Commit graph

100 commits

Author SHA1 Message Date
iteriani
92bb8d974b refactor(core): Use the retrieve method in the implementation of injectInjectorOnly (#60192)
This should keep the existing behavior intact. Right now retrieve never returns back NOT_FOUND. This should not be the case, but tests fail if I do add this behavior so itll have to be later.

PR Close #60192
2025-03-10 11:38:13 -07:00
iteriani
ac94604ef2 refactor(core): Remove the optional flag from Injector and all casts. (#60154)
Note that this does NOT use the retrieve method yet. I believe we need to move the logic for notFoundValue into the inject implementation.

PR Close #60154
2025-03-05 13:43:59 -08:00
Taygan Caldwell
1d3b9148d3 refactor: add untracked to primitives (#60105)
add untracked to primitives to allow Wiz to use it

PR Close #60105
2025-03-05 12:11:40 -08:00
Andrew Scott
a3575e204a refactor(core): Update push/replace navigation to not trigger popstate (#60028)
This matches the spec, though there is a bug in chrome that does trigger these events.

PR Close #60028
2025-03-03 18:40:58 +00:00
Andrew Scott
2e8b84f086 refactor(core): Update fake navigation to more closely follow the spec (#60028)
This commit updates the implementation of the fake navigation to more
closely follow the spec. This includes links to spec parts as well as
some reorganization to have the flow of the code more exactly follow the
corresponding steps in the spec. This makes it easier to verify that th
behavior is correct.

PR Close #60028
2025-03-03 18:40:58 +00:00
Andrew Scott
ae9c7225d4 refactor(core): Ensure fake navigation is not aborted after it succeeds (#60028)
The navigate event was only ever being cleared when a new navigation
happened. That new navigation would abort the previous one, even if it
had already finished successfully.

PR Close #60028
2025-03-03 18:40:58 +00:00
iteriani
78b27a83fb refactor(core): Move getCurrentInjector/setCurrentInjector to primitives package. (#60090)
This change casts the injector back and forth since all instances of
injector currently don't implement the `retrieve` method. Note that
the retrieve method is seen as optional, so that Angular can revert back to
inject if necessary.

PR Close #60090
2025-02-28 18:47:08 +00:00
Andrew Scott
8657a0e4cc refactor(core): Add fake navigation to primitives for code sharing (#59857)
This moves the `FakeNavigation` implementation to the primitives folder
so its implementation can be shared with Wiz. This class was initially
copied directly from the Wiz implementation, with some small modifications.
There will still need to be some work done to align the implementations
and fix anything internally that needs adjusting.

PR Close #59857
2025-02-19 20:09:10 +00:00
iteriani
8b757bf35c refactor(core): Check in some interfaces for the DI package (#59921)
This will be the starting point of the DI package. We will first check in some interfaces and then make sure the existing DI package implements that interface. Afterwards, we'll slowly start moving injector implementation.

PR Close #59921
2025-02-13 20:19:29 +00:00
Matt Turco
2588985f43 feat(core): pass signal node to throwInvalidWriteToSignalErrorFn (#59600)
Updates the signature of the `throwInvalidWriteToSignalError` to take the signal node in question and pass it along to the throwInvalidWriteToSignalErrorFn handler function. This allows the handler to e.g. include the signal name in error messaging.

PR Close #59600
2025-02-13 17:56:14 +00:00
Sebastian Ochoa
65cf061feb fix(platform-browser): Update pseudoevent created by createMouseSpecialEvent to populate _originalEvent property (#59690)
This fixes an internal bug

PR Close #59690
2025-01-27 10:28:58 +01:00
Sebastian Ochoa
af9d74710c fix(platform-browser): Update pseudoevent created by createMouseSpecialEvent to populate _originalEvent property (#59690)
This fixes an internal bug.

PR Close #59690
2025-01-27 10:28:58 +01:00
Pawel Kozlowski
04c24472d2 refactor(core): move linkedSignal implementation to primitives (#59501)
This change refactors the Angular-specific linkedSignal implementation
such that its core logic can be shared with other frameworks.

PR Close #59501
2025-01-21 07:58:09 -08:00
Leon Senft
f8b8e80d79 fix(core): treat exceptions in equal as part of computation (#55818)
Prevent leaking signal reads and exceptions from a custom `equal`
function of a producer `computed()` to a consumer.

Upstream https://github.com/tc39/proposal-signals/pull/90 with a notable
change: Angular does **not** track reactive reads in custom `equal`
implementations.

PR Close #55818
2025-01-16 08:10:10 -08:00
Johnson Chu
a6cdbec09f refactor: remove unnecessary TSLint rule flags (#59365)
There are many TSLint rule flags in the source code that have no effect, and they can be safely removed to keep the code clean.

PR Close #59365
2025-01-07 16:06:21 +00:00
Tom Wilkinson
8780399234 refactor(core): Remove event_contract_multi_container (#59059)
This code has been moved internally.

PR Close #59059
2024-12-05 15:24:43 -08:00
AleksanderBodurri
fa0a9a5dde refactor(core): add "kind" to signal prototype nodes (#58333)
Enables debug APIs to determine the kind of a signal given a node.

PR Close #58333
2024-12-03 15:15:50 +01:00
Jessica Janiuk
f2bda8e3fc fix(core): prevent errors on contract cleanup (#58614)
If contract cleanup is called more than once, the assertion that the container manager will be present results in exceptions.

PR Close #58614
2024-11-12 17:25:50 +00:00
Yong Su
bba8cc5d86 refactor(core): allow passing passive option to addEvent (#58316)
For scroll-blocking events like 'touchstart', 'touchmove', 'wheel' and 'mousewheel',
if passive option is not specified when adding the event listener, browser may give
a violation warning.

This PR allows us to set the passive option when calling event lib's addEvent().

PR Close #58316
2024-10-24 17:49:26 -07:00
Pawel Kozlowski
dd407a7132 refactor(core): expose producerMarkClean utility (#58228)
This commit exposes the new producerMarkClean utility that
makes it possible to mark a reactive node as clean following
changes to the node's value. In practice it resets the dirty
flag and all other internal flags as need. Prior to this change
the cleanup code was duplicated.

The new utility will be used in the linkedSignal implementation.

PR Close #58228
2024-10-17 18:09:16 +00:00
AleksanderBodurri
837af44510 refactor(core): introduce debugName optional arg to ReactiveNode (#57710)
This commit contains the changes to core/primitives that used to be in https://github.com/angular/angular/pull/57073.

PR Close #57710
2024-10-07 09:25:28 -07:00
Joey Perrott
9dbe6fc18b refactor: update license text to point to angular.dev (#57901)
Update license text to point to angular.dev instead of angular.io

PR Close #57901
2024-09-24 15:33:00 +02:00
Thomas Nguyen
7a99815146 fix(core): Do not bubble capture events. (#57476)
These should only fire if the target is the same as the targetElement. Also, delete an out of date test since capture/non-capture tests are separately covered.

PR Close #57476
2024-08-23 14:46:54 -07:00
Thomas Nguyen
8bea2e3965 refactor(core): Call stopPropagation and preventDefault unconditionally within the patched methods. (#57354)
This fixes a few tests in g3 and is a bug fix for the event dispatcher. Otherwise, bubbling might
continue.

PR Close #57354
2024-08-13 12:09:56 -07:00
Thomas Nguyen
2a915d1912 refactor(core): Remove clickmod support from Angular. (#57201)
This was an old feature that mapped shift + click (et al) to "clickmod". This doesn't really make sense to add to Angular, so let's remove it.

PR Close #57201
2024-08-02 14:20:53 +00:00
Tom Wilkinson
83117f1a0d refactor(core): Switch to using concat rather than spread operator for events. (#57103)
Internally, the JSCompiler does not dead code eliminate this code when its using spread.

PR Close #57103
2024-07-23 15:54:23 -07:00
Tom Wilkinson
425f44c133 refactor(core): Move logic into early event contract files. (#56994)
Also remove some dead a11y code, now that a11y is in `ActionResolver`.

PR Close #56994
2024-07-18 12:05:17 -07:00
Tom Wilkinson
d011c9f7ba refactor(core): Refactor EarlyEventContract to prepare for using it as a container. (#56900)
This is the first step towards combining `EarlyEventContract` and `EventContract`. It contains a few refactors, such as making names more consistent.

The goal of this refactor is to remove the `EarlyEventContract` class altogether, as well as `EventContract`.

To install the early event contract with the default events in early script tag, users will call:

`bootstrapGlobalEarlyEventContract()`

And for boostraping:

`registerGlobalDispatcher(dispatcher)`

PR Close #56900
2024-07-10 13:53:03 -07:00
Tom Wilkinson
6271a16755 refactor(core): Remove unused A11Y_CLICK_SUPPORT define. (#56901)
This behavior was moved to be configured by a runtime boolean, rather
than a define.

PR Close #56901
2024-07-10 15:50:39 +02:00
Thomas Nguyen
551027e04e refactor(core): Set the jsaction cache directly instead of using jsaction attribute. (#56747)
This should make things somewhat faster, since setAttribute can be slower than addEventListener. Jsaction attribute is still needed for SSR though.

PR Close #56747
2024-07-01 17:31:24 +00:00
Alex Rickabaugh
46b0292261 refactor(core): export additional methods from primitives/signals (#56759)
Export `producerIncrementEpoch` which was missing before, as well as a new
`runPostSignalSetFn` helper. These changes make it easier to write `signal`-
like utilities which don't use the `createSignal` abstraction.

PR Close #56759
2024-07-01 14:39:44 +00:00
Tom Wilkinson
040d86137e refactor(core): Remove dom.ts and use native Element.prototype.contains. (#56591)
Delete the entire dom.ts file, it is no longer needed.

PR Close #56591
2024-06-27 18:28:19 +00:00
Tom Wilkinson
3773f406ac refactor(core): Remove ActionResolver code from EventContract (#56723)
Now that all `Dispatcher` implementations use `ActionResolver`, `EventContract` no longer needs to. Additionally, all a11y click support has been removed. `EventContract` will not specifically listen for `keydown` automatically, as all `EventContract` instances already have `keydown` listeners. This removes the need for the `A11Y_CLICK_SUPPORT` define, which will be removed in a future PR.

PR Close #56723
2024-06-27 18:27:44 +00:00
Tom Wilkinson
60a72af163 refactor(core): Remove attribute, char, and property values for ActionFlow. (#56590)
These values are inlined in ActionFlow internally in google3, and are no longer used.

Do some additional cleanup to only define the properties once.

PR Close #56590
2024-06-27 18:27:15 +00:00
Tom Wilkinson
1d28fbb84c refactor(core): Use ActionResolver in Dispatcher. (#56369) (#56369)
`EventContract` usages in Angular now use `false` for
`useActionResolver`. Tests have been updated, with functionality that
depends on `ActionResolver` moving to dispatcher_test.ts.

PR Close #56369

PR Close #56369
2024-06-26 08:49:30 -07:00
Andrew Kushnir
fca5764564 Revert "refactor(core): Use ActionResolver in Dispatcher. (#56369)" (#56440)
This reverts commit 4ebd2853fa.

PR Close #56440
2024-06-13 12:17:35 -07:00
Tom Wilkinson
4ebd2853fa refactor(core): Use ActionResolver in Dispatcher. (#56369)
`EventContract` usages in Angular now use `false` for
`useActionResolver`. Tests have been updated, with functionality that
depends on `ActionResolver` moving to dispatcher_test.ts.

PR Close #56369
2024-06-13 08:50:45 -07:00
Thomas Nguyen
6e89ef1ebf refactor(core): Refactor parts of event_replay into a shared library that will be used with global event delegation. (#56172)
This also moves the code that stashes the jsaction more closely to the code that actually sets the event listener.

PR Close #56172
2024-06-05 16:35:23 +00:00
Tom Wilkinson
a65c1cf109 refactor(core): Add and move tests for Dispatcher. (#56193)
Move tests from `eventcontract_test.ts` to `dispatcher_test.ts` for
functionality that lives in `Dispatcher`.

Add an extra test for `preventDefault` behavior for `CLICKMOD` that
covers a previous bug case.

PR Close #56193
2024-06-04 18:05:39 +00:00
Tom Wilkinson
b6fb53cdc7 fix(core): Fix shouldPreventDefaultBeforeDispatching bug (#56188)
When I copied this over in caedd10597
the parentheses moved around the A tag check and the CLICK type check,
instead of around the CLICK and CLICKMOD check.

PR Close #56188
2024-05-30 17:54:55 +00:00
Alex Rickabaugh
1081c8d623 fix(core): don't coerce all producers to consumers on liveness change (#56140)
When a consumer switches its liveness state, it gets added to / removed from
the consumer list of all of its producers. This operation is transitive, so
if its producer is *also* a consumer and *its* liveness state is switched,
then the change is applied recursively.

Note that this only matters *if* the producer is also a consumer. However,
the logic in `producerAddLiveConsumer` / `producerRemoveLiveConsumerAtIndex`
coerced the producer node into a producer & consumer node, which allocated
extra arrays into the node structure that are never used. This didn't affect
correctness, but increased the memory usage of plain signal nodes (which are
just producers, never consumers).

This fix changes the logic in those operations to simply check if a producer
is also a consumer instead of coercing it into one.

PR Close #56140
2024-05-30 17:44:55 +00:00
Thomas Nguyen
e286d3cd3b refactor(core): Remove lambda from error message. (#56161)
This should've been in the previous PR, but a bad rebase removed it.

PR Close #56161
2024-05-30 17:30:53 +00:00
Thomas Nguyen
caeb7042b0 refactor(core): Switch a .includes to a .indexOf(), as this is currently (#56046)
breaking internal tests that assert no usage of Array ES6 methods.

PR Close #56046
2024-05-30 15:30:52 +00:00
Thomas Nguyen
1223122080 refactor(core): Use event_dispatcher in event_replay code. (#56036)
This makes events bubble! This change also contains changes to
dispatcher and event_dispatcher to make replay synchronous,
so that we avoid odd timing issues. This can be split out though.

Lastly, we have one cleanup change to move the mapping from
event type to functions on the element itself.

PR Close #56036
2024-05-29 12:59:23 +02:00
Thomas Nguyen
690b0fb9af refactor(core): Create event types that are able to be serialized, captured, or are mouse events. (#55799)
Use these constants across jsaction and Angular.

PR Close #55799
2024-05-23 16:10:47 +02:00
Tom Wilkinson
fdd59c49fe refactor(core): Add a new EventDispatcher class. (#55837)
`EventDispatcher` emulates the browser's event dispatch (mostly).
It supports:
 - Bubbling and `stopPropagation`/`stopImmediatePropagation`.
 - `currentTarget` during dispatch.
 - Throwing errors for `preventDefault` if the event is being dispatched
   in replay.
 - Throwing errors for `composedPath()` if event is being dispatched in
   replay.

PR Close #55837
2024-05-22 15:24:01 -07:00
Tom Wilkinson
bb13174bd1 refactor(core): Add a bit to EventInfo to mark resolution. (#55864)
This will prevent running `ActionResolver` logic multiple times while
migrating to use `Dispatcher` to resolve actions rather than
`EventContract`.

PR Close #55864
2024-05-21 12:20:48 -07:00
Tom Wilkinson
834e627d9e refactor(core): Remove legacy_dispatcher.ts which is no longer needed. (#55784)
Also use `dispatchDelegate` by default for `eventReplayer`.

PR Close #55784
2024-05-20 23:36:51 -07:00
Rahat Ahmed
f7894885b8 refactor(core): Cleanup dead jsnamespace code (#55795)
Support for the jsnamespace attribute was removed in #55619.

PR Close #55795
2024-05-17 12:59:41 -07:00
Tom Wilkinson
f1e3ec2601 refactor(core): Add an ActionResolver option to Dispatcher. (#55757)
This will enable internal usages to migrate from ActionResolver in
EventContrat to ActionResolver in Dispatcher.

PR Close #55757
2024-05-14 15:16:26 -07:00