Commit graph

176 commits

Author SHA1 Message Date
N. Coury
057cc6d09d fix(core): remove obsolete iOS cursor pointer hack in event delegation
Since WebKit commit 67a62d98 (merged for iOS 13), WebKit no longer restricts
click event bubbling to interactable nodes like `div` or `body`. The
`cursor: pointer` hack polyfill is therefore obsolete and can safely be
removed without breaking JSAction behavior.

(cherry picked from commit a24179e125)
2026-04-08 18:31:34 +00:00
SkyZeroZx
0b08e29f26 test(core): refactors test to use timeout utility
Replaces direct `setTimeout` wrapped in a Promise with the `timeout` helper from `@angular/private/testing`

(cherry picked from commit c15e3a005d)
2026-04-01 20:46:05 +02:00
JoostK
a8f80c1f99 refactor(core): declare explicit reactive node prototypes types
These type annotations allow TS to associate the object's properties
with their corresponding declaration in the interfaces, enabling
much better code navigation. For example, "Find all implementations"
for `ReactiveNode.producerRecomputeValue` now finds the implementation
in `COMPUTED_NODE` and `LINKED_SIGNAL_NODE`.

(cherry picked from commit 1eaf92077f)
2026-03-17 13:00:15 -07:00
JoostK
bf948be4c2 fix(core): run linked signal equality check without reactive consumer
This commit ports the changes in #55818 from `computed` to `linkedSignal`,
which duplicates the core logic to recompute the downstream value for an
upstream change.

(cherry picked from commit 523d69a768)
2026-03-17 12:59:42 -07:00
Alan Agius
5d755be01c refactor: ensure modules with 'declare global' are correctly handled by Rollup
Explicitly adding an `export {}` to modules containing `declare global` fixes an issue where Rollup would incorrectly claim that the `global` variable is not defined in the emitted `.d.ts` files.

Needed to land the latest `rules_angular`.

(cherry picked from commit bb628d8b50)
2026-03-12 13:58:03 -07:00
Alan Agius
7907e982ee test: remove duplicate tests
These tests are duplicate and have been removed.
2026-03-11 13:35:26 -07:00
JoostK
21b1c3b2ee fix(core): include signal debug names in their toString() representation
The `toString()` implementations in the primitives package intended to include
the debug name, yet the debug name was evaluated during construction before it
could ever have been assigned. This commit fixes that.

The Angular wrappers override the `toString()` representation to evaluate signals
ad-hoc instead of showing their internal state, and this commit aligns their
behavior to include the debug name in `toString` as well.

(cherry picked from commit b401c18674)
2026-03-11 18:28:39 +00:00
Shuaib Hasan Akib
2f213de593 refactor(core): remove outdated TODO comments
Cleans up TODO comments that are no longer planned

Fixes #67191

(cherry picked from commit 5ac1c025f9)
2026-02-23 18:19:57 +00:00
Alex Rickabaugh
aff9e36a98 fix(core): linkedSignal.update should propagate errors
Unlike a normal `signal()`, a `linkedSignal()` can be in an error state when
its computation fails. Currently, there's a bug where `linkedSignal.update`
does not account for this error state, and will pass the internal `ERRORED`
`Symbol` as the current value to the updater function.

This commit fixes the issue by having `update()` check and throw the error
instead of calling the updater function.
2026-02-02 12:21:28 -08:00
SkyZeroZx
d072791f13 refactor(core): remove unused restriction parameter
Removes the `restriction` parameter from `registerAppScopedDispatcher` and `registerGlobalDispatcher`.
2026-01-28 20:54:46 +00:00
Shuaib Hasan Akib
1b4dcc01ff docs: replace old https://angular.io/license with https://angular.dev/license 2026-01-12 13:41:30 -08:00
Andrew Scott
49295778bc refactor(core): Use the provided Document value rather than global in FakeNavigation
This commit ensures the Document used by `FakeNavigation` is the one
passed in the constructor rather than the global `document`, which may
be different.
2026-01-08 13:28:18 -08:00
Andrew Scott
86dc1283e8 fix(core): handle cancelled traversals in fake navigation
Update fake navigation implementation to correctly handle traversals that are cancelled (e.g. by a precommit handler).
Ensure prospective index is calculated correctly so that subsequent traversals target the correct entry.
Add regression test for cancelled traversals.
2026-01-08 11:27:37 -08:00
Andrew Seguin
e2a9938c51 fix(core): explicitly cast signal node value to String
If the computed's `toString` is called and `node.value` is a Symbol, the browser will throw an exception `ERROR TypeError: Cannot convert a Symbol value to a string`

Symbols cannot be implicitly changed to strings. This change changes the conversion to be explicit by wrapping `node.value` with `String()`

