Commit Graph

3832 Commits

Author SHA1 Message Date
Paul Gschwendtner 78efc406ba WIP STYLING: improve comment correctness styling 2023-07-14 15:30:48 +00:00
Paul Gschwendtner c277e88b22 WIP STYLING: styling findings/reversing 2023-07-14 15:30:45 +00:00
Paul Gschwendtner 574b1c276d test: setup signal acceptance tests to also run with AOT compilation
This allows us to test the template pipeline TS emit (where we already
caught a bug using this), and also allows us to test the proper
recognition of e.g. `input`, `output`, `viewChild` etc- while also
testing type-checking.
2023-07-14 13:12:41 +00:00
Paul Gschwendtner 8ef145fa1b feat(compiler): support public aliases for signal output API 2023-07-14 13:12:41 +00:00
Paul Gschwendtner 94f2daaa1c feat(compiler): support signal-based output API
* Detect and recognize outputs for type-checking and definition
  generation
* Add compliance tests & fake core infrastructure
* Add playground example
2023-07-14 13:12:41 +00:00
Paul Gschwendtner ffc61749ff test: rework and enable outputs test to verify functionality 2023-07-14 13:12:41 +00:00
Pawel Kozlowski a4cb2e671c feat(core): add runtime support for outputs in signal components
Runtime implementation is very simple - it adds the output function that
acts as an alias to the existing EventEmitter class constructor.
2023-07-14 13:12:41 +00:00
Paul Gschwendtner 5f9bd59b14 feat(compiler): support signal based content queries
Compiler portion for supporting content queries in signal components.
This is based on the preparation work, for detecting such queries. See
previous commits.
2023-07-14 13:12:40 +00:00
Pawel Kozlowski cfd466dfbb feat(core): reactive content queries
Runtime part of the reactive content queries.
2023-07-14 13:12:40 +00:00
Pawel Kozlowski 61ce057a09 test(core): add test for QueryList.onDirty callback
Add a test verifying that the onDirty callback:
- does not fire initially;
- fires once when a query is marked dirty (even if there are
multiple setDirty notifications).
2023-07-14 13:12:40 +00:00
Pawel Kozlowski 8dc6c9fe22 fix(core): adjust reactive query types
Improvements to the types signature in viewChild / viewChildren.
2023-07-14 13:12:40 +00:00
Paul Gschwendtner e71e900708 feat(compiler): support generating queries for signal components 2023-07-14 13:12:40 +00:00
Pawel Kozlowski 1168fd585f fixup! refactor(core): rename queryCreate to viewQueryCreate 2023-07-14 13:12:40 +00:00
Pawel Kozlowski 18ea007390 refactor(core): rename queryCreate to viewQueryCreate
In the end we need to distinguish between view and content query
creation and need separate names for those instructions.
2023-07-14 13:12:40 +00:00
Pawel Kozlowski 6b0e1c7703 feat(core): reactive queries
Initial runtime implementation of the reactive view queries
(in preparation for the compiler work).
2023-07-14 13:12:40 +00:00
Pawel Kozlowski 6b89ce9e27 fix(core): fix stringify logic for interpolated values
Make sure that null, undefined and NaN interpolated values
are rendered consistently with the current ivy approach:
- null and undefined are rendered as empty strings;
- NaN is rendered as-is.
2023-07-14 13:12:40 +00:00
Paul Gschwendtner 0bf724f4d4 feat: support property interpolation in signal components 2023-07-14 13:12:40 +00:00
Pawel Kozlowski 7acf163f51 test: fix signal tests after property binding changes
Property bindings are wrapped into computed now.
2023-07-14 13:12:40 +00:00
Pawel Kozlowski 97d6781be7 refactor(core): fix lint issues
Fixing lint issues that I've just introduced...
2023-07-14 13:12:40 +00:00
Pawel Kozlowski f12e8e3ea2 feat(core): introduce property interpolation and make DOM property bindings reactive
DOM bindings are wrapped into computed now so their values
are memoized. As the result expression in DOM bindings are
re-evaluated when a component is change-detected.
2023-07-14 13:12:40 +00:00
Paul Gschwendtner 5fa6ce3e61 WIP: Implement type-checking for signal inputs
New implementation of type-checking for signal inputs. Much simpler, and
without causing signficant type check block changes that would require
more changes to the language service completion logic / or rewrites of
more than 50+ handwritten code output tests for type check blocks.

See previous commits for other explored solutions.
2023-07-14 13:12:40 +00:00
Pawel Kozlowski 48f4f86835 test: add basic test for event listeners
Adding a passing test for a listener invocation
that changes signal value.
2023-07-14 13:12:39 +00:00
Pawel Kozlowski 183c92baed Revert "feat(core): propertyInterpolationCreate"
This reverts commit 2e3fe0747990647c5cfbba5429e90ed621b18e6e.

Based on the recent design discussion we are going to express property
interpolation as a computed function and reuse the propertyCreate
infrastructure.
2023-07-14 13:12:39 +00:00
Alex Rickabaugh e03ccb60ed wip: support local references in signal property bindings
This commit adds support for local refs in signal property bindings, by
generating variables in the creation block. To implement this support:

* a new instruction shallowReference() is introduced, which is not tied to
  the current view context.
