@oasys/oecs 0.4.0 → 0.5.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 +553 -0
- package/README.md +42 -31
- package/dist/core/ecs/access_check.d.cts +77 -0
- package/dist/core/ecs/access_check.d.ts +8 -8
- package/dist/core/ecs/access_check.d.ts.map +1 -1
- package/dist/core/ecs/archetype.d.cts +486 -0
- package/dist/core/ecs/archetype.d.ts +23 -11
- package/dist/core/ecs/archetype.d.ts.map +1 -1
- package/dist/core/ecs/archetype_graph.d.cts +96 -0
- package/dist/core/ecs/archetype_graph.d.ts +96 -0
- package/dist/core/ecs/archetype_graph.d.ts.map +1 -0
- package/dist/core/ecs/builtin_relations.d.cts +43 -0
- package/dist/core/ecs/builtin_relations.d.ts +8 -8
- package/dist/core/ecs/builtin_relations.d.ts.map +1 -1
- package/dist/core/ecs/command_log.d.cts +116 -0
- package/dist/core/ecs/command_log.d.ts +13 -10
- package/dist/core/ecs/command_log.d.ts.map +1 -1
- package/dist/core/ecs/component.d.cts +176 -0
- package/dist/core/ecs/component.d.ts +75 -5
- package/dist/core/ecs/component.d.ts.map +1 -1
- package/dist/core/ecs/compute_backend.d.cts +37 -0
- package/dist/core/ecs/compute_backend.d.ts +2 -2
- package/dist/core/ecs/debug_names.d.cts +7 -0
- package/dist/core/ecs/debug_names.d.ts +7 -0
- package/dist/core/ecs/debug_names.d.ts.map +1 -0
- package/dist/core/ecs/deferred_commands.d.cts +55 -0
- package/dist/core/ecs/deferred_commands.d.ts +55 -0
- package/dist/core/ecs/deferred_commands.d.ts.map +1 -0
- package/dist/core/ecs/dispatch_trace.d.cts +93 -0
- package/dist/core/ecs/dispatch_trace.d.ts +3 -3
- package/dist/core/ecs/ecs.d.cts +562 -0
- package/dist/core/ecs/ecs.d.ts +314 -285
- package/dist/core/ecs/ecs.d.ts.map +1 -1
- package/dist/core/ecs/ecs_memory.d.cts +179 -0
- package/dist/core/ecs/ecs_memory.d.ts +1 -1
- package/dist/core/ecs/entity.d.cts +34 -0
- package/dist/core/ecs/entity.d.ts +7 -1
- package/dist/core/ecs/entity.d.ts.map +1 -1
- package/dist/core/ecs/entity_allocator.d.cts +59 -0
- package/dist/core/ecs/entity_allocator.d.ts +59 -0
- package/dist/core/ecs/entity_allocator.d.ts.map +1 -0
- package/dist/core/ecs/event.d.cts +79 -0
- package/dist/core/ecs/event.d.ts +36 -11
- package/dist/core/ecs/event.d.ts.map +1 -1
- package/dist/core/ecs/event_registry.d.cts +22 -0
- package/dist/core/ecs/event_registry.d.ts +22 -0
- package/dist/core/ecs/event_registry.d.ts.map +1 -0
- package/dist/core/ecs/facades.d.cts +158 -0
- package/dist/core/ecs/facades.d.ts +158 -0
- package/dist/core/ecs/facades.d.ts.map +1 -0
- package/dist/core/ecs/frame_stepper.d.cts +58 -0
- package/dist/core/ecs/frame_stepper.d.ts +58 -0
- package/dist/core/ecs/frame_stepper.d.ts.map +1 -0
- package/dist/core/ecs/frame_trace.d.cts +133 -0
- package/dist/core/ecs/frame_trace.d.ts +5 -5
- package/dist/core/ecs/frame_trace.d.ts.map +1 -1
- package/dist/core/ecs/host_commands.d.cts +274 -0
- package/dist/core/ecs/host_commands.d.ts +53 -31
- package/dist/core/ecs/host_commands.d.ts.map +1 -1
- package/dist/core/ecs/index.d.cts +46 -0
- package/dist/core/ecs/index.d.ts +45 -40
- package/dist/core/ecs/index.d.ts.map +1 -1
- package/dist/core/ecs/observer.d.cts +173 -0
- package/dist/core/ecs/observer.d.ts +43 -12
- package/dist/core/ecs/observer.d.ts.map +1 -1
- package/dist/core/ecs/query.d.cts +718 -0
- package/dist/core/ecs/query.d.ts +251 -90
- package/dist/core/ecs/query.d.ts.map +1 -1
- package/dist/core/ecs/ref.d.cts +31 -0
- package/dist/core/ecs/ref.d.ts +3 -3
- package/dist/core/ecs/relation.d.cts +243 -0
- package/dist/core/ecs/relation.d.ts +26 -14
- package/dist/core/ecs/relation.d.ts.map +1 -1
- package/dist/core/ecs/relation_service.d.cts +235 -0
- package/dist/core/ecs/relation_service.d.ts +235 -0
- package/dist/core/ecs/relation_service.d.ts.map +1 -0
- package/dist/core/ecs/resource.d.cts +53 -0
- package/dist/core/ecs/resource.d.ts +25 -5
- package/dist/core/ecs/resource.d.ts.map +1 -1
- package/dist/core/ecs/resource_registry.d.cts +20 -0
- package/dist/core/ecs/resource_registry.d.ts +20 -0
- package/dist/core/ecs/resource_registry.d.ts.map +1 -0
- package/dist/core/ecs/resume.d.cts +85 -0
- package/dist/core/ecs/resume.d.ts +6 -6
- package/dist/core/ecs/resume.d.ts.map +1 -1
- package/dist/core/ecs/run_condition.d.cts +81 -0
- package/dist/core/ecs/run_condition.d.ts +15 -9
- package/dist/core/ecs/run_condition.d.ts.map +1 -1
- package/dist/core/ecs/schedule.d.cts +142 -0
- package/dist/core/ecs/schedule.d.ts +15 -6
- package/dist/core/ecs/schedule.d.ts.map +1 -1
- package/dist/core/ecs/snapshot_service.d.cts +94 -0
- package/dist/core/ecs/snapshot_service.d.ts +94 -0
- package/dist/core/ecs/snapshot_service.d.ts.map +1 -0
- package/dist/core/ecs/sparse_store.d.cts +110 -0
- package/dist/core/ecs/sparse_store.d.ts +5 -2
- package/dist/core/ecs/sparse_store.d.ts.map +1 -1
- package/dist/core/ecs/store.d.cts +950 -0
- package/dist/core/ecs/store.d.ts +143 -342
- package/dist/core/ecs/store.d.ts.map +1 -1
- package/dist/core/ecs/store_layout_listener.d.cts +23 -0
- package/dist/core/ecs/system.d.cts +250 -0
- package/dist/core/ecs/system.d.ts +138 -22
- package/dist/core/ecs/system.d.ts.map +1 -1
- package/dist/{utils/arrays.d.ts → core/ecs/utils/arrays.d.cts} +1 -0
- package/dist/core/ecs/utils/error.d.cts +61 -0
- package/dist/core/ecs/utils/error.d.ts +12 -2
- package/dist/core/ecs/utils/error.d.ts.map +1 -1
- package/dist/core/store/action_ring.d.cts +136 -0
- package/dist/core/store/allocator.d.cts +238 -0
- package/dist/core/store/allocator.d.ts.map +1 -1
- package/dist/core/store/buffer_backed_column.d.cts +69 -0
- package/dist/core/store/buffer_backed_column.d.ts +2 -2
- package/dist/core/store/column_store.d.cts +273 -0
- package/dist/core/store/column_store.d.ts +18 -10
- package/dist/core/store/column_store.d.ts.map +1 -1
- package/dist/core/store/command_dispatch.d.cts +52 -0
- package/dist/core/store/command_ring.d.cts +107 -0
- package/dist/core/store/descriptor.d.cts +80 -0
- package/dist/core/store/descriptor.d.ts +1 -1
- package/dist/core/store/descriptor.d.ts.map +1 -1
- package/dist/core/store/entity_index.d.cts +108 -0
- package/dist/core/store/event_ring.d.cts +95 -0
- package/dist/core/store/extend.d.cts +39 -0
- package/dist/core/store/extend.d.ts +3 -73
- package/dist/core/store/extend.d.ts.map +1 -1
- package/dist/core/store/grow.d.cts +34 -0
- package/dist/core/store/grow.d.ts +4 -9
- package/dist/core/store/grow.d.ts.map +1 -1
- package/dist/core/store/header.d.cts +64 -0
- package/dist/core/store/header.d.ts +1 -1
- package/dist/core/store/header.d.ts.map +1 -1
- package/dist/core/store/index.d.cts +17 -0
- package/dist/core/store/index.d.ts +16 -15
- package/dist/core/store/index.d.ts.map +1 -1
- package/dist/core/store/layout_ops.d.cts +152 -0
- package/dist/core/store/layout_ops.d.ts +152 -0
- package/dist/core/store/layout_ops.d.ts.map +1 -0
- package/dist/core/store/region_table.d.cts +74 -0
- package/dist/core/store/region_table.d.ts +1 -1
- package/dist/core/store/region_table.d.ts.map +1 -1
- package/dist/core/store/snapshot.d.cts +43 -0
- package/dist/core/store/snapshot.d.ts +2 -2
- package/dist/core/store/state_hash.d.cts +38 -0
- package/dist/core/store/state_hash.d.ts +1 -1
- package/dist/core/store/store_regions.d.cts +38 -0
- package/dist/core/store/store_regions.d.ts +1 -1
- package/dist/core/store/vendored_abi/abi.d.ts +43 -0
- package/dist/core/store/{__generated__ → vendored_abi}/abi.d.ts.map +1 -1
- package/dist/dev_flag.d.cts +17 -0
- package/dist/dev_flag.d.ts +17 -0
- package/dist/dev_flag.d.ts.map +1 -0
- package/dist/extensions/editor/editor.d.cts +170 -0
- package/dist/extensions/editor/editor.d.ts +43 -22
- package/dist/extensions/editor/editor.d.ts.map +1 -1
- package/dist/extensions/editor/field_handle.d.cts +40 -0
- package/dist/extensions/editor/field_handle.d.ts +8 -3
- package/dist/extensions/editor/field_handle.d.ts.map +1 -1
- package/dist/extensions/editor/index.cjs +1 -1
- package/dist/extensions/editor/index.d.cts +21 -0
- package/dist/extensions/editor/index.d.ts +2 -2
- package/dist/extensions/editor/index.js +116 -88
- package/dist/extensions/reactive/ecs_sync.d.cts +214 -0
- package/dist/extensions/reactive/ecs_sync.d.ts +26 -22
- package/dist/extensions/reactive/ecs_sync.d.ts.map +1 -1
- package/dist/extensions/reactive/index.cjs +1 -1
- package/dist/extensions/reactive/index.d.cts +23 -0
- package/dist/extensions/reactive/index.d.ts +1 -1
- package/dist/extensions/reactive/index.js +106 -116
- package/dist/extensions/solid/index.cjs +1 -1
- package/dist/extensions/solid/index.d.cts +6 -0
- package/dist/extensions/solid/index.d.ts +2 -2
- package/dist/extensions/solid/index.js +8 -4
- package/dist/extensions/solid/kernel_solid.d.cts +45 -0
- package/dist/extensions/solid/kernel_solid.d.ts +6 -3
- package/dist/extensions/solid/kernel_solid.d.ts.map +1 -1
- package/dist/host_commands-BF8QMi3c.cjs +1 -0
- package/dist/host_commands-i4cAeyL5.js +2318 -0
- package/dist/index.cjs +1 -2
- package/dist/index.d.cts +66 -0
- package/dist/index.d.ts +50 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4469 -5933
- package/dist/internal.cjs +2 -0
- package/dist/internal.d.cts +20 -0
- package/dist/internal.d.ts +20 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +141 -0
- package/dist/primitives.cjs +1 -1
- package/dist/primitives.d.cts +18 -0
- package/dist/primitives.d.ts +6 -6
- package/dist/primitives.js +24 -23
- package/dist/reactive/array.d.ts +24 -0
- package/dist/reactive/array.d.ts.map +1 -0
- package/dist/reactive/index.cjs +1 -0
- package/dist/reactive/index.d.cts +11 -0
- package/dist/reactive/index.d.ts +11 -0
- package/dist/reactive/index.d.ts.map +1 -0
- package/dist/reactive/index.js +18 -0
- package/dist/reactive/interop.d.cts +19 -0
- package/dist/{core/reactive → reactive}/interop.d.ts +1 -1
- package/dist/reactive/interop.d.ts.map +1 -0
- package/dist/reactive/kernel.d.cts +73 -0
- package/dist/{core/reactive → reactive}/kernel.d.ts +5 -3
- package/dist/reactive/kernel.d.ts.map +1 -0
- package/dist/reactive/map.d.ts +16 -0
- package/dist/reactive/map.d.ts.map +1 -0
- package/dist/reactive/shallow.d.cts +11 -0
- package/dist/reactive/shallow.d.ts +11 -0
- package/dist/reactive/shallow.d.ts.map +1 -0
- package/dist/reactive/struct.d.cts +10 -0
- package/dist/{core/reactive → reactive}/struct.d.ts +1 -1
- package/dist/reactive/struct.d.ts.map +1 -0
- package/dist/shallow-DQ8aG51_.cjs +1 -0
- package/dist/shallow-DfnAm9vG.js +150 -0
- package/dist/shared-BU1Cd40h.js +103 -0
- package/dist/shared-BymrGTyR.cjs +1 -0
- package/dist/shared.cjs +1 -1
- package/dist/shared.d.cts +22 -0
- package/dist/shared.d.ts +2 -2
- package/dist/shared.js +1 -1
- package/dist/topological_sort-BDvEyb9W.cjs +1 -0
- package/dist/topological_sort-DK6EjpWa.js +135 -0
- package/dist/type_primitives/assertions.d.cts +32 -0
- package/dist/type_primitives/assertions.d.ts +13 -1
- package/dist/type_primitives/assertions.d.ts.map +1 -1
- package/dist/type_primitives/binary_heap/binary_heap.d.cts +37 -0
- package/dist/type_primitives/bitset/bitset.d.cts +54 -0
- package/dist/type_primitives/brand.d.cts +23 -0
- package/dist/type_primitives/error.d.cts +16 -0
- package/dist/type_primitives/error.d.ts +4 -3
- package/dist/type_primitives/error.d.ts.map +1 -1
- package/dist/type_primitives/index.d.cts +13 -0
- package/dist/type_primitives/index.d.ts +9 -9
- package/dist/type_primitives/sparse_map/sparse_map.d.cts +30 -0
- package/dist/type_primitives/sparse_set/sparse_set.d.cts +28 -0
- package/dist/type_primitives/topological_sort/topological_sort.d.cts +29 -0
- package/dist/type_primitives/typed_arrays/typed_arrays.d.cts +127 -0
- package/dist/typed_arrays-BcXcnzB4.js +258 -0
- package/dist/typed_arrays-D3NmwtCG.cjs +1 -0
- package/dist/utils/error.d.cts +6 -0
- package/dist/version.d.cts +10 -0
- package/dist/version.d.ts +10 -0
- package/dist/version.d.ts.map +1 -0
- package/package.json +102 -19
- package/dist/array-CxbPyiHO.cjs +0 -1
- package/dist/array-uFR7Q8fU.js +0 -132
- package/dist/core/reactive/array.d.ts.map +0 -1
- package/dist/core/reactive/index.cjs +0 -1
- package/dist/core/reactive/index.d.ts +0 -10
- package/dist/core/reactive/index.d.ts.map +0 -1
- package/dist/core/reactive/index.js +0 -17
- package/dist/core/reactive/interop.d.ts.map +0 -1
- package/dist/core/reactive/kernel.d.ts.map +0 -1
- package/dist/core/reactive/map.d.ts.map +0 -1
- package/dist/core/reactive/struct.d.ts.map +0 -1
- package/dist/log/console_sink.d.ts +0 -4
- package/dist/log/console_sink.d.ts.map +0 -1
- package/dist/log/index.d.ts +0 -3
- package/dist/log/index.d.ts.map +0 -1
- package/dist/log/logger.d.ts +0 -27
- package/dist/log/logger.d.ts.map +0 -1
- package/dist/shared-BXSZnxx4.cjs +0 -1
- package/dist/shared-C678TAPY.js +0 -99
- package/dist/topological_sort-DlRpSrxu.js +0 -391
- package/dist/topological_sort-WAT-VHb-.cjs +0 -1
- package/dist/utils/arrays.d.ts.map +0 -1
- package/dist/utils/constants.d.ts.map +0 -1
- /package/dist/{utils/constants.d.ts → core/ecs/utils/constants.d.cts} +0 -0
- /package/dist/core/store/{__generated__/abi.d.ts → vendored_abi/abi.d.cts} +0 -0
- /package/dist/{core/reactive/array.d.ts → reactive/array.d.cts} +0 -0
- /package/dist/{core/reactive/map.d.ts → reactive/map.d.cts} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./host_commands-BF8QMi3c.cjs"),d="/packages/engine/src/core/ecs/";class h{activeCache=null;repoRootCache=null;buf=new Map;callsiteCache=new Map;isActive(){if(this.activeCache!==null)return this.activeCache;const t=globalThis.process?.env?.VISUAL_INTEL_TRACE;return this.activeCache=t==="1"||t==="true"}repoRoot(){if(this.repoRootCache!==null)return this.repoRootCache;const e=globalThis.process;return this.repoRootCache=e?.cwd?.()??""}resolveCallsite(){return T(new Error().stack??null,this.repoRoot(),this.callsiteCache)}record(e,t,l){const s=this.resolveCallsite();if(!s)return;const o=`${e} ${t} ${l} ${s}`;this.buf.set(o,(this.buf.get(o)??0)+1)}recordEmit(e){this.record("ecs-events","emit",e)}recordRead(e){this.record("ecs-events","read",e)}recordResourceRead(e){this.record("resources","read",e)}recordResourceWrite(e){this.record("resources","write",e)}recordResourceRegister(e){this.record("resources","register",e)}recordResourceRemove(e){this.record("resources","remove",e)}recordSendAction(e){this.record("actions","send_action",e)}recordHandleAction(e){this.record("actions","handle_action",e)}snapshot(){const e={"ecs-events":{emit:[],read:[]},actions:{send_action:[],handle_action:[]},resources:{read:[],write:[],register:[],remove:[]}};for(const[t,l]of this.buf.entries()){const[s,o,n,c]=t.split(" ");if(!s||!o||c===void 0)continue;const u={key:s==="actions"?Number(n):n,file:c,count:l},E=e[s][o];E&&E.push(u)}for(const t of Object.values(e))for(const l of Object.values(t))l.sort((s,o)=>{if(s.file!==o.file)return s.file<o.file?-1:1;const n=String(s.key),c=String(o.key);return n<c?-1:n>c?1:0});return{schemaVersion:1,capturedAt:new Date().toISOString(),channels:e}}reset(){this.buf.clear(),this.callsiteCache.clear(),this.activeCache=null,this.repoRootCache=null}}function _(i){const e=/\(([^)]+):\d+:\d+\)\s*$/.exec(i);if(e)return e[1]??null;const t=/at\s+([^\s][^()]*?):\d+:\d+\s*$/.exec(i);return t&&(t[1]??"").trim()||null}function T(i,e,t){if(!i)return null;const l=i.split(`
|
|
2
|
+
`);for(let s=0;s<l.length;s++){const o=l[s],n=t?.get(o);if(n!==void 0){if(n===null)continue;return n}const c=_(o);if(!c){t?.set(o,null);continue}if(c.includes(d)){t?.set(o,null);continue}const a=C(c,e);return t?.set(o,a),a}return null}function C(i,e){let t=i;return t.startsWith("file://")&&(t=t.slice(7)),e&&t.startsWith(e+"/")&&(t=t.slice(e.length+1)),t.replace(/\\/g,"/")}const R=new h;exports.BUDGET_DEFAULT_ARCHETYPES=r.BUDGET_DEFAULT_ARCHETYPES;exports.BUDGET_DEFAULT_BYTES_PER_ENTITY=r.BUDGET_DEFAULT_BYTES_PER_ENTITY;exports.BUDGET_GROWTH_HEADROOM=r.BUDGET_GROWTH_HEADROOM;exports.DEFAULT_ECS_CAP_BYTES=r.DEFAULT_ECS_CAP_BYTES;exports.HOST_COMMAND_PAYLOAD_BYTES=r.HOST_COMMAND_PAYLOAD_BYTES;exports.HostCommandDispatcher=r.HostCommandDispatcher;exports.MAX_ENTITY_ID=r.MAX_ENTITY_ID;exports.MAX_GENERATION=r.MAX_GENERATION;exports.MAX_INDEX=r.MAX_INDEX;exports.MAX_LIVE_GENERATION=r.MAX_LIVE_GENERATION;exports.RETIRED_GENERATION=r.RETIRED_GENERATION;exports.accessCheck=r.accessCheck;exports.createEntityId=r.createEntityId;exports.getEntityGeneration=r.getEntityGeneration;exports.resolveECSMemory=r.resolveECSMemory;exports.ringDespawnCodec=r.ringDespawnCodec;exports.ringDisableCodec=r.ringDisableCodec;exports.ringEnableCodec=r.ringEnableCodec;exports.ringRemoveComponentCodec=r.ringRemoveComponentCodec;exports.ringSetFieldCodec=r.ringSetFieldCodec;exports.dispatchTrace=R;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* # oecs/internal — unstable tooling surface
|
|
3
|
+
*
|
|
4
|
+
* Codecs, ABI constants, memory inspectors, and dev-mode singletons, exported
|
|
5
|
+
* for tests, tooling, and advanced integrations (replication decode,
|
|
6
|
+
* cross-thread transports, adversarial harnesses).
|
|
7
|
+
*
|
|
8
|
+
* **No semver guarantees.** Anything here may change or disappear in any
|
|
9
|
+
* release. The supported application surface is the package root.
|
|
10
|
+
*
|
|
11
|
+
* @module oecs/internal
|
|
12
|
+
*/
|
|
13
|
+
export { resolveECSMemory, DEFAULT_ECS_CAP_BYTES, BUDGET_GROWTH_HEADROOM, BUDGET_DEFAULT_BYTES_PER_ENTITY, BUDGET_DEFAULT_ARCHETYPES } from './core/ecs/index.cjs';
|
|
14
|
+
export type { ResolvedECSMemory, ECSMemoryCapContext } from './core/ecs/index.cjs';
|
|
15
|
+
export { accessCheck } from './core/ecs/index.cjs';
|
|
16
|
+
export { dispatchTrace, type DispatchTraceSnapshot, type DispatchTraceEntry } from './core/ecs/index.cjs';
|
|
17
|
+
export { HostCommandDispatcher, ringSetFieldCodec, ringDespawnCodec, ringDisableCodec, ringEnableCodec, ringRemoveComponentCodec, HOST_COMMAND_PAYLOAD_BYTES } from './core/ecs/index.cjs';
|
|
18
|
+
export type { RingCommandApplier } from './core/ecs/index.cjs';
|
|
19
|
+
export { createEntityId, getEntityGeneration, MAX_INDEX, MAX_GENERATION, MAX_LIVE_GENERATION, RETIRED_GENERATION, MAX_ENTITY_ID } from './core/ecs/index.cjs';
|
|
20
|
+
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* # oecs/internal — unstable tooling surface
|
|
3
|
+
*
|
|
4
|
+
* Codecs, ABI constants, memory inspectors, and dev-mode singletons, exported
|
|
5
|
+
* for tests, tooling, and advanced integrations (replication decode,
|
|
6
|
+
* cross-thread transports, adversarial harnesses).
|
|
7
|
+
*
|
|
8
|
+
* **No semver guarantees.** Anything here may change or disappear in any
|
|
9
|
+
* release. The supported application surface is the package root.
|
|
10
|
+
*
|
|
11
|
+
* @module oecs/internal
|
|
12
|
+
*/
|
|
13
|
+
export { resolveECSMemory, DEFAULT_ECS_CAP_BYTES, BUDGET_GROWTH_HEADROOM, BUDGET_DEFAULT_BYTES_PER_ENTITY, BUDGET_DEFAULT_ARCHETYPES } from './core/ecs/index.js';
|
|
14
|
+
export type { ResolvedECSMemory, ECSMemoryCapContext } from './core/ecs/index.js';
|
|
15
|
+
export { accessCheck } from './core/ecs/index.js';
|
|
16
|
+
export { dispatchTrace, type DispatchTraceSnapshot, type DispatchTraceEntry } from './core/ecs/index.js';
|
|
17
|
+
export { HostCommandDispatcher, ringSetFieldCodec, ringDespawnCodec, ringDisableCodec, ringEnableCodec, ringRemoveComponentCodec, HOST_COMMAND_PAYLOAD_BYTES } from './core/ecs/index.js';
|
|
18
|
+
export type { RingCommandApplier } from './core/ecs/index.js';
|
|
19
|
+
export { createEntityId, getEntityGeneration, MAX_INDEX, MAX_GENERATION, MAX_LIVE_GENERATION, RETIRED_GENERATION, MAX_ENTITY_ID } from './core/ecs/index.js';
|
|
20
|
+
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,EACN,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,+BAA+B,EAC/B,yBAAyB,EACzB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGzE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAIzC,OAAO,EAAE,aAAa,EAAE,KAAK,qBAAqB,EAAE,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAMhG,OAAO,EACN,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,wBAAwB,EACxB,0BAA0B,EAC1B,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAQrD,OAAO,EACN,cAAc,EACd,mBAAmB,EACnB,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,MAAM,YAAY,CAAC"}
|
package/dist/internal.js
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { b as v, a as A, B as g, D as m, i as D, H as S, n as b, l as I, M, m as N, R as O, c as k, j as w, k as y, r as G, e as F, f as B, g as H, h as L, d as U } from "./host_commands-i4cAeyL5.js";
|
|
2
|
+
const h = "/packages/engine/src/core/ecs/";
|
|
3
|
+
class d {
|
|
4
|
+
activeCache = null;
|
|
5
|
+
repoRootCache = null;
|
|
6
|
+
buf = /* @__PURE__ */ new Map();
|
|
7
|
+
callsiteCache = /* @__PURE__ */ new Map();
|
|
8
|
+
isActive() {
|
|
9
|
+
if (this.activeCache !== null) return this.activeCache;
|
|
10
|
+
const t = globalThis.process?.env?.VISUAL_INTEL_TRACE;
|
|
11
|
+
return this.activeCache = t === "1" || t === "true";
|
|
12
|
+
}
|
|
13
|
+
repoRoot() {
|
|
14
|
+
if (this.repoRootCache !== null) return this.repoRootCache;
|
|
15
|
+
const e = globalThis.process;
|
|
16
|
+
return this.repoRootCache = e?.cwd?.() ?? "";
|
|
17
|
+
}
|
|
18
|
+
resolveCallsite() {
|
|
19
|
+
return E(
|
|
20
|
+
new Error().stack ?? null,
|
|
21
|
+
this.repoRoot(),
|
|
22
|
+
this.callsiteCache
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
record(e, t, i) {
|
|
26
|
+
const r = this.resolveCallsite();
|
|
27
|
+
if (!r) return;
|
|
28
|
+
const s = `${e} ${t} ${i} ${r}`;
|
|
29
|
+
this.buf.set(s, (this.buf.get(s) ?? 0) + 1);
|
|
30
|
+
}
|
|
31
|
+
recordEmit(e) {
|
|
32
|
+
this.record("ecs-events", "emit", e);
|
|
33
|
+
}
|
|
34
|
+
recordRead(e) {
|
|
35
|
+
this.record("ecs-events", "read", e);
|
|
36
|
+
}
|
|
37
|
+
recordResourceRead(e) {
|
|
38
|
+
this.record("resources", "read", e);
|
|
39
|
+
}
|
|
40
|
+
recordResourceWrite(e) {
|
|
41
|
+
this.record("resources", "write", e);
|
|
42
|
+
}
|
|
43
|
+
recordResourceRegister(e) {
|
|
44
|
+
this.record("resources", "register", e);
|
|
45
|
+
}
|
|
46
|
+
recordResourceRemove(e) {
|
|
47
|
+
this.record("resources", "remove", e);
|
|
48
|
+
}
|
|
49
|
+
recordSendAction(e) {
|
|
50
|
+
this.record("actions", "send_action", e);
|
|
51
|
+
}
|
|
52
|
+
recordHandleAction(e) {
|
|
53
|
+
this.record("actions", "handle_action", e);
|
|
54
|
+
}
|
|
55
|
+
snapshot() {
|
|
56
|
+
const e = {
|
|
57
|
+
"ecs-events": { emit: [], read: [] },
|
|
58
|
+
actions: { send_action: [], handle_action: [] },
|
|
59
|
+
resources: { read: [], write: [], register: [], remove: [] }
|
|
60
|
+
};
|
|
61
|
+
for (const [t, i] of this.buf.entries()) {
|
|
62
|
+
const [r, s, o, c] = t.split(" ");
|
|
63
|
+
if (!r || !s || c === void 0) continue;
|
|
64
|
+
const u = { key: r === "actions" ? Number(o) : o, file: c, count: i }, l = e[r][s];
|
|
65
|
+
l && l.push(u);
|
|
66
|
+
}
|
|
67
|
+
for (const t of Object.values(e))
|
|
68
|
+
for (const i of Object.values(t))
|
|
69
|
+
i.sort((r, s) => {
|
|
70
|
+
if (r.file !== s.file) return r.file < s.file ? -1 : 1;
|
|
71
|
+
const o = String(r.key), c = String(s.key);
|
|
72
|
+
return o < c ? -1 : o > c ? 1 : 0;
|
|
73
|
+
});
|
|
74
|
+
return {
|
|
75
|
+
schemaVersion: 1,
|
|
76
|
+
capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
77
|
+
channels: e
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
reset() {
|
|
81
|
+
this.buf.clear(), this.callsiteCache.clear(), this.activeCache = null, this.repoRootCache = null;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function f(n) {
|
|
85
|
+
const e = /\(([^)]+):\d+:\d+\)\s*$/.exec(n);
|
|
86
|
+
if (e) return e[1] ?? null;
|
|
87
|
+
const t = /at\s+([^\s][^()]*?):\d+:\d+\s*$/.exec(n);
|
|
88
|
+
return t && (t[1] ?? "").trim() || null;
|
|
89
|
+
}
|
|
90
|
+
function E(n, e, t) {
|
|
91
|
+
if (!n) return null;
|
|
92
|
+
const i = n.split(`
|
|
93
|
+
`);
|
|
94
|
+
for (let r = 0; r < i.length; r++) {
|
|
95
|
+
const s = i[r], o = t?.get(s);
|
|
96
|
+
if (o !== void 0) {
|
|
97
|
+
if (o === null) continue;
|
|
98
|
+
return o;
|
|
99
|
+
}
|
|
100
|
+
const c = f(s);
|
|
101
|
+
if (!c) {
|
|
102
|
+
t?.set(s, null);
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (c.includes(h)) {
|
|
106
|
+
t?.set(s, null);
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
const a = p(c, e);
|
|
110
|
+
return t?.set(s, a), a;
|
|
111
|
+
}
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
function p(n, e) {
|
|
115
|
+
let t = n;
|
|
116
|
+
return t.startsWith("file://") && (t = t.slice(7)), e && t.startsWith(e + "/") && (t = t.slice(e.length + 1)), t.replace(/\\/g, "/");
|
|
117
|
+
}
|
|
118
|
+
const C = new d();
|
|
119
|
+
export {
|
|
120
|
+
v as BUDGET_DEFAULT_ARCHETYPES,
|
|
121
|
+
A as BUDGET_DEFAULT_BYTES_PER_ENTITY,
|
|
122
|
+
g as BUDGET_GROWTH_HEADROOM,
|
|
123
|
+
m as DEFAULT_ECS_CAP_BYTES,
|
|
124
|
+
D as HOST_COMMAND_PAYLOAD_BYTES,
|
|
125
|
+
S as HostCommandDispatcher,
|
|
126
|
+
b as MAX_ENTITY_ID,
|
|
127
|
+
I as MAX_GENERATION,
|
|
128
|
+
M as MAX_INDEX,
|
|
129
|
+
N as MAX_LIVE_GENERATION,
|
|
130
|
+
O as RETIRED_GENERATION,
|
|
131
|
+
k as accessCheck,
|
|
132
|
+
w as createEntityId,
|
|
133
|
+
C as dispatchTrace,
|
|
134
|
+
y as getEntityGeneration,
|
|
135
|
+
G as resolveECSMemory,
|
|
136
|
+
F as ringDespawnCodec,
|
|
137
|
+
B as ringDisableCodec,
|
|
138
|
+
H as ringEnableCodec,
|
|
139
|
+
L as ringRemoveComponentCodec,
|
|
140
|
+
U as ringSetFieldCodec
|
|
141
|
+
};
|
package/dist/primitives.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./topological_sort-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./typed_arrays-D3NmwtCG.cjs"),t=require("./topological_sort-BDvEyb9W.cjs");class o{_dense=[];_sparse=[];get size(){return this._dense.length}get values(){return this._dense}has(e){return this._dense[this._sparse[e]]===e}add(e){this.has(e)||(this._sparse[e]=this._dense.length,this._dense.push(e))}delete(e){if(!this.has(e))return!1;const a=this._sparse[e],s=this._dense[this._dense.length-1];return this._dense[a]=s,this._sparse[s]=a,this._dense.pop(),!0}clear(){this._dense.length=0,this._sparse.length=0}[Symbol.iterator](){return this._dense[Symbol.iterator]()}}exports.BitSet=r.BitSet;exports.GrowableFloat32Array=r.GrowableFloat32Array;exports.GrowableFloat64Array=r.GrowableFloat64Array;exports.GrowableInt16Array=r.GrowableInt16Array;exports.GrowableInt32Array=r.GrowableInt32Array;exports.GrowableInt8Array=r.GrowableInt8Array;exports.GrowableTypedArray=r.GrowableTypedArray;exports.GrowableUint16Array=r.GrowableUint16Array;exports.GrowableUint32Array=r.GrowableUint32Array;exports.GrowableUint8Array=r.GrowableUint8Array;exports.BinaryHeap=t.BinaryHeap;exports.SparseMap=t.SparseMap;exports.topologicalSort=t.topologicalSort;exports.SparseSet=o;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@oasys/oecs/primitives` — the general-purpose data-structure primitives the
|
|
3
|
+
* ECS is built on, surfaced for direct consumer use: a bit set, sparse set/map,
|
|
4
|
+
* growable typed arrays, a binary heap, and a topological sort.
|
|
5
|
+
*
|
|
6
|
+
* These are the low-level building blocks only; the ECS itself is the default
|
|
7
|
+
* `@oasys/oecs` entry. The internal assertion, brand, and error helpers under
|
|
8
|
+
* `src/type_primitives/` are intentionally NOT re-exported here.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
export { BitSet } from './type_primitives/bitset/bitset.cjs';
|
|
13
|
+
export { SparseSet } from './type_primitives/sparse_set/sparse_set.cjs';
|
|
14
|
+
export { SparseMap } from './type_primitives/sparse_map/sparse_map.cjs';
|
|
15
|
+
export { GrowableTypedArray, GrowableFloat32Array, GrowableFloat64Array, GrowableInt8Array, GrowableInt16Array, GrowableInt32Array, GrowableUint8Array, GrowableUint16Array, GrowableUint32Array, type TypedArrayTag, type AnyTypedArray } from './type_primitives/typed_arrays/typed_arrays.cjs';
|
|
16
|
+
export { BinaryHeap, type CompareFn } from './type_primitives/binary_heap/binary_heap.cjs';
|
|
17
|
+
export { topologicalSort } from './type_primitives/topological_sort/topological_sort.cjs';
|
|
18
|
+
//# sourceMappingURL=primitives.d.ts.map
|
package/dist/primitives.d.ts
CHANGED
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @module
|
|
11
11
|
*/
|
|
12
|
-
export { BitSet } from './type_primitives/bitset/bitset';
|
|
13
|
-
export { SparseSet } from './type_primitives/sparse_set/sparse_set';
|
|
14
|
-
export { SparseMap } from './type_primitives/sparse_map/sparse_map';
|
|
15
|
-
export { GrowableTypedArray, GrowableFloat32Array, GrowableFloat64Array, GrowableInt8Array, GrowableInt16Array, GrowableInt32Array, GrowableUint8Array, GrowableUint16Array, GrowableUint32Array, type TypedArrayTag, type AnyTypedArray } from './type_primitives/typed_arrays/typed_arrays';
|
|
16
|
-
export { BinaryHeap, type CompareFn } from './type_primitives/binary_heap/binary_heap';
|
|
17
|
-
export { topologicalSort } from './type_primitives/topological_sort/topological_sort';
|
|
12
|
+
export { BitSet } from './type_primitives/bitset/bitset.js';
|
|
13
|
+
export { SparseSet } from './type_primitives/sparse_set/sparse_set.js';
|
|
14
|
+
export { SparseMap } from './type_primitives/sparse_map/sparse_map.js';
|
|
15
|
+
export { GrowableTypedArray, GrowableFloat32Array, GrowableFloat64Array, GrowableInt8Array, GrowableInt16Array, GrowableInt32Array, GrowableUint8Array, GrowableUint16Array, GrowableUint32Array, type TypedArrayTag, type AnyTypedArray } from './type_primitives/typed_arrays/typed_arrays.js';
|
|
16
|
+
export { BinaryHeap, type CompareFn } from './type_primitives/binary_heap/binary_heap.js';
|
|
17
|
+
export { topologicalSort } from './type_primitives/topological_sort/topological_sort.js';
|
|
18
18
|
//# sourceMappingURL=primitives.d.ts.map
|
package/dist/primitives.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { B as h, a as o, b as l, d as p, e as _, c as d, G as b, g as u, h as w, f as G } from "./typed_arrays-BcXcnzB4.js";
|
|
2
|
+
import { B as y, S as A, t as S } from "./topological_sort-DK6EjpWa.js";
|
|
3
|
+
class a {
|
|
3
4
|
_dense = [];
|
|
4
5
|
_sparse = [];
|
|
5
6
|
get size() {
|
|
@@ -8,16 +9,16 @@ class t {
|
|
|
8
9
|
get values() {
|
|
9
10
|
return this._dense;
|
|
10
11
|
}
|
|
11
|
-
has(
|
|
12
|
-
return this._dense[this._sparse[
|
|
12
|
+
has(e) {
|
|
13
|
+
return this._dense[this._sparse[e]] === e;
|
|
13
14
|
}
|
|
14
|
-
add(
|
|
15
|
-
this.has(
|
|
15
|
+
add(e) {
|
|
16
|
+
this.has(e) || (this._sparse[e] = this._dense.length, this._dense.push(e));
|
|
16
17
|
}
|
|
17
|
-
delete(
|
|
18
|
-
if (!this.has(
|
|
19
|
-
const
|
|
20
|
-
return this._dense[
|
|
18
|
+
delete(e) {
|
|
19
|
+
if (!this.has(e)) return !1;
|
|
20
|
+
const s = this._sparse[e], r = this._dense[this._dense.length - 1];
|
|
21
|
+
return this._dense[s] = r, this._sparse[r] = s, this._dense.pop(), !0;
|
|
21
22
|
}
|
|
22
23
|
clear() {
|
|
23
24
|
this._dense.length = 0, this._sparse.length = 0;
|
|
@@ -27,18 +28,18 @@ class t {
|
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
export {
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
y as BinaryHeap,
|
|
32
|
+
h as BitSet,
|
|
32
33
|
o as GrowableFloat32Array,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
l as GrowableFloat64Array,
|
|
35
|
+
p as GrowableInt16Array,
|
|
36
|
+
_ as GrowableInt32Array,
|
|
37
|
+
d as GrowableInt8Array,
|
|
38
|
+
b as GrowableTypedArray,
|
|
39
|
+
u as GrowableUint16Array,
|
|
40
|
+
w as GrowableUint32Array,
|
|
41
|
+
G as GrowableUint8Array,
|
|
42
|
+
A as SparseMap,
|
|
43
|
+
a as SparseSet,
|
|
44
|
+
S as topologicalSort
|
|
44
45
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface ReactiveArray<T> {
|
|
2
|
+
/** Read slot `i`, subscribing to that slot (or to structure if out of range). */
|
|
3
|
+
get(i: number): T | undefined;
|
|
4
|
+
/** Element count, tracking structure (length changes only, not value updates). */
|
|
5
|
+
length(): number;
|
|
6
|
+
/**
|
|
7
|
+
* Whole-array snapshot. Tracks structure AND every slot value — the COARSE read
|
|
8
|
+
* (any slot change wakes it). Use `length()` + `get(i)` for the fine-grained path;
|
|
9
|
+
* `snapshot()` is for feeding a positional array to a Solid `<Index each>`.
|
|
10
|
+
*/
|
|
11
|
+
snapshot(): readonly T[];
|
|
12
|
+
/** Fine-grained slot write. Updating an in-range slot wakes only that slot's readers. */
|
|
13
|
+
set(i: number, value: T): void;
|
|
14
|
+
/** Append one element; bumps structure. */
|
|
15
|
+
push(value: T): void;
|
|
16
|
+
/** Remove + return the last element; bumps structure. */
|
|
17
|
+
pop(): T | undefined;
|
|
18
|
+
/** Array-semantics splice; positionally reconciles so only shifted slots wake. */
|
|
19
|
+
splice(start: number, deleteCount?: number, ...items: T[]): T[];
|
|
20
|
+
/** Structural-sharing bulk replace: diff vs current, write only changed slots. */
|
|
21
|
+
reconcile(next: readonly T[]): void;
|
|
22
|
+
}
|
|
23
|
+
export declare function reactiveArray<T>(initial?: readonly T[], eq?: (a: T, b: T) => boolean): ReactiveArray<T>;
|
|
24
|
+
//# sourceMappingURL=array.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../src/reactive/array.ts"],"names":[],"mappings":"AA2CA,MAAM,WAAW,aAAa,CAAC,CAAC;IAC/B,iFAAiF;IACjF,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;IAC9B,kFAAkF;IAClF,MAAM,IAAI,MAAM,CAAC;IACjB;;;;OAIG;IACH,QAAQ,IAAI,SAAS,CAAC,EAAE,CAAC;IACzB,yFAAyF;IACzF,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IAC/B,2CAA2C;IAC3C,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACrB,yDAAyD;IACzD,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;IACrB,kFAAkF;IAClF,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;IAChE,kFAAkF;IAClF,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,GAAG,IAAI,CAAC;CACpC;AAED,wBAAgB,aAAa,CAAC,CAAC,EAC9B,OAAO,GAAE,SAAS,CAAC,EAAO,EAC1B,EAAE,GAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAmB,GACrC,aAAa,CAAC,CAAC,CAAC,CAmGlB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../kernel-yWV3XnAb.cjs"),t=require("../shallow-DQ8aG51_.cjs"),r=require("../interop-CT-REx0W.cjs");exports.batch=e.batch;exports.computed=e.computed;exports.effect=e.effect;exports.onCleanup=e.onCleanup;exports.root=e.root;exports.signal=e.signal;exports.untrack=e.untrack;exports.reactiveArray=t.reactiveArray;exports.reactiveMap=t.reactiveMap;exports.reactiveStruct=t.reactiveStruct;exports.shallow=t.shallow;exports.subscribe=r.subscribe;exports.toExternalStore=r.toExternalStore;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reactive kernel — the engine UI seam's fine-grained, glitch-free reactive core
|
|
3
|
+
* (ADR-0021). Zero dependencies; consumer owns rendering. See docs/api/reactive.md.
|
|
4
|
+
*/
|
|
5
|
+
export { signal, computed, effect, batch, untrack, root, onCleanup, type Accessor, type Setter, type Eq } from './kernel.cjs';
|
|
6
|
+
export { reactiveMap, type ReactiveMap } from './map.cjs';
|
|
7
|
+
export { reactiveStruct, type StructSetters, type StructEq } from './struct.cjs';
|
|
8
|
+
export { reactiveArray, type ReactiveArray } from './array.cjs';
|
|
9
|
+
export { subscribe, toExternalStore, type ExternalStore } from './interop.cjs';
|
|
10
|
+
export { shallow } from './shallow.cjs';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reactive kernel — the engine UI seam's fine-grained, glitch-free reactive core
|
|
3
|
+
* (ADR-0021). Zero dependencies; consumer owns rendering. See docs/api/reactive.md.
|
|
4
|
+
*/
|
|
5
|
+
export { signal, computed, effect, batch, untrack, root, onCleanup, type Accessor, type Setter, type Eq } from './kernel.js';
|
|
6
|
+
export { reactiveMap, type ReactiveMap } from './map.js';
|
|
7
|
+
export { reactiveStruct, type StructSetters, type StructEq } from './struct.js';
|
|
8
|
+
export { reactiveArray, type ReactiveArray } from './array.js';
|
|
9
|
+
export { subscribe, toExternalStore, type ExternalStore } from './interop.js';
|
|
10
|
+
export { shallow } from './shallow.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/reactive/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACN,MAAM,EACN,QAAQ,EACR,MAAM,EACN,KAAK,EACL,OAAO,EACP,IAAI,EACJ,SAAS,EACT,KAAK,QAAQ,EACb,KAAK,MAAM,EACX,KAAK,EAAE,EACP,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,KAAK,aAAa,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { b as r, c as e, e as t, o, r as c, s as p, u } from "../kernel-DgyrLFjW.js";
|
|
2
|
+
import { b as f, r as i, a as l, s as n } from "../shallow-DfnAm9vG.js";
|
|
3
|
+
import { s as x, t as v } from "../interop-CcY6ASQc.js";
|
|
4
|
+
export {
|
|
5
|
+
r as batch,
|
|
6
|
+
e as computed,
|
|
7
|
+
t as effect,
|
|
8
|
+
o as onCleanup,
|
|
9
|
+
f as reactiveArray,
|
|
10
|
+
i as reactiveMap,
|
|
11
|
+
l as reactiveStruct,
|
|
12
|
+
c as root,
|
|
13
|
+
n as shallow,
|
|
14
|
+
p as signal,
|
|
15
|
+
x as subscribe,
|
|
16
|
+
v as toExternalStore,
|
|
17
|
+
u as untrack
|
|
18
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Accessor } from './kernel.cjs';
|
|
2
|
+
/**
|
|
3
|
+
* Vanilla subscription: invoke `onChange(value)` once per coalesced change to
|
|
4
|
+
* whatever `accessor` reads. Does NOT fire on subscribe (the consumer reads the
|
|
5
|
+
* initial value itself); returns a disposer. This is the universal adapter base.
|
|
6
|
+
*/
|
|
7
|
+
export declare function subscribe<T>(accessor: Accessor<T>, onChange: (value: T) => void): () => void;
|
|
8
|
+
/**
|
|
9
|
+
* The framework-agnostic external-store contract (React's useSyncExternalStore
|
|
10
|
+
* shape, but useful everywhere). `subscribe` takes a zero-arg "something changed"
|
|
11
|
+
* callback; `getSnapshot` reads the current, referentially-stable value.
|
|
12
|
+
*/
|
|
13
|
+
export interface ExternalStore<T> {
|
|
14
|
+
subscribe(onStoreChange: () => void): () => void;
|
|
15
|
+
getSnapshot(): T;
|
|
16
|
+
}
|
|
17
|
+
/** Wrap an accessor as an ExternalStore. Snapshot stability comes from the kernel. */
|
|
18
|
+
export declare function toExternalStore<T>(accessor: Accessor<T>): ExternalStore<T>;
|
|
19
|
+
//# sourceMappingURL=interop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interop.d.ts","sourceRoot":"","sources":["../../src/reactive/interop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,EAAmB,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAE1D;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GAAG,MAAM,IAAI,CAW5F;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC;IAC/B,SAAS,CAAC,aAAa,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;IACjD,WAAW,IAAI,CAAC,CAAC;CACjB;AAED,sFAAsF;AACtF,wBAAgB,eAAe,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAK1E"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-house fine-grained reactive kernel — signal / computed / effect / batch,
|
|
3
|
+
* plus ownership scopes (`root` / `onCleanup`). Zero dependencies (ADR-0021).
|
|
4
|
+
*
|
|
5
|
+
* This is the engine UI seam's propagation core. It is the same class of machine
|
|
6
|
+
* as the ECS observer system (ADR-0013) — fine-grained, glitch-free, cascades to
|
|
7
|
+
* a fixed point — at a different granularity, which is exactly why #646 chose to
|
|
8
|
+
* own it rather than adopt solid-js / @preact/signals-core / alien-signals.
|
|
9
|
+
*
|
|
10
|
+
* The dependency graph is an intrusive doubly-linked structure. One pooled `Link`
|
|
11
|
+
* per edge is threaded into BOTH the source's subscriber list and the target's
|
|
12
|
+
* dependency list at once, so link/unlink is O(1) pointer surgery with no hashing,
|
|
13
|
+
* and a stable-dependency re-run reuses its edges via a tail cursor (zero graph
|
|
14
|
+
* mutation). That is the entire performance story: it ties the throughput leaders
|
|
15
|
+
* on the hot paths and avoids the Set-based prototype's fan-in collapse.
|
|
16
|
+
*
|
|
17
|
+
* Computed is lazy and glitch-free via a version-cutoff pull (the model
|
|
18
|
+
* alien-signals / preact use):
|
|
19
|
+
*
|
|
20
|
+
* - Every source carries a `version` that bumps only when its value actually
|
|
21
|
+
* changes. Each edge (`Link`) remembers the source version it last saw.
|
|
22
|
+
* - A write does NOT eagerly recompute anything. It propagates a "maybe-dirty"
|
|
23
|
+
* mark (`OUTDATED`) down through computeds to effects, and queues the effects.
|
|
24
|
+
* Computeds stay lazy.
|
|
25
|
+
* - Work happens on the pull: when an effect flushes (or a computed is read),
|
|
26
|
+
* `needsRecompute` walks its deps, refreshes each, and recomputes only if a
|
|
27
|
+
* dep's version actually advanced. A recompute that produces an equal value
|
|
28
|
+
* does NOT bump the node's own version, so its subscribers are skipped.
|
|
29
|
+
*
|
|
30
|
+
* That gives glitch-freedom (a diamond resolves with one consistent recompute of
|
|
31
|
+
* the join) and minimal work (unchanged values cut propagation) at once.
|
|
32
|
+
*
|
|
33
|
+
* Known, deliberate scope (refinements, not correctness gaps): computeds ALWAYS
|
|
34
|
+
* track their sources (no auto-unsubscribe of unobserved computeds — the TRACKING
|
|
35
|
+
* optimization) and there is no global-version fast path. The two help only a
|
|
36
|
+
* workload heavy in *unobserved* computeds and are low-value without each other;
|
|
37
|
+
* see ADR-0021. Cycle reads return the stale value rather than throwing.
|
|
38
|
+
*/
|
|
39
|
+
export type Eq<T> = (a: T, b: T) => boolean;
|
|
40
|
+
/** A read accessor; calling it inside an effect/computed subscribes to the source. */
|
|
41
|
+
export type Accessor<T> = () => T;
|
|
42
|
+
/** A write setter; a same-value write (per `eq`) is a no-op and wakes nobody. */
|
|
43
|
+
export type Setter<T> = (v: T) => void;
|
|
44
|
+
/** Create a writable signal. Returns `[read, write]`; `eq` defaults to `Object.is`.
|
|
45
|
+
* The zero-arg form (Solid parity) starts at `undefined` for late-initialized
|
|
46
|
+
* values: `const [user, setUser] = signal<User>();` reads `User | undefined`. */
|
|
47
|
+
export declare function signal<T>(): readonly [Accessor<T | undefined>, Setter<T | undefined>];
|
|
48
|
+
export declare function signal<T>(initial: T, eq?: Eq<T>): readonly [Accessor<T>, Setter<T>];
|
|
49
|
+
/** Create a lazy, glitch-free derived value. Recomputes on pull only when a dep changed. */
|
|
50
|
+
export declare function computed<T>(fn: () => T, eq?: Eq<T>): Accessor<T>;
|
|
51
|
+
/** Run `fn` now and re-run it whenever a tracked dep changes. Returns a disposer. */
|
|
52
|
+
export declare function effect(fn: () => void): () => void;
|
|
53
|
+
/** Coalesce all writes inside `fn` into a single flush at the outermost boundary. */
|
|
54
|
+
export declare function batch(fn: () => void): void;
|
|
55
|
+
/**
|
|
56
|
+
* Read inside `fn` without subscribing the enclosing effect/computed to anything it
|
|
57
|
+
* touches (Solid's `untrack`). Use it when a callback that runs during a tracked run
|
|
58
|
+
* must NOT become a dependency — e.g. an interop subscriber whose `onChange` reads
|
|
59
|
+
* other accessors. Returns `fn`'s result.
|
|
60
|
+
*/
|
|
61
|
+
export declare function untrack<T>(fn: () => T): T;
|
|
62
|
+
/**
|
|
63
|
+
* Create an ownership scope. `fn` receives a disposer that tears down every
|
|
64
|
+
* effect/computed (and their onCleanups) created under the scope. Detached from
|
|
65
|
+
* any enclosing owner — you hold the disposer (Solid's `createRoot` contract).
|
|
66
|
+
*/
|
|
67
|
+
export declare function root<T>(fn: (dispose: () => void) => T): T;
|
|
68
|
+
/**
|
|
69
|
+
* Register a cleanup with the owner in scope. Inside an effect/computed it runs
|
|
70
|
+
* before each re-run and on dispose; inside a `root` it runs on root disposal.
|
|
71
|
+
*/
|
|
72
|
+
export declare function onCleanup(fn: () => void): void;
|
|
73
|
+
//# sourceMappingURL=kernel.d.ts.map
|
|
@@ -36,12 +36,15 @@
|
|
|
36
36
|
* workload heavy in *unobserved* computeds and are low-value without each other;
|
|
37
37
|
* see ADR-0021. Cycle reads return the stale value rather than throwing.
|
|
38
38
|
*/
|
|
39
|
-
type Eq<T> = (a: T, b: T) => boolean;
|
|
39
|
+
export type Eq<T> = (a: T, b: T) => boolean;
|
|
40
40
|
/** A read accessor; calling it inside an effect/computed subscribes to the source. */
|
|
41
41
|
export type Accessor<T> = () => T;
|
|
42
42
|
/** A write setter; a same-value write (per `eq`) is a no-op and wakes nobody. */
|
|
43
43
|
export type Setter<T> = (v: T) => void;
|
|
44
|
-
/** Create a writable signal. Returns `[read, write]`; `eq` defaults to `Object.is`.
|
|
44
|
+
/** Create a writable signal. Returns `[read, write]`; `eq` defaults to `Object.is`.
|
|
45
|
+
* The zero-arg form (Solid parity) starts at `undefined` for late-initialized
|
|
46
|
+
* values: `const [user, setUser] = signal<User>();` reads `User | undefined`. */
|
|
47
|
+
export declare function signal<T>(): readonly [Accessor<T | undefined>, Setter<T | undefined>];
|
|
45
48
|
export declare function signal<T>(initial: T, eq?: Eq<T>): readonly [Accessor<T>, Setter<T>];
|
|
46
49
|
/** Create a lazy, glitch-free derived value. Recomputes on pull only when a dep changed. */
|
|
47
50
|
export declare function computed<T>(fn: () => T, eq?: Eq<T>): Accessor<T>;
|
|
@@ -67,5 +70,4 @@ export declare function root<T>(fn: (dispose: () => void) => T): T;
|
|
|
67
70
|
* before each re-run and on dispose; inside a `root` it runs on root disposal.
|
|
68
71
|
*/
|
|
69
72
|
export declare function onCleanup(fn: () => void): void;
|
|
70
|
-
export {};
|
|
71
73
|
//# sourceMappingURL=kernel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../../src/reactive/kernel.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,MAAM,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC;AA0W5C,sFAAsF;AACtF,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC;AAClC,iFAAiF;AACjF,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC;AAEvC;;iFAEiF;AACjF,wBAAgB,MAAM,CAAC,CAAC,KAAK,SAAS,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;AACvF,wBAAgB,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AASrF,4FAA4F;AAC5F,wBAAgB,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,GAAE,EAAE,CAAC,CAAC,CAAa,GAAG,QAAQ,CAAC,CAAC,CAAC,CAS3E;AAED,qFAAqF;AACrF,wBAAgB,MAAM,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAKjD;AAED,qFAAqF;AACrF,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI,CAO1C;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAQzC;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,EAAE,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CASzD;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI,CAW9C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface ReactiveMap<K, V> {
|
|
2
|
+
/** Read a key's value, subscribing the caller to that key (or to structure if absent). */
|
|
3
|
+
get(key: K): V | undefined;
|
|
4
|
+
/** Insert or update a key. Updating an existing key wakes only that key's readers. */
|
|
5
|
+
set(key: K, value: V): void;
|
|
6
|
+
/** Remove a key. Wakes that key's readers (now absent) and structure readers. */
|
|
7
|
+
delete(key: K): boolean;
|
|
8
|
+
/** Membership test, tracking the key set. */
|
|
9
|
+
has(key: K): boolean;
|
|
10
|
+
/** Entry count, tracking the key set. */
|
|
11
|
+
size(): number;
|
|
12
|
+
/** Snapshot of keys, tracking the key set. */
|
|
13
|
+
keys(): K[];
|
|
14
|
+
}
|
|
15
|
+
export declare function reactiveMap<K, V>(eq?: (a: V, b: V) => boolean): ReactiveMap<K, V>;
|
|
16
|
+
//# sourceMappingURL=map.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../src/reactive/map.ts"],"names":[],"mappings":"AA2BA,MAAM,WAAW,WAAW,CAAC,CAAC,EAAE,CAAC;IAChC,0FAA0F;IAC1F,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAC3B,sFAAsF;IACtF,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IAC5B,iFAAiF;IACjF,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC;IACxB,6CAA6C;IAC7C,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC;IACrB,yCAAyC;IACzC,IAAI,IAAI,MAAM,CAAC;IACf,8CAA8C;IAC9C,IAAI,IAAI,CAAC,EAAE,CAAC;CACZ;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,GAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAmB,GAAG,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAiE5F"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shallow (one-level) value equality — the recommended `eq` for object-valued
|
|
3
|
+
* projections. Mirrors zustand `useShallow` / MobX `comparer.shallow`: two objects
|
|
4
|
+
* are equal iff they have the same own keys with `Object.is`-equal values. Restores
|
|
5
|
+
* "equal write wakes nobody" for projections that build a fresh object each tick.
|
|
6
|
+
*
|
|
7
|
+
* Lives in the kernel entry (`/reactive`) — it has zero ECS dependency
|
|
8
|
+
* (POLISH_AUDIT M12); `/reactive-sync` re-exports it for compatibility.
|
|
9
|
+
*/
|
|
10
|
+
export declare function shallow(a: object, b: object): boolean;
|
|
11
|
+
//# sourceMappingURL=shallow.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shallow (one-level) value equality — the recommended `eq` for object-valued
|
|
3
|
+
* projections. Mirrors zustand `useShallow` / MobX `comparer.shallow`: two objects
|
|
4
|
+
* are equal iff they have the same own keys with `Object.is`-equal values. Restores
|
|
5
|
+
* "equal write wakes nobody" for projections that build a fresh object each tick.
|
|
6
|
+
*
|
|
7
|
+
* Lives in the kernel entry (`/reactive`) — it has zero ECS dependency
|
|
8
|
+
* (POLISH_AUDIT M12); `/reactive-sync` re-exports it for compatibility.
|
|
9
|
+
*/
|
|
10
|
+
export declare function shallow(a: object, b: object): boolean;
|
|
11
|
+
//# sourceMappingURL=shallow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shallow.d.ts","sourceRoot":"","sources":["../../src/reactive/shallow.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAWrD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Per-field setters: `set.field(value)`. */
|
|
2
|
+
export type StructSetters<T> = {
|
|
3
|
+
readonly [K in keyof T]: (v: T[K]) => void;
|
|
4
|
+
};
|
|
5
|
+
/** Optional per-field equality overrides. */
|
|
6
|
+
export type StructEq<T> = {
|
|
7
|
+
readonly [K in keyof T]?: (a: T[K], b: T[K]) => boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare function reactiveStruct<T extends object>(initial: T, eq?: StructEq<T>): readonly [proxy: Readonly<T>, set: StructSetters<T>];
|
|
10
|
+
//# sourceMappingURL=struct.d.ts.map
|
|
@@ -6,5 +6,5 @@ export type StructSetters<T> = {
|
|
|
6
6
|
export type StructEq<T> = {
|
|
7
7
|
readonly [K in keyof T]?: (a: T[K], b: T[K]) => boolean;
|
|
8
8
|
};
|
|
9
|
-
export declare function reactiveStruct<T extends object>(initial: T, eq?: StructEq<T>): readonly [proxy: T
|
|
9
|
+
export declare function reactiveStruct<T extends object>(initial: T, eq?: StructEq<T>): readonly [proxy: Readonly<T>, set: StructSetters<T>];
|
|
10
10
|
//# sourceMappingURL=struct.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"struct.d.ts","sourceRoot":"","sources":["../../src/reactive/struct.ts"],"names":[],"mappings":"AA6BA,6CAA6C;AAC7C,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI;IAAE,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI;CAAE,CAAC;AAC9E,6CAA6C;AAC7C,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;IAAE,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO;CAAE,CAAC;AAEtF,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAC9C,OAAO,EAAE,CAAC,EACV,EAAE,GAAE,QAAQ,CAAC,CAAC,CAAM,GAClB,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAyDtD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const p=require("./kernel-yWV3XnAb.cjs");function O(g=Object.is){const l=new Map,[t,h]=p.signal(0);let i=0;const a=(s,r)=>s!==void 0&&r!==void 0?g(s,r):s===r;return{get(s){const r=l.get(s);if(r!==void 0)return r[0]();t()},set(s,r){const o=l.get(s);o!==void 0?o[1](r):(l.set(s,p.signal(r,a)),h(++i))},delete(s){const r=l.get(s);return r===void 0?!1:(l.delete(s),p.batch(()=>{r[1](void 0),h(++i)}),!0)},has(s){return t(),l.has(s)},size(){return t(),l.size},keys(){return t(),[...l.keys()]}}}function k(g,l={}){const t={},h={},i=Object.keys(g),a=new Set(i);for(const r of i){const[o,b]=p.signal(g[r],l[r]);t[r]=o,h[r]=b}return[new Proxy({},{get:(r,o)=>a.has(o)?t[o]():Reflect.get(r,o),has:(r,o)=>a.has(o),ownKeys:()=>i,getOwnPropertyDescriptor:(r,o)=>a.has(o)?{get:()=>t[o](),enumerable:!0,configurable:!0}:void 0,set:(r,o)=>!1}),h]}const y=Symbol("reactiveArray.absent");function j(g=[],l=Object.is){const t=[],[h,i]=p.signal(0);let a=0;const s=(e,n)=>e!==y&&n!==y?l(e,n):e===n,r=e=>p.signal(e,s),o=e=>p.untrack(t[e][0]);for(const e of g)t.push(r(e));function b(e){p.batch(()=>{const n=t.length,f=e.length,v=f<n?f:n;for(let c=0;c<v;c++)t[c][1](e[c]);if(f>n){for(let c=n;c<f;c++)t.push(r(e[c]));i(++a)}else if(f<n){const c=t.splice(f);for(let d=0;d<c.length;d++)c[d][1](y);i(++a)}})}return{get(e){if(e>=0&&e<t.length){const n=t[e][0]();if(n!==y)return n}h()},length(){return h(),t.length},snapshot(){h();const e=new Array(t.length);for(let n=0;n<t.length;n++)e[n]=t[n][0]();return e},set(e,n){e>=0&&e<t.length&&t[e][1](n)},push(e){t.push(r(e)),i(++a)},pop(){const e=t.length;if(e===0)return;const n=o(e-1),[f]=t.splice(e-1);return p.batch(()=>{f[1](y),i(++a)}),n},splice(e,n,...f){const v=t.length,c=e<0?Math.max(v+e,0):Math.min(e,v),d=n===void 0?v-c:Math.max(0,Math.min(n,v-c)),w=[];for(let u=0;u<d;u++)w.push(o(c+u));const m=[];for(let u=0;u<c;u++)m.push(o(u));for(let u=0;u<f.length;u++)m.push(f[u]);for(let u=c+d;u<v;u++)m.push(o(u));return b(m),w},reconcile(e){b(e)}}}function S(g,l){if(Object.is(g,l))return!0;const t=g,h=l,i=Object.keys(t);if(i.length!==Object.keys(h).length)return!1;for(let a=0;a<i.length;a++){const s=i[a];if(!Object.prototype.hasOwnProperty.call(h,s)||!Object.is(t[s],h[s]))return!1}return!0}exports.reactiveArray=j;exports.reactiveMap=O;exports.reactiveStruct=k;exports.shallow=S;
|