This can be reproduced if you create a computed with `createComputed(computation, equal)` and call `toString()` while `node.value` is something like `Symbol(UNSET)`
2025-12-17 14:38:38 -08:00
Andrew Kushnir
9fa77af110 Revert "fix(core): explicitly cast signal node value to String"
This reverts commit c501b25d04.
2025-12-16 17:37:34 -08:00
Andrew Seguin
c501b25d04 fix(core): explicitly cast signal node value to String
If the computed's `toString` is called and `node.value` is a Symbol, the browser will throw an exception `ERROR TypeError: Cannot convert a Symbol value to a string`

Symbols cannot be implicitly changed to strings. This change changes the conversion to be explicit by wrapping `node.value` with `String()`

This can be reproduced if you create a computed with `createComputed(computation, equal)` and call `toString()` while `node.value` is something like `Symbol(UNSET)`
2025-12-16 16:38:02 -08:00
Matthieu Riegler
6270bba056 ci: reformat files
This is after we've slightly changed a rule in #66056
2025-12-16 14:44:19 -08:00
Andrew Scott
5988bdedae refactor(core): Add transition.to property to FakeNavigation
This matches the upstream changes in f19930f98a
2025-12-10 10:18:08 -08:00
Andrew Scott
d355205198 refactor(core): match spec updates for FakeNavigation
Updates FakeNavigation based on updates in https://github.com/whatwg/html/pull/11952
2025-12-10 08:19:23 -08:00
Matthieu Riegler
5b720aa2eb refactor(core): show error message on signal error
When a signal throws an error on read. The formatter will show the error message.
2025-11-26 13:11:07 -05:00
tsc036
34e1fe235f
refactor(core): export profile event as enum and move profile_types.ts and framework to shared devtools folder
move framework enum and profile_types to a shared folder so it can be used by wiz
2025-11-19 15:22:49 -08:00
Matthieu Riegler
1b895fece6 refactor(core): flip ngDevMode condition for formatter
In cases the `ngDevMode` flag hasn't been set, still enable the formatter. What matters is if `ngDevMode` is `false ` we tree shake that away.
2025-11-13 10:01:10 -08:00
Doug Parker
490435bf76 fix(core): skip Angular formatting when formatting signals recursively
The flag `skipFormatting` got renamed to `ngSkipFormatting` during review of https://github.com/angular/angular/pull/64000, but a couple usages got missed, causing some unfortunate UI recursion.
2025-11-11 10:14:30 -08:00
Andrew Scott
8bccd8671c refactor(core): Extract NavigateEvent cancel steps based on recent spec update
This updates the cancel/abort steps of fake navigation to match the
current spec.

Relevant commit seems to be
* b0b40cca16
2025-11-07 12:54:14 -08:00
Andrew Scott
7a5ac69144 refactor(core): Update commit steps of PlatformNavigation fake to match spec updates
Brings commit steps in line with recent spec updates

