@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 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function o(r,t,e){return`${r}:${t.id}:${e}`}const a=new WeakMap;class h{constructor(t,e){this._readField=t,this._shadow=e,a.set(this,{forward:[],inverse:[]})}_staged=new Map;get _txn(){return a.get(this)}spawn(t,e){const s={kind:"despawn",eid:0};return this._txn.inverse.push(s),this._txn.forward.push({kind:"spawn",components:t,onSpawned:n=>{s.eid=n,e?.(n)}}),this}despawn(t,e){const s={kind:"despawn",eid:t};return this._txn.forward.push(s),this._txn.inverse.push({kind:"spawn",components:e,onSpawned:n=>{s.eid=n}}),this}setField(t,e,s,n){const i=o(t,e,s),d=this._staged.get(i)??this._shadow.get(i)??this._readField(t,e,s)??0;return this._staged.set(i,n),this._txn.forward.push({kind:"set_field",eid:t,def:e,field:s,value:n}),this._txn.inverse.push({kind:"set_field",eid:t,def:e,field:s,value:d}),this}add(t,e,s){return this._txn.forward.push({kind:"add_component",eid:t,def:e,values:s}),this._txn.inverse.push({kind:"remove_component",eid:t,def:e}),this}remove(t,e,s){return this._txn.forward.push({kind:"remove_component",eid:t,def:e}),this._txn.inverse.push({kind:"add_component",eid:t,def:e,values:s}),this}disable(t){return this._txn.forward.push({kind:"disable",eid:t}),this._txn.inverse.push({kind:"enable",eid:t}),this}enable(t){return this._txn.forward.push({kind:"enable",eid:t}),this._txn.inverse.push({kind:"disable",eid:t}),this}}class u{constructor(t,e){this._queue=t,this._readField=e}_undoStack=[];_redoStack=[];_listeners=[];_shadow=new Map;transaction(t){const e=new h(this._readField,this._shadow);return t(e),this._commit(a.get(e))}spawn(t,e){return this.transaction(s=>s.spawn(t,e))}despawn(t,e){return this.transaction(s=>s.despawn(t,e))}setField(t,e,s,n){return this.transaction(i=>i.setField(t,e,s,n))}add(t,e,s){return this.transaction(n=>n.add(t,e,s))}remove(t,e,s){return this.transaction(n=>n.remove(t,e,s))}disable(t){return this.transaction(e=>e.disable(t))}enable(t){return this.transaction(e=>e.enable(t))}undo(){const t=this._undoStack.pop();if(t===void 0)return!1;const e=t.inverse.slice().reverse();for(const s of e)this._queue.push(s);return this._applyShadow(e),this._redoStack.push(t),this._notify(),!0}redo(){const t=this._redoStack.pop();if(t===void 0)return!1;for(const e of t.forward)this._queue.push(e);return this._applyShadow(t.forward),this._undoStack.push(t),this._notify(),!0}clear(){this._undoStack.length=0,this._redoStack.length=0,this._shadow.clear(),this._notify()}depths(){return{undo:this._undoStack.length,redo:this._redoStack.length}}get canUndo(){return this._undoStack.length>0}get canRedo(){return this._redoStack.length>0}onChange(t){return this._listeners.push(t),()=>{const e=this._listeners.indexOf(t);e!==-1&&this._listeners.splice(e,1)}}_notify(){for(const t of this._listeners.slice())t()}committedField(t,e,s){return this._readField(t,e,s)}pendingField(t,e,s){const n=o(t,e,s),i=this._shadow.get(n);if(i===void 0)return;const d=this._readField(t,e,s);if(d===i||d===void 0){this._shadow.delete(n);return}return i}_commit(t){if(t.forward.length===0)return t;for(const e of t.forward)this._queue.push(e);return this._applyShadow(t.forward),this._undoStack.push(t),this._redoStack.length=0,this._notify(),t}_applyShadow(t){for(const e of t)e.kind==="set_field"&&this._shadow.set(o(e.eid,e.def,e.field),e.value)}}function c(r,t,e,s,n){return{get value(){return n!==void 0?n():r.committedField(t,e,s)},set(i){r.setField(t,e,s,i)},get pending(){return r.pendingField(t,e,s)}}}exports.Editor=u;exports.TransactionBuilder=h;exports.fieldHandle=c;
|
|
@@ -5,14 +5,14 @@ const a = /* @__PURE__ */ new WeakMap();
|
|
|
5
5
|
class h {
|
|
6
6
|
/** @internal */
|
|
7
7
|
constructor(t, e) {
|
|
8
|
-
this.
|
|
8
|
+
this._readField = t, this._shadow = e, a.set(this, { forward: [], inverse: [] });
|
|
9
9
|
}
|
|
10
|
-
/** Values staged by
|
|
10
|
+
/** Values staged by this build, layered over the editor's shared shadow. Kept
|
|
11
11
|
* transaction-local so an aborted build (the callback throws before commit)
|
|
12
|
-
* leaves the shared shadow untouched
|
|
13
|
-
* `pendingField` and seed the
|
|
14
|
-
* held. The one merge point into the shared shadow is commit's `
|
|
15
|
-
|
|
12
|
+
* leaves the shared shadow untouched, a phantom staged value would poison
|
|
13
|
+
* `pendingField` and seed the next edit's inverse with a value the world never
|
|
14
|
+
* held. The one merge point into the shared shadow is commit's `_applyShadow`. */
|
|
15
|
+
_staged = /* @__PURE__ */ new Map();
|
|
16
16
|
get _txn() {
|
|
17
17
|
return a.get(this);
|
|
18
18
|
}
|
|
@@ -41,23 +41,40 @@ class h {
|
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* Set `field` of `def` on `entityId` to `value`. Inverse: set it back to the value
|
|
44
|
-
* this edit replaced
|
|
44
|
+
* this edit replaced, read from the staged overlay and shadow (so stacked edits,
|
|
45
45
|
* within one build or before a commit, invert correctly) or, failing that, the
|
|
46
46
|
* read channel (`0` if unknown).
|
|
47
47
|
*/
|
|
48
48
|
setField(t, e, s, n) {
|
|
49
|
-
const i = o(t, e, s), d = this.
|
|
50
|
-
return this.
|
|
49
|
+
const i = o(t, e, s), d = this._staged.get(i) ?? this._shadow.get(i) ?? this._readField(t, e, s) ?? 0;
|
|
50
|
+
return this._staged.set(i, n), this._txn.forward.push({
|
|
51
|
+
kind: "set_field",
|
|
52
|
+
eid: t,
|
|
53
|
+
def: e,
|
|
54
|
+
field: s,
|
|
55
|
+
value: n
|
|
56
|
+
}), this._txn.inverse.push({
|
|
57
|
+
kind: "set_field",
|
|
58
|
+
eid: t,
|
|
59
|
+
def: e,
|
|
60
|
+
field: s,
|
|
61
|
+
value: d
|
|
62
|
+
}), this;
|
|
51
63
|
}
|
|
52
64
|
/** Attach `def` (with complete `values`) to `entityId`. Inverse: remove it.
|
|
53
|
-
* Bare `add
|
|
65
|
+
* Bare `add`, the namespaced-handle grammar (matches `ctx.commands.add` and
|
|
54
66
|
* the queue's `add`), not `addComponent`. */
|
|
55
67
|
add(t, e, s) {
|
|
56
|
-
return this._txn.forward.push({
|
|
68
|
+
return this._txn.forward.push({
|
|
69
|
+
kind: "add_component",
|
|
70
|
+
eid: t,
|
|
71
|
+
def: e,
|
|
72
|
+
values: s
|
|
73
|
+
}), this._txn.inverse.push({ kind: "remove_component", eid: t, def: e }), this;
|
|
57
74
|
}
|
|
58
75
|
/**
|
|
59
76
|
* Detach `def` from `entityId`. Inverse: re-add it from `restore` (the field values
|
|
60
|
-
* to recreate
|
|
77
|
+
* to recreate, read them from the channel before removing). Bare `remove`, see `add`.
|
|
61
78
|
*/
|
|
62
79
|
remove(t, e, s) {
|
|
63
80
|
return this._txn.forward.push({ kind: "remove_component", eid: t, def: e }), this._txn.inverse.push({
|
|
@@ -78,22 +95,22 @@ class h {
|
|
|
78
95
|
}
|
|
79
96
|
class u {
|
|
80
97
|
constructor(t, e) {
|
|
81
|
-
this.
|
|
98
|
+
this._queue = t, this._readField = e;
|
|
82
99
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
/** onChange subscribers
|
|
86
|
-
|
|
100
|
+
_undoStack = [];
|
|
101
|
+
_redoStack = [];
|
|
102
|
+
/** onChange subscribers, see {@link onChange}. */
|
|
103
|
+
_listeners = [];
|
|
87
104
|
/** Per-`(entity, component, field)` shadow of edited values, for inverse correctness. */
|
|
88
|
-
|
|
105
|
+
_shadow = /* @__PURE__ */ new Map();
|
|
89
106
|
/**
|
|
90
|
-
* Group several actions into
|
|
91
|
-
* {@link TransactionBuilder}
|
|
92
|
-
* commands
|
|
107
|
+
* Group several actions into one undo entry. Build them on the passed
|
|
108
|
+
* {@link TransactionBuilder}. The whole group commits, which enqueues its
|
|
109
|
+
* forward commands, and lands on the undo stack atomically, clearing the redo stack.
|
|
93
110
|
*/
|
|
94
111
|
transaction(t) {
|
|
95
|
-
const e = new h(this.
|
|
96
|
-
return t(e), this.
|
|
112
|
+
const e = new h(this._readField, this._shadow);
|
|
113
|
+
return t(e), this._commit(a.get(e));
|
|
97
114
|
}
|
|
98
115
|
spawn(t, e) {
|
|
99
116
|
return this.transaction((s) => s.spawn(t, e));
|
|
@@ -109,7 +126,7 @@ class u {
|
|
|
109
126
|
add(t, e, s) {
|
|
110
127
|
return this.transaction((n) => n.add(t, e, s));
|
|
111
128
|
}
|
|
112
|
-
/** Detach a component as its own undo entry
|
|
129
|
+
/** Detach a component as its own undo entry. `restore` re-adds it on undo. Bare `remove`. */
|
|
113
130
|
remove(t, e, s) {
|
|
114
131
|
return this.transaction((n) => n.remove(t, e, s));
|
|
115
132
|
}
|
|
@@ -123,15 +140,15 @@ class u {
|
|
|
123
140
|
}
|
|
124
141
|
/**
|
|
125
142
|
* Undo the most recent transaction: enqueue its inverse commands (in reverse
|
|
126
|
-
* order
|
|
143
|
+
* order, a group unwinds last-action-first) on the bus and move it to the redo
|
|
127
144
|
* stack. Returns `false` if the undo stack is empty.
|
|
128
145
|
*/
|
|
129
146
|
undo() {
|
|
130
|
-
const t = this.
|
|
147
|
+
const t = this._undoStack.pop();
|
|
131
148
|
if (t === void 0) return !1;
|
|
132
149
|
const e = t.inverse.slice().reverse();
|
|
133
|
-
for (const s of e) this.
|
|
134
|
-
return this.
|
|
150
|
+
for (const s of e) this._queue.push(s);
|
|
151
|
+
return this._applyShadow(e), this._redoStack.push(t), this._notify(), !0;
|
|
135
152
|
}
|
|
136
153
|
/**
|
|
137
154
|
* Redo the most recently undone transaction: re-enqueue its forward commands on
|
|
@@ -139,87 +156,87 @@ class u {
|
|
|
139
156
|
* is empty.
|
|
140
157
|
*/
|
|
141
158
|
redo() {
|
|
142
|
-
const t = this.
|
|
159
|
+
const t = this._redoStack.pop();
|
|
143
160
|
if (t === void 0) return !1;
|
|
144
|
-
for (const e of t.forward) this.
|
|
145
|
-
return this.
|
|
161
|
+
for (const e of t.forward) this._queue.push(e);
|
|
162
|
+
return this._applyShadow(t.forward), this._undoStack.push(t), this._notify(), !0;
|
|
146
163
|
}
|
|
147
164
|
/** Drop both stacks (e.g. on load). Does not touch the world. */
|
|
148
165
|
clear() {
|
|
149
|
-
this.
|
|
166
|
+
this._undoStack.length = 0, this._redoStack.length = 0, this._shadow.clear(), this._notify();
|
|
150
167
|
}
|
|
151
|
-
/** Current stack depths
|
|
168
|
+
/** Current stack depths, for an "Undo (3)" or "Redo" affordance. */
|
|
152
169
|
depths() {
|
|
153
|
-
return { undo: this.
|
|
170
|
+
return { undo: this._undoStack.length, redo: this._redoStack.length };
|
|
154
171
|
}
|
|
155
|
-
/** `true` when `undo()` would do something
|
|
172
|
+
/** `true` when `undo()` would do something, allocation-free. */
|
|
156
173
|
get canUndo() {
|
|
157
|
-
return this.
|
|
174
|
+
return this._undoStack.length > 0;
|
|
158
175
|
}
|
|
159
|
-
/** `true` when `redo()` would do something
|
|
176
|
+
/** `true` when `redo()` would do something, allocation-free. */
|
|
160
177
|
get canRedo() {
|
|
161
|
-
return this.
|
|
178
|
+
return this._redoStack.length > 0;
|
|
162
179
|
}
|
|
163
180
|
/**
|
|
164
|
-
* Subscribe to undo
|
|
165
|
-
* redo, and clear
|
|
181
|
+
* Subscribe to undo-stack and redo-stack changes: fires after every commit, undo,
|
|
182
|
+
* redo, and clear, the push signal an "Undo (3)" affordance needs instead
|
|
166
183
|
* of polling `depths()` per frame. Returns an unsubscribe function.
|
|
167
|
-
* Callbacks run synchronously in subscription order
|
|
168
|
-
* `canRedo`
|
|
184
|
+
* Callbacks run synchronously in subscription order. Read `canUndo`,
|
|
185
|
+
* `canRedo` and `depths()` inside.
|
|
169
186
|
*/
|
|
170
187
|
onChange(t) {
|
|
171
|
-
return this.
|
|
172
|
-
const e = this.
|
|
173
|
-
e !== -1 && this.
|
|
188
|
+
return this._listeners.push(t), () => {
|
|
189
|
+
const e = this._listeners.indexOf(t);
|
|
190
|
+
e !== -1 && this._listeners.splice(e, 1);
|
|
174
191
|
};
|
|
175
192
|
}
|
|
176
|
-
|
|
177
|
-
for (const t of this.
|
|
193
|
+
_notify() {
|
|
194
|
+
for (const t of this._listeners.slice()) t();
|
|
178
195
|
}
|
|
179
196
|
/** Read one committed `(entity, component, field)` slot through the reader
|
|
180
|
-
* this editor was constructed with
|
|
197
|
+
* this editor was constructed with, the default read for `fieldHandle`
|
|
181
198
|
* when no channel thunk is supplied. */
|
|
182
199
|
committedField(t, e, s) {
|
|
183
|
-
return this.
|
|
200
|
+
return this._readField(t, e, s);
|
|
184
201
|
}
|
|
185
202
|
/**
|
|
186
203
|
* The pending value the editor believes for a field that the committed read
|
|
187
|
-
* channel has
|
|
204
|
+
* channel has not caught up to yet (the shadow), or `undefined` if none. Lets an
|
|
188
205
|
* inspector echo an edit between the `set` and the tick that commits it.
|
|
189
206
|
*
|
|
190
207
|
* Self-resolving: once the read channel reports the shadowed value (the edit
|
|
191
|
-
* landed)
|
|
192
|
-
* component removed)
|
|
208
|
+
* landed), or reports `undefined` (the slot is gone: entity despawned or
|
|
209
|
+
* component removed), the entry is dropped and this returns `undefined`, so
|
|
193
210
|
* `pending` does not outlive its set→commit window and shadow a later external
|
|
194
211
|
* write, nor a dead slot's lifetime. The one
|
|
195
212
|
* residual: if an external write changes the field to a *different* value within
|
|
196
213
|
* the same window before this is next consulted, `pending` can read stale until
|
|
197
214
|
* the next edit to the slot. `value` (the read channel) is always the source of
|
|
198
|
-
* truth
|
|
215
|
+
* truth. `pending` is only the optimistic bridge.
|
|
199
216
|
*/
|
|
200
217
|
pendingField(t, e, s) {
|
|
201
|
-
const n = o(t, e, s), i = this.
|
|
218
|
+
const n = o(t, e, s), i = this._shadow.get(n);
|
|
202
219
|
if (i === void 0) return;
|
|
203
|
-
const d = this.
|
|
220
|
+
const d = this._readField(t, e, s);
|
|
204
221
|
if (d === i || d === void 0) {
|
|
205
|
-
this.
|
|
222
|
+
this._shadow.delete(n);
|
|
206
223
|
return;
|
|
207
224
|
}
|
|
208
225
|
return i;
|
|
209
226
|
}
|
|
210
227
|
/** Enqueue forward commands, record the transaction, clear redo, sync shadow. */
|
|
211
|
-
|
|
228
|
+
_commit(t) {
|
|
212
229
|
if (t.forward.length === 0) return t;
|
|
213
|
-
for (const e of t.forward) this.
|
|
214
|
-
return this.
|
|
230
|
+
for (const e of t.forward) this._queue.push(e);
|
|
231
|
+
return this._applyShadow(t.forward), this._undoStack.push(t), this._redoStack.length = 0, this._notify(), t;
|
|
215
232
|
}
|
|
216
|
-
/** Keep the setField shadow in step with the commands
|
|
217
|
-
|
|
233
|
+
/** Keep the setField shadow in step with the commands only enqueued. */
|
|
234
|
+
_applyShadow(t) {
|
|
218
235
|
for (const e of t)
|
|
219
|
-
e.kind === "set_field" && this.
|
|
236
|
+
e.kind === "set_field" && this._shadow.set(o(e.eid, e.def, e.field), e.value);
|
|
220
237
|
}
|
|
221
238
|
}
|
|
222
|
-
function
|
|
239
|
+
function _(r, t, e, s, n) {
|
|
223
240
|
return {
|
|
224
241
|
get value() {
|
|
225
242
|
return n !== void 0 ? n() : r.committedField(t, e, s);
|
|
@@ -235,5 +252,5 @@ function c(r, t, e, s, n) {
|
|
|
235
252
|
export {
|
|
236
253
|
u as Editor,
|
|
237
254
|
h as TransactionBuilder,
|
|
238
|
-
|
|
255
|
+
_ as fieldHandle
|
|
239
256
|
};
|
|
@@ -5,14 +5,14 @@ const a = /* @__PURE__ */ new WeakMap();
|
|
|
5
5
|
class h {
|
|
6
6
|
/** @internal */
|
|
7
7
|
constructor(t, e) {
|
|
8
|
-
this.
|
|
8
|
+
this._readField = t, this._shadow = e, a.set(this, { forward: [], inverse: [] });
|
|
9
9
|
}
|
|
10
|
-
/** Values staged by
|
|
10
|
+
/** Values staged by this build, layered over the editor's shared shadow. Kept
|
|
11
11
|
* transaction-local so an aborted build (the callback throws before commit)
|
|
12
|
-
* leaves the shared shadow untouched
|
|
13
|
-
* `pendingField` and seed the
|
|
14
|
-
* held. The one merge point into the shared shadow is commit's `
|
|
15
|
-
|
|
12
|
+
* leaves the shared shadow untouched, a phantom staged value would poison
|
|
13
|
+
* `pendingField` and seed the next edit's inverse with a value the world never
|
|
14
|
+
* held. The one merge point into the shared shadow is commit's `_applyShadow`. */
|
|
15
|
+
_staged = /* @__PURE__ */ new Map();
|
|
16
16
|
get _txn() {
|
|
17
17
|
return a.get(this);
|
|
18
18
|
}
|
|
@@ -41,23 +41,40 @@ class h {
|
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* Set `field` of `def` on `entityId` to `value`. Inverse: set it back to the value
|
|
44
|
-
* this edit replaced
|
|
44
|
+
* this edit replaced, read from the staged overlay and shadow (so stacked edits,
|
|
45
45
|
* within one build or before a commit, invert correctly) or, failing that, the
|
|
46
46
|
* read channel (`0` if unknown).
|
|
47
47
|
*/
|
|
48
48
|
setField(t, e, s, n) {
|
|
49
|
-
const i = o(t, e, s), d = this.
|
|
50
|
-
return this.
|
|
49
|
+
const i = o(t, e, s), d = this._staged.get(i) ?? this._shadow.get(i) ?? this._readField(t, e, s) ?? 0;
|
|
50
|
+
return this._staged.set(i, n), this._txn.forward.push({
|
|
51
|
+
kind: "set_field",
|
|
52
|
+
eid: t,
|
|
53
|
+
def: e,
|
|
54
|
+
field: s,
|
|
55
|
+
value: n
|
|
56
|
+
}), this._txn.inverse.push({
|
|
57
|
+
kind: "set_field",
|
|
58
|
+
eid: t,
|
|
59
|
+
def: e,
|
|
60
|
+
field: s,
|
|
61
|
+
value: d
|
|
62
|
+
}), this;
|
|
51
63
|
}
|
|
52
64
|
/** Attach `def` (with complete `values`) to `entityId`. Inverse: remove it.
|
|
53
|
-
* Bare `add
|
|
65
|
+
* Bare `add`, the namespaced-handle grammar (matches `ctx.commands.add` and
|
|
54
66
|
* the queue's `add`), not `addComponent`. */
|
|
55
67
|
add(t, e, s) {
|
|
56
|
-
return this._txn.forward.push({
|
|
68
|
+
return this._txn.forward.push({
|
|
69
|
+
kind: "add_component",
|
|
70
|
+
eid: t,
|
|
71
|
+
def: e,
|
|
72
|
+
values: s
|
|
73
|
+
}), this._txn.inverse.push({ kind: "remove_component", eid: t, def: e }), this;
|
|
57
74
|
}
|
|
58
75
|
/**
|
|
59
76
|
* Detach `def` from `entityId`. Inverse: re-add it from `restore` (the field values
|
|
60
|
-
* to recreate
|
|
77
|
+
* to recreate, read them from the channel before removing). Bare `remove`, see `add`.
|
|
61
78
|
*/
|
|
62
79
|
remove(t, e, s) {
|
|
63
80
|
return this._txn.forward.push({ kind: "remove_component", eid: t, def: e }), this._txn.inverse.push({
|
|
@@ -78,22 +95,22 @@ class h {
|
|
|
78
95
|
}
|
|
79
96
|
class u {
|
|
80
97
|
constructor(t, e) {
|
|
81
|
-
this.
|
|
98
|
+
this._queue = t, this._readField = e;
|
|
82
99
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
/** onChange subscribers
|
|
86
|
-
|
|
100
|
+
_undoStack = [];
|
|
101
|
+
_redoStack = [];
|
|
102
|
+
/** onChange subscribers, see {@link onChange}. */
|
|
103
|
+
_listeners = [];
|
|
87
104
|
/** Per-`(entity, component, field)` shadow of edited values, for inverse correctness. */
|
|
88
|
-
|
|
105
|
+
_shadow = /* @__PURE__ */ new Map();
|
|
89
106
|
/**
|
|
90
|
-
* Group several actions into
|
|
91
|
-
* {@link TransactionBuilder}
|
|
92
|
-
* commands
|
|
107
|
+
* Group several actions into one undo entry. Build them on the passed
|
|
108
|
+
* {@link TransactionBuilder}. The whole group commits, which enqueues its
|
|
109
|
+
* forward commands, and lands on the undo stack atomically, clearing the redo stack.
|
|
93
110
|
*/
|
|
94
111
|
transaction(t) {
|
|
95
|
-
const e = new h(this.
|
|
96
|
-
return t(e), this.
|
|
112
|
+
const e = new h(this._readField, this._shadow);
|
|
113
|
+
return t(e), this._commit(a.get(e));
|
|
97
114
|
}
|
|
98
115
|
spawn(t, e) {
|
|
99
116
|
return this.transaction((s) => s.spawn(t, e));
|
|
@@ -109,7 +126,7 @@ class u {
|
|
|
109
126
|
add(t, e, s) {
|
|
110
127
|
return this.transaction((n) => n.add(t, e, s));
|
|
111
128
|
}
|
|
112
|
-
/** Detach a component as its own undo entry
|
|
129
|
+
/** Detach a component as its own undo entry. `restore` re-adds it on undo. Bare `remove`. */
|
|
113
130
|
remove(t, e, s) {
|
|
114
131
|
return this.transaction((n) => n.remove(t, e, s));
|
|
115
132
|
}
|
|
@@ -123,15 +140,15 @@ class u {
|
|
|
123
140
|
}
|
|
124
141
|
/**
|
|
125
142
|
* Undo the most recent transaction: enqueue its inverse commands (in reverse
|
|
126
|
-
* order
|
|
143
|
+
* order, a group unwinds last-action-first) on the bus and move it to the redo
|
|
127
144
|
* stack. Returns `false` if the undo stack is empty.
|
|
128
145
|
*/
|
|
129
146
|
undo() {
|
|
130
|
-
const t = this.
|
|
147
|
+
const t = this._undoStack.pop();
|
|
131
148
|
if (t === void 0) return !1;
|
|
132
149
|
const e = t.inverse.slice().reverse();
|
|
133
|
-
for (const s of e) this.
|
|
134
|
-
return this.
|
|
150
|
+
for (const s of e) this._queue.push(s);
|
|
151
|
+
return this._applyShadow(e), this._redoStack.push(t), this._notify(), !0;
|
|
135
152
|
}
|
|
136
153
|
/**
|
|
137
154
|
* Redo the most recently undone transaction: re-enqueue its forward commands on
|
|
@@ -139,87 +156,87 @@ class u {
|
|
|
139
156
|
* is empty.
|
|
140
157
|
*/
|
|
141
158
|
redo() {
|
|
142
|
-
const t = this.
|
|
159
|
+
const t = this._redoStack.pop();
|
|
143
160
|
if (t === void 0) return !1;
|
|
144
|
-
for (const e of t.forward) this.
|
|
145
|
-
return this.
|
|
161
|
+
for (const e of t.forward) this._queue.push(e);
|
|
162
|
+
return this._applyShadow(t.forward), this._undoStack.push(t), this._notify(), !0;
|
|
146
163
|
}
|
|
147
164
|
/** Drop both stacks (e.g. on load). Does not touch the world. */
|
|
148
165
|
clear() {
|
|
149
|
-
this.
|
|
166
|
+
this._undoStack.length = 0, this._redoStack.length = 0, this._shadow.clear(), this._notify();
|
|
150
167
|
}
|
|
151
|
-
/** Current stack depths
|
|
168
|
+
/** Current stack depths, for an "Undo (3)" or "Redo" affordance. */
|
|
152
169
|
depths() {
|
|
153
|
-
return { undo: this.
|
|
170
|
+
return { undo: this._undoStack.length, redo: this._redoStack.length };
|
|
154
171
|
}
|
|
155
|
-
/** `true` when `undo()` would do something
|
|
172
|
+
/** `true` when `undo()` would do something, allocation-free. */
|
|
156
173
|
get canUndo() {
|
|
157
|
-
return this.
|
|
174
|
+
return this._undoStack.length > 0;
|
|
158
175
|
}
|
|
159
|
-
/** `true` when `redo()` would do something
|
|
176
|
+
/** `true` when `redo()` would do something, allocation-free. */
|
|
160
177
|
get canRedo() {
|
|
161
|
-
return this.
|
|
178
|
+
return this._redoStack.length > 0;
|
|
162
179
|
}
|
|
163
180
|
/**
|
|
164
|
-
* Subscribe to undo
|
|
165
|
-
* redo, and clear
|
|
181
|
+
* Subscribe to undo-stack and redo-stack changes: fires after every commit, undo,
|
|
182
|
+
* redo, and clear, the push signal an "Undo (3)" affordance needs instead
|
|
166
183
|
* of polling `depths()` per frame. Returns an unsubscribe function.
|
|
167
|
-
* Callbacks run synchronously in subscription order
|
|
168
|
-
* `canRedo`
|
|
184
|
+
* Callbacks run synchronously in subscription order. Read `canUndo`,
|
|
185
|
+
* `canRedo` and `depths()` inside.
|
|
169
186
|
*/
|
|
170
187
|
onChange(t) {
|
|
171
|
-
return this.
|
|
172
|
-
const e = this.
|
|
173
|
-
e !== -1 && this.
|
|
188
|
+
return this._listeners.push(t), () => {
|
|
189
|
+
const e = this._listeners.indexOf(t);
|
|
190
|
+
e !== -1 && this._listeners.splice(e, 1);
|
|
174
191
|
};
|
|
175
192
|
}
|
|
176
|
-
|
|
177
|
-
for (const t of this.
|
|
193
|
+
_notify() {
|
|
194
|
+
for (const t of this._listeners.slice()) t();
|
|
178
195
|
}
|
|
179
196
|
/** Read one committed `(entity, component, field)` slot through the reader
|
|
180
|
-
* this editor was constructed with
|
|
197
|
+
* this editor was constructed with, the default read for `fieldHandle`
|
|
181
198
|
* when no channel thunk is supplied. */
|
|
182
199
|
committedField(t, e, s) {
|
|
183
|
-
return this.
|
|
200
|
+
return this._readField(t, e, s);
|
|
184
201
|
}
|
|
185
202
|
/**
|
|
186
203
|
* The pending value the editor believes for a field that the committed read
|
|
187
|
-
* channel has
|
|
204
|
+
* channel has not caught up to yet (the shadow), or `undefined` if none. Lets an
|
|
188
205
|
* inspector echo an edit between the `set` and the tick that commits it.
|
|
189
206
|
*
|
|
190
207
|
* Self-resolving: once the read channel reports the shadowed value (the edit
|
|
191
|
-
* landed)
|
|
192
|
-
* component removed)
|
|
208
|
+
* landed), or reports `undefined` (the slot is gone: entity despawned or
|
|
209
|
+
* component removed), the entry is dropped and this returns `undefined`, so
|
|
193
210
|
* `pending` does not outlive its set→commit window and shadow a later external
|
|
194
211
|
* write, nor a dead slot's lifetime. The one
|
|
195
212
|
* residual: if an external write changes the field to a *different* value within
|
|
196
213
|
* the same window before this is next consulted, `pending` can read stale until
|
|
197
214
|
* the next edit to the slot. `value` (the read channel) is always the source of
|
|
198
|
-
* truth
|
|
215
|
+
* truth. `pending` is only the optimistic bridge.
|
|
199
216
|
*/
|
|
200
217
|
pendingField(t, e, s) {
|
|
201
|
-
const n = o(t, e, s), i = this.
|
|
218
|
+
const n = o(t, e, s), i = this._shadow.get(n);
|
|
202
219
|
if (i === void 0) return;
|
|
203
|
-
const d = this.
|
|
220
|
+
const d = this._readField(t, e, s);
|
|
204
221
|
if (d === i || d === void 0) {
|
|
205
|
-
this.
|
|
222
|
+
this._shadow.delete(n);
|
|
206
223
|
return;
|
|
207
224
|
}
|
|
208
225
|
return i;
|
|
209
226
|
}
|
|
210
227
|
/** Enqueue forward commands, record the transaction, clear redo, sync shadow. */
|
|
211
|
-
|
|
228
|
+
_commit(t) {
|
|
212
229
|
if (t.forward.length === 0) return t;
|
|
213
|
-
for (const e of t.forward) this.
|
|
214
|
-
return this.
|
|
230
|
+
for (const e of t.forward) this._queue.push(e);
|
|
231
|
+
return this._applyShadow(t.forward), this._undoStack.push(t), this._redoStack.length = 0, this._notify(), t;
|
|
215
232
|
}
|
|
216
|
-
/** Keep the setField shadow in step with the commands
|
|
217
|
-
|
|
233
|
+
/** Keep the setField shadow in step with the commands only enqueued. */
|
|
234
|
+
_applyShadow(t) {
|
|
218
235
|
for (const e of t)
|
|
219
|
-
e.kind === "set_field" && this.
|
|
236
|
+
e.kind === "set_field" && this._shadow.set(o(e.eid, e.def, e.field), e.value);
|
|
220
237
|
}
|
|
221
238
|
}
|
|
222
|
-
function
|
|
239
|
+
function _(r, t, e, s, n) {
|
|
223
240
|
return {
|
|
224
241
|
get value() {
|
|
225
242
|
return n !== void 0 ? n() : r.committedField(t, e, s);
|
|
@@ -235,5 +252,5 @@ function c(r, t, e, s, n) {
|
|
|
235
252
|
export {
|
|
236
253
|
u as Editor,
|
|
237
254
|
h as TransactionBuilder,
|
|
238
|
-
|
|
255
|
+
_ as fieldHandle
|
|
239
256
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { EventReader } from '../../core/ecs/event.cjs';
|
|
2
|
+
export declare class EventChannel {
|
|
3
|
+
readonly fieldNames: string[];
|
|
4
|
+
readonly columns: number[][];
|
|
5
|
+
readonly reader: EventReader<any>;
|
|
6
|
+
private readonly _readerLen;
|
|
7
|
+
constructor(fieldNames: string[]);
|
|
8
|
+
emit(values: Record<string, number>): void;
|
|
9
|
+
/** Emit a signal (zero-field event). */
|
|
10
|
+
emitSignal(): void;
|
|
11
|
+
clear(): void;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=event_channel.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { EventReader } from '../../core/ecs/event.js';
|
|
2
|
+
export declare class EventChannel {
|
|
3
|
+
readonly fieldNames: string[];
|
|
4
|
+
readonly columns: number[][];
|
|
5
|
+
readonly reader: EventReader<any>;
|
|
6
|
+
private readonly _readerLen;
|
|
7
|
+
constructor(fieldNames: string[]);
|
|
8
|
+
emit(values: Record<string, number>): void;
|
|
9
|
+
/** Emit a signal (zero-field event). */
|
|
10
|
+
emitSignal(): void;
|
|
11
|
+
clear(): void;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=event_channel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event_channel.d.ts","sourceRoot":"","sources":["../../../src/plugins/events/event_channel.ts"],"names":[],"mappings":"AAAA;;;;;;;;KAQK;AAIL,OAAO,KAAK,EAAE,WAAW,EAAe,MAAM,sBAAsB,CAAC;AAErE,qBAAa,YAAY;IACxB,SAAgB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrC,SAAgB,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC;IAEpC,SAAgB,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC;IAMzC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAqB;gBAEpC,UAAU,EAAE,MAAM,EAAE;IAsBzB,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAsBjD,wCAAwC;IACjC,UAAU,IAAI,IAAI;IAIlB,KAAK,IAAI,IAAI;CAOpB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { EmptyEventSchema, EventDef, EventHooks, EventReader, EventShape } from '../../core/ecs/event.cjs';
|
|
2
|
+
export declare class EventRegistry implements EventHooks {
|
|
3
|
+
private readonly _channels;
|
|
4
|
+
private readonly _dirtyChannels;
|
|
5
|
+
private _nextEventId;
|
|
6
|
+
private readonly _defsByKey;
|
|
7
|
+
register<S extends EventShape<S>>(fields: readonly (keyof S & string)[]): EventDef<S>;
|
|
8
|
+
emit(def: EventDef<any>, values: Record<string, number>): void;
|
|
9
|
+
emitSignal(def: EventDef<EmptyEventSchema>): void;
|
|
10
|
+
reader<S extends EventShape<S>>(def: EventDef<S>): EventReader<S>;
|
|
11
|
+
clear(): void;
|
|
12
|
+
/** `DEV`-only: total events currently buffered across the dirty channels.
|
|
13
|
+
* `ECS.update` samples this either side of the settle hooks to assert an
|
|
14
|
+
* onSet observer emitted nothing, its emissions would be wiped by the
|
|
15
|
+
* tick-tail `clear` and break the empty-channel-at-boundary invariant that
|
|
16
|
+
* snapshot and restore rely on. Walks only the dirty list, never the hot emit path. */
|
|
17
|
+
devBufferedCount(): number;
|
|
18
|
+
registerByKey<S extends EventShape<S>>(key: symbol, fields: readonly (keyof S & string)[]): EventDef<S>;
|
|
19
|
+
defByKey(key: symbol): EventDef<any>;
|
|
20
|
+
hasKey(key: symbol): boolean;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=event_registry.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { EmptyEventSchema, EventDef, EventHooks, EventReader, EventShape } from '../../core/ecs/event.js';
|
|
2
|
+
export declare class EventRegistry implements EventHooks {
|
|
3
|
+
private readonly _channels;
|
|
4
|
+
private readonly _dirtyChannels;
|
|
5
|
+
private _nextEventId;
|
|
6
|
+
private readonly _defsByKey;
|
|
7
|
+
register<S extends EventShape<S>>(fields: readonly (keyof S & string)[]): EventDef<S>;
|
|
8
|
+
emit(def: EventDef<any>, values: Record<string, number>): void;
|
|
9
|
+
emitSignal(def: EventDef<EmptyEventSchema>): void;
|
|
10
|
+
reader<S extends EventShape<S>>(def: EventDef<S>): EventReader<S>;
|
|
11
|
+
clear(): void;
|
|
12
|
+
/** `DEV`-only: total events currently buffered across the dirty channels.
|
|
13
|
+
* `ECS.update` samples this either side of the settle hooks to assert an
|
|
14
|
+
* onSet observer emitted nothing, its emissions would be wiped by the
|
|
15
|
+
* tick-tail `clear` and break the empty-channel-at-boundary invariant that
|
|
16
|
+
* snapshot and restore rely on. Walks only the dirty list, never the hot emit path. */
|
|
17
|
+
devBufferedCount(): number;
|
|
18
|
+
registerByKey<S extends EventShape<S>>(key: symbol, fields: readonly (keyof S & string)[]): EventDef<S>;
|
|
19
|
+
defByKey(key: symbol): EventDef<any>;
|
|
20
|
+
hasKey(key: symbol): boolean;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=event_registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event_registry.d.ts","sourceRoot":"","sources":["../../../src/plugins/events/event_registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;KAQK;AAIL,OAAO,EAEN,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,MAAM,sBAAsB,CAAC;AAG9B,qBAAa,aAAc,YAAW,UAAU;IAE/C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAsB;IAKhD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAgB;IAC/C,OAAO,CAAC,YAAY,CAAK;IAIzB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAyC;IAE7D,QAAQ,CAAC,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC;IAOrF,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAY9D,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GAAG,IAAI;IAQjD,MAAM,CAAC,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC;IAIjE,KAAK,IAAI,IAAI;IAepB;;;;2FAIuF;IAChF,gBAAgB,IAAI,MAAM;IAQ1B,aAAa,CAAC,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,EAC3C,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,GACnC,QAAQ,CAAC,CAAC,CAAC;IAcP,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC;IAYpC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;CAGnC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { EventFieldsCover, EventKey, EventReader, EventShape, SignalKey } from '../../core/ecs/event.cjs';
|
|
2
|
+
import { EventRegistry } from './event_registry.cjs';
|
|
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
|