@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
|
@@ -1,62 +1,60 @@
|
|
|
1
|
-
import { ArchetypeView } from './
|
|
2
|
-
import {
|
|
1
|
+
import { ArchetypeView } from './archetype_types.cjs';
|
|
2
|
+
import { ChangeFeed } from './change_feed.cjs';
|
|
3
3
|
import { EntityID } from './entity.cjs';
|
|
4
4
|
import { FrameTraceSink } from './frame_trace.cjs';
|
|
5
|
-
import { SystemContext } from './
|
|
6
|
-
import { StructuralObserverEvents } from './store.cjs';
|
|
5
|
+
import { SystemContext } from './system_context.cjs';
|
|
7
6
|
import { SystemAccessDeclaration, SystemDescriptor } from './system.cjs';
|
|
8
|
-
/** What the observer registry needs from `Store
|
|
9
|
-
*
|
|
7
|
+
/** What the observer registry needs from `Store`: the change feed every
|
|
8
|
+
* consumer shares, plus the dev-only trace sink. `Store` implements this. The
|
|
10
9
|
* registry holds only this view, so the compiler bounds what observer dispatch
|
|
11
|
-
* can touch
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
readonly _tick: number;
|
|
16
|
-
/** Dev-only frame-trace sink (`null` when unset; always null in prod). */
|
|
17
|
-
readonly _trace: FrameTraceSink | null;
|
|
18
|
-
/** Sync a component's observation flags (add/remove/disable/enable/dirty). */
|
|
19
|
-
_configureComponentObservation(cid: number, hasAdd: boolean, hasRem: boolean, hasDisable: boolean, hasEnable: boolean, trackDirty: boolean): void;
|
|
20
|
-
/** Drain the per-entity onSet dirty list for `cid` (clears marks). */
|
|
21
|
-
_takeDirty(cid: number): EntityID[];
|
|
22
|
-
/** Visit archetypes whose `cid` column changed since `baseline`, in
|
|
23
|
-
* canonical (creation-id) order. */
|
|
24
|
-
_forEachChangedArchetype(cid: number, baseline: number, cb: (arch: ArchetypeView) => void): void;
|
|
25
|
-
/** Every live entity currently holding `cid` (dispose-on-disable sweep). */
|
|
26
|
-
_collectEntitiesWithComponent(cid: number): EntityID[];
|
|
27
|
-
isAlive(id: EntityID): boolean;
|
|
28
|
-
isDisabled(id: EntityID): boolean;
|
|
29
|
-
hasComponent(entityId: EntityID, def: ComponentHandle): boolean;
|
|
10
|
+
* can touch, and the registry is one consumer of the feed among others. */
|
|
11
|
+
export interface ObserverHost extends ChangeFeed {
|
|
12
|
+
/** Dev-only frame-trace sink (`null` when unset, always null in prod). */
|
|
13
|
+
readonly trace: FrameTraceSink | null;
|
|
30
14
|
}
|
|
31
|
-
/**
|
|
15
|
+
/** What the world calls into an observer registry it did not build.
|
|
16
|
+
*
|
|
17
|
+
* `ECS.update` runs `dispatchSet` at the tick-tail detection point, through
|
|
18
|
+
* the settle hook the install pushed. A `DEV` build reads `descriptors` once
|
|
19
|
+
* per frame trace. Both are cold. The structural dispatch does not appear
|
|
20
|
+
* here: the plugin subscribes to it through the change feed. */
|
|
21
|
+
export interface ObserverHooks {
|
|
22
|
+
/** The synthesized descriptor of each registered observer, for the access
|
|
23
|
+
* check and the frame trace. */
|
|
24
|
+
descriptors(): SystemDescriptor[];
|
|
25
|
+
/** Fire the `onSet` observers for the change tick `run`. */
|
|
26
|
+
dispatchSet(run: number): void;
|
|
27
|
+
}
|
|
28
|
+
/** Per-entity observer callback (onAdd, onRemove, onDisable and onEnable, and
|
|
32
29
|
* per-entity onSet). */
|
|
33
30
|
export type ObserverFn = (entityId: EntityID, ctx: SystemContext) => void;
|
|
34
|
-
/** Archetype-granular onSet callback
|
|
35
|
-
*
|
|
31
|
+
/** Archetype-granular onSet callback, fires once per changed archetype-column.
|
|
32
|
+
* The consumer iterates `arch.entityCount` rows itself. */
|
|
36
33
|
export type ArchetypeObserverFn = (arch: ArchetypeView, ctx: SystemContext) => void;
|
|
37
34
|
/** Fields common to every observer registration. `access` drives both the
|
|
38
|
-
* dev-mode `accessCheck` and the access-topological firing order
|
|
35
|
+
* dev-mode `accessCheck` and the access-topological firing order. It is merged
|
|
39
36
|
* over an all-empty declaration, so a caller spells out only what it touches. */
|
|
40
37
|
interface ObserverConfigBase {
|
|
41
38
|
onAdd?: ObserverFn;
|
|
42
39
|
onRemove?: ObserverFn;
|
|
43
|
-
/** Fires when an entity carrying this component is *disabled
|
|
40
|
+
/** Fires when an entity carrying this component is *disabled*, at the
|
|
44
41
|
* deferred toggle drain, once per net transition. Mirrors `onRemove`:
|
|
45
42
|
* a disable is a soft remove of the whole mask from default queries. An immediate
|
|
46
43
|
* host-side `ecs.disable()` does not fire (like immediate `addComponent`). */
|
|
47
44
|
onDisable?: ObserverFn;
|
|
48
45
|
/** Fires when an entity carrying this component is *enabled*, symmetric
|
|
49
|
-
* with `onDisable`
|
|
46
|
+
* with `onDisable` and `onAdd`. */
|
|
50
47
|
onEnable?: ObserverFn;
|
|
51
|
-
/** Access surface the callbacks touch (reads
|
|
48
|
+
/** Access surface the callbacks touch (reads, writes, spawns and the rest). Partial:
|
|
52
49
|
* merged over `_INTERNAL_EMPTY_ACCESS`. Undeclared access throws in `DEV`. */
|
|
53
50
|
access?: Partial<SystemAccessDeclaration>;
|
|
54
|
-
/** flecs-style replay of current matches on registration
|
|
55
|
-
*
|
|
56
|
-
*
|
|
51
|
+
/** flecs-style replay of current matches on registration, so the order of
|
|
52
|
+
* register and spawn does not matter. `onAdd` only, and it seeds the
|
|
53
|
+
* *enabled* members. A disabled entity is absent, which matches the
|
|
54
|
+
* default-query semantics. */
|
|
57
55
|
yieldExisting?: boolean;
|
|
58
56
|
/** Diagnostic label for this observer, surfaced by the frame-trace seam
|
|
59
|
-
* as the `observer_fired.observer` field
|
|
57
|
+
* as the `observer_fired.observer` field, the same role a system's
|
|
60
58
|
* `name` plays. Optional and observe-only: it never touches `stateHash` or
|
|
61
59
|
* dispatch. Defaults to `observer(<component debug name>)` when the component
|
|
62
60
|
* was registered with a name, else `observer(<cid>)`. */
|
|
@@ -64,7 +62,7 @@ interface ObserverConfigBase {
|
|
|
64
62
|
}
|
|
65
63
|
/** Per-entity onSet: `onSet(eid, ctx)` fires once per changed entity, drained
|
|
66
64
|
* from the opt-in per-row dirty list (registering this enables dirty tracking
|
|
67
|
-
* for the component
|
|
65
|
+
* for the component, the dirty list + dedup bit). */
|
|
68
66
|
export interface EntitySetObserverConfig extends ObserverConfigBase {
|
|
69
67
|
onSet: ObserverFn;
|
|
70
68
|
granularity: "entity";
|
|
@@ -76,98 +74,19 @@ export interface ArchetypeSetObserverConfig extends ObserverConfigBase {
|
|
|
76
74
|
onSet: ArchetypeObserverFn;
|
|
77
75
|
granularity?: "archetype";
|
|
78
76
|
}
|
|
79
|
-
/** Structural-only observer
|
|
77
|
+
/** Structural-only observer, no onSet. */
|
|
80
78
|
export interface StructuralObserverConfig extends ObserverConfigBase {
|
|
81
79
|
onSet?: undefined;
|
|
82
80
|
granularity?: undefined;
|
|
83
81
|
}
|
|
84
82
|
export type ObserverConfig = StructuralObserverConfig | EntitySetObserverConfig | ArchetypeSetObserverConfig;
|
|
83
|
+
/** Handle returned by `ecs.observe(...)`. `dispose()` unregisters. Safe to
|
|
84
|
+
* call more than once. */
|
|
85
85
|
export interface ObserverHandle {
|
|
86
86
|
dispose(): void;
|
|
87
|
-
/** `using h = ecs.observe(C, {...})
|
|
87
|
+
/** `using h = ecs.observe(C, {...})`, explicit-resource-management sugar
|
|
88
88
|
* over {@link dispose} (TC39 `Symbol.dispose`). */
|
|
89
89
|
[Symbol.dispose](): void;
|
|
90
90
|
}
|
|
91
|
-
/**
|
|
92
|
-
* Registry of component observers. Owned by `ECS`; the `Store` calls back into
|
|
93
|
-
* `dispatchStructural` between fixed-point rounds during `flushStructural`,
|
|
94
|
-
* and `ECS.update` calls `dispatchSet` at the post-update detection point.
|
|
95
|
-
*/
|
|
96
|
-
export declare class ObserverRegistry {
|
|
97
|
-
private readonly store;
|
|
98
|
-
private readonly ctx;
|
|
99
|
-
private readonly entries;
|
|
100
|
-
/** ComponentID → its observers (structural + onSet). */
|
|
101
|
-
private readonly byCid;
|
|
102
|
-
/** Cached access-topological order; invalidated on register / dispose. */
|
|
103
|
-
private _topo;
|
|
104
|
-
private readonly _addBuckets;
|
|
105
|
-
private readonly _remBuckets;
|
|
106
|
-
private readonly _disBuckets;
|
|
107
|
-
private readonly _enaBuckets;
|
|
108
|
-
private readonly _radixOut;
|
|
109
|
-
private readonly _radixC0;
|
|
110
|
-
private readonly _radixC1;
|
|
111
|
-
private readonly _setDrainCache;
|
|
112
|
-
constructor(store: ObserverHost, ctx: SystemContext);
|
|
113
|
-
get count(): number;
|
|
114
|
-
/** The synthesized `SystemDescriptor`s of every registered observer, in
|
|
115
|
-
* registration order (`dispose()` splices entries out, so none are stale).
|
|
116
|
-
* Fed into the `startup()` archetype-prewarm closure so an observer's declared
|
|
117
|
-
* `spawns` / `transitions` create their target archetypes eagerly, exactly as a
|
|
118
|
-
* system's do. Without this an observer-spawned/-transitioned archetype
|
|
119
|
-
* first-touches lazily mid-tick — the one asymmetry left in the otherwise
|
|
120
|
-
* uniform "no lazy archetypes" prewarm. */
|
|
121
|
-
descriptors(): SystemDescriptor[];
|
|
122
|
-
register(def: ComponentHandle, config: ObserverConfig): ObserverHandle;
|
|
123
|
-
private _dispose;
|
|
124
|
-
/** Recompute the component's hot-path observation flags from its live
|
|
125
|
-
* observers and push them to the store (which owns the flags + fast-path
|
|
126
|
-
* counters). */
|
|
127
|
-
private _reconfigureComponent;
|
|
128
|
-
private getTopo;
|
|
129
|
-
/**
|
|
130
|
-
* Fire onAdd / onRemove / onDisable / onEnable for one fixed-point round's
|
|
131
|
-
* effective events, in canonical order: access-topological across observers,
|
|
132
|
-
* entity-id order (radix) within each observer. Called by
|
|
133
|
-
* `Store.flushStructural` after the batch commits; observer callbacks may
|
|
134
|
-
* enqueue further structural ops (or toggles) onto the deferred buffers (the
|
|
135
|
-
* store loops until quiescent).
|
|
136
|
-
*
|
|
137
|
-
* The events arrive as flat `(comp, eid)` parallel arrays collected during the
|
|
138
|
-
* flush; we bucket by component once (O(K)), then walk observers in topo order
|
|
139
|
-
* so a producer's writes are visible to a consumer (glitch-free). A round
|
|
140
|
-
* carries either structural (add/rem) OR toggle (dis/ena) events, never both —
|
|
141
|
-
* toggles drain only once add/remove/destroy are quiescent (`flushStructural`)
|
|
142
|
-
* — but we bucket all four uniformly; the empty pairs are no-ops. Within an
|
|
143
|
-
* observer the fire order is remove, add, disable, enable (the "leaving" edges
|
|
144
|
-
* before the "entering" edges).
|
|
145
|
-
*/
|
|
146
|
-
dispatchStructural(ev: StructuralObserverEvents): void;
|
|
147
|
-
/** Radix-sort `eids` by entity index (canonical within-observer order), then
|
|
148
|
-
* fire `fn` per entity under the observer's access scope. */
|
|
149
|
-
private _fireEach;
|
|
150
|
-
private _bucket;
|
|
151
|
-
private _clearBuckets;
|
|
152
|
-
/**
|
|
153
|
-
* Fire onSet observers for the current tick, in canonical order. Per-entity
|
|
154
|
-
* onSet drains the opt-in dirty list (once per changed entity); archetype-
|
|
155
|
-
* granular onSet scans the change tick (once per changed archetype-column).
|
|
156
|
-
* Called by `ECS.update` after all phases, with `tick === store._tick`.
|
|
157
|
-
*/
|
|
158
|
-
dispatchSet(tick: number): void;
|
|
159
|
-
private _dispatchSetEntity;
|
|
160
|
-
private _dispatchSetArch;
|
|
161
|
-
private _yieldExisting;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* O(K) LSD radix sort of entity ids by their 20-bit dense index (two 10-bit
|
|
165
|
-
* passes), in place. This is the canonical within-observer order — *never* a
|
|
166
|
-
* comparator `Array.sort`, which the bench measured as much slower than the
|
|
167
|
-
* entire flush. Distinct live entities have distinct indices,
|
|
168
|
-
* so index order is a total canonical order. `out` is scratch (grown to length);
|
|
169
|
-
* `c0` / `c1` are 1024-entry histograms (reused).
|
|
170
|
-
*/
|
|
171
|
-
export declare function radixSortByIndex(eids: number[], out: number[], c0: Int32Array, c1: Int32Array): void;
|
|
172
91
|
export {};
|
|
173
92
|
//# sourceMappingURL=observer.d.ts.map
|
|
@@ -1,62 +1,60 @@
|
|
|
1
|
-
import { ArchetypeView } from './
|
|
2
|
-
import {
|
|
1
|
+
import { ArchetypeView } from './archetype_types.js';
|
|
2
|
+
import { ChangeFeed } from './change_feed.js';
|
|
3
3
|
import { EntityID } from './entity.js';
|
|
4
4
|
import { FrameTraceSink } from './frame_trace.js';
|
|
5
|
-
import { SystemContext } from './
|
|
6
|
-
import { StructuralObserverEvents } from './store.js';
|
|
5
|
+
import { SystemContext } from './system_context.js';
|
|
7
6
|
import { SystemAccessDeclaration, SystemDescriptor } from './system.js';
|
|
8
|
-
/** What the observer registry needs from `Store
|
|
9
|
-
*
|
|
7
|
+
/** What the observer registry needs from `Store`: the change feed every
|
|
8
|
+
* consumer shares, plus the dev-only trace sink. `Store` implements this. The
|
|
10
9
|
* registry holds only this view, so the compiler bounds what observer dispatch
|
|
11
|
-
* can touch
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
readonly _tick: number;
|
|
16
|
-
/** Dev-only frame-trace sink (`null` when unset; always null in prod). */
|
|
17
|
-
readonly _trace: FrameTraceSink | null;
|
|
18
|
-
/** Sync a component's observation flags (add/remove/disable/enable/dirty). */
|
|
19
|
-
_configureComponentObservation(cid: number, hasAdd: boolean, hasRem: boolean, hasDisable: boolean, hasEnable: boolean, trackDirty: boolean): void;
|
|
20
|
-
/** Drain the per-entity onSet dirty list for `cid` (clears marks). */
|
|
21
|
-
_takeDirty(cid: number): EntityID[];
|
|
22
|
-
/** Visit archetypes whose `cid` column changed since `baseline`, in
|
|
23
|
-
* canonical (creation-id) order. */
|
|
24
|
-
_forEachChangedArchetype(cid: number, baseline: number, cb: (arch: ArchetypeView) => void): void;
|
|
25
|
-
/** Every live entity currently holding `cid` (dispose-on-disable sweep). */
|
|
26
|
-
_collectEntitiesWithComponent(cid: number): EntityID[];
|
|
27
|
-
isAlive(id: EntityID): boolean;
|
|
28
|
-
isDisabled(id: EntityID): boolean;
|
|
29
|
-
hasComponent(entityId: EntityID, def: ComponentHandle): boolean;
|
|
10
|
+
* can touch, and the registry is one consumer of the feed among others. */
|
|
11
|
+
export interface ObserverHost extends ChangeFeed {
|
|
12
|
+
/** Dev-only frame-trace sink (`null` when unset, always null in prod). */
|
|
13
|
+
readonly trace: FrameTraceSink | null;
|
|
30
14
|
}
|
|
31
|
-
/**
|
|
15
|
+
/** What the world calls into an observer registry it did not build.
|
|
16
|
+
*
|
|
17
|
+
* `ECS.update` runs `dispatchSet` at the tick-tail detection point, through
|
|
18
|
+
* the settle hook the install pushed. A `DEV` build reads `descriptors` once
|
|
19
|
+
* per frame trace. Both are cold. The structural dispatch does not appear
|
|
20
|
+
* here: the plugin subscribes to it through the change feed. */
|
|
21
|
+
export interface ObserverHooks {
|
|
22
|
+
/** The synthesized descriptor of each registered observer, for the access
|
|
23
|
+
* check and the frame trace. */
|
|
24
|
+
descriptors(): SystemDescriptor[];
|
|
25
|
+
/** Fire the `onSet` observers for the change tick `run`. */
|
|
26
|
+
dispatchSet(run: number): void;
|
|
27
|
+
}
|
|
28
|
+
/** Per-entity observer callback (onAdd, onRemove, onDisable and onEnable, and
|
|
32
29
|
* per-entity onSet). */
|
|
33
30
|
export type ObserverFn = (entityId: EntityID, ctx: SystemContext) => void;
|
|
34
|
-
/** Archetype-granular onSet callback
|
|
35
|
-
*
|
|
31
|
+
/** Archetype-granular onSet callback, fires once per changed archetype-column.
|
|
32
|
+
* The consumer iterates `arch.entityCount` rows itself. */
|
|
36
33
|
export type ArchetypeObserverFn = (arch: ArchetypeView, ctx: SystemContext) => void;
|
|
37
34
|
/** Fields common to every observer registration. `access` drives both the
|
|
38
|
-
* dev-mode `accessCheck` and the access-topological firing order
|
|
35
|
+
* dev-mode `accessCheck` and the access-topological firing order. It is merged
|
|
39
36
|
* over an all-empty declaration, so a caller spells out only what it touches. */
|
|
40
37
|
interface ObserverConfigBase {
|
|
41
38
|
onAdd?: ObserverFn;
|
|
42
39
|
onRemove?: ObserverFn;
|
|
43
|
-
/** Fires when an entity carrying this component is *disabled
|
|
40
|
+
/** Fires when an entity carrying this component is *disabled*, at the
|
|
44
41
|
* deferred toggle drain, once per net transition. Mirrors `onRemove`:
|
|
45
42
|
* a disable is a soft remove of the whole mask from default queries. An immediate
|
|
46
43
|
* host-side `ecs.disable()` does not fire (like immediate `addComponent`). */
|
|
47
44
|
onDisable?: ObserverFn;
|
|
48
45
|
/** Fires when an entity carrying this component is *enabled*, symmetric
|
|
49
|
-
* with `onDisable`
|
|
46
|
+
* with `onDisable` and `onAdd`. */
|
|
50
47
|
onEnable?: ObserverFn;
|
|
51
|
-
/** Access surface the callbacks touch (reads
|
|
48
|
+
/** Access surface the callbacks touch (reads, writes, spawns and the rest). Partial:
|
|
52
49
|
* merged over `_INTERNAL_EMPTY_ACCESS`. Undeclared access throws in `DEV`. */
|
|
53
50
|
access?: Partial<SystemAccessDeclaration>;
|
|
54
|
-
/** flecs-style replay of current matches on registration
|
|
55
|
-
*
|
|
56
|
-
*
|
|
51
|
+
/** flecs-style replay of current matches on registration, so the order of
|
|
52
|
+
* register and spawn does not matter. `onAdd` only, and it seeds the
|
|
53
|
+
* *enabled* members. A disabled entity is absent, which matches the
|
|
54
|
+
* default-query semantics. */
|
|
57
55
|
yieldExisting?: boolean;
|
|
58
56
|
/** Diagnostic label for this observer, surfaced by the frame-trace seam
|
|
59
|
-
* as the `observer_fired.observer` field
|
|
57
|
+
* as the `observer_fired.observer` field, the same role a system's
|
|
60
58
|
* `name` plays. Optional and observe-only: it never touches `stateHash` or
|
|
61
59
|
* dispatch. Defaults to `observer(<component debug name>)` when the component
|
|
62
60
|
* was registered with a name, else `observer(<cid>)`. */
|
|
@@ -64,7 +62,7 @@ interface ObserverConfigBase {
|
|
|
64
62
|
}
|
|
65
63
|
/** Per-entity onSet: `onSet(eid, ctx)` fires once per changed entity, drained
|
|
66
64
|
* from the opt-in per-row dirty list (registering this enables dirty tracking
|
|
67
|
-
* for the component
|
|
65
|
+
* for the component, the dirty list + dedup bit). */
|
|
68
66
|
export interface EntitySetObserverConfig extends ObserverConfigBase {
|
|
69
67
|
onSet: ObserverFn;
|
|
70
68
|
granularity: "entity";
|
|
@@ -76,98 +74,19 @@ export interface ArchetypeSetObserverConfig extends ObserverConfigBase {
|
|
|
76
74
|
onSet: ArchetypeObserverFn;
|
|
77
75
|
granularity?: "archetype";
|
|
78
76
|
}
|
|
79
|
-
/** Structural-only observer
|
|
77
|
+
/** Structural-only observer, no onSet. */
|
|
80
78
|
export interface StructuralObserverConfig extends ObserverConfigBase {
|
|
81
79
|
onSet?: undefined;
|
|
82
80
|
granularity?: undefined;
|
|
83
81
|
}
|
|
84
82
|
export type ObserverConfig = StructuralObserverConfig | EntitySetObserverConfig | ArchetypeSetObserverConfig;
|
|
83
|
+
/** Handle returned by `ecs.observe(...)`. `dispose()` unregisters. Safe to
|
|
84
|
+
* call more than once. */
|
|
85
85
|
export interface ObserverHandle {
|
|
86
86
|
dispose(): void;
|
|
87
|
-
/** `using h = ecs.observe(C, {...})
|
|
87
|
+
/** `using h = ecs.observe(C, {...})`, explicit-resource-management sugar
|
|
88
88
|
* over {@link dispose} (TC39 `Symbol.dispose`). */
|
|
89
89
|
[Symbol.dispose](): void;
|
|
90
90
|
}
|
|
91
|
-
/**
|
|
92
|
-
* Registry of component observers. Owned by `ECS`; the `Store` calls back into
|
|
93
|
-
* `dispatchStructural` between fixed-point rounds during `flushStructural`,
|
|
94
|
-
* and `ECS.update` calls `dispatchSet` at the post-update detection point.
|
|
95
|
-
*/
|
|
96
|
-
export declare class ObserverRegistry {
|
|
97
|
-
private readonly store;
|
|
98
|
-
private readonly ctx;
|
|
99
|
-
private readonly entries;
|
|
100
|
-
/** ComponentID → its observers (structural + onSet). */
|
|
101
|
-
private readonly byCid;
|
|
102
|
-
/** Cached access-topological order; invalidated on register / dispose. */
|
|
103
|
-
private _topo;
|
|
104
|
-
private readonly _addBuckets;
|
|
105
|
-
private readonly _remBuckets;
|
|
106
|
-
private readonly _disBuckets;
|
|
107
|
-
private readonly _enaBuckets;
|
|
108
|
-
private readonly _radixOut;
|
|
109
|
-
private readonly _radixC0;
|
|
110
|
-
private readonly _radixC1;
|
|
111
|
-
private readonly _setDrainCache;
|
|
112
|
-
constructor(store: ObserverHost, ctx: SystemContext);
|
|
113
|
-
get count(): number;
|
|
114
|
-
/** The synthesized `SystemDescriptor`s of every registered observer, in
|
|
115
|
-
* registration order (`dispose()` splices entries out, so none are stale).
|
|
116
|
-
* Fed into the `startup()` archetype-prewarm closure so an observer's declared
|
|
117
|
-
* `spawns` / `transitions` create their target archetypes eagerly, exactly as a
|
|
118
|
-
* system's do. Without this an observer-spawned/-transitioned archetype
|
|
119
|
-
* first-touches lazily mid-tick — the one asymmetry left in the otherwise
|
|
120
|
-
* uniform "no lazy archetypes" prewarm. */
|
|
121
|
-
descriptors(): SystemDescriptor[];
|
|
122
|
-
register(def: ComponentHandle, config: ObserverConfig): ObserverHandle;
|
|
123
|
-
private _dispose;
|
|
124
|
-
/** Recompute the component's hot-path observation flags from its live
|
|
125
|
-
* observers and push them to the store (which owns the flags + fast-path
|
|
126
|
-
* counters). */
|
|
127
|
-
private _reconfigureComponent;
|
|
128
|
-
private getTopo;
|
|
129
|
-
/**
|
|
130
|
-
* Fire onAdd / onRemove / onDisable / onEnable for one fixed-point round's
|
|
131
|
-
* effective events, in canonical order: access-topological across observers,
|
|
132
|
-
* entity-id order (radix) within each observer. Called by
|
|
133
|
-
* `Store.flushStructural` after the batch commits; observer callbacks may
|
|
134
|
-
* enqueue further structural ops (or toggles) onto the deferred buffers (the
|
|
135
|
-
* store loops until quiescent).
|
|
136
|
-
*
|
|
137
|
-
* The events arrive as flat `(comp, eid)` parallel arrays collected during the
|
|
138
|
-
* flush; we bucket by component once (O(K)), then walk observers in topo order
|
|
139
|
-
* so a producer's writes are visible to a consumer (glitch-free). A round
|
|
140
|
-
* carries either structural (add/rem) OR toggle (dis/ena) events, never both —
|
|
141
|
-
* toggles drain only once add/remove/destroy are quiescent (`flushStructural`)
|
|
142
|
-
* — but we bucket all four uniformly; the empty pairs are no-ops. Within an
|
|
143
|
-
* observer the fire order is remove, add, disable, enable (the "leaving" edges
|
|
144
|
-
* before the "entering" edges).
|
|
145
|
-
*/
|
|
146
|
-
dispatchStructural(ev: StructuralObserverEvents): void;
|
|
147
|
-
/** Radix-sort `eids` by entity index (canonical within-observer order), then
|
|
148
|
-
* fire `fn` per entity under the observer's access scope. */
|
|
149
|
-
private _fireEach;
|
|
150
|
-
private _bucket;
|
|
151
|
-
private _clearBuckets;
|
|
152
|
-
/**
|
|
153
|
-
* Fire onSet observers for the current tick, in canonical order. Per-entity
|
|
154
|
-
* onSet drains the opt-in dirty list (once per changed entity); archetype-
|
|
155
|
-
* granular onSet scans the change tick (once per changed archetype-column).
|
|
156
|
-
* Called by `ECS.update` after all phases, with `tick === store._tick`.
|
|
157
|
-
*/
|
|
158
|
-
dispatchSet(tick: number): void;
|
|
159
|
-
private _dispatchSetEntity;
|
|
160
|
-
private _dispatchSetArch;
|
|
161
|
-
private _yieldExisting;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* O(K) LSD radix sort of entity ids by their 20-bit dense index (two 10-bit
|
|
165
|
-
* passes), in place. This is the canonical within-observer order — *never* a
|
|
166
|
-
* comparator `Array.sort`, which the bench measured as much slower than the
|
|
167
|
-
* entire flush. Distinct live entities have distinct indices,
|
|
168
|
-
* so index order is a total canonical order. `out` is scratch (grown to length);
|
|
169
|
-
* `c0` / `c1` are 1024-entry histograms (reused).
|
|
170
|
-
*/
|
|
171
|
-
export declare function radixSortByIndex(eids: number[], out: number[], c0: Int32Array, c1: Int32Array): void;
|
|
172
91
|
export {};
|
|
173
92
|
//# sourceMappingURL=observer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observer.d.ts","sourceRoot":"","sources":["../../../src/core/ecs/observer.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"observer.d.ts","sourceRoot":"","sources":["../../../src/core/ecs/observer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;KAYK;AAEL,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE1E;;;2EAG2E;AAC3E,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC/C,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;CACtC;AAED;;;;;gEAKgE;AAChE,MAAM,WAAW,aAAa;IAC7B;oCACgC;IAChC,WAAW,IAAI,gBAAgB,EAAE,CAAC;IAClC,4DAA4D;IAC5D,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED;wBACwB;AACxB,MAAM,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,aAAa,KAAK,IAAI,CAAC;AAC1E;2DAC2D;AAC3D,MAAM,MAAM,mBAAmB,GAAG,CAAC,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,aAAa,KAAK,IAAI,CAAC;AAEpF;;iFAEiF;AACjF,UAAU,kBAAkB;IAC3B,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB;;;kFAG8E;IAC9E,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB;uCACmC;IACnC,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB;kFAC8E;IAC9E,MAAM,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAC1C;;;kCAG8B;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;6DAIyD;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;qDAEqD;AACrD,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB;IAClE,KAAK,EAAE,UAAU,CAAC;IAClB,WAAW,EAAE,QAAQ,CAAC;CACtB;AAED;;iBAEiB;AACjB,MAAM,WAAW,0BAA2B,SAAQ,kBAAkB;IACrE,KAAK,EAAE,mBAAmB,CAAC;IAC3B,WAAW,CAAC,EAAE,WAAW,CAAC;CAC1B;AAED,0CAA0C;AAC1C,MAAM,WAAW,wBAAyB,SAAQ,kBAAkB;IACnE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,CAAC,EAAE,SAAS,CAAC;CACxB;AAED,MAAM,MAAM,cAAc,GACvB,wBAAwB,GACxB,uBAAuB,GACvB,0BAA0B,CAAC;AAE9B;0BAC0B;AAC1B,MAAM,WAAW,cAAc;IAC9B,OAAO,IAAI,IAAI,CAAC;IAChB;uDACmD;IACnD,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC;CACzB"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/***
|
|
2
|
+
* Phase vocabulary. The names a caller uses to point at one slot of the frame.
|
|
3
|
+
*
|
|
4
|
+
* This file owns the seven built-in `SCHEDULE` members, the `Phase` handle
|
|
5
|
+
* `ecs.addPhase` hands back, the loop a phase belongs to, and the two pure
|
|
6
|
+
* classifiers over either spelling.
|
|
7
|
+
*
|
|
8
|
+
* It imports nothing. That is the point, and not an accident. A phase name is
|
|
9
|
+
* the one piece of schedule vocabulary that `frame_trace.ts` and
|
|
10
|
+
* `host_commands.ts` need, and reaching it through `schedule.ts` dragged the
|
|
11
|
+
* whole schedule, the system descriptor and the run condition behind it. With
|
|
12
|
+
* no import here the module sits outside every type cycle in `src`, and
|
|
13
|
+
* `import_graph.test.ts` records the smaller tangle.
|
|
14
|
+
*
|
|
15
|
+
* It refuses state. `PhaseNode`, the object behind a handle, stays in
|
|
16
|
+
* `schedule.ts` beside the drive loops that read its `plan` field.
|
|
17
|
+
***/
|
|
18
|
+
export declare enum SCHEDULE {
|
|
19
|
+
PRE_STARTUP = "PRE_STARTUP",
|
|
20
|
+
STARTUP = "STARTUP",
|
|
21
|
+
POST_STARTUP = "POST_STARTUP",
|
|
22
|
+
FIXED_UPDATE = "FIXED_UPDATE",
|
|
23
|
+
PRE_UPDATE = "PRE_UPDATE",
|
|
24
|
+
UPDATE = "UPDATE",
|
|
25
|
+
POST_UPDATE = "POST_UPDATE"
|
|
26
|
+
}
|
|
27
|
+
/** Which drive runs a phase.
|
|
28
|
+
*
|
|
29
|
+
* `startup` runs once, from `ecs.startup()`. `fixed` runs once per fixed step,
|
|
30
|
+
* inside the accumulator loop. `update` runs once per `ecs.update(dt)`. A
|
|
31
|
+
* phase belongs to one loop for its life, because the loop decides the delta
|
|
32
|
+
* time it receives and how often it runs. */
|
|
33
|
+
export type PhaseLoop = "startup" | "fixed" | "update";
|
|
34
|
+
/**
|
|
35
|
+
* An opaque handle for one slot in the schedule, returned by `ecs.addPhase`.
|
|
36
|
+
*
|
|
37
|
+
* A phase is identified by **object identity**, not by name, exactly like a
|
|
38
|
+
* `SystemSet`. Two `addPhase` calls with the same name are two phases. The
|
|
39
|
+
* handle belongs to the world that made it, so passing one to another world's
|
|
40
|
+
* `addSystems` is a fault and not silent cross-world scheduling.
|
|
41
|
+
*
|
|
42
|
+
* The seven built-ins have no handle. `SCHEDULE.UPDATE` names one directly,
|
|
43
|
+
* and every place that takes a `SchedulePhase` takes either spelling. A string
|
|
44
|
+
* enum member is already a string, so the built-in needs no wrapper object,
|
|
45
|
+
* and a plugin author reads `after: [SCHEDULE.PRE_UPDATE]` without an import
|
|
46
|
+
* of a handle table.
|
|
47
|
+
*/
|
|
48
|
+
export interface Phase {
|
|
49
|
+
readonly name: string;
|
|
50
|
+
readonly loop: PhaseLoop;
|
|
51
|
+
}
|
|
52
|
+
/** Where a new phase sits. `before` and `after` order it against other phases
|
|
53
|
+
* of the same loop, and a target in another loop is dropped. A phase with
|
|
54
|
+
* neither runs after every phase declared before it, so an unordered plugin
|
|
55
|
+
* phase lands at the tail of its loop. */
|
|
56
|
+
export interface PhaseConfig {
|
|
57
|
+
readonly loop: PhaseLoop;
|
|
58
|
+
readonly before?: readonly SchedulePhase[];
|
|
59
|
+
readonly after?: readonly SchedulePhase[];
|
|
60
|
+
}
|
|
61
|
+
/** Either spelling of a phase: a built-in `SCHEDULE` member, or the handle
|
|
62
|
+
* `addPhase` returned. */
|
|
63
|
+
export type SchedulePhase = SCHEDULE | Phase;
|
|
64
|
+
/** The name a trace event carries for a phase. A built-in spells its `SCHEDULE`
|
|
65
|
+
* member. A phase from `addPhase` spells the name it was given, so the set of
|
|
66
|
+
* values is open and a consumer switching on it needs a default arm. */
|
|
67
|
+
export type PhaseName = SCHEDULE | (string & {});
|
|
68
|
+
/** The loop that drives either spelling of a phase.
|
|
69
|
+
*
|
|
70
|
+
* A handle from `addPhase` carries its loop. A built-in is one of seven, and
|
|
71
|
+
* its loop is fixed at construction. Pure and cold, so a caller outside the
|
|
72
|
+
* schedule classifies a phase without holding the world. `installHostCommandSeam`
|
|
73
|
+
* is that caller. It refuses a recorder on a fixed-loop phase, and `addPhase`
|
|
74
|
+
* can put a phase of any name in that loop. */
|
|
75
|
+
export declare function phaseLoopOf(phase: SchedulePhase): PhaseLoop;
|
|
76
|
+
/** The name either spelling of a phase carries, for a diagnostic and for a
|
|
77
|
+
* system name. Pure and cold. */
|
|
78
|
+
export declare function phaseNameOf(phase: SchedulePhase): PhaseName;
|
|
79
|
+
//# sourceMappingURL=phase.d.ts.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/***
|
|
2
|
+
* Phase vocabulary. The names a caller uses to point at one slot of the frame.
|
|
3
|
+
*
|
|
4
|
+
* This file owns the seven built-in `SCHEDULE` members, the `Phase` handle
|
|
5
|
+
* `ecs.addPhase` hands back, the loop a phase belongs to, and the two pure
|
|
6
|
+
* classifiers over either spelling.
|
|
7
|
+
*
|
|
8
|
+
* It imports nothing. That is the point, and not an accident. A phase name is
|
|
9
|
+
* the one piece of schedule vocabulary that `frame_trace.ts` and
|
|
10
|
+
* `host_commands.ts` need, and reaching it through `schedule.ts` dragged the
|
|
11
|
+
* whole schedule, the system descriptor and the run condition behind it. With
|
|
12
|
+
* no import here the module sits outside every type cycle in `src`, and
|
|
13
|
+
* `import_graph.test.ts` records the smaller tangle.
|
|
14
|
+
*
|
|
15
|
+
* It refuses state. `PhaseNode`, the object behind a handle, stays in
|
|
16
|
+
* `schedule.ts` beside the drive loops that read its `plan` field.
|
|
17
|
+
***/
|
|
18
|
+
export declare enum SCHEDULE {
|
|
19
|
+
PRE_STARTUP = "PRE_STARTUP",
|
|
20
|
+
STARTUP = "STARTUP",
|
|
21
|
+
POST_STARTUP = "POST_STARTUP",
|
|
22
|
+
FIXED_UPDATE = "FIXED_UPDATE",
|
|
23
|
+
PRE_UPDATE = "PRE_UPDATE",
|
|
24
|
+
UPDATE = "UPDATE",
|
|
25
|
+
POST_UPDATE = "POST_UPDATE"
|
|
26
|
+
}
|
|
27
|
+
/** Which drive runs a phase.
|
|
28
|
+
*
|
|
29
|
+
* `startup` runs once, from `ecs.startup()`. `fixed` runs once per fixed step,
|
|
30
|
+
* inside the accumulator loop. `update` runs once per `ecs.update(dt)`. A
|
|
31
|
+
* phase belongs to one loop for its life, because the loop decides the delta
|
|
32
|
+
* time it receives and how often it runs. */
|
|
33
|
+
export type PhaseLoop = "startup" | "fixed" | "update";
|
|
34
|
+
/**
|
|
35
|
+
* An opaque handle for one slot in the schedule, returned by `ecs.addPhase`.
|
|
36
|
+
*
|
|
37
|
+
* A phase is identified by **object identity**, not by name, exactly like a
|
|
38
|
+
* `SystemSet`. Two `addPhase` calls with the same name are two phases. The
|
|
39
|
+
* handle belongs to the world that made it, so passing one to another world's
|
|
40
|
+
* `addSystems` is a fault and not silent cross-world scheduling.
|
|
41
|
+
*
|
|
42
|
+
* The seven built-ins have no handle. `SCHEDULE.UPDATE` names one directly,
|
|
43
|
+
* and every place that takes a `SchedulePhase` takes either spelling. A string
|
|
44
|
+
* enum member is already a string, so the built-in needs no wrapper object,
|
|
45
|
+
* and a plugin author reads `after: [SCHEDULE.PRE_UPDATE]` without an import
|
|
46
|
+
* of a handle table.
|
|
47
|
+
*/
|
|
48
|
+
export interface Phase {
|
|
49
|
+
readonly name: string;
|
|
50
|
+
readonly loop: PhaseLoop;
|
|
51
|
+
}
|
|
52
|
+
/** Where a new phase sits. `before` and `after` order it against other phases
|
|
53
|
+
* of the same loop, and a target in another loop is dropped. A phase with
|
|
54
|
+
* neither runs after every phase declared before it, so an unordered plugin
|
|
55
|
+
* phase lands at the tail of its loop. */
|
|
56
|
+
export interface PhaseConfig {
|
|
57
|
+
readonly loop: PhaseLoop;
|
|
58
|
+
readonly before?: readonly SchedulePhase[];
|
|
59
|
+
readonly after?: readonly SchedulePhase[];
|
|
60
|
+
}
|
|
61
|
+
/** Either spelling of a phase: a built-in `SCHEDULE` member, or the handle
|
|
62
|
+
* `addPhase` returned. */
|
|
63
|
+
export type SchedulePhase = SCHEDULE | Phase;
|
|
64
|
+
/** The name a trace event carries for a phase. A built-in spells its `SCHEDULE`
|
|
65
|
+
* member. A phase from `addPhase` spells the name it was given, so the set of
|
|
66
|
+
* values is open and a consumer switching on it needs a default arm. */
|
|
67
|
+
export type PhaseName = SCHEDULE | (string & {});
|
|
68
|
+
/** The loop that drives either spelling of a phase.
|
|
69
|
+
*
|
|
70
|
+
* A handle from `addPhase` carries its loop. A built-in is one of seven, and
|
|
71
|
+
* its loop is fixed at construction. Pure and cold, so a caller outside the
|
|
72
|
+
* schedule classifies a phase without holding the world. `installHostCommandSeam`
|
|
73
|
+
* is that caller. It refuses a recorder on a fixed-loop phase, and `addPhase`
|
|
74
|
+
* can put a phase of any name in that loop. */
|
|
75
|
+
export declare function phaseLoopOf(phase: SchedulePhase): PhaseLoop;
|
|
76
|
+
/** The name either spelling of a phase carries, for a diagnostic and for a
|
|
77
|
+
* system name. Pure and cold. */
|
|
78
|
+
export declare function phaseNameOf(phase: SchedulePhase): PhaseName;
|
|
79
|
+
//# sourceMappingURL=phase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phase.d.ts","sourceRoot":"","sources":["../../../src/core/ecs/phase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;KAgBK;AAEL,oBAAY,QAAQ;IACnB,WAAW,gBAAgB;IAC3B,OAAO,YAAY;IACnB,YAAY,iBAAiB;IAC7B,YAAY,iBAAiB;IAC7B,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,WAAW,gBAAgB;CAC3B;AAED;;;;;6CAK6C;AAC7C,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEvD;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,KAAK;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;CACzB;AAED;;;0CAG0C;AAC1C,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;IAC3C,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;CAC1C;AAED;0BAC0B;AAC1B,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE7C;;wEAEwE;AACxE,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAEjD;;;;;;+CAM+C;AAC/C,wBAAgB,WAAW,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,CAc3D;AAED;iCACiC;AACjC,wBAAgB,WAAW,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,CAE3D"}
|