@oasys/oecs 0.4.0 → 0.5.1

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.
Files changed (273) hide show
  1. package/CHANGELOG.md +636 -0
  2. package/README.md +47 -32
  3. package/dist/core/ecs/access_check.d.cts +77 -0
  4. package/dist/core/ecs/access_check.d.ts +8 -8
  5. package/dist/core/ecs/access_check.d.ts.map +1 -1
  6. package/dist/core/ecs/archetype.d.cts +486 -0
  7. package/dist/core/ecs/archetype.d.ts +25 -13
  8. package/dist/core/ecs/archetype.d.ts.map +1 -1
  9. package/dist/core/ecs/archetype_graph.d.cts +96 -0
  10. package/dist/core/ecs/archetype_graph.d.ts +96 -0
  11. package/dist/core/ecs/archetype_graph.d.ts.map +1 -0
  12. package/dist/core/ecs/builtin_relations.d.cts +43 -0
  13. package/dist/core/ecs/builtin_relations.d.ts +8 -8
  14. package/dist/core/ecs/builtin_relations.d.ts.map +1 -1
  15. package/dist/core/ecs/command_log.d.cts +116 -0
  16. package/dist/core/ecs/command_log.d.ts +13 -10
  17. package/dist/core/ecs/command_log.d.ts.map +1 -1
  18. package/dist/core/ecs/component.d.cts +201 -0
  19. package/dist/core/ecs/component.d.ts +100 -5
  20. package/dist/core/ecs/component.d.ts.map +1 -1
  21. package/dist/core/ecs/compute_backend.d.cts +37 -0
  22. package/dist/core/ecs/compute_backend.d.ts +2 -2
  23. package/dist/core/ecs/debug_names.d.cts +7 -0
  24. package/dist/core/ecs/debug_names.d.ts +7 -0
  25. package/dist/core/ecs/debug_names.d.ts.map +1 -0
  26. package/dist/core/ecs/deferred_commands.d.cts +55 -0
  27. package/dist/core/ecs/deferred_commands.d.ts +55 -0
  28. package/dist/core/ecs/deferred_commands.d.ts.map +1 -0
  29. package/dist/core/ecs/dispatch_trace.d.cts +93 -0
  30. package/dist/core/ecs/dispatch_trace.d.ts +3 -3
  31. package/dist/core/ecs/ecs.d.cts +580 -0
  32. package/dist/core/ecs/ecs.d.ts +340 -293
  33. package/dist/core/ecs/ecs.d.ts.map +1 -1
  34. package/dist/core/ecs/ecs_memory.d.cts +179 -0
  35. package/dist/core/ecs/ecs_memory.d.ts +1 -1
  36. package/dist/core/ecs/entity.d.cts +34 -0
  37. package/dist/core/ecs/entity.d.ts +8 -2
  38. package/dist/core/ecs/entity.d.ts.map +1 -1
  39. package/dist/core/ecs/entity_allocator.d.cts +59 -0
  40. package/dist/core/ecs/entity_allocator.d.ts +59 -0
  41. package/dist/core/ecs/entity_allocator.d.ts.map +1 -0
  42. package/dist/core/ecs/event.d.cts +79 -0
  43. package/dist/core/ecs/event.d.ts +36 -11
  44. package/dist/core/ecs/event.d.ts.map +1 -1
  45. package/dist/core/ecs/event_registry.d.cts +22 -0
  46. package/dist/core/ecs/event_registry.d.ts +22 -0
  47. package/dist/core/ecs/event_registry.d.ts.map +1 -0
  48. package/dist/core/ecs/facades.d.cts +158 -0
  49. package/dist/core/ecs/facades.d.ts +158 -0
  50. package/dist/core/ecs/facades.d.ts.map +1 -0
  51. package/dist/core/ecs/frame_stepper.d.cts +58 -0
  52. package/dist/core/ecs/frame_stepper.d.ts +58 -0
  53. package/dist/core/ecs/frame_stepper.d.ts.map +1 -0
  54. package/dist/core/ecs/frame_trace.d.cts +133 -0
  55. package/dist/core/ecs/frame_trace.d.ts +5 -5
  56. package/dist/core/ecs/frame_trace.d.ts.map +1 -1
  57. package/dist/core/ecs/host_commands.d.cts +284 -0
  58. package/dist/core/ecs/host_commands.d.ts +77 -45
  59. package/dist/core/ecs/host_commands.d.ts.map +1 -1
  60. package/dist/core/ecs/index.d.cts +46 -0
  61. package/dist/core/ecs/index.d.ts +45 -40
  62. package/dist/core/ecs/index.d.ts.map +1 -1
  63. package/dist/core/ecs/observer.d.cts +173 -0
  64. package/dist/core/ecs/observer.d.ts +44 -13
  65. package/dist/core/ecs/observer.d.ts.map +1 -1
  66. package/dist/core/ecs/query.d.cts +734 -0
  67. package/dist/core/ecs/query.d.ts +267 -90
  68. package/dist/core/ecs/query.d.ts.map +1 -1
  69. package/dist/core/ecs/ref.d.cts +31 -0
  70. package/dist/core/ecs/ref.d.ts +3 -3
  71. package/dist/core/ecs/ref.d.ts.map +1 -1
  72. package/dist/core/ecs/relation.d.cts +243 -0
  73. package/dist/core/ecs/relation.d.ts +26 -14
  74. package/dist/core/ecs/relation.d.ts.map +1 -1
  75. package/dist/core/ecs/relation_service.d.cts +235 -0
  76. package/dist/core/ecs/relation_service.d.ts +235 -0
  77. package/dist/core/ecs/relation_service.d.ts.map +1 -0
  78. package/dist/core/ecs/resource.d.cts +53 -0
  79. package/dist/core/ecs/resource.d.ts +25 -5
  80. package/dist/core/ecs/resource.d.ts.map +1 -1
  81. package/dist/core/ecs/resource_registry.d.cts +20 -0
  82. package/dist/core/ecs/resource_registry.d.ts +20 -0
  83. package/dist/core/ecs/resource_registry.d.ts.map +1 -0
  84. package/dist/core/ecs/resume.d.cts +85 -0
  85. package/dist/core/ecs/resume.d.ts +6 -6
  86. package/dist/core/ecs/resume.d.ts.map +1 -1
  87. package/dist/core/ecs/run_condition.d.cts +81 -0
  88. package/dist/core/ecs/run_condition.d.ts +16 -10
  89. package/dist/core/ecs/run_condition.d.ts.map +1 -1
  90. package/dist/core/ecs/schedule.d.cts +142 -0
  91. package/dist/core/ecs/schedule.d.ts +15 -6
  92. package/dist/core/ecs/schedule.d.ts.map +1 -1
  93. package/dist/core/ecs/snapshot_service.d.cts +94 -0
  94. package/dist/core/ecs/snapshot_service.d.ts +94 -0
  95. package/dist/core/ecs/snapshot_service.d.ts.map +1 -0
  96. package/dist/core/ecs/sparse_store.d.cts +110 -0
  97. package/dist/core/ecs/sparse_store.d.ts +5 -2
  98. package/dist/core/ecs/sparse_store.d.ts.map +1 -1
  99. package/dist/core/ecs/store.d.cts +937 -0
  100. package/dist/core/ecs/store.d.ts +144 -356
  101. package/dist/core/ecs/store.d.ts.map +1 -1
  102. package/dist/core/ecs/store_layout_listener.d.cts +23 -0
  103. package/dist/core/ecs/system.d.cts +250 -0
  104. package/dist/core/ecs/system.d.ts +138 -22
  105. package/dist/core/ecs/system.d.ts.map +1 -1
  106. package/dist/{utils/arrays.d.ts → core/ecs/utils/arrays.d.cts} +1 -0
  107. package/dist/core/ecs/utils/error.d.cts +61 -0
  108. package/dist/core/ecs/utils/error.d.ts +12 -2
  109. package/dist/core/ecs/utils/error.d.ts.map +1 -1
  110. package/dist/core/store/action_ring.d.cts +136 -0
  111. package/dist/core/store/allocator.d.cts +238 -0
  112. package/dist/core/store/allocator.d.ts.map +1 -1
  113. package/dist/core/store/buffer_backed_column.d.cts +69 -0
  114. package/dist/core/store/buffer_backed_column.d.ts +2 -2
  115. package/dist/core/store/column_store.d.cts +273 -0
  116. package/dist/core/store/column_store.d.ts +18 -10
  117. package/dist/core/store/column_store.d.ts.map +1 -1
  118. package/dist/core/store/command_dispatch.d.cts +52 -0
  119. package/dist/core/store/command_ring.d.cts +107 -0
  120. package/dist/core/store/descriptor.d.cts +80 -0
  121. package/dist/core/store/descriptor.d.ts +1 -1
  122. package/dist/core/store/descriptor.d.ts.map +1 -1
  123. package/dist/core/store/entity_index.d.cts +108 -0
  124. package/dist/core/store/event_ring.d.cts +95 -0
  125. package/dist/core/store/extend.d.cts +39 -0
  126. package/dist/core/store/extend.d.ts +3 -73
  127. package/dist/core/store/extend.d.ts.map +1 -1
  128. package/dist/core/store/grow.d.cts +34 -0
  129. package/dist/core/store/grow.d.ts +4 -9
  130. package/dist/core/store/grow.d.ts.map +1 -1
  131. package/dist/core/store/header.d.cts +64 -0
  132. package/dist/core/store/header.d.ts +1 -1
  133. package/dist/core/store/header.d.ts.map +1 -1
  134. package/dist/core/store/index.d.cts +17 -0
  135. package/dist/core/store/index.d.ts +16 -15
  136. package/dist/core/store/index.d.ts.map +1 -1
  137. package/dist/core/store/layout_ops.d.cts +152 -0
  138. package/dist/core/store/layout_ops.d.ts +152 -0
  139. package/dist/core/store/layout_ops.d.ts.map +1 -0
  140. package/dist/core/store/region_table.d.cts +74 -0
  141. package/dist/core/store/region_table.d.ts +1 -1
  142. package/dist/core/store/region_table.d.ts.map +1 -1
  143. package/dist/core/store/snapshot.d.cts +43 -0
  144. package/dist/core/store/snapshot.d.ts +2 -2
  145. package/dist/core/store/state_hash.d.cts +38 -0
  146. package/dist/core/store/state_hash.d.ts +1 -1
  147. package/dist/core/store/store_regions.d.cts +38 -0
  148. package/dist/core/store/store_regions.d.ts +1 -1
  149. package/dist/core/store/vendored_abi/abi.d.ts +43 -0
  150. package/dist/core/store/{__generated__ → vendored_abi}/abi.d.ts.map +1 -1
  151. package/dist/dev_flag.d.cts +2 -0
  152. package/dist/dev_flag.d.ts +2 -0
  153. package/dist/dev_flag.d.ts.map +1 -0
  154. package/dist/extensions/editor/editor.d.cts +172 -0
  155. package/dist/extensions/editor/editor.d.ts +65 -42
  156. package/dist/extensions/editor/editor.d.ts.map +1 -1
  157. package/dist/extensions/editor/field_handle.d.cts +40 -0
  158. package/dist/extensions/editor/field_handle.d.ts +10 -5
  159. package/dist/extensions/editor/field_handle.d.ts.map +1 -1
  160. package/dist/extensions/editor/index.cjs +1 -1
  161. package/dist/extensions/editor/index.d.cts +21 -0
  162. package/dist/extensions/editor/index.d.ts +2 -2
  163. package/dist/extensions/editor/index.js +130 -100
  164. package/dist/extensions/reactive/ecs_sync.d.cts +214 -0
  165. package/dist/extensions/reactive/ecs_sync.d.ts +26 -22
  166. package/dist/extensions/reactive/ecs_sync.d.ts.map +1 -1
  167. package/dist/extensions/reactive/index.cjs +1 -1
  168. package/dist/extensions/reactive/index.d.cts +23 -0
  169. package/dist/extensions/reactive/index.d.ts +1 -1
  170. package/dist/extensions/reactive/index.js +106 -116
  171. package/dist/extensions/solid/index.cjs +1 -1
  172. package/dist/extensions/solid/index.d.cts +6 -0
  173. package/dist/extensions/solid/index.d.ts +2 -2
  174. package/dist/extensions/solid/index.js +8 -4
  175. package/dist/extensions/solid/kernel_solid.d.cts +45 -0
  176. package/dist/extensions/solid/kernel_solid.d.ts +6 -3
  177. package/dist/extensions/solid/kernel_solid.d.ts.map +1 -1
  178. package/dist/host_commands-BI8pEmjH.js +2326 -0
  179. package/dist/host_commands-CxhpzMx9.cjs +1 -0
  180. package/dist/index.cjs +1 -2
  181. package/dist/index.d.cts +66 -0
  182. package/dist/index.d.ts +50 -1
  183. package/dist/index.d.ts.map +1 -1
  184. package/dist/index.js +4489 -5898
  185. package/dist/internal.cjs +2 -0
  186. package/dist/internal.d.cts +20 -0
  187. package/dist/internal.d.ts +20 -0
  188. package/dist/internal.d.ts.map +1 -0
  189. package/dist/internal.js +141 -0
  190. package/dist/primitives.cjs +1 -1
  191. package/dist/primitives.d.cts +18 -0
  192. package/dist/primitives.d.ts +6 -6
  193. package/dist/primitives.js +24 -23
  194. package/dist/reactive/array.d.ts +24 -0
  195. package/dist/reactive/array.d.ts.map +1 -0
  196. package/dist/reactive/index.cjs +1 -0
  197. package/dist/reactive/index.d.cts +11 -0
  198. package/dist/reactive/index.d.ts +11 -0
  199. package/dist/reactive/index.d.ts.map +1 -0
  200. package/dist/reactive/index.js +18 -0
  201. package/dist/reactive/interop.d.cts +19 -0
  202. package/dist/{core/reactive → reactive}/interop.d.ts +1 -1
  203. package/dist/reactive/interop.d.ts.map +1 -0
  204. package/dist/reactive/kernel.d.cts +73 -0
  205. package/dist/{core/reactive → reactive}/kernel.d.ts +5 -3
  206. package/dist/reactive/kernel.d.ts.map +1 -0
  207. package/dist/reactive/map.d.ts +16 -0
  208. package/dist/reactive/map.d.ts.map +1 -0
  209. package/dist/reactive/shallow.d.cts +11 -0
  210. package/dist/reactive/shallow.d.ts +11 -0
  211. package/dist/reactive/shallow.d.ts.map +1 -0
  212. package/dist/reactive/struct.d.cts +10 -0
  213. package/dist/{core/reactive → reactive}/struct.d.ts +1 -1
  214. package/dist/reactive/struct.d.ts.map +1 -0
  215. package/dist/shallow-DQ8aG51_.cjs +1 -0
  216. package/dist/shallow-DfnAm9vG.js +150 -0
  217. package/dist/shared-BU1Cd40h.js +103 -0
  218. package/dist/shared-BymrGTyR.cjs +1 -0
  219. package/dist/shared.cjs +1 -1
  220. package/dist/shared.d.cts +22 -0
  221. package/dist/shared.d.ts +2 -2
  222. package/dist/shared.js +1 -1
  223. package/dist/topological_sort-BDvEyb9W.cjs +1 -0
  224. package/dist/topological_sort-DK6EjpWa.js +135 -0
  225. package/dist/type_primitives/assertions.d.cts +32 -0
  226. package/dist/type_primitives/assertions.d.ts +13 -1
  227. package/dist/type_primitives/assertions.d.ts.map +1 -1
  228. package/dist/type_primitives/binary_heap/binary_heap.d.cts +37 -0
  229. package/dist/type_primitives/bitset/bitset.d.cts +54 -0
  230. package/dist/type_primitives/brand.d.cts +23 -0
  231. package/dist/type_primitives/error.d.cts +16 -0
  232. package/dist/type_primitives/error.d.ts +4 -3
  233. package/dist/type_primitives/error.d.ts.map +1 -1
  234. package/dist/type_primitives/index.d.cts +13 -0
  235. package/dist/type_primitives/index.d.ts +9 -9
  236. package/dist/type_primitives/sparse_map/sparse_map.d.cts +30 -0
  237. package/dist/type_primitives/sparse_set/sparse_set.d.cts +28 -0
  238. package/dist/type_primitives/topological_sort/topological_sort.d.cts +29 -0
  239. package/dist/type_primitives/typed_arrays/typed_arrays.d.cts +127 -0
  240. package/dist/typed_arrays-BcXcnzB4.js +258 -0
  241. package/dist/typed_arrays-D3NmwtCG.cjs +1 -0
  242. package/dist/utils/error.d.cts +6 -0
  243. package/dist/version.d.cts +10 -0
  244. package/dist/version.d.ts +10 -0
  245. package/dist/version.d.ts.map +1 -0
  246. package/package.json +102 -19
  247. package/dist/array-CxbPyiHO.cjs +0 -1
  248. package/dist/array-uFR7Q8fU.js +0 -132
  249. package/dist/core/reactive/array.d.ts.map +0 -1
  250. package/dist/core/reactive/index.cjs +0 -1
  251. package/dist/core/reactive/index.d.ts +0 -10
  252. package/dist/core/reactive/index.d.ts.map +0 -1
  253. package/dist/core/reactive/index.js +0 -17
  254. package/dist/core/reactive/interop.d.ts.map +0 -1
  255. package/dist/core/reactive/kernel.d.ts.map +0 -1
  256. package/dist/core/reactive/map.d.ts.map +0 -1
  257. package/dist/core/reactive/struct.d.ts.map +0 -1
  258. package/dist/log/console_sink.d.ts +0 -4
  259. package/dist/log/console_sink.d.ts.map +0 -1
  260. package/dist/log/index.d.ts +0 -3
  261. package/dist/log/index.d.ts.map +0 -1
  262. package/dist/log/logger.d.ts +0 -27
  263. package/dist/log/logger.d.ts.map +0 -1
  264. package/dist/shared-BXSZnxx4.cjs +0 -1
  265. package/dist/shared-C678TAPY.js +0 -99
  266. package/dist/topological_sort-DlRpSrxu.js +0 -391
  267. package/dist/topological_sort-WAT-VHb-.cjs +0 -1
  268. package/dist/utils/arrays.d.ts.map +0 -1
  269. package/dist/utils/constants.d.ts.map +0 -1
  270. /package/dist/{utils/constants.d.ts → core/ecs/utils/constants.d.cts} +0 -0
  271. /package/dist/core/store/{__generated__/abi.d.ts → vendored_abi/abi.d.cts} +0 -0
  272. /package/dist/{core/reactive/array.d.ts → reactive/array.d.cts} +0 -0
  273. /package/dist/{core/reactive/map.d.ts → reactive/map.d.cts} +0 -0
