@oasys/oecs 0.3.1 → 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 +207 -267
- package/dist/core/ecs/access_check.d.cts +77 -0
- package/dist/core/ecs/access_check.d.ts +77 -0
- package/dist/core/ecs/access_check.d.ts.map +1 -0
- package/dist/core/ecs/archetype.d.cts +486 -0
- package/dist/core/ecs/archetype.d.ts +486 -0
- package/dist/core/ecs/archetype.d.ts.map +1 -0
- 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 +43 -0
- package/dist/core/ecs/builtin_relations.d.ts.map +1 -0
- package/dist/core/ecs/command_log.d.cts +116 -0
- package/dist/core/ecs/command_log.d.ts +116 -0
- package/dist/core/ecs/command_log.d.ts.map +1 -0
- package/dist/core/ecs/component.d.cts +176 -0
- package/dist/core/ecs/component.d.ts +176 -0
- package/dist/core/ecs/component.d.ts.map +1 -0
- package/dist/core/ecs/compute_backend.d.cts +37 -0
- package/dist/core/ecs/compute_backend.d.ts +37 -0
- package/dist/core/ecs/compute_backend.d.ts.map +1 -0
- 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 +93 -0
- package/dist/core/ecs/dispatch_trace.d.ts.map +1 -0
- package/dist/core/ecs/ecs.d.cts +562 -0
- package/dist/core/ecs/ecs.d.ts +562 -0
- package/dist/core/ecs/ecs.d.ts.map +1 -0
- package/dist/core/ecs/ecs_memory.d.cts +179 -0
- package/dist/core/ecs/ecs_memory.d.ts +179 -0
- package/dist/core/ecs/ecs_memory.d.ts.map +1 -0
- package/dist/core/ecs/entity.d.cts +34 -0
- package/dist/core/ecs/entity.d.ts +34 -0
- package/dist/core/ecs/entity.d.ts.map +1 -0
- 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 +79 -0
- package/dist/core/ecs/event.d.ts.map +1 -0
- 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 +133 -0
- package/dist/core/ecs/frame_trace.d.ts.map +1 -0
- package/dist/core/ecs/host_commands.d.cts +274 -0
- package/dist/core/ecs/host_commands.d.ts +274 -0
- package/dist/core/ecs/host_commands.d.ts.map +1 -0
- package/dist/core/ecs/index.d.cts +46 -0
- package/dist/core/ecs/index.d.ts +46 -0
- package/dist/core/ecs/index.d.ts.map +1 -0
- package/dist/core/ecs/observer.d.cts +173 -0
- package/dist/core/ecs/observer.d.ts +173 -0
- package/dist/core/ecs/observer.d.ts.map +1 -0
- package/dist/core/ecs/query.d.cts +718 -0
- package/dist/core/ecs/query.d.ts +718 -0
- package/dist/core/ecs/query.d.ts.map +1 -0
- package/dist/core/ecs/ref.d.cts +31 -0
- package/dist/core/ecs/ref.d.ts +31 -0
- package/dist/core/ecs/ref.d.ts.map +1 -0
- package/dist/core/ecs/relation.d.cts +243 -0
- package/dist/core/ecs/relation.d.ts +243 -0
- package/dist/core/ecs/relation.d.ts.map +1 -0
- 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 +53 -0
- package/dist/core/ecs/resource.d.ts.map +1 -0
- 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 +85 -0
- package/dist/core/ecs/resume.d.ts.map +1 -0
- package/dist/core/ecs/run_condition.d.cts +81 -0
- package/dist/core/ecs/run_condition.d.ts +81 -0
- package/dist/core/ecs/run_condition.d.ts.map +1 -0
- package/dist/core/ecs/schedule.d.cts +142 -0
- package/dist/core/ecs/schedule.d.ts +142 -0
- package/dist/core/ecs/schedule.d.ts.map +1 -0
- 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 +110 -0
- package/dist/core/ecs/sparse_store.d.ts.map +1 -0
- package/dist/core/ecs/store.d.cts +950 -0
- package/dist/core/ecs/store.d.ts +950 -0
- package/dist/core/ecs/store.d.ts.map +1 -0
- package/dist/core/ecs/store_layout_listener.d.cts +23 -0
- package/dist/core/ecs/store_layout_listener.d.ts +23 -0
- package/dist/core/ecs/store_layout_listener.d.ts.map +1 -0
- package/dist/core/ecs/system.d.cts +250 -0
- package/dist/core/ecs/system.d.ts +250 -0
- package/dist/core/ecs/system.d.ts.map +1 -0
- package/dist/core/ecs/utils/arrays.d.cts +7 -0
- package/dist/{utils → core/ecs/utils}/arrays.d.ts +2 -1
- package/dist/core/ecs/utils/arrays.d.ts.map +1 -0
- package/dist/core/ecs/utils/constants.d.ts +12 -0
- package/dist/core/ecs/utils/constants.d.ts.map +1 -0
- package/dist/core/ecs/utils/error.d.cts +61 -0
- package/dist/core/ecs/utils/error.d.ts +61 -0
- package/dist/core/ecs/utils/error.d.ts.map +1 -0
- package/dist/core/store/action_ring.d.cts +136 -0
- package/dist/core/store/action_ring.d.ts +136 -0
- package/dist/core/store/action_ring.d.ts.map +1 -0
- package/dist/core/store/allocator.d.cts +238 -0
- package/dist/core/store/allocator.d.ts +238 -0
- package/dist/core/store/allocator.d.ts.map +1 -0
- package/dist/core/store/buffer_backed_column.d.cts +69 -0
- package/dist/core/store/buffer_backed_column.d.ts +69 -0
- package/dist/core/store/buffer_backed_column.d.ts.map +1 -0
- package/dist/core/store/column_store.d.cts +273 -0
- package/dist/core/store/column_store.d.ts +273 -0
- package/dist/core/store/column_store.d.ts.map +1 -0
- package/dist/core/store/command_dispatch.d.cts +52 -0
- package/dist/core/store/command_dispatch.d.ts +52 -0
- package/dist/core/store/command_dispatch.d.ts.map +1 -0
- package/dist/core/store/command_ring.d.cts +107 -0
- package/dist/core/store/command_ring.d.ts +107 -0
- package/dist/core/store/command_ring.d.ts.map +1 -0
- package/dist/core/store/descriptor.d.cts +80 -0
- package/dist/core/store/descriptor.d.ts +80 -0
- package/dist/core/store/descriptor.d.ts.map +1 -0
- package/dist/core/store/entity_index.d.cts +108 -0
- package/dist/core/store/entity_index.d.ts +108 -0
- package/dist/core/store/entity_index.d.ts.map +1 -0
- package/dist/core/store/event_ring.d.cts +95 -0
- package/dist/core/store/event_ring.d.ts +95 -0
- package/dist/core/store/event_ring.d.ts.map +1 -0
- package/dist/core/store/extend.d.cts +39 -0
- package/dist/core/store/extend.d.ts +39 -0
- package/dist/core/store/extend.d.ts.map +1 -0
- package/dist/core/store/grow.d.cts +34 -0
- package/dist/core/store/grow.d.ts +34 -0
- package/dist/core/store/grow.d.ts.map +1 -0
- package/dist/core/store/header.d.cts +64 -0
- package/dist/core/store/header.d.ts +64 -0
- package/dist/core/store/header.d.ts.map +1 -0
- package/dist/core/store/index.d.cts +17 -0
- package/dist/core/store/index.d.ts +17 -0
- package/dist/core/store/index.d.ts.map +1 -0
- 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 +74 -0
- package/dist/core/store/region_table.d.ts.map +1 -0
- package/dist/core/store/snapshot.d.cts +43 -0
- package/dist/core/store/snapshot.d.ts +43 -0
- package/dist/core/store/snapshot.d.ts.map +1 -0
- package/dist/core/store/state_hash.d.cts +38 -0
- package/dist/core/store/state_hash.d.ts +38 -0
- package/dist/core/store/state_hash.d.ts.map +1 -0
- package/dist/core/store/store_regions.d.cts +38 -0
- package/dist/core/store/store_regions.d.ts +38 -0
- package/dist/core/store/store_regions.d.ts.map +1 -0
- package/dist/core/store/vendored_abi/abi.d.cts +43 -0
- package/dist/core/store/vendored_abi/abi.d.ts +43 -0
- package/dist/core/store/vendored_abi/abi.d.ts.map +1 -0
- 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 +170 -0
- package/dist/extensions/editor/editor.d.ts.map +1 -0
- package/dist/extensions/editor/field_handle.d.cts +40 -0
- package/dist/extensions/editor/field_handle.d.ts +40 -0
- package/dist/extensions/editor/field_handle.d.ts.map +1 -0
- package/dist/extensions/editor/index.cjs +1 -0
- package/dist/extensions/editor/index.d.cts +21 -0
- package/dist/extensions/editor/index.d.ts +21 -0
- package/dist/extensions/editor/index.d.ts.map +1 -0
- package/dist/extensions/editor/index.js +237 -0
- package/dist/extensions/reactive/ecs_sync.d.cts +214 -0
- package/dist/extensions/reactive/ecs_sync.d.ts +214 -0
- package/dist/extensions/reactive/ecs_sync.d.ts.map +1 -0
- package/dist/extensions/reactive/index.cjs +1 -0
- package/dist/extensions/reactive/index.d.cts +23 -0
- package/dist/extensions/reactive/index.d.ts +23 -0
- package/dist/extensions/reactive/index.d.ts.map +1 -0
- package/dist/extensions/reactive/index.js +215 -0
- package/dist/extensions/solid/index.cjs +1 -0
- package/dist/extensions/solid/index.d.cts +6 -0
- package/dist/extensions/solid/index.d.ts +6 -0
- package/dist/extensions/solid/index.d.ts.map +1 -0
- package/dist/extensions/solid/index.js +36 -0
- package/dist/extensions/solid/kernel_solid.d.cts +45 -0
- package/dist/extensions/solid/kernel_solid.d.ts +45 -0
- package/dist/extensions/solid/kernel_solid.d.ts.map +1 -0
- package/dist/host_commands-BF8QMi3c.cjs +1 -0
- package/dist/host_commands-i4cAeyL5.js +2318 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +66 -0
- package/dist/index.d.ts +65 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7080 -1289
- 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/interop-CT-REx0W.cjs +1 -0
- package/dist/interop-CcY6ASQc.js +18 -0
- package/dist/kernel-DgyrLFjW.js +227 -0
- package/dist/kernel-yWV3XnAb.cjs +1 -0
- package/dist/primitives.cjs +1 -0
- package/dist/primitives.d.cts +18 -0
- package/dist/primitives.d.ts +18 -0
- package/dist/primitives.d.ts.map +1 -0
- package/dist/primitives.js +45 -0
- package/dist/reactive/array.d.cts +24 -0
- 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/reactive/interop.d.ts +19 -0
- package/dist/reactive/interop.d.ts.map +1 -0
- package/dist/reactive/kernel.d.cts +73 -0
- package/dist/reactive/kernel.d.ts +73 -0
- package/dist/reactive/kernel.d.ts.map +1 -0
- package/dist/reactive/map.d.cts +16 -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/reactive/struct.d.ts +10 -0
- 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 -0
- package/dist/shared.d.cts +22 -0
- package/dist/shared.d.ts +22 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +7 -0
- 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 +25 -9
- 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/binary_heap/binary_heap.d.ts +6 -2
- package/dist/type_primitives/binary_heap/binary_heap.d.ts.map +1 -1
- package/dist/type_primitives/bitset/bitset.d.cts +54 -0
- package/dist/type_primitives/bitset/bitset.d.ts +16 -4
- package/dist/type_primitives/bitset/bitset.d.ts.map +1 -1
- package/dist/type_primitives/brand.d.cts +23 -0
- package/dist/type_primitives/brand.d.ts +6 -1
- package/dist/type_primitives/brand.d.ts.map +1 -1
- package/dist/type_primitives/error.d.cts +16 -0
- package/dist/type_primitives/error.d.ts +8 -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 +12 -9
- package/dist/type_primitives/index.d.ts.map +1 -1
- package/dist/type_primitives/sparse_map/sparse_map.d.cts +30 -0
- package/dist/type_primitives/sparse_map/sparse_map.d.ts +7 -3
- package/dist/type_primitives/sparse_map/sparse_map.d.ts.map +1 -1
- package/dist/type_primitives/sparse_set/sparse_set.d.cts +28 -0
- package/dist/type_primitives/sparse_set/sparse_set.d.ts +4 -0
- package/dist/type_primitives/sparse_set/sparse_set.d.ts.map +1 -1
- package/dist/type_primitives/topological_sort/topological_sort.d.cts +29 -0
- package/dist/type_primitives/topological_sort/topological_sort.d.ts +7 -3
- package/dist/type_primitives/topological_sort/topological_sort.d.ts.map +1 -1
- package/dist/type_primitives/typed_arrays/typed_arrays.d.cts +127 -0
- package/dist/type_primitives/typed_arrays/typed_arrays.d.ts +53 -16
- package/dist/type_primitives/typed_arrays/typed_arrays.d.ts.map +1 -1
- 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/utils/error.d.ts +2 -20
- package/dist/utils/error.d.ts.map +1 -1
- 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 +115 -5
- package/dist/archetype.d.ts +0 -108
- package/dist/archetype.d.ts.map +0 -1
- package/dist/component.d.ts +0 -45
- package/dist/component.d.ts.map +0 -1
- package/dist/ecs.d.ts +0 -104
- package/dist/ecs.d.ts.map +0 -1
- package/dist/entity.d.ts +0 -11
- package/dist/entity.d.ts.map +0 -1
- package/dist/event.d.ts +0 -30
- package/dist/event.d.ts.map +0 -1
- package/dist/query.d.ts +0 -94
- package/dist/query.d.ts.map +0 -1
- package/dist/ref.d.ts +0 -23
- package/dist/ref.d.ts.map +0 -1
- package/dist/resource.d.ts +0 -23
- package/dist/resource.d.ts.map +0 -1
- package/dist/schedule.d.ts +0 -45
- package/dist/schedule.d.ts.map +0 -1
- package/dist/store.d.ts +0 -118
- package/dist/store.d.ts.map +0 -1
- package/dist/system.d.ts +0 -16
- package/dist/system.d.ts.map +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
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/***
|
|
2
|
+
* topologicalSort — Kahn's algorithm with a BinaryHeap ready queue.
|
|
3
|
+
*
|
|
4
|
+
* Accepts an arbitrary node set, a dependency edge map, and a tiebreaker
|
|
5
|
+
* comparator used to order nodes that are simultaneously ready (zero in-degree).
|
|
6
|
+
* This makes the output deterministic and priority-driven rather than
|
|
7
|
+
* insertion-order dependent.
|
|
8
|
+
*
|
|
9
|
+
* Throws a built-in TypeError when a cycle is detected, listing the names of
|
|
10
|
+
* the nodes that could not be scheduled.
|
|
11
|
+
*
|
|
12
|
+
***/
|
|
13
|
+
/**
|
|
14
|
+
* Topologically sorts `nodes` respecting the dependency edges, breaking ties
|
|
15
|
+
* with the supplied comparator.
|
|
16
|
+
*
|
|
17
|
+
* @param nodes - All items to sort.
|
|
18
|
+
* @param edges - Adjacency list: `edges.get(a)` = items that must come after `a`.
|
|
19
|
+
* @param tiebreaker - Comparator for the ready queue (min-heap semantics: lower = higher priority).
|
|
20
|
+
* @param nodeName - Optional label function for cycle error messages. Defaults to `String(node)`.
|
|
21
|
+
* @returns Sorted array in topological order.
|
|
22
|
+
* @throws {TypeError} If a cycle is detected among the nodes.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Topologically sorts `nodes` respecting dependency edges, breaking ties with the comparator.
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
export declare function topologicalSort<T>(nodes: readonly T[], edges: Map<T, T[]>, tiebreaker: (a: T, b: T) => number, nodeName?: (node: T) => string): T[];
|
|
29
|
+
//# sourceMappingURL=topological_sort.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/***
|
|
2
|
-
*
|
|
2
|
+
* topologicalSort — Kahn's algorithm with a BinaryHeap ready queue.
|
|
3
3
|
*
|
|
4
4
|
* Accepts an arbitrary node set, a dependency edge map, and a tiebreaker
|
|
5
5
|
* comparator used to order nodes that are simultaneously ready (zero in-degree).
|
|
@@ -17,9 +17,13 @@
|
|
|
17
17
|
* @param nodes - All items to sort.
|
|
18
18
|
* @param edges - Adjacency list: `edges.get(a)` = items that must come after `a`.
|
|
19
19
|
* @param tiebreaker - Comparator for the ready queue (min-heap semantics: lower = higher priority).
|
|
20
|
-
* @param
|
|
20
|
+
* @param nodeName - Optional label function for cycle error messages. Defaults to `String(node)`.
|
|
21
21
|
* @returns Sorted array in topological order.
|
|
22
22
|
* @throws {TypeError} If a cycle is detected among the nodes.
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Topologically sorts `nodes` respecting dependency edges, breaking ties with the comparator.
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
export declare function topologicalSort<T>(nodes: readonly T[], edges: Map<T, T[]>, tiebreaker: (a: T, b: T) => number, nodeName?: (node: T) => string): T[];
|
|
25
29
|
//# sourceMappingURL=topological_sort.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topological_sort.d.ts","sourceRoot":"","sources":["../../../src/type_primitives/topological_sort/topological_sort.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;KAWK;AAIL;;;;;;;;;;GAUG;AACH,wBAAgB,
|
|
1
|
+
{"version":3,"file":"topological_sort.d.ts","sourceRoot":"","sources":["../../../src/type_primitives/topological_sort/topological_sort.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;KAWK;AAIL;;;;;;;;;;GAUG;AACH;;;GAGG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAChC,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,KAAK,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAClB,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,MAAM,EAClC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAC5B,CAAC,EAAE,CA8DL"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/***
|
|
2
|
+
* GrowableTypedArray — TypedArray wrapper with amortised O(1) append.
|
|
3
|
+
*
|
|
4
|
+
* TypedArrays have fixed length — resizing requires allocating a new
|
|
5
|
+
* buffer and copying. GrowableTypedArray wraps one with a separate
|
|
6
|
+
* logical length and doubles the backing buffer on overflow.
|
|
7
|
+
*
|
|
8
|
+
* Named subclasses (GrowableFloat32Array etc.) are provided for each
|
|
9
|
+
* numeric type. TypedArrayFor maps TypeTag strings to their class so
|
|
10
|
+
* component columns can be allocated by tag.
|
|
11
|
+
*
|
|
12
|
+
***/
|
|
13
|
+
export declare const DEFAULT_INITIAL_CAPACITY = 16;
|
|
14
|
+
export declare const GROWTH_FACTOR = 2;
|
|
15
|
+
export type TypedArrayTag = "f32" | "f64" | "i8" | "i16" | "i32" | "u8" | "u16" | "u32";
|
|
16
|
+
export type AnyTypedArray = Float32Array | Float64Array | Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array;
|
|
17
|
+
/**
|
|
18
|
+
* Common surface of a row-addressable column buffer. `GrowableTypedArray<T>`
|
|
19
|
+
* implements it over a heap-allocated TypedArray; SAB-backed columns (see
|
|
20
|
+
* `packages/engine/src/core/sab/sab_backed_column.ts`) implement it over a
|
|
21
|
+
* `SharedArrayBuffer` view at a known offset. Archetype column storage
|
|
22
|
+
* targets this interface so a single code path serves both backings.
|
|
23
|
+
*/
|
|
24
|
+
export interface ColumnBacking<T extends AnyTypedArray> {
|
|
25
|
+
readonly length: number;
|
|
26
|
+
readonly buf: T;
|
|
27
|
+
push(value: number): void;
|
|
28
|
+
pop(): number;
|
|
29
|
+
swapRemove(i: number): number;
|
|
30
|
+
clear(): void;
|
|
31
|
+
view(): T;
|
|
32
|
+
ensureCapacity(capacity: number): void;
|
|
33
|
+
bulkAppend(src: T, srcOffset: number, count: number): void;
|
|
34
|
+
bulkAppendZeroes(count: number): void;
|
|
35
|
+
bulkAppendValue(value: number, count: number): void;
|
|
36
|
+
/** Set the logical length directly, declaring that `[0, len)` already holds
|
|
37
|
+
* valid data. The snapshot-mount path (`Archetype.restoreHostRows`, #789)
|
|
38
|
+
* uses this: a restored SAB carries the column bytes, but the column's logical
|
|
39
|
+
* length is host state that must be re-synced with `Archetype.length`. Throws
|
|
40
|
+
* if `len` exceeds capacity. NOT a hot-path method — push/pop track length. */
|
|
41
|
+
setLength(len: number): void;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* TypedArray wrapper with amortised O(1) append. Doubles the backing buffer on overflow.
|
|
45
|
+
*
|
|
46
|
+
*/
|
|
47
|
+
export declare class GrowableTypedArray<T extends AnyTypedArray> implements ColumnBacking<T> {
|
|
48
|
+
private readonly _ctor;
|
|
49
|
+
private _buf;
|
|
50
|
+
private _len;
|
|
51
|
+
constructor(_ctor: new (n: number) => T, initialCapacity?: number);
|
|
52
|
+
get length(): number;
|
|
53
|
+
push(value: number): void;
|
|
54
|
+
pop(): number;
|
|
55
|
+
get(i: number): number;
|
|
56
|
+
setAt(i: number, value: number): void;
|
|
57
|
+
/**
|
|
58
|
+
* Move the last element into slot i, decrement length.
|
|
59
|
+
* Returns the value that was removed from slot i.
|
|
60
|
+
*/
|
|
61
|
+
swapRemove(i: number): number;
|
|
62
|
+
clear(): void;
|
|
63
|
+
/** Set the logical length directly (snapshot-mount reconstruction, #789). The
|
|
64
|
+
* caller guarantees `[0, len)` already holds valid data. Grows the backing if
|
|
65
|
+
* needed so the length is always representable. */
|
|
66
|
+
setLength(len: number): void;
|
|
67
|
+
/**
|
|
68
|
+
* Raw backing buffer. Valid data: indices 0..length-1.
|
|
69
|
+
* This reference is stable until the next push() that triggers a grow —
|
|
70
|
+
* do not cache across entity additions.
|
|
71
|
+
*/
|
|
72
|
+
get buf(): T;
|
|
73
|
+
/**
|
|
74
|
+
* Zero-copy subarray view of valid data (0..length-1).
|
|
75
|
+
* Shares the backing buffer — invalidated if a subsequent push() grows.
|
|
76
|
+
*/
|
|
77
|
+
view(): T;
|
|
78
|
+
[Symbol.iterator](): Iterator<number>;
|
|
79
|
+
/** Ensure the backing buffer can hold at least `capacity` elements without growing. */
|
|
80
|
+
ensureCapacity(capacity: number): void;
|
|
81
|
+
/**
|
|
82
|
+
* Append `count` elements from `src` starting at `srcOffset`.
|
|
83
|
+
* Grows if needed. Equivalent to push() in a loop but uses TypedArray.set().
|
|
84
|
+
*/
|
|
85
|
+
bulkAppend(src: T, srcOffset: number, count: number): void;
|
|
86
|
+
/** Append `count` zeroes. Grows if needed. */
|
|
87
|
+
bulkAppendZeroes(count: number): void;
|
|
88
|
+
/** Append `count` copies of `value`. Grows if needed. Single-pass
|
|
89
|
+
* analogue of `bulkAppendZeroes` for a non-zero default. */
|
|
90
|
+
bulkAppendValue(value: number, count: number): void;
|
|
91
|
+
private _grow;
|
|
92
|
+
}
|
|
93
|
+
export declare class GrowableFloat32Array extends GrowableTypedArray<Float32Array> {
|
|
94
|
+
constructor(initialCapacity?: number);
|
|
95
|
+
}
|
|
96
|
+
export declare class GrowableFloat64Array extends GrowableTypedArray<Float64Array> {
|
|
97
|
+
constructor(initialCapacity?: number);
|
|
98
|
+
}
|
|
99
|
+
export declare class GrowableInt8Array extends GrowableTypedArray<Int8Array> {
|
|
100
|
+
constructor(initialCapacity?: number);
|
|
101
|
+
}
|
|
102
|
+
export declare class GrowableInt16Array extends GrowableTypedArray<Int16Array> {
|
|
103
|
+
constructor(initialCapacity?: number);
|
|
104
|
+
}
|
|
105
|
+
export declare class GrowableInt32Array extends GrowableTypedArray<Int32Array> {
|
|
106
|
+
constructor(initialCapacity?: number);
|
|
107
|
+
}
|
|
108
|
+
export declare class GrowableUint8Array extends GrowableTypedArray<Uint8Array> {
|
|
109
|
+
constructor(initialCapacity?: number);
|
|
110
|
+
}
|
|
111
|
+
export declare class GrowableUint16Array extends GrowableTypedArray<Uint16Array> {
|
|
112
|
+
constructor(initialCapacity?: number);
|
|
113
|
+
}
|
|
114
|
+
export declare class GrowableUint32Array extends GrowableTypedArray<Uint32Array> {
|
|
115
|
+
constructor(initialCapacity?: number);
|
|
116
|
+
}
|
|
117
|
+
export declare const TypedArrayFor: {
|
|
118
|
+
readonly f32: typeof GrowableFloat32Array;
|
|
119
|
+
readonly f64: typeof GrowableFloat64Array;
|
|
120
|
+
readonly i8: typeof GrowableInt8Array;
|
|
121
|
+
readonly i16: typeof GrowableInt16Array;
|
|
122
|
+
readonly i32: typeof GrowableInt32Array;
|
|
123
|
+
readonly u8: typeof GrowableUint8Array;
|
|
124
|
+
readonly u16: typeof GrowableUint16Array;
|
|
125
|
+
readonly u32: typeof GrowableUint32Array;
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=typed_arrays.d.ts.map
|
|
@@ -14,22 +14,56 @@ export declare const DEFAULT_INITIAL_CAPACITY = 16;
|
|
|
14
14
|
export declare const GROWTH_FACTOR = 2;
|
|
15
15
|
export type TypedArrayTag = "f32" | "f64" | "i8" | "i16" | "i32" | "u8" | "u16" | "u32";
|
|
16
16
|
export type AnyTypedArray = Float32Array | Float64Array | Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array;
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Common surface of a row-addressable column buffer. `GrowableTypedArray<T>`
|
|
19
|
+
* implements it over a heap-allocated TypedArray; SAB-backed columns (see
|
|
20
|
+
* `packages/engine/src/core/sab/sab_backed_column.ts`) implement it over a
|
|
21
|
+
* `SharedArrayBuffer` view at a known offset. Archetype column storage
|
|
22
|
+
* targets this interface so a single code path serves both backings.
|
|
23
|
+
*/
|
|
24
|
+
export interface ColumnBacking<T extends AnyTypedArray> {
|
|
25
|
+
readonly length: number;
|
|
26
|
+
readonly buf: T;
|
|
27
|
+
push(value: number): void;
|
|
28
|
+
pop(): number;
|
|
29
|
+
swapRemove(i: number): number;
|
|
30
|
+
clear(): void;
|
|
31
|
+
view(): T;
|
|
32
|
+
ensureCapacity(capacity: number): void;
|
|
33
|
+
bulkAppend(src: T, srcOffset: number, count: number): void;
|
|
34
|
+
bulkAppendZeroes(count: number): void;
|
|
35
|
+
bulkAppendValue(value: number, count: number): void;
|
|
36
|
+
/** Set the logical length directly, declaring that `[0, len)` already holds
|
|
37
|
+
* valid data. The snapshot-mount path (`Archetype.restoreHostRows`, #789)
|
|
38
|
+
* uses this: a restored SAB carries the column bytes, but the column's logical
|
|
39
|
+
* length is host state that must be re-synced with `Archetype.length`. Throws
|
|
40
|
+
* if `len` exceeds capacity. NOT a hot-path method — push/pop track length. */
|
|
41
|
+
setLength(len: number): void;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* TypedArray wrapper with amortised O(1) append. Doubles the backing buffer on overflow.
|
|
45
|
+
*
|
|
46
|
+
*/
|
|
47
|
+
export declare class GrowableTypedArray<T extends AnyTypedArray> implements ColumnBacking<T> {
|
|
18
48
|
private readonly _ctor;
|
|
19
49
|
private _buf;
|
|
20
50
|
private _len;
|
|
21
|
-
constructor(_ctor: new (n: number) => T,
|
|
51
|
+
constructor(_ctor: new (n: number) => T, initialCapacity?: number);
|
|
22
52
|
get length(): number;
|
|
23
53
|
push(value: number): void;
|
|
24
54
|
pop(): number;
|
|
25
55
|
get(i: number): number;
|
|
26
|
-
|
|
56
|
+
setAt(i: number, value: number): void;
|
|
27
57
|
/**
|
|
28
58
|
* Move the last element into slot i, decrement length.
|
|
29
59
|
* Returns the value that was removed from slot i.
|
|
30
60
|
*/
|
|
31
|
-
|
|
61
|
+
swapRemove(i: number): number;
|
|
32
62
|
clear(): void;
|
|
63
|
+
/** Set the logical length directly (snapshot-mount reconstruction, #789). The
|
|
64
|
+
* caller guarantees `[0, len)` already holds valid data. Grows the backing if
|
|
65
|
+
* needed so the length is always representable. */
|
|
66
|
+
setLength(len: number): void;
|
|
33
67
|
/**
|
|
34
68
|
* Raw backing buffer. Valid data: indices 0..length-1.
|
|
35
69
|
* This reference is stable until the next push() that triggers a grow —
|
|
@@ -43,39 +77,42 @@ export declare class GrowableTypedArray<T extends AnyTypedArray> {
|
|
|
43
77
|
view(): T;
|
|
44
78
|
[Symbol.iterator](): Iterator<number>;
|
|
45
79
|
/** Ensure the backing buffer can hold at least `capacity` elements without growing. */
|
|
46
|
-
|
|
80
|
+
ensureCapacity(capacity: number): void;
|
|
47
81
|
/**
|
|
48
|
-
* Append `count` elements from `src` starting at `
|
|
82
|
+
* Append `count` elements from `src` starting at `srcOffset`.
|
|
49
83
|
* Grows if needed. Equivalent to push() in a loop but uses TypedArray.set().
|
|
50
84
|
*/
|
|
51
|
-
|
|
85
|
+
bulkAppend(src: T, srcOffset: number, count: number): void;
|
|
52
86
|
/** Append `count` zeroes. Grows if needed. */
|
|
53
|
-
|
|
87
|
+
bulkAppendZeroes(count: number): void;
|
|
88
|
+
/** Append `count` copies of `value`. Grows if needed. Single-pass
|
|
89
|
+
* analogue of `bulkAppendZeroes` for a non-zero default. */
|
|
90
|
+
bulkAppendValue(value: number, count: number): void;
|
|
54
91
|
private _grow;
|
|
55
92
|
}
|
|
56
93
|
export declare class GrowableFloat32Array extends GrowableTypedArray<Float32Array> {
|
|
57
|
-
constructor(
|
|
94
|
+
constructor(initialCapacity?: number);
|
|
58
95
|
}
|
|
59
96
|
export declare class GrowableFloat64Array extends GrowableTypedArray<Float64Array> {
|
|
60
|
-
constructor(
|
|
97
|
+
constructor(initialCapacity?: number);
|
|
61
98
|
}
|
|
62
99
|
export declare class GrowableInt8Array extends GrowableTypedArray<Int8Array> {
|
|
63
|
-
constructor(
|
|
100
|
+
constructor(initialCapacity?: number);
|
|
64
101
|
}
|
|
65
102
|
export declare class GrowableInt16Array extends GrowableTypedArray<Int16Array> {
|
|
66
|
-
constructor(
|
|
103
|
+
constructor(initialCapacity?: number);
|
|
67
104
|
}
|
|
68
105
|
export declare class GrowableInt32Array extends GrowableTypedArray<Int32Array> {
|
|
69
|
-
constructor(
|
|
106
|
+
constructor(initialCapacity?: number);
|
|
70
107
|
}
|
|
71
108
|
export declare class GrowableUint8Array extends GrowableTypedArray<Uint8Array> {
|
|
72
|
-
constructor(
|
|
109
|
+
constructor(initialCapacity?: number);
|
|
73
110
|
}
|
|
74
111
|
export declare class GrowableUint16Array extends GrowableTypedArray<Uint16Array> {
|
|
75
|
-
constructor(
|
|
112
|
+
constructor(initialCapacity?: number);
|
|
76
113
|
}
|
|
77
114
|
export declare class GrowableUint32Array extends GrowableTypedArray<Uint32Array> {
|
|
78
|
-
constructor(
|
|
115
|
+
constructor(initialCapacity?: number);
|
|
79
116
|
}
|
|
80
117
|
export declare const TypedArrayFor: {
|
|
81
118
|
readonly f32: typeof GrowableFloat32Array;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typed_arrays.d.ts","sourceRoot":"","sources":["../../../src/type_primitives/typed_arrays/typed_arrays.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;KAWK;AAEL,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,CAAC;AAExF,MAAM,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"typed_arrays.d.ts","sourceRoot":"","sources":["../../../src/type_primitives/typed_arrays/typed_arrays.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
const w = 5, d = 31;
|
|
2
|
+
class c {
|
|
3
|
+
_words;
|
|
4
|
+
constructor(t) {
|
|
5
|
+
this._words = t ?? new Array(4).fill(0);
|
|
6
|
+
}
|
|
7
|
+
has(t) {
|
|
8
|
+
const s = t >>> 5;
|
|
9
|
+
return s >= this._words.length ? !1 : (this._words[s] & 1 << (t & 31)) !== 0;
|
|
10
|
+
}
|
|
11
|
+
set(t) {
|
|
12
|
+
const s = t >>> 5;
|
|
13
|
+
s >= this._words.length && this.grow(s + 1), this._words[s] |= 1 << (t & 31);
|
|
14
|
+
}
|
|
15
|
+
clear(t) {
|
|
16
|
+
const s = t >>> 5;
|
|
17
|
+
s >= this._words.length || (this._words[s] &= ~(1 << (t & 31)));
|
|
18
|
+
}
|
|
19
|
+
/** True if no bit is set. */
|
|
20
|
+
isEmpty() {
|
|
21
|
+
const t = this._words;
|
|
22
|
+
for (let s = 0; s < t.length; s++)
|
|
23
|
+
if (t[s] !== 0) return !1;
|
|
24
|
+
return !0;
|
|
25
|
+
}
|
|
26
|
+
/** True if any bit is set in both this and other (non-empty intersection). */
|
|
27
|
+
overlaps(t) {
|
|
28
|
+
const s = this._words, e = t._words, r = s.length < e.length ? s.length : e.length;
|
|
29
|
+
for (let n = 0; n < r; n++)
|
|
30
|
+
if ((s[n] & e[n]) !== 0) return !0;
|
|
31
|
+
return !1;
|
|
32
|
+
}
|
|
33
|
+
/** True if this is a superset of other (all bits in other are set in this). */
|
|
34
|
+
contains(t) {
|
|
35
|
+
const s = t._words, e = this._words, r = e.length;
|
|
36
|
+
for (let n = 0; n < s.length; n++) {
|
|
37
|
+
const o = s[n];
|
|
38
|
+
if (o !== 0 && (n >= r || (e[n] & o) !== o))
|
|
39
|
+
return !1;
|
|
40
|
+
}
|
|
41
|
+
return !0;
|
|
42
|
+
}
|
|
43
|
+
equals(t) {
|
|
44
|
+
const s = this._words, e = t._words, r = s.length > e.length ? s.length : e.length;
|
|
45
|
+
for (let n = 0; n < r; n++) {
|
|
46
|
+
const o = n < s.length ? s[n] : 0, h = n < e.length ? e[n] : 0;
|
|
47
|
+
if (o !== h) return !1;
|
|
48
|
+
}
|
|
49
|
+
return !0;
|
|
50
|
+
}
|
|
51
|
+
copy() {
|
|
52
|
+
return new c(this._words.slice());
|
|
53
|
+
}
|
|
54
|
+
/** Mutate `target` so it has the same set bits as `this`. Reuses
|
|
55
|
+
* `target._words` storage when capacity allows (no allocation) and
|
|
56
|
+
* grows it only when `this` is wider. Designed for hot-path scratch
|
|
57
|
+
* BitSets where callers want `.copy()` semantics without the
|
|
58
|
+
* per-call allocation. Returns `target` for chaining. */
|
|
59
|
+
copyInto(t) {
|
|
60
|
+
const s = this._words, e = t._words, r = s.length, n = e.length;
|
|
61
|
+
if (n >= r) {
|
|
62
|
+
for (let o = 0; o < r; o++) e[o] = s[o];
|
|
63
|
+
for (let o = r; o < n; o++) e[o] = 0;
|
|
64
|
+
} else {
|
|
65
|
+
let o = n > 0 ? n : 1;
|
|
66
|
+
for (; o < r; ) o *= 2;
|
|
67
|
+
const h = new Array(o).fill(0);
|
|
68
|
+
for (let a = 0; a < r; a++) h[a] = s[a];
|
|
69
|
+
t._words = h;
|
|
70
|
+
}
|
|
71
|
+
return t;
|
|
72
|
+
}
|
|
73
|
+
copyWithSet(t) {
|
|
74
|
+
const s = t >>> 5, e = s + 1, r = this._words.length > e ? this._words.length : e, n = new Array(r).fill(0);
|
|
75
|
+
for (let o = 0; o < this._words.length; o++) n[o] = this._words[o];
|
|
76
|
+
return n[s] |= 1 << (t & 31), new c(n);
|
|
77
|
+
}
|
|
78
|
+
copyWithClear(t) {
|
|
79
|
+
const s = this._words.slice(), e = t >>> 5;
|
|
80
|
+
return e < s.length && (s[e] &= ~(1 << (t & 31))), new c(s);
|
|
81
|
+
}
|
|
82
|
+
/** FNV-1a hash. Skips trailing zero words so differently-sized arrays with the same bits hash equally. */
|
|
83
|
+
hash() {
|
|
84
|
+
let t = 2166136261;
|
|
85
|
+
const s = this._words;
|
|
86
|
+
let e = s.length - 1;
|
|
87
|
+
for (; e >= 0 && s[e] === 0; ) e--;
|
|
88
|
+
for (let r = 0; r <= e; r++)
|
|
89
|
+
t ^= s[r], t = Math.imul(t, 16777619);
|
|
90
|
+
return t;
|
|
91
|
+
}
|
|
92
|
+
/** Iterate all set bits via lowest-set-bit extraction. */
|
|
93
|
+
forEach(t) {
|
|
94
|
+
const s = this._words;
|
|
95
|
+
for (let e = 0; e < s.length; e++) {
|
|
96
|
+
let r = s[e];
|
|
97
|
+
if (r === 0) continue;
|
|
98
|
+
const n = e << 5;
|
|
99
|
+
for (; r !== 0; ) {
|
|
100
|
+
const o = r & -r >>> 0, h = 31 - Math.clz32(o);
|
|
101
|
+
t(n + h), r ^= o;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
grow(t) {
|
|
106
|
+
let s = this._words.length;
|
|
107
|
+
for (; s < t; ) s *= 2;
|
|
108
|
+
const e = new Array(s).fill(0);
|
|
109
|
+
for (let r = 0; r < this._words.length; r++) e[r] = this._words[r];
|
|
110
|
+
this._words = e;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const i = 16, u = 2;
|
|
114
|
+
class _ {
|
|
115
|
+
constructor(t, s = 16) {
|
|
116
|
+
this._ctor = t, this._buf = new t(s);
|
|
117
|
+
}
|
|
118
|
+
_buf;
|
|
119
|
+
_len = 0;
|
|
120
|
+
get length() {
|
|
121
|
+
return this._len;
|
|
122
|
+
}
|
|
123
|
+
push(t) {
|
|
124
|
+
this._len >= this._buf.length && this._grow(), this._buf[this._len++] = t;
|
|
125
|
+
}
|
|
126
|
+
pop() {
|
|
127
|
+
return this._buf[--this._len];
|
|
128
|
+
}
|
|
129
|
+
get(t) {
|
|
130
|
+
return this._buf[t];
|
|
131
|
+
}
|
|
132
|
+
setAt(t, s) {
|
|
133
|
+
this._buf[t] = s;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Move the last element into slot i, decrement length.
|
|
137
|
+
* Returns the value that was removed from slot i.
|
|
138
|
+
*/
|
|
139
|
+
swapRemove(t) {
|
|
140
|
+
const s = this._buf[t];
|
|
141
|
+
return this._buf[t] = this._buf[--this._len], s;
|
|
142
|
+
}
|
|
143
|
+
clear() {
|
|
144
|
+
this._len = 0;
|
|
145
|
+
}
|
|
146
|
+
/** Set the logical length directly (snapshot-mount reconstruction, #789). The
|
|
147
|
+
* caller guarantees `[0, len)` already holds valid data. Grows the backing if
|
|
148
|
+
* needed so the length is always representable. */
|
|
149
|
+
setLength(t) {
|
|
150
|
+
this.ensureCapacity(t), this._len = t;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Raw backing buffer. Valid data: indices 0..length-1.
|
|
154
|
+
* This reference is stable until the next push() that triggers a grow —
|
|
155
|
+
* do not cache across entity additions.
|
|
156
|
+
*/
|
|
157
|
+
get buf() {
|
|
158
|
+
return this._buf;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Zero-copy subarray view of valid data (0..length-1).
|
|
162
|
+
* Shares the backing buffer — invalidated if a subsequent push() grows.
|
|
163
|
+
*/
|
|
164
|
+
view() {
|
|
165
|
+
return this._buf.subarray(0, this._len);
|
|
166
|
+
}
|
|
167
|
+
[Symbol.iterator]() {
|
|
168
|
+
let t = 0;
|
|
169
|
+
const s = this._buf, e = this._len;
|
|
170
|
+
return {
|
|
171
|
+
next() {
|
|
172
|
+
return t < e ? { value: s[t++], done: !1 } : { value: 0, done: !0 };
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
/** Ensure the backing buffer can hold at least `capacity` elements without growing. */
|
|
177
|
+
ensureCapacity(t) {
|
|
178
|
+
if (t <= this._buf.length) return;
|
|
179
|
+
let s = this._buf.length || 1;
|
|
180
|
+
for (; s < t; ) s *= u;
|
|
181
|
+
const e = new this._ctor(s);
|
|
182
|
+
e.set(this._buf.subarray(0, this._len)), this._buf = e;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Append `count` elements from `src` starting at `srcOffset`.
|
|
186
|
+
* Grows if needed. Equivalent to push() in a loop but uses TypedArray.set().
|
|
187
|
+
*/
|
|
188
|
+
bulkAppend(t, s, e) {
|
|
189
|
+
this.ensureCapacity(this._len + e), this._buf.set(t.subarray(s, s + e), this._len), this._len += e;
|
|
190
|
+
}
|
|
191
|
+
/** Append `count` zeroes. Grows if needed. */
|
|
192
|
+
bulkAppendZeroes(t) {
|
|
193
|
+
this.ensureCapacity(this._len + t), this._buf.fill(0, this._len, this._len + t), this._len += t;
|
|
194
|
+
}
|
|
195
|
+
/** Append `count` copies of `value`. Grows if needed. Single-pass
|
|
196
|
+
* analogue of `bulkAppendZeroes` for a non-zero default. */
|
|
197
|
+
bulkAppendValue(t, s) {
|
|
198
|
+
this.ensureCapacity(this._len + s), this._buf.fill(t, this._len, this._len + s), this._len += s;
|
|
199
|
+
}
|
|
200
|
+
_grow() {
|
|
201
|
+
const t = new this._ctor(this._buf.length * u);
|
|
202
|
+
t.set(this._buf), this._buf = t;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
class f extends _ {
|
|
206
|
+
constructor(t = i) {
|
|
207
|
+
super(Float32Array, t);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
class I extends _ {
|
|
211
|
+
constructor(t = i) {
|
|
212
|
+
super(Float64Array, t);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
class b extends _ {
|
|
216
|
+
constructor(t = i) {
|
|
217
|
+
super(Int8Array, t);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
class A extends _ {
|
|
221
|
+
constructor(t = i) {
|
|
222
|
+
super(Int16Array, t);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
class g extends _ {
|
|
226
|
+
constructor(t = i) {
|
|
227
|
+
super(Int32Array, t);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
class y extends _ {
|
|
231
|
+
constructor(t = i) {
|
|
232
|
+
super(Uint8Array, t);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
class R extends _ {
|
|
236
|
+
constructor(t = i) {
|
|
237
|
+
super(Uint16Array, t);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
class S extends _ {
|
|
241
|
+
constructor(t = i) {
|
|
242
|
+
super(Uint32Array, t);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
export {
|
|
246
|
+
c as B,
|
|
247
|
+
_ as G,
|
|
248
|
+
f as a,
|
|
249
|
+
I as b,
|
|
250
|
+
b as c,
|
|
251
|
+
A as d,
|
|
252
|
+
g as e,
|
|
253
|
+
y as f,
|
|
254
|
+
R as g,
|
|
255
|
+
S as h,
|
|
256
|
+
d as i,
|
|
257
|
+
w as j
|
|
258
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";class a{_words;constructor(t){this._words=t??new Array(4).fill(0)}has(t){const r=t>>>5;return r>=this._words.length?!1:(this._words[r]&1<<(t&31))!==0}set(t){const r=t>>>5;r>=this._words.length&&this.grow(r+1),this._words[r]|=1<<(t&31)}clear(t){const r=t>>>5;r>=this._words.length||(this._words[r]&=~(1<<(t&31)))}isEmpty(){const t=this._words;for(let r=0;r<t.length;r++)if(t[r]!==0)return!1;return!0}overlaps(t){const r=this._words,s=t._words,e=r.length<s.length?r.length:s.length;for(let n=0;n<e;n++)if((r[n]&s[n])!==0)return!0;return!1}contains(t){const r=t._words,s=this._words,e=s.length;for(let n=0;n<r.length;n++){const o=r[n];if(o!==0&&(n>=e||(s[n]&o)!==o))return!1}return!0}equals(t){const r=this._words,s=t._words,e=r.length>s.length?r.length:s.length;for(let n=0;n<e;n++){const o=n<r.length?r[n]:0,h=n<s.length?s[n]:0;if(o!==h)return!1}return!0}copy(){return new a(this._words.slice())}copyInto(t){const r=this._words,s=t._words,e=r.length,n=s.length;if(n>=e){for(let o=0;o<e;o++)s[o]=r[o];for(let o=e;o<n;o++)s[o]=0}else{let o=n>0?n:1;for(;o<e;)o*=2;const h=new Array(o).fill(0);for(let c=0;c<e;c++)h[c]=r[c];t._words=h}return t}copyWithSet(t){const r=t>>>5,s=r+1,e=this._words.length>s?this._words.length:s,n=new Array(e).fill(0);for(let o=0;o<this._words.length;o++)n[o]=this._words[o];return n[r]|=1<<(t&31),new a(n)}copyWithClear(t){const r=this._words.slice(),s=t>>>5;return s<r.length&&(r[s]&=~(1<<(t&31))),new a(r)}hash(){let t=2166136261;const r=this._words;let s=r.length-1;for(;s>=0&&r[s]===0;)s--;for(let e=0;e<=s;e++)t^=r[e],t=Math.imul(t,16777619);return t}forEach(t){const r=this._words;for(let s=0;s<r.length;s++){let e=r[s];if(e===0)continue;const n=s<<5;for(;e!==0;){const o=e&-e>>>0,h=31-Math.clz32(o);t(n+h),e^=o}}}grow(t){let r=this._words.length;for(;r<t;)r*=2;const s=new Array(r).fill(0);for(let e=0;e<this._words.length;e++)s[e]=this._words[e];this._words=s}}const i=16,u=2;class l{constructor(t,r=16){this._ctor=t,this._buf=new t(r)}_buf;_len=0;get length(){return this._len}push(t){this._len>=this._buf.length&&this._grow(),this._buf[this._len++]=t}pop(){return this._buf[--this._len]}get(t){return this._buf[t]}setAt(t,r){this._buf[t]=r}swapRemove(t){const r=this._buf[t];return this._buf[t]=this._buf[--this._len],r}clear(){this._len=0}setLength(t){this.ensureCapacity(t),this._len=t}get buf(){return this._buf}view(){return this._buf.subarray(0,this._len)}[Symbol.iterator](){let t=0;const r=this._buf,s=this._len;return{next(){return t<s?{value:r[t++],done:!1}:{value:0,done:!0}}}}ensureCapacity(t){if(t<=this._buf.length)return;let r=this._buf.length||1;for(;r<t;)r*=u;const s=new this._ctor(r);s.set(this._buf.subarray(0,this._len)),this._buf=s}bulkAppend(t,r,s){this.ensureCapacity(this._len+s),this._buf.set(t.subarray(r,r+s),this._len),this._len+=s}bulkAppendZeroes(t){this.ensureCapacity(this._len+t),this._buf.fill(0,this._len,this._len+t),this._len+=t}bulkAppendValue(t,r){this.ensureCapacity(this._len+r),this._buf.fill(t,this._len,this._len+r),this._len+=r}_grow(){const t=new this._ctor(this._buf.length*u);t.set(this._buf),this._buf=t}}class w extends l{constructor(t=i){super(Float32Array,t)}}class d extends l{constructor(t=i){super(Float64Array,t)}}class f extends l{constructor(t=i){super(Int8Array,t)}}class I extends l{constructor(t=i){super(Int16Array,t)}}class A extends l{constructor(t=i){super(Int32Array,t)}}class b extends l{constructor(t=i){super(Uint8Array,t)}}class y extends l{constructor(t=i){super(Uint16Array,t)}}class R extends l{constructor(t=i){super(Uint32Array,t)}}exports.BITS_PER_WORD_MASK=31;exports.BITS_PER_WORD_SHIFT=5;exports.BitSet=a;exports.GrowableFloat32Array=w;exports.GrowableFloat64Array=d;exports.GrowableInt16Array=I;exports.GrowableInt32Array=A;exports.GrowableInt8Array=f;exports.GrowableTypedArray=l;exports.GrowableUint16Array=y;exports.GrowableUint32Array=R;exports.GrowableUint8Array=b;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare abstract class AppError extends Error {
|
|
2
|
+
readonly isOperational: boolean;
|
|
3
|
+
readonly context?: Record<string, unknown> | undefined;
|
|
4
|
+
constructor(message: string, isOperational: boolean, context?: Record<string, unknown> | undefined);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=error.d.ts.map
|
package/dist/utils/error.d.ts
CHANGED
|
@@ -1,24 +1,6 @@
|
|
|
1
1
|
export declare abstract class AppError extends Error {
|
|
2
|
-
readonly
|
|
2
|
+
readonly isOperational: boolean;
|
|
3
3
|
readonly context?: Record<string, unknown> | undefined;
|
|
4
|
-
constructor(message: string,
|
|
4
|
+
constructor(message: string, isOperational: boolean, context?: Record<string, unknown> | undefined);
|
|
5
5
|
}
|
|
6
|
-
export declare enum ECS_ERROR {
|
|
7
|
-
EID_MAX_INDEX_OVERFLOW = "EID_MAX_INDEX_OVERFLOW",
|
|
8
|
-
EID_MAX_GEN_OVERFLOW = "EID_MAX_GEN_OVERFLOW",
|
|
9
|
-
COMPONENT_NOT_REGISTERED = "COMPONENT_NOT_REGISTERED",
|
|
10
|
-
ENTITY_NOT_ALIVE = "ENTITY_NOT_ALIVE",
|
|
11
|
-
CIRCULAR_SYSTEM_DEPENDENCY = "CIRCULAR_SYSTEM_DEPENDENCY",
|
|
12
|
-
DUPLICATE_SYSTEM = "DUPLICATE_SYSTEM",
|
|
13
|
-
ARCHETYPE_NOT_FOUND = "ARCHETYPE_NOT_FOUND",
|
|
14
|
-
RESOURCE_NOT_REGISTERED = "RESOURCE_NOT_REGISTERED",
|
|
15
|
-
RESOURCE_ALREADY_REGISTERED = "RESOURCE_ALREADY_REGISTERED",
|
|
16
|
-
EVENT_ALREADY_REGISTERED = "EVENT_ALREADY_REGISTERED",
|
|
17
|
-
EVENT_NOT_REGISTERED = "EVENT_NOT_REGISTERED"
|
|
18
|
-
}
|
|
19
|
-
export declare class ECSError extends AppError {
|
|
20
|
-
readonly category: ECS_ERROR;
|
|
21
|
-
constructor(category: ECS_ERROR, message?: string, context?: Record<string, unknown>);
|
|
22
|
-
}
|
|
23
|
-
export declare function is_ecs_error(error: unknown): error is ECSError;
|
|
24
6
|
//# sourceMappingURL=error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/utils/error.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/utils/error.ts"],"names":[],"mappings":"AAGA,8BAAsB,QAAS,SAAQ,KAAK;aAGxB,aAAa,EAAE,OAAO;aACtB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;gBAFjD,OAAO,EAAE,MAAM,EACC,aAAa,EAAE,OAAO,EACtB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAA;CAMpD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The package version, readable at runtime (POLISH_AUDIT M21).
|
|
3
|
+
*
|
|
4
|
+
* A literal, not a build-time injection, so raw-source (JSR) consumers get the
|
|
5
|
+
* same value as the npm bundle. Kept in lock-step with `package.json` /
|
|
6
|
+
* `jsr.json` by `src/__tests__/version_sync.test.ts` — bump all three
|
|
7
|
+
* together.
|
|
8
|
+
*/
|
|
9
|
+
export declare const VERSION = "0.5.0";
|
|
10
|
+
//# sourceMappingURL=version.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The package version, readable at runtime (POLISH_AUDIT M21).
|
|
3
|
+
*
|
|
4
|
+
* A literal, not a build-time injection, so raw-source (JSR) consumers get the
|
|
5
|
+
* same value as the npm bundle. Kept in lock-step with `package.json` /
|
|
6
|
+
* `jsr.json` by `src/__tests__/version_sync.test.ts` — bump all three
|
|
7
|
+
* together.
|
|
8
|
+
*/
|
|
9
|
+
export declare const VERSION = "0.5.0";
|
|
10
|
+
//# sourceMappingURL=version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,UAAU,CAAC"}
|