4048 Commits

Author SHA1 Message Date
Paul Gschwendtner 836530fdfd test: update symbol golden for defer
The golden JSON file is from  and doesn't support the virtual instruction
logic we've added in the signals branch. Surprisingly, this shows that something
is wrong with this test.
2023-10-13 10:37:48 +00:00
Paul Gschwendtner ca81661c95 fix(core): fix property_create instruction breaking binding to Zone targets
The property create instruction is currently failing to bind to Zone
targets if there is no advance call before the virtual instruction
that selects the intended element.
2023-10-12 17:29:21 +00:00
Paul Gschwendtner 5bf5cac714 refactor(core): rework queries to work with new signal graph API 2023-10-12 17:29:21 +00:00
Paul Gschwendtner 70861909a7 refactor(core): add more signal todos for input signal 2023-10-12 17:28:05 +00:00
Paul Gschwendtner c8ac2b6d1e 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-10-12 17:28:05 +00:00
Paul Gschwendtner 51ce1d6228 feat(compiler): support public aliases for signal output API 2023-10-12 17:27:39 +00:00
Paul Gschwendtner f79b106dfc 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-10-12 17:27:39 +00:00
Paul Gschwendtner 7504f24fe2 test: rework and enable outputs test to verify functionality 2023-10-12 17:27:39 +00:00
Pawel Kozlowski 63084b6502 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-10-12 17:27:39 +00:00
Paul Gschwendtner 0dbccabdf9 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-10-12 17:27:39 +00:00
Pawel Kozlowski 1d2f7545c5 feat(core): reactive content queries
Runtime part of the reactive content queries.
2023-10-12 17:27:39 +00:00
Pawel Kozlowski bf16d7e414 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-10-12 17:27:39 +00:00
Pawel Kozlowski 6106fcf4c7 fix(core): adjust reactive query types
Improvements to the types signature in viewChild / viewChildren.
2023-10-12 17:27:39 +00:00
Paul Gschwendtner 3e01740e43 feat(compiler): support generating queries for signal components 2023-10-12 17:27:39 +00:00
Pawel Kozlowski 968700c5f9 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-10-12 17:27:39 +00:00
Pawel Kozlowski c77976d9aa feat(core): reactive queries
Initial runtime implementation of the reactive view queries
(in preparation for the compiler work).
2023-10-12 17:27:39 +00:00
Pawel Kozlowski 2c754081e1 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-10-12 17:27:38 +00:00
Paul Gschwendtner 1a2a6659a0 feat: support property interpolation in signal components 2023-10-12 17:27:38 +00:00
Pawel Kozlowski 1067f8a439 test: fix signal tests after property binding changes
Property bindings are wrapped into computed now.
2023-10-12 17:27:38 +00:00
Pawel Kozlowski e94b474b96 refactor(core): fix lint issues
Fixing lint issues that I've just introduced...
2023-10-12 17:27:38 +00:00
Pawel Kozlowski 34f002db7e 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-10-12 17:27:38 +00:00
Paul Gschwendtner c09cace82b 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-10-12 17:27:38 +00:00
Pawel Kozlowski b263c00d36 test: add basic test for event listeners
Adding a passing test for a listener invocation
that changes signal value.
2023-10-12 17:27:20 +00:00
Pawel Kozlowski 3bd2fcd044 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-10-12 17:27:20 +00:00
Alex Rickabaugh 7feda88abb 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-10-12 17:27:20 +00:00
Paul Gschwendtner 5264c18b53 test: disable input signal initialization test
Still needs to be implemented and discussed.
2023-10-12 17:26:52 +00:00
Pawel Kozlowski f5edc3e9a8 feat(core): propertyInterpolationCreate
Skeleton of the propertyInterpolationCreate instruction.
2023-10-12 17:26:52 +00:00
Paul Gschwendtner 9bf377a424 build: fix lint errors 2023-10-12 17:26:52 +00:00
Pawel Kozlowski 0eced157a9 test: add failing tests for property interpolation
Adding failing tests for the property interpolation so we
keep those instructions on our radar.
2023-10-12 17:26:52 +00:00
Pawel Kozlowski 5dea0312d6 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-10-12 17:26:52 +00:00
Pawel Kozlowski 7b15e261ad test: enable passing tests after recent code changes
Enabling newly passing tests.
2023-10-12 17:26:51 +00:00
Alex Rickabaugh a59dcb52bd 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-10-12 17:26:51 +00:00
Paul Gschwendtner 24d689730d test: add test to ensure variable bindings work 2023-10-12 17:26:51 +00:00
Paul Gschwendtner 6310ccc221 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-10-12 17:26:51 +00:00
Pawel Kozlowski faf5b21275 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-10-12 17:26:51 +00:00
Alex Rickabaugh 317ddb0d00 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-10-12 17:26:51 +00:00
Pawel Kozlowski b7f33034e8 test: failing test case for non-primitive literals in a template 2023-10-12 17:26:51 +00:00
Pawel Kozlowski a79e202f33 test: add test veryfing bindings to multiple directives 2023-10-12 17:26:51 +00:00
Pawel Kozlowski 92f4d0127f 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-10-12 17:26:51 +00:00
Pawel Kozlowski 43cf37aa3e test: re-organize tests 2023-10-12 17:26:51 +00:00
JoostK 41db51bf91 test: add test to bind a signal to a signal input 2023-10-12 17:26:51 +00:00
JoostK 1ae67024cb test: allow signal component test to pass 2023-10-12 17:26:51 +00:00
Alex Rickabaugh d56cbc2fdf wip: bypass pure functions in input computations 2023-10-12 17:26:50 +00:00
Alex Rickabaugh 49cbecaeab wip: fix signals test
(required and initial values for inputs are mutually incompatible)
2023-10-12 17:26:50 +00:00
Alex Rickabaugh a6702e92aa wip: switch to the real input() implementation 2023-10-12 17:26:50 +00:00
Paul Gschwendtner dadd751a48 refactor: fix lint warnings 2023-10-12 17:26:50 +00:00
Paul Gschwendtner 48054443da refactor: wire up propertyCreate instruction for JIT generation 2023-10-12 17:26:50 +00:00
Paul Gschwendtner 84e0908b29 WIP: setup template pipeline acceptance tests on CI and base setup 2023-10-12 17:26:50 +00:00
Alex Rickabaugh 0f228885bf wip: working signal input and all 3 binding types 2023-10-12 17:26:50 +00:00
Alex Rickabaugh af93b126dd wip: specialize virtual instructions
* splits propertyCreate virtual instructions into DOM vs zone inputs
* integrates with `InputSignal` setting (untested)
* deletes old interfaces/virtual_property impl in favor of Paul's
2023-10-12 17:26:50 +00:00