Commit graph

154 commits

Author SHA1 Message Date
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
Joey Perrott
3a0cfd544d build: migrate to using new jasmine_test (#62086)
Use the new jasmine_test based on rules_js instead of jasmine_node_test from rules_nodejs

PR Close #62086
2025-06-18 08:27:26 +02:00
Taygan Caldwell
6097184711 refactor(core): Delete createSignalTuple (#61907)
Delete createSignalTuple because it is no longer needed. creatSignal has the same behavior.

PR Close #61907
2025-06-06 13:46:16 +02:00
Taygan Caldwell
935ce0e0d9 refactor(core): export signal setter and updater types for wiz (#61714)
Export signal setter and updater types for Wiz to use

PR Close #61714
2025-06-05 12:57:23 +02:00
Taygan Caldwell
ed0a0a6d78 refactor(core): Refactor createSignal to return a tuple contain getter, setter, and updater (#61705)
Refactor createSignal to return a tuple instead of a signal getter. createSignalTuple will be removed in a follow up pr once createSignalTuple usages in google3 are migrated to createSignal.

PR Close #61705
2025-06-04 10:46:11 -04:00
Paul Gschwendtner
f779c95e6f build: migrate integration and primitives/defer to ts_project (#61843)
Migrates remaining `ts_project` targets (excluding zone.js) to
`ts_project`.

PR Close #61843
2025-06-04 09:13:41 +00:00
Steven Nguyendoan
d7753988bd refactor(migrations): update references for dom_trigger functions onInteract, onHover, onViewport to point to new location in core/primitives/defer (#61342)
Moves the onInteract, onHover, onViewport dom_trigger functions to /packages/core/primitives/defer to be used as a shared library

PR Close #61342
2025-05-21 17:30:10 +00:00
Steven Nguyendoan
74cf9cb010 refactor(migrations): moved onInteraction, onHover (#61342)
, onViewport to core/primitives

PR Close #61342
2025-05-21 17:30:10 +00:00
Paul Gschwendtner
d067dff394 build: migrate more targets of @angular/core to ts_project (#61370)
Migrates more targets of `@angular/core` to `ts_project`. Remaining are:

 - tests
 - schematics

PR Close #61370
2025-05-16 11:02:07 +00:00
Paul Gschwendtner
ff62ff1793 refactor: explicitly ensure ngDevMode types are available (#61365)
This commit adds an import to the `ng_dev_mode.ts` file that augments
`global` to have types for `ngDevMode`.

Notably this change is currently not needed because the file is loaded
by `ts_library` through `tsconfig#files`— but in a separate PR we are
switching the target to `ts_project` which no longer loads all Bazel
dependency files via `tsconfig#files`; resulting in the ambient types no
longer magically being available.

PR Close #61365
2025-05-15 12:45:12 +00:00
Paul Gschwendtner
b71c35a6b5 refactor: update packages/core:{core,src} to ts_project (#61275)
Updates `packages/core:core` and `packages/core/src/...` to `ts_project`
of `rules_js`.

PR Close #61275
2025-05-14 12:01:51 +00:00
Paul Gschwendtner
810b0a7e5c refactor: add explicit types for exports relying on inferred call return type (#61312)
As part of the Bazel toolchain migration we noticed that implicit types
generated by the TypeScript compiler sometimes end up referencing types
from other packages (i.e. cross-package imports).

These imports currently work just because the Bazel `ts_library` and
`ng_module` rules automatically inserted a `<amd-module
name="@angular/x" />` into `.d.ts` of packages. This helped TS figure
out how to import a given file. Notably this is custom logic that is not
occuring in vanilla TS or Angular compilations—so we will drop this
magic as part of the toolchain cleanup!

To improve code quality and keep the existing behavior working, we are
doing the following:

- adding a lint rule that reduces the risk of such imports breaking. The
  failure scenario without the rule is that API goldens show unexpected
  diffs, and types might be duplicated in a different package!

- keeping the `<amd-module` headers, but we manually insert them into
  the package entry-points. This should ensure we don't regress
  anywhere; while we also improved general safety around this above.

Long-term, isolated declarations or a lint rule from eslint-typescript
can make this even more robust.

PR Close #61312
2025-05-13 22:45:18 +00:00
arturovt
6bc9d45e77 refactor(core): drop computation error messages in production (#60700)
Some of the error messages in `core/primitives` are already guarded with `ngDevMode`; this change guards the remaining ones.

PR Close #60700
2025-05-01 10:11:01 -07:00
arturovt
13fd1b30e0 refactor(core): tree-shake PROPAGATION_STOPPED_SYMBOL (#61004)
Adds `__PURE__` annotations to `PROPAGATION_STOPPED_SYMBOL` to enable tree-shaking, even if is is not referenced. This variable is not dropped when Angular is imported from a module that has `sideEffects` set to `true`.

PR Close #61004
2025-04-30 12:38:44 -07:00
Taygan Caldwell
42cad2849d refactor(core): Add createSignalTuple (#60903)
Add createSignalTuple function to match Wiz array destructuring signal return. This will be the implementation for createSignal once createSignal usages in google3 are migrated to createSignalTuple.

PR Close #60903
2025-04-29 08:46:39 -07:00
Andrew Scott
2445946943 refactor(core): Update FakeNavigation to extract some Angular quirks (#60961)
This change updates the implementation of `FakeNavigation` to extract
some changes that were made due to quirks in Angular testing.

PR Close #60961
2025-04-28 14:36:24 -07:00
Andrew Scott
e90daf3eb9 refactor(core): Update Transition finished promise to not throw unhandled rejection (#60816)
As with `InternalNavigationResult`, this commit adds the `catch` to the
`finished` promise on `InternalNavigationTransition` to avoid unhandled
promise rejections.

PR Close #60816
2025-04-15 18:40:42 -04:00
Andrew Scott
189935810c refactor(common): Add hashchange event for traversals (#60682)
This commit adds the logic to emit the `hashchange` event for
traversals.

PR Close #60682
2025-04-03 16:54:56 -07:00
Andrew Scott
36b92367ae refactor(common): Update FakeNavigation deferred commit to use precommitHandler (#60652)
This commit updates the FakeNavigation implementation to match the
spec's new `precommitHandler` which replaces the old `commit: 'after-transition'`.

PR Close #60652
2025-04-03 16:53:06 -07:00
Matt Turco
a4bad8d361 feat(core): export signalGetFn from signal primitives (#60497)
This updates `createSignal` to use `signalGetFn` to define the signal getter and exports `signalGetFn` from the shared signal primitives.

PR Close #60497
2025-03-31 22:24:21 +00:00
Pawel Kozlowski
76c60a609f refactor(core): move signal toString to primitives (#60365)
This change pushes the toString implementation of signal getters
down to the primitives package so it can be shared with other
frameworks.

Closes #59990

PR Close #60365
2025-03-27 19:43:19 +00:00
iteriani
4a107ed7af refactor(core): Return NOT_FOUND for retrieve instead of null (#60358)
This fits within the spec of the retrieve.

PR Close #60358
2025-03-27 19:39:59 +00:00
Pawel Kozlowski
997836e858 refactor(core): specify reactive node kind for linked signal (#60451)
This commit adds reactive node kind for linked signal.

PR Close #60451
2025-03-24 07:06:47 -07:00