@oasys/oecs 0.5.3 → 0.6.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 +1399 -276
- package/README.md +327 -169
- package/dist/core/ecs/access_check.d.cts +31 -31
- package/dist/core/ecs/access_check.d.ts +31 -31
- package/dist/core/ecs/access_check.d.ts.map +1 -1
- package/dist/core/ecs/archetype.d.cts +273 -205
- package/dist/core/ecs/archetype.d.ts +273 -205
- package/dist/core/ecs/archetype.d.ts.map +1 -1
- package/dist/core/ecs/archetype_closure.d.cts +23 -0
- package/dist/core/ecs/archetype_closure.d.ts +23 -0
- package/dist/core/ecs/archetype_closure.d.ts.map +1 -0
- package/dist/core/ecs/archetype_graph.d.cts +34 -34
- package/dist/core/ecs/archetype_graph.d.ts +34 -34
- package/dist/core/ecs/archetype_graph.d.ts.map +1 -1
- package/dist/core/ecs/archetype_types.d.cts +55 -0
- package/dist/core/ecs/archetype_types.d.ts +55 -0
- package/dist/core/ecs/archetype_types.d.ts.map +1 -0
- package/dist/core/ecs/change_feed.d.cts +53 -0
- package/dist/core/ecs/change_feed.d.ts +53 -0
- package/dist/core/ecs/change_feed.d.ts.map +1 -0
- package/dist/core/ecs/changed_query.d.cts +36 -0
- package/dist/core/ecs/changed_query.d.ts +36 -0
- package/dist/core/ecs/changed_query.d.ts.map +1 -0
- package/dist/core/ecs/chunk_columns.d.cts +49 -0
- package/dist/core/ecs/chunk_columns.d.ts +49 -0
- package/dist/core/ecs/chunk_columns.d.ts.map +1 -0
- package/dist/core/ecs/command_log.d.cts +30 -30
- package/dist/core/ecs/command_log.d.ts +30 -30
- package/dist/core/ecs/command_log.d.ts.map +1 -1
- package/dist/core/ecs/component.d.cts +45 -44
- package/dist/core/ecs/component.d.ts +45 -44
- package/dist/core/ecs/component.d.ts.map +1 -1
- package/dist/core/ecs/component_registry.d.cts +53 -0
- package/dist/core/ecs/component_registry.d.ts +53 -0
- package/dist/core/ecs/component_registry.d.ts.map +1 -0
- package/dist/core/ecs/compute_backend.d.cts +18 -7
- package/dist/core/ecs/compute_backend.d.ts +18 -7
- package/dist/core/ecs/compute_backend.d.ts.map +1 -1
- package/dist/core/ecs/deferred_commands.d.cts +15 -14
- package/dist/core/ecs/deferred_commands.d.ts +15 -14
- package/dist/core/ecs/deferred_commands.d.ts.map +1 -1
- package/dist/core/ecs/dispatch_trace.d.cts +32 -31
- package/dist/core/ecs/dispatch_trace.d.ts +32 -31
- package/dist/core/ecs/dispatch_trace.d.ts.map +1 -1
- package/dist/core/ecs/ecs.d.cts +337 -276
- package/dist/core/ecs/ecs.d.ts +337 -276
- package/dist/core/ecs/ecs.d.ts.map +1 -1
- package/dist/core/ecs/ecs_memory.d.cts +134 -136
- package/dist/core/ecs/ecs_memory.d.ts +134 -136
- package/dist/core/ecs/ecs_memory.d.ts.map +1 -1
- package/dist/core/ecs/ecs_options.d.cts +89 -0
- package/dist/core/ecs/ecs_options.d.ts +89 -0
- package/dist/core/ecs/ecs_options.d.ts.map +1 -0
- package/dist/core/ecs/entity.d.cts +4 -4
- package/dist/core/ecs/entity.d.ts +4 -4
- package/dist/core/ecs/entity_allocator.d.cts +24 -22
- package/dist/core/ecs/entity_allocator.d.ts +24 -22
- package/dist/core/ecs/entity_allocator.d.ts.map +1 -1
- package/dist/core/ecs/event.d.cts +37 -23
- package/dist/core/ecs/event.d.ts +37 -23
- package/dist/core/ecs/event.d.ts.map +1 -1
- package/dist/core/ecs/facades.d.cts +12 -126
- package/dist/core/ecs/facades.d.ts +12 -126
- package/dist/core/ecs/facades.d.ts.map +1 -1
- package/dist/core/ecs/frame_stepper.d.cts +12 -12
- package/dist/core/ecs/frame_stepper.d.ts +12 -12
- package/dist/core/ecs/frame_stepper.d.ts.map +1 -1
- package/dist/core/ecs/frame_trace.d.cts +34 -34
- package/dist/core/ecs/frame_trace.d.ts +34 -34
- package/dist/core/ecs/frame_trace.d.ts.map +1 -1
- package/dist/core/ecs/host_commands.d.cts +107 -89
- package/dist/core/ecs/host_commands.d.ts +107 -89
- package/dist/core/ecs/host_commands.d.ts.map +1 -1
- package/dist/core/ecs/index.d.cts +22 -12
- package/dist/core/ecs/index.d.ts +22 -12
- package/dist/core/ecs/index.d.ts.map +1 -1
- package/dist/core/ecs/observer.d.cts +41 -122
- package/dist/core/ecs/observer.d.ts +41 -122
- package/dist/core/ecs/observer.d.ts.map +1 -1
- package/dist/core/ecs/phase.d.cts +79 -0
- package/dist/core/ecs/phase.d.ts +79 -0
- package/dist/core/ecs/phase.d.ts.map +1 -0
- package/dist/core/ecs/plugin.d.cts +125 -0
- package/dist/core/ecs/plugin.d.ts +125 -0
- package/dist/core/ecs/plugin.d.ts.map +1 -0
- package/dist/core/ecs/plugin_slots.d.cts +26 -0
- package/dist/core/ecs/plugin_slots.d.ts +26 -0
- package/dist/core/ecs/plugin_slots.d.ts.map +1 -0
- package/dist/core/ecs/query.d.cts +219 -568
- package/dist/core/ecs/query.d.ts +219 -568
- package/dist/core/ecs/query.d.ts.map +1 -1
- package/dist/core/ecs/query_cache.d.cts +130 -0
- package/dist/core/ecs/query_cache.d.ts +130 -0
- package/dist/core/ecs/query_cache.d.ts.map +1 -0
- package/dist/core/ecs/query_registry.d.cts +47 -0
- package/dist/core/ecs/query_registry.d.ts +47 -0
- package/dist/core/ecs/query_registry.d.ts.map +1 -0
- package/dist/core/ecs/query_terms.d.cts +126 -0
- package/dist/core/ecs/query_terms.d.ts +126 -0
- package/dist/core/ecs/query_terms.d.ts.map +1 -0
- package/dist/core/ecs/ref.d.cts +129 -16
- package/dist/core/ecs/ref.d.ts +129 -16
- package/dist/core/ecs/ref.d.ts.map +1 -1
- package/dist/core/ecs/relation.d.cts +105 -186
- package/dist/core/ecs/relation.d.ts +105 -186
- package/dist/core/ecs/relation.d.ts.map +1 -1
- package/dist/core/ecs/resource.d.cts +14 -14
- package/dist/core/ecs/resource.d.ts +14 -14
- package/dist/core/ecs/resource_registry.d.cts +6 -6
- package/dist/core/ecs/resource_registry.d.ts +6 -6
- package/dist/core/ecs/resource_registry.d.ts.map +1 -1
- package/dist/core/ecs/row_kinds.d.cts +24 -0
- package/dist/core/ecs/row_kinds.d.ts +24 -0
- package/dist/core/ecs/row_kinds.d.ts.map +1 -0
- package/dist/core/ecs/run_condition.d.cts +23 -23
- package/dist/core/ecs/run_condition.d.ts +23 -23
- package/dist/core/ecs/run_condition.d.ts.map +1 -1
- package/dist/core/ecs/schedule.d.cts +98 -114
- package/dist/core/ecs/schedule.d.ts +98 -114
- package/dist/core/ecs/schedule.d.ts.map +1 -1
- package/dist/core/ecs/schedule_plan.d.cts +33 -0
- package/dist/core/ecs/schedule_plan.d.ts +33 -0
- package/dist/core/ecs/schedule_plan.d.ts.map +1 -0
- package/dist/core/ecs/snapshot.d.cts +77 -0
- package/dist/core/ecs/snapshot.d.ts +77 -0
- package/dist/core/ecs/snapshot.d.ts.map +1 -0
- package/dist/core/ecs/snapshot_mount.d.cts +42 -0
- package/dist/core/ecs/snapshot_mount.d.ts +42 -0
- package/dist/core/ecs/snapshot_mount.d.ts.map +1 -0
- package/dist/core/ecs/sparse_store.d.cts +110 -53
- package/dist/core/ecs/sparse_store.d.ts +110 -53
- package/dist/core/ecs/sparse_store.d.ts.map +1 -1
- package/dist/core/ecs/store.d.cts +644 -511
- package/dist/core/ecs/store.d.ts +644 -511
- package/dist/core/ecs/store.d.ts.map +1 -1
- package/dist/core/ecs/store_layout_listener.d.cts +8 -8
- package/dist/core/ecs/store_layout_listener.d.ts +8 -8
- package/dist/core/ecs/store_types.d.cts +122 -0
- package/dist/core/ecs/store_types.d.ts +122 -0
- package/dist/core/ecs/store_types.d.ts.map +1 -0
- package/dist/core/ecs/system.d.cts +151 -66
- package/dist/core/ecs/system.d.ts +151 -66
- package/dist/core/ecs/system.d.ts.map +1 -1
- package/dist/core/ecs/system_context.d.cts +296 -0
- package/dist/core/ecs/system_context.d.ts +296 -0
- package/dist/core/ecs/system_context.d.ts.map +1 -0
- package/dist/core/ecs/system_set.d.cts +48 -0
- package/dist/core/ecs/system_set.d.ts +48 -0
- package/dist/core/ecs/system_set.d.ts.map +1 -0
- package/dist/core/ecs/utils/arrays.d.cts +15 -1
- package/dist/core/ecs/utils/arrays.d.ts +15 -1
- package/dist/core/ecs/utils/arrays.d.ts.map +1 -1
- package/dist/core/ecs/utils/error.d.cts +87 -4
- package/dist/core/ecs/utils/error.d.ts +87 -4
- package/dist/core/ecs/utils/error.d.ts.map +1 -1
- package/dist/core/ecs/utils/plugin_error.d.cts +10 -0
- package/dist/core/ecs/utils/plugin_error.d.ts +10 -0
- package/dist/core/ecs/utils/plugin_error.d.ts.map +1 -0
- package/dist/core/restore_errors.d.cts +30 -0
- package/dist/core/restore_errors.d.ts +30 -0
- package/dist/core/restore_errors.d.ts.map +1 -0
- package/dist/core/store/action_ring.d.cts +48 -49
- package/dist/core/store/action_ring.d.ts +48 -49
- package/dist/core/store/action_ring.d.ts.map +1 -1
- package/dist/core/store/allocator.d.cts +166 -114
- package/dist/core/store/allocator.d.ts +166 -114
- package/dist/core/store/allocator.d.ts.map +1 -1
- package/dist/core/store/buffer_backed_column.d.cts +21 -22
- package/dist/core/store/buffer_backed_column.d.ts +21 -22
- package/dist/core/store/buffer_backed_column.d.ts.map +1 -1
- package/dist/core/store/column_store.d.cts +138 -100
- package/dist/core/store/column_store.d.ts +138 -100
- package/dist/core/store/column_store.d.ts.map +1 -1
- package/dist/core/store/command_dispatch.d.cts +14 -15
- package/dist/core/store/command_dispatch.d.ts +14 -15
- package/dist/core/store/command_dispatch.d.ts.map +1 -1
- package/dist/core/store/command_ring.d.cts +41 -45
- package/dist/core/store/command_ring.d.ts +41 -45
- package/dist/core/store/command_ring.d.ts.map +1 -1
- package/dist/core/store/descriptor.d.cts +35 -18
- package/dist/core/store/descriptor.d.ts +35 -18
- package/dist/core/store/descriptor.d.ts.map +1 -1
- package/dist/core/store/entity_index.d.cts +34 -35
- package/dist/core/store/entity_index.d.ts +34 -35
- package/dist/core/store/entity_index.d.ts.map +1 -1
- package/dist/core/store/event_ring.d.cts +40 -42
- package/dist/core/store/event_ring.d.ts +40 -42
- package/dist/core/store/event_ring.d.ts.map +1 -1
- package/dist/core/store/extend.d.cts +15 -9
- package/dist/core/store/extend.d.ts +15 -9
- package/dist/core/store/extend.d.ts.map +1 -1
- package/dist/core/store/grow.d.cts +3 -3
- package/dist/core/store/grow.d.ts +3 -3
- package/dist/core/store/grow.d.ts.map +1 -1
- package/dist/core/store/header.d.cts +37 -33
- package/dist/core/store/header.d.ts +37 -33
- package/dist/core/store/header.d.ts.map +1 -1
- package/dist/core/store/index.d.cts +10 -10
- package/dist/core/store/index.d.ts +10 -10
- package/dist/core/store/index.d.ts.map +1 -1
- package/dist/core/store/layout_ops.d.cts +72 -63
- package/dist/core/store/layout_ops.d.ts +72 -63
- package/dist/core/store/layout_ops.d.ts.map +1 -1
- package/dist/core/store/region_table.d.cts +28 -21
- package/dist/core/store/region_table.d.ts +28 -21
- package/dist/core/store/region_table.d.ts.map +1 -1
- package/dist/core/store/snapshot.d.cts +31 -16
- package/dist/core/store/snapshot.d.ts +31 -16
- package/dist/core/store/snapshot.d.ts.map +1 -1
- package/dist/core/store/state_hash.d.cts +14 -14
- package/dist/core/store/state_hash.d.ts +14 -14
- package/dist/core/store/state_hash.d.ts.map +1 -1
- package/dist/core/store/store_regions.d.cts +10 -10
- package/dist/core/store/store_regions.d.ts +10 -10
- package/dist/core/store/store_regions.d.ts.map +1 -1
- package/dist/core/store/vendored_abi/abi.d.cts +27 -2
- package/dist/core/store/vendored_abi/abi.d.ts +27 -2
- package/dist/core/store/vendored_abi/abi.d.ts.map +1 -1
- package/dist/host_commands-B2KMx8O2.cjs +1 -0
- package/dist/host_commands-ClVPvhSa.cjs +2 -0
- package/dist/host_commands-CwxVQS1z.js +1524 -0
- package/dist/host_commands-nJvTy88E.js +1667 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +16 -11
- package/dist/index.d.ts +16 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.development.cjs +1 -1
- package/dist/index.development.js +6709 -5729
- package/dist/index.js +5664 -4743
- package/dist/internal.cjs +2 -2
- package/dist/internal.d.cts +5 -2
- package/dist/internal.d.ts +5 -2
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.development.cjs +1 -1
- package/dist/internal.development.js +70 -20
- package/dist/internal.js +138 -83
- package/dist/plugins/abi-D3V-QUSf.cjs +1 -0
- package/dist/plugins/abi-NP8pNxpd.js +42 -0
- package/dist/plugins/arrays-Dr_1hCjL.js +28 -0
- package/dist/plugins/arrays-Dt-Joc4i.cjs +1 -0
- package/dist/plugins/assertions-gtDVfbnQ.js +6 -0
- package/dist/plugins/assertions-z5GQd_bB.cjs +1 -0
- package/dist/{extensions → plugins}/editor/editor.d.cts +56 -56
- package/dist/{extensions → plugins}/editor/editor.d.ts +56 -56
- package/dist/plugins/editor/editor.d.ts.map +1 -0
- package/dist/{extensions → plugins}/editor/field_handle.d.cts +13 -13
- package/dist/{extensions → plugins}/editor/field_handle.d.ts +13 -13
- package/dist/plugins/editor/field_handle.d.ts.map +1 -0
- package/dist/plugins/editor/index.d.cts +22 -0
- package/dist/plugins/editor/index.d.ts +22 -0
- package/dist/plugins/editor/index.d.ts.map +1 -0
- package/dist/plugins/editor.cjs +1 -0
- package/dist/plugins/editor.d.cts +1 -0
- package/dist/plugins/editor.d.ts +1 -0
- package/dist/plugins/editor.development.cjs +1 -0
- package/dist/{extensions/editor/index.development.js → plugins/editor.development.js} +83 -66
- package/dist/{extensions/editor/index.js → plugins/editor.js} +83 -66
- package/dist/plugins/events/event_channel.d.cts +13 -0
- package/dist/plugins/events/event_channel.d.ts +13 -0
- package/dist/plugins/events/event_channel.d.ts.map +1 -0
- package/dist/plugins/events/event_registry.d.cts +22 -0
- package/dist/plugins/events/event_registry.d.ts +22 -0
- package/dist/plugins/events/event_registry.d.ts.map +1 -0
- package/dist/plugins/events/facade.d.cts +26 -0
- package/dist/plugins/events/facade.d.ts +26 -0
- package/dist/plugins/events/facade.d.ts.map +1 -0
- package/dist/plugins/events/index.d.cts +10 -0
- package/dist/plugins/events/index.d.ts +10 -0
- package/dist/plugins/events/index.d.ts.map +1 -0
- package/dist/plugins/events.cjs +1 -0
- package/dist/plugins/events.d.cts +1 -0
- package/dist/plugins/events.d.ts +1 -0
- package/dist/plugins/events.development.cjs +1 -0
- package/dist/plugins/events.development.js +174 -0
- package/dist/plugins/events.js +159 -0
- package/dist/plugins/observers/index.d.cts +23 -0
- package/dist/plugins/observers/index.d.ts +23 -0
- package/dist/plugins/observers/index.d.ts.map +1 -0
- package/dist/plugins/observers/observer_registry.d.cts +101 -0
- package/dist/plugins/observers/observer_registry.d.ts +101 -0
- package/dist/plugins/observers/observer_registry.d.ts.map +1 -0
- package/dist/plugins/observers.cjs +1 -0
- package/dist/plugins/observers.d.cts +1 -0
- package/dist/plugins/observers.d.ts +1 -0
- package/dist/plugins/observers.development.cjs +1 -0
- package/dist/plugins/observers.development.js +431 -0
- package/dist/plugins/observers.js +403 -0
- package/dist/plugins/relation_store-BsoegrZh.js +313 -0
- package/dist/plugins/relation_store-DQKSnxsm.cjs +1 -0
- package/dist/plugins/relation_store-RBhpcE28.cjs +1 -0
- package/dist/plugins/relation_store-RqW5Snx6.js +328 -0
- package/dist/plugins/relations/builtin_relations.d.cts +48 -0
- package/dist/plugins/relations/builtin_relations.d.ts +48 -0
- package/dist/plugins/relations/builtin_relations.d.ts.map +1 -0
- package/dist/plugins/relations/facade.d.cts +73 -0
- package/dist/plugins/relations/facade.d.ts +73 -0
- package/dist/plugins/relations/facade.d.ts.map +1 -0
- package/dist/plugins/relations/index.d.cts +11 -0
- package/dist/plugins/relations/index.d.ts +11 -0
- package/dist/plugins/relations/index.d.ts.map +1 -0
- package/dist/{core/ecs → plugins/relations}/relation_service.d.cts +93 -105
- package/dist/{core/ecs → plugins/relations}/relation_service.d.ts +93 -105
- package/dist/plugins/relations/relation_service.d.ts.map +1 -0
- package/dist/plugins/relations/relation_store.d.cts +177 -0
- package/dist/plugins/relations/relation_store.d.ts +177 -0
- package/dist/plugins/relations/relation_store.d.ts.map +1 -0
- package/dist/plugins/relations.cjs +1 -0
- package/dist/plugins/relations.d.cts +1 -0
- package/dist/plugins/relations.d.ts +1 -0
- package/dist/plugins/relations.development.cjs +1 -0
- package/dist/plugins/relations.development.js +603 -0
- package/dist/plugins/relations.js +553 -0
- package/dist/plugins/snapshots/index.d.cts +33 -0
- package/dist/plugins/snapshots/index.d.ts +33 -0
- package/dist/plugins/snapshots/index.d.ts.map +1 -0
- package/dist/plugins/snapshots/resume.d.cts +57 -0
- package/dist/plugins/snapshots/resume.d.ts +57 -0
- package/dist/plugins/snapshots/resume.d.ts.map +1 -0
- package/dist/plugins/snapshots/snapshot_service.d.cts +59 -0
- package/dist/plugins/snapshots/snapshot_service.d.ts +59 -0
- package/dist/plugins/snapshots/snapshot_service.d.ts.map +1 -0
- package/dist/plugins/snapshots.cjs +1 -0
- package/dist/plugins/snapshots.d.cts +1 -0
- package/dist/plugins/snapshots.d.ts +1 -0
- package/dist/plugins/snapshots.development.cjs +1 -0
- package/dist/plugins/snapshots.development.js +737 -0
- package/dist/plugins/snapshots.js +737 -0
- package/dist/plugins/solid/index.d.cts +8 -0
- package/dist/plugins/solid/index.d.ts +8 -0
- package/dist/plugins/solid/index.d.ts.map +1 -0
- package/dist/plugins/solid/solid.d.cts +97 -0
- package/dist/plugins/solid/solid.d.ts +97 -0
- package/dist/plugins/solid/solid.d.ts.map +1 -0
- package/dist/plugins/solid.cjs +1 -0
- package/dist/plugins/solid.d.cts +1 -0
- package/dist/plugins/solid.d.ts +1 -0
- package/dist/plugins/solid.development.cjs +1 -0
- package/dist/plugins/solid.development.js +319 -0
- package/dist/plugins/solid.js +319 -0
- package/dist/plugins/workers/index.d.cts +75 -0
- package/dist/plugins/workers/index.d.ts +75 -0
- package/dist/plugins/workers/index.d.ts.map +1 -0
- package/dist/plugins/workers/node_threads.d.cts +25 -0
- package/dist/plugins/workers/node_threads.d.ts +25 -0
- package/dist/plugins/workers/node_threads.d.ts.map +1 -0
- package/dist/plugins/workers/plan.d.cts +61 -0
- package/dist/plugins/workers/plan.d.ts +61 -0
- package/dist/plugins/workers/plan.d.ts.map +1 -0
- package/dist/plugins/workers/pool.d.cts +144 -0
- package/dist/plugins/workers/pool.d.ts +144 -0
- package/dist/plugins/workers/pool.d.ts.map +1 -0
- package/dist/plugins/workers/protocol.d.cts +112 -0
- package/dist/plugins/workers/protocol.d.ts +112 -0
- package/dist/plugins/workers/protocol.d.ts.map +1 -0
- package/dist/plugins/workers/worker_bind.d.cts +64 -0
- package/dist/plugins/workers/worker_bind.d.ts +64 -0
- package/dist/plugins/workers/worker_bind.d.ts.map +1 -0
- package/dist/plugins/workers/worker_loop.d.cts +14 -0
- package/dist/plugins/workers/worker_loop.d.ts +14 -0
- package/dist/plugins/workers/worker_loop.d.ts.map +1 -0
- package/dist/plugins/workers.cjs +1 -0
- package/dist/plugins/workers.d.cts +1 -0
- package/dist/plugins/workers.d.ts +1 -0
- package/dist/plugins/workers.development.cjs +1 -0
- package/dist/plugins/workers.development.js +596 -0
- package/dist/plugins/workers.js +474 -0
- package/dist/primitives.cjs +1 -1
- package/dist/primitives.d.cts +4 -4
- package/dist/primitives.d.ts +4 -4
- package/dist/primitives.development.cjs +1 -1
- package/dist/primitives.development.js +66 -22
- package/dist/primitives.js +66 -22
- package/dist/shared-BKl12xF1.js +132 -0
- package/dist/shared-Dk-pACZT.cjs +1 -0
- package/dist/shared.cjs +1 -1
- package/dist/shared.d.cts +7 -7
- package/dist/shared.d.ts +7 -7
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.development.cjs +1 -1
- package/dist/shared.development.js +4 -3
- package/dist/shared.js +4 -3
- package/dist/topological_sort-Cc_yXqPT.js +346 -0
- package/dist/topological_sort-vp1imU6D.cjs +1 -0
- package/dist/type_primitives/assertions.d.cts +12 -16
- package/dist/type_primitives/assertions.d.ts +12 -16
- package/dist/type_primitives/assertions.d.ts.map +1 -1
- package/dist/type_primitives/binary_heap/binary_heap.d.cts +2 -6
- package/dist/type_primitives/binary_heap/binary_heap.d.ts +2 -6
- package/dist/type_primitives/binary_heap/binary_heap.d.ts.map +1 -1
- package/dist/type_primitives/bitset/bitset.d.cts +7 -11
- package/dist/type_primitives/bitset/bitset.d.ts +7 -11
- package/dist/type_primitives/bitset/bitset.d.ts.map +1 -1
- package/dist/type_primitives/brand.d.cts +2 -7
- package/dist/type_primitives/brand.d.ts +2 -7
- package/dist/type_primitives/brand.d.ts.map +1 -1
- package/dist/type_primitives/error.d.cts +1 -2
- package/dist/type_primitives/error.d.ts +1 -2
- package/dist/type_primitives/error.d.ts.map +1 -1
- package/dist/type_primitives/index.d.cts +1 -1
- package/dist/type_primitives/index.d.ts +1 -1
- package/dist/type_primitives/sparse_map/sparse_map.d.cts +3 -7
- package/dist/type_primitives/sparse_map/sparse_map.d.ts +3 -7
- package/dist/type_primitives/sparse_map/sparse_map.d.ts.map +1 -1
- package/dist/type_primitives/sparse_set/sparse_set.d.cts +2 -6
- package/dist/type_primitives/sparse_set/sparse_set.d.ts +2 -6
- package/dist/type_primitives/sparse_set/sparse_set.d.ts.map +1 -1
- package/dist/type_primitives/topological_sort/topological_sort.d.cts +1 -5
- package/dist/type_primitives/topological_sort/topological_sort.d.ts +1 -5
- package/dist/type_primitives/topological_sort/topological_sort.d.ts.map +1 -1
- package/dist/type_primitives/typed_arrays/typed_arrays.d.cts +18 -17
- package/dist/type_primitives/typed_arrays/typed_arrays.d.ts +18 -17
- package/dist/type_primitives/typed_arrays/typed_arrays.d.ts.map +1 -1
- package/dist/utils/error.d.ts.map +1 -1
- package/dist/version.d.cts +4 -4
- package/dist/version.d.ts +4 -4
- package/dist/worker.cjs +1 -0
- package/dist/worker.d.cts +17 -0
- package/dist/worker.d.ts +17 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.development.cjs +1 -0
- package/dist/worker.development.js +253 -0
- package/dist/worker.js +253 -0
- package/package.json +363 -191
- package/dist/core/ecs/builtin_relations.d.cts +0 -43
- package/dist/core/ecs/builtin_relations.d.ts +0 -43
- package/dist/core/ecs/builtin_relations.d.ts.map +0 -1
- package/dist/core/ecs/event_registry.d.cts +0 -22
- package/dist/core/ecs/event_registry.d.ts +0 -22
- package/dist/core/ecs/event_registry.d.ts.map +0 -1
- package/dist/core/ecs/relation_service.d.ts.map +0 -1
- package/dist/core/ecs/resume.d.cts +0 -85
- package/dist/core/ecs/resume.d.ts +0 -85
- package/dist/core/ecs/resume.d.ts.map +0 -1
- package/dist/core/ecs/snapshot_service.d.cts +0 -94
- package/dist/core/ecs/snapshot_service.d.ts +0 -94
- package/dist/core/ecs/snapshot_service.d.ts.map +0 -1
- package/dist/extensions/editor/editor.d.ts.map +0 -1
- package/dist/extensions/editor/field_handle.d.ts.map +0 -1
- package/dist/extensions/editor/index.cjs +0 -1
- package/dist/extensions/editor/index.d.cts +0 -21
- package/dist/extensions/editor/index.d.ts +0 -21
- package/dist/extensions/editor/index.d.ts.map +0 -1
- package/dist/extensions/editor/index.development.cjs +0 -1
- package/dist/extensions/reactive/ecs_sync.d.cts +0 -214
- package/dist/extensions/reactive/ecs_sync.d.ts +0 -214
- package/dist/extensions/reactive/ecs_sync.d.ts.map +0 -1
- package/dist/extensions/reactive/index.cjs +0 -1
- package/dist/extensions/reactive/index.d.cts +0 -23
- package/dist/extensions/reactive/index.d.ts +0 -23
- package/dist/extensions/reactive/index.d.ts.map +0 -1
- package/dist/extensions/reactive/index.development.cjs +0 -1
- package/dist/extensions/reactive/index.development.js +0 -215
- package/dist/extensions/reactive/index.js +0 -215
- package/dist/extensions/solid/index.cjs +0 -1
- package/dist/extensions/solid/index.d.cts +0 -6
- package/dist/extensions/solid/index.d.ts +0 -6
- package/dist/extensions/solid/index.d.ts.map +0 -1
- package/dist/extensions/solid/index.development.cjs +0 -1
- package/dist/extensions/solid/index.development.js +0 -40
- package/dist/extensions/solid/index.js +0 -36
- package/dist/extensions/solid/kernel_solid.d.cts +0 -45
- package/dist/extensions/solid/kernel_solid.d.ts +0 -45
- package/dist/extensions/solid/kernel_solid.d.ts.map +0 -1
- package/dist/host_commands-3jyFfWNg.js +0 -2326
- package/dist/host_commands-DNf0f6ko.cjs +0 -1
- package/dist/internal-C9jjL90H.js +0 -2485
- package/dist/internal-RZN14uMw.cjs +0 -2
- package/dist/interop-CT-REx0W.cjs +0 -1
- package/dist/interop-CcY6ASQc.js +0 -18
- package/dist/interop-DqxleBo7.js +0 -18
- package/dist/interop-T1HZ-Dpa.cjs +0 -1
- package/dist/kernel-Cz2Kxlwl.js +0 -240
- package/dist/kernel-DgyrLFjW.js +0 -227
- package/dist/kernel-sw7ScKWu.cjs +0 -1
- package/dist/kernel-yWV3XnAb.cjs +0 -1
- package/dist/reactive/array.d.cts +0 -24
- package/dist/reactive/array.d.ts +0 -24
- package/dist/reactive/array.d.ts.map +0 -1
- package/dist/reactive/index.cjs +0 -1
- package/dist/reactive/index.d.cts +0 -11
- package/dist/reactive/index.d.ts +0 -11
- package/dist/reactive/index.d.ts.map +0 -1
- package/dist/reactive/index.development.cjs +0 -1
- package/dist/reactive/index.development.js +0 -18
- package/dist/reactive/index.js +0 -18
- package/dist/reactive/interop.d.cts +0 -19
- package/dist/reactive/interop.d.ts +0 -19
- package/dist/reactive/interop.d.ts.map +0 -1
- package/dist/reactive/kernel.d.cts +0 -73
- package/dist/reactive/kernel.d.ts +0 -73
- package/dist/reactive/kernel.d.ts.map +0 -1
- package/dist/reactive/map.d.cts +0 -16
- package/dist/reactive/map.d.ts +0 -16
- package/dist/reactive/map.d.ts.map +0 -1
- package/dist/reactive/shallow.d.cts +0 -11
- package/dist/reactive/shallow.d.ts +0 -11
- package/dist/reactive/shallow.d.ts.map +0 -1
- package/dist/reactive/struct.d.cts +0 -10
- package/dist/reactive/struct.d.ts +0 -10
- package/dist/reactive/struct.d.ts.map +0 -1
- package/dist/shallow-9S1pY_Iw.js +0 -159
- package/dist/shallow-C5YmTbtb.cjs +0 -1
- package/dist/shallow-DQ8aG51_.cjs +0 -1
- package/dist/shallow-DfnAm9vG.js +0 -150
- package/dist/shared-BMXh9hxm.cjs +0 -1
- package/dist/shared-DQKK0i-E.js +0 -109
- package/dist/topological_sort-BDvEyb9W.cjs +0 -1
- package/dist/topological_sort-DK6EjpWa.js +0 -135
- package/dist/typed_arrays-BcXcnzB4.js +0 -258
- package/dist/typed_arrays-D3NmwtCG.cjs +0 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ECS } from '../../core/ecs/ecs.cjs';
|
|
2
|
+
import { OnDeleteTarget, RelationDef } from '../../core/ecs/relation.cjs';
|
|
3
|
+
import { RelationsPlugin } from './index.cjs';
|
|
4
|
+
/** A world with the relations plugin installed. These helpers register a
|
|
5
|
+
* relation, so they need it. */
|
|
6
|
+
type RelationalWorld = ECS<RelationsPlugin> & RelationsPlugin;
|
|
7
|
+
/** Options for a built-in relation. `exclusive` and `multi` are fixed (always
|
|
8
|
+
* exclusive, required for the chain and tree traversal helpers), so only the
|
|
9
|
+
* target-deletion cleanup policy is tunable. */
|
|
10
|
+
export interface BuiltinRelationOptions {
|
|
11
|
+
/** What happens to a relation's sources when a target is destroyed.
|
|
12
|
+
* Defaults per relation (see each registrar). */
|
|
13
|
+
readonly onDeleteTarget?: OnDeleteTarget;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Register an **`IsA(instance → exemplar)`** relation, a thin instance-of link.
|
|
17
|
+
*
|
|
18
|
+
* - "all instances of exemplar E" is `ecs.relations.sourcesOf(E, IsA)`.
|
|
19
|
+
* - the IsA chain (`instance → exemplar → …`) is walked with
|
|
20
|
+
* `ecs.relations.ancestorsOf(instance, IsA)`, `rootOf` and `cascadeOf(exemplar, IsA)`.
|
|
21
|
+
* - **No component inheritance**. IsA records the link only. Materialization of
|
|
22
|
+
* an instance from its exemplar stays a spawn-time copy on the template path,
|
|
23
|
+
* deliberately decoupled. An exemplar is a real entity and not a `Template`,
|
|
24
|
+
* because a non-entity template cannot be a relation target.
|
|
25
|
+
*
|
|
26
|
+
* Default `onDeleteTarget: "clear"`, destroying an exemplar drops its
|
|
27
|
+
* instances' IsA link but leaves the instances alive (the thin analog of
|
|
28
|
+
* flecs's `IsA`-remove, since there is no inherited data to strip). Pass
|
|
29
|
+
* `"delete"` for strong instance-of (exemplar death cascade-destroys instances).
|
|
30
|
+
*/
|
|
31
|
+
export declare function registerIsA(ecs: RelationalWorld, opts?: BuiltinRelationOptions): RelationDef<"exclusive">;
|
|
32
|
+
/**
|
|
33
|
+
* Register a **`ChildOf(child → parent)`** relation, a thin hierarchy link.
|
|
34
|
+
*
|
|
35
|
+
* - a parent's children are `ecs.relations.sourcesOf(parent, ChildOf)`.
|
|
36
|
+
* - the hierarchy is walked with `ecs.relations.ancestorsOf(child, ChildOf)` (up to the
|
|
37
|
+
* root), `rootOf`, and `cascadeOf(root, ChildOf)` (down, breadth-first,
|
|
38
|
+
* parents before children).
|
|
39
|
+
* - unlike flecs's `ChildOf`, this does **not** scope names or lookup, the engine
|
|
40
|
+
* has no name registry. It is purely the structural parent link.
|
|
41
|
+
*
|
|
42
|
+
* Default `onDeleteTarget: "delete"`, destroying a parent cascade-destroys
|
|
43
|
+
* its whole subtree (flecs's default). Pass `"clear"` to let children survive as
|
|
44
|
+
* roots, or `"orphan"` to leave a dangling `targetOf`.
|
|
45
|
+
*/
|
|
46
|
+
export declare function registerChildOf(ecs: RelationalWorld, opts?: BuiltinRelationOptions): RelationDef<"exclusive">;
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=builtin_relations.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ECS } from '../../core/ecs/ecs.js';
|
|
2
|
+
import { OnDeleteTarget, RelationDef } from '../../core/ecs/relation.js';
|
|
3
|
+
import { RelationsPlugin } from './index.js';
|
|
4
|
+
/** A world with the relations plugin installed. These helpers register a
|
|
5
|
+
* relation, so they need it. */
|
|
6
|
+
type RelationalWorld = ECS<RelationsPlugin> & RelationsPlugin;
|
|
7
|
+
/** Options for a built-in relation. `exclusive` and `multi` are fixed (always
|
|
8
|
+
* exclusive, required for the chain and tree traversal helpers), so only the
|
|
9
|
+
* target-deletion cleanup policy is tunable. */
|
|
10
|
+
export interface BuiltinRelationOptions {
|
|
11
|
+
/** What happens to a relation's sources when a target is destroyed.
|
|
12
|
+
* Defaults per relation (see each registrar). */
|
|
13
|
+
readonly onDeleteTarget?: OnDeleteTarget;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Register an **`IsA(instance → exemplar)`** relation, a thin instance-of link.
|
|
17
|
+
*
|
|
18
|
+
* - "all instances of exemplar E" is `ecs.relations.sourcesOf(E, IsA)`.
|
|
19
|
+
* - the IsA chain (`instance → exemplar → …`) is walked with
|
|
20
|
+
* `ecs.relations.ancestorsOf(instance, IsA)`, `rootOf` and `cascadeOf(exemplar, IsA)`.
|
|
21
|
+
* - **No component inheritance**. IsA records the link only. Materialization of
|
|
22
|
+
* an instance from its exemplar stays a spawn-time copy on the template path,
|
|
23
|
+
* deliberately decoupled. An exemplar is a real entity and not a `Template`,
|
|
24
|
+
* because a non-entity template cannot be a relation target.
|
|
25
|
+
*
|
|
26
|
+
* Default `onDeleteTarget: "clear"`, destroying an exemplar drops its
|
|
27
|
+
* instances' IsA link but leaves the instances alive (the thin analog of
|
|
28
|
+
* flecs's `IsA`-remove, since there is no inherited data to strip). Pass
|
|
29
|
+
* `"delete"` for strong instance-of (exemplar death cascade-destroys instances).
|
|
30
|
+
*/
|
|
31
|
+
export declare function registerIsA(ecs: RelationalWorld, opts?: BuiltinRelationOptions): RelationDef<"exclusive">;
|
|
32
|
+
/**
|
|
33
|
+
* Register a **`ChildOf(child → parent)`** relation, a thin hierarchy link.
|
|
34
|
+
*
|
|
35
|
+
* - a parent's children are `ecs.relations.sourcesOf(parent, ChildOf)`.
|
|
36
|
+
* - the hierarchy is walked with `ecs.relations.ancestorsOf(child, ChildOf)` (up to the
|
|
37
|
+
* root), `rootOf`, and `cascadeOf(root, ChildOf)` (down, breadth-first,
|
|
38
|
+
* parents before children).
|
|
39
|
+
* - unlike flecs's `ChildOf`, this does **not** scope names or lookup, the engine
|
|
40
|
+
* has no name registry. It is purely the structural parent link.
|
|
41
|
+
*
|
|
42
|
+
* Default `onDeleteTarget: "delete"`, destroying a parent cascade-destroys
|
|
43
|
+
* its whole subtree (flecs's default). Pass `"clear"` to let children survive as
|
|
44
|
+
* roots, or `"orphan"` to leave a dangling `targetOf`.
|
|
45
|
+
*/
|
|
46
|
+
export declare function registerChildOf(ecs: RelationalWorld, opts?: BuiltinRelationOptions): RelationDef<"exclusive">;
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=builtin_relations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin_relations.d.ts","sourceRoot":"","sources":["../../../src/plugins/relations/builtin_relations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;KAsBK;AAEL,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C;gCACgC;AAChC,KAAK,eAAe,GAAG,GAAG,CAAC,eAAe,CAAC,GAAG,eAAe,CAAC;AAE9D;;gDAEgD;AAChD,MAAM,WAAW,sBAAsB;IACtC;qDACiD;IACjD,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC;CACzC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAC1B,GAAG,EAAE,eAAe,EACpB,IAAI,CAAC,EAAE,sBAAsB,GAC3B,WAAW,CAAC,WAAW,CAAC,CAK1B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAC9B,GAAG,EAAE,eAAe,EACpB,IAAI,CAAC,EAAE,sBAAsB,GAC3B,WAAW,CAAC,WAAW,CAAC,CAK1B"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { EntityID } from '../../core/ecs/entity.cjs';
|
|
2
|
+
import { OnDeleteTarget, RelationDef, RelationOptions } from '../../core/ecs/relation.cjs';
|
|
3
|
+
import { RelationService } from './relation_service.cjs';
|
|
4
|
+
/** Relations, sparse `(relation, target)` pairs and hierarchy traversal.
|
|
5
|
+
* Add, remove and re-target cause no archetype
|
|
6
|
+
* transition. Ops are immediate and safe mid-tick. Traversal and wildcard
|
|
7
|
+
* reads are cold-path. */
|
|
8
|
+
export declare class ECSRelations {
|
|
9
|
+
private readonly _service;
|
|
10
|
+
/** @internal constructed by the relations plugin. */
|
|
11
|
+
constructor(service: RelationService);
|
|
12
|
+
/** Register a relation kind. Exclusive (default) stores one target per
|
|
13
|
+
* source. `{ multi: true }` stores a target set per source.
|
|
14
|
+
* `{ onDeleteTarget: "delete" | "clear" | "orphan" }` selects target-death
|
|
15
|
+
* cleanup (default `orphan`).
|
|
16
|
+
*
|
|
17
|
+
* The overloads stamp the cardinality into the handle type:
|
|
18
|
+
* the exclusive-only surfaces (`targetOf`, `ancestorsOf`, `rootOf`,
|
|
19
|
+
* `cascadeOf` and `Query.hierarchy`) accept only `RelationDef<"exclusive">`,
|
|
20
|
+
* so passing a `{ multi: true }` relation is a compile error. A
|
|
21
|
+
* dynamically-built options value falls to the erased overload and keeps
|
|
22
|
+
* the runtime check as its only guard. */
|
|
23
|
+
register(opts?: {
|
|
24
|
+
readonly exclusive?: true;
|
|
25
|
+
readonly multi?: false;
|
|
26
|
+
readonly onDeleteTarget?: OnDeleteTarget;
|
|
27
|
+
}): RelationDef<"exclusive">;
|
|
28
|
+
register(opts: {
|
|
29
|
+
readonly multi: true;
|
|
30
|
+
readonly exclusive?: false;
|
|
31
|
+
readonly onDeleteTarget?: OnDeleteTarget;
|
|
32
|
+
}): RelationDef<"multi">;
|
|
33
|
+
register(opts?: RelationOptions): RelationDef;
|
|
34
|
+
/** Count of registered relations. */
|
|
35
|
+
get count(): number;
|
|
36
|
+
/** Add a `(R, tgt)` pair to `src`. Exclusive replaces the existing target
|
|
37
|
+
* multi adds to the set. No archetype transition. */
|
|
38
|
+
add(src: EntityID, def: RelationDef, tgt: EntityID): this;
|
|
39
|
+
/** Remove a `(R, tgt)` pair from `src`. For multi, omitting `tgt` removes
|
|
40
|
+
* all of `src`'s targets. No archetype transition. */
|
|
41
|
+
remove(src: EntityID, def: RelationDef, tgt?: EntityID): this;
|
|
42
|
+
/** Whether `src` holds any pair under `R`. */
|
|
43
|
+
has(src: EntityID, def: RelationDef): boolean;
|
|
44
|
+
/** The single target of `src` under an exclusive relation, or `undefined`. */
|
|
45
|
+
targetOf(src: EntityID, def: RelationDef<"exclusive">): EntityID | undefined;
|
|
46
|
+
/** All targets of `src` under `R`, ascending by id. */
|
|
47
|
+
targetsOf(src: EntityID, def: RelationDef): EntityID[];
|
|
48
|
+
/** Sources pointing at `tgt` under `R` (the reverse index), ascending by id.
|
|
49
|
+
* `(entity, def)` order, matching `targetOf` and `targetsOf`. */
|
|
50
|
+
sourcesOf(tgt: EntityID, def: RelationDef): EntityID[];
|
|
51
|
+
/** All `(source, target)` pairs of relation `R`, the `(R, *)` wildcard.
|
|
52
|
+
* Sources in canonical entity-index order. Cold path. */
|
|
53
|
+
pairsOf(def: RelationDef): readonly (readonly [EntityID, EntityID])[];
|
|
54
|
+
/** Every `(relation, source)` pointing at `tgt`, across all relation kinds,
|
|
55
|
+
* the `(*, T)` wildcard. Ordered by relation id then source id. */
|
|
56
|
+
sourcesOfAny(tgt: EntityID): readonly (readonly [RelationDef, EntityID])[];
|
|
57
|
+
/** Walk relation `R` up from `src` to its chain root, returning
|
|
58
|
+
* `[src, parent, …, root]` (nearest-ancestor-first). Exclusive only. */
|
|
59
|
+
ancestorsOf(src: EntityID, def: RelationDef<"exclusive">): EntityID[];
|
|
60
|
+
/** The root of `src`'s `R`-chain (`src` itself when it has no target).
|
|
61
|
+
* Exclusive only. */
|
|
62
|
+
rootOf(src: EntityID, def: RelationDef<"exclusive">): EntityID;
|
|
63
|
+
/** Walk relation `R` down from `root` over the reverse index, returning the
|
|
64
|
+
* subtree (including `root`) breadth-first, parents before children (the
|
|
65
|
+
* `cascade` order). Exclusive only. */
|
|
66
|
+
cascadeOf(root: EntityID, def: RelationDef<"exclusive">): EntityID[];
|
|
67
|
+
/** Reclaim relation reverse-index memory: drop every reverse entry whose
|
|
68
|
+
* target has been destroyed, returning the total dropped. Purely
|
|
69
|
+
* cold-path, no observable state change, call it at a scene boundary or at
|
|
70
|
+
* a snapshot boundary. */
|
|
71
|
+
compact(): number;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=facade.d.ts.map
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { EntityID } from '../../core/ecs/entity.js';
|
|
2
|
+
import { OnDeleteTarget, RelationDef, RelationOptions } from '../../core/ecs/relation.js';
|
|
3
|
+
import { RelationService } from './relation_service.js';
|
|
4
|
+
/** Relations, sparse `(relation, target)` pairs and hierarchy traversal.
|
|
5
|
+
* Add, remove and re-target cause no archetype
|
|
6
|
+
* transition. Ops are immediate and safe mid-tick. Traversal and wildcard
|
|
7
|
+
* reads are cold-path. */
|
|
8
|
+
export declare class ECSRelations {
|
|
9
|
+
private readonly _service;
|
|
10
|
+
/** @internal constructed by the relations plugin. */
|
|
11
|
+
constructor(service: RelationService);
|
|
12
|
+
/** Register a relation kind. Exclusive (default) stores one target per
|
|
13
|
+
* source. `{ multi: true }` stores a target set per source.
|
|
14
|
+
* `{ onDeleteTarget: "delete" | "clear" | "orphan" }` selects target-death
|
|
15
|
+
* cleanup (default `orphan`).
|
|
16
|
+
*
|
|
17
|
+
* The overloads stamp the cardinality into the handle type:
|
|
18
|
+
* the exclusive-only surfaces (`targetOf`, `ancestorsOf`, `rootOf`,
|
|
19
|
+
* `cascadeOf` and `Query.hierarchy`) accept only `RelationDef<"exclusive">`,
|
|
20
|
+
* so passing a `{ multi: true }` relation is a compile error. A
|
|
21
|
+
* dynamically-built options value falls to the erased overload and keeps
|
|
22
|
+
* the runtime check as its only guard. */
|
|
23
|
+
register(opts?: {
|
|
24
|
+
readonly exclusive?: true;
|
|
25
|
+
readonly multi?: false;
|
|
26
|
+
readonly onDeleteTarget?: OnDeleteTarget;
|
|
27
|
+
}): RelationDef<"exclusive">;
|
|
28
|
+
register(opts: {
|
|
29
|
+
readonly multi: true;
|
|
30
|
+
readonly exclusive?: false;
|
|
31
|
+
readonly onDeleteTarget?: OnDeleteTarget;
|
|
32
|
+
}): RelationDef<"multi">;
|
|
33
|
+
register(opts?: RelationOptions): RelationDef;
|
|
34
|
+
/** Count of registered relations. */
|
|
35
|
+
get count(): number;
|
|
36
|
+
/** Add a `(R, tgt)` pair to `src`. Exclusive replaces the existing target
|
|
37
|
+
* multi adds to the set. No archetype transition. */
|
|
38
|
+
add(src: EntityID, def: RelationDef, tgt: EntityID): this;
|
|
39
|
+
/** Remove a `(R, tgt)` pair from `src`. For multi, omitting `tgt` removes
|
|
40
|
+
* all of `src`'s targets. No archetype transition. */
|
|
41
|
+
remove(src: EntityID, def: RelationDef, tgt?: EntityID): this;
|
|
42
|
+
/** Whether `src` holds any pair under `R`. */
|
|
43
|
+
has(src: EntityID, def: RelationDef): boolean;
|
|
44
|
+
/** The single target of `src` under an exclusive relation, or `undefined`. */
|
|
45
|
+
targetOf(src: EntityID, def: RelationDef<"exclusive">): EntityID | undefined;
|
|
46
|
+
/** All targets of `src` under `R`, ascending by id. */
|
|
47
|
+
targetsOf(src: EntityID, def: RelationDef): EntityID[];
|
|
48
|
+
/** Sources pointing at `tgt` under `R` (the reverse index), ascending by id.
|
|
49
|
+
* `(entity, def)` order, matching `targetOf` and `targetsOf`. */
|
|
50
|
+
sourcesOf(tgt: EntityID, def: RelationDef): EntityID[];
|
|
51
|
+
/** All `(source, target)` pairs of relation `R`, the `(R, *)` wildcard.
|
|
52
|
+
* Sources in canonical entity-index order. Cold path. */
|
|
53
|
+
pairsOf(def: RelationDef): readonly (readonly [EntityID, EntityID])[];
|
|
54
|
+
/** Every `(relation, source)` pointing at `tgt`, across all relation kinds,
|
|
55
|
+
* the `(*, T)` wildcard. Ordered by relation id then source id. */
|
|
56
|
+
sourcesOfAny(tgt: EntityID): readonly (readonly [RelationDef, EntityID])[];
|
|
57
|
+
/** Walk relation `R` up from `src` to its chain root, returning
|
|
58
|
+
* `[src, parent, …, root]` (nearest-ancestor-first). Exclusive only. */
|
|
59
|
+
ancestorsOf(src: EntityID, def: RelationDef<"exclusive">): EntityID[];
|
|
60
|
+
/** The root of `src`'s `R`-chain (`src` itself when it has no target).
|
|
61
|
+
* Exclusive only. */
|
|
62
|
+
rootOf(src: EntityID, def: RelationDef<"exclusive">): EntityID;
|
|
63
|
+
/** Walk relation `R` down from `root` over the reverse index, returning the
|
|
64
|
+
* subtree (including `root`) breadth-first, parents before children (the
|
|
65
|
+
* `cascade` order). Exclusive only. */
|
|
66
|
+
cascadeOf(root: EntityID, def: RelationDef<"exclusive">): EntityID[];
|
|
67
|
+
/** Reclaim relation reverse-index memory: drop every reverse entry whose
|
|
68
|
+
* target has been destroyed, returning the total dropped. Purely
|
|
69
|
+
* cold-path, no observable state change, call it at a scene boundary or at
|
|
70
|
+
* a snapshot boundary. */
|
|
71
|
+
compact(): number;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=facade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"facade.d.ts","sourceRoot":"","sources":["../../../src/plugins/relations/facade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;KASK;AAEL,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC5F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D;;;0BAG0B;AAC1B,qBAAa,YAAY;IACxB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkB;IAC3C,qDAAqD;gBACzC,OAAO,EAAE,eAAe;IAIpC;;;;;;;;;;8CAU0C;IACnC,QAAQ,CAAC,IAAI,CAAC,EAAE;QACtB,QAAQ,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC;QAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;QACvB,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC;KACzC,GAAG,WAAW,CAAC,WAAW,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE;QACrB,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;QACrB,QAAQ,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC;QAC3B,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC;KACzC,GAAG,WAAW,CAAC,OAAO,CAAC;IACjB,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,WAAW;IAKpD,qCAAqC;IACrC,IAAW,KAAK,IAAI,MAAM,CAEzB;IAED;yDACqD;IAC9C,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,GAAG,IAAI;IAKhE;0DACsD;IAC/C,MAAM,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,CAAC,EAAE,QAAQ,GAAG,IAAI;IAKpE,8CAA8C;IACvC,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,WAAW,GAAG,OAAO;IAIpD,8EAA8E;IACvE,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,WAAW,CAAC,WAAW,CAAC,GAAG,QAAQ,GAAG,SAAS;IAInF,uDAAuD;IAChD,SAAS,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,WAAW,GAAG,QAAQ,EAAE;IAI7D;qEACiE;IAC1D,SAAS,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,WAAW,GAAG,QAAQ,EAAE;IAI7D;6DACyD;IAClD,OAAO,CAAC,GAAG,EAAE,WAAW,GAAG,SAAS,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,EAAE;IAI5E;uEACmE;IAC5D,YAAY,CAAC,GAAG,EAAE,QAAQ,GAAG,SAAS,CAAC,SAAS,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,EAAE;IAIjF;4EACwE;IACjE,WAAW,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,WAAW,CAAC,WAAW,CAAC,GAAG,QAAQ,EAAE;IAI5E;yBACqB;IACd,MAAM,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,WAAW,CAAC,WAAW,CAAC,GAAG,QAAQ;IAIrE;;2CAEuC;IAChC,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,WAAW,CAAC,WAAW,CAAC,GAAG,QAAQ,EAAE;IAI3E;;;8BAG0B;IACnB,OAAO,IAAI,MAAM;CAGxB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ECSRelations } from './facade.cjs';
|
|
2
|
+
import { Plugin } from '../../core/ecs/plugin.cjs';
|
|
3
|
+
export { ECSRelations } from './facade.cjs';
|
|
4
|
+
export { registerIsA, registerChildOf, type BuiltinRelationOptions } from './builtin_relations.cjs';
|
|
5
|
+
/** The world surface this plugin adds. */
|
|
6
|
+
export interface RelationsPlugin {
|
|
7
|
+
readonly relations: ECSRelations;
|
|
8
|
+
}
|
|
9
|
+
/** The relations plugin, for `ECS.create({ plugins: [relations()] })`. */
|
|
10
|
+
export declare function relations(): Plugin<RelationsPlugin>;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ECSRelations } from './facade.js';
|
|
2
|
+
import { Plugin } from '../../core/ecs/plugin.js';
|
|
3
|
+
export { ECSRelations } from './facade.js';
|
|
4
|
+
export { registerIsA, registerChildOf, type BuiltinRelationOptions } from './builtin_relations.js';
|
|
5
|
+
/** The world surface this plugin adds. */
|
|
6
|
+
export interface RelationsPlugin {
|
|
7
|
+
readonly relations: ECSRelations;
|
|
8
|
+
}
|
|
9
|
+
/** The relations plugin, for `ECS.create({ plugins: [relations()] })`. */
|
|
10
|
+
export declare function relations(): Plugin<RelationsPlugin>;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/relations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;KAkBK;AAGL,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,EAAE,MAAM,EAAc,MAAM,uBAAuB,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,KAAK,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAEhG,0CAA0C;AAC1C,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;CACjC;AAED,0EAA0E;AAC1E,wBAAgB,SAAS,IAAI,MAAM,CAAC,eAAe,CAAC,CAUnD"}
|
|
@@ -1,134 +1,122 @@
|
|
|
1
|
-
import { BitSet
|
|
2
|
-
import { Archetype } from '
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
isAlive(id: EntityID): boolean;
|
|
12
|
-
hasSparse(entityId: EntityID, def: SparseComponentDef): boolean;
|
|
13
|
-
pushSparseStore(fieldNames: string[], fieldTypes: TypedArrayTag[]): SparseComponentDef;
|
|
14
|
-
sparseStoreOf(def: SparseComponentDef): SparseComponentStore;
|
|
15
|
-
sparseStores(): readonly SparseComponentStore[];
|
|
16
|
-
entityGenerations(): Int32Array;
|
|
17
|
-
entityArchetype(): Int32Array;
|
|
18
|
-
entityRow(): Int32Array;
|
|
19
|
-
archetypes(): readonly Archetype[];
|
|
20
|
-
forEachSparseMatch(include: BitSet, exclude: BitSet | null, anyOf: BitSet | null, sparseInclude: readonly SparseComponentID[], sparseExclude: readonly SparseComponentID[], denseArchetypes: readonly Archetype[], cb: (entityId: EntityID) => void, includeDisabled: boolean): void;
|
|
21
|
-
}
|
|
22
|
-
export declare class RelationService {
|
|
23
|
-
private readonly host;
|
|
24
|
-
private readonly relations;
|
|
1
|
+
import { BitSet } from '../../type_primitives/index.cjs';
|
|
2
|
+
import { Archetype } from '../../core/ecs/archetype.cjs';
|
|
3
|
+
import { QueryTerms } from '../../core/ecs/query_terms.cjs';
|
|
4
|
+
import { EntityID } from '../../core/ecs/entity.cjs';
|
|
5
|
+
import { RelationDef, RelationHooks, RelationOptions, RelationServiceHost } from '../../core/ecs/relation.cjs';
|
|
6
|
+
import { RelationStore } from './relation_store.cjs';
|
|
7
|
+
import { SparseComponentID } from '../../core/ecs/sparse_store.cjs';
|
|
8
|
+
export declare class RelationService implements RelationHooks {
|
|
9
|
+
private readonly _host;
|
|
10
|
+
private readonly _relations;
|
|
25
11
|
private _hasTargetCleanup;
|
|
26
|
-
private
|
|
12
|
+
private _hierarchyRadixOut;
|
|
27
13
|
private readonly _hierarchyRadixC0;
|
|
28
14
|
private readonly _hierarchyRadixC1;
|
|
29
|
-
constructor(
|
|
30
|
-
/** The registry, indexed by RelationID
|
|
31
|
-
* `stateHash
|
|
15
|
+
constructor(_host: RelationServiceHost);
|
|
16
|
+
/** The registry, indexed by RelationID, the read-only view the Store's
|
|
17
|
+
* `stateHash`, snapshot and restore paths iterate. */
|
|
32
18
|
get stores(): readonly RelationStore[];
|
|
33
19
|
/** Number of registered relations. */
|
|
34
20
|
get count(): number;
|
|
35
|
-
/** Whether any relation registered a non-`orphan` `onDeleteTarget` policy
|
|
36
|
-
* the destroy paths' gate for `cleanupTarget
|
|
21
|
+
/** Whether any relation registered a non-`orphan` `onDeleteTarget` policy,
|
|
22
|
+
* the destroy paths' gate for `cleanupTarget`. */
|
|
37
23
|
get hasTargetCleanup(): boolean;
|
|
38
24
|
/** Register a relation kind. `exclusive` (the default) → one target per
|
|
39
25
|
* source, stored in a backing `{ target: f64 }` sparse component, so the
|
|
40
|
-
* forward index rides the sparse store and inherits query membership
|
|
41
|
-
* `stateHash` + snapshot
|
|
26
|
+
* forward index rides the sparse store and inherits query membership,
|
|
27
|
+
* `stateHash` + snapshot and restore for free. `multi` → a set of
|
|
42
28
|
* targets per source, backed by a sparse tag for membership plus a side
|
|
43
29
|
* forward index the relation owns. The two cardinalities are mutually
|
|
44
30
|
* exclusive. `onDeleteTarget` selects the cleanup policy run when a target
|
|
45
|
-
* is destroyed
|
|
46
|
-
* sources survive), or `orphan` (default: leave it dangling
|
|
47
|
-
*
|
|
31
|
+
* is destroyed, `delete` (cascade-destroy sources), `clear` (drop the link,
|
|
32
|
+
* sources survive), or `orphan` (default: leave it dangling). See
|
|
33
|
+
* `relation_store.ts`.
|
|
48
34
|
*
|
|
49
35
|
* The backing sparse store is resolved and handed to the relation so it can
|
|
50
|
-
* drive forward
|
|
51
|
-
* interaction
|
|
52
|
-
* branch here
|
|
36
|
+
* drive forward and membership rows directly, the cardinality-specific
|
|
37
|
+
* interaction belongs to `ExclusiveRelationStore` and `MultiRelationStore`, not to a
|
|
38
|
+
* branch here. */
|
|
53
39
|
registerRelation(opts?: RelationOptions): RelationDef;
|
|
54
|
-
private
|
|
40
|
+
private _relationOf;
|
|
55
41
|
/** Add a `(R, tgt)` pair to `src`. No archetype transition. Exclusive:
|
|
56
42
|
* replaces any existing target (engine-enforced one-per-source), a no-op if
|
|
57
43
|
* `tgt` is already the target. Multi: adds `tgt` to the set, a no-op if
|
|
58
44
|
* already present. A dead `src` *or* `tgt` is caller error: it throws in
|
|
59
|
-
* `DEV` and is a no-op in production
|
|
60
|
-
* never links a reverse-index entry keyed by a destroyed handle
|
|
45
|
+
* `DEV` and is a no-op in production, symmetric, so a production build
|
|
46
|
+
* never links a reverse-index entry keyed by a destroyed handle. */
|
|
61
47
|
addRelation(src: EntityID, def: RelationDef, tgt: EntityID): void;
|
|
62
48
|
/** Remove a `(R, tgt)` pair from `src`. No archetype transition. Exclusive:
|
|
63
49
|
* `tgt` is optional and the removal is a no-op when it names a target other
|
|
64
50
|
* than the current one. Multi: omitting `tgt` removes *all* of `src`'s
|
|
65
|
-
* targets
|
|
51
|
+
* targets. Passing one removes only that pair (dropping membership when the
|
|
66
52
|
* set empties). */
|
|
67
53
|
removeRelation(src: EntityID, def: RelationDef, tgt?: EntityID): void;
|
|
68
54
|
/** The single target of `src` under an exclusive relation, or `undefined`.
|
|
69
55
|
* Throws in `DEV` on a multi-target relation (use `targetsOf`). */
|
|
70
56
|
targetOf(src: EntityID, def: RelationDef): EntityID | undefined;
|
|
71
|
-
/** All targets of `src` under `R
|
|
72
|
-
* for multi
|
|
57
|
+
/** All targets of `src` under `R`, one or zero for exclusive, the full set
|
|
58
|
+
* for multi, ascending by id. */
|
|
73
59
|
targetsOf(src: EntityID, def: RelationDef): EntityID[];
|
|
74
60
|
/** Sources that point at `tgt` under `R` (the reverse index), ascending by
|
|
75
|
-
* id
|
|
61
|
+
* id. Empty when none. */
|
|
76
62
|
sourcesOf(tgt: EntityID, def: RelationDef): EntityID[];
|
|
77
63
|
/** Whether `src` holds any pair under `R`. */
|
|
78
64
|
hasRelation(src: EntityID, def: RelationDef): boolean;
|
|
79
|
-
/** All `(source, target)` pairs of relation `R
|
|
80
|
-
*
|
|
65
|
+
/** All `(source, target)` pairs of relation `R`, the `(R, *)` wildcard.
|
|
66
|
+
* Sources are emitted in **canonical entity-index order** (the
|
|
81
67
|
* determinism convention): exclusive relations ride the backing sparse
|
|
82
68
|
* store's `canonicalIndices`, multi relations ride the same
|
|
83
|
-
* `forEachCanonicalTargetSet` traversal `stateHash`
|
|
84
|
-
* use
|
|
85
|
-
* relation holds no pairs. Cold path
|
|
86
|
-
*
|
|
87
|
-
* point-query forms are `targetOf`
|
|
69
|
+
* `forEachCanonicalTargetSet` traversal that `stateHash` and
|
|
70
|
+
* `snapshotRelations` use. A multi source's targets follow ascending by id.
|
|
71
|
+
* Empty when the relation holds no pairs. Cold path, it allocates the result
|
|
72
|
+
* array, and for multi it sorts each source's target set. Not for per-tick
|
|
73
|
+
* use. The point-query forms are `targetOf` and `targetsOf`. */
|
|
88
74
|
pairsOf(def: RelationDef): readonly (readonly [EntityID, EntityID])[];
|
|
89
75
|
/** Every `(relation, source)` pointing at `tgt`, across **all** registered
|
|
90
|
-
* relation kinds
|
|
76
|
+
* relation kinds, the `(*, T)` wildcard. Walks the relation registry
|
|
91
77
|
* in id order (each relation's reverse index already returns sources
|
|
92
78
|
* ascending by id), so the result is ordered by relation id then source id.
|
|
93
79
|
* Empty when nothing targets `tgt`. The single-relation form is
|
|
94
80
|
* `sourcesOf(tgt, def)`. */
|
|
95
81
|
sourcesOfAny(tgt: EntityID): readonly (readonly [RelationDef, EntityID])[];
|
|
96
|
-
/** The backing sparse component id of relation `R
|
|
97
|
-
* `(R, *)` wildcard term (`Query.
|
|
82
|
+
/** The backing sparse component id of relation `R`, the membership store a
|
|
83
|
+
* `(R, *)` wildcard term (`Query.andRelation`) drives through the shared
|
|
98
84
|
* sparse-match path. Exclusive relations back a `{ target: f64 }` sparse
|
|
99
|
-
* component, multi a tag
|
|
85
|
+
* component, multi a tag. Both carry per-source membership, so "has any
|
|
100
86
|
* `(R, *)` pair" is exactly membership in this store (including an
|
|
101
|
-
* orphan-dangling source, whose membership row persists
|
|
102
|
-
* `pairsOf`). The def is engine-owned and never handed to callers
|
|
103
|
-
* the query builder only its erased id for the `
|
|
87
|
+
* orphan-dangling source, whose membership row persists, consistent with
|
|
88
|
+
* `pairsOf`). The def is engine-owned and never handed to callers. This hands
|
|
89
|
+
* the query builder only its erased id for the `sparseIncludes` list. */
|
|
104
90
|
relationBackingSparseId(def: RelationDef): SparseComponentID;
|
|
105
91
|
/** Drive a `(*, T)` wildcard query (`Query.forEachRelatedTo`): every source
|
|
106
92
|
* related to `target` under **any** relation, intersected with the query's
|
|
107
|
-
* dense mask
|
|
93
|
+
* dense mask, its sparse require and exclude terms, and the default
|
|
94
|
+
* enabled-row filter,
|
|
108
95
|
* each source yielded once. Unions `sourcesOf(target, R)` across every
|
|
109
|
-
* relation into a `Set` (dedup by full `EntityID
|
|
96
|
+
* relation into a `Set` (dedup by full `EntityID`, a source related to `T`
|
|
110
97
|
* via two relations is yielded once), then sorts ascending: the cross-relation
|
|
111
98
|
* union has no inherent order, so one cold sort gives a deterministic,
|
|
112
|
-
* canonical `(*, T)` order matching `sourcesOf`
|
|
113
|
-
* the same way). Cold
|
|
114
|
-
* `
|
|
99
|
+
* canonical `(*, T)` order matching `sourcesOf` and `sourcesOfAny` (which sort
|
|
100
|
+
* the same way). Cold and structural, not a per-tick hot loop over many targets.
|
|
101
|
+
* `sparseIncludes` and `sparseExcludes` carry both raw sparse terms and the backing
|
|
115
102
|
* stores of any composed `(R, *)` terms, so it intersects with them uniformly. */
|
|
116
|
-
|
|
103
|
+
forEachTargetMatch(target: EntityID, include: BitSet, exclude: BitSet | null, anyOf: BitSet | null, terms: QueryTerms, cb: (entityId: EntityID) => void): void;
|
|
117
104
|
/** Reclaim reverse-index memory: drop every relation's reverse entries whose
|
|
118
105
|
* **target** has been destroyed, returning the total dropped across all
|
|
119
|
-
* relations
|
|
106
|
+
* relations. Under the default `orphan` policy a destroyed target
|
|
120
107
|
* leaves its reverse entry intact until each source re-targets or dies, so a
|
|
121
108
|
* long-lived source that orphan-points at a churn of short-lived targets and
|
|
122
109
|
* never re-targets accumulates dead-target keys without bound. This cold-path
|
|
123
|
-
* hook drops them on demand
|
|
110
|
+
* hook drops them on demand, call it at scene or snapshot boundaries.
|
|
124
111
|
*
|
|
125
112
|
* Purely a memory reclaim with no observable state change: forward links stay
|
|
126
113
|
* dangling (so `orphan`'s `targetOf`-returns-the-dead-handle contract is
|
|
127
114
|
* unchanged), `stateHash` is unaffected (the reverse index is derived, never
|
|
128
|
-
* folded), and the dropped entries are faithfully rebuilt by snapshot
|
|
129
|
-
* from the surviving forward links (
|
|
115
|
+
* folded), and the dropped entries are faithfully rebuilt by snapshot and restore
|
|
116
|
+
* from the surviving forward links (the snapshot plugin's
|
|
117
|
+
* `_rebuildRelationIndices`). The only
|
|
130
118
|
* difference a caller can see is `sourcesOf(deadHandle, R)` going from the
|
|
131
|
-
* dangling sources to `[]
|
|
119
|
+
* dangling sources to `[]`, both meaningless once the target is gone.
|
|
132
120
|
* No-op (returns 0) when no relations are registered. */
|
|
133
121
|
compactRelations(): number;
|
|
134
122
|
/** Walk exclusive relation `R` from `src` toward the root, returning the
|
|
@@ -136,34 +124,34 @@ export declare class RelationService {
|
|
|
136
124
|
* inclusive of both endpoints). A source with no target returns `[src]`. The
|
|
137
125
|
* root is the first entity in the chain with no `R`-target, **or** a dangling
|
|
138
126
|
* dead target handle (see below). Throws `RELATION_MODE_MISMATCH` on a multi
|
|
139
|
-
* relation and `RELATION_CYCLE` on a cycle (both `DEV`-only
|
|
127
|
+
* relation and `RELATION_CYCLE` on a cycle (both `DEV`-only, in production
|
|
140
128
|
* a cycle stops at the repeated node).
|
|
141
129
|
*
|
|
142
130
|
* **Dangling links terminate the chain.** Under the `orphan` policy a source
|
|
143
131
|
* keeps pointing at a destroyed target (a dead handle). The walk must *not*
|
|
144
132
|
* advance through such a handle: the backing store is keyed by entity
|
|
145
133
|
* **index**, so reading the dead handle's index would return whatever now
|
|
146
|
-
* occupies that recycled slot
|
|
134
|
+
* occupies that recycled slot, splicing the chain onto an unrelated entity
|
|
147
135
|
* (the ABA the `EntityID`-keyed reverse index avoids for `cascadeOf`). So a
|
|
148
136
|
* dead next-hop is appended as the chain's (dangling) terminus and the walk
|
|
149
|
-
* stops
|
|
137
|
+
* stops. The caller can detect it with `isAlive`, exactly as `targetOf`
|
|
150
138
|
* returns a dead handle. */
|
|
151
139
|
ancestorsOf(src: EntityID, def: RelationDef): EntityID[];
|
|
152
|
-
/** The root of `src`'s exclusive-relation chain
|
|
140
|
+
/** The root of `src`'s exclusive-relation chain, the last entity of
|
|
153
141
|
* `ancestorsOf` (the one with no `R`-target). `src` itself when it has no
|
|
154
142
|
* target. If the chain ends in a dangling dead target handle (orphan policy),
|
|
155
|
-
* that handle is the root
|
|
143
|
+
* that handle is the root, `isAlive`-check the result if dangling links are
|
|
156
144
|
* possible. Same `DEV` guards as `ancestorsOf`. */
|
|
157
145
|
rootOf(src: EntityID, def: RelationDef): EntityID;
|
|
158
146
|
/** Walk exclusive relation `R` **down** from `root` over the reverse index,
|
|
159
|
-
* returning the subtree (including `root`) breadth-first
|
|
147
|
+
* returning the subtree (including `root`) breadth-first, **parents before
|
|
160
148
|
* children** (the `cascade` order). Children of each node come from
|
|
161
149
|
* `sourcesOf` (ascending by id), so the traversal is deterministic. Throws
|
|
162
150
|
* `RELATION_MODE_MISMATCH` on a multi relation and `RELATION_CYCLE` on a cycle
|
|
163
|
-
* (both `DEV`-only
|
|
151
|
+
* (both `DEV`-only, in production an already-visited node is skipped, so
|
|
164
152
|
* it never hangs). */
|
|
165
153
|
cascadeOf(root: EntityID, def: RelationDef): EntityID[];
|
|
166
|
-
/** Purge a destroyed entity from the relation indices
|
|
154
|
+
/** Purge a destroyed entity from the relation indices, its **source** role
|
|
167
155
|
* only: drop its forward target(s) and unlink it from every target's reverse
|
|
168
156
|
* set. The backing sparse membership row is dropped separately by the Store's
|
|
169
157
|
* `_purgeSparse`, so this must run *before* it (it reads the sparse target
|
|
@@ -171,64 +159,64 @@ export declare class RelationService {
|
|
|
171
159
|
* intact: the reverse index is keyed by full `EntityID`, so a recycled slot
|
|
172
160
|
* never aliases the dead target's sources. The destroyed entity's **target**
|
|
173
161
|
* role is handled separately by `cleanupTarget` per each relation's
|
|
174
|
-
* `OnDeleteTarget` policy
|
|
162
|
+
* `OnDeleteTarget` policy. Gated by the caller on `count > 0`. */
|
|
175
163
|
purgeSource(entityId: EntityID): void;
|
|
176
164
|
/** Apply each relation's `OnDeleteTarget` policy for a destroyed **target**
|
|
177
|
-
* `targetId
|
|
165
|
+
* `targetId`. Walks the registry. For every relation whose reverse
|
|
178
166
|
* index has sources pointing at the dead target:
|
|
179
167
|
*
|
|
180
|
-
* - **`delete
|
|
181
|
-
* through the same path, so chains
|
|
168
|
+
* - **`delete`**, append each source to `cascade`. The caller destroys them
|
|
169
|
+
* through the same path, so chains and trees cascade recursively. The sources'
|
|
182
170
|
* own source-role purge (`purgeSource`) drops their forward link and
|
|
183
171
|
* unlinks them from `targetId`'s reverse set, so no reverse entry leaks.
|
|
184
|
-
* - **`clear
|
|
185
|
-
* `rs.unlink(src, targetId)` (exclusive drops the row
|
|
172
|
+
* - **`clear`**, drop each source's link to the dead target in place via
|
|
173
|
+
* `rs.unlink(src, targetId)` (exclusive drops the row, multi removes the
|
|
186
174
|
* target from the set, dropping membership when it empties). Sources
|
|
187
|
-
* survive
|
|
188
|
-
* - **`orphan
|
|
175
|
+
* survive, the cardinality bookkeeping is the relation's, not branched here.
|
|
176
|
+
* - **`orphan`**, skipped (the link is left dangling, safe because the
|
|
189
177
|
* reverse key carries the generation).
|
|
190
178
|
*
|
|
191
179
|
* `sourcesOf` returns a fresh snapshot, so mutating the reverse index while
|
|
192
180
|
* iterating is safe. Gated by the caller on `hasTargetCleanup`, so the
|
|
193
181
|
* whole walk is skipped when no relation opts into a non-`orphan` policy. */
|
|
194
182
|
cleanupTarget(targetId: EntityID, cascade: EntityID[]): void;
|
|
195
|
-
/**
|
|
196
|
-
* sparse-match intersection (dense mask
|
|
197
|
-
* default enabled-row filter)
|
|
183
|
+
/** A query-match path: yield the matched entities, the exact
|
|
184
|
+
* sparse-match intersection (dense mask, sparse require and exclude, and the
|
|
185
|
+
* default enabled-row filter), in canonical **hierarchy depth order** over
|
|
198
186
|
* exclusive relation `R`: depth ascending (parents before children), **entity
|
|
199
187
|
* index ascending within each depth band**. Entities deeper than `maxDepth`
|
|
200
188
|
* are skipped (`Infinity` = unbounded). Only reached via `Query.forEachEntity`
|
|
201
189
|
* on a query carrying a `.hierarchy(R)` term.
|
|
202
190
|
*
|
|
203
|
-
* `.hierarchy(R)` does not narrow the matched set
|
|
191
|
+
* `.hierarchy(R)` does not narrow the matched set. It reorders it, so an
|
|
204
192
|
* entity with no `R`-parent is a root (depth 0) and is yielded first. Depth is a
|
|
205
193
|
* structural property of the *full* tree (an ancestor outside the matched set
|
|
206
194
|
* still counts toward depth), computed by a memoised upward walk shared across
|
|
207
|
-
* the whole batch, so a shared
|
|
195
|
+
* the whole batch, so a shared or deep chain costs O(nodes), not O(nodes²).
|
|
208
196
|
*
|
|
209
|
-
* The canonical order is produced without a comparator sort
|
|
210
|
-
*
|
|
211
|
-
* the host's `forEachSparseMatch
|
|
212
|
-
* ascending
|
|
197
|
+
* The canonical order is produced without a comparator sort, which is far
|
|
198
|
+
* slower: (1) collect the matched ids via
|
|
199
|
+
* the host's `forEachSparseMatch`, (2) `radixSortByIndex` → entity-index
|
|
200
|
+
* ascending, and (3) stable-bucket by depth, since the input is index-ascending
|
|
213
201
|
* and the bucket append is stable, each depth band stays index-ascending.
|
|
214
202
|
* Tuned for the motivating per-tick case (transform propagation): the radix
|
|
215
203
|
* scratch is reused instance state (`_hierarchyRadix*`), so a per-tick pass
|
|
216
|
-
* churns no histograms
|
|
217
|
-
* `visiting`) is still allocated per call, as it must stay call-local for
|
|
204
|
+
* churns no histograms. The working set (`matched`, `buckets`, `depthMemo`
|
|
205
|
+
* and `visiting`) is still allocated per call, as it must stay call-local for
|
|
218
206
|
* re-entrancy.
|
|
219
207
|
*
|
|
220
|
-
* Exclusive-only
|
|
221
|
-
* (mirrors `cascadeOf`
|
|
222
|
-
* `DEV` and a safe break in production. */
|
|
223
|
-
forEachHierarchyMatch(include: BitSet, exclude: BitSet | null, anyOf: BitSet | null,
|
|
208
|
+
* Exclusive-only, a multi relation throws `RELATION_MODE_MISMATCH` in `DEV`
|
|
209
|
+
* (mirrors `cascadeOf` and `ancestorsOf`). A cycle is a loud `RELATION_CYCLE`
|
|
210
|
+
* in `DEV` and a safe break in production. */
|
|
211
|
+
forEachHierarchyMatch(include: BitSet, exclude: BitSet | null, anyOf: BitSet | null, terms: QueryTerms, denseArchetypes: readonly Archetype[], relation: RelationDef, maxDepth: number, cb: (entityId: EntityID) => void): void;
|
|
224
212
|
/** Depth of entity index `idx` in the exclusive-relation tree backing `store`
|
|
225
213
|
* (root = 0), for `forEachHierarchyMatch`. Memoised across the batch (`memo`),
|
|
226
214
|
* so a shared ancestor chain is walked once. Walks upward via the backing store's
|
|
227
215
|
* target field 0 (mirroring `ancestorsOf`), stopping at: a root (no target), an
|
|
228
|
-
* already-memoised node, or a dangling
|
|
229
|
-
* a root
|
|
230
|
-
* `visiting` flags the nodes on the current upward path to catch a cycle
|
|
231
|
-
* `RELATION_CYCLE` in `DEV`, treated as a root in production
|
|
216
|
+
* already-memoised node, or a dangling or dead parent (the child is then treated as
|
|
217
|
+
* a root, never advance through a recycled slot, the ABA `ancestorsOf` guards).
|
|
218
|
+
* `visiting` flags the nodes on the current upward path to catch a cycle,
|
|
219
|
+
* `RELATION_CYCLE` in `DEV`, treated as a root in production, and is emptied
|
|
232
220
|
* on the way back down so it can be reused for the next entity. */
|
|
233
221
|
private _hierarchyDepthOf;
|
|
234
222
|
}
|