@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/in-the-dark/Entity.ts"],
|
|
4
|
-
"sourcesContent": ["import {emit, off, on, once, Priority} from '@spearwolf/eventize';\nimport {\n batch,\n createSignal,\n link,\n Signal,\n SignalAutoMap,\n type SignalReader,\n type SignalWriter,\n value,\n} from '@spearwolf/signalize';\nimport type {IComponentEvent} from '../types.js';\nimport {onDestroy, onViewEvent} from './events.js';\nimport {Kernel} from './Kernel.js';\nimport {SignalsPath} from './SignalsPath.js';\n\ntype ContextNameType = string | symbol;\n\ninterface IContextValue {\n name: ContextNameType;\n inherited: Signal<unknown>;\n provide: Signal<unknown>;\n context: Signal<unknown>;\n valuePath: SignalsPath;\n\n unsubscribePathValue: () => void;\n unsubscribeFromParent?: () => void;\n}\n\nconst updateContextValues: Map<Signal<unknown>, unknown> = new Map();\nlet requestedContextValueBatchUpdate = false;\n\nconst deferContextValueUpdate = (sig: Signal<unknown>, val: unknown) => {\n updateContextValues.set(sig, val);\n if (!requestedContextValueBatchUpdate) {\n requestedContextValueBatchUpdate = true;\n queueMicrotask(() => {\n requestedContextValueBatchUpdate = false;\n const contextValues = Array.from(updateContextValues.entries());\n updateContextValues.clear();\n for (const [sig, val] of contextValues) {\n sig.set(val);\n }\n });\n }\n};\n\n/**\n * An entity has a parent and children, replicating the hierarchy of view-components.\n *\n * A signal is created for each view-component property.\n *\n * Shadow-objects can use the signal properties via the entity.\n */\nexport class Entity {\n #kernel: Kernel;\n #uuid: string;\n\n #props = new SignalAutoMap();\n #context: Map<ContextNameType, IContextValue> = new Map();\n\n #rootContexts: Map<ContextNameType, {cleanup: () => void; signal: Signal<any>}> = new Map();\n\n #parentUuid?: string;\n #parent?: Entity;\n\n #childrenUuids: Set<string> = new Set();\n #children: Entity[] = [];\n\n #order = 0;\n\n get kernel(): Kernel {\n return this.#kernel;\n }\n\n get uuid(): string {\n return this.#uuid;\n }\n\n get order(): number {\n return this.#order;\n }\n\n set order(value: number) {\n if (this.#order !== value) {\n this.#order = value;\n if (this.#parentUuid) {\n this.parent!.resortChildren();\n }\n }\n }\n\n get parentUuid(): string | undefined {\n return this.#parentUuid || undefined;\n }\n\n set parentUuid(parentUuid: string | undefined) {\n if (this.#parentUuid !== parentUuid) {\n // Resolve the new parent FIRST so an unknown-uuid throw doesn't orphan us mid-mutation.\n const nextParent = parentUuid ? this.#kernel.getEntity(parentUuid) : undefined;\n\n this.removeFromParent();\n\n this.#parentUuid = parentUuid || undefined;\n this.#parent = nextParent;\n\n if (this.#parent) {\n this.#parent.addChild(this);\n }\n\n this.#updateAutoDestructionSubscription();\n }\n }\n\n get parent(): Entity | undefined {\n if (!this.#parent && this.#parentUuid) {\n this.#parent = this.#kernel.getEntity(this.#parentUuid);\n }\n return this.#parent;\n }\n\n set parent(parent: Entity | undefined) {\n this.parentUuid = parent?.uuid;\n }\n\n get hasParent(): boolean {\n return !!this.#parentUuid;\n }\n\n get children(): readonly Entity[] {\n return this.#children;\n }\n\n constructor(kernel: Kernel, uuid: string) {\n this.#kernel = kernel;\n this.#uuid = uuid;\n once(this as Entity, onDestroy, Priority.Min, this);\n }\n\n traverse(callback: (entity: Entity) => void) {\n callback(this);\n for (const child of this.#children) {\n child.traverse(callback);\n }\n }\n\n [onDestroy]() {\n this.#props.clear();\n off(this);\n\n this.#autoDestructionSubscription?.();\n\n for (const rootCtx of this.#rootContexts.values()) {\n rootCtx.cleanup();\n rootCtx.signal.destroy();\n }\n this.#rootContexts.clear();\n\n for (const ctx of this.#context.values()) {\n ctx.context.set(undefined);\n ctx.unsubscribePathValue();\n ctx.unsubscribeFromParent?.();\n ctx.valuePath.dispose();\n ctx.inherited.destroy();\n ctx.provide.destroy();\n ctx.context.destroy();\n }\n\n this.#parentUuid = undefined;\n this.#parent = undefined;\n\n this.#childrenUuids.clear();\n this.#children.length = 0;\n }\n\n addChild(child: Entity) {\n if (this.#children.length === 0) {\n this.#childrenUuids.add(child.uuid);\n this.#children.push(child);\n // this.emit(onAddChild, this, child);\n // child.emit(onAddToParent, child, this);\n return;\n }\n\n if (this.#childrenUuids.has(child.uuid)) {\n throw new Error(`child with uuid: ${child.uuid} already exists! parentUuid: ${this.uuid}`);\n }\n\n this.#childrenUuids.add(child.uuid);\n this.#children.push(child);\n\n this.resortChildren();\n\n for (const [, ctx] of child.#context) {\n child.#subscribeToParent(ctx);\n }\n\n // this.emit(onAddChild, this, child);\n // child.emit(onAddToParent, child, this);\n }\n\n resortChildren() {\n this.#children.sort((a, b) => a.order - b.order);\n }\n\n removeChild(child: Entity) {\n if (this.#childrenUuids.has(child.uuid)) {\n this.#childrenUuids.delete(child.uuid);\n this.#children.splice(this.#children.indexOf(child), 1);\n // this.emit(onRemoveChild, this, child);\n }\n }\n\n removeFromParent() {\n if (this.#parent) {\n // const prevParent = this.#parent;\n\n this.#parent.removeChild(this);\n\n this.#parent = undefined;\n this.#parentUuid = undefined;\n\n for (const [, ctx] of this.#context) {\n if (ctx.unsubscribeFromParent) {\n ctx.unsubscribeFromParent();\n ctx.unsubscribeFromParent = undefined;\n }\n }\n\n this.#unsubscribeAutoDestruction();\n\n // this.emit(onRemoveFromParent, this, prevParent);\n }\n }\n\n #autoDestructionEnabled = false;\n #autoDestructionSubscription?: () => void;\n\n get autoDestructionOnParentRemoval(): boolean {\n return this.#autoDestructionEnabled;\n }\n\n set autoDestructionOnParentRemoval(autoDestruct: boolean) {\n if (this.#autoDestructionEnabled === autoDestruct) return;\n this.#autoDestructionEnabled = autoDestruct;\n this.#updateAutoDestructionSubscription();\n }\n\n #unsubscribeAutoDestruction() {\n if (this.#autoDestructionSubscription) {\n this.#autoDestructionSubscription();\n this.#autoDestructionSubscription = undefined;\n }\n }\n\n #updateAutoDestructionSubscription() {\n this.#unsubscribeAutoDestruction();\n if (this.#autoDestructionEnabled && this.#parent) {\n this.#autoDestructionSubscription = once(this.#parent, onDestroy, Priority.Max, () => {\n this.#autoDestructionSubscription = undefined;\n this.#kernel.destroyEntity(this.#uuid);\n });\n }\n }\n\n reSubscribeToParentContexts() {\n for (const [, ctx] of this.#context) {\n this.#subscribeToParent(ctx);\n }\n }\n\n dispatchMessageToView(type: string, data?: unknown, transferables?: Transferable[], traverseChildren = false) {\n this.#kernel.dispatchMessageToView({uuid: this.#uuid, type, data, transferables, traverseChildren});\n }\n\n dispatchViewEvents(events: IComponentEvent[]) {\n for (const {type, data} of events) {\n emit(this as Entity, onViewEvent, type, data);\n }\n }\n\n dispatchViewEvent(type: string, data: unknown) {\n this.dispatchViewEvents([{type, data}]);\n }\n\n #getPropSignal<T = unknown>(key: string): Signal<T> {\n return this.#props.get<T>(key);\n }\n\n getPropertyReader<T = unknown>(key: string): SignalReader<T> {\n return this.#getPropSignal<T>(key).get;\n }\n\n getPropertyWriter<T = unknown>(key: string): SignalWriter<T> {\n return this.#getPropSignal<T>(key).set;\n }\n\n setProperties(properties: [string, unknown][]) {\n this.clearTruthyPropsCache();\n batch(() => {\n for (const [key, val] of properties) {\n this.setProperty(key, val);\n }\n });\n }\n\n setProperty(key: string, value: unknown) {\n this.getPropertyWriter(key)(value);\n }\n\n getProperty<T = unknown>(key: string): T {\n return value(this.getPropertyReader<T>(key));\n }\n\n propKeys(): string[] {\n return Array.from(this.#props.keys()) as string[];\n }\n\n propEntries(): [string, unknown][] {\n return Array.from(this.#props.entries()).map(([key, sig]) => [key, sig.value]) as [string, unknown][];\n }\n\n #truthyPropsCache: Set<string> | undefined;\n\n clearTruthyPropsCache() {\n this.#truthyPropsCache = undefined;\n }\n\n truthyProps(): Set<string> | undefined {\n if (this.#truthyPropsCache) {\n return this.#truthyPropsCache.size ? this.#truthyPropsCache : undefined;\n }\n const truthyProps = new Set<string>();\n for (const [key, sig] of this.#props.entries()) {\n if (typeof key === 'string') {\n const val = sig.value;\n if (val != null && val !== false && val !== '') {\n truthyProps.add(key);\n }\n }\n }\n this.#truthyPropsCache = truthyProps;\n return truthyProps.size ? truthyProps : undefined;\n }\n\n hasContext(name: ContextNameType): boolean {\n return this.#context.has(name);\n }\n\n useContext<T = unknown>(name: ContextNameType): SignalReader<T> {\n return this.#findOrCreateContext(name).context.get as SignalReader<T>;\n }\n\n useParentContext<T = unknown>(name: ContextNameType): SignalReader<T> {\n return this.#findOrCreateContext(name).inherited.get as SignalReader<T>;\n }\n\n provideContext<T = unknown>(name: ContextNameType): Signal<T> {\n return this.#findOrCreateContext(name).provide as Signal<T>;\n }\n\n provideGlobalContext<T = unknown>(name: ContextNameType): Signal<T> {\n if (this.#rootContexts.has(name)) {\n return this.#rootContexts.get(name)!.signal as Signal<T>;\n }\n const rootCtx = this.#kernel.findOrCreateRootContext(name);\n const signal = createSignal<T>();\n const cleanup = rootCtx.add(signal);\n this.#rootContexts.set(name, {cleanup, signal});\n return signal;\n }\n\n #findOrCreateContext(name: ContextNameType): IContextValue {\n if (this.#context.has(name)) {\n return this.#context.get(name)!;\n }\n\n const inherited = createSignal();\n const provide = createSignal();\n const context = createSignal();\n\n const valuePath = new SignalsPath([provide, inherited]);\n\n const unsubscribePathValue = on(valuePath, SignalsPath.Value, (val) => {\n deferContextValueUpdate(context, val);\n });\n\n const ctx: IContextValue = {name, inherited, provide, context, valuePath, unsubscribePathValue};\n this.#context.set(name, ctx);\n\n this.#subscribeToParent(ctx);\n\n return ctx;\n }\n\n #subscribeToParent(ctx: IContextValue) {\n ctx.unsubscribeFromParent?.();\n ctx.unsubscribeFromParent = undefined;\n if (this.parent) {\n const parentCtx = this.parent.#findOrCreateContext(ctx.name);\n const linkToParent = link(parentCtx.context, ctx.inherited);\n ctx.unsubscribeFromParent = linkToParent.destroy.bind(linkToParent);\n } else {\n const rootCtx = this.#kernel.findOrCreateRootContext(ctx.name);\n const linkToRoot = link(rootCtx.value$, ctx.inherited);\n ctx.unsubscribeFromParent = linkToRoot.destroy.bind(linkToRoot);\n }\n }\n}"],
|
|
5
|
-
"mappings": "AAAA,SAAQ,
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["import {emitStrict, off, on, once, Priority} from '@spearwolf/eventize';\nimport {\n batch,\n createSignal,\n link,\n Signal,\n SignalAutoMap,\n type SignalLink,\n type SignalReader,\n type SignalWriter,\n type SignalWriterParams,\n value,\n} from '@spearwolf/signalize';\nimport type {ComponentPropertiesType, IComponentEvent} from '../types.js';\nimport {MicrotaskCollector} from '../utils/MicrotaskCollector.js';\nimport {runGuarded} from '../utils/runGuarded.js';\nimport {onDestroy, onViewEvent} from './events.js';\nimport {Kernel} from './Kernel.js';\nimport {SignalsPath} from './SignalsPath.js';\n\ntype ContextNameType = string | symbol;\n\ninterface IContextValue {\n name: ContextNameType;\n inherited: Signal<unknown>;\n provide: Signal<unknown>;\n context: Signal<unknown>;\n valuePath: SignalsPath;\n\n /**\n * The links that feed `provide`, one per provider of this name on this entity. They all write\n * into that one signal, so the value standing there is the one written last -- and the set is\n * what makes it possible to ask a provider that is still here for its value once another one\n * lets go. See {@link Entity.attachContextProvider}.\n */\n providerFeeds: Set<SignalLink<any>>;\n\n unsubscribePathValue: () => void;\n unsubscribeFromParent?: (() => void) | undefined;\n}\n\ninterface IRootContextValue {\n signal: Signal<any>;\n\n /** The links that feed `signal`, exactly as {@link IContextValue.providerFeeds} feeds `provide`. */\n providerFeeds: Set<SignalLink<any>>;\n\n /** Takes the entity's signal back out of the kernel-wide chain of this name. */\n cleanup: () => void;\n}\n\n/** One context value an entity has waiting for its readers in the current round. */\ninterface IDeferredContextValue {\n value: unknown;\n name: ContextNameType;\n uuid: string;\n}\n\n/**\n * The context values waiting to reach their readers, one collector per kernel.\n *\n * Per kernel rather than per module for two reasons that are the same one: a write below can fail,\n * and what it is reported to is a logger, of which there is one per kernel; and an application\n * running two shadow environments in one realm would otherwise hand the values of one to a round\n * the other started. The kernel is the key, so a collector reaches no further than the kernel it\n * belongs to and needs no teardown of its own -- every round empties it, and the last one is\n * emptied by the kernel going out of reach.\n */\nconst contextValueCollectors = new WeakMap<Kernel, MicrotaskCollector<Signal<unknown>, IDeferredContextValue>>();\n\nconst collectorOf = (kernel: Kernel): MicrotaskCollector<Signal<unknown>, IDeferredContextValue> => {\n let collector = contextValueCollectors.get(kernel);\n if (collector == null) {\n collector = new MicrotaskCollector<Signal<unknown>, IDeferredContextValue>((contextValues) => {\n for (const [contextSignal, entry] of contextValues) {\n // one hand-over is one context value: `set()` runs the effects that read it synchronously\n // and throws what one of them threw\n runGuarded(\n kernel.logger,\n () => contextSignal.set(entry.value),\n `an effect of a context value failed (${String(entry.name)}):`,\n entry.uuid,\n );\n }\n });\n contextValueCollectors.set(kernel, collector);\n }\n return collector;\n};\n\n/**\n * Collects the context values written in one task and hands them to their readers a microtask\n * later, one at a time. A second value for the same signal replaces the one waiting, so a name\n * written twice in a task reaches its readers once, with the value that stood at the end of it.\n */\nconst deferContextValueUpdate = (kernel: Kernel, signal: Signal<unknown>, val: unknown, name: ContextNameType, uuid: string) => {\n collectorOf(kernel).add(signal, {value: val, name, uuid});\n};\n\n/**\n * An entity has a parent and children, replicating the hierarchy of view-components.\n *\n * A signal is created for each view-component property.\n *\n * Shadow-objects can use the signal properties via the entity.\n */\nexport class Entity {\n #kernel: Kernel;\n #uuid: string;\n\n #props = new SignalAutoMap();\n #context: Map<ContextNameType, IContextValue> = new Map();\n\n #rootContexts: Map<ContextNameType, IRootContextValue> = new Map();\n\n // There is one place the parent is kept: `parentUuid` answers from `#parent.uuid`, so a half-set\n // link -- a uuid with no matching entity, or an entity with no uuid to show for it -- has no field\n // left to hold it in.\n #parent?: Entity | undefined;\n\n #childrenUuids: Set<string> = new Set();\n #children: Entity[] = [];\n\n #order = 0;\n\n #isReleased = false;\n\n get kernel(): Kernel {\n return this.#kernel;\n }\n\n get uuid(): string {\n return this.#uuid;\n }\n\n get order(): number {\n return this.#order;\n }\n\n set order(value: number) {\n if (this.#order !== value) {\n this.#order = value;\n if (this.#parent) {\n this.#parent.resortChildren();\n }\n // The place among the siblings is part of the traversal order the kernel caches.\n this.#kernel.noteEntityTreeChange(this.#uuid);\n }\n }\n\n get parentUuid(): string | undefined {\n return this.#parent?.uuid;\n }\n\n set parentUuid(parentUuid: string | undefined) {\n if (this.#parent?.uuid !== parentUuid) {\n // Resolve the new parent FIRST so an unknown-uuid throw doesn't orphan us mid-mutation.\n const nextParent = parentUuid ? this.#kernel.getEntity(parentUuid) : undefined;\n\n if (nextParent != null) {\n this.assertAttachableTo(nextParent);\n }\n\n // A parent that follows right away binds the contexts itself, so the detachment skips it. The\n // entity keeps reading the parent it leaves until the one it joins takes over.\n this.#detachFromParent(nextParent == null);\n\n this.#parent = nextParent;\n\n if (this.#parent) {\n this.#parent.addChild(this);\n }\n\n this.#updateAutoDestructionSubscription();\n\n // The link is written; the kernel writes down where the entity stands now. This is the route\n // a shadow-object takes when it moves an entity without going through `Kernel.setParent()`,\n // and the report is the only thing the two share -- the `onParentChanged` notification stays\n // with `setParent()`.\n this.#kernel.noteEntityTreeChange(this.#uuid);\n }\n }\n\n get parent(): Entity | undefined {\n return this.#parent;\n }\n\n set parent(parent: Entity | undefined) {\n this.parentUuid = parent?.uuid;\n }\n\n // Reads the same field `parent` and `parentUuid` do, so `Kernel.noteEntityTreeChange()` -- which\n // reads `hasParent` to decide whether the uuid belongs in the root set -- sees what they see.\n get hasParent(): boolean {\n return !!this.#parent;\n }\n\n get children(): readonly Entity[] {\n return this.#children;\n }\n\n constructor(kernel: Kernel, uuid: string) {\n this.#kernel = kernel;\n this.#uuid = uuid;\n }\n\n traverse(callback: (entity: Entity) => void) {\n this.#traverse(callback, new Set());\n }\n\n // The visited set guards the one traversal an outside shadow object drives, over a tree it did not\n // build. `addChild()` writes a children list without touching the parent link, so no ancestor check\n // can cover it.\n #traverse(callback: (entity: Entity) => void, visited: Set<Entity>) {\n if (visited.has(this)) return;\n visited.add(this);\n\n callback(this);\n\n for (const child of this.#children) {\n child.#traverse(callback, visited);\n }\n }\n\n /**\n * Releases everything the entity holds: its properties, its subscriptions, its contexts and its place\n * in the entity tree.\n *\n * It runs once, whichever way it is reached. The kernel reaches it directly, right behind the\n * destruction notification it sends on the entity, so that every listener on that notification has\n * had its turn first -- down to `Priority.Min`, which is nobody's but the caller's. The entity is\n * not a listener on its own notification: registering it in the constructor would put it ahead of\n * anything registered at the same priority, because eventize breaks a tie by order of registration,\n * and the bulk `off(this)` below would then take the listeners still waiting in that delivery with\n * it. The flag makes a second call cost nothing and keeps every step below written for a\n * single run: `kernel.getEntity()` hands the entity to anyone, and this method is as reachable as\n * the rest of it.\n *\n * The flag is raised before the first step rather than after the last, because that is what a release\n * running twice would cost: the steps below are written for one pass, not for a repeat.\n *\n * Every step below runs behind a guard of its own, the way `ShadowObjectCreationScope.tearDown()`\n * gives each of its steps one: a step that throws is reported through the kernel's logger, named by\n * the step and by the uuid of this entity, and costs only itself -- the steps behind it still run.\n * The method therefore never throws to its own caller. The plain resets at the end -- clearing a\n * collection, overwriting a field -- cannot throw and run unguarded, exactly as `tearDown()` empties\n * its own sets at the end.\n */\n [onDestroy]() {\n if (this.#isReleased) return;\n this.#isReleased = true;\n\n // `SignalAutoMap.clear()` destroys every property signal and only then re-raises whatever a\n // dependent effect's cleanup threw along the way, so it belongs behind a guard of its own like\n // every other step here -- it is not the plain reset it looks like.\n this.#runGuarded('properties', () => this.#props.clear());\n this.#runGuarded('listeners', () => off(this));\n this.#runGuarded('auto-destruction subscription', () => this.#autoDestructionSubscription?.());\n\n for (const rootCtx of this.#rootContexts.values()) {\n this.#runGuarded('global context cleanup', () => rootCtx.cleanup());\n this.#runGuarded('global context signal', () => rootCtx.signal.destroy());\n }\n\n for (const ctx of this.#context.values()) {\n this.#runGuarded('context value reset', () => ctx.context.set(undefined));\n this.#runGuarded('context value subscription', () => ctx.unsubscribePathValue());\n this.#runGuarded('context parent subscription', () => ctx.unsubscribeFromParent?.());\n this.#runGuarded('context value path', () => ctx.valuePath.dispose());\n this.#runGuarded('inherited context signal', () => ctx.inherited.destroy());\n this.#runGuarded('provided context signal', () => ctx.provide.destroy());\n this.#runGuarded('context signal', () => ctx.context.destroy());\n }\n\n this.#rootContexts.clear();\n this.#context.clear();\n\n this.#parent = undefined;\n\n this.#childrenUuids.clear();\n this.#children.length = 0;\n }\n\n /**\n * Isolates one release step from the ones around it: a step that throws is reported through the\n * kernel's logger and does not stop `[onDestroy]()` from reaching the steps that follow. The\n * report goes out through the shared `runGuarded()`; what this wrapper adds is the label of the\n * step and the uuid of the entity it belongs to.\n */\n #runGuarded(step: string, run: () => void): void {\n runGuarded(this.#kernel.logger, run, `entity teardown step failed (${step}):`, this.#uuid);\n }\n\n /**\n * Refuses a parent that would close the entity tree into a ring: the entity itself, or an entity that\n * already sits below it. The walk follows the parent chain upwards, which is a chain exactly because\n * this guard keeps it one.\n *\n * `Kernel.setParent()` calls it before it detaches, and the `parentUuid` setter before it resolves the\n * link, so a refused attachment leaves the entity where it was instead of orphaned halfway through.\n * `ViewComponent.addChild()` guards the same thing on the view side.\n */\n assertAttachableTo(nextParent: Entity) {\n for (let e: Entity | undefined = nextParent; e != null; e = e.parent) {\n if (e === this) {\n throw new Error(\n `entity \"${nextParent.uuid}\" cannot become the parent of \"${this.uuid}\": it is the entity itself or one of its descendants`,\n );\n }\n }\n }\n\n /**\n * Puts `child` into the children list, at its place among the siblings.\n *\n * Nothing here notifies. Neither this method nor {@link Entity.removeChild} nor a detachment\n * sends anything to a listener on the entity -- the one notification over a moved entity is\n * `onParentChanged`, and `Kernel.setParent()` is the call that sends it.\n */\n addChild(child: Entity) {\n if (this.#childrenUuids.has(child.uuid)) {\n throw new Error(`child with uuid: ${child.uuid} already exists! parentUuid: ${this.uuid}`);\n }\n\n this.#childrenUuids.add(child.uuid);\n this.#insertChildInOrder(child);\n\n // the child may have created its contexts while it was still unattached: they hang on the root\n // of the entity context tree until something binds them to the parent they now have\n for (const [, ctx] of child.#context) {\n child.#subscribeToParent(ctx);\n }\n }\n\n /**\n * Puts a child at its place among the siblings, so building a subtree costs one insertion per\n * child. The scan runs from the end because children usually arrive with an equal or rising\n * `order`, which makes the common case a plain append. A child lands behind every sibling that\n * shares its `order` -- the same place a stable sort would give it.\n *\n * The result only matches a full sort while `#children` is already sorted when the insertion\n * starts, so name what keeps it that way: the insertion here preserves the order, `removeChild()`\n * cuts an element out with `splice`, the destroy handler empties the list, and the `order` setter\n * re-sorts through the parent. That last one is the condition worth stating, because it needs the\n * child to know its parent -- the parent link has to be established. Every way an entity is\n * attached inside this class goes through the `parentUuid` setter, which sets the parent before it\n * calls `addChild()`. A caller that reaches for `addChild()` on its own leaves the child without a\n * parent link, and a later `order` on such a child never reaches this list.\n */\n #insertChildInOrder(child: Entity) {\n let i = this.#children.length;\n while (i > 0 && child.order < this.#children[i - 1]!.order) i--;\n this.#children.splice(i, 0, child);\n }\n\n resortChildren() {\n this.#children.sort((a, b) => a.order - b.order);\n }\n\n removeChild(child: Entity) {\n // The identity decides here, not the uuid: `indexOf` answers -1 for an entity this list\n // does not hold, and a `splice(-1, 1)` on that answer would cut the last child out\n // instead of none. The ordered uuid lists of `ComponentContext` carry the same guard where\n // they cut a uuid out.\n const idx = this.#children.indexOf(child);\n if (idx !== -1) {\n this.#childrenUuids.delete(child.uuid);\n this.#children.splice(idx, 1);\n }\n }\n\n /**\n * @param rebindContexts bind every context back to the root of the entity context tree. An entity\n * that carries a context out of a subtree keeps following the value it can still see, rather\n * than freezing on the last one the former parent held. Only a caller that attaches the entity\n * to the next parent in the same breath passes `false` -- that parent binds the contexts itself,\n * and the detour over the root would be visible to `useParentContext()`, which hands out the\n * inherited value without the microtask collector `useContext()` has in front of it.\n */\n removeFromParent(rebindContexts = true) {\n this.#detachFromParent(rebindContexts);\n }\n\n #detachFromParent(rebindContexts: boolean) {\n // The field `parent` and `parentUuid` both answer from: clearing it here clears what either\n // getter would report, with nothing left over for a second check to find.\n if (this.#parent) {\n this.#parent.removeChild(this);\n\n this.#parent = undefined;\n\n if (rebindContexts) {\n for (const [, ctx] of this.#context) {\n this.#subscribeToParent(ctx);\n }\n }\n\n this.#unsubscribeAutoDestruction();\n\n // Detached is a place too: an entity with no parent is a root, and the root set is where\n // every traversal starts.\n this.#kernel.noteEntityTreeChange(this.#uuid);\n }\n }\n\n #autoDestructionEnabled = false;\n #autoDestructionSubscription?: (() => void) | undefined;\n\n get autoDestructionOnParentRemoval(): boolean {\n return this.#autoDestructionEnabled;\n }\n\n set autoDestructionOnParentRemoval(autoDestruct: boolean) {\n if (this.#autoDestructionEnabled === autoDestruct) return;\n this.#autoDestructionEnabled = autoDestruct;\n this.#updateAutoDestructionSubscription();\n }\n\n #unsubscribeAutoDestruction() {\n if (this.#autoDestructionSubscription) {\n this.#autoDestructionSubscription();\n this.#autoDestructionSubscription = undefined;\n }\n }\n\n #updateAutoDestructionSubscription() {\n this.#unsubscribeAutoDestruction();\n if (this.#autoDestructionEnabled && this.#parent) {\n this.#autoDestructionSubscription = once(this.#parent, onDestroy, Priority.Max, () => {\n this.#autoDestructionSubscription = undefined;\n this.#kernel.destroyEntity(this.#uuid);\n });\n }\n }\n\n /**\n * Binds every context of this entity to its current position in the entity tree -- to the parent\n * if there is one, to the root otherwise. `addChild()` and `removeFromParent()` each do this for\n * the entity they move, so a caller needs this only when it changed the position by other means\n * or wants the binding re-established without knowing which of the two ran.\n *\n * Moving an entity through the kernel is not such a case: both directions bring their own binding,\n * and a third one would reach every `useParentContext()` reader as another change.\n */\n reSubscribeToParentContexts() {\n for (const [, ctx] of this.#context) {\n this.#subscribeToParent(ctx);\n }\n }\n\n dispatchMessageToView(type: string, data?: unknown, transferables?: Transferable[], traverseChildren = false) {\n this.#kernel.dispatchMessageToView({uuid: this.#uuid, type, data, transferables, traverseChildren});\n }\n\n /**\n * Hands the events the view sent to whoever listens on this entity, one delivery per event.\n *\n * Each delivery is guarded, and the reason is where this call sits: the kernel makes it from\n * inside a change trail, on a path that builds. Unguarded, a single shadow-object that cannot cope\n * with a single view event would leave through `Kernel.run()` and refuse the whole trail -- the\n * same argument that puts a guard around the `onParentChanged` notification, which is a delivery\n * on a building path as well. The guard is per event, so one that fails costs neither the events\n * behind it nor the caller anything; `emitStrict()` inside it makes the same promise one level\n * down, to the listeners of one event.\n */\n dispatchViewEvents(events: IComponentEvent[]) {\n for (const {type, data} of events) {\n runGuarded(\n this.#kernel.logger,\n // the concrete class is needed here: eventize cannot reduce its emitter conditional\n // (`NonTypedEmitter<this>`) over the polymorphic `this` type, and no overload then matches\n () => emitStrict(this as Entity, onViewEvent, type, data),\n 'entity view event delivery failed:',\n type,\n this.#uuid,\n );\n }\n }\n\n dispatchViewEvent(type: string, data: unknown) {\n this.dispatchViewEvents([{type, data}]);\n }\n\n #getPropSignal<T = unknown>(key: string): Signal<T> {\n return this.#props.get<T>(key);\n }\n\n getPropertyReader<T = unknown>(key: string): SignalReader<T> {\n return this.#getPropSignal<T>(key).get;\n }\n\n /**\n * A write head for one property. Every write through it drops the cache behind\n * `truthyProps()`: that cache answers `Kernel.#updateShadowObjects()`, which picks the shadow\n * objects of this entity along the property routes of the registry, and a write the cache does\n * not see routes the entity to a state it no longer has.\n *\n * What comes back is a function of the entity, not the `set` of the signal behind the property.\n * The signalize helpers that take a signal-like -- `isSignal()`, `destroySignal()`, `touch()` --\n * do not recognise it; `getPropertyReader()` hands out the signal's own reader for that.\n *\n * A fresh closure is handed out on every call rather than one cached per key: `SignalAutoMap`\n * hands out \"a fresh, live\" signal for a key whose signal was destroyed from the outside, so a\n * writer cached against the signal captured on an earlier call could end up closing over a corpse.\n * The call sites this feeds -- `setProperty()` from a change-trail application, at most once per\n * property that actually changed -- do not turn this into a hot path.\n */\n getPropertyWriter<T = unknown>(key: string): SignalWriter<T> {\n const signal = this.#getPropSignal<T>(key);\n return (value: unknown, params?: SignalWriterParams<T>) => {\n this.clearTruthyPropsCache();\n signal.set(value as T, params);\n };\n }\n\n setProperties(properties: ComponentPropertiesType) {\n batch(() => {\n // an entry that names only the key sets the property to `undefined` \u2014 the key is there, the value is not\n for (const [key, val] of properties) {\n this.setProperty(key, val);\n }\n });\n }\n\n setProperty(key: string, value: unknown) {\n this.getPropertyWriter(key)(value);\n }\n\n getProperty<T = unknown>(key: string): T {\n return value(this.getPropertyReader<T>(key));\n }\n\n propKeys(): string[] {\n return Array.from(this.#props.keys()) as string[];\n }\n\n propEntries(): [string, unknown][] {\n return Array.from(this.#props.entries()).map(([key, sig]) => [key, sig.value]) as [string, unknown][];\n }\n\n #truthyPropsCache: Set<string> | undefined;\n\n clearTruthyPropsCache() {\n this.#truthyPropsCache = undefined;\n }\n\n truthyProps(): Set<string> | undefined {\n if (this.#truthyPropsCache) {\n return this.#truthyPropsCache.size ? this.#truthyPropsCache : undefined;\n }\n const truthyProps = new Set<string>();\n for (const [key, sig] of this.#props.entries()) {\n if (typeof key === 'string') {\n const val = sig.value;\n if (val != null && val !== false && val !== '') {\n truthyProps.add(key);\n }\n }\n }\n this.#truthyPropsCache = truthyProps;\n return truthyProps.size ? truthyProps : undefined;\n }\n\n hasContext(name: ContextNameType): boolean {\n return this.#context.has(name);\n }\n\n /** The names of the Entity Contexts this entity holds, used or provided. Reads only, creates none. */\n contextNames(): ContextNameType[] {\n return Array.from(this.#context.keys());\n }\n\n /**\n * The three values behind one Entity Context of this entity: what its own providers wrote, what it\n * inherits from the parent (or from the global chain at a root), and what `useContext(name)` reads.\n * `hasProviders` says whether a provider feed is attached -- a value written straight into the\n * signal from `provideContext()` counts as provided but not as a provider.\n *\n * `undefined` when the entity holds no context of that name; asking does not create one. The\n * reads are plain `.value` reads and track nothing, so a call from inside an effect does not\n * subscribe that effect to the context.\n */\n describeContext(\n name: ContextNameType,\n ): {provided: unknown; inherited: unknown; effective: unknown; hasProviders: boolean} | undefined {\n const ctx = this.#context.get(name);\n if (ctx === undefined) return undefined;\n return {\n provided: ctx.provide.value,\n inherited: ctx.inherited.value,\n effective: ctx.context.value,\n hasProviders: ctx.providerFeeds.size > 0,\n };\n }\n\n /** The names of the global Entity Contexts this entity contributes to. Reads only, creates none. */\n globalContextNames(): ContextNameType[] {\n return Array.from(this.#rootContexts.keys());\n }\n\n /**\n * What this entity contributes to the kernel-wide chain of one global Entity Context: the value\n * and the very signal that stands in the chain, so a caller holding the chain can find this entity\n * in it by identity. `undefined` when the entity contributes nothing under that name.\n */\n describeGlobalContext(name: ContextNameType): {value: unknown; signal: Signal<unknown>; hasProviders: boolean} | undefined {\n const rootCtx = this.#rootContexts.get(name);\n if (rootCtx === undefined) return undefined;\n return {value: rootCtx.signal.value, signal: rootCtx.signal, hasProviders: rootCtx.providerFeeds.size > 0};\n }\n\n useContext<T = unknown>(name: ContextNameType): SignalReader<T> {\n return this.#findOrCreateContext(name).context.get as SignalReader<T>;\n }\n\n useParentContext<T = unknown>(name: ContextNameType): SignalReader<T> {\n return this.#findOrCreateContext(name).inherited.get as SignalReader<T>;\n }\n\n provideContext<T = unknown>(name: ContextNameType): Signal<T> {\n return this.#findOrCreateContext(name).provide as Signal<T>;\n }\n\n provideGlobalContext<T = unknown>(name: ContextNameType): Signal<T> {\n // The signal behind it is created without an initial value \u2014 a context signal does start out\n // empty and holds no `T` until a provider writes one. The cast keeps the same contract\n // `provideContext()` hands out; callers see the `undefined` through `Maybe<T>` in the\n // shadow-object API.\n return this.#findOrCreateGlobalContext(name).signal as Signal<T>;\n }\n\n /**\n * Attaches a provider signal to the context of `name` on this entity and answers with the release\n * that detaches it again.\n *\n * Every provider of one name writes into the single signal that `provideContext()` hands out, so\n * what a consumer reads is what was written last. The release therefore does two things: it cuts\n * this feed, and it then lets a provider that is still attached write its value once more. Without\n * that second step the context would keep whatever the departure left standing -- the `undefined`\n * of a clearing provider, or the last value of one that opted out of it -- even though this entity\n * still has a provider of the name that says otherwise.\n *\n * A value written straight into the signal from `provideContext()` is not a feed and is therefore\n * overwritten by the next release. Feeding a value in through this method is what makes it survive\n * one.\n */\n attachContextProvider(name: ContextNameType, provider: Signal<any>): () => void {\n const ctx = this.#findOrCreateContext(name);\n return Entity.#attachProviderFeed(provider, ctx.provide, ctx.providerFeeds);\n }\n\n /**\n * The counterpart of {@link Entity.attachContextProvider} for the global context of `name`.\n *\n * Within one entity the situation is the same one: every provider feeds the single signal this\n * entity contributes to the kernel-wide chain of that name, and a release hands the name back to a\n * provider that stays. Across entities the chain decides on its own -- it resolves to the first\n * entry that holds something, so an entity whose signal falls empty lets the next one through.\n */\n attachGlobalContextProvider(name: ContextNameType, provider: Signal<any>): () => void {\n const rootCtx = this.#findOrCreateGlobalContext(name);\n return Entity.#attachProviderFeed(provider, rootCtx.signal, rootCtx.providerFeeds);\n }\n\n static #attachProviderFeed(provider: Signal<any>, target: Signal<any>, feeds: Set<SignalLink<any>>): () => void {\n const feed = link(provider, target);\n feeds.add(feed);\n\n return () => {\n // A release called a second time finds nothing of its own left and leaves the context to\n // whoever holds it by then.\n if (!feeds.delete(feed)) return;\n feed.destroy();\n Entity.#handOverToRemainingProvider(feeds);\n };\n }\n\n /**\n * Lets the provider that stays write its value into the context signal again.\n *\n * The set iterates in the order the providers were attached and the loop keeps the last hit, so the\n * winner is the one attached last that still holds a value. Attachment order is the order in which the\n * providers took the name: attaching feeds the value straight through, so a later attachment writes\n * over an earlier one, and the hand-over falls back on that order instead of inventing one of its own.\n * It is not the order of the writes -- a provider that writes to its signal after attaching carries\n * the name until the next departure, and the hand-over does not restore that write, because what this\n * entity keeps on file is its providers and not the sequence in which they wrote. Providers holding\n * nothing are passed over -- by the same `!= null` rule with which `SignalsPath` resolves a context\n * chain, and for the same reason: a provider without a value has nothing to say about the name, and\n * electing it would clear a name that is still being provided.\n *\n * A feed whose link is destroyed is passed over as well. A shadow-object owns the signal it was\n * handed and may end it early, which destroys the link without the release ever having run: such a\n * feed still reports a value through its source while its writes go nowhere, so electing it would\n * leave the write of the departure standing, silently and over a provider that is alive.\n *\n * `touch()` is what makes the winner write, because `SignalLink.write()` is protected: touching is\n * the only public way to push the current value of a source through its link again, and the source\n * of a provider that merely stays has no reason to change.\n *\n * Where no remaining feed qualifies, nothing is written: then what the departure left stands,\n * which is the `undefined` of a clearing provider or the last value of one that opted out.\n */\n static #handOverToRemainingProvider(feeds: Set<SignalLink<any>>): void {\n let winner: SignalLink<any> | undefined;\n for (const feed of feeds) {\n if (!feed.isDestroyed && feed.source.value != null) winner = feed;\n }\n winner?.touch();\n }\n\n #findOrCreateGlobalContext(name: ContextNameType): IRootContextValue {\n if (this.#rootContexts.has(name)) {\n return this.#rootContexts.get(name)!;\n }\n const rootCtx = this.#kernel.findOrCreateRootContext(name);\n const signal = createSignal() as Signal<any>;\n const cleanup = rootCtx.add(signal);\n const ctx: IRootContextValue = {cleanup, signal, providerFeeds: new Set()};\n this.#rootContexts.set(name, ctx);\n return ctx;\n }\n\n #findOrCreateContext(name: ContextNameType): IContextValue {\n if (this.#context.has(name)) {\n return this.#context.get(name)!;\n }\n\n const inherited = createSignal();\n const provide = createSignal();\n const context = createSignal();\n\n const valuePath = new SignalsPath([provide, inherited]);\n\n const unsubscribePathValue = on(valuePath, SignalsPath.Value, (val) => {\n deferContextValueUpdate(this.#kernel, context, val, name, this.#uuid);\n });\n\n const ctx: IContextValue = {name, inherited, provide, context, valuePath, providerFeeds: new Set(), unsubscribePathValue};\n this.#context.set(name, ctx);\n\n this.#subscribeToParent(ctx);\n\n return ctx;\n }\n\n #subscribeToParent(ctx: IContextValue) {\n ctx.unsubscribeFromParent?.();\n ctx.unsubscribeFromParent = undefined;\n if (this.parent) {\n const parentCtx = this.parent.#findOrCreateContext(ctx.name);\n const linkToParent = link(parentCtx.context, ctx.inherited);\n ctx.unsubscribeFromParent = linkToParent.destroy.bind(linkToParent);\n } else {\n const rootCtx = this.#kernel.findOrCreateRootContext(ctx.name);\n const linkToRoot = link(rootCtx.value$, ctx.inherited);\n ctx.unsubscribeFromParent = linkToRoot.destroy.bind(linkToRoot);\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAQ,YAAY,KAAK,IAAI,MAAM,gBAAe;AAClD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAKA;AAAA,OACK;AAEP,SAAQ,0BAAyB;AACjC,SAAQ,kBAAiB;AACzB,SAAQ,WAAW,mBAAkB;AACrC,SAAQ,cAAa;AACrB,SAAQ,mBAAkB;AAkD1B,MAAM,yBAAyB,oBAAI,QAA4E;AAE/G,MAAM,cAAc,CAAC,WAA+E;AAClG,MAAI,YAAY,uBAAuB,IAAI,MAAM;AACjD,MAAI,aAAa,MAAM;AACrB,gBAAY,IAAI,mBAA2D,CAAC,kBAAkB;AAC5F,iBAAW,CAAC,eAAe,KAAK,KAAK,eAAe;AAGlD;AAAA,UACE,OAAO;AAAA,UACP,MAAM,cAAc,IAAI,MAAM,KAAK;AAAA,UACnC,wCAAwC,OAAO,MAAM,IAAI,CAAC;AAAA,UAC1D,MAAM;AAAA,QACR;AAAA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AU;AAAA,IAChE;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["value"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type SignalLike } from '@spearwolf/signalize';
|
|
2
|
+
import type { ComponentPropertiesType, IComponentEvent, ShadowObjectDescription, ShadowObjectType, SyncEvent } from '../types.js';
|
|
2
3
|
import { ConsoleLogger } from '../utils/ConsoleLogger.js';
|
|
3
4
|
import { Entity } from './Entity.js';
|
|
4
5
|
import { Registry } from './Registry.js';
|
|
@@ -7,14 +8,19 @@ export interface MessageToViewEvent {
|
|
|
7
8
|
uuid: string;
|
|
8
9
|
type: string;
|
|
9
10
|
data?: unknown;
|
|
10
|
-
transferables?: Transferable[];
|
|
11
|
-
traverseChildren?: boolean;
|
|
11
|
+
transferables?: Transferable[] | undefined;
|
|
12
|
+
traverseChildren?: boolean | undefined;
|
|
13
|
+
}
|
|
14
|
+
interface OmittedGraphChild {
|
|
15
|
+
uuid: string;
|
|
16
|
+
reason: 'already-in-graph' | 'not-in-kernel';
|
|
12
17
|
}
|
|
13
18
|
interface EntityGraphNode {
|
|
14
19
|
token: string;
|
|
15
20
|
entity: Entity;
|
|
16
21
|
props: Record<string, unknown>;
|
|
17
22
|
children: EntityGraphNode[];
|
|
23
|
+
omittedChildren?: OmittedGraphChild[];
|
|
18
24
|
}
|
|
19
25
|
/**
|
|
20
26
|
* The entity kernel manages the lifecycle of all entities and shadow-objects.
|
|
@@ -26,20 +32,62 @@ interface EntityGraphNode {
|
|
|
26
32
|
export declare class Kernel {
|
|
27
33
|
#private;
|
|
28
34
|
registry: Registry;
|
|
29
|
-
|
|
35
|
+
/** The logger this Kernel reports through. */
|
|
36
|
+
get logger(): ConsoleLogger;
|
|
30
37
|
constructor(registry?: Registry);
|
|
31
38
|
getEntity(uuid: string): Entity;
|
|
39
|
+
/**
|
|
40
|
+
* The entity behind a uuid, or `undefined` when the kernel does not hold one.
|
|
41
|
+
*
|
|
42
|
+
* The counterpart to `getEntity()`, which throws. Which of the two a caller wants follows from what an
|
|
43
|
+
* absent entity means to it: a change that describes the entity tree -- a new parent, a new order, new
|
|
44
|
+
* properties -- names an entity the view believes to be there, and a uuid the kernel does not know is a
|
|
45
|
+
* disagreement the caller has to hear about. An event is the other case: it carries no structure, and the
|
|
46
|
+
* entity it was meant for may have been torn down between the two sides.
|
|
47
|
+
*/
|
|
48
|
+
findEntity(uuid: string): Entity | undefined;
|
|
32
49
|
hasEntity(uuid: string): boolean;
|
|
50
|
+
/** The token of the entity behind `uuid`, or `undefined` when the kernel does not hold one. */
|
|
51
|
+
tokenOf(uuid: string): string | undefined;
|
|
33
52
|
/**
|
|
34
53
|
* @returns all entities in breadth-first order
|
|
54
|
+
*
|
|
55
|
+
* The list belongs to the caller: sorting or reversing it changes nothing about what the next call
|
|
56
|
+
* hands out. The walk behind it visits every entity once, which also carries it over a children list
|
|
57
|
+
* that points back at an ancestor -- `Entity.addChild()` writes such a list without touching the parent
|
|
58
|
+
* link, so no check along the parent chain can cover it.
|
|
59
|
+
*
|
|
60
|
+
* A uuid the kernel no longer holds drops out, and what hangs below it with it -- `getEntityGraph()`
|
|
61
|
+
* walks the same tree by the same rule.
|
|
35
62
|
*/
|
|
36
63
|
traverseLevelOrderBFS(reverse?: boolean): Entity[];
|
|
64
|
+
/**
|
|
65
|
+
* The entity tree as nested nodes, one node per entity. The visited set is what makes that count
|
|
66
|
+
* hold: a children list that points back at an ancestor would otherwise be walked forever, and this
|
|
67
|
+
* is the one traversal a caller reaches for while debugging a tree that is already broken. A child
|
|
68
|
+
* the walk leaves out is named at its parent under `omittedChildren`, with the reason -- a uuid the
|
|
69
|
+
* kernel does not hold, or one the walk has already placed elsewhere in the graph. A root the walk
|
|
70
|
+
* has already reached through another root's children falls off the top level without a note; it
|
|
71
|
+
* still stands in the graph, just at the other position.
|
|
72
|
+
*/
|
|
37
73
|
getEntityGraph(): EntityGraphNode[];
|
|
38
|
-
private getEntityGraphNode;
|
|
39
74
|
upgradeEntities(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Apply a change trail, entry by entry, and say how far it got if it cannot be applied in full.
|
|
77
|
+
*
|
|
78
|
+
* The loop ends at the entry that throws, so what the kernel holds afterwards is a prefix of the
|
|
79
|
+
* trail; the {@link ChangeTrailRefusedError} names its length. The counter sits behind
|
|
80
|
+
* `#parse` and therefore counts only entries that returned normally.
|
|
81
|
+
*
|
|
82
|
+
* An effect the batch defers belongs to no single entry: the batch releases it once the loop is
|
|
83
|
+
* through, and a throw from there arrives with every entry already counted. `appliedCount` then
|
|
84
|
+
* equals `entryCount` — everything was applied, something failed nevertheless, and both
|
|
85
|
+
* statements are true at once.
|
|
86
|
+
*
|
|
87
|
+
* @throws {ChangeTrailRefusedError} if any entry, or any effect the batch deferred, threw
|
|
88
|
+
*/
|
|
40
89
|
run(event: SyncEvent): void;
|
|
41
|
-
|
|
42
|
-
createEntity(uuid: string, token: string, parentUuid?: string, order?: number, properties?: [string, unknown][], autoDestructionOnParentRemoval?: boolean): void;
|
|
90
|
+
createEntity(uuid: string, token: string, parentUuid?: string, order?: number, properties?: ComponentPropertiesType, autoDestructionOnParentRemoval?: boolean): void;
|
|
43
91
|
destroyEntity(uuid: string): void;
|
|
44
92
|
/**
|
|
45
93
|
* @param order the new order, or `undefined` to keep the current one. A set-parent change
|
|
@@ -48,21 +96,55 @@ export declare class Kernel {
|
|
|
48
96
|
*/
|
|
49
97
|
setParent(uuid: string, parentUuid?: string, order?: number): void;
|
|
50
98
|
updateOrder(uuid: string, order: number): void;
|
|
99
|
+
/**
|
|
100
|
+
* Records that an entity has changed its place in the entity tree: it took a parent, lost one,
|
|
101
|
+
* or moved among its siblings. Two pieces of bookkeeping follow from that -- the cached
|
|
102
|
+
* traversal is dropped, and an entity without a parent joins the set of root entities while one
|
|
103
|
+
* with a parent leaves it.
|
|
104
|
+
*
|
|
105
|
+
* `Entity` reports here from every write that moves it, because those writes are reachable from
|
|
106
|
+
* a shadow-object with no kernel call in between: `entity.parent`, `entity.parentUuid`,
|
|
107
|
+
* `entity.order` and `entity.removeFromParent()`. The state is read off the entity rather than
|
|
108
|
+
* taken as an argument, so a caller cannot describe a move the entity did not make.
|
|
109
|
+
*
|
|
110
|
+
* A uuid the kernel does not hold reaches the cache and stops there: an entity joins the root
|
|
111
|
+
* set when the kernel takes it in and leaves it when the kernel lets go.
|
|
112
|
+
*
|
|
113
|
+
* That such a uuid passes in silence, where `setParent()` and `updateOrder()` throw at one, is the
|
|
114
|
+
* difference between a request and a report. Those two are asked to move an entity and cannot do it
|
|
115
|
+
* without one, so an unknown uuid is a disagreement the caller has to hear about. This is an entity
|
|
116
|
+
* saying where it stands, and it says so while the kernel is still taking it in: `createEntity()`
|
|
117
|
+
* writes the order on the entity before the entry is registered, so an entity created with an order
|
|
118
|
+
* of its own reports once before the kernel holds it. A throw there would cost the creation its own
|
|
119
|
+
* bookkeeping, and there is nothing to disagree about -- dropping the cache is right either way.
|
|
120
|
+
*/
|
|
121
|
+
noteEntityTreeChange(uuid: string): void;
|
|
51
122
|
dispatchEventsToEntity(uuid: string, events: IComponentEvent[]): void;
|
|
52
|
-
changeProperties(uuid: string, properties:
|
|
123
|
+
changeProperties(uuid: string, properties: ComponentPropertiesType): void;
|
|
53
124
|
changeToken(uuid: string, token: string): void;
|
|
54
125
|
dispatchMessageToView(message: MessageToViewEvent): void;
|
|
126
|
+
findShadowObjects(uuid: string): ShadowObjectType[];
|
|
55
127
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
128
|
+
* One description per Shadow Object of the entity, in the order `findShadowObjects()` lists them:
|
|
129
|
+
* what the creation scope knows (display name, the five name lists), the tokens the constructor is
|
|
130
|
+
* defined under in this kernel's registry, and which of the four lifecycle hooks the instance
|
|
131
|
+
* implements. `[]` for a uuid the kernel does not hold. Reads only; a scope that is already gone
|
|
132
|
+
* contributes its display name and empty lists.
|
|
58
133
|
*/
|
|
59
|
-
|
|
60
|
-
private constructShadowObject;
|
|
61
|
-
private createShadowObjects;
|
|
62
|
-
findShadowObjects(uuid: string): ShadowObjectType[];
|
|
63
|
-
private attachShadowObject;
|
|
64
|
-
private destroyShadowObject;
|
|
134
|
+
describeShadowObjects(uuid: string): ShadowObjectDescription[];
|
|
65
135
|
findOrCreateRootContext(name: string | symbol): SignalsPath;
|
|
136
|
+
/** The names of the kernel-wide context chains -- every name a root entity uses or any entity provides globally. */
|
|
137
|
+
rootContextNames(): (string | symbol)[];
|
|
138
|
+
/**
|
|
139
|
+
* One kernel-wide context chain: what it resolves to, and its members in chain order. The members
|
|
140
|
+
* are the signals the entities contributed -- `Entity.describeGlobalContext()` hands out the same
|
|
141
|
+
* objects, so a caller can match them by identity. `undefined` for a name the kernel holds no
|
|
142
|
+
* chain for; asking does not create one.
|
|
143
|
+
*/
|
|
144
|
+
describeRootContext(name: string | symbol): {
|
|
145
|
+
value: unknown;
|
|
146
|
+
signals: readonly SignalLike<any>[];
|
|
147
|
+
} | undefined;
|
|
66
148
|
destroy(): void;
|
|
67
149
|
}
|
|
68
150
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Kernel.d.ts","sourceRoot":"","sources":["../../../src/in-the-dark/Kernel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Kernel.d.ts","sourceRoot":"","sources":["../../../src/in-the-dark/Kernel.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,KAAK,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAI5D,OAAO,KAAK,EACV,uBAAuB,EAEvB,eAAe,EAGf,uBAAuB,EACvB,gBAAgB,EAChB,SAAS,EACV,MAAM,aAAa,CAAC;AACrB,OAAO,EAAC,aAAa,EAAC,MAAM,2BAA2B,CAAC;AAGxD,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAE7C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