@warp-drive/core 5.6.0-alpha.15 → 5.6.0-alpha.18
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/declarations/build-config/babel-macros.d.ts +1 -2
- package/declarations/build-config/canary-features.d.ts +1 -2
- package/declarations/build-config/debugging.d.ts +1 -2
- package/declarations/build-config/deprecations.d.ts +1 -2
- package/declarations/build-config/env.d.ts +1 -2
- package/declarations/build-config/macros.d.ts +1 -2
- package/declarations/build-config.d.ts +1 -2
- package/declarations/configure.d.ts +6 -7
- package/declarations/graph/-private/-diff.d.ts +21 -22
- package/declarations/graph/-private/-edge-definition.d.ts +134 -135
- package/declarations/graph/-private/-state.d.ts +93 -7
- package/declarations/graph/-private/-utils.d.ts +18 -13
- package/declarations/graph/-private/coerce-id.d.ts +6 -1
- package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +15 -4
- package/declarations/graph/-private/edges/collection.d.ts +35 -36
- package/declarations/graph/-private/edges/implicit.d.ts +28 -29
- package/declarations/graph/-private/edges/resource.d.ts +19 -20
- package/declarations/graph/-private/graph.d.ts +83 -48
- package/declarations/graph/-private/normalize-link.d.ts +7 -2
- package/declarations/graph/-private/operations/add-to-related-records.d.ts +3 -4
- package/declarations/graph/-private/operations/merge-identifier.d.ts +2 -3
- package/declarations/graph/-private/operations/remove-from-related-records.d.ts +3 -4
- package/declarations/graph/-private/operations/replace-related-record.d.ts +2 -3
- package/declarations/graph/-private/operations/replace-related-records.d.ts +58 -4
- package/declarations/graph/-private/operations/update-relationship.d.ts +11 -9
- package/declarations/graph/-private.d.ts +9 -10
- package/declarations/index.d.ts +11 -12
- package/declarations/reactive/-private/document.d.ts +143 -144
- package/declarations/reactive/-private/fields/compute.d.ts +31 -28
- package/declarations/reactive/-private/fields/extension.d.ts +2 -3
- package/declarations/reactive/-private/fields/managed-array.d.ts +19 -20
- package/declarations/reactive/-private/fields/managed-object.d.ts +16 -16
- package/declarations/reactive/-private/fields/many-array-manager.d.ts +15 -16
- package/declarations/reactive/-private/hooks.d.ts +3 -4
- package/declarations/reactive/-private/record.d.ts +61 -59
- package/declarations/reactive/-private/schema.d.ts +242 -224
- package/declarations/reactive/-private/symbols.d.ts +26 -1
- package/declarations/reactive/-private.d.ts +1 -2
- package/declarations/reactive.d.ts +4 -5
- package/declarations/request/-private/context.d.ts +34 -35
- package/declarations/request/-private/debug.d.ts +2 -3
- package/declarations/request/-private/fetch.d.ts +23 -24
- package/declarations/request/-private/future.d.ts +3 -4
- package/declarations/request/-private/manager.d.ts +159 -157
- package/declarations/request/-private/promise-cache.d.ts +21 -13
- package/declarations/request/-private/types.d.ts +124 -124
- package/declarations/request/-private/utils.d.ts +8 -9
- package/declarations/request.d.ts +5 -6
- package/declarations/store/-private/cache-handler/handler.d.ts +57 -52
- package/declarations/store/-private/cache-handler/types.d.ts +95 -96
- package/declarations/store/-private/cache-handler/utils.d.ts +16 -16
- package/declarations/store/-private/caches/cache-utils.d.ts +7 -4
- package/declarations/store/-private/caches/identifier-cache.d.ts +234 -246
- package/declarations/store/-private/caches/instance-cache.d.ts +47 -47
- package/declarations/store/-private/caches/resource-utils.d.ts +3 -4
- package/declarations/store/-private/debug/utils.d.ts +6 -7
- package/declarations/store/-private/default-cache-policy.d.ts +362 -361
- package/declarations/store/-private/legacy-model-support/record-reference.d.ts +154 -159
- package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts +14 -14
- package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +21 -22
- package/declarations/store/-private/managers/cache-manager.d.ts +440 -425
- package/declarations/store/-private/managers/notification-manager.d.ts +88 -83
- package/declarations/store/-private/managers/record-array-manager.d.ts +89 -90
- package/declarations/store/-private/network/request-cache.d.ts +86 -83
- package/declarations/store/-private/new-core-tmp/promise-state.d.ts +252 -244
- package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts +154 -155
- package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts +148 -149
- package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +28 -23
- package/declarations/store/-private/new-core-tmp/request-state.d.ts +263 -241
- package/declarations/store/-private/new-core-tmp/request-subscription.d.ts +253 -223
- package/declarations/store/-private/record-arrays/identifier-array.d.ts +125 -121
- package/declarations/store/-private/record-arrays/many-array.d.ts +180 -184
- package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +120 -110
- package/declarations/store/-private/store-service.d.ts +1594 -1586
- package/declarations/store/-private/utils/coerce-id.d.ts +6 -1
- package/declarations/store/-private/utils/construct-resource.d.ts +1 -2
- package/declarations/store/-private/utils/is-non-empty-string.d.ts +0 -1
- package/declarations/store/-private/utils/normalize-model-name.d.ts +0 -1
- package/declarations/store/-private/utils/uuid-polyfill.d.ts +0 -1
- package/declarations/store/-private.d.ts +31 -28
- package/declarations/store/-types/q/cache-capabilities-manager.d.ts +96 -97
- package/declarations/store/-types/q/ds-model.d.ts +17 -18
- package/declarations/store/-types/q/identifier.d.ts +11 -12
- package/declarations/store/-types/q/record-instance.d.ts +16 -17
- package/declarations/store/-types/q/schema-service.d.ts +346 -343
- package/declarations/store/-types/q/store.d.ts +25 -28
- package/declarations/store.d.ts +1 -2
- package/declarations/types/-private.d.ts +16 -8
- package/declarations/types/cache/aliases.d.ts +11 -1
- package/declarations/types/cache/change.d.ts +4 -5
- package/declarations/types/cache/mutations.d.ts +51 -28
- package/declarations/types/cache/operations.d.ts +60 -47
- package/declarations/types/cache/relationship.d.ts +11 -9
- package/declarations/types/cache.d.ts +495 -484
- package/declarations/types/graph.d.ts +31 -32
- package/declarations/types/identifier.d.ts +83 -82
- package/declarations/types/json/raw.d.ts +1 -2
- package/declarations/types/params.d.ts +4 -5
- package/declarations/types/record.d.ts +117 -76
- package/declarations/types/request.d.ts +289 -266
- package/declarations/types/runtime.d.ts +8 -9
- package/declarations/types/schema/concepts.d.ts +19 -13
- package/declarations/types/schema/fields.d.ts +1712 -1713
- package/declarations/types/schema/fields.type-test.d.ts +0 -1
- package/declarations/types/spec/document.d.ts +28 -22
- package/declarations/types/spec/error.d.ts +16 -17
- package/declarations/types/spec/json-api-raw.d.ts +102 -102
- package/declarations/types/symbols.d.ts +74 -75
- package/declarations/types/utils.d.ts +5 -5
- package/declarations/types.d.ts +10 -11
- package/declarations/utils/string.d.ts +43 -40
- package/dist/graph/-private.js +1 -1
- package/dist/{handler-D1C3Innj.js → handler-C2T-IyJK.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/reactive/-private.js +1 -1
- package/dist/reactive.js +42 -73
- package/dist/{request-state-CCOJIj5i.js → request-state-CjLph1LP.js} +275 -261
- package/dist/store/-private.js +2 -2
- package/dist/{symbols-epHW0Vm9.js → symbols-SIstXMLI.js} +1 -1
- package/dist/types/-private.js +1 -1
- package/package.json +4 -4
- package/declarations/build-config/babel-macros.d.ts.map +0 -1
- package/declarations/build-config/canary-features.d.ts.map +0 -1
- package/declarations/build-config/debugging.d.ts.map +0 -1
- package/declarations/build-config/deprecations.d.ts.map +0 -1
- package/declarations/build-config/env.d.ts.map +0 -1
- package/declarations/build-config/macros.d.ts.map +0 -1
- package/declarations/build-config.d.ts.map +0 -1
- package/declarations/configure.d.ts.map +0 -1
- package/declarations/graph/-private/-diff.d.ts.map +0 -1
- package/declarations/graph/-private/-edge-definition.d.ts.map +0 -1
- package/declarations/graph/-private/-state.d.ts.map +0 -1
- package/declarations/graph/-private/-utils.d.ts.map +0 -1
- package/declarations/graph/-private/coerce-id.d.ts.map +0 -1
- package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts.map +0 -1
- package/declarations/graph/-private/edges/collection.d.ts.map +0 -1
- package/declarations/graph/-private/edges/implicit.d.ts.map +0 -1
- package/declarations/graph/-private/edges/resource.d.ts.map +0 -1
- package/declarations/graph/-private/graph.d.ts.map +0 -1
- package/declarations/graph/-private/normalize-link.d.ts.map +0 -1
- package/declarations/graph/-private/operations/add-to-related-records.d.ts.map +0 -1
- package/declarations/graph/-private/operations/merge-identifier.d.ts.map +0 -1
- package/declarations/graph/-private/operations/remove-from-related-records.d.ts.map +0 -1
- package/declarations/graph/-private/operations/replace-related-record.d.ts.map +0 -1
- package/declarations/graph/-private/operations/replace-related-records.d.ts.map +0 -1
- package/declarations/graph/-private/operations/update-relationship.d.ts.map +0 -1
- package/declarations/graph/-private.d.ts.map +0 -1
- package/declarations/index.d.ts.map +0 -1
- package/declarations/reactive/-private/document.d.ts.map +0 -1
- package/declarations/reactive/-private/fields/compute.d.ts.map +0 -1
- package/declarations/reactive/-private/fields/extension.d.ts.map +0 -1
- package/declarations/reactive/-private/fields/managed-array.d.ts.map +0 -1
- package/declarations/reactive/-private/fields/managed-object.d.ts.map +0 -1
- package/declarations/reactive/-private/fields/many-array-manager.d.ts.map +0 -1
- package/declarations/reactive/-private/hooks.d.ts.map +0 -1
- package/declarations/reactive/-private/record.d.ts.map +0 -1
- package/declarations/reactive/-private/schema.d.ts.map +0 -1
- package/declarations/reactive/-private/symbols.d.ts.map +0 -1
- package/declarations/reactive/-private.d.ts.map +0 -1
- package/declarations/reactive.d.ts.map +0 -1
- package/declarations/request/-private/context.d.ts.map +0 -1
- package/declarations/request/-private/debug.d.ts.map +0 -1
- package/declarations/request/-private/fetch.d.ts.map +0 -1
- package/declarations/request/-private/future.d.ts.map +0 -1
- package/declarations/request/-private/manager.d.ts.map +0 -1
- package/declarations/request/-private/promise-cache.d.ts.map +0 -1
- package/declarations/request/-private/types.d.ts.map +0 -1
- package/declarations/request/-private/utils.d.ts.map +0 -1
- package/declarations/request.d.ts.map +0 -1
- package/declarations/store/-private/cache-handler/handler.d.ts.map +0 -1
- package/declarations/store/-private/cache-handler/types.d.ts.map +0 -1
- package/declarations/store/-private/cache-handler/utils.d.ts.map +0 -1
- package/declarations/store/-private/caches/cache-utils.d.ts.map +0 -1
- package/declarations/store/-private/caches/identifier-cache.d.ts.map +0 -1
- package/declarations/store/-private/caches/instance-cache.d.ts.map +0 -1
- package/declarations/store/-private/caches/resource-utils.d.ts.map +0 -1
- package/declarations/store/-private/debug/utils.d.ts.map +0 -1
- package/declarations/store/-private/default-cache-policy.d.ts.map +0 -1
- package/declarations/store/-private/legacy-model-support/record-reference.d.ts.map +0 -1
- package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts.map +0 -1
- package/declarations/store/-private/managers/cache-capabilities-manager.d.ts.map +0 -1
- package/declarations/store/-private/managers/cache-manager.d.ts.map +0 -1
- package/declarations/store/-private/managers/notification-manager.d.ts.map +0 -1
- package/declarations/store/-private/managers/record-array-manager.d.ts.map +0 -1
- package/declarations/store/-private/network/request-cache.d.ts.map +0 -1
- package/declarations/store/-private/new-core-tmp/promise-state.d.ts.map +0 -1
- package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts.map +0 -1
- package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts.map +0 -1
- package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts.map +0 -1
- package/declarations/store/-private/new-core-tmp/request-state.d.ts.map +0 -1
- package/declarations/store/-private/new-core-tmp/request-subscription.d.ts.map +0 -1
- package/declarations/store/-private/record-arrays/identifier-array.d.ts.map +0 -1
- package/declarations/store/-private/record-arrays/many-array.d.ts.map +0 -1
- package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts.map +0 -1
- package/declarations/store/-private/store-service.d.ts.map +0 -1
- package/declarations/store/-private/store-service.type-test.d.ts +0 -2
- package/declarations/store/-private/store-service.type-test.d.ts.map +0 -1
- package/declarations/store/-private/utils/coerce-id.d.ts.map +0 -1
- package/declarations/store/-private/utils/construct-resource.d.ts.map +0 -1
- package/declarations/store/-private/utils/is-non-empty-string.d.ts.map +0 -1
- package/declarations/store/-private/utils/normalize-model-name.d.ts.map +0 -1
- package/declarations/store/-private/utils/uuid-polyfill.d.ts.map +0 -1
- package/declarations/store/-private.d.ts.map +0 -1
- package/declarations/store/-types/q/cache-capabilities-manager.d.ts.map +0 -1
- package/declarations/store/-types/q/ds-model.d.ts.map +0 -1
- package/declarations/store/-types/q/identifier.d.ts.map +0 -1
- package/declarations/store/-types/q/promise-proxies.d.ts +0 -2
- package/declarations/store/-types/q/promise-proxies.d.ts.map +0 -1
- package/declarations/store/-types/q/record-data-json-api.d.ts +0 -31
- package/declarations/store/-types/q/record-data-json-api.d.ts.map +0 -1
- package/declarations/store/-types/q/record-instance.d.ts.map +0 -1
- package/declarations/store/-types/q/schema-service.d.ts.map +0 -1
- package/declarations/store/-types/q/store.d.ts.map +0 -1
- package/declarations/store.d.ts.map +0 -1
- package/declarations/types/-private.d.ts.map +0 -1
- package/declarations/types/cache/aliases.d.ts.map +0 -1
- package/declarations/types/cache/change.d.ts.map +0 -1
- package/declarations/types/cache/mutations.d.ts.map +0 -1
- package/declarations/types/cache/operations.d.ts.map +0 -1
- package/declarations/types/cache/relationship.d.ts.map +0 -1
- package/declarations/types/cache.d.ts.map +0 -1
- package/declarations/types/graph.d.ts.map +0 -1
- package/declarations/types/identifier.d.ts.map +0 -1
- package/declarations/types/json/raw.d.ts.map +0 -1
- package/declarations/types/params.d.ts.map +0 -1
- package/declarations/types/record.d.ts.map +0 -1
- package/declarations/types/record.type-test.d.ts +0 -2
- package/declarations/types/record.type-test.d.ts.map +0 -1
- package/declarations/types/request.d.ts.map +0 -1
- package/declarations/types/request.type-test.d.ts +0 -2
- package/declarations/types/request.type-test.d.ts.map +0 -1
- package/declarations/types/runtime.d.ts.map +0 -1
- package/declarations/types/schema/concepts.d.ts.map +0 -1
- package/declarations/types/schema/fields.d.ts.map +0 -1
- package/declarations/types/schema/fields.type-test.d.ts.map +0 -1
- package/declarations/types/spec/document.d.ts.map +0 -1
- package/declarations/types/spec/error.d.ts.map +0 -1
- package/declarations/types/spec/json-api-raw.d.ts.map +0 -1
- package/declarations/types/symbols.d.ts.map +0 -1
- package/declarations/types/utils.d.ts.map +0 -1
- package/declarations/types.d.ts.map +0 -1
- package/declarations/utils/string.d.ts.map +0 -1
- package/dist/build-config/babel-macros.js.map +0 -1
- package/dist/build-config/canary-features.js.map +0 -1
- package/dist/build-config/debugging.js.map +0 -1
- package/dist/build-config/deprecations.js.map +0 -1
- package/dist/build-config/env.js.map +0 -1
- package/dist/build-config/macros.js.map +0 -1
- package/dist/build-config.js.map +0 -1
- package/dist/configure-B48bFHOl.js.map +0 -1
- package/dist/configure.js.map +0 -1
- package/dist/context-COmAnXUQ.js.map +0 -1
- package/dist/graph/-private.js.map +0 -1
- package/dist/handler-D1C3Innj.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/reactive/-private.js.map +0 -1
- package/dist/reactive.js.map +0 -1
- package/dist/request-state-CCOJIj5i.js.map +0 -1
- package/dist/request.js.map +0 -1
- package/dist/store/-private.js.map +0 -1
- package/dist/store.js.map +0 -1
- package/dist/symbols-epHW0Vm9.js.map +0 -1
- package/dist/types/-private.js.map +0 -1
- package/dist/types/cache/aliases.js.map +0 -1
- package/dist/types/cache/change.js.map +0 -1
- package/dist/types/cache/mutations.js.map +0 -1
- package/dist/types/cache/operations.js.map +0 -1
- package/dist/types/cache/relationship.js.map +0 -1
- package/dist/types/cache.js.map +0 -1
- package/dist/types/graph.js.map +0 -1
- package/dist/types/identifier.js.map +0 -1
- package/dist/types/json/raw.js.map +0 -1
- package/dist/types/params.js.map +0 -1
- package/dist/types/record.js.map +0 -1
- package/dist/types/request.js.map +0 -1
- package/dist/types/runtime.js.map +0 -1
- package/dist/types/schema/concepts.js.map +0 -1
- package/dist/types/schema/fields.js.map +0 -1
- package/dist/types/schema/fields.type-test.js.map +0 -1
- package/dist/types/spec/document.js.map +0 -1
- package/dist/types/spec/error.js.map +0 -1
- package/dist/types/spec/json-api-raw.js.map +0 -1
- package/dist/types/symbols.js.map +0 -1
- package/dist/types/utils.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/string.js.map +0 -1
|
@@ -1,177 +1,176 @@
|
|
|
1
1
|
export declare const ARRAY_SIGNAL: "___(unique) Symbol(#[])";
|
|
2
2
|
export declare const OBJECT_SIGNAL: "___(unique) Symbol(#{})";
|
|
3
3
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
4
|
+
* Requirements:
|
|
5
|
+
*
|
|
6
|
+
* Signal:
|
|
7
|
+
*
|
|
8
|
+
* - signal: a way of creating a reference that we can dirty when we desire to notify
|
|
9
|
+
* - @signal: a way of creating an accessor on an object that subscribes to a signal on access
|
|
10
|
+
* and notifies the signal on set, or of upgrading a descriptor to be such an accessor
|
|
11
|
+
* - defineSignal: a way of creating a signal on an object
|
|
12
|
+
* - notifySignal: a way of notifying the underlying signal that it has been dirtied
|
|
13
|
+
* - peekSignal: a way of inspecting the signal without notifying it
|
|
14
|
+
*
|
|
15
|
+
* - gate: a memoized getter function that re-runs when on access if its signal is dirty
|
|
16
|
+
* conceptually, a gate is a tightly coupled signal and memo
|
|
17
|
+
* - @gate: a way of creating a gate on an object or upgrading a descriptor with a getter
|
|
18
|
+
* to be a gate
|
|
19
|
+
* - defineGate: a way of creating a gate on an object
|
|
20
|
+
* - notifySignal: a way of notifying the signal for a gate that it has been dirtied
|
|
21
|
+
*
|
|
22
|
+
* - memo:
|
|
23
|
+
* - @memo: a way of creating a memoized getter on an object or upgrading a descriptor with a getter
|
|
24
|
+
* to be a memo
|
|
25
|
+
* - defineMemo: a way of creating a memo on an object
|
|
26
|
+
*
|
|
27
|
+
* - signalStore: storage bucket for signals associated to an object
|
|
28
|
+
* - withSignalStore: a way of pre-creating a signal store on an object
|
|
29
|
+
*
|
|
30
|
+
*
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
33
|
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
* An Opaque type that represents a framework specific or TC39 signal.
|
|
35
|
+
*
|
|
36
|
+
* It may be an array of signals or a single signal.
|
|
37
|
+
*
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
40
|
export type SignalRef = unknown;
|
|
41
41
|
/**
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
42
|
+
* The hooks which MUST be configured in order to use reactive arrays,
|
|
43
|
+
* resources and documents with framework specfic signals or TC39 signals.
|
|
44
|
+
*
|
|
45
|
+
* Support for multiple frameworks simultaneously can be done via
|
|
46
|
+
* this abstraction by returning multiple signals from the `createSignal`
|
|
47
|
+
* method, and consuming the correct one via the correct framework via
|
|
48
|
+
* the `consumeSignal` and `notifySignal` methods.
|
|
49
|
+
*
|
|
50
|
+
* Unlike many signals implementations, WarpDrive does not wrap values as
|
|
51
|
+
* signals directly, but instead uses signals to alert the reactive layer
|
|
52
|
+
* to changes in the underlying cache. E.g. a signal is associated to a value,
|
|
53
|
+
* but does not serve as the cache for that value directly. We refer to this as
|
|
54
|
+
* a "gate", the pattern has also been called "side-signals".
|
|
55
|
+
*
|
|
56
|
+
* A no-op implementation is allowed, though it may lead to performance issues
|
|
57
|
+
* in locations that use createMemo as no memoization would be done. This is
|
|
58
|
+
* typically desirable only when integrating with a framework that does its own
|
|
59
|
+
* memoization and does not integrate with any signals-like primitive. For these
|
|
60
|
+
* scenarios you may also be interested in integrating with the {@link NotificationManager}
|
|
61
|
+
* more directly.
|
|
62
|
+
*
|
|
63
|
+
* @public
|
|
64
|
+
*/
|
|
65
65
|
export interface SignalHooks<T = SignalRef> {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Create a signal for the given key associated to the given object.
|
|
68
|
+
*
|
|
69
|
+
* This method does *not* need to cache the signal, it will only be
|
|
70
|
+
* called once for a given object and key. However, if your framework
|
|
71
|
+
* will look for a signal cache on the object in a given location or may
|
|
72
|
+
* have created its own signal on the object for some reason it may be
|
|
73
|
+
* useful to ensure such cache is properly updated.
|
|
74
|
+
*/
|
|
75
|
+
createSignal: (obj: object, key: string | symbol) => T;
|
|
76
|
+
/**
|
|
77
|
+
* Consume (mark as acccessed) a signal previously created via createSignal.
|
|
78
|
+
*/
|
|
79
|
+
consumeSignal: (signal: T) => void;
|
|
80
|
+
/**
|
|
81
|
+
* Alert a signal previously created via createSignal that its associated value has changed.
|
|
82
|
+
*/
|
|
83
|
+
notifySignal: (signal: T) => void;
|
|
84
|
+
/**
|
|
85
|
+
* Take the given function and wrap it in signals-based memoization. Analagous
|
|
86
|
+
* to a Computed in the TC39 spec.
|
|
87
|
+
*
|
|
88
|
+
* Should return a function which when run provides the latest value of the original
|
|
89
|
+
* function.
|
|
90
|
+
*/
|
|
91
|
+
createMemo: <F>(obj: object, key: string | symbol, fn: () => F) => () => F;
|
|
92
|
+
/**
|
|
93
|
+
* If the signals implementation allows synchronous flushing of watchers, and
|
|
94
|
+
* has scheduled such a flush (e.g. watchers will run before the current calling
|
|
95
|
+
* context yields) this should return "true".
|
|
96
|
+
*
|
|
97
|
+
* This is generally something that should return false for anything but the few
|
|
98
|
+
* frameworks that extensively handle their own reactivity => render scheduling.
|
|
99
|
+
*
|
|
100
|
+
* For an example, see EmberJS's backburner scheduler which functioned as a microtask
|
|
101
|
+
* polyfill.
|
|
102
|
+
*/
|
|
103
|
+
willSyncFlushWatchers: () => boolean;
|
|
104
|
+
/**
|
|
105
|
+
* An optional method that allows wrapping key promises within WarpDrive
|
|
106
|
+
* for things like test-waiters.
|
|
107
|
+
*/
|
|
108
|
+
waitFor?: <K>(promise: Promise<K>) => Promise<K>;
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
111
|
+
* Contains information a {@link SignalHooks} implementation may want
|
|
112
|
+
* to use, such as the specialized key used for the signal
|
|
113
|
+
* representing an array's contents / length.
|
|
114
|
+
*
|
|
115
|
+
* ```ts
|
|
116
|
+
* interface HooksOptions {
|
|
117
|
+
* wellknown: {
|
|
118
|
+
* Array: symbol | string;
|
|
119
|
+
* }
|
|
120
|
+
* }
|
|
121
|
+
* ```
|
|
122
|
+
*
|
|
123
|
+
* @public
|
|
124
|
+
*/
|
|
125
125
|
export interface HooksOptions {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
126
|
+
/**
|
|
127
|
+
* A list of specialized symbols/strings
|
|
128
|
+
* used by WarpDrive to encapsulate key
|
|
129
|
+
* reactivity concerns.
|
|
130
|
+
*/
|
|
131
|
+
wellknown: {
|
|
132
|
+
/**
|
|
133
|
+
* The key used when the signal provides reactivity for the
|
|
134
|
+
* `length` or "contents" of an array.
|
|
135
|
+
*
|
|
136
|
+
* Arrays only use a single signal for all accesses, regardless
|
|
137
|
+
* of index, property or method: this one.
|
|
138
|
+
*/
|
|
139
|
+
Array: symbol | string;
|
|
140
|
+
};
|
|
141
141
|
}
|
|
142
142
|
/**
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
143
|
+
* Configures the signals implementation to use. Supports multiple
|
|
144
|
+
* implementations simultaneously.
|
|
145
|
+
*
|
|
146
|
+
* See {@link HooksOptions} for the options passed to the provided function
|
|
147
|
+
* when called.
|
|
148
|
+
*
|
|
149
|
+
* See {@link SignalHooks} for the implementation the callback function should
|
|
150
|
+
* return.
|
|
151
|
+
*
|
|
152
|
+
* @public
|
|
153
|
+
* @param buildConfig - a function that takes options and returns a configuration object
|
|
154
|
+
*/
|
|
155
155
|
export declare function setupSignals<T>(buildConfig: (options: HooksOptions) => SignalHooks<T>): void;
|
|
156
156
|
/**
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
157
|
+
* Internal method for consuming the configured `createSignal` hook
|
|
158
|
+
*
|
|
159
|
+
* @internal
|
|
160
|
+
*/
|
|
161
161
|
export declare function createSignal(obj: object, key: string | symbol): SignalRef;
|
|
162
162
|
/**
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
163
|
+
* Internal method for consuming the configured `consumeSignal` hook
|
|
164
|
+
*
|
|
165
|
+
* @internal
|
|
166
|
+
*/
|
|
167
167
|
export declare function consumeSignal(signal: SignalRef): void;
|
|
168
168
|
/**
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
169
|
+
* Internal method for consuming the configured `notifySignal` hook
|
|
170
|
+
*
|
|
171
|
+
* @internal
|
|
172
|
+
*/
|
|
173
173
|
export declare function notifySignal(signal: SignalRef): void;
|
|
174
174
|
export declare function createMemo<T>(object: object, key: string | symbol, fn: () => T): () => T;
|
|
175
175
|
export declare function willSyncFlushWatchers(): boolean;
|
|
176
176
|
export declare function waitFor<K>(promise: Promise<K>): Promise<K>;
|
|
177
|
-
//# sourceMappingURL=configure.d.ts.map
|
|
@@ -1,170 +1,169 @@
|
|
|
1
|
-
import { ARRAY_SIGNAL, OBJECT_SIGNAL, type SignalRef } from
|
|
1
|
+
import { ARRAY_SIGNAL, OBJECT_SIGNAL, type SignalRef } from "./configure.js";
|
|
2
2
|
export type { SignalRef };
|
|
3
3
|
export { ARRAY_SIGNAL, OBJECT_SIGNAL };
|
|
4
4
|
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
5
|
+
* A WarpDriveSignal is a wrapper around a framework specific or TC39 signal
|
|
6
|
+
* that enables us to store and manage the signal in a universal way.
|
|
7
|
+
*
|
|
8
|
+
* WarpDrive uses signals to manage three separate concepts:
|
|
9
|
+
*
|
|
10
|
+
* - as a `storage` for a value local to the object that we want to be reactive
|
|
11
|
+
* (see `@local` schema field for an example)
|
|
12
|
+
* - as a `gate` for a memoized getter that we want to act as a reactive property
|
|
13
|
+
* but whose value is computed/pulled from a non-reactive source elsewhere
|
|
14
|
+
* and whose latest value is stored in the signal
|
|
15
|
+
* (see `field` schema field for an example)
|
|
16
|
+
* - as a `gate` with a manually managed value updated on pull when `isStale` is true
|
|
17
|
+
*
|
|
18
|
+
*
|
|
19
|
+
* It offers
|
|
20
|
+
*
|
|
21
|
+
* - a non-reactive way to access/update the current value
|
|
22
|
+
* - a non-reactive way to mark the signal as dirtied
|
|
23
|
+
* - a non-reactive way to store content for why the signal was dirtied
|
|
24
|
+
* - access to the underlying Signal(s) in-use
|
|
25
|
+
*
|
|
26
|
+
* For debugging:
|
|
27
|
+
* - the "key" or "name" of the signal
|
|
28
|
+
* - the "object identity" or "context" to which the signal is attached
|
|
29
|
+
*
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
32
|
export interface WarpDriveSignal {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
33
|
+
/**
|
|
34
|
+
* The "key" or "name" of the signal.
|
|
35
|
+
* This is usually (but not always) the name of a property
|
|
36
|
+
* on the object to which the signal is attached.
|
|
37
|
+
*
|
|
38
|
+
* This is used for debugging purposes.
|
|
39
|
+
* It is not used for any other purpose.
|
|
40
|
+
*
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
key: string | symbol;
|
|
44
|
+
/**
|
|
45
|
+
* The "object identity" or "context" to which the
|
|
46
|
+
* signal is attached.
|
|
47
|
+
*
|
|
48
|
+
* This is used for debugging purposes.
|
|
49
|
+
* It is not used for any other purpose.
|
|
50
|
+
*
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
context: object;
|
|
54
|
+
/**
|
|
55
|
+
* The underlying signal(s) in-use.
|
|
56
|
+
*
|
|
57
|
+
* Generally, this is a single signal.
|
|
58
|
+
*
|
|
59
|
+
* In some cases multiple signals need to be condensed,
|
|
60
|
+
* such as to support legacy Ember Array APIs or to
|
|
61
|
+
* support reactive-objects shared between the code of
|
|
62
|
+
* multiple frameworks.
|
|
63
|
+
*
|
|
64
|
+
* In such cases, this value may be an array.
|
|
65
|
+
*
|
|
66
|
+
* e.g. (pseudo-code for Ember):
|
|
67
|
+
*
|
|
68
|
+
* setupSignals({
|
|
69
|
+
* createSignal: (obj, key, initialValue) => {
|
|
70
|
+
* if (isArraySignal(key)) {
|
|
71
|
+
* return [
|
|
72
|
+
* tagForProperty(obj, key),
|
|
73
|
+
* tagForProperty(obj, '[]'),
|
|
74
|
+
* tagForProperty(obj, 'length'),
|
|
75
|
+
* ];
|
|
76
|
+
* }
|
|
77
|
+
* return tagForProperty(obj, key);
|
|
78
|
+
* },
|
|
79
|
+
*
|
|
80
|
+
* consumeSignal: (signal) => {
|
|
81
|
+
* if (Array.isArray(signal)) {
|
|
82
|
+
* signal.forEach((s) => consumeTag(s));
|
|
83
|
+
* } else {
|
|
84
|
+
* consumeTag(signal);
|
|
85
|
+
* }
|
|
86
|
+
* },
|
|
87
|
+
*
|
|
88
|
+
* dirtySignal: (signal) => {
|
|
89
|
+
* if (Array.isArray(signal)) {
|
|
90
|
+
* signal.forEach((s) => dirtyTag(s));
|
|
91
|
+
* } else {
|
|
92
|
+
* dirtyTag(signal);
|
|
93
|
+
* }
|
|
94
|
+
* },
|
|
95
|
+
* });
|
|
96
|
+
*
|
|
97
|
+
* @internal
|
|
98
|
+
*/
|
|
99
|
+
signal: SignalRef;
|
|
100
|
+
/**
|
|
101
|
+
* The last "value" computed for this signal when
|
|
102
|
+
* a signal is also used for storage.
|
|
103
|
+
*
|
|
104
|
+
* @internal
|
|
105
|
+
*/
|
|
106
|
+
value: unknown;
|
|
107
|
+
/**
|
|
108
|
+
* Whether ths signal is known to have been dirtied.
|
|
109
|
+
* This is useful *both* when manually managing the
|
|
110
|
+
* `value` cache and when using the signal as a
|
|
111
|
+
* "gate"
|
|
112
|
+
*
|
|
113
|
+
* @internal
|
|
114
|
+
*/
|
|
115
|
+
isStale: boolean;
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
118
|
+
* We attach signals to their context object via
|
|
119
|
+
* a Map attached to the object via this symbol.
|
|
120
|
+
*
|
|
121
|
+
* This allows us to store multiple signals
|
|
122
|
+
* on the same object with smaller memory
|
|
123
|
+
* overhead and no WeakMap lookups.
|
|
124
|
+
*
|
|
125
|
+
* Performance sensitive objects should
|
|
126
|
+
* pre-warm their shape by assigning this
|
|
127
|
+
* during initialization.
|
|
128
|
+
*
|
|
129
|
+
* ```ts
|
|
130
|
+
* initializeSignalStore(obj);
|
|
131
|
+
* ```
|
|
132
|
+
*
|
|
133
|
+
* @internal
|
|
134
|
+
*/
|
|
135
135
|
export declare const Signals: "___(unique) Symbol(Signals)";
|
|
136
136
|
export type SignalStore = Map<string | symbol, WarpDriveSignal>;
|
|
137
137
|
/**
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
138
|
+
* A type util to recast the object as having a signal store.
|
|
139
|
+
*
|
|
140
|
+
* @internal
|
|
141
|
+
*/
|
|
142
142
|
export declare function upgradeWithSignals<T extends object>(obj: T): asserts obj is T & {
|
|
143
|
-
|
|
143
|
+
[Signals]: SignalStore;
|
|
144
144
|
};
|
|
145
145
|
/**
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
146
|
+
* A util that will create a signal store on the object
|
|
147
|
+
* if it does not already exist and returns the associated
|
|
148
|
+
* signal store.
|
|
149
|
+
*
|
|
150
|
+
* @internal
|
|
151
|
+
*/
|
|
152
152
|
export declare function withSignalStore<T extends object>(obj: T): SignalStore;
|
|
153
153
|
/**
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
154
|
+
* A util that will create a signal store on the object
|
|
155
|
+
* if it does not already exist.
|
|
156
|
+
*
|
|
157
|
+
* Useful for pre-warming the shape of an object to ensure
|
|
158
|
+
* a key-transition to add it is not required later.
|
|
159
|
+
*
|
|
160
|
+
* @internal
|
|
161
|
+
*/
|
|
162
162
|
export declare function initializeSignalStore<T extends object>(obj: T): asserts obj is T & {
|
|
163
|
-
|
|
163
|
+
[Signals]: SignalStore;
|
|
164
164
|
};
|
|
165
165
|
export declare function createInternalSignal(signals: SignalStore, obj: object, key: string | symbol, initialValue: unknown): WarpDriveSignal;
|
|
166
166
|
export declare function getOrCreateInternalSignal(signals: SignalStore, obj: object, key: string | symbol, initialValue: unknown): WarpDriveSignal;
|
|
167
167
|
export declare function peekInternalSignal(signals: SignalStore | undefined, key: string | symbol): WarpDriveSignal | undefined;
|
|
168
168
|
export declare function consumeInternalSignal(signal: WarpDriveSignal): void;
|
|
169
169
|
export declare function notifyInternalSignal(signal: WarpDriveSignal | undefined): void;
|
|
170
|
-
//# sourceMappingURL=internal.d.ts.map
|