@@ -1,12 +1,7 @@
1
- import { ReactiveArray, ReactiveMap, StructSetters } from '../../core/reactive';
2
- import { ComponentDef, ComponentSchema, ECS, EntityID, SystemAccessDeclaration } from '../../core/ecs';
3
- /**
4
- * Shallow (one-level) value equality — the recommended `eq` for object-valued
5
- * projections. Mirrors zustand `useShallow` / MobX `comparer.shallow`: two objects
6
- * are equal iff they have the same own keys with `Object.is`-equal values. Restores
7
- * "equal write wakes nobody" for projections that build a fresh object each tick.
8
- */
9
- export declare function shallow(a: object, b: object): boolean;
1
+ import { ReactiveArray, ReactiveMap, StructSetters, StructEq } from '../../reactive/index.js';
2
+ import { ComponentDef, ComponentSchema, ECS, EntityID, SystemAccessDeclaration } from '../../core/ecs/index.js';
3
+ import { shallow } from '../../reactive/shallow.js';
4
+ export { shallow };
10
5
  /**
11
6
  * A read cursor over one entity's single-component state, handed to a single-
12
7
  * component `Projection`. `field` is column-backed under "column" grain
@@ -32,16 +27,19 @@ export interface RowReader<S extends ComponentSchema> {
32
27
  * Lifetime: like `RowReader`, a reused mutable singleton valid ONLY during the
33
28
  * synchronous `project` call — never capture it; the next dispatch mutates it.
34
29
  */