* a3809244c0
* bd347bdfeb
2025-11-07 12:54:14 -08:00
tsc036
cf47ce2db9
refactor(core): move profile_types.ts to primtives
move profile_types.ts so the types can be used in Wiz code
2025-11-06 14:22:33 -08:00
Alan Agius
26fed34e0e
build: format md files
This commit configures prettier to format markdown files.
2025-11-06 10:03:05 -08:00
SkyZeroZx
ca3ef38143 refactor(common): Removes unused imports to clean up dependencies
Eliminates unnecessary imports to reduce clutter and improve maintainability
2025-11-06 08:35:28 -08:00
tsc036
104f7d57c1
refactor(core): export types from primitives
export Version type and a type for linkedSignal previous value so they can be used for the Wiz implementations
2025-11-06 08:34:54 -08:00
hawkgs
daaad1e6b0 refactor(core): narrow down ReactiveNode.kind type (#64127)
Use a string union type instead of a generic string.

PR Close #64127
2025-10-20 20:15:46 +00:00
Kristiyan Kostadinov
ad2376435b feat(core): support IntersectionObserver options in viewport triggers (#64130)
Adds support for customizing the `IntersectionObserver` options for the `on viewport`, `prefetch on viewport` and `hydrate on viewport` triggers.

Note that the options need to be a static object literal, e.g. `@defer (on viewport(trigger, {rootMargin: '123px'})`.

Fixes #52799.

PR Close #64130
2025-10-09 05:32:21 -07:00
Matthieu Riegler
2aca6da583 refactor(core): Add custom formatters for Signals (#64000)
This commit adds a devmode only formatter for Angular signals

Custom formatters must also be enabled in the browser devtools.

PR Close #64000
2025-09-30 13:49:26 -04:00
Milo
5406e1a84b refactor(core): use version>0 instead of hasRun (#62467)
this saves a field for effect and watch nodes

PR Close #62467
2025-09-22 16:51:50 +00:00
Rocky Meza
663f48cfc1 refactor(core): Split consumerBefore/AfterComputation (#62549)
This makes it possible to batch effects, where we can "reopen" consumers
during initial render and then finalize them after we are finally done
adding all the effects to a batch:

```
function createBatch() {
  const effect = // ... create effect node
  resetConsumerBeforeComputation(effect);
  return effect;
}

// pseudo-code
function appendEffect(effectBatch, updater) {
  if (value is a signal) {
    const prevConsumer = setActiveConsumer(effectBatch.node);
    const output = value();
    setActiveConsumer(prevConsumer);
    effectBatch.push({ signal, updater });
    return output;
  }
}

function finalizeBatch(effectBatch) {
  if (effectBatch.length > 0) {
    finalizeConsumerAfterComputation(effectBatch.node);
  }
}

const effectBatch = createBatchEffectNode();
appendEffect(signal1, (newValue) => /* something */);
appendEffect(signal2, (newValue) => /* something different */);
finalizeBatch(effectBatch);
```

PR Close #62549
2025-09-11 15:47:33 +00:00
Hongxu Xu
1f4c5f72aa refactor(bazel): reduce build deps (#63348)
clean up deps in bazel build scripts

PR Close #63348
2025-08-28 09:16:10 -07:00
Andrew Scott
8e4b7e47f4 refactor(core): Reorder resolve/reject in relation to navigate[error/success] (#63377)
Order was changed in https://github.com/whatwg/html/pull/11512 (see that
PR for details as to why).

https://whatpr.org/html/10919/nav-history-apis.html#abort-a-navigateevent

PR Close #63377
2025-08-27 11:16:53 -07:00
Taygan Caldwell
a43057c059 refactor(core): Create a base effect interface and prototype to be used by both angular and wiz. (#62931)
Add a common effect interface and prototype to be used to create the wiz and angular effects.

PR Close #62931
2025-08-26 14:48:32 -07:00
Joey Perrott
2fcafb65c5 build: rename defaults2.bzl to defaults.bzl (#63383)
Use defaults.bzl for the common macros

PR Close #63383
2025-08-25 15:45:01 -07:00
Joey Perrott
cbc258eec8 build: remove ts_project_interop infrastructure (#62908)
Remove the interop macros and final usages

PR Close #62908
2025-07-31 09:12:58 +00:00
Joey Perrott
17ada9838b build: move tsec to new toolchain (#62825)
Migrate tsec tooling/macro to use tsec directly as a js_binary and rely on ts_project dependencies.

PR Close #62825
2025-07-28 20:07:05 +02:00
Milo
3c008c9263 refactor(core): use quad linked lists for signals (#62284)
inspired by the design of Preact's signals, use linked lists instead of arrays for faster signal creation

PR Close #62284
2025-07-28 17:01:42 +02:00
Joey Perrott
8bf97d1370 build: remove all usages of the interop_deps attr for ts_project and ng_project (#62732)
Remove all of the usages of interop_deps as attributes in the repo

PR Close #62732
2025-07-21 13:03:09 -04:00
Joey Perrott
49813c5d85 build: migrate esbuild usages to aspect_rules_esbuild esbuild rule (#62529)
Migrate more usages of esbuild to new toolchain

PR Close #62529
2025-07-09 12:41:27 -07:00
Joey Perrott
4fae4dbba8 build: migrate adev to use packaged version of @angular/* packages (#62413)
Use the packaged versions of the packages instead of the local ts_project dependencies to prevent multiple versions of the deps to enter test bundles

PR Close #62413
2025-07-02 16:10:25 +00:00
iteriani
35032a6f6a refactor(core): Make it so that injecting with just a token guarantees an instance of the type provided. (#62338)
This allows us to pass in the following

const x = inject(FooService);

and have x be required.

PR Close #62338
2025-06-30 12:06:02 +00:00
iteriani
f849803f79 refactor(core): Add return value for defineInjectable. (#62303)
This allows the return value of this function to be passed into registerInjectable.

PR Close #62303
2025-06-27 10:34:14 +00:00
Joey Perrott
b84859073b build: migrate to use web test runner rules (#62292)
Migrate karma tests throughout the repo to use the new web test runner based rule instead

PR Close #62292
2025-06-26 17:19:10 +00:00
iteriani
ec01599987 refactor(core): Add Constructor type to injection types (#62265)
This allows us to pass in constructors into the inject function

PR Close #62265
2025-06-26 15:55:23 +00:00
iteriani
ba755830be refactor(core): Add injection primitives for shared services. (#62087)
This way, an arbitrary service can implement Angular's service requirements without a hard dependency on @angular/core

ex:

class Foo {
   bar = inject(Bar);
}

registerInjectable(Foo);

PR Close #62087
2025-06-25 14:57:57 +00:00
Andrew Scott
fa5ae9228d refactor(core): update FakeNavigation to the latest spec (#62017)
Spec updates are in https://github.com/whatwg/html/pull/10919

For the most part, the updates revolve around the deferred commit
handling (with precommitHandler). Updates to redirect allow more
options. A committed promise now exists on the transition since commits
can be delayed. Tests were made zoneless for easier debugging and
timeouts were reduced.

PR Close #62017
2025-06-19 15:10:41 +02:00