@oasys/oecs 0.5.4 → 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 +1223 -266
- package/README.md +217 -112
- package/dist/core/ecs/access_check.d.cts +29 -29
- package/dist/core/ecs/access_check.d.ts +29 -29
- package/dist/core/ecs/access_check.d.ts.map +1 -1
- package/dist/core/ecs/archetype.d.cts +217 -209
- package/dist/core/ecs/archetype.d.ts +217 -209
- 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 +33 -33
- package/dist/core/ecs/archetype_graph.d.ts +33 -33
- 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 +26 -26
- package/dist/core/ecs/command_log.d.ts +26 -26
- package/dist/core/ecs/command_log.d.ts.map +1 -1
- package/dist/core/ecs/component.d.cts +43 -42
- package/dist/core/ecs/component.d.ts +43 -42
- 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 +289 -270
- package/dist/core/ecs/ecs.d.ts +289 -270
- 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 +20 -18
- package/dist/core/ecs/entity_allocator.d.ts +20 -18
- package/dist/core/ecs/entity_allocator.d.ts.map +1 -1
- package/dist/core/ecs/event.d.cts +36 -22
- package/dist/core/ecs/event.d.ts +36 -22
- 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 +32 -32
- package/dist/core/ecs/frame_trace.d.ts +32 -32
- package/dist/core/ecs/frame_trace.d.ts.map +1 -1
- package/dist/core/ecs/host_commands.d.cts +103 -85
- package/dist/core/ecs/host_commands.d.ts +103 -85
- package/dist/core/ecs/host_commands.d.ts.map +1 -1
- package/dist/core/ecs/index.d.cts +21 -11
- package/dist/core/ecs/index.d.ts +21 -11
- package/dist/core/ecs/index.d.ts.map +1 -1
- package/dist/core/ecs/observer.d.cts +39 -120
- package/dist/core/ecs/observer.d.ts +39 -120
- 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 +208 -578
- package/dist/core/ecs/query.d.ts +208 -578
- 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 +100 -39
- package/dist/core/ecs/ref.d.ts +100 -39
- package/dist/core/ecs/ref.d.ts.map +1 -1
- package/dist/core/ecs/relation.d.cts +101 -182
- package/dist/core/ecs/relation.d.ts +101 -182
- package/dist/core/ecs/relation.d.ts.map +1 -1
- package/dist/core/ecs/resource.d.cts +13 -13
- package/dist/core/ecs/resource.d.ts +13 -13
- package/dist/core/ecs/resource_registry.d.cts +5 -5
- package/dist/core/ecs/resource_registry.d.ts +5 -5
- 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 +91 -120
- package/dist/core/ecs/schedule.d.ts +91 -120
- 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 +108 -51
- package/dist/core/ecs/sparse_store.d.ts +108 -51
- package/dist/core/ecs/sparse_store.d.ts.map +1 -1
- package/dist/core/ecs/store.d.cts +527 -473
- package/dist/core/ecs/store.d.ts +527 -473
- package/dist/core/ecs/store.d.ts.map +1 -1
- package/dist/core/ecs/store_layout_listener.d.cts +6 -6
- package/dist/core/ecs/store_layout_listener.d.ts +6 -6
- 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 +146 -61
- package/dist/core/ecs/system.d.ts +146 -61
- 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 +82 -6
- package/dist/core/ecs/utils/error.d.ts +82 -6
- 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 +44 -44
- package/dist/core/store/action_ring.d.ts +44 -44
- package/dist/core/store/action_ring.d.ts.map +1 -1
- package/dist/core/store/allocator.d.cts +149 -95
- package/dist/core/store/allocator.d.ts +149 -95
- package/dist/core/store/allocator.d.ts.map +1 -1
- package/dist/core/store/buffer_backed_column.d.cts +17 -17
- package/dist/core/store/buffer_backed_column.d.ts +17 -17
- package/dist/core/store/buffer_backed_column.d.ts.map +1 -1
- package/dist/core/store/column_store.d.cts +124 -86
- package/dist/core/store/column_store.d.ts +124 -86
- 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 +36 -39
- package/dist/core/store/command_ring.d.ts +36 -39
- package/dist/core/store/command_ring.d.ts.map +1 -1
- package/dist/core/store/descriptor.d.cts +34 -17
- package/dist/core/store/descriptor.d.ts +34 -17
- 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 +36 -38
- package/dist/core/store/event_ring.d.ts +36 -38
- package/dist/core/store/event_ring.d.ts.map +1 -1
- package/dist/core/store/extend.d.cts +13 -7
- package/dist/core/store/extend.d.ts +13 -7
- package/dist/core/store/extend.d.ts.map +1 -1
- package/dist/core/store/grow.d.cts +2 -2
- package/dist/core/store/grow.d.ts +2 -2
- package/dist/core/store/grow.d.ts.map +1 -1
- package/dist/core/store/header.d.cts +31 -27
- package/dist/core/store/header.d.ts +31 -27
- 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 +71 -62
- package/dist/core/store/layout_ops.d.ts +71 -62
- 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 +12 -12
- package/dist/core/store/state_hash.d.ts +12 -12
- 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 +15 -10
- package/dist/index.d.ts +15 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.development.cjs +1 -1
- package/dist/index.development.js +5804 -5203
- package/dist/index.js +5323 -4764
- 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 +54 -54
- package/dist/{extensions → plugins}/editor/editor.d.ts +54 -54
- package/dist/plugins/editor/editor.d.ts.map +1 -0
- package/dist/{extensions → plugins}/editor/field_handle.d.cts +12 -12
- package/dist/{extensions → plugins}/editor/field_handle.d.ts +12 -12
- 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} +81 -64
- package/dist/{extensions/editor/index.js → plugins/editor.js} +81 -64
- 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 +85 -97
- package/dist/{core/ecs → plugins/relations}/relation_service.d.ts +85 -97
- 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 +16 -15
- package/dist/type_primitives/typed_arrays/typed_arrays.d.ts +16 -15
- 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 +3 -3
- package/dist/version.d.ts +3 -3
- 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-BlR3oZ3x.js +0 -2406
- package/dist/host_commands-C2cpU3yC.cjs +0 -1
- package/dist/internal-BoxWl4dG.js +0 -2565
- package/dist/internal-CGBEwfeB.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-Bs39EPh1.js +0 -150
- package/dist/shallow-C5YmTbtb.cjs +0 -1
- package/dist/shallow-CiFC70Dz.js +0 -159
- package/dist/shallow-DQ8aG51_.cjs +0 -1
- package/dist/shared-B4v0L1cw.js +0 -109
- package/dist/shared-DU78k0pU.cjs +0 -1
- package/dist/topological_sort-BDvEyb9W.cjs +0 -1
- package/dist/topological_sort-DK6EjpWa.js +0 -135
- package/dist/typed_arrays-D3NmwtCG.cjs +0 -1
- package/dist/typed_arrays-DIVwVy5_.js +0 -258
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { EventFieldsCover, EventKey, EventReader, EventShape, SignalKey } from '../../core/ecs/event.js';
|
|
2
|
+
import { EventRegistry } from './event_registry.js';
|
|
3
|
+
/** Event channels and signals. Emit during one `update()`, visible to every
|
|
4
|
+
* later system in that call, cleared before the next. System-side reads and
|
|
5
|
+
* emits go through `ctx`. This facade is the host-side surface. */
|
|
6
|
+
export declare class ECSEvents {
|
|
7
|
+
private readonly _registry;
|
|
8
|
+
/** @internal constructed by the events plugin. */
|
|
9
|
+
constructor(registry: EventRegistry);
|
|
10
|
+
/** Register an event channel at world setup, before anything emits on it.
|
|
11
|
+
* `fields` must name every schema key, an under-registered channel would
|
|
12
|
+
* silently drop the missing fields at emit (see `EventFieldsCover`).
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* const Damaged = eventKey<{ target: EntityID; amount: number }>("Damaged");
|
|
16
|
+
* ecs.events.register(Damaged, ["target", "amount"]);
|
|
17
|
+
* ecs.events.emit(Damaged, { target: e, amount: 10 }); // or ctx.emit inside a system
|
|
18
|
+
*/
|
|
19
|
+
register<S extends EventShape<S>, const F extends readonly (keyof S & string)[]>(key: EventKey<S>, fields: F & EventFieldsCover<S, F>): void;
|
|
20
|
+
/** Register a signal (empty-payload event channel). */
|
|
21
|
+
registerSignal(key: SignalKey): void;
|
|
22
|
+
emit(key: SignalKey): void;
|
|
23
|
+
emit<S extends EventShape<S>>(key: EventKey<S>, values: NoInfer<S>): void;
|
|
24
|
+
read<S extends EventShape<S>>(key: EventKey<S>): EventReader<S>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=facade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"facade.d.ts","sourceRoot":"","sources":["../../../src/plugins/events/facade.ts"],"names":[],"mappings":"AAAA;;;;;;;KAOK;AAEL,OAAO,KAAK,EAGX,gBAAgB,EAChB,QAAQ,EACR,WAAW,EACX,UAAU,EACV,SAAS,EACT,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD;;mEAEmE;AACnE,qBAAa,SAAS;IACrB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAgB;IAC1C,kDAAkD;gBACtC,QAAQ,EAAE,aAAa;IAInC;;;;;;;;OAQG;IACI,QAAQ,CAAC,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,EACrF,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,EAChB,MAAM,EAAE,CAAC,GAAG,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,GAChC,IAAI;IAIP,uDAAuD;IAChD,cAAc,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI;IAIpC,IAAI,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI;IAC1B,IAAI,CAAC,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI;IAgBzE,IAAI,CAAC,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC;CAOtE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ECSEvents } from './facade.cjs';
|
|
2
|
+
import { Plugin } from '../../core/ecs/plugin.cjs';
|
|
3
|
+
export { ECSEvents } from './facade.cjs';
|
|
4
|
+
/** The world surface this plugin adds. */
|
|
5
|
+
export interface EventsPlugin {
|
|
6
|
+
readonly events: ECSEvents;
|
|
7
|
+
}
|
|
8
|
+
/** The events plugin, for `ECS.create({ plugins: [events()] })`. */
|
|
9
|
+
export declare function events(): Plugin<EventsPlugin>;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ECSEvents } from './facade.js';
|
|
2
|
+
import { Plugin } from '../../core/ecs/plugin.js';
|
|
3
|
+
export { ECSEvents } from './facade.js';
|
|
4
|
+
/** The world surface this plugin adds. */
|
|
5
|
+
export interface EventsPlugin {
|
|
6
|
+
readonly events: ECSEvents;
|
|
7
|
+
}
|
|
8
|
+
/** The events plugin, for `ECS.create({ plugins: [events()] })`. */
|
|
9
|
+
export declare function events(): Plugin<EventsPlugin>;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/events/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;KAaK;AAGL,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,EAAc,MAAM,uBAAuB,CAAC;AAEhE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,0CAA0C;AAC1C,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;CAC3B;AAED,oEAAoE;AACpE,wBAAgB,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,CAS7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../index.cjs"),h=require("./assertions-z5GQd_bB.cjs");require("../internal.cjs");class c{fieldNames;columns;reader;_readerLen;constructor(e){this.fieldNames=e,this.columns=[];for(let n=0;n<e.length;n++)this.columns.push([]);const t={};for(let n=0;n<e.length;n++)t[e[n]]=this.columns[n];const s={length:0,...t};this._readerLen=s,this.reader=s}emit(e){const t=this.fieldNames,s=this.columns;for(let n=0;n<t.length;n++)s[n].push(e[t[n]]);this._readerLen.length++}emitSignal(){this._readerLen.length++}clear(){this._readerLen.length=0;const e=this.columns;for(let t=0;t<e.length;t++)e[t].length=0}}const o=r=>h.unsafeCast(r);class d{_channels=[];_dirtyChannels=[];_nextEventId=0;_defsByKey=new Map;register(e){const t=o(this._nextEventId++),s=new c(e);return this._channels.push(s),h.unsafeCast(t)}emit(e,t){const s=e,n=this._channels[s],a=n.reader.length===0;n.emit(t),a&&this._dirtyChannels.push(s)}emitSignal(e){const t=e,s=this._channels[t],n=s.reader.length===0;s.emitSignal(),n&&this._dirtyChannels.push(t)}reader(e){return this._channels[e].reader}clear(){const e=this._dirtyChannels;if(e.length===0)return;const t=this._channels;for(let s=0;s<e.length;s++)t[e[s]].clear();e.length=0}devBufferedCount(){const e=this._dirtyChannels,t=this._channels;let s=0;for(let n=0;n<e.length;n++)s+=t[e[n]].reader.length;return s}registerByKey(e,t){if(this._defsByKey.has(e))throw new i.ECSError(i.ECS_ERROR.EVENT_ALREADY_REGISTERED,`event '${e.description??"<unnamed>"}' is already registered`,{event:e.description});const s=this.register(t);return this._defsByKey.set(e,s),s}defByKey(e){const t=this._defsByKey.get(e);if(t===void 0)throw new i.ECSError(i.ECS_ERROR.EVENT_NOT_REGISTERED,`event '${e.description??"<unnamed>"}' is not registered, call ecs.events.register(key, fields) at world setup`,{event:e.description});return t}hasKey(e){return this._defsByKey.has(e)}}class l{_registry;constructor(e){this._registry=e}register(e,t){this._registry.registerByKey(e,t)}registerSignal(e){this._registry.registerByKey(e,[])}emit(e,t){const s=this._registry.defByKey(e);t===void 0?this._registry.emitSignal(s):this._registry.emit(s,t)}read(e){const t=this._registry.defByKey(e);return this._registry.reader(t)}}function g(){return{name:"events",install(r){const e=new d;return r.store.installEvents(e),{events:new l(e)}}}}exports.ECSEvents=l;exports.events=g;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./events/index.cjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./events/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../index.development.cjs"),c=require("./assertions-z5GQd_bB.cjs"),h=require("../internal.development.cjs");class l{fieldNames;columns;reader;_readerLen;constructor(e){this.fieldNames=e,this.columns=[];for(let s=0;s<e.length;s++)this.columns.push([]);const t={};for(let s=0;s<e.length;s++)t[e[s]]=this.columns[s];const n={length:0,...t};this._readerLen=n,this.reader=n}emit(e){const t=this.fieldNames,n=this.columns;for(let s=0;s<t.length;s++)if(!(t[s]in e))throw new i.ECSError(i.ECS_ERROR.FIELD_NOT_REGISTERED,`emit: event field "${t[s]}" missing from values`);for(let s=0;s<t.length;s++)n[s].push(e[t[s]]);this._readerLen.length++}emitSignal(){this._readerLen.length++}clear(){this._readerLen.length=0;const e=this.columns;for(let t=0;t<e.length;t++)e[t].length=0}}const d=r=>{if(!(Number.isInteger(r)&&r>=0))throw new i.ECSError(i.ECS_ERROR.INVALID_EVENT_ID,`event id must be an integer >= 0, got ${r}`);return c.unsafeCast(r)};class g{_channels=[];_dirtyChannels=[];_nextEventId=0;_defsByKey=new Map;register(e){const t=d(this._nextEventId++),n=new l(e);return this._channels.push(n),c.unsafeCast(t)}emit(e,t){const n=e,s=this._channels[n],a=s.reader.length===0;s.emit(t),a&&this._dirtyChannels.push(n)}emitSignal(e){const t=e,n=this._channels[t],s=n.reader.length===0;n.emitSignal(),s&&this._dirtyChannels.push(t)}reader(e){return this._channels[e].reader}clear(){const e=this._dirtyChannels;if(e.length===0)return;const t=this._channels;for(let n=0;n<e.length;n++)t[e[n]].clear();e.length=0}devBufferedCount(){const e=this._dirtyChannels,t=this._channels;let n=0;for(let s=0;s<e.length;s++)n+=t[e[s]].reader.length;return n}registerByKey(e,t){if(this._defsByKey.has(e))throw new i.ECSError(i.ECS_ERROR.EVENT_ALREADY_REGISTERED,`event '${e.description??"<unnamed>"}' is already registered`,{event:e.description});const n=this.register(t);return this._defsByKey.set(e,n),n}defByKey(e){const t=this._defsByKey.get(e);if(t===void 0)throw new i.ECSError(i.ECS_ERROR.EVENT_NOT_REGISTERED,`event '${e.description??"<unnamed>"}' is not registered, call ecs.events.register(key, fields) at world setup`,{event:e.description});return t}hasKey(e){return this._defsByKey.has(e)}}class o{_registry;constructor(e){this._registry=e}register(e,t){this._registry.registerByKey(e,t)}registerSignal(e){this._registry.registerByKey(e,[])}emit(e,t){h.dispatchTrace.isActive()&&h.dispatchTrace.recordEventEmit(e.description??"");const n=this._registry.defByKey(e);t===void 0?this._registry.emitSignal(n):this._registry.emit(n,t)}read(e){h.dispatchTrace.isActive()&&h.dispatchTrace.recordEventRead(e.description??"");const t=this._registry.defByKey(e);return this._registry.reader(t)}}function E(){return{name:"events",install(r){const e=new g;return r.store.installEvents(e),{events:new o(e)}}}}exports.ECSEvents=o;exports.events=E;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { ECSError as h, ECS_ERROR as o } from "../index.development.js";
|
|
2
|
+
import { u as l } from "./assertions-gtDVfbnQ.js";
|
|
3
|
+
import { dispatchTrace as i } from "../internal.development.js";
|
|
4
|
+
class a {
|
|
5
|
+
fieldNames;
|
|
6
|
+
columns;
|
|
7
|
+
// any: type-erased storage, channel is stored in Map<number, EventChannel>, S is lost
|
|
8
|
+
reader;
|
|
9
|
+
// The one mutable view of the reader's `length`. The public `EventReader`
|
|
10
|
+
// type declares it readonly (a consumer writing `reader.length = 0` on the
|
|
11
|
+
// live shared object would permanently desync every other system's view),
|
|
12
|
+
// so the channel keeps this private alias to the same
|
|
13
|
+
// object for emit and clear bookkeeping.
|
|
14
|
+
_readerLen;
|
|
15
|
+
constructor(e) {
|
|
16
|
+
this.fieldNames = e, this.columns = [];
|
|
17
|
+
for (let n = 0; n < e.length; n++)
|
|
18
|
+
this.columns.push([]);
|
|
19
|
+
const t = {};
|
|
20
|
+
for (let n = 0; n < e.length; n++)
|
|
21
|
+
t[e[n]] = this.columns[n];
|
|
22
|
+
const s = { length: 0, ...t };
|
|
23
|
+
this._readerLen = s, this.reader = s;
|
|
24
|
+
}
|
|
25
|
+
emit(e) {
|
|
26
|
+
const t = this.fieldNames, s = this.columns;
|
|
27
|
+
for (let n = 0; n < t.length; n++)
|
|
28
|
+
if (!(t[n] in e))
|
|
29
|
+
throw new h(
|
|
30
|
+
o.FIELD_NOT_REGISTERED,
|
|
31
|
+
`emit: event field "${t[n]}" missing from values`
|
|
32
|
+
);
|
|
33
|
+
for (let n = 0; n < t.length; n++) s[n].push(e[t[n]]);
|
|
34
|
+
this._readerLen.length++;
|
|
35
|
+
}
|
|
36
|
+
/** Emit a signal (zero-field event). */
|
|
37
|
+
emitSignal() {
|
|
38
|
+
this._readerLen.length++;
|
|
39
|
+
}
|
|
40
|
+
clear() {
|
|
41
|
+
this._readerLen.length = 0;
|
|
42
|
+
const e = this.columns;
|
|
43
|
+
for (let t = 0; t < e.length; t++)
|
|
44
|
+
e[t].length = 0;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const d = (r) => {
|
|
48
|
+
if (!(Number.isInteger(r) && r >= 0))
|
|
49
|
+
throw new h(
|
|
50
|
+
o.INVALID_EVENT_ID,
|
|
51
|
+
`event id must be an integer >= 0, got ${r}`
|
|
52
|
+
);
|
|
53
|
+
return l(r);
|
|
54
|
+
};
|
|
55
|
+
class g {
|
|
56
|
+
// Parallel array indexed by EventID: each channel holds SoA columns + reader.
|
|
57
|
+
_channels = [];
|
|
58
|
+
// IDs of channels emitted to since the last `clear()`. An `emit*`
|
|
59
|
+
// only pushes when the channel was empty (`reader.length === 0`), so each
|
|
60
|
+
// dirty channel appears at most once per tick, `clear` then walks
|
|
61
|
+
// only these instead of every registered channel.
|
|
62
|
+
_dirtyChannels = [];
|
|
63
|
+
_nextEventId = 0;
|
|
64
|
+
// any: type-erased. EventDef<F> phantom is lost in the map, recovered by
|
|
65
|
+
// callers via EventKey<F>
|
|
66
|
+
_defsByKey = /* @__PURE__ */ new Map();
|
|
67
|
+
register(e) {
|
|
68
|
+
const t = d(this._nextEventId++), s = new a(e);
|
|
69
|
+
return this._channels.push(s), l(t);
|
|
70
|
+
}
|
|
71
|
+
emit(e, t) {
|
|
72
|
+
const s = e, n = this._channels[s], c = n.reader.length === 0;
|
|
73
|
+
n.emit(t), c && this._dirtyChannels.push(s);
|
|
74
|
+
}
|
|
75
|
+
emitSignal(e) {
|
|
76
|
+
const t = e, s = this._channels[t], n = s.reader.length === 0;
|
|
77
|
+
s.emitSignal(), n && this._dirtyChannels.push(t);
|
|
78
|
+
}
|
|
79
|
+
reader(e) {
|
|
80
|
+
return this._channels[e].reader;
|
|
81
|
+
}
|
|
82
|
+
clear() {
|
|
83
|
+
const e = this._dirtyChannels;
|
|
84
|
+
if (e.length === 0) return;
|
|
85
|
+
const t = this._channels;
|
|
86
|
+
for (let s = 0; s < e.length; s++)
|
|
87
|
+
t[e[s]].clear();
|
|
88
|
+
e.length = 0;
|
|
89
|
+
}
|
|
90
|
+
/** `DEV`-only: total events currently buffered across the dirty channels.
|
|
91
|
+
* `ECS.update` samples this either side of the settle hooks to assert an
|
|
92
|
+
* onSet observer emitted nothing, its emissions would be wiped by the
|
|
93
|
+
* tick-tail `clear` and break the empty-channel-at-boundary invariant that
|
|
94
|
+
* snapshot and restore rely on. Walks only the dirty list, never the hot emit path. */
|
|
95
|
+
devBufferedCount() {
|
|
96
|
+
const e = this._dirtyChannels, t = this._channels;
|
|
97
|
+
let s = 0;
|
|
98
|
+
for (let n = 0; n < e.length; n++) s += t[e[n]].reader.length;
|
|
99
|
+
return s;
|
|
100
|
+
}
|
|
101
|
+
registerByKey(e, t) {
|
|
102
|
+
if (this._defsByKey.has(e))
|
|
103
|
+
throw new h(
|
|
104
|
+
o.EVENT_ALREADY_REGISTERED,
|
|
105
|
+
`event '${e.description ?? "<unnamed>"}' is already registered`,
|
|
106
|
+
{ event: e.description }
|
|
107
|
+
);
|
|
108
|
+
const s = this.register(t);
|
|
109
|
+
return this._defsByKey.set(e, s), s;
|
|
110
|
+
}
|
|
111
|
+
// any: type-erased, caller recovers F from EventKey<F>
|
|
112
|
+
defByKey(e) {
|
|
113
|
+
const t = this._defsByKey.get(e);
|
|
114
|
+
if (t === void 0)
|
|
115
|
+
throw new h(
|
|
116
|
+
o.EVENT_NOT_REGISTERED,
|
|
117
|
+
`event '${e.description ?? "<unnamed>"}' is not registered, call ecs.events.register(key, fields) at world setup`,
|
|
118
|
+
{ event: e.description }
|
|
119
|
+
);
|
|
120
|
+
return t;
|
|
121
|
+
}
|
|
122
|
+
hasKey(e) {
|
|
123
|
+
return this._defsByKey.has(e);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
class _ {
|
|
127
|
+
_registry;
|
|
128
|
+
/** @internal constructed by the events plugin. */
|
|
129
|
+
constructor(e) {
|
|
130
|
+
this._registry = e;
|
|
131
|
+
}
|
|
132
|
+
/** Register an event channel at world setup, before anything emits on it.
|
|
133
|
+
* `fields` must name every schema key, an under-registered channel would
|
|
134
|
+
* silently drop the missing fields at emit (see `EventFieldsCover`).
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* const Damaged = eventKey<{ target: EntityID; amount: number }>("Damaged");
|
|
138
|
+
* ecs.events.register(Damaged, ["target", "amount"]);
|
|
139
|
+
* ecs.events.emit(Damaged, { target: e, amount: 10 }); // or ctx.emit inside a system
|
|
140
|
+
*/
|
|
141
|
+
register(e, t) {
|
|
142
|
+
this._registry.registerByKey(e, t);
|
|
143
|
+
}
|
|
144
|
+
/** Register a signal (empty-payload event channel). */
|
|
145
|
+
registerSignal(e) {
|
|
146
|
+
this._registry.registerByKey(e, []);
|
|
147
|
+
}
|
|
148
|
+
// Erased implementation position spells `<any>`, not the bare/`unknown`
|
|
149
|
+
// form, `EventKey` is invariant under the typestate seams (function-typed
|
|
150
|
+
// phantom), so only `<any>` erases (see project typestate constraints).
|
|
151
|
+
emit(e, t) {
|
|
152
|
+
i.isActive() && i.recordEventEmit(e.description ?? "");
|
|
153
|
+
const s = this._registry.defByKey(e);
|
|
154
|
+
t === void 0 ? this._registry.emitSignal(s) : this._registry.emit(s, t);
|
|
155
|
+
}
|
|
156
|
+
read(e) {
|
|
157
|
+
i.isActive() && i.recordEventRead(e.description ?? "");
|
|
158
|
+
const t = this._registry.defByKey(e);
|
|
159
|
+
return this._registry.reader(t);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function E() {
|
|
163
|
+
return {
|
|
164
|
+
name: "events",
|
|
165
|
+
install(r) {
|
|
166
|
+
const e = new g();
|
|
167
|
+
return r.store.installEvents(e), { events: new _(e) };
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
export {
|
|
172
|
+
_ as ECSEvents,
|
|
173
|
+
E as events
|
|
174
|
+
};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { ECSError as i, ECS_ERROR as h } from "../index.js";
|
|
2
|
+
import { u as l } from "./assertions-gtDVfbnQ.js";
|
|
3
|
+
import "../internal.js";
|
|
4
|
+
class o {
|
|
5
|
+
fieldNames;
|
|
6
|
+
columns;
|
|
7
|
+
// any: type-erased storage, channel is stored in Map<number, EventChannel>, S is lost
|
|
8
|
+
reader;
|
|
9
|
+
// The one mutable view of the reader's `length`. The public `EventReader`
|
|
10
|
+
// type declares it readonly (a consumer writing `reader.length = 0` on the
|
|
11
|
+
// live shared object would permanently desync every other system's view),
|
|
12
|
+
// so the channel keeps this private alias to the same
|
|
13
|
+
// object for emit and clear bookkeeping.
|
|
14
|
+
_readerLen;
|
|
15
|
+
constructor(e) {
|
|
16
|
+
this.fieldNames = e, this.columns = [];
|
|
17
|
+
for (let n = 0; n < e.length; n++)
|
|
18
|
+
this.columns.push([]);
|
|
19
|
+
const t = {};
|
|
20
|
+
for (let n = 0; n < e.length; n++)
|
|
21
|
+
t[e[n]] = this.columns[n];
|
|
22
|
+
const s = { length: 0, ...t };
|
|
23
|
+
this._readerLen = s, this.reader = s;
|
|
24
|
+
}
|
|
25
|
+
emit(e) {
|
|
26
|
+
const t = this.fieldNames, s = this.columns;
|
|
27
|
+
for (let n = 0; n < t.length; n++) s[n].push(e[t[n]]);
|
|
28
|
+
this._readerLen.length++;
|
|
29
|
+
}
|
|
30
|
+
/** Emit a signal (zero-field event). */
|
|
31
|
+
emitSignal() {
|
|
32
|
+
this._readerLen.length++;
|
|
33
|
+
}
|
|
34
|
+
clear() {
|
|
35
|
+
this._readerLen.length = 0;
|
|
36
|
+
const e = this.columns;
|
|
37
|
+
for (let t = 0; t < e.length; t++)
|
|
38
|
+
e[t].length = 0;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const c = (r) => l(r);
|
|
42
|
+
class d {
|
|
43
|
+
// Parallel array indexed by EventID: each channel holds SoA columns + reader.
|
|
44
|
+
_channels = [];
|
|
45
|
+
// IDs of channels emitted to since the last `clear()`. An `emit*`
|
|
46
|
+
// only pushes when the channel was empty (`reader.length === 0`), so each
|
|
47
|
+
// dirty channel appears at most once per tick, `clear` then walks
|
|
48
|
+
// only these instead of every registered channel.
|
|
49
|
+
_dirtyChannels = [];
|
|
50
|
+
_nextEventId = 0;
|
|
51
|
+
// any: type-erased. EventDef<F> phantom is lost in the map, recovered by
|
|
52
|
+
// callers via EventKey<F>
|
|
53
|
+
_defsByKey = /* @__PURE__ */ new Map();
|
|
54
|
+
register(e) {
|
|
55
|
+
const t = c(this._nextEventId++), s = new o(e);
|
|
56
|
+
return this._channels.push(s), l(t);
|
|
57
|
+
}
|
|
58
|
+
emit(e, t) {
|
|
59
|
+
const s = e, n = this._channels[s], a = n.reader.length === 0;
|
|
60
|
+
n.emit(t), a && this._dirtyChannels.push(s);
|
|
61
|
+
}
|
|
62
|
+
emitSignal(e) {
|
|
63
|
+
const t = e, s = this._channels[t], n = s.reader.length === 0;
|
|
64
|
+
s.emitSignal(), n && this._dirtyChannels.push(t);
|
|
65
|
+
}
|
|
66
|
+
reader(e) {
|
|
67
|
+
return this._channels[e].reader;
|
|
68
|
+
}
|
|
69
|
+
clear() {
|
|
70
|
+
const e = this._dirtyChannels;
|
|
71
|
+
if (e.length === 0) return;
|
|
72
|
+
const t = this._channels;
|
|
73
|
+
for (let s = 0; s < e.length; s++)
|
|
74
|
+
t[e[s]].clear();
|
|
75
|
+
e.length = 0;
|
|
76
|
+
}
|
|
77
|
+
/** `DEV`-only: total events currently buffered across the dirty channels.
|
|
78
|
+
* `ECS.update` samples this either side of the settle hooks to assert an
|
|
79
|
+
* onSet observer emitted nothing, its emissions would be wiped by the
|
|
80
|
+
* tick-tail `clear` and break the empty-channel-at-boundary invariant that
|
|
81
|
+
* snapshot and restore rely on. Walks only the dirty list, never the hot emit path. */
|
|
82
|
+
devBufferedCount() {
|
|
83
|
+
const e = this._dirtyChannels, t = this._channels;
|
|
84
|
+
let s = 0;
|
|
85
|
+
for (let n = 0; n < e.length; n++) s += t[e[n]].reader.length;
|
|
86
|
+
return s;
|
|
87
|
+
}
|
|
88
|
+
registerByKey(e, t) {
|
|
89
|
+
if (this._defsByKey.has(e))
|
|
90
|
+
throw new i(
|
|
91
|
+
h.EVENT_ALREADY_REGISTERED,
|
|
92
|
+
`event '${e.description ?? "<unnamed>"}' is already registered`,
|
|
93
|
+
{ event: e.description }
|
|
94
|
+
);
|
|
95
|
+
const s = this.register(t);
|
|
96
|
+
return this._defsByKey.set(e, s), s;
|
|
97
|
+
}
|
|
98
|
+
// any: type-erased, caller recovers F from EventKey<F>
|
|
99
|
+
defByKey(e) {
|
|
100
|
+
const t = this._defsByKey.get(e);
|
|
101
|
+
if (t === void 0)
|
|
102
|
+
throw new i(
|
|
103
|
+
h.EVENT_NOT_REGISTERED,
|
|
104
|
+
`event '${e.description ?? "<unnamed>"}' is not registered, call ecs.events.register(key, fields) at world setup`,
|
|
105
|
+
{ event: e.description }
|
|
106
|
+
);
|
|
107
|
+
return t;
|
|
108
|
+
}
|
|
109
|
+
hasKey(e) {
|
|
110
|
+
return this._defsByKey.has(e);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
class g {
|
|
114
|
+
_registry;
|
|
115
|
+
/** @internal constructed by the events plugin. */
|
|
116
|
+
constructor(e) {
|
|
117
|
+
this._registry = e;
|
|
118
|
+
}
|
|
119
|
+
/** Register an event channel at world setup, before anything emits on it.
|
|
120
|
+
* `fields` must name every schema key, an under-registered channel would
|
|
121
|
+
* silently drop the missing fields at emit (see `EventFieldsCover`).
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* const Damaged = eventKey<{ target: EntityID; amount: number }>("Damaged");
|
|
125
|
+
* ecs.events.register(Damaged, ["target", "amount"]);
|
|
126
|
+
* ecs.events.emit(Damaged, { target: e, amount: 10 }); // or ctx.emit inside a system
|
|
127
|
+
*/
|
|
128
|
+
register(e, t) {
|
|
129
|
+
this._registry.registerByKey(e, t);
|
|
130
|
+
}
|
|
131
|
+
/** Register a signal (empty-payload event channel). */
|
|
132
|
+
registerSignal(e) {
|
|
133
|
+
this._registry.registerByKey(e, []);
|
|
134
|
+
}
|
|
135
|
+
// Erased implementation position spells `<any>`, not the bare/`unknown`
|
|
136
|
+
// form, `EventKey` is invariant under the typestate seams (function-typed
|
|
137
|
+
// phantom), so only `<any>` erases (see project typestate constraints).
|
|
138
|
+
emit(e, t) {
|
|
139
|
+
const s = this._registry.defByKey(e);
|
|
140
|
+
t === void 0 ? this._registry.emitSignal(s) : this._registry.emit(s, t);
|
|
141
|
+
}
|
|
142
|
+
read(e) {
|
|
143
|
+
const t = this._registry.defByKey(e);
|
|
144
|
+
return this._registry.reader(t);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function f() {
|
|
148
|
+
return {
|
|
149
|
+
name: "events",
|
|
150
|
+
install(r) {
|
|
151
|
+
const e = new d();
|
|
152
|
+
return r.store.installEvents(e), { events: new g(e) };
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
export {
|
|
157
|
+
g as ECSEvents,
|
|
158
|
+
f as events
|
|
159
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Plugin } from '../../core/ecs/plugin.cjs';
|
|
2
|
+
import { ArchetypeSetObserverConfig, EntitySetObserverConfig, ObserverHandle, StructuralObserverConfig } from '../../core/ecs/observer.cjs';
|
|
3
|
+
import { ComponentHandle } from '../../core/ecs/component.cjs';
|
|
4
|
+
import { SparseComponentDef } from '../../core/ecs/sparse_store.cjs';
|
|
5
|
+
export { ObserverRegistry } from './observer_registry.cjs';
|
|
6
|
+
/** The world surface this plugin adds. The overloads match the ones `ECS`
|
|
7
|
+
* carried before the split, so a call site does not change.
|
|
8
|
+
*
|
|
9
|
+
* `observe` registers the callbacks in `config` against `def`. `onAdd`,
|
|
10
|
+
* `onRemove`, `onDisable` and `onEnable` fire at the structural flush, after
|
|
11
|
+
* the batch commits, in canonical order (access-topological across
|
|
12
|
+
* observers, entity id order within), and the flush loops to a fixed point
|
|
13
|
+
* so a cascade settles. `onSet` fires at the settle of `update()`. Register
|
|
14
|
+
* before `startup()`. The handle's `dispose()` unregisters. Cold path. */
|
|
15
|
+
export interface ObserversPlugin {
|
|
16
|
+
observe(def: ComponentHandle, config: StructuralObserverConfig): ObserverHandle;
|
|
17
|
+
observe(def: ComponentHandle, config: EntitySetObserverConfig): ObserverHandle;
|
|
18
|
+
observe(def: ComponentHandle, config: ArchetypeSetObserverConfig): ObserverHandle;
|
|
19
|
+
observe(def: SparseComponentDef, config: EntitySetObserverConfig): ObserverHandle;
|
|
20
|
+
}
|
|
21
|
+
/** The observers plugin, for `ECS.create({ plugins: [observers()] })`. */
|
|
22
|
+
export declare function observers(): Plugin<ObserversPlugin>;
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Plugin } from '../../core/ecs/plugin.js';
|
|
2
|
+
import { ArchetypeSetObserverConfig, EntitySetObserverConfig, ObserverHandle, StructuralObserverConfig } from '../../core/ecs/observer.js';
|
|
3
|
+
import { ComponentHandle } from '../../core/ecs/component.js';
|
|
4
|
+
import { SparseComponentDef } from '../../core/ecs/sparse_store.js';
|
|
5
|
+
export { ObserverRegistry } from './observer_registry.js';
|
|
6
|
+
/** The world surface this plugin adds. The overloads match the ones `ECS`
|
|
7
|
+
* carried before the split, so a call site does not change.
|
|
8
|
+
*
|
|
9
|
+
* `observe` registers the callbacks in `config` against `def`. `onAdd`,
|
|
10
|
+
* `onRemove`, `onDisable` and `onEnable` fire at the structural flush, after
|
|
11
|
+
* the batch commits, in canonical order (access-topological across
|
|
12
|
+
* observers, entity id order within), and the flush loops to a fixed point
|
|
13
|
+
* so a cascade settles. `onSet` fires at the settle of `update()`. Register
|
|
14
|
+
* before `startup()`. The handle's `dispose()` unregisters. Cold path. */
|
|
15
|
+
export interface ObserversPlugin {
|
|
16
|
+
observe(def: ComponentHandle, config: StructuralObserverConfig): ObserverHandle;
|
|
17
|
+
observe(def: ComponentHandle, config: EntitySetObserverConfig): ObserverHandle;
|
|
18
|
+
observe(def: ComponentHandle, config: ArchetypeSetObserverConfig): ObserverHandle;
|
|
19
|
+
observe(def: SparseComponentDef, config: EntitySetObserverConfig): ObserverHandle;
|
|
20
|
+
}
|
|
21
|
+
/** The observers plugin, for `ECS.create({ plugins: [observers()] })`. */
|
|
22
|
+
export declare function observers(): Plugin<ObserversPlugin>;
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/observers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;KAiBK;AAGL,OAAO,KAAK,EAAE,MAAM,EAAc,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EACX,0BAA0B,EAC1B,uBAAuB,EAEvB,cAAc,EACd,wBAAwB,EACxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;;;;0EAQ0E;AAC1E,MAAM,WAAW,eAAe;IAC/B,OAAO,CAAC,GAAG,EAAE,eAAe,EAAE,MAAM,EAAE,wBAAwB,GAAG,cAAc,CAAC;IAChF,OAAO,CAAC,GAAG,EAAE,eAAe,EAAE,MAAM,EAAE,uBAAuB,GAAG,cAAc,CAAC;IAC/E,OAAO,CAAC,GAAG,EAAE,eAAe,EAAE,MAAM,EAAE,0BAA0B,GAAG,cAAc,CAAC;IAClF,OAAO,CAAC,GAAG,EAAE,kBAAkB,EAAE,MAAM,EAAE,uBAAuB,GAAG,cAAc,CAAC;CAClF;AAED,0EAA0E;AAC1E,wBAAgB,SAAS,IAAI,MAAM,CAAC,eAAe,CAAC,CAoBnD"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { ComponentHandle } from '../../core/ecs/component.cjs';
|
|
2
|
+
import { SparseComponentDef } from '../../core/ecs/sparse_store.cjs';
|
|
3
|
+
import { SystemContext } from '../../core/ecs/system_context.cjs';
|
|
4
|
+
import { StructuralObserverEvents } from '../../core/ecs/store.cjs';
|
|
5
|
+
import { SystemDescriptor } from '../../core/ecs/system.cjs';
|
|
6
|
+
import { ObserverConfig, ObserverHandle, ObserverHooks, ObserverHost } from '../../core/ecs/observer.cjs';
|
|
7
|
+
/**
|
|
8
|
+
* Registry of component observers. Owned by the observers plugin, which builds
|
|
9
|
+
* it at install. The store calls `dispatchStructural` through its structural
|
|
10
|
+
* hook between fixed-point rounds of `flushStructural`, and the world calls
|
|
11
|
+
* `dispatchSet` through the plugin's settle hook at the post-update detection
|
|
12
|
+
* point.
|
|
13
|
+
*/
|
|
14
|
+
export declare class ObserverRegistry implements ObserverHooks {
|
|
15
|
+
private readonly _store;
|
|
16
|
+
private readonly _ctx;
|
|
17
|
+
private readonly _entries;
|
|
18
|
+
/** ComponentID → its observers (structural + onSet). */
|
|
19
|
+
private readonly _byCid;
|
|
20
|
+
/** The entity-level onSet observers on sparse components, in registration
|
|
21
|
+
* order. */
|
|
22
|
+
private readonly _sparseEntries;
|
|
23
|
+
/** Per-`dispatchSet` cache of each sparse component's drain, so two
|
|
24
|
+
* observers on one sparse component fire over one snapshot. */
|
|
25
|
+
private readonly _sparseDrainCache;
|
|
26
|
+
/** Cached access-topological order. A register or a dispose invalidates it. */
|
|
27
|
+
private _topo;
|
|
28
|
+
private readonly _addBuckets;
|
|
29
|
+
private readonly _remBuckets;
|
|
30
|
+
private readonly _disBuckets;
|
|
31
|
+
private readonly _enaBuckets;
|
|
32
|
+
private _radixOut;
|
|
33
|
+
private readonly _radixC0;
|
|
34
|
+
private readonly _radixC1;
|
|
35
|
+
private readonly _setDrainCache;
|
|
36
|
+
constructor(_store: ObserverHost, _ctx: SystemContext);
|
|
37
|
+
get count(): number;
|
|
38
|
+
/** The synthesized `SystemDescriptor`s of every registered observer, in
|
|
39
|
+
* registration order (`dispose()` splices entries out, so none are stale).
|
|
40
|
+
* Fed into the `startup()` archetype-prewarm closure so an observer's declared
|
|
41
|
+
* `spawns` and `transitions` create their target archetypes eagerly, exactly as a
|
|
42
|
+
* system's do. Without this an archetype an observer spawns into or transitions to
|
|
43
|
+
* first-touches lazily mid-tick, the one asymmetry left in the otherwise
|
|
44
|
+
* uniform "no lazy archetypes" prewarm. */
|
|
45
|
+
descriptors(): SystemDescriptor[];
|
|
46
|
+
register(def: ComponentHandle | SparseComponentDef, config: ObserverConfig): ObserverHandle;
|
|
47
|
+
/** The sparse arm of `register`: an entity-level onSet, and nothing else.
|
|
48
|
+
* A sparse add and remove are immediate and touch no archetype, so there
|
|
49
|
+
* is no flush boundary to fire a structural observer at, and no archetype
|
|
50
|
+
* column for the archetype grain. */
|
|
51
|
+
private _registerSparse;
|
|
52
|
+
private _dispose;
|
|
53
|
+
/** Recompute the component's hot-path observation flags from its live
|
|
54
|
+
* observers and push them to the store (which owns the flags + fast-path
|
|
55
|
+
* counters). */
|
|
56
|
+
private _reconfigureComponent;
|
|
57
|
+
private _getTopo;
|
|
58
|
+
/**
|
|
59
|
+
* Fire onAdd, onRemove, onDisable and onEnable for one fixed-point round's
|
|
60
|
+
* effective events, in canonical order: access-topological across observers,
|
|
61
|
+
* entity-id order (radix) within each observer. Called through the store's
|
|
62
|
+
* structural hook after the batch commits. Observer callbacks may
|
|
63
|
+
* enqueue further structural ops (or toggles) onto the deferred buffers (the
|
|
64
|
+
* store loops until quiescent).
|
|
65
|
+
*
|
|
66
|
+
* The events arrive as flat `(comp, eid)` parallel arrays collected during the
|
|
67
|
+
* flush. This dispatch buckets by component once (O(K)), then walks observers
|
|
68
|
+
* in topo order so a producer's writes are visible to a consumer
|
|
69
|
+
* (glitch-free). A round
|
|
70
|
+
* carries either structural (add, remove) or toggle (disable, enable) events, never both,
|
|
71
|
+
* toggles drain only once add, remove and destroy are quiescent (`flushStructural`),
|
|
72
|
+
* but all four bucket uniformly. The empty pairs are no-ops. Within an
|
|
73
|
+
* observer the fire order is remove, add, disable, enable (the "leaving" edges
|
|
74
|
+
* before the "entering" edges).
|
|
75
|
+
*/
|
|
76
|
+
dispatchStructural(ev: StructuralObserverEvents): void;
|
|
77
|
+
/** Radix-sort `eids` by entity index (canonical within-observer order), then
|
|
78
|
+
* fire `fn` per entity under the observer's access scope. */
|
|
79
|
+
private _fireEach;
|
|
80
|
+
private _bucket;
|
|
81
|
+
private _clearBuckets;
|
|
82
|
+
/**
|
|
83
|
+
* Fire onSet observers for the current frame, in canonical order. Per-entity
|
|
84
|
+
* onSet drains the opt-in dirty list, once for each changed entity.
|
|
85
|
+
* Archetype-granular onSet scans the change tick, once for each changed
|
|
86
|
+
* archetype column.
|
|
87
|
+
* Called through the plugin's settle hook, after every phase of the frame.
|
|
88
|
+
* `run` is the change tick advanced
|
|
89
|
+
* for this dispatch: above every system run of the frame, and the baseline
|
|
90
|
+
* each archetype-granular observer keeps for its next dispatch.
|
|
91
|
+
*/
|
|
92
|
+
dispatchSet(run: number): void;
|
|
93
|
+
/** Fire one sparse observer over the members recorded since the last
|
|
94
|
+
* drain. The store's walk gives alive, member and enabled entities, so no
|
|
95
|
+
* check remains here. Canonical order by entity index, through the radix. */
|
|
96
|
+
private _dispatchSparseSet;
|
|
97
|
+
private _dispatchSetEntity;
|
|
98
|
+
private _dispatchSetArch;
|
|
99
|
+
private _yieldExisting;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=observer_registry.d.ts.map
|