@spearwolf/shadow-objects 0.33.0 → 0.35.0
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/CHANGELOG.md +350 -61
- package/README.md +66 -13
- package/bundle.js +6 -53
- package/package.json +15 -3
- package/src/ChangeTrailRefusedError.d.ts +27 -0
- package/src/ChangeTrailRefusedError.d.ts.map +1 -0
- package/src/ChangeTrailRefusedError.js +12 -0
- package/src/ChangeTrailRefusedError.js.map +7 -0
- package/src/EntityUuidInUseError.d.ts +19 -0
- package/src/EntityUuidInUseError.d.ts.map +1 -0
- package/src/EntityUuidInUseError.js +11 -0
- package/src/EntityUuidInUseError.js.map +7 -0
- package/src/WorkerTimeoutError.d.ts +26 -0
- package/src/WorkerTimeoutError.d.ts.map +1 -0
- package/src/WorkerTimeoutError.js +12 -0
- package/src/WorkerTimeoutError.js.map +7 -0
- package/src/bundle.d.ts +1 -1
- package/src/bundle.d.ts.map +1 -1
- package/src/bundle.js +1 -1
- package/src/bundle.js.map +2 -2
- package/src/constants.d.ts +13 -2
- package/src/constants.d.ts.map +1 -1
- package/src/constants.js +7 -1
- package/src/constants.js.map +2 -2
- package/src/create-worker.bundle.d.ts +1 -1
- package/src/create-worker.bundle.d.ts.map +1 -1
- package/src/create-worker.bundle.js.map +1 -1
- package/src/create-worker.d.ts +1 -1
- package/src/create-worker.d.ts.map +1 -1
- package/src/create-worker.js.map +1 -1
- package/src/elements/ShaeElement.d.ts +70 -2
- package/src/elements/ShaeElement.d.ts.map +1 -1
- package/src/elements/ShaeElement.js +129 -25
- package/src/elements/ShaeElement.js.map +3 -3
- package/src/elements/ShaeEntElement.d.ts +39 -1
- package/src/elements/ShaeEntElement.d.ts.map +1 -1
- package/src/elements/ShaeEntElement.js +397 -167
- package/src/elements/ShaeEntElement.js.map +2 -2
- package/src/elements/ShaeLifecycleElement.d.ts +71 -0
- package/src/elements/ShaeLifecycleElement.d.ts.map +1 -0
- package/src/elements/ShaeLifecycleElement.js +83 -0
- package/src/elements/ShaeLifecycleElement.js.map +7 -0
- package/src/elements/ShaePropElement.d.ts +61 -2
- package/src/elements/ShaePropElement.d.ts.map +1 -1
- package/src/elements/ShaePropElement.js +264 -219
- package/src/elements/ShaePropElement.js.map +2 -2
- package/src/elements/ShaeWorkerElement.d.ts +59 -5
- package/src/elements/ShaeWorkerElement.d.ts.map +1 -1
- package/src/elements/ShaeWorkerElement.js +271 -73
- package/src/elements/ShaeWorkerElement.js.map +2 -2
- package/src/elements/constants.d.ts +9 -0
- package/src/elements/constants.d.ts.map +1 -1
- package/src/elements/constants.js +18 -0
- package/src/elements/constants.js.map +2 -2
- package/src/elements/deferredTeardown.d.ts +24 -0
- package/src/elements/deferredTeardown.d.ts.map +1 -0
- package/src/elements/deferredTeardown.js +30 -0
- package/src/elements/deferredTeardown.js.map +7 -0
- package/src/elements/displayContentsRule.d.ts +25 -0
- package/src/elements/displayContentsRule.d.ts.map +1 -0
- package/src/elements/displayContentsRule.js +37 -0
- package/src/elements/displayContentsRule.js.map +7 -0
- package/src/elements/events.d.ts +10 -7
- package/src/elements/events.d.ts.map +1 -1
- package/src/elements/forwardCustomEvents.d.ts +19 -0
- package/src/elements/forwardCustomEvents.d.ts.map +1 -0
- package/src/elements/forwardCustomEvents.js +47 -0
- package/src/elements/forwardCustomEvents.js.map +7 -0
- package/src/elements/hostedSlots.d.ts +36 -0
- package/src/elements/hostedSlots.d.ts.map +1 -0
- package/src/elements/hostedSlots.js +118 -0
- package/src/elements/hostedSlots.js.map +7 -0
- package/src/elements/parentRemoval.d.ts +18 -0
- package/src/elements/parentRemoval.d.ts.map +1 -0
- package/src/elements/parentRemoval.js +60 -0
- package/src/elements/parentRemoval.js.map +7 -0
- package/src/elements/propValueConverters.d.ts +3 -0
- package/src/elements/propValueConverters.d.ts.map +1 -0
- package/src/elements/propValueConverters.js +54 -0
- package/src/elements/propValueConverters.js.map +7 -0
- package/src/elements/requestEntAncestor.d.ts +32 -0
- package/src/elements/requestEntAncestor.d.ts.map +1 -0
- package/src/elements/requestEntAncestor.js +16 -0
- package/src/elements/requestEntAncestor.js.map +7 -0
- package/src/elements.js.map +1 -1
- package/src/in-the-dark/Entity.d.ts +143 -3
- package/src/in-the-dark/Entity.d.ts.map +1 -1
- package/src/in-the-dark/Entity.js +330 -63
- package/src/in-the-dark/Entity.js.map +3 -3
- package/src/in-the-dark/Kernel.d.ts +98 -16
- package/src/in-the-dark/Kernel.d.ts.map +1 -1
- package/src/in-the-dark/Kernel.js +466 -379
- package/src/in-the-dark/Kernel.js.map +3 -3
- package/src/in-the-dark/Registry.d.ts +7 -1
- package/src/in-the-dark/Registry.d.ts.map +1 -1
- package/src/in-the-dark/Registry.js +112 -14
- package/src/in-the-dark/Registry.js.map +2 -2
- package/src/in-the-dark/ShadowObject.d.ts.map +1 -1
- package/src/in-the-dark/ShadowObject.js +1 -0
- package/src/in-the-dark/ShadowObject.js.map +2 -2
- package/src/in-the-dark/ShadowObjectCreationScope.d.ts +133 -0
- package/src/in-the-dark/ShadowObjectCreationScope.d.ts.map +1 -0
- package/src/in-the-dark/ShadowObjectCreationScope.js +603 -0
- package/src/in-the-dark/ShadowObjectCreationScope.js.map +7 -0
- package/src/in-the-dark/SignalsPath.d.ts +2 -0
- package/src/in-the-dark/SignalsPath.d.ts.map +1 -1
- package/src/in-the-dark/SignalsPath.js +6 -2
- package/src/in-the-dark/SignalsPath.js.map +2 -2
- package/src/in-the-dark/displayName.d.ts +4 -0
- package/src/in-the-dark/displayName.d.ts.map +1 -0
- package/src/in-the-dark/displayName.js +5 -0
- package/src/in-the-dark/displayName.js.map +7 -0
- package/src/in-the-dark/events.js.map +1 -1
- package/src/in-the-dark/importModule.d.ts +7 -0
- package/src/in-the-dark/importModule.d.ts.map +1 -1
- package/src/in-the-dark/importModule.js +5 -2
- package/src/in-the-dark/importModule.js.map +2 -2
- package/src/index.d.ts +9 -1
- package/src/index.d.ts.map +1 -1
- package/src/index.js +9 -1
- package/src/index.js.map +2 -2
- package/src/inspect/createKernelSnapshot.d.ts +17 -0
- package/src/inspect/createKernelSnapshot.d.ts.map +1 -0
- package/src/inspect/createKernelSnapshot.js +247 -0
- package/src/inspect/createKernelSnapshot.js.map +7 -0
- package/src/inspect/createViewSnapshot.d.ts +10 -0
- package/src/inspect/createViewSnapshot.d.ts.map +1 -0
- package/src/inspect/createViewSnapshot.js +143 -0
- package/src/inspect/createViewSnapshot.js.map +7 -0
- package/src/inspect/normalizeInspectRequest.d.ts +32 -0
- package/src/inspect/normalizeInspectRequest.d.ts.map +1 -0
- package/src/inspect/normalizeInspectRequest.js +55 -0
- package/src/inspect/normalizeInspectRequest.js.map +7 -0
- package/src/inspect/serializeValue.d.ts +13 -0
- package/src/inspect/serializeValue.d.ts.map +1 -0
- package/src/inspect/serializeValue.js +149 -0
- package/src/inspect/serializeValue.js.map +7 -0
- package/src/inspect/types.d.ts +260 -0
- package/src/inspect/types.d.ts.map +1 -0
- package/src/inspect/types.js +1 -0
- package/src/inspect/types.js.map +7 -0
- package/src/model-context/ModelContextLike.d.ts +59 -0
- package/src/model-context/ModelContextLike.d.ts.map +1 -0
- package/src/model-context/ModelContextLike.js +15 -0
- package/src/model-context/ModelContextLike.js.map +7 -0
- package/src/model-context/exposeShadowEnvsToModelContext.d.ts +48 -0
- package/src/model-context/exposeShadowEnvsToModelContext.d.ts.map +1 -0
- package/src/model-context/exposeShadowEnvsToModelContext.js +39 -0
- package/src/model-context/exposeShadowEnvsToModelContext.js.map +7 -0
- package/src/model-context/redactProps.d.ts +14 -0
- package/src/model-context/redactProps.d.ts.map +1 -0
- package/src/model-context/redactProps.js +22 -0
- package/src/model-context/redactProps.js.map +7 -0
- package/src/model-context/sharedExposure.d.ts +32 -0
- package/src/model-context/sharedExposure.d.ts.map +1 -0
- package/src/model-context/sharedExposure.js +108 -0
- package/src/model-context/sharedExposure.js.map +7 -0
- package/src/model-context/toolSupport.d.ts +72 -0
- package/src/model-context/toolSupport.d.ts.map +1 -0
- package/src/model-context/toolSupport.js +145 -0
- package/src/model-context/toolSupport.js.map +7 -0
- package/src/model-context/tools/findEntities.d.ts +15 -0
- package/src/model-context/tools/findEntities.d.ts.map +1 -0
- package/src/model-context/tools/findEntities.js +71 -0
- package/src/model-context/tools/findEntities.js.map +7 -0
- package/src/model-context/tools/getEntity.d.ts +16 -0
- package/src/model-context/tools/getEntity.d.ts.map +1 -0
- package/src/model-context/tools/getEntity.js +65 -0
- package/src/model-context/tools/getEntity.js.map +7 -0
- package/src/model-context/tools/getEntityTree.d.ts +4 -0
- package/src/model-context/tools/getEntityTree.d.ts.map +1 -0
- package/src/model-context/tools/getEntityTree.js +58 -0
- package/src/model-context/tools/getEntityTree.js.map +7 -0
- package/src/model-context/tools/getRegistry.d.ts +14 -0
- package/src/model-context/tools/getRegistry.d.ts.map +1 -0
- package/src/model-context/tools/getRegistry.js +39 -0
- package/src/model-context/tools/getRegistry.js.map +7 -0
- package/src/model-context/tools/index.d.ts +9 -0
- package/src/model-context/tools/index.d.ts.map +1 -0
- package/src/model-context/tools/index.js +16 -0
- package/src/model-context/tools/index.js.map +7 -0
- package/src/model-context/tools/listEnvs.d.ts +33 -0
- package/src/model-context/tools/listEnvs.d.ts.map +1 -0
- package/src/model-context/tools/listEnvs.js +37 -0
- package/src/model-context/tools/listEnvs.js.map +7 -0
- package/src/model-context.d.ts +13 -0
- package/src/model-context.d.ts.map +1 -0
- package/src/model-context.js +15 -0
- package/src/model-context.js.map +7 -0
- package/src/shadow-objects.d.ts +4 -0
- package/src/shadow-objects.d.ts.map +1 -1
- package/src/shadow-objects.js +6 -0
- package/src/shadow-objects.js.map +2 -2
- package/src/shadow-objects.worker.js +0 -1
- package/src/shadow-objects.worker.js.map +2 -2
- package/src/shae-ent.js.map +1 -1
- package/src/shae-prop.js +2 -2
- package/src/shae-prop.js.map +2 -2
- package/src/shae-worker.js.map +1 -1
- package/src/testing/TestEntity.d.ts +79 -0
- package/src/testing/TestEntity.d.ts.map +1 -0
- package/src/testing/TestEntity.js +135 -0
- package/src/testing/TestEntity.js.map +7 -0
- package/src/testing/createTestKernel.d.ts +11 -0
- package/src/testing/createTestKernel.d.ts.map +1 -0
- package/src/testing/createTestKernel.js +132 -0
- package/src/testing/createTestKernel.js.map +7 -0
- package/src/testing/mountShadowObject.d.ts +21 -0
- package/src/testing/mountShadowObject.d.ts.map +1 -0
- package/src/testing/mountShadowObject.js +72 -0
- package/src/testing/mountShadowObject.js.map +7 -0
- package/src/testing/recordKernelErrors.d.ts +21 -0
- package/src/testing/recordKernelErrors.d.ts.map +1 -0
- package/src/testing/recordKernelErrors.js +39 -0
- package/src/testing/recordKernelErrors.js.map +7 -0
- package/src/testing/settle.d.ts +15 -0
- package/src/testing/settle.d.ts.map +1 -0
- package/src/testing/settle.js +19 -0
- package/src/testing/settle.js.map +7 -0
- package/src/testing/types.d.ts +119 -0
- package/src/testing/types.d.ts.map +1 -0
- package/src/testing/types.js +1 -0
- package/src/testing/types.js.map +7 -0
- package/src/testing.d.ts +14 -0
- package/src/testing.d.ts.map +1 -0
- package/src/testing.js +11 -0
- package/src/testing.js.map +7 -0
- package/src/types.d.ts +185 -14
- package/src/types.d.ts.map +1 -1
- package/src/utils/ConsoleLogger.d.ts +45 -10
- package/src/utils/ConsoleLogger.d.ts.map +1 -1
- package/src/utils/ConsoleLogger.js +51 -26
- package/src/utils/ConsoleLogger.js.map +2 -2
- package/src/utils/FrameLoop.d.ts +42 -3
- package/src/utils/FrameLoop.d.ts.map +1 -1
- package/src/utils/FrameLoop.js +71 -10
- package/src/utils/FrameLoop.js.map +2 -2
- package/src/utils/MicrotaskCollector.d.ts +45 -0
- package/src/utils/MicrotaskCollector.d.ts.map +1 -0
- package/src/utils/MicrotaskCollector.js +33 -0
- package/src/utils/MicrotaskCollector.js.map +7 -0
- package/src/utils/MicrotaskGate.d.ts +17 -0
- package/src/utils/MicrotaskGate.d.ts.map +1 -0
- package/src/utils/MicrotaskGate.js +20 -0
- package/src/utils/MicrotaskGate.js.map +7 -0
- package/src/utils/array-utils.js.map +1 -1
- package/src/utils/attr-utils.d.ts +11 -0
- package/src/utils/attr-utils.d.ts.map +1 -1
- package/src/utils/attr-utils.js +5 -1
- package/src/utils/attr-utils.js.map +2 -2
- package/src/utils/constants.js.map +1 -1
- package/src/utils/generateUUID.d.ts +11 -0
- package/src/utils/generateUUID.d.ts.map +1 -1
- package/src/utils/generateUUID.js +31 -266
- package/src/utils/generateUUID.js.map +2 -2
- package/src/utils/props-utils.d.ts +3 -2
- package/src/utils/props-utils.d.ts.map +1 -1
- package/src/utils/props-utils.js +13 -24
- package/src/utils/props-utils.js.map +2 -2
- package/src/utils/runGuarded.d.ts +27 -0
- package/src/utils/runGuarded.d.ts.map +1 -0
- package/src/utils/runGuarded.js +11 -0
- package/src/utils/runGuarded.js.map +7 -0
- package/src/utils/toMaybe.d.ts.map +1 -1
- package/src/utils/toMaybe.js.map +1 -1
- package/src/utils/toNamespace.d.ts.map +1 -1
- package/src/utils/toNamespace.js.map +1 -1
- package/src/utils/toUrlString.d.ts +12 -0
- package/src/utils/toUrlString.d.ts.map +1 -1
- package/src/utils/toUrlString.js.map +2 -2
- package/src/utils/waitForMessageOfType.d.ts +12 -1
- package/src/utils/waitForMessageOfType.d.ts.map +1 -1
- package/src/utils/waitForMessageOfType.js +16 -1
- package/src/utils/waitForMessageOfType.js.map +2 -2
- package/src/view/ComponentChanges.d.ts +88 -1
- package/src/view/ComponentChanges.d.ts.map +1 -1
- package/src/view/ComponentChanges.js +243 -73
- package/src/view/ComponentChanges.js.map +2 -2
- package/src/view/ComponentContext.d.ts +206 -16
- package/src/view/ComponentContext.d.ts.map +1 -1
- package/src/view/ComponentContext.js +548 -91
- package/src/view/ComponentContext.js.map +2 -2
- package/src/view/ComponentMemory.d.ts +3 -3
- package/src/view/ComponentMemory.d.ts.map +1 -1
- package/src/view/ComponentMemory.js.map +1 -1
- package/src/view/IShadowObjectEnvProxy.d.ts +38 -3
- package/src/view/IShadowObjectEnvProxy.d.ts.map +1 -1
- package/src/view/LocalShadowObjectEnv.d.ts +8 -1
- package/src/view/LocalShadowObjectEnv.d.ts.map +1 -1
- package/src/view/LocalShadowObjectEnv.js +23 -7
- package/src/view/LocalShadowObjectEnv.js.map +2 -2
- package/src/view/RemoteWorkerEnv.d.ts +108 -5
- package/src/view/RemoteWorkerEnv.d.ts.map +1 -1
- package/src/view/RemoteWorkerEnv.js +244 -77
- package/src/view/RemoteWorkerEnv.js.map +2 -2
- package/src/view/ShadowEnv.d.ts +79 -2
- package/src/view/ShadowEnv.d.ts.map +1 -1
- package/src/view/ShadowEnv.js +323 -59
- package/src/view/ShadowEnv.js.map +3 -3
- package/src/view/ViewComponent.d.ts +78 -14
- package/src/view/ViewComponent.d.ts.map +1 -1
- package/src/view/ViewComponent.js +90 -14
- package/src/view/ViewComponent.js.map +2 -2
- package/src/view/cloneChangeTrail.js.map +2 -2
- package/src/worker/MessageRouter.d.ts +14 -0
- package/src/worker/MessageRouter.d.ts.map +1 -1
- package/src/worker/MessageRouter.js +98 -15
- package/src/worker/MessageRouter.js.map +2 -2
- package/src/worker/WorkerRuntime.d.ts +22 -1
- package/src/worker/WorkerRuntime.d.ts.map +1 -1
- package/src/worker/WorkerRuntime.js +60 -8
- package/src/worker/WorkerRuntime.js.map +2 -2
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { on, once } from '@spearwolf/eventize';
|
|
2
|
+
import { type CompareFunc, createEffect, createMemo, type Signal, type SignalReader } from '@spearwolf/signalize';
|
|
3
|
+
import type { Maybe, ProvideContextOptions, ShadowObjectCreationAPI, ShadowObjectScopeDescription, ShadowObjectType, SignalValueOptions } from '../types.js';
|
|
4
|
+
import type { ConsoleLogger } from '../utils/ConsoleLogger.js';
|
|
5
|
+
import type { Entity } from './Entity.js';
|
|
6
|
+
/**
|
|
7
|
+
* Everything a single shadow-object was given at construction time, and the end of all of it.
|
|
8
|
+
*
|
|
9
|
+
* The scope holds the signals, links and subscriptions the creation API hands out, and it hands the API
|
|
10
|
+
* itself to the kernel through `createAPI()`. The instance stays with the kernel: a shadow-object only ever
|
|
11
|
+
* sees the API object, never the scope behind it.
|
|
12
|
+
*
|
|
13
|
+
* One scope belongs to exactly one shadow-object, and it ends with it -- or, where the constructor throws,
|
|
14
|
+
* without it: a scope that never reached `bindTo()` is torn down by the kernel on the spot, and everything the
|
|
15
|
+
* constructor registered before the throw is released, although no shadow-object came out of it.
|
|
16
|
+
*
|
|
17
|
+
* Eight methods share their name with a module-level import: `on`, `once`, `emit`, `onDestroy`,
|
|
18
|
+
* `onViewEvent`, `createSignal`, `createEffect` and `createMemo`. They are named that way deliberately,
|
|
19
|
+
* because those names are part of the `ShadowObjectCreationAPI` contract a shadow-object destructures by
|
|
20
|
+
* name. Seven of them call or reference their namesake inside their own body; `onDestroy` is the exception,
|
|
21
|
+
* as its import is the entity event that `bindTo()` subscribes to. A bare name inside one of these eight
|
|
22
|
+
* bodies is therefore always the import, and a call on the method of the same name always carries `this.`
|
|
23
|
+
* -- `inertSignal`, `inertEffect` and `noSubscription` are bare names of a different kind, module-level
|
|
24
|
+
* functions with no method of the same name to tell them apart from.
|
|
25
|
+
*/
|
|
26
|
+
export declare class ShadowObjectCreationScope {
|
|
27
|
+
#private;
|
|
28
|
+
/**
|
|
29
|
+
* The name the kernel gave this scope, taken from the constructor it belongs to rather than from
|
|
30
|
+
* the shadow-object that came out of it. The two agree for most forms -- a class and a function
|
|
31
|
+
* that returns nothing both leave their own name on the instance's `constructor` -- but not for a
|
|
32
|
+
* function that returns an object literal: `new` hands that literal back, and it reports `Object`.
|
|
33
|
+
* Reports about the shadow-object are keyed by this name, so the kernel reads it here instead of
|
|
34
|
+
* asking the instance.
|
|
35
|
+
*/
|
|
36
|
+
get displayName(): string;
|
|
37
|
+
/**
|
|
38
|
+
* The names this scope handed readers and providers out for, by kind, plus the display name. Read
|
|
39
|
+
* off the private maps and nothing else: no reader is created, no late call is reported, and a
|
|
40
|
+
* scope past its teardown answers empty lists rather than a throw -- `tearDown()` clears the maps
|
|
41
|
+
* it reads.
|
|
42
|
+
*/
|
|
43
|
+
describe(): ShadowObjectScopeDescription;
|
|
44
|
+
constructor(entity: Entity, logger: ConsoleLogger, displayName: string, shownDeprecations: Set<string>);
|
|
45
|
+
/**
|
|
46
|
+
* The object that goes into `new construct(…)`.
|
|
47
|
+
*
|
|
48
|
+
* Every member is a bound function, because a shadow-object constructor is expected to destructure the
|
|
49
|
+
* API in its parameter list — a member that took its receiver from the call site would lose it there.
|
|
50
|
+
*/
|
|
51
|
+
createAPI(): ShadowObjectCreationAPI;
|
|
52
|
+
/**
|
|
53
|
+
* Binds the scope to the shadow-object it made the API for and subscribes to the destruction of the entity.
|
|
54
|
+
*
|
|
55
|
+
* A shadow-object reaches its end on two independent paths: the entity is destroyed, or the shadow-object
|
|
56
|
+
* leaves the constructor set of a still living entity (token or route change). Both run the same teardown,
|
|
57
|
+
* and each path reaches it through a handle of its own.
|
|
58
|
+
*
|
|
59
|
+
* The kernel keeps two releases rather than one, because they belong to opposite ends of the teardown:
|
|
60
|
+
* `releaseScope` runs at its start, `forgetShadowObject` at its end.
|
|
61
|
+
*
|
|
62
|
+
* One scope serves one shadow-object, once: the call is part of the contract, and both ways of breaking
|
|
63
|
+
* it are refused below.
|
|
64
|
+
*/
|
|
65
|
+
bindTo(shadowObject: ShadowObjectType, releaseScope: () => void, forgetShadowObject: () => void): void;
|
|
66
|
+
/**
|
|
67
|
+
* Runs once, whichever path reaches it first.
|
|
68
|
+
*
|
|
69
|
+
* Three lead here. Two belong to a shadow-object that lived: its entity is destroyed, or it leaves the
|
|
70
|
+
* constructor set of an entity that stays. On the third, the kernel calls this directly on a scope that
|
|
71
|
+
* `bindTo()` never saw, because the constructor threw -- there is no shadow-object then, and three of the
|
|
72
|
+
* handles below are still unset (`#releaseScope` and `#unsubscribeFromEntityDestroy` at the start,
|
|
73
|
+
* `#forgetShadowObject` at the end), which is why all three are called optionally.
|
|
74
|
+
*
|
|
75
|
+
* The provider feeds are released after everything else, so that a write made on the way out reaches the
|
|
76
|
+
* entity-side signal rather than stopping at the provider, and so that the entity hands the context over to
|
|
77
|
+
* a provider that stays only once that write is through.
|
|
78
|
+
*
|
|
79
|
+
* The flag makes the teardown a one-time act: a destroy callback reaching back into the kernel finds no
|
|
80
|
+
* way to start it a second time. Releasing both handles right after ends the retention in both directions
|
|
81
|
+
* -- the kernel's map points from the shadow-object to this scope, the subscription points from the entity
|
|
82
|
+
* to the same scope.
|
|
83
|
+
*
|
|
84
|
+
* The kernel is told to forget the shadow-object at the very end, so a destroy callback that reaches back
|
|
85
|
+
* into the kernel still finds its shadow-object listed among the ones the constructor created. Once that
|
|
86
|
+
* call is through, the four handles above are let go of as well -- the shadow-object, both kernel releases
|
|
87
|
+
* and the entity subscription -- so a scope past this point holds none of the four through these fields.
|
|
88
|
+
*
|
|
89
|
+
* Every step below runs behind its own guard, so a callback or signal teardown that throws does not stop
|
|
90
|
+
* the ones after it: the remaining callbacks, the remaining signal releases, and the provider feed
|
|
91
|
+
* hand-over all still happen. A caught error goes to the logger by displayName and the label of the step
|
|
92
|
+
* that failed, and is not re-thrown -- neither `changeToken()` nor `destroyEntity()` deliver it to their
|
|
93
|
+
* caller, nor does it stop the destroy notification the entity is still delivering to whatever comes after
|
|
94
|
+
* this shadow-object in the same run.
|
|
95
|
+
*
|
|
96
|
+
* The creation API is closed as the very last step, after everything above has run. Until then it
|
|
97
|
+
* is open, because the cleanup callbacks of the shadow-object run inside this method and are
|
|
98
|
+
* entitled to it -- a last message to the view, a last write to a context. What such a callback
|
|
99
|
+
* registers is still reached by the steps behind it. The two sets of cleanup callbacks are run
|
|
100
|
+
* in rounds until neither has anything left, so a callback that another one registers is reached
|
|
101
|
+
* whichever of the two it lands in. The context feed releases follow all of them. What arrives
|
|
102
|
+
* once this method has returned is not, and is turned away by `#refuseAfterTearDown()`.
|
|
103
|
+
*/
|
|
104
|
+
tearDown(): void;
|
|
105
|
+
useProperty<T = unknown>(name: string, options?: SignalValueOptions<T> | CompareFunc<T | undefined>): SignalReader<Maybe<T>>;
|
|
106
|
+
useProperties<T extends Record<string, unknown> = Record<string, unknown>>(props: {
|
|
107
|
+
[K in keyof T]: string;
|
|
108
|
+
}): {
|
|
109
|
+
[K in keyof T]: SignalReader<Maybe<T[K]>>;
|
|
110
|
+
};
|
|
111
|
+
provideContext<T = unknown>(name: string | symbol, sourceOrInitialValue?: T | SignalReader<T> | SignalReader<T | undefined>, options?: ProvideContextOptions<T> | CompareFunc<T | undefined>): Signal<any>;
|
|
112
|
+
provideGlobalContext<T = unknown>(name: string | symbol, sourceOrInitialValue?: T | SignalReader<T> | SignalReader<T | undefined>, options?: ProvideContextOptions<T> | CompareFunc<T | undefined>): Signal<any>;
|
|
113
|
+
useContext<T = unknown>(name: string | symbol, options?: SignalValueOptions<T> | CompareFunc<T | undefined>): SignalReader<any>;
|
|
114
|
+
useParentContext<T = unknown>(name: string | symbol, options?: SignalValueOptions<T> | CompareFunc<T | undefined>): SignalReader<any>;
|
|
115
|
+
createSignal(...args: any[]): any;
|
|
116
|
+
createEffect(...args: any[]): ReturnType<typeof createEffect>;
|
|
117
|
+
createMemo<T = unknown>(...args: Parameters<typeof createMemo<T>>): SignalReader<T>;
|
|
118
|
+
createResource<T = unknown>(factory: () => T | undefined, cleanup?: (resource: NonNullable<T>) => unknown): Signal<Maybe<T>>;
|
|
119
|
+
on(...args: any[]): ReturnType<typeof on>;
|
|
120
|
+
once(...args: any[]): ReturnType<typeof once>;
|
|
121
|
+
/**
|
|
122
|
+
* The plain `emit()`, deliberately, where every notification the framework sends out of its own
|
|
123
|
+
* accord runs on the guarded dispatch. This one is outbound and belongs to the Shadow Object: it
|
|
124
|
+
* owns the listeners, a throw from one of them is its own bug, and letting it surface where it
|
|
125
|
+
* happened is the fastest way to find it. A listener that needs a policy of its own carries a
|
|
126
|
+
* `try`/`catch` in its own body, which is where that decision belongs.
|
|
127
|
+
*/
|
|
128
|
+
emit(...args: any[]): void;
|
|
129
|
+
onViewEvent(callback: (type: string, data: unknown) => any): void;
|
|
130
|
+
onDestroy(callback: () => any): void;
|
|
131
|
+
dispatchMessageToView(type: string, data?: unknown, transferables?: Transferable[], traverseChildren?: boolean): void;
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=ShadowObjectCreationScope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShadowObjectCreationScope.d.ts","sourceRoot":"","sources":["../../../src/in-the-dark/ShadowObjectCreationScope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,EAAE,EAAE,IAAI,EAAW,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EACL,KAAK,WAAW,EAChB,YAAY,EACZ,UAAU,EAKV,KAAK,MAAM,EACX,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,KAAK,EACL,qBAAqB,EACrB,uBAAuB,EACvB,4BAA4B,EAC5B,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,2BAA2B,CAAC;AAG7D,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AA6CxC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,yBAAyB;;IAwEpC;;;;;;;OAOG;IACH,IAAI,WAAW,IAAI,MAAM,CAExB;IAsCD;;;;;OAKG;IACH,QAAQ,IAAI,4BAA4B,CASvC;IAED,YAAY,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,EAAE,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,EAKrG;IAED;;;;;OAKG;IACH,SAAS,IAAI,uBAAuB,CAyBnC;IAED;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,IAAI,EAAE,kBAAkB,EAAE,MAAM,IAAI,GAAG,IAAI,CA4BrG;IAED;;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