* variables are now generated for creation mode as well as update mode
* a new template pipeline pass (`phaseCreationVarColocation`) handles
  ordering of reference variable declaration and assignment in the creation
  block (guaranteeing references are only read after declarations).
2023-07-14 13:12:39 +00:00
Paul Gschwendtner 0a7a8e496e test: disable input signal initialization test
Still needs to be implemented and discussed.
2023-07-14 13:12:39 +00:00
Pawel Kozlowski 41f8584aad feat(core): propertyInterpolationCreate
Skeleton of the propertyInterpolationCreate instruction.
2023-07-14 13:12:39 +00:00
Paul Gschwendtner 4b8e6b36ab build: fix lint errors 2023-07-14 13:12:39 +00:00
Pawel Kozlowski 4c58b2f8cf test: add failing tests for property interpolation
Adding failing tests for the property interpolation so we
keep those instructions on our radar.
2023-07-14 13:12:39 +00:00
Pawel Kozlowski 1d1338fced test: binding to a mix of zone and signal inputs
This commit adds a test for a case of a binding targetting
multiple inputs with the same name. Test passes for both
signal based components as well as a mix of zone and signal
based components.
2023-07-14 13:12:39 +00:00
Pawel Kozlowski 1344da62ad test: enable passing tests after recent code changes
Enabling newly passing tests.
2023-07-14 13:12:39 +00:00
Alex Rickabaugh 0c821b28f3 wip: one calculation for many input targets
Wrap bound expressions in `computed` where necessary to ensure all consumers
of a binding see the same value.
2023-07-14 13:12:39 +00:00
Alex Rickabaugh ebef1a592a wip: ignore dep polling when input signals change their backing
Previously, input signals had a bug where when their backing computation or
value would change, it would notify consumers, but consumers would poll the
input signal to check if its value really changed. This polling operation
would transitively poll the input signal's previous dependencies, which of
course would report that they hadn't changed.

This commit adds logic in the `InputSignalImpl` to skip dependency polling
whenever the signal's backing computation or value changes, until that value
is read for the first time.
2023-07-14 13:12:39 +00:00
Paul Gschwendtner 4c97f56223 fixup! wip: specialize virtual instructions
Fix bundle size tests after core changes for virtual update
2023-07-14 13:12:39 +00:00
Paul Gschwendtner ccf0dc1884 test: add test to ensure variable bindings work 2023-07-14 13:12:38 +00:00
Paul Gschwendtner 732e45a730 WIP: prepare tests for failing scenarios discovered during collab
* Local refs needs more testing
* Basic variable read failed
* We do not have any tests for listeners? there was some restore view
  issue: https://github.com/angular/angular/commit/3acfdf4861d5eeed5b2ad42978547da929cc3567
2023-07-14 13:12:38 +00:00
Pawel Kozlowski 399e173d8c fix(core): properly bind to the same input from multiple views
Before this fix bindings to the same input from multiple LViews didn't
work properly as the binding expression was assigned to LView only on
the first create pass (instead of assigning on each durective usage pass).
2023-07-14 13:12:38 +00:00
Alex Rickabaugh 05ecc619fc wip: allocate vars for PropertyCreateOp
This commit adds the `ConsumesVarsTrait` to `PropertyCreateOp` which causes
vars to be counted for use in the virtual instructions it might add. This
allows the DOM test to pass.
2023-07-14 13:12:38 +00:00
Pawel Kozlowski 52f508ab4d test: failing test case for non-primitive literals in a template 2023-07-14 13:12:38 +00:00
Pawel Kozlowski 2a61fea64b test: add test veryfing bindings to multiple directives 2023-07-14 13:12:38 +00:00
Pawel Kozlowski 10c1ae5b6e test: add failing test for dom property bindings
The test is skipped as we are not propagating number of vars
based on the bindings found in a template.
2023-07-14 13:12:38 +00:00
Pawel Kozlowski 9208e64e74 test: re-organize tests 2023-07-14 13:12:38 +00:00
JoostK 65d45e4919 test: add test to bind a signal to a signal input 2023-07-14 13:12:38 +00:00
JoostK 080bdfa77f test: allow signal component test to pass 2023-07-14 13:12:38 +00:00
Alex Rickabaugh a90dc4310c wip: bypass pure functions in input computations 2023-07-14 13:12:38 +00:00
Alex Rickabaugh 2426b2e1f1 wip: fix signals test
(required and initial values for inputs are mutually incompatible)
2023-07-14 13:12:38 +00:00
Alex Rickabaugh 912c7252f8 wip: switch to the real input() implementation 2023-07-14 13:12:38 +00:00
Paul Gschwendtner 8e64d9e1d8 refactor: fix lint warnings 2023-07-14 13:12:38 +00:00
Paul Gschwendtner 4d7b23e99e refactor: wire up propertyCreate instruction for JIT generation 2023-07-14 13:12:38 +00:00
Paul Gschwendtner 59d278c07c WIP: setup template pipeline acceptance tests on CI and base setup 2023-07-14 13:12:38 +00:00
Pawel Kozlowski 7e1de8cb6a refactor: making CI green-ish
Would be great to keep CI green, making changes in this direction.
2023-07-14 13:12:37 +00:00