35
- export interface JoinReader {
30
+ export interface JoinReader<Schemas extends readonly ComponentSchema[] = readonly ComponentSchema[]> {
36
31
  /** The current entity (it has all joined components). */
37
32
  readonly eid: EntityID;
38
- /** Read a field of one joined component for the current entity. */
39
- field<S extends ComponentSchema, K extends string & keyof S>(def: ComponentDef<S>, name: K): number;
33
+ /** Read a field of one joined component for the current entity. `def` is
34
+ * constrained to the join's own component set reading a def outside the
35
+ * join is the stale-read footgun the module header warns about (its changes
36
+ * aren't subscribed), so it's a compile error. */
37
+ field<S extends Schemas[number], K extends string & keyof S>(def: ComponentDef<S>, name: K): number;
40
38
  }
41
39
  /** Map one single-component row to the value a UI cell reads. */
42
40
  export type Projection<S extends ComponentSchema, V> = (row: RowReader<S>) => V;
43
41
  /** Map one joined entity to the value a UI cell reads. */
44
- export type JoinProjection<V> = (row: JoinReader) => V;
42
+ export type JoinProjection<V, Schemas extends readonly ComponentSchema[] = readonly ComponentSchema[]> = (row: JoinReader<Schemas>) => V;
45
43
  /** Per-component dirty grain. See the module header for the measured crossover. */
46
44
  export type SyncGrain = "entity" | "column";
47
45
  export interface EcsMapSyncOptions<V> {
@@ -55,7 +53,7 @@ export interface EcsMapSyncOptions<V> {
55
53
  eq?: (a: V, b: V) => boolean;
56
54
  /**
57
55
  * Access surface the projection touches, merged over the synced components'
58
- * `reads`. `__DEV__` access-checks the observer callbacks exactly like a system.
56
+ * `reads`. `DEV` access-checks the observer callbacks exactly like a system.
59
57
  */
60
58
  access?: Partial<SystemAccessDeclaration>;
61
59
  /**
@@ -79,7 +77,7 @@ export interface EcsMapSync<V> {
79
77
  * To read more than one component per row, use `syncJoinToMap` — reading a second
80
78
  * component here goes stale (its changes aren't subscribed).
81
79
  */
82
- export declare function syncComponentToMap<S extends ComponentSchema, V>(world: ECS, def: ComponentDef<S>, project: Projection<S, V>, opts?: EcsMapSyncOptions<V>): EcsMapSync<V>;
80
+ export declare function syncComponentToMap<S extends ComponentSchema, V>(ecs: ECS, def: ComponentDef<S>, project: Projection<S, V>, opts?: EcsMapSyncOptions<V>): EcsMapSync<V>;
83
81
  /**
84
82
  * Sugar over `syncComponentToMap`: project a fixed FIELD LIST into a `{ field:
85
83
  * value }` snapshot, with an automatic `shallow` eq so an unchanged row wakes
@@ -93,7 +91,7 @@ export declare function syncComponentToMap<S extends ComponentSchema, V>(world:
93
91
  * or hand-written-`eq` projection, so the hot path doesn't allocate exactly where
94
92
  * the column grain is meant to keep it cheap.
95
93
  */
96
- export declare function syncFieldsToMap<S extends ComponentSchema, const F extends readonly (string & keyof S)[]>(world: ECS, def: ComponentDef<S>, fields: F, opts?: Omit<EcsMapSyncOptions<{
94
+ export declare function syncFieldsToMap<S extends ComponentSchema, const F extends readonly (string & keyof S)[]>(ecs: ECS, def: ComponentDef<S>, fields: F, opts?: Omit<EcsMapSyncOptions<{
97
95
  [K in F[number]]: number;
98
96
  }>, "eq">): EcsMapSync<{
99
97
  [K in F[number]]: number;
@@ -109,7 +107,9 @@ export declare function syncFieldsToMap<S extends ComponentSchema, const F exten
109
107
  * Entity grain only: a join spans archetypes, so there is no single column to
110
108
  * sweep. Drive with `batchedUpdate(world, dt)`.
111
109
  */
112
- export declare function syncJoinToMap<V>(world: ECS, defs: readonly ComponentDef[], project: JoinProjection<V>, opts?: Omit<EcsMapSyncOptions<V>, "grain">): EcsMapSync<V>;
110
+ export declare function syncJoinToMap<Schemas extends readonly ComponentSchema[], V>(ecs: ECS, defs: readonly [...{
111
+ [I in keyof Schemas]: ComponentDef<Schemas[I]>;
112
+ }], project: JoinProjection<V, Schemas>, opts?: Omit<EcsMapSyncOptions<V>, "grain">): EcsMapSync<V>;
113
113
  export interface SingletonStructSync<V extends object> {
114
114
  /** The live per-field channel: reading `struct.field` in a tracked scope
115
115
  * subscribes to that field alone (pair with `fromKernelStruct` to render). */
@@ -120,7 +120,7 @@ export interface SingletonStructSync<V extends object> {
120
120
  export interface SingletonSyncOptions<V extends object = Record<string, number>> {
121
121
  /**
122
122
  * Access surface the publish touches, merged over the synced def's read.
123
- * `__DEV__` access-checks the observer callbacks exactly like a system.
123
+ * `DEV` access-checks the observer callbacks exactly like a system.
124
124
  */
125
125
  access?: Partial<SystemAccessDeclaration>;
126
126
  /** Replay current state on registration (default `true`). flecs `yieldExisting`. */
@@ -134,6 +134,10 @@ export interface SingletonSyncOptions<V extends object = Record<string, number>>
134
134
  * the eager initials with the entity's current values on registration.
135
135
  */
136
136
  into?: readonly [V, StructSetters<V>];
137
+ /** Per-field equality overrides for the created struct (parity with
138
+ * `SingletonArraySyncOptions.eq`). Ignored when `into` supplies a
139
+ * pre-created struct — that struct already carries its own `eq`. */
140
+ eq?: StructEq<V>;
137
141
  }
138
142
  /**
139
143
  * Sync ONE singleton entity's single-component state into a `reactiveStruct`,
@@ -165,7 +169,7 @@ export interface SingletonSyncOptions<V extends object = Record<string, number>>
165
169
  * or the zeros of a freshly-created one — captured (untracked) at registration, NOT a
166
170
  * blind 0. A singleton is rarely despawned; this keeps the channel well-defined if it is.
167
171
  */
168
- export declare function syncSingletonToStruct<S extends ComponentSchema, const F extends readonly (string & keyof S)[]>(world: ECS, def: ComponentDef<S>, eid: EntityID, fields: F, opts?: SingletonSyncOptions<{
172
+ export declare function syncSingletonToStruct<S extends ComponentSchema, const F extends readonly (string & keyof S)[]>(ecs: ECS, def: ComponentDef<S>, eid: EntityID, fields: F, opts?: SingletonSyncOptions<{
169
173
  [K in F[number]]: number;
170
174
  }>): SingletonStructSync<{
171
175
  [K in F[number]]: number;
@@ -197,14 +201,14 @@ export interface SingletonArraySyncOptions<T> {
197
201
  * `fields` is explicit (a `ComponentDef` is a branded number at runtime). Pair with
198
202
  * `@oasys/oecs/solid`'s `fromKernelArray` + a Solid `<Index>`.
199
203
  */
200
- export declare function syncSingletonToArray<S extends ComponentSchema>(world: ECS, def: ComponentDef<S>, eid: EntityID, fields: readonly (string & keyof S)[], opts?: SingletonArraySyncOptions<number>): SingletonArraySync<number>;
204
+ export declare function syncSingletonToArray<S extends ComponentSchema>(ecs: ECS, def: ComponentDef<S>, eid: EntityID, fields: readonly (string & keyof S)[], opts?: SingletonArraySyncOptions<number>): SingletonArraySync<number>;
201
205
  /**
202
206
  * Advance the world one tick with every bridge publish coalesced into a single UI
203
207
  * flush. onAdd/onRemove fire mid-tick at flush boundaries and onSet fires at the
204
208
  * tick tail; wrapping the whole update in `batch` defers the effect flush until the
205
209
  * tick completes, so a frame that touched K entities (across any number of syncs on
206
210
  * this world) wakes its readers once, not once per observer dispatch point.
207
- * Equivalent to `batch(() => world.update(dt))`.
211
+ * Equivalent to `batch(() => ecs.update(dt))`.
208
212
  */
209
- export declare function batchedUpdate(world: ECS, dt: number): void;
213
+ export declare function batchedUpdate(ecs: ECS, dt: number): void;
210
214
  //# sourceMappingURL=ecs_sync.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ecs_sync.d.ts","sourceRoot":"","sources":["../../../src/extensions/reactive/ecs_sync.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0EG;AACH,OAAO,EAMN,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAEX,YAAY,EACZ,eAAe,EACf,GAAG,EACH,QAAQ,EAGR,uBAAuB,EAEvB,MAAM,gBAAgB,CAAC;AAExB;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAWrD;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,eAAe;IACnD,oDAAoD;IACpD,QAAQ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CAAC,CAAC,CAAC;IACxB,0EAA0E;IAC1E,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC;CAC7B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,eAAe,EAC7D,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,EACpB,GAAG,EAAE,QAAQ,EACb,MAAM,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,EAAE,EACrC,IAAI,GAAE,yBAAyB,CAAC,MAAM,CAAM,GAC1C,kBAAkB,CAAC,MAAM,CAAC,CA2D5B;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAExD"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../../kernel-yWV3XnAb.cjs"),p=require("../../array-CxbPyiHO.cjs");function _(a,n){if(Object.is(a,n))return!0;const s=a,r=n,i=Object.keys(s);if(i.length!==Object.keys(r).length)return!1;for(let l=0;l<i.length;l++){const u=i[l];if(!Object.prototype.hasOwnProperty.call(r,u)||!Object.is(s[u],r[u]))return!1}return!0}class v{constructor(n){this.def=n}_ctx;_eid=0;get eid(){return this._eid}field(n){return this._ctx.getField(this._eid,this.def,n)}}class w{constructor(n){this.def=n}_eid=0;_row=0;cols=new Map;arch;bind(n){this.arch=n,this.cols.clear()}get eid(){return this._eid}field(n){let s=this.cols.get(n);return s===void 0&&(s=this.arch.getColumnRead(this.def,n),this.cols.set(n,s)),s[this._row]}}class E{_ctx;_eid=0;get eid(){return this._eid}field(n,s){return this._ctx.getField(this._eid,n,s)}}function m(a,n,s,r={}){const i=p.reactiveMap(r.eq),l={...r.access,reads:[n,...r.access?.reads??[]]},u=r.grain??"entity",d=r.seedExisting??!0,b=new v(n),h=(o,t)=>{t.isDisabled(o)||(b._ctx=t,b._eid=o,i.set(o,s(b)))};let g;return f.batch(()=>{if(u==="column"){const o=new w(n);g=a.observe(n,{granularity:"archetype",onSet:t=>{o.bind(t);const c=t.entityIds;for(let e=0;e<t.entityCount;e++)o._row=e,o._eid=c[e],i.set(o._eid,s(o))},onAdd:(t,c)=>h(t,c),onRemove:t=>i.delete(t),onDisable:t=>i.delete(t),onEnable:(t,c)=>h(t,c),access:l,yieldExisting:d})}else g=a.observe(n,{granularity:"entity",onSet:(o,t)=>h(o,t),onAdd:(o,t)=>h(o,t),onRemove:o=>i.delete(o),onDisable:o=>i.delete(o),onEnable:(o,t)=>h(o,t),access:l,yieldExisting:d})}),{map:i,dispose:()=>g.dispose()}}function S(a,n,s,r={}){return m(a,n,l=>{const u={};for(let d=0;d<s.length;d++)u[s[d]]=l.field(s[d]);return u},{...r,eq:_})}function R(a,n,s,r={}){const i=p.reactiveMap(r.eq),l={...r.access,reads:[...n,...r.access?.reads??[]]},u=r.seedExisting??!0,d=new E,b=(t,c)=>{for(let e=0;e<n.length;e++)if(!t.hasComponent(c,n[e]))return!1;return!0},h=(t,c)=>{c.isDisabled(t)||b(c,t)&&(d._ctx=c,d._eid=t,i.set(t,s(d)))},g=t=>{i.delete(t)};let o;return f.batch(()=>{o=n.map(t=>a.observe(t,{granularity:"entity",onSet:h,onAdd:h,onRemove:g,onDisable:g,onEnable:h,access:l,yieldExisting:u}))}),{map:i,dispose:()=>{for(let t=0;t<o.length;t++)o[t].dispose()}}}function T(a,n,s,r,i={}){const l={};for(let e=0;e<r.length;e++)l[r[e]]=0;const[u,d]=i.into??p.reactiveStruct(l),b=f.untrack(()=>r.map(e=>u[e])),h={...i.access,reads:[n,...i.access?.reads??[]]},g=i.seedExisting??!0,o=e=>{for(let y=0;y<r.length;y++)d[r[y]](e.getField(s,n,r[y]))},t=()=>{for(let e=0;e<r.length;e++)d[r[e]](b[e])};let c;return f.batch(()=>{c=a.observe(n,{granularity:"entity",onSet:(e,y)=>{e===s&&o(y)},onAdd:(e,y)=>{e===s&&!y.isDisabled(s)&&o(y)},onRemove:e=>{e===s&&t()},onDisable:e=>{e===s&&t()},onEnable:(e,y)=>{e===s&&o(y)},access:h,yieldExisting:g})}),{struct:u,dispose:()=>c.dispose()}}function x(a,n,s,r,i={}){const l=i.into??p.reactiveArray(new Array(r.length).fill(0),i.eq),u=f.untrack(()=>l.snapshot());if(i.into!==void 0&&u.length!==r.length)throw new Error(`syncSingletonToArray: into.length (${u.length}) must equal fields.length (${r.length})`);const d={...i.access,reads:[n,...i.access?.reads??[]]},b=i.seedExisting??!0,h=new Array(r.length),g=c=>{for(let e=0;e<r.length;e++)h[e]=c.getField(s,n,r[e]);l.reconcile(h)},o=()=>l.reconcile(u);let t;return f.batch(()=>{t=a.observe(n,{granularity:"entity",onSet:(c,e)=>{c===s&&g(e)},onAdd:(c,e)=>{c===s&&!e.isDisabled(s)&&g(e)},onRemove:c=>{c===s&&o()},onDisable:c=>{c===s&&o()},onEnable:(c,e)=>{c===s&&g(e)},access:d,yieldExisting:b})}),{array:l,dispose:()=>t.dispose()}}function A(a,n){f.batch(()=>a.update(n))}exports.batchedUpdate=A;exports.shallow=_;exports.syncComponentToMap=m;exports.syncFieldsToMap=S;exports.syncJoinToMap=R;exports.syncSingletonToArray=x;exports.syncSingletonToStruct=T;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../../kernel-yWV3XnAb.cjs"),_=require("../../shallow-DQ8aG51_.cjs");class w{constructor(n){this.def=n}_ctx;_eid=0;get eid(){return this._eid}field(n){return this._ctx.getField(this._eid,this.def,n)}}class m{constructor(n){this.def=n}_eid=0;_row=0;cols=new Map;arch;bind(n){this.arch=n,this.cols.clear()}get eid(){return this._eid}field(n){let s=this.cols.get(n);return s===void 0&&(s=this.arch.getColumnRead(this.def,n),this.cols.set(n,s)),s[this._row]}}class v{_ctx;_eid=0;get eid(){return this._eid}field(n,s){return this._ctx.getField(this._eid,n,s)}}function p(l,n,s,r={}){const c=_.reactiveMap(r.eq),a={...r.access,reads:[n,...r.access?.reads??[]]},h=r.grain??"entity",u=r.seedExisting??!0,b=new w(n),y=(i,o)=>{o.isDisabled(i)||(b._ctx=o,b._eid=i,c.set(i,s(b)))};let g;return f.batch(()=>{if(h==="column"){const i=new m(n);g=l.observe(n,{granularity:"archetype",onSet:o=>{i.bind(o);const t=o.entityIds;for(let e=0;e<o.entityCount;e++)i._row=e,i._eid=t[e],c.set(i._eid,s(i))},onAdd:(o,t)=>y(o,t),onRemove:o=>c.delete(o),onDisable:o=>c.delete(o),onEnable:(o,t)=>y(o,t),access:a,yieldExisting:u})}else g=l.observe(n,{granularity:"entity",onSet:(i,o)=>y(i,o),onAdd:(i,o)=>y(i,o),onRemove:i=>c.delete(i),onDisable:i=>c.delete(i),onEnable:(i,o)=>y(i,o),access:a,yieldExisting:u})}),{map:c,dispose:()=>g.dispose()}}function E(l,n,s,r={}){return p(l,n,a=>{const h={};for(let u=0;u<s.length;u++)h[s[u]]=a.field(s[u]);return h},{...r,eq:_.shallow})}function S(l,n,s,r={}){const c=n,a=_.reactiveMap(r.eq),h={...r.access,reads:[...c,...r.access?.reads??[]]},u=r.seedExisting??!0,b=new v,y=(t,e)=>{for(let d=0;d<c.length;d++)if(!t.hasComponent(e,c[d]))return!1;return!0},g=(t,e)=>{e.isDisabled(t)||y(e,t)&&(b._ctx=e,b._eid=t,a.set(t,s(b)))},i=t=>{a.delete(t)};let o;return f.batch(()=>{o=c.map(t=>l.observe(t,{granularity:"entity",onSet:g,onAdd:g,onRemove:i,onDisable:i,onEnable:g,access:h,yieldExisting:u}))}),{map:a,dispose:()=>{for(let t=0;t<o.length;t++)o[t].dispose()}}}function R(l,n,s,r,c={}){const a={};for(let e=0;e<r.length;e++)a[r[e]]=0;const[h,u]=c.into??_.reactiveStruct(a,c.eq),b=f.untrack(()=>r.map(e=>h[e])),y={...c.access,reads:[n,...c.access?.reads??[]]},g=c.seedExisting??!0,i=e=>{for(let d=0;d<r.length;d++)u[r[d]](e.getField(s,n,r[d]))},o=()=>{for(let e=0;e<r.length;e++)u[r[e]](b[e])};let t;return f.batch(()=>{t=l.observe(n,{granularity:"entity",onSet:(e,d)=>{e===s&&i(d)},onAdd:(e,d)=>{e===s&&!d.isDisabled(s)&&i(d)},onRemove:e=>{e===s&&o()},onDisable:e=>{e===s&&o()},onEnable:(e,d)=>{e===s&&i(d)},access:y,yieldExisting:g})}),{struct:h,dispose:()=>t.dispose()}}function T(l,n,s,r,c={}){const a=c.into??_.reactiveArray(new Array(r.length).fill(0),c.eq),h=f.untrack(()=>a.snapshot());if(c.into!==void 0&&h.length!==r.length)throw new Error(`syncSingletonToArray: into.length (${h.length}) must equal fields.length (${r.length})`);const u={...c.access,reads:[n,...c.access?.reads??[]]},b=c.seedExisting??!0,y=new Array(r.length),g=t=>{for(let e=0;e<r.length;e++)y[e]=t.getField(s,n,r[e]);a.reconcile(y)},i=()=>a.reconcile(h);let o;return f.batch(()=>{o=l.observe(n,{granularity:"entity",onSet:(t,e)=>{t===s&&g(e)},onAdd:(t,e)=>{t===s&&!e.isDisabled(s)&&g(e)},onRemove:t=>{t===s&&i()},onDisable:t=>{t===s&&i()},onEnable:(t,e)=>{t===s&&g(e)},access:u,yieldExisting:b})}),{array:a,dispose:()=>o.dispose()}}function x(l,n){f.batch(()=>l.update(n))}exports.shallow=_.shallow;exports.batchedUpdate=x;exports.syncComponentToMap=p;exports.syncFieldsToMap=E;exports.syncJoinToMap=S;exports.syncSingletonToArray=T;exports.syncSingletonToStruct=R;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The production ECS→UI reactive bridge (#672 / ADR-0021).
3
+ *
4
+ * Drains the engine's own change detection (ADR-0013 component observers, riding
5
+ * the ADR-0012 per-row dirty list) into a `reactiveMap` — publishing O(changed),
6
+ * not O(all), each tick. Declarative selection + closure projection (the Bevy
7
+ * `ExtractComponent` / WatermelonDB `observeWithColumns` shape):
8
+ * - `syncComponentToMap(def, project)` — one component, grain `"entity"`/`"column"`.
9
+ * - `syncFieldsToMap(def, [fields])` — field-list sugar with auto `shallow` eq.
10
+ * - `syncJoinToMap([defs], project)` — multi-component join (subscribes all defs).
11
+ *
12
+ * For singleton/ephemeral UI state (net status+latency, FPS/mem, wave timer), model
13
+ * it as a component on a reserved singleton entity and read it keyless via per-field
14
+ * channels (#687 / ADR-0024) — NOT a separate reactive-resource subsystem:
15
+ * - `syncSingletonToStruct(def, eid, [fields])` — one singleton entity → `reactiveStruct`.
16
+ * - `syncSingletonToArray(def, eid, [fields])` — one singleton entity → `reactiveArray` (ordered slots).
17
+ *
18
+ * The framework-agnostic counterpart to the Solid leaf: pair the map entry points
19
+ * with `@oasys/oecs/solid`'s `fromKernelMap`, the singleton struct with
20
+ * `fromKernelStruct`, and the singleton array with `fromKernelArray`, to render.
21
+ */
22
+ export { syncComponentToMap, syncFieldsToMap, syncJoinToMap, syncSingletonToStruct, syncSingletonToArray, batchedUpdate, shallow, type Projection, type JoinProjection, type RowReader, type JoinReader, type SyncGrain, type EcsMapSync, type EcsMapSyncOptions, type SingletonStructSync, type SingletonSyncOptions, type SingletonArraySync, type SingletonArraySyncOptions } from './ecs_sync.cjs';
23
+ //# sourceMappingURL=index.d.ts.map
@@ -19,5 +19,5 @@
19
19
  * with `@oasys/oecs/solid`'s `fromKernelMap`, the singleton struct with
20
20
  * `fromKernelStruct`, and the singleton array with `fromKernelArray`, to render.
21
21
  */
22
- export { syncComponentToMap, syncFieldsToMap, syncJoinToMap, syncSingletonToStruct, syncSingletonToArray, batchedUpdate, shallow, type Projection, type JoinProjection, type RowReader, type JoinReader, type SyncGrain, type EcsMapSync, type EcsMapSyncOptions, type SingletonStructSync, type SingletonSyncOptions, type SingletonArraySync, type SingletonArraySyncOptions } from './ecs_sync';
22
+ export { syncComponentToMap, syncFieldsToMap, syncJoinToMap, syncSingletonToStruct, syncSingletonToArray, batchedUpdate, shallow, type Projection, type JoinProjection, type RowReader, type JoinReader, type SyncGrain, type EcsMapSync, type EcsMapSyncOptions, type SingletonStructSync, type SingletonSyncOptions, type SingletonArraySync, type SingletonArraySyncOptions } from './ecs_sync.js';
23
23
  //# sourceMappingURL=index.d.ts.map
@@ -1,15 +1,5 @@
1
1
  import { b as f, u as _ } from "../../kernel-DgyrLFjW.js";
2
- import { r as p, a as m, b as E } from "../../array-uFR7Q8fU.js";
3
- function w(a, n) {
4
- if (Object.is(a, n)) return !0;
5
- const s = a, r = n, o = Object.keys(s);
6
- if (o.length !== Object.keys(r).length) return !1;
7
- for (let l = 0; l < o.length; l++) {
8
- const u = o[l];
9
- if (!Object.prototype.hasOwnProperty.call(r, u) || !Object.is(s[u], r[u])) return !1;
10
- }
11
- return !0;
12
- }
2
+ import { r as m, s as E, a as p, b as w } from "../../shallow-DfnAm9vG.js";
13
3
  class v {
14
4
  constructor(n) {
15
5
  this.def = n;
@@ -53,173 +43,173 @@ class x {
53
43
  return this._ctx.getField(this._eid, n, s);
54
44
  }
55
45
  }
56
- function A(a, n, s, r = {}) {
57
- const o = p(r.eq), l = {
46
+ function A(l, n, s, r = {}) {
47
+ const c = m(r.eq), a = {
58
48
  ...r.access,
59
49
  reads: [n, ...r.access?.reads ?? []]
60
- }, u = r.grain ?? "entity", d = r.seedExisting ?? !0, b = new v(n), h = (i, t) => {
61
- t.isDisabled(i) || (b._ctx = t, b._eid = i, o.set(i, s(b)));
50
+ }, h = r.grain ?? "entity", u = r.seedExisting ?? !0, b = new v(n), y = (o, i) => {
51
+ i.isDisabled(o) || (b._ctx = i, b._eid = o, c.set(o, s(b)));
62
52
  };
63
53
  let g;
64
54
  return f(() => {
65
- if (u === "column") {
66
- const i = new R(n);
67
- g = a.observe(n, {
55
+ if (h === "column") {
56
+ const o = new R(n);
57
+ g = l.observe(n, {
68
58
  granularity: "archetype",
69
- onSet: (t) => {
70
- i.bind(t);
71
- const c = t.entityIds;
72
- for (let e = 0; e < t.entityCount; e++)
73
- i._row = e, i._eid = c[e], o.set(i._eid, s(i));
59
+ onSet: (i) => {
60
+ o.bind(i);
61
+ const t = i.entityIds;
62
+ for (let e = 0; e < i.entityCount; e++)
63
+ o._row = e, o._eid = t[e], c.set(o._eid, s(o));
74
64
  },
75
- onAdd: (t, c) => h(t, c),
76
- onRemove: (t) => o.delete(t),
65
+ onAdd: (i, t) => y(i, t),
66
+ onRemove: (i) => c.delete(i),
77
67
  // Disable = soft remove from the channel; enable = re-add (#677). The
78
68
  // column sweep is bounded by enabled rows, so a disabled row would never
79
69
  // refresh — drop it on disable, republish on enable.
80
- onDisable: (t) => o.delete(t),
81
- onEnable: (t, c) => h(t, c),
82
- access: l,
83
- yieldExisting: d
70
+ onDisable: (i) => c.delete(i),
71
+ onEnable: (i, t) => y(i, t),
72
+ access: a,
73
+ yieldExisting: u
84
74
  });
85
75
  } else
86
- g = a.observe(n, {
76
+ g = l.observe(n, {
87
77
  granularity: "entity",
88
- onSet: (i, t) => h(i, t),
89
- onAdd: (i, t) => h(i, t),
90
- onRemove: (i) => o.delete(i),
91
- onDisable: (i) => o.delete(i),
92
- onEnable: (i, t) => h(i, t),
93
- access: l,
94
- yieldExisting: d
78
+ onSet: (o, i) => y(o, i),
79
+ onAdd: (o, i) => y(o, i),
80
+ onRemove: (o) => c.delete(o),
81
+ onDisable: (o) => c.delete(o),
82
+ onEnable: (o, i) => y(o, i),
83
+ access: a,
84
+ yieldExisting: u
95
85
  });
96
- }), { map: o, dispose: () => g.dispose() };
86
+ }), { map: c, dispose: () => g.dispose() };
97
87
  }
98
- function j(a, n, s, r = {}) {
99
- return A(a, n, (l) => {
100
- const u = {};
101
- for (let d = 0; d < s.length; d++) u[s[d]] = l.field(s[d]);
102
- return u;
103
- }, { ...r, eq: w });
88
+ function q(l, n, s, r = {}) {
89
+ return A(l, n, (a) => {
90
+ const h = {};
91
+ for (let u = 0; u < s.length; u++) h[s[u]] = a.field(s[u]);
92
+ return h;
93
+ }, { ...r, eq: E });
104
94
  }
105
- function M(a, n, s, r = {}) {
106
- const o = p(r.eq), l = {
95
+ function M(l, n, s, r = {}) {
96
+ const c = n, a = m(r.eq), h = {
107
97
  ...r.access,
108
- reads: [...n, ...r.access?.reads ?? []]
109
- }, u = r.seedExisting ?? !0, d = new x(), b = (t, c) => {
110
- for (let e = 0; e < n.length; e++) if (!t.hasComponent(c, n[e])) return !1;
98
+ reads: [...c, ...r.access?.reads ?? []]
99
+ }, u = r.seedExisting ?? !0, b = new x(), y = (t, e) => {
100
+ for (let d = 0; d < c.length; d++) if (!t.hasComponent(e, c[d])) return !1;
111
101
  return !0;
112
- }, h = (t, c) => {
113
- c.isDisabled(t) || b(c, t) && (d._ctx = c, d._eid = t, o.set(t, s(d)));
114
- }, g = (t) => {
115
- o.delete(t);
102
+ }, g = (t, e) => {
103
+ e.isDisabled(t) || y(e, t) && (b._ctx = e, b._eid = t, a.set(t, s(b)));
104
+ }, o = (t) => {
105
+ a.delete(t);
116
106
  };
117
107
  let i;
118
108
  return f(() => {
119
- i = n.map(
120
- (t) => a.observe(t, {
109
+ i = c.map(
110
+ (t) => l.observe(t, {
121
111
  granularity: "entity",
122
- onSet: h,
123
- onAdd: h,
124
- onRemove: g,
112
+ onSet: g,
113
+ onAdd: g,
114
+ onRemove: o,
125
115
  // Disabling any joined component soft-removes the entity from the
126
116
  // channel; enabling re-evaluates membership and republishes (#677). A
127
117
  // disable fires once per carried joined component — `dropRow` is
128
118
  // idempotent, and `publishIfMember` re-checks the full join.
129
- onDisable: g,
130
- onEnable: h,
131
- access: l,
119
+ onDisable: o,
120
+ onEnable: g,
121
+ access: h,
132
122
  yieldExisting: u
133
123
  })
134
124
  );
135
125
  }), {
136
- map: o,
126
+ map: a,
137
127
  dispose: () => {
138
128
  for (let t = 0; t < i.length; t++) i[t].dispose();
139
129
  }
140
130
  };
141
131
  }
142
- function O(a, n, s, r, o = {}) {
143
- const l = {};
144
- for (let e = 0; e < r.length; e++) l[r[e]] = 0;
145
- const [u, d] = o.into ?? m(l), b = _(() => r.map((e) => u[e])), h = {
146
- ...o.access,
147
- reads: [n, ...o.access?.reads ?? []]
148
- }, g = o.seedExisting ?? !0, i = (e) => {
149
- for (let y = 0; y < r.length; y++) d[r[y]](e.getField(s, n, r[y]));
150
- }, t = () => {
151
- for (let e = 0; e < r.length; e++) d[r[e]](b[e]);
132
+ function T(l, n, s, r, c = {}) {
133
+ const a = {};
134
+ for (let e = 0; e < r.length; e++) a[r[e]] = 0;
135
+ const [h, u] = c.into ?? p(a, c.eq), b = _(() => r.map((e) => h[e])), y = {
136
+ ...c.access,
137
+ reads: [n, ...c.access?.reads ?? []]
138
+ }, g = c.seedExisting ?? !0, o = (e) => {
139
+ for (let d = 0; d < r.length; d++) u[r[d]](e.getField(s, n, r[d]));
140
+ }, i = () => {
141
+ for (let e = 0; e < r.length; e++) u[r[e]](b[e]);
152
142
  };
153
- let c;
143
+ let t;
154
144
  return f(() => {
155
- c = a.observe(n, {
145
+ t = l.observe(n, {
156
146
  granularity: "entity",
157
- onSet: (e, y) => {
158
- e === s && i(y);
147
+ onSet: (e, d) => {
148
+ e === s && o(d);
159
149
  },
160
- onAdd: (e, y) => {
161
- e === s && !y.isDisabled(s) && i(y);
150
+ onAdd: (e, d) => {
151
+ e === s && !d.isDisabled(s) && o(d);
162
152
  },
163
153
  onRemove: (e) => {
164
- e === s && t();
154
+ e === s && i();
165
155
  },
166
156
  onDisable: (e) => {
167
- e === s && t();
157
+ e === s && i();
168
158
  },
169
- onEnable: (e, y) => {
170
- e === s && i(y);
159
+ onEnable: (e, d) => {
160
+ e === s && o(d);
171
161
  },
172
- access: h,
162
+ access: y,
173
163
  yieldExisting: g
174
164
  });
175
- }), { struct: u, dispose: () => c.dispose() };
165
+ }), { struct: h, dispose: () => t.dispose() };
176
166
  }
177
- function T(a, n, s, r, o = {}) {
178
- const l = o.into ?? E(new Array(r.length).fill(0), o.eq), u = _(() => l.snapshot());
179
- if (o.into !== void 0 && u.length !== r.length)
167
+ function C(l, n, s, r, c = {}) {
168
+ const a = c.into ?? w(new Array(r.length).fill(0), c.eq), h = _(() => a.snapshot());
169
+ if (c.into !== void 0 && h.length !== r.length)
180
170
  throw new Error(
181
- `syncSingletonToArray: into.length (${u.length}) must equal fields.length (${r.length})`
171
+ `syncSingletonToArray: into.length (${h.length}) must equal fields.length (${r.length})`
182
172
  );
183
- const d = {
184
- ...o.access,
185
- reads: [n, ...o.access?.reads ?? []]
186
- }, b = o.seedExisting ?? !0, h = new Array(r.length), g = (c) => {
187
- for (let e = 0; e < r.length; e++) h[e] = c.getField(s, n, r[e]);
188
- l.reconcile(h);
189
- }, i = () => l.reconcile(u);
190
- let t;
173
+ const u = {
174
+ ...c.access,
175
+ reads: [n, ...c.access?.reads ?? []]
176
+ }, b = c.seedExisting ?? !0, y = new Array(r.length), g = (t) => {
177
+ for (let e = 0; e < r.length; e++) y[e] = t.getField(s, n, r[e]);
178
+ a.reconcile(y);
179
+ }, o = () => a.reconcile(h);
180
+ let i;
191
181
  return f(() => {
192
- t = a.observe(n, {
182
+ i = l.observe(n, {
193
183
  granularity: "entity",
194
- onSet: (c, e) => {
195
- c === s && g(e);
184
+ onSet: (t, e) => {
185
+ t === s && g(e);
196
186
  },
197
- onAdd: (c, e) => {
198
- c === s && !e.isDisabled(s) && g(e);
187
+ onAdd: (t, e) => {
188
+ t === s && !e.isDisabled(s) && g(e);
199
189
  },
200
- onRemove: (c) => {
201
- c === s && i();
190
+ onRemove: (t) => {
191
+ t === s && o();
202
192
  },
203
- onDisable: (c) => {
204
- c === s && i();
193
+ onDisable: (t) => {
194
+ t === s && o();
205
195
  },
206
- onEnable: (c, e) => {
207
- c === s && g(e);
196
+ onEnable: (t, e) => {
197
+ t === s && g(e);
208
198
  },
209
- access: d,
199
+ access: u,
210
200
  yieldExisting: b
211
201
  });
212
- }), { array: l, dispose: () => t.dispose() };
202
+ }), { array: a, dispose: () => i.dispose() };
213
203
  }
214
- function k(a, n) {
215
- f(() => a.update(n));
204
+ function F(l, n) {
205
+ f(() => l.update(n));
216
206
  }
217
207
  export {
218
- k as batchedUpdate,
219
- w as shallow,
208
+ F as batchedUpdate,
209
+ E as shallow,
220
210
  A as syncComponentToMap,
221
- j as syncFieldsToMap,
211
+ q as syncFieldsToMap,
222
212
  M as syncJoinToMap,
223
- T as syncSingletonToArray,
224
- O as syncSingletonToStruct
213
+ C as syncSingletonToArray,
214
+ T as syncSingletonToStruct
225
215
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("solid-js"),c=require("../../interop-CT-REx0W.cjs");function l(e){const[t,o]=u.createSignal(e());return u.onCleanup(c.subscribe(e,s=>o(()=>s))),t}function f(e){return{keys:l(()=>e.keys()),cell:t=>l(()=>e.get(t))}}function i(e){const t={},o=Object.keys(e),s=new Set(o);for(const n of o)t[n]=l(()=>e[n]);return new Proxy({},{get:(n,r)=>s.has(r)?t[r]():Reflect.get(n,r),has:(n,r)=>s.has(r),ownKeys:()=>o,getOwnPropertyDescriptor:(n,r)=>s.has(r)?{get:()=>t[r](),enumerable:!0,configurable:!0}:void 0})}function a(e){return l(()=>e.snapshot())}exports.fromKernel=l;exports.fromKernelArray=a;exports.fromKernelMap=f;exports.fromKernelStruct=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("solid-js"),c=require("../../interop-CT-REx0W.cjs");function l(e){const[t,o]=u.createSignal(e());return u.onCleanup(c.subscribe(e,s=>o(()=>s))),t}function f(e){return{keys:l(()=>e.keys()),cell:t=>l(()=>e.get(t))}}function i(e){const t={},o=Object.keys(e),s=new Set(o);for(const n of o)t[n]=l(()=>e[n]);return new Proxy({},{get:(n,r)=>s.has(r)?t[r]():Reflect.get(n,r),has:(n,r)=>s.has(r),ownKeys:()=>o,getOwnPropertyDescriptor:(n,r)=>s.has(r)?{get:()=>t[r](),enumerable:!0,configurable:!0}:void 0,set:(n,r)=>!1})}function a(e){return l(()=>e.snapshot())}exports.fromKernel=l;exports.fromKernelArray=a;exports.fromKernelMap=f;exports.fromKernelStruct=i;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * `@oasys/oecs/solid` — the SolidJS adapter plugin for oecs's reactive
3
+ * kernel (`@oasys/oecs/reactive` / `../../reactive`, #646 / ADR-0021).
4
+ */
5
+ export { fromKernel, fromKernelMap, fromKernelStruct, fromKernelArray, type KernelMapView } from './kernel_solid.cjs';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * `@oasys/oecs/solid` — the SolidJS adapter plugin for oecs's reactive
3
- * kernel (`@oasys/oecs/reactive` / `../../core/reactive`, #646 / ADR-0021).
3
+ * kernel (`@oasys/oecs/reactive` / `../../reactive`, #646 / ADR-0021).
4
4
  */
5
- export { fromKernel, fromKernelMap, fromKernelStruct, fromKernelArray, type KernelMapView } from './kernel_solid';
5
+ export { fromKernel, fromKernelMap, fromKernelStruct, fromKernelArray, type KernelMapView } from './kernel_solid.js';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1,8 +1,8 @@
1
- import { createSignal as c, onCleanup as u } from "solid-js";
1
+ import { createSignal as u, onCleanup as c } from "solid-js";
2
2
  import { s as a } from "../../interop-CcY6ASQc.js";
3
3
  function f(e) {
4
- const [t, o] = c(e());
5
- return u(a(e, (s) => o(() => s))), t;
4
+ const [t, o] = u(e());
5
+ return c(a(e, (s) => o(() => s))), t;
6
6
  }
7
7
  function g(e) {
8
8
  return {
@@ -18,7 +18,11 @@ function m(e) {
18
18
  get: (n, r) => s.has(r) ? t[r]() : Reflect.get(n, r),
19
19
  has: (n, r) => s.has(r),
20
20
  ownKeys: () => o,
21
- getOwnPropertyDescriptor: (n, r) => s.has(r) ? { get: () => t[r](), enumerable: !0, configurable: !0 } : void 0
21
+ getOwnPropertyDescriptor: (n, r) => s.has(r) ? { get: () => t[r](), enumerable: !0, configurable: !0 } : void 0,
22
+ // Read surface only (`Readonly<T>`, POLISH_AUDIT #8) — mirrors the kernel
23
+ // struct proxy's trap so a JS-side assignment fails loudly instead of
24
+ // sticking a non-reactive value on the hidden target.
25
+ set: (n, r) => !1
22
26
  });
23
27
  }
24
28
  function y(e) {
@@ -0,0 +1,45 @@
1
+ import { Accessor } from 'solid-js';
2
+ import { ReactiveArray, ReactiveMap } from '../../reactive/index.cjs';
3
+ /**
4
+ * Mirror a kernel accessor into a Solid accessor. The returned accessor tracks in
5
+ * Solid; it updates once per coalesced kernel change and never on an equal write.
6
+ */
7
+ export declare function fromKernel<T>(accessor: () => T): Accessor<T>;
8
+ /** A kernel `reactiveMap` projected for a keyed Solid `<For>`. */
9
+ export interface KernelMapView<K, V> {
10
+ /** The live key set — pass to a keyed Solid `<For each>`. Keyed on the id. */
11
+ readonly keys: Accessor<readonly K[]>;
12
+ /** A bridged value accessor for one key — read inside the `<For>` row.
13
+ * Each call mints a FRESH bridge (subscription): call it once per row (bind
14
+ * the accessor in the row's scope), never inline it in a hot JSX expression
15
+ * that re-evaluates per render. */
16
+ cell(key: K): Accessor<V | undefined>;
17
+ }
18
+ /**
19
+ * Bridge a kernel `reactiveMap` for keyed Solid rendering. `keys` drives a `<For>`
20
+ * (one row per entity, keyed on the stable id); `cell(id)` is that row's bridged
21
+ * value. Changing one entity wakes only its row; spawn/despawn add/remove one row.
22
+ */
23
+ export declare function fromKernelMap<K, V>(map: ReactiveMap<K, V>): KernelMapView<K, V>;
24
+ /**
25
+ * Bridge a kernel `reactiveStruct` proxy into a Solid-reactive proxy: reading
26
+ * `view.field` in a Solid scope tracks that field alone (one `fromKernel` per
27
+ * field), so a change to one field re-renders only its readers. Completes the
28
+ * `fromKernel` / `fromKernelMap` / `fromKernelStruct` trio — the read side for the
29
+ * singleton/ephemeral UI state `syncSingletonToStruct` publishes (ADR-0024). The
30
+ * field set is read once from the (enumerable) struct proxy; call inside a component
31
+ * or `root` so each field's `onCleanup` has an owner. The kernel struct's per-field
32
+ * `eq` and batching carry through `fromKernel` unchanged.
33
+ */
34
+ export declare function fromKernelStruct<T extends object>(struct: Readonly<T>): Readonly<T>;
35
+ /**
36
+ * Bridge a kernel `reactiveArray` into a Solid accessor of its snapshot, for a
37
+ * positional Solid `<Index each={view()}>`. `<Index>` (NOT `<For>`) is the match for
38
+ * an ordered slot list: it keys by position and hands each slot an accessor, so
39
+ * duplicate primitive values (e.g. empty army slots) don't alias and a slot change
40
+ * updates only that row. The snapshot is the array's coarse read (any slot change
41
+ * wakes it), but `<Index>` then diffs by position and touches only the changed
42
+ * index's DOM. Use `fromKernelMap` instead for an *entity* collection (keyed, `<For>`).
43
+ */
44
+ export declare function fromKernelArray<T>(arr: ReactiveArray<T>): Accessor<readonly T[]>;
45
+ //# sourceMappingURL=kernel_solid.d.ts.map