@tstdl/base 0.93.181 → 0.93.183
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/server/api-request-token.provider.js +1 -1
- package/api/server/gateway.js +8 -3
- package/authentication/authentication.api.d.ts +13 -40
- package/authentication/authentication.api.js +5 -14
- package/authentication/client/authentication.service.d.ts +6 -14
- package/authentication/client/authentication.service.js +22 -4
- package/authentication/client/module.d.ts +1 -1
- package/authentication/client/module.js +4 -4
- package/authentication/models/index.d.ts +1 -0
- package/authentication/models/index.js +1 -0
- package/authentication/models/totp-results.model.d.ts +11 -0
- package/authentication/models/totp-results.model.js +37 -0
- package/authentication/server/authentication.api-controller.d.ts +3 -3
- package/authentication/server/authentication.api-controller.js +31 -4
- package/authentication/server/authentication.service.d.ts +5 -14
- package/authentication/server/authentication.service.js +6 -4
- package/core.d.ts +0 -5
- package/core.js +0 -8
- package/document-management/api/document-management.api.d.ts +2 -2
- package/document-management/service-models/document.service-model.d.ts +1 -1
- package/examples/config.d.ts +25 -0
- package/examples/config.js +26 -0
- package/notification/server/module.d.ts +1 -1
- package/notification/server/module.js +1 -1
- package/package.json +5 -5
- package/signals/api.d.ts +5 -1
- package/signals/api.js +3 -1
- package/signals/implementation/api.d.ts +13 -5
- package/signals/implementation/api.js +7 -1
- package/signals/implementation/asserts.d.ts +2 -2
- package/signals/implementation/asserts.js +3 -3
- package/signals/implementation/computed.d.ts +7 -34
- package/signals/implementation/computed.js +14 -83
- package/signals/implementation/configure.js +6 -2
- package/signals/implementation/effect.d.ts +65 -46
- package/signals/implementation/effect.js +97 -62
- package/signals/implementation/index.d.ts +2 -4
- package/signals/implementation/index.js +2 -4
- package/signals/implementation/linked_signal.d.ts +36 -0
- package/signals/implementation/linked_signal.js +34 -0
- package/signals/implementation/primitive/computed.d.ts +55 -0
- package/signals/implementation/primitive/computed.js +107 -0
- package/signals/implementation/primitive/effect.d.ts +26 -0
- package/signals/implementation/primitive/effect.js +31 -0
- package/signals/implementation/{equality.d.ts → primitive/equality.d.ts} +1 -1
- package/signals/implementation/{equality.js → primitive/equality.js} +1 -1
- package/signals/implementation/primitive/errors.d.ts +10 -0
- package/signals/implementation/{errors.js → primitive/errors.js} +3 -4
- package/signals/implementation/primitive/formatter.d.ts +19 -0
- package/signals/implementation/primitive/formatter.js +136 -0
- package/signals/implementation/{graph.d.ts → primitive/graph.d.ts} +68 -36
- package/signals/implementation/primitive/graph.js +386 -0
- package/signals/implementation/primitive/linked_signal.d.ts +46 -0
- package/signals/implementation/primitive/linked_signal.js +110 -0
- package/signals/implementation/primitive/signal.d.ts +31 -0
- package/signals/implementation/primitive/signal.js +80 -0
- package/signals/implementation/primitive/untracked.d.ts +12 -0
- package/signals/implementation/primitive/untracked.js +23 -0
- package/signals/implementation/{watch.d.ts → primitive/watch.d.ts} +1 -2
- package/signals/implementation/{watch.js → primitive/watch.js} +22 -16
- package/signals/implementation/resource/api.d.ts +275 -0
- package/signals/implementation/resource/api.js +26 -0
- package/signals/implementation/resource/debounce.d.ts +13 -0
- package/signals/implementation/resource/debounce.js +113 -0
- package/signals/implementation/resource/from_snapshots.d.ts +16 -0
- package/signals/implementation/resource/from_snapshots.js +44 -0
- package/signals/implementation/resource/index.d.ts +11 -0
- package/signals/implementation/resource/index.js +11 -0
- package/signals/implementation/resource/resource.d.ts +110 -0
- package/signals/implementation/resource/resource.js +402 -0
- package/signals/implementation/root_effect_scheduler.d.ts +50 -0
- package/signals/implementation/root_effect_scheduler.js +66 -0
- package/signals/implementation/signal.d.ts +42 -18
- package/signals/implementation/signal.js +29 -49
- package/signals/implementation/to-observable.d.ts +12 -5
- package/signals/implementation/to-observable.js +12 -2
- package/signals/implementation/to-signal.d.ts +9 -18
- package/signals/implementation/to-signal.js +46 -13
- package/signals/implementation/untracked.d.ts +1 -1
- package/signals/implementation/untracked.js +3 -11
- package/signals/operators/debounce.d.ts +8 -0
- package/signals/operators/debounce.js +19 -0
- package/signals/operators/derive-async.js +43 -15
- package/signals/operators/index.d.ts +2 -0
- package/signals/operators/index.js +2 -0
- package/signals/operators/throttle.d.ts +8 -0
- package/signals/operators/throttle.js +31 -0
- package/ai/genkit/tests/multi-region.test.d.ts +0 -2
- package/ai/genkit/tests/multi-region.test.js +0 -179
- package/ai/genkit/tests/token-limit-fallback.test.d.ts +0 -2
- package/ai/genkit/tests/token-limit-fallback.test.js +0 -209
- package/ai/prompts/tests/prompt-builder.test.d.ts +0 -1
- package/ai/prompts/tests/prompt-builder.test.js +0 -22
- package/ai/tests/instructions-formatter.test.d.ts +0 -1
- package/ai/tests/instructions-formatter.test.js +0 -116
- package/ai/tests/steering.test.d.ts +0 -1
- package/ai/tests/steering.test.js +0 -37
- package/api/client/tests/api-client.test.d.ts +0 -1
- package/api/client/tests/api-client.test.js +0 -194
- package/api/server/tests/csrf.middleware.test.d.ts +0 -1
- package/api/server/tests/csrf.middleware.test.js +0 -91
- package/authentication/tests/authentication-password-requirements.validator.test.d.ts +0 -1
- package/authentication/tests/authentication-password-requirements.validator.test.js +0 -29
- package/authentication/tests/authentication.api-controller.test.d.ts +0 -1
- package/authentication/tests/authentication.api-controller.test.js +0 -156
- package/authentication/tests/authentication.api-request-token.provider.test.d.ts +0 -1
- package/authentication/tests/authentication.api-request-token.provider.test.js +0 -48
- package/authentication/tests/authentication.client-error-handling.test.d.ts +0 -1
- package/authentication/tests/authentication.client-error-handling.test.js +0 -123
- package/authentication/tests/authentication.client-middleware.test.d.ts +0 -1
- package/authentication/tests/authentication.client-middleware.test.js +0 -118
- package/authentication/tests/authentication.client-service-methods.test.d.ts +0 -1
- package/authentication/tests/authentication.client-service-methods.test.js +0 -177
- package/authentication/tests/authentication.client-service-refresh.test.d.ts +0 -1
- package/authentication/tests/authentication.client-service-refresh.test.js +0 -153
- package/authentication/tests/authentication.client-service.test.d.ts +0 -1
- package/authentication/tests/authentication.client-service.test.js +0 -76
- package/authentication/tests/authentication.refresh-busy-loop.test.d.ts +0 -1
- package/authentication/tests/authentication.refresh-busy-loop.test.js +0 -84
- package/authentication/tests/authentication.service.test.d.ts +0 -1
- package/authentication/tests/authentication.service.test.js +0 -167
- package/authentication/tests/authentication.test-ancillary-service.d.ts +0 -9
- package/authentication/tests/authentication.test-ancillary-service.js +0 -27
- package/authentication/tests/brute-force-protection.test.d.ts +0 -1
- package/authentication/tests/brute-force-protection.test.js +0 -211
- package/authentication/tests/helper.test.d.ts +0 -1
- package/authentication/tests/helper.test.js +0 -122
- package/authentication/tests/password-requirements.error.test.d.ts +0 -1
- package/authentication/tests/password-requirements.error.test.js +0 -14
- package/authentication/tests/remember.api.test.d.ts +0 -1
- package/authentication/tests/remember.api.test.js +0 -117
- package/authentication/tests/remember.service.test.d.ts +0 -1
- package/authentication/tests/remember.service.test.js +0 -83
- package/authentication/tests/subject.service.test.d.ts +0 -1
- package/authentication/tests/subject.service.test.js +0 -140
- package/authentication/tests/suspended-subject.test.d.ts +0 -1
- package/authentication/tests/suspended-subject.test.js +0 -120
- package/authentication/tests/totp.enrollment.test.d.ts +0 -1
- package/authentication/tests/totp.enrollment.test.js +0 -123
- package/authentication/tests/totp.login.test.d.ts +0 -1
- package/authentication/tests/totp.login.test.js +0 -213
- package/authentication/tests/totp.recovery-codes.test.d.ts +0 -1
- package/authentication/tests/totp.recovery-codes.test.js +0 -97
- package/authentication/tests/totp.status.test.d.ts +0 -1
- package/authentication/tests/totp.status.test.js +0 -72
- package/cancellation/tests/coverage.test.d.ts +0 -1
- package/cancellation/tests/coverage.test.js +0 -49
- package/cancellation/tests/leak.test.d.ts +0 -1
- package/cancellation/tests/leak.test.js +0 -35
- package/cancellation/tests/token.test.d.ts +0 -1
- package/cancellation/tests/token.test.js +0 -136
- package/circuit-breaker/tests/circuit-breaker.test.d.ts +0 -1
- package/circuit-breaker/tests/circuit-breaker.test.js +0 -116
- package/cryptography/tests/cryptography.test.d.ts +0 -1
- package/cryptography/tests/cryptography.test.js +0 -175
- package/cryptography/tests/jwt.test.d.ts +0 -1
- package/cryptography/tests/jwt.test.js +0 -54
- package/cryptography/tests/modern.test.d.ts +0 -1
- package/cryptography/tests/modern.test.js +0 -105
- package/cryptography/tests/module.test.d.ts +0 -1
- package/cryptography/tests/module.test.js +0 -100
- package/cryptography/tests/totp.test.d.ts +0 -1
- package/cryptography/tests/totp.test.js +0 -108
- package/document-management/tests/ai-config-hierarchy.test.d.ts +0 -1
- package/document-management/tests/ai-config-hierarchy.test.js +0 -59
- package/document-management/tests/ai-config-integration.test.d.ts +0 -1
- package/document-management/tests/ai-config-integration.test.js +0 -125
- package/document-management/tests/ai-config-merge.test.d.ts +0 -1
- package/document-management/tests/ai-config-merge.test.js +0 -46
- package/document-management/tests/document-management-ai-overrides.test.d.ts +0 -1
- package/document-management/tests/document-management-ai-overrides.test.js +0 -63
- package/document-management/tests/document-management-core.test.d.ts +0 -1
- package/document-management/tests/document-management-core.test.js +0 -157
- package/document-management/tests/document-management.api.test.d.ts +0 -1
- package/document-management/tests/document-management.api.test.js +0 -101
- package/document-management/tests/document-statistics.service.test.d.ts +0 -1
- package/document-management/tests/document-statistics.service.test.js +0 -498
- package/document-management/tests/document-validation-ai-overrides.test.d.ts +0 -1
- package/document-management/tests/document-validation-ai-overrides.test.js +0 -87
- package/document-management/tests/document.service.test.d.ts +0 -1
- package/document-management/tests/document.service.test.js +0 -143
- package/document-management/tests/enum-helpers.test.d.ts +0 -1
- package/document-management/tests/enum-helpers.test.js +0 -452
- package/document-management/tests/helper.d.ts +0 -24
- package/document-management/tests/helper.js +0 -39
- package/errors/tests/format.test.d.ts +0 -1
- package/errors/tests/format.test.js +0 -84
- package/http/tests/server-timing.test.d.ts +0 -1
- package/http/tests/server-timing.test.js +0 -42
- package/injector/tests/advanced.test.d.ts +0 -1
- package/injector/tests/advanced.test.js +0 -116
- package/injector/tests/async-init.test.d.ts +0 -1
- package/injector/tests/async-init.test.js +0 -77
- package/injector/tests/basic.test.d.ts +0 -1
- package/injector/tests/basic.test.js +0 -114
- package/injector/tests/hierarchical.test.d.ts +0 -1
- package/injector/tests/hierarchical.test.js +0 -59
- package/injector/tests/leak.test.d.ts +0 -1
- package/injector/tests/leak.test.js +0 -45
- package/injector/tests/lifecycles.test.d.ts +0 -1
- package/injector/tests/lifecycles.test.js +0 -109
- package/logger/tests/pretty-print.test.d.ts +0 -1
- package/logger/tests/pretty-print.test.js +0 -60
- package/notification/tests/notification-api.test.d.ts +0 -1
- package/notification/tests/notification-api.test.js +0 -124
- package/notification/tests/notification-client.test.d.ts +0 -1
- package/notification/tests/notification-client.test.js +0 -101
- package/notification/tests/notification-flow.test.d.ts +0 -1
- package/notification/tests/notification-flow.test.js +0 -296
- package/notification/tests/notification-sse.service.test.d.ts +0 -1
- package/notification/tests/notification-sse.service.test.js +0 -43
- package/notification/tests/notification-type.service.test.d.ts +0 -1
- package/notification/tests/notification-type.service.test.js +0 -41
- package/object-storage/s3/tests/s3.object-storage.integration.test.d.ts +0 -1
- package/object-storage/s3/tests/s3.object-storage.integration.test.js +0 -303
- package/orm/tests/build-jsonb.test.d.ts +0 -1
- package/orm/tests/build-jsonb.test.js +0 -39
- package/orm/tests/data-types.test.d.ts +0 -1
- package/orm/tests/data-types.test.js +0 -39
- package/orm/tests/database-extension.test.d.ts +0 -1
- package/orm/tests/database-extension.test.js +0 -63
- package/orm/tests/database-migration.test.d.ts +0 -1
- package/orm/tests/database-migration.test.js +0 -83
- package/orm/tests/decorators.test.d.ts +0 -1
- package/orm/tests/decorators.test.js +0 -77
- package/orm/tests/encryption.test.d.ts +0 -1
- package/orm/tests/encryption.test.js +0 -31
- package/orm/tests/query-complex.test.d.ts +0 -1
- package/orm/tests/query-complex.test.js +0 -172
- package/orm/tests/query-converter-complex.test.d.ts +0 -1
- package/orm/tests/query-converter-complex.test.js +0 -131
- package/orm/tests/query-converter.test.d.ts +0 -1
- package/orm/tests/query-converter.test.js +0 -123
- package/orm/tests/repository-advanced.test.d.ts +0 -1
- package/orm/tests/repository-advanced.test.js +0 -189
- package/orm/tests/repository-attributes.test.d.ts +0 -1
- package/orm/tests/repository-attributes.test.js +0 -83
- package/orm/tests/repository-compound-primary-key.test.d.ts +0 -2
- package/orm/tests/repository-compound-primary-key.test.js +0 -226
- package/orm/tests/repository-comprehensive.test.d.ts +0 -1
- package/orm/tests/repository-comprehensive.test.js +0 -162
- package/orm/tests/repository-coverage.test.d.ts +0 -2
- package/orm/tests/repository-coverage.test.js +0 -242
- package/orm/tests/repository-cti-complex.test.d.ts +0 -1
- package/orm/tests/repository-cti-complex.test.js +0 -151
- package/orm/tests/repository-cti-embedded.test.d.ts +0 -1
- package/orm/tests/repository-cti-embedded.test.js +0 -178
- package/orm/tests/repository-cti-extensive.test.d.ts +0 -2
- package/orm/tests/repository-cti-extensive.test.js +0 -279
- package/orm/tests/repository-cti-mapping.test.d.ts +0 -2
- package/orm/tests/repository-cti-mapping.test.js +0 -108
- package/orm/tests/repository-cti-search.test.d.ts +0 -1
- package/orm/tests/repository-cti-search.test.js +0 -141
- package/orm/tests/repository-cti-soft-delete.test.d.ts +0 -2
- package/orm/tests/repository-cti-soft-delete.test.js +0 -103
- package/orm/tests/repository-cti-transactions.test.d.ts +0 -1
- package/orm/tests/repository-cti-transactions.test.js +0 -112
- package/orm/tests/repository-cti-upsert-many.test.d.ts +0 -2
- package/orm/tests/repository-cti-upsert-many.test.js +0 -115
- package/orm/tests/repository-cti.test.d.ts +0 -2
- package/orm/tests/repository-cti.test.js +0 -390
- package/orm/tests/repository-edge-cases.test.d.ts +0 -1
- package/orm/tests/repository-edge-cases.test.js +0 -178
- package/orm/tests/repository-expiration.test.d.ts +0 -2
- package/orm/tests/repository-expiration.test.js +0 -140
- package/orm/tests/repository-extra-coverage.test.d.ts +0 -2
- package/orm/tests/repository-extra-coverage.test.js +0 -402
- package/orm/tests/repository-mapping.test.d.ts +0 -2
- package/orm/tests/repository-mapping.test.js +0 -65
- package/orm/tests/repository-regression.test.d.ts +0 -1
- package/orm/tests/repository-regression.test.js +0 -288
- package/orm/tests/repository-search-coverage.test.d.ts +0 -1
- package/orm/tests/repository-search-coverage.test.js +0 -107
- package/orm/tests/repository-search.test.d.ts +0 -1
- package/orm/tests/repository-search.test.js +0 -105
- package/orm/tests/repository-soft-delete.test.d.ts +0 -1
- package/orm/tests/repository-soft-delete.test.js +0 -118
- package/orm/tests/repository-transactions-nested.test.d.ts +0 -1
- package/orm/tests/repository-transactions-nested.test.js +0 -178
- package/orm/tests/repository-types.test.d.ts +0 -1
- package/orm/tests/repository-types.test.js +0 -184
- package/orm/tests/repository-undelete.test.d.ts +0 -2
- package/orm/tests/repository-undelete.test.js +0 -201
- package/orm/tests/schema-converter.test.d.ts +0 -1
- package/orm/tests/schema-converter.test.js +0 -82
- package/orm/tests/schema-generation.test.d.ts +0 -2
- package/orm/tests/schema-generation.test.js +0 -174
- package/orm/tests/sql-helpers.test.d.ts +0 -1
- package/orm/tests/sql-helpers.test.js +0 -67
- package/orm/tests/transaction-safety.test.d.ts +0 -1
- package/orm/tests/transaction-safety.test.js +0 -81
- package/orm/tests/transactional.test.d.ts +0 -1
- package/orm/tests/transactional.test.js +0 -215
- package/orm/tests/utils.test.d.ts +0 -1
- package/orm/tests/utils.test.js +0 -70
- package/pdf/tests/utils.test.d.ts +0 -1
- package/pdf/tests/utils.test.js +0 -187
- package/process/tests/spawn.test.d.ts +0 -1
- package/process/tests/spawn.test.js +0 -182
- package/rate-limit/tests/postgres-rate-limiter.test.d.ts +0 -1
- package/rate-limit/tests/postgres-rate-limiter.test.js +0 -84
- package/renderer/tests/renderer.test.d.ts +0 -1
- package/renderer/tests/renderer.test.js +0 -88
- package/rpc/tests/rpc.integration.test.d.ts +0 -1
- package/rpc/tests/rpc.integration.test.js +0 -615
- package/signals/implementation/errors.d.ts +0 -2
- package/signals/implementation/graph.js +0 -312
- package/signals/implementation/writable-signal.d.ts +0 -48
- package/signals/implementation/writable-signal.js +0 -32
- package/task-queue/tests/coverage-branch.test.d.ts +0 -1
- package/task-queue/tests/coverage-branch.test.js +0 -395
- package/task-queue/tests/coverage-enhancement.test.d.ts +0 -1
- package/task-queue/tests/coverage-enhancement.test.js +0 -150
- package/task-queue/tests/dag.test.d.ts +0 -1
- package/task-queue/tests/dag.test.js +0 -188
- package/task-queue/tests/dependencies.test.d.ts +0 -1
- package/task-queue/tests/dependencies.test.js +0 -296
- package/task-queue/tests/enqueue-batch.test.d.ts +0 -1
- package/task-queue/tests/enqueue-batch.test.js +0 -125
- package/task-queue/tests/enqueue-item.test.d.ts +0 -1
- package/task-queue/tests/enqueue-item.test.js +0 -12
- package/task-queue/tests/fan-out-spawning.test.d.ts +0 -1
- package/task-queue/tests/fan-out-spawning.test.js +0 -94
- package/task-queue/tests/idempotent-replacement.test.d.ts +0 -1
- package/task-queue/tests/idempotent-replacement.test.js +0 -114
- package/task-queue/tests/missing-idempotent-tasks.test.d.ts +0 -1
- package/task-queue/tests/missing-idempotent-tasks.test.js +0 -39
- package/task-queue/tests/optimization-edge-cases.test.d.ts +0 -1
- package/task-queue/tests/optimization-edge-cases.test.js +0 -124
- package/task-queue/tests/queue-generic.test.d.ts +0 -1
- package/task-queue/tests/queue-generic.test.js +0 -8
- package/task-queue/tests/queue.test.d.ts +0 -1
- package/task-queue/tests/queue.test.js +0 -756
- package/task-queue/tests/shutdown.test.d.ts +0 -1
- package/task-queue/tests/shutdown.test.js +0 -41
- package/task-queue/tests/task-context.test.d.ts +0 -1
- package/task-queue/tests/task-context.test.js +0 -7
- package/task-queue/tests/task-union.test.d.ts +0 -1
- package/task-queue/tests/task-union.test.js +0 -18
- package/task-queue/tests/transactions.test.d.ts +0 -1
- package/task-queue/tests/transactions.test.js +0 -47
- package/task-queue/tests/typing.test.d.ts +0 -1
- package/task-queue/tests/typing.test.js +0 -9
- package/task-queue/tests/worker.test.d.ts +0 -1
- package/task-queue/tests/worker.test.js +0 -258
- package/task-queue/tests/zombie-parent.test.d.ts +0 -1
- package/task-queue/tests/zombie-parent.test.js +0 -45
- package/task-queue/tests/zombie-recovery.test.d.ts +0 -1
- package/task-queue/tests/zombie-recovery.test.js +0 -51
- package/utils/tests/backoff.test.d.ts +0 -1
- package/utils/tests/backoff.test.js +0 -41
- package/utils/tests/retry-with-backoff.test.d.ts +0 -1
- package/utils/tests/retry-with-backoff.test.js +0 -49
|
@@ -1,78 +1,113 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
|
|
3
|
-
import { createWatch } from './watch.js';
|
|
2
|
+
/** biome-ignore-all lint: <explanation> */
|
|
4
3
|
/**
|
|
5
|
-
*
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6
|
+
*
|
|
7
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
8
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
6
9
|
*/
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
this
|
|
17
|
-
if (!this.hasPendingFlush) {
|
|
18
|
-
this.hasPendingFlush = true;
|
|
19
|
-
queueMicrotask(() => {
|
|
20
|
-
this.hasPendingFlush = false;
|
|
21
|
-
this.flush();
|
|
22
|
-
});
|
|
23
|
-
}
|
|
10
|
+
import { isDevMode } from '../../core.js';
|
|
11
|
+
import { SIGNAL } from '../symbol.js';
|
|
12
|
+
import { assertNotInReactiveContext } from './asserts.js';
|
|
13
|
+
import { BASE_EFFECT_NODE, runEffect } from './primitive/effect.js';
|
|
14
|
+
import { consumerDestroy, isInNotificationPhase, setActiveConsumer } from './primitive/graph.js';
|
|
15
|
+
import { microtaskEffectScheduler } from './root_effect_scheduler.js';
|
|
16
|
+
export class EffectRefImpl {
|
|
17
|
+
[SIGNAL];
|
|
18
|
+
constructor(node) {
|
|
19
|
+
this[SIGNAL] = node;
|
|
24
20
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
this.queue.delete(effect);
|
|
28
|
-
effect.run();
|
|
29
|
-
}
|
|
21
|
+
destroy() {
|
|
22
|
+
this[SIGNAL].destroy();
|
|
30
23
|
}
|
|
31
24
|
}
|
|
32
25
|
/**
|
|
33
|
-
*
|
|
26
|
+
* Registers an "effect" that will be scheduled & executed whenever the signals that it reads
|
|
27
|
+
* changes.
|
|
28
|
+
*
|
|
29
|
+
* Angular has two different kinds of effect: component effects and root effects. Component effects
|
|
30
|
+
* are created when `effect()` is called from a component, directive, or within a service of a
|
|
31
|
+
* component/directive. Root effects are created when `effect()` is called from outside the
|
|
32
|
+
* component tree, such as in a root service.
|
|
33
|
+
*
|
|
34
|
+
* The two effect types differ in their timing. Component effects run as a component lifecycle
|
|
35
|
+
* event during Angular's synchronization (change detection) process, and can safely read input
|
|
36
|
+
* signals or create/destroy views that depend on component state. Root effects run as microtasks
|
|
37
|
+
* and have no connection to the component tree or change detection.
|
|
34
38
|
*
|
|
35
|
-
* `
|
|
36
|
-
*
|
|
37
|
-
*
|
|
39
|
+
* `effect()` must be run in injection context, unless the `injector` option is manually specified.
|
|
40
|
+
*
|
|
41
|
+
* @see [Effects](guide/signals#effects)
|
|
42
|
+
*
|
|
43
|
+
* @publicApi 20.0
|
|
38
44
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
this.effectFn = effectFn;
|
|
46
|
-
this.watcher = createWatch((onCleanup) => this.runEffect(onCleanup), () => this.schedule(), allowSignalWrites);
|
|
45
|
+
export function effect(effectFn, options) {
|
|
46
|
+
isDevMode() &&
|
|
47
|
+
assertNotInReactiveContext(effect, 'Call `effect` outside of a reactive context. For example, schedule the ' +
|
|
48
|
+
'effect inside the component constructor.');
|
|
49
|
+
if (isDevMode() && options?.allowSignalWrites !== undefined) {
|
|
50
|
+
console.warn(`The 'allowSignalWrites' flag is deprecated and no longer impacts effect() (writes are always allowed)`);
|
|
47
51
|
}
|
|
48
|
-
|
|
52
|
+
const node = createRootEffect(effectFn, microtaskEffectScheduler);
|
|
53
|
+
return new EffectRefImpl(node);
|
|
54
|
+
}
|
|
55
|
+
export const EFFECT_NODE =
|
|
56
|
+
/* @__PURE__ */ (() => ({
|
|
57
|
+
...BASE_EFFECT_NODE,
|
|
58
|
+
cleanupFns: undefined,
|
|
59
|
+
onDestroyFns: null,
|
|
60
|
+
run() {
|
|
61
|
+
if (isDevMode() && isInNotificationPhase()) {
|
|
62
|
+
throw new Error(`Schedulers cannot synchronously execute watches while scheduling.`);
|
|
63
|
+
}
|
|
64
|
+
runEffect(this);
|
|
65
|
+
},
|
|
66
|
+
cleanup() {
|
|
67
|
+
if (!this.cleanupFns?.length) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const prevConsumer = setActiveConsumer(null);
|
|
49
71
|
try {
|
|
50
|
-
|
|
72
|
+
// Attempt to run the cleanup functions. Regardless of failure or success, we consider
|
|
73
|
+
// cleanup "completed" and clear the list for the next run of the effect. Note that an error
|
|
74
|
+
// from the cleanup function will still crash the current run of the effect.
|
|
75
|
+
while (this.cleanupFns.length) {
|
|
76
|
+
this.cleanupFns.pop()();
|
|
77
|
+
}
|
|
51
78
|
}
|
|
52
|
-
|
|
53
|
-
|
|
79
|
+
finally {
|
|
80
|
+
this.cleanupFns = [];
|
|
81
|
+
setActiveConsumer(prevConsumer);
|
|
54
82
|
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
83
|
+
},
|
|
84
|
+
}))();
|
|
85
|
+
export const ROOT_EFFECT_NODE =
|
|
86
|
+
/* @__PURE__ */ (() => ({
|
|
87
|
+
...EFFECT_NODE,
|
|
88
|
+
consumerMarkedDirty() {
|
|
89
|
+
this.scheduler.schedule(this);
|
|
90
|
+
},
|
|
62
91
|
destroy() {
|
|
63
|
-
this
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
92
|
+
consumerDestroy(this);
|
|
93
|
+
if (this.onDestroyFns !== null) {
|
|
94
|
+
for (const fn of this.onDestroyFns) {
|
|
95
|
+
fn();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
this.cleanup();
|
|
99
|
+
this.scheduler.remove(this);
|
|
100
|
+
},
|
|
101
|
+
}))();
|
|
102
|
+
export function createRootEffect(fn, scheduler) {
|
|
103
|
+
const node = Object.create(ROOT_EFFECT_NODE);
|
|
104
|
+
node.fn = createEffectFn(node, fn);
|
|
105
|
+
node.scheduler = scheduler;
|
|
106
|
+
node.scheduler.add(node);
|
|
107
|
+
return node;
|
|
67
108
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
export function effect(effectFn, options) {
|
|
73
|
-
assertNotInReactiveContext(effect, 'Call `effect` outside of a reactive context. For example, schedule the ' +
|
|
74
|
-
'effect inside the component constructor.');
|
|
75
|
-
const handle = new EffectHandle(effectScheduler, effectFn, options?.allowSignalWrites ?? false);
|
|
76
|
-
handle.watcher.notify();
|
|
77
|
-
return handle;
|
|
109
|
+
function createEffectFn(node, fn) {
|
|
110
|
+
return () => {
|
|
111
|
+
fn((cleanupFn) => (node.cleanupFns ??= []).push(cleanupFn));
|
|
112
|
+
};
|
|
78
113
|
}
|
|
@@ -3,11 +3,9 @@ export * from './asserts.js';
|
|
|
3
3
|
export * from './computed.js';
|
|
4
4
|
export * from './configure.js';
|
|
5
5
|
export * from './effect.js';
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
6
|
+
export * from './linked_signal.js';
|
|
7
|
+
export * from './resource/index.js';
|
|
8
8
|
export * from './signal.js';
|
|
9
9
|
export * from './to-observable.js';
|
|
10
10
|
export * from './to-signal.js';
|
|
11
11
|
export * from './untracked.js';
|
|
12
|
-
export * from './watch.js';
|
|
13
|
-
export * from './writable-signal.js';
|
|
@@ -3,11 +3,9 @@ export * from './asserts.js';
|
|
|
3
3
|
export * from './computed.js';
|
|
4
4
|
export * from './configure.js';
|
|
5
5
|
export * from './effect.js';
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
6
|
+
export * from './linked_signal.js';
|
|
7
|
+
export * from './resource/index.js';
|
|
8
8
|
export * from './signal.js';
|
|
9
9
|
export * from './to-observable.js';
|
|
10
10
|
export * from './to-signal.js';
|
|
11
11
|
export * from './untracked.js';
|
|
12
|
-
export * from './watch.js';
|
|
13
|
-
export * from './writable-signal.js';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import type { ValueEqualityFn } from './primitive/equality.js';
|
|
9
|
+
import { type WritableSignal } from './signal.js';
|
|
10
|
+
/**
|
|
11
|
+
* Creates a writable signal whose value is initialized and reset by the linked, reactive computation.
|
|
12
|
+
*
|
|
13
|
+
* @publicApi 20.0
|
|
14
|
+
*/
|
|
15
|
+
export declare function linkedSignal<D>(computation: () => D, options?: {
|
|
16
|
+
equal?: ValueEqualityFn<NoInfer<D>>;
|
|
17
|
+
debugName?: string;
|
|
18
|
+
}): WritableSignal<D>;
|
|
19
|
+
/**
|
|
20
|
+
* Creates a writable signal whose value is initialized and reset by the linked, reactive computation.
|
|
21
|
+
* This is an advanced API form where the computation has access to the previous value of the signal and the computation result.
|
|
22
|
+
*
|
|
23
|
+
* Note: The computation is reactive, meaning the linked signal will automatically update whenever any of the signals used within the computation change.
|
|
24
|
+
*
|
|
25
|
+
* @publicApi 20.0
|
|
26
|
+
* @see [Dependent state with linkedSignal](guide/signals/linked-signal)
|
|
27
|
+
*/
|
|
28
|
+
export declare function linkedSignal<S, D>(options: {
|
|
29
|
+
source: () => S;
|
|
30
|
+
computation: (source: NoInfer<S>, previous?: {
|
|
31
|
+
source: NoInfer<S>;
|
|
32
|
+
value: NoInfer<D>;
|
|
33
|
+
}) => D;
|
|
34
|
+
equal?: ValueEqualityFn<NoInfer<D>>;
|
|
35
|
+
debugName?: string;
|
|
36
|
+
}): WritableSignal<D>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import { isDevMode } from '../../core.js';
|
|
9
|
+
import { SIGNAL } from '../symbol.js';
|
|
10
|
+
import { createLinkedSignal, linkedSignalSetFn, linkedSignalUpdateFn } from './primitive/linked_signal.js';
|
|
11
|
+
import { signalAsReadonlyFn } from './signal.js';
|
|
12
|
+
const identityFn = (v) => v;
|
|
13
|
+
export function linkedSignal(optionsOrComputation, options) {
|
|
14
|
+
if (typeof optionsOrComputation === 'function') {
|
|
15
|
+
const getter = createLinkedSignal(optionsOrComputation, (identityFn), options?.equal);
|
|
16
|
+
return upgradeLinkedSignalGetter(getter, options?.debugName);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
const getter = createLinkedSignal(optionsOrComputation.source, optionsOrComputation.computation, optionsOrComputation.equal);
|
|
20
|
+
return upgradeLinkedSignalGetter(getter, optionsOrComputation.debugName);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function upgradeLinkedSignalGetter(getter, debugName) {
|
|
24
|
+
if (isDevMode()) {
|
|
25
|
+
getter[SIGNAL].debugName = debugName;
|
|
26
|
+
getter.toString = () => `[LinkedSignal${debugName ? ' (' + debugName + ')' : ''}: ${getter()}]`;
|
|
27
|
+
}
|
|
28
|
+
const node = getter[SIGNAL];
|
|
29
|
+
const upgradedGetter = getter;
|
|
30
|
+
upgradedGetter.set = (newValue) => linkedSignalSetFn(node, newValue);
|
|
31
|
+
upgradedGetter.update = (updateFn) => linkedSignalUpdateFn(node, updateFn);
|
|
32
|
+
upgradedGetter.asReadonly = signalAsReadonlyFn.bind(getter);
|
|
33
|
+
return upgradedGetter;
|
|
34
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import { type ValueEqualityFn } from './equality.js';
|
|
9
|
+
import { type ReactiveNode, SIGNAL } from './graph.js';
|
|
10
|
+
/**
|
|
11
|
+
* A computation, which derives a value from a declarative reactive expression.
|
|
12
|
+
*
|
|
13
|
+
* `Computed`s are both producers and consumers of reactivity.
|
|
14
|
+
*/
|
|
15
|
+
export interface ComputedNode<T> extends ReactiveNode {
|
|
16
|
+
/**
|
|
17
|
+
* Current value of the computation, or one of the sentinel values above (`UNSET`, `COMPUTING`,
|
|
18
|
+
* `ERROR`).
|
|
19
|
+
*/
|
|
20
|
+
value: T;
|
|
21
|
+
/**
|
|
22
|
+
* If `value` is `ERRORED`, the error caught from the last computation attempt which will
|
|
23
|
+
* be re-thrown.
|
|
24
|
+
*/
|
|
25
|
+
error: unknown;
|
|
26
|
+
/**
|
|
27
|
+
* The computation function which will produce a new value.
|
|
28
|
+
*/
|
|
29
|
+
computation: () => T;
|
|
30
|
+
equal: ValueEqualityFn<T>;
|
|
31
|
+
}
|
|
32
|
+
export type ComputedGetter<T> = (() => T) & {
|
|
33
|
+
[SIGNAL]: ComputedNode<T>;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Create a computed signal which derives a reactive value from an expression.
|
|
37
|
+
*/
|
|
38
|
+
export declare function createComputed<T>(computation: () => T, equal?: ValueEqualityFn<T>): ComputedGetter<T>;
|
|
39
|
+
/**
|
|
40
|
+
* A dedicated symbol used before a computed value has been calculated for the first time.
|
|
41
|
+
* Explicitly typed as `any` so we can use it as signal's value.
|
|
42
|
+
*/
|
|
43
|
+
export declare const UNSET: any;
|
|
44
|
+
/**
|
|
45
|
+
* A dedicated symbol used in place of a computed signal value to indicate that a given computation
|
|
46
|
+
* is in progress. Used to detect cycles in computation chains.
|
|
47
|
+
* Explicitly typed as `any` so we can use it as signal's value.
|
|
48
|
+
*/
|
|
49
|
+
export declare const COMPUTING: any;
|
|
50
|
+
/**
|
|
51
|
+
* A dedicated symbol used in place of a computed signal value to indicate that a given computation
|
|
52
|
+
* failed. The thrown error is cached until the computation gets dirty again.
|
|
53
|
+
* Explicitly typed as `any` so we can use it as signal's value.
|
|
54
|
+
*/
|
|
55
|
+
export declare const ERRORED: any;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import { isDevMode } from '../../../core.js';
|
|
9
|
+
import { defaultEquals } from './equality.js';
|
|
10
|
+
import { consumerAfterComputation, consumerBeforeComputation, producerAccessed, producerUpdateValueVersion, REACTIVE_NODE, runPostProducerCreatedFn, setActiveConsumer, SIGNAL, } from './graph.js';
|
|
11
|
+
/**
|
|
12
|
+
* Create a computed signal which derives a reactive value from an expression.
|
|
13
|
+
*/
|
|
14
|
+
export function createComputed(computation, equal) {
|
|
15
|
+
const node = Object.create(COMPUTED_NODE);
|
|
16
|
+
node.computation = computation;
|
|
17
|
+
if (equal !== undefined) {
|
|
18
|
+
node.equal = equal;
|
|
19
|
+
}
|
|
20
|
+
const computed = () => {
|
|
21
|
+
// Check if the value needs updating before returning it.
|
|
22
|
+
producerUpdateValueVersion(node);
|
|
23
|
+
// Record that someone looked at this signal.
|
|
24
|
+
producerAccessed(node);
|
|
25
|
+
if (node.value === ERRORED) {
|
|
26
|
+
throw node.error;
|
|
27
|
+
}
|
|
28
|
+
return node.value;
|
|
29
|
+
};
|
|
30
|
+
computed[SIGNAL] = node;
|
|
31
|
+
if (isDevMode()) {
|
|
32
|
+
computed.toString = () => `[Computed${node.debugName ? ' (' + node.debugName + ')' : ''}: ${String(node.value)}]`;
|
|
33
|
+
}
|
|
34
|
+
runPostProducerCreatedFn(node);
|
|
35
|
+
return computed;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A dedicated symbol used before a computed value has been calculated for the first time.
|
|
39
|
+
* Explicitly typed as `any` so we can use it as signal's value.
|
|
40
|
+
*/
|
|
41
|
+
export const UNSET = /* @__PURE__ */ Symbol('UNSET');
|
|
42
|
+
/**
|
|
43
|
+
* A dedicated symbol used in place of a computed signal value to indicate that a given computation
|
|
44
|
+
* is in progress. Used to detect cycles in computation chains.
|
|
45
|
+
* Explicitly typed as `any` so we can use it as signal's value.
|
|
46
|
+
*/
|
|
47
|
+
export const COMPUTING = /* @__PURE__ */ Symbol('COMPUTING');
|
|
48
|
+
/**
|
|
49
|
+
* A dedicated symbol used in place of a computed signal value to indicate that a given computation
|
|
50
|
+
* failed. The thrown error is cached until the computation gets dirty again.
|
|
51
|
+
* Explicitly typed as `any` so we can use it as signal's value.
|
|
52
|
+
*/
|
|
53
|
+
export const ERRORED = /* @__PURE__ */ Symbol('ERRORED');
|
|
54
|
+
// Note: Using an IIFE here to ensure that the spread assignment is not considered
|
|
55
|
+
// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.
|
|
56
|
+
const COMPUTED_NODE = /* @__PURE__ */ (() => {
|
|
57
|
+
return {
|
|
58
|
+
...REACTIVE_NODE,
|
|
59
|
+
value: UNSET,
|
|
60
|
+
dirty: true,
|
|
61
|
+
error: null,
|
|
62
|
+
equal: defaultEquals,
|
|
63
|
+
kind: 'computed',
|
|
64
|
+
producerMustRecompute(node) {
|
|
65
|
+
// Force a recomputation if there's no current value, or if the current value is in the
|
|
66
|
+
// process of being calculated (which should throw an error).
|
|
67
|
+
return node.value === UNSET || node.value === COMPUTING;
|
|
68
|
+
},
|
|
69
|
+
producerRecomputeValue(node) {
|
|
70
|
+
if (node.value === COMPUTING) {
|
|
71
|
+
// Our computation somehow led to a cyclic read of itself.
|
|
72
|
+
throw new Error(isDevMode() ? 'Detected cycle in computations.' : '');
|
|
73
|
+
}
|
|
74
|
+
const oldValue = node.value;
|
|
75
|
+
node.value = COMPUTING;
|
|
76
|
+
const prevConsumer = consumerBeforeComputation(node);
|
|
77
|
+
let newValue;
|
|
78
|
+
let wasEqual = false;
|
|
79
|
+
try {
|
|
80
|
+
newValue = node.computation();
|
|
81
|
+
// We want to mark this node as errored if calling `equal` throws; however, we don't want
|
|
82
|
+
// to track any reactive reads inside `equal`.
|
|
83
|
+
setActiveConsumer(null);
|
|
84
|
+
wasEqual =
|
|
85
|
+
oldValue !== UNSET &&
|
|
86
|
+
oldValue !== ERRORED &&
|
|
87
|
+
newValue !== ERRORED &&
|
|
88
|
+
node.equal(oldValue, newValue);
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
newValue = ERRORED;
|
|
92
|
+
node.error = err;
|
|
93
|
+
}
|
|
94
|
+
finally {
|
|
95
|
+
consumerAfterComputation(node, prevConsumer);
|
|
96
|
+
}
|
|
97
|
+
if (wasEqual) {
|
|
98
|
+
// No change to `valueVersion` - old and new values are
|
|
99
|
+
// semantically equivalent.
|
|
100
|
+
node.value = oldValue;
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
node.value = newValue;
|
|
104
|
+
node.version++;
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
})();
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import { type ReactiveNode } from './graph.js';
|
|
9
|
+
/**
|
|
10
|
+
* An effect can, optionally, register a cleanup function. If registered, the cleanup is executed
|
|
11
|
+
* before the next effect run. The cleanup function makes it possible to "cancel" any work that the
|
|
12
|
+
* previous effect run might have started.
|
|
13
|
+
*/
|
|
14
|
+
export type EffectCleanupFn = () => void;
|
|
15
|
+
/**
|
|
16
|
+
* A callback passed to the effect function that makes it possible to register cleanup logic.
|
|
17
|
+
*/
|
|
18
|
+
export type EffectCleanupRegisterFn = (cleanupFn: EffectCleanupFn) => void;
|
|
19
|
+
export interface BaseEffectNode extends ReactiveNode {
|
|
20
|
+
fn: () => void;
|
|
21
|
+
destroy(): void;
|
|
22
|
+
cleanup(): void;
|
|
23
|
+
run(): void;
|
|
24
|
+
}
|
|
25
|
+
export declare const BASE_EFFECT_NODE: Omit<BaseEffectNode, 'fn' | 'destroy' | 'cleanup' | 'run'>;
|
|
26
|
+
export declare function runEffect(node: BaseEffectNode): void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import { consumerAfterComputation, consumerBeforeComputation, consumerPollProducersForChange, REACTIVE_NODE, } from './graph.js';
|
|
9
|
+
export const BASE_EFFECT_NODE =
|
|
10
|
+
/* @__PURE__ */ (() => ({
|
|
11
|
+
...REACTIVE_NODE,
|
|
12
|
+
consumerIsAlwaysLive: true,
|
|
13
|
+
consumerAllowSignalWrites: true,
|
|
14
|
+
dirty: true,
|
|
15
|
+
kind: 'effect',
|
|
16
|
+
}))();
|
|
17
|
+
export function runEffect(node) {
|
|
18
|
+
node.dirty = false;
|
|
19
|
+
if (node.version > 0 && !consumerPollProducersForChange(node)) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
node.version++;
|
|
23
|
+
const prevNode = consumerBeforeComputation(node);
|
|
24
|
+
try {
|
|
25
|
+
node.cleanup();
|
|
26
|
+
node.fn();
|
|
27
|
+
}
|
|
28
|
+
finally {
|
|
29
|
+
consumerAfterComputation(node, prevNode);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
9
9
|
* A comparison function which can determine if two values are equal.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
9
9
|
* The default equality function used for `signal` and `computed`, which uses referential equality.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import type { SignalNode } from './signal.js';
|
|
9
|
+
export declare function throwInvalidWriteToSignalError<T>(node: SignalNode<T>): void;
|
|
10
|
+
export declare function setThrowInvalidWriteToSignalError(fn: <T>(node: SignalNode<T>) => never): void;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
1
|
/**
|
|
3
2
|
* @license
|
|
4
3
|
* Copyright Google LLC All Rights Reserved.
|
|
5
4
|
*
|
|
6
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
7
|
*/
|
|
9
8
|
function defaultThrowError() {
|
|
10
9
|
throw new Error();
|
|
11
10
|
}
|
|
12
11
|
let throwInvalidWriteToSignalErrorFn = defaultThrowError;
|
|
13
|
-
export function throwInvalidWriteToSignalError() {
|
|
14
|
-
throwInvalidWriteToSignalErrorFn();
|
|
12
|
+
export function throwInvalidWriteToSignalError(node) {
|
|
13
|
+
throwInvalidWriteToSignalErrorFn(node);
|
|
15
14
|
}
|
|
16
15
|
export function setThrowInvalidWriteToSignalError(fn) {
|
|
17
16
|
throwInvalidWriteToSignalErrorFn = fn;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
declare global {
|
|
9
|
+
var devtoolsFormatters: any[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Installs the custom formatter into custom formatting on Signals in the devtools.
|
|
13
|
+
*
|
|
14
|
+
* Supported by both Chrome and Firefox.
|
|
15
|
+
*
|
|
16
|
+
* @see https://firefox-source-docs.mozilla.org/devtools-user/custom_formatters/index.html
|
|
17
|
+
*/
|
|
18
|
+
export declare function installDevToolsSignalFormatter(): void;
|
|
19
|
+
export {};
|