@fundamental-engine/core 0.4.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.
Files changed (371) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +128 -0
  3. package/dist/agents/element-agent.d.ts +38 -0
  4. package/dist/agents/element-agent.d.ts.map +1 -0
  5. package/dist/agents/element-agent.js +70 -0
  6. package/dist/agents/element-agent.js.map +1 -0
  7. package/dist/agents/event-agent.d.ts +47 -0
  8. package/dist/agents/event-agent.d.ts.map +1 -0
  9. package/dist/agents/event-agent.js +82 -0
  10. package/dist/agents/event-agent.js.map +1 -0
  11. package/dist/agents/index.d.ts +17 -0
  12. package/dist/agents/index.d.ts.map +1 -0
  13. package/dist/agents/index.js +57 -0
  14. package/dist/agents/index.js.map +1 -0
  15. package/dist/agents/region-agents.d.ts +40 -0
  16. package/dist/agents/region-agents.d.ts.map +1 -0
  17. package/dist/agents/region-agents.js +22 -0
  18. package/dist/agents/region-agents.js.map +1 -0
  19. package/dist/agents/relationship.d.ts +55 -0
  20. package/dist/agents/relationship.d.ts.map +1 -0
  21. package/dist/agents/relationship.js +40 -0
  22. package/dist/agents/relationship.js.map +1 -0
  23. package/dist/agents/user-agent.d.ts +57 -0
  24. package/dist/agents/user-agent.d.ts.map +1 -0
  25. package/dist/agents/user-agent.js +45 -0
  26. package/dist/agents/user-agent.js.map +1 -0
  27. package/dist/config/forces.config.d.ts +101 -0
  28. package/dist/config/forces.config.d.ts.map +1 -0
  29. package/dist/config/forces.config.js +239 -0
  30. package/dist/config/forces.config.js.map +1 -0
  31. package/dist/config/manual.d.ts +134 -0
  32. package/dist/config/manual.d.ts.map +1 -0
  33. package/dist/config/manual.js +604 -0
  34. package/dist/config/manual.js.map +1 -0
  35. package/dist/config/palettes.d.ts +18 -0
  36. package/dist/config/palettes.d.ts.map +1 -0
  37. package/dist/config/palettes.js +34 -0
  38. package/dist/config/palettes.js.map +1 -0
  39. package/dist/config/presets.d.ts +48 -0
  40. package/dist/config/presets.d.ts.map +1 -0
  41. package/dist/config/presets.js +87 -0
  42. package/dist/config/presets.js.map +1 -0
  43. package/dist/config/tokens.d.ts +3 -0
  44. package/dist/config/tokens.d.ts.map +1 -0
  45. package/dist/config/tokens.js +16 -0
  46. package/dist/config/tokens.js.map +1 -0
  47. package/dist/conformance/expectations.d.ts +40 -0
  48. package/dist/conformance/expectations.d.ts.map +1 -0
  49. package/dist/conformance/expectations.js +347 -0
  50. package/dist/conformance/expectations.js.map +1 -0
  51. package/dist/conformance/experiments.d.ts +17 -0
  52. package/dist/conformance/experiments.d.ts.map +1 -0
  53. package/dist/conformance/experiments.js +875 -0
  54. package/dist/conformance/experiments.js.map +1 -0
  55. package/dist/conformance/run.d.ts +18 -0
  56. package/dist/conformance/run.d.ts.map +1 -0
  57. package/dist/conformance/run.js +240 -0
  58. package/dist/conformance/run.js.map +1 -0
  59. package/dist/conformance/types.d.ts +100 -0
  60. package/dist/conformance/types.d.ts.map +1 -0
  61. package/dist/conformance/types.js +2 -0
  62. package/dist/conformance/types.js.map +1 -0
  63. package/dist/contracts/guards.d.ts +51 -0
  64. package/dist/contracts/guards.d.ts.map +1 -0
  65. package/dist/contracts/guards.js +100 -0
  66. package/dist/contracts/guards.js.map +1 -0
  67. package/dist/contracts/index.d.ts +18 -0
  68. package/dist/contracts/index.d.ts.map +1 -0
  69. package/dist/contracts/index.js +107 -0
  70. package/dist/contracts/index.js.map +1 -0
  71. package/dist/contracts/passport.d.ts +88 -0
  72. package/dist/contracts/passport.d.ts.map +1 -0
  73. package/dist/contracts/passport.js +135 -0
  74. package/dist/contracts/passport.js.map +1 -0
  75. package/dist/contracts/types.d.ts +120 -0
  76. package/dist/contracts/types.d.ts.map +1 -0
  77. package/dist/contracts/types.js +24 -0
  78. package/dist/contracts/types.js.map +1 -0
  79. package/dist/core/accretion.d.ts +50 -0
  80. package/dist/core/accretion.d.ts.map +1 -0
  81. package/dist/core/accretion.js +98 -0
  82. package/dist/core/accretion.js.map +1 -0
  83. package/dist/core/agents.d.ts +31 -0
  84. package/dist/core/agents.d.ts.map +1 -0
  85. package/dist/core/agents.js +51 -0
  86. package/dist/core/agents.js.map +1 -0
  87. package/dist/core/attention.d.ts +72 -0
  88. package/dist/core/attention.d.ts.map +1 -0
  89. package/dist/core/attention.js +122 -0
  90. package/dist/core/attention.js.map +1 -0
  91. package/dist/core/causality.d.ts +38 -0
  92. package/dist/core/causality.d.ts.map +1 -0
  93. package/dist/core/causality.js +64 -0
  94. package/dist/core/causality.js.map +1 -0
  95. package/dist/core/conditions.d.ts +10 -0
  96. package/dist/core/conditions.d.ts.map +1 -0
  97. package/dist/core/conditions.js +22 -0
  98. package/dist/core/conditions.js.map +1 -0
  99. package/dist/core/currents.d.ts +53 -0
  100. package/dist/core/currents.d.ts.map +1 -0
  101. package/dist/core/currents.js +65 -0
  102. package/dist/core/currents.js.map +1 -0
  103. package/dist/core/dock.d.ts +35 -0
  104. package/dist/core/dock.d.ts.map +1 -0
  105. package/dist/core/dock.js +39 -0
  106. package/dist/core/dock.js.map +1 -0
  107. package/dist/core/events.d.ts +23 -0
  108. package/dist/core/events.d.ts.map +1 -0
  109. package/dist/core/events.js +34 -0
  110. package/dist/core/events.js.map +1 -0
  111. package/dist/core/feedback-sink.d.ts +32 -0
  112. package/dist/core/feedback-sink.d.ts.map +1 -0
  113. package/dist/core/feedback-sink.js +53 -0
  114. package/dist/core/feedback-sink.js.map +1 -0
  115. package/dist/core/feedback.d.ts +11 -0
  116. package/dist/core/feedback.d.ts.map +1 -0
  117. package/dist/core/feedback.js +16 -0
  118. package/dist/core/feedback.js.map +1 -0
  119. package/dist/core/field-store.d.ts +26 -0
  120. package/dist/core/field-store.d.ts.map +1 -0
  121. package/dist/core/field-store.js +54 -0
  122. package/dist/core/field-store.js.map +1 -0
  123. package/dist/core/field.d.ts +18 -0
  124. package/dist/core/field.d.ts.map +1 -0
  125. package/dist/core/field.js +1943 -0
  126. package/dist/core/field.js.map +1 -0
  127. package/dist/core/fieldline-seeds.d.ts +25 -0
  128. package/dist/core/fieldline-seeds.d.ts.map +1 -0
  129. package/dist/core/fieldline-seeds.js +32 -0
  130. package/dist/core/fieldline-seeds.js.map +1 -0
  131. package/dist/core/fieldlines.d.ts +75 -0
  132. package/dist/core/fieldlines.d.ts.map +1 -0
  133. package/dist/core/fieldlines.js +111 -0
  134. package/dist/core/fieldlines.js.map +1 -0
  135. package/dist/core/flow.d.ts +38 -0
  136. package/dist/core/flow.d.ts.map +1 -0
  137. package/dist/core/flow.js +27 -0
  138. package/dist/core/flow.js.map +1 -0
  139. package/dist/core/formations.d.ts +11 -0
  140. package/dist/core/formations.d.ts.map +1 -0
  141. package/dist/core/formations.js +22 -0
  142. package/dist/core/formations.js.map +1 -0
  143. package/dist/core/geometry.d.ts +67 -0
  144. package/dist/core/geometry.d.ts.map +1 -0
  145. package/dist/core/geometry.js +68 -0
  146. package/dist/core/geometry.js.map +1 -0
  147. package/dist/core/heatmap.d.ts +22 -0
  148. package/dist/core/heatmap.d.ts.map +1 -0
  149. package/dist/core/heatmap.js +55 -0
  150. package/dist/core/heatmap.js.map +1 -0
  151. package/dist/core/host.d.ts +46 -0
  152. package/dist/core/host.d.ts.map +1 -0
  153. package/dist/core/host.js +11 -0
  154. package/dist/core/host.js.map +1 -0
  155. package/dist/core/integrator.d.ts +24 -0
  156. package/dist/core/integrator.d.ts.map +1 -0
  157. package/dist/core/integrator.js +375 -0
  158. package/dist/core/integrator.js.map +1 -0
  159. package/dist/core/math.d.ts +37 -0
  160. package/dist/core/math.d.ts.map +1 -0
  161. package/dist/core/math.js +77 -0
  162. package/dist/core/math.js.map +1 -0
  163. package/dist/core/reactions.d.ts +32 -0
  164. package/dist/core/reactions.d.ts.map +1 -0
  165. package/dist/core/reactions.js +45 -0
  166. package/dist/core/reactions.js.map +1 -0
  167. package/dist/core/registry.d.ts +13 -0
  168. package/dist/core/registry.d.ts.map +1 -0
  169. package/dist/core/registry.js +20 -0
  170. package/dist/core/registry.js.map +1 -0
  171. package/dist/core/render-backend.d.ts +46 -0
  172. package/dist/core/render-backend.d.ts.map +1 -0
  173. package/dist/core/render-backend.js +75 -0
  174. package/dist/core/render-backend.js.map +1 -0
  175. package/dist/core/render-modes.d.ts +42 -0
  176. package/dist/core/render-modes.d.ts.map +1 -0
  177. package/dist/core/render-modes.js +141 -0
  178. package/dist/core/render-modes.js.map +1 -0
  179. package/dist/core/reservoir.d.ts +43 -0
  180. package/dist/core/reservoir.d.ts.map +1 -0
  181. package/dist/core/reservoir.js +207 -0
  182. package/dist/core/reservoir.js.map +1 -0
  183. package/dist/core/scalar-grid.d.ts +51 -0
  184. package/dist/core/scalar-grid.d.ts.map +1 -0
  185. package/dist/core/scalar-grid.js +146 -0
  186. package/dist/core/scalar-grid.js.map +1 -0
  187. package/dist/core/scanner.d.ts +59 -0
  188. package/dist/core/scanner.d.ts.map +1 -0
  189. package/dist/core/scanner.js +260 -0
  190. package/dist/core/scanner.js.map +1 -0
  191. package/dist/core/shadow.d.ts +69 -0
  192. package/dist/core/shadow.d.ts.map +1 -0
  193. package/dist/core/shadow.js +84 -0
  194. package/dist/core/shadow.js.map +1 -0
  195. package/dist/core/spatial-hash.d.ts +30 -0
  196. package/dist/core/spatial-hash.d.ts.map +1 -0
  197. package/dist/core/spatial-hash.js +64 -0
  198. package/dist/core/spatial-hash.js.map +1 -0
  199. package/dist/core/streamlines.d.ts +29 -0
  200. package/dist/core/streamlines.d.ts.map +1 -0
  201. package/dist/core/streamlines.js +70 -0
  202. package/dist/core/streamlines.js.map +1 -0
  203. package/dist/core/surface.d.ts +19 -0
  204. package/dist/core/surface.d.ts.map +1 -0
  205. package/dist/core/surface.js +21 -0
  206. package/dist/core/surface.js.map +1 -0
  207. package/dist/core/temporal.d.ts +110 -0
  208. package/dist/core/temporal.d.ts.map +1 -0
  209. package/dist/core/temporal.js +139 -0
  210. package/dist/core/temporal.js.map +1 -0
  211. package/dist/core/thermo.d.ts +48 -0
  212. package/dist/core/thermo.d.ts.map +1 -0
  213. package/dist/core/thermo.js +48 -0
  214. package/dist/core/thermo.js.map +1 -0
  215. package/dist/core/types.d.ts +610 -0
  216. package/dist/core/types.d.ts.map +1 -0
  217. package/dist/core/types.js +2 -0
  218. package/dist/core/types.js.map +1 -0
  219. package/dist/core/weights.d.ts +111 -0
  220. package/dist/core/weights.d.ts.map +1 -0
  221. package/dist/core/weights.js +128 -0
  222. package/dist/core/weights.js.map +1 -0
  223. package/dist/diagnostics/energy.d.ts +21 -0
  224. package/dist/diagnostics/energy.d.ts.map +1 -0
  225. package/dist/diagnostics/energy.js +27 -0
  226. package/dist/diagnostics/energy.js.map +1 -0
  227. package/dist/diagnostics/fields.d.ts +23 -0
  228. package/dist/diagnostics/fields.d.ts.map +1 -0
  229. package/dist/diagnostics/fields.js +30 -0
  230. package/dist/diagnostics/fields.js.map +1 -0
  231. package/dist/diagnostics/index.d.ts +46 -0
  232. package/dist/diagnostics/index.d.ts.map +1 -0
  233. package/dist/diagnostics/index.js +23 -0
  234. package/dist/diagnostics/index.js.map +1 -0
  235. package/dist/diagnostics/modes.d.ts +108 -0
  236. package/dist/diagnostics/modes.d.ts.map +1 -0
  237. package/dist/diagnostics/modes.js +181 -0
  238. package/dist/diagnostics/modes.js.map +1 -0
  239. package/dist/diagnostics/potential.d.ts +30 -0
  240. package/dist/diagnostics/potential.d.ts.map +1 -0
  241. package/dist/diagnostics/potential.js +43 -0
  242. package/dist/diagnostics/potential.js.map +1 -0
  243. package/dist/diagnostics/probes.d.ts +31 -0
  244. package/dist/diagnostics/probes.d.ts.map +1 -0
  245. package/dist/diagnostics/probes.js +61 -0
  246. package/dist/diagnostics/probes.js.map +1 -0
  247. package/dist/diagnostics/render.d.ts +49 -0
  248. package/dist/diagnostics/render.d.ts.map +1 -0
  249. package/dist/diagnostics/render.js +132 -0
  250. package/dist/diagnostics/render.js.map +1 -0
  251. package/dist/export.d.ts +18 -0
  252. package/dist/export.d.ts.map +1 -0
  253. package/dist/export.js +17 -0
  254. package/dist/export.js.map +1 -0
  255. package/dist/forces/extended.d.ts +121 -0
  256. package/dist/forces/extended.d.ts.map +1 -0
  257. package/dist/forces/extended.js +674 -0
  258. package/dist/forces/extended.js.map +1 -0
  259. package/dist/forces/index.d.ts +33 -0
  260. package/dist/forces/index.d.ts.map +1 -0
  261. package/dist/forces/index.js +237 -0
  262. package/dist/forces/index.js.map +1 -0
  263. package/dist/forces/natural.d.ts +106 -0
  264. package/dist/forces/natural.d.ts.map +1 -0
  265. package/dist/forces/natural.js +385 -0
  266. package/dist/forces/natural.js.map +1 -0
  267. package/dist/index.d.ts +59 -0
  268. package/dist/index.d.ts.map +1 -0
  269. package/dist/index.js +71 -0
  270. package/dist/index.js.map +1 -0
  271. package/dist/inspect/budget.d.ts +17 -0
  272. package/dist/inspect/budget.d.ts.map +1 -0
  273. package/dist/inspect/budget.js +19 -0
  274. package/dist/inspect/budget.js.map +1 -0
  275. package/dist/inspect/index.d.ts +10 -0
  276. package/dist/inspect/index.d.ts.map +1 -0
  277. package/dist/inspect/index.js +10 -0
  278. package/dist/inspect/index.js.map +1 -0
  279. package/dist/inspect/report.d.ts +17 -0
  280. package/dist/inspect/report.d.ts.map +1 -0
  281. package/dist/inspect/report.js +44 -0
  282. package/dist/inspect/report.js.map +1 -0
  283. package/dist/inspect/snapshot.d.ts +21 -0
  284. package/dist/inspect/snapshot.d.ts.map +1 -0
  285. package/dist/inspect/snapshot.js +30 -0
  286. package/dist/inspect/snapshot.js.map +1 -0
  287. package/dist/recipes/catalog.d.ts +51 -0
  288. package/dist/recipes/catalog.d.ts.map +1 -0
  289. package/dist/recipes/catalog.js +1496 -0
  290. package/dist/recipes/catalog.js.map +1 -0
  291. package/dist/recipes/charge.d.ts +18 -0
  292. package/dist/recipes/charge.d.ts.map +1 -0
  293. package/dist/recipes/charge.js +27 -0
  294. package/dist/recipes/charge.js.map +1 -0
  295. package/dist/recipes/compile.d.ts +93 -0
  296. package/dist/recipes/compile.d.ts.map +1 -0
  297. package/dist/recipes/compile.js +113 -0
  298. package/dist/recipes/compile.js.map +1 -0
  299. package/dist/recipes/explain.d.ts +8 -0
  300. package/dist/recipes/explain.d.ts.map +1 -0
  301. package/dist/recipes/explain.js +46 -0
  302. package/dist/recipes/explain.js.map +1 -0
  303. package/dist/recipes/gallery.d.ts +6 -0
  304. package/dist/recipes/gallery.d.ts.map +1 -0
  305. package/dist/recipes/gallery.js +6 -0
  306. package/dist/recipes/gallery.js.map +1 -0
  307. package/dist/recipes/gravity.d.ts +16 -0
  308. package/dist/recipes/gravity.d.ts.map +1 -0
  309. package/dist/recipes/gravity.js +27 -0
  310. package/dist/recipes/gravity.js.map +1 -0
  311. package/dist/recipes/index.d.ts +18 -0
  312. package/dist/recipes/index.d.ts.map +1 -0
  313. package/dist/recipes/index.js +36 -0
  314. package/dist/recipes/index.js.map +1 -0
  315. package/dist/recipes/intent.d.ts +44 -0
  316. package/dist/recipes/intent.d.ts.map +1 -0
  317. package/dist/recipes/intent.js +46 -0
  318. package/dist/recipes/intent.js.map +1 -0
  319. package/dist/recipes/schema.d.ts +103 -0
  320. package/dist/recipes/schema.d.ts.map +1 -0
  321. package/dist/recipes/schema.js +123 -0
  322. package/dist/recipes/schema.js.map +1 -0
  323. package/dist/recipes/wayfinding.d.ts +39 -0
  324. package/dist/recipes/wayfinding.d.ts.map +1 -0
  325. package/dist/recipes/wayfinding.js +77 -0
  326. package/dist/recipes/wayfinding.js.map +1 -0
  327. package/dist/semantic/index.d.ts +13 -0
  328. package/dist/semantic/index.d.ts.map +1 -0
  329. package/dist/semantic/index.js +31 -0
  330. package/dist/semantic/index.js.map +1 -0
  331. package/dist/semantic/layers.d.ts +24 -0
  332. package/dist/semantic/layers.d.ts.map +1 -0
  333. package/dist/semantic/layers.js +27 -0
  334. package/dist/semantic/layers.js.map +1 -0
  335. package/dist/semantic/materials.d.ts +20 -0
  336. package/dist/semantic/materials.d.ts.map +1 -0
  337. package/dist/semantic/materials.js +17 -0
  338. package/dist/semantic/materials.js.map +1 -0
  339. package/dist/semantic/states.d.ts +11 -0
  340. package/dist/semantic/states.d.ts.map +1 -0
  341. package/dist/semantic/states.js +26 -0
  342. package/dist/semantic/states.js.map +1 -0
  343. package/dist/visual/channels.d.ts +71 -0
  344. package/dist/visual/channels.d.ts.map +1 -0
  345. package/dist/visual/channels.js +70 -0
  346. package/dist/visual/channels.js.map +1 -0
  347. package/dist/visual/index.d.ts +39 -0
  348. package/dist/visual/index.d.ts.map +1 -0
  349. package/dist/visual/index.js +30 -0
  350. package/dist/visual/index.js.map +1 -0
  351. package/dist/visual/lint.d.ts +41 -0
  352. package/dist/visual/lint.d.ts.map +1 -0
  353. package/dist/visual/lint.js +58 -0
  354. package/dist/visual/lint.js.map +1 -0
  355. package/dist/visual/mapping.d.ts +13 -0
  356. package/dist/visual/mapping.d.ts.map +1 -0
  357. package/dist/visual/mapping.js +43 -0
  358. package/dist/visual/mapping.js.map +1 -0
  359. package/dist/visual/semantic-text.d.ts +28 -0
  360. package/dist/visual/semantic-text.d.ts.map +1 -0
  361. package/dist/visual/semantic-text.js +36 -0
  362. package/dist/visual/semantic-text.js.map +1 -0
  363. package/dist/visual/tokens.d.ts +23 -0
  364. package/dist/visual/tokens.d.ts.map +1 -0
  365. package/dist/visual/tokens.js +54 -0
  366. package/dist/visual/tokens.js.map +1 -0
  367. package/dist/visual/visualization.d.ts +31 -0
  368. package/dist/visual/visualization.d.ts.map +1 -0
  369. package/dist/visual/visualization.js +47 -0
  370. package/dist/visual/visualization.js.map +1 -0
  371. package/package.json +60 -0
@@ -0,0 +1,385 @@
1
+ /**
2
+ * Natural primitives (§20.10) — real field laws, not the designed UI falloffs.
3
+ *
4
+ * The canonical nine (§6) are *designed*: finite range, soft `(1 − d/d_max)ⁿ`
5
+ * falloff, tuned for legible motion on content bodies. These are *natural*: a true
6
+ * softened inverse-square law in the sim unit system (§20.10). `gravity` and
7
+ * `charge` are the **same kernel** — only the source scalar differs (mass ≥ 0 vs.
8
+ * signed charge), which is the one unification the spec says is worth coding once.
9
+ *
10
+ * Opt-in: a body only feels them via `data-body="gravity"` / `data-body="charge"`,
11
+ * so registering them changes nothing on a page that doesn't ask for them.
12
+ */
13
+ import { polePair, dipoleField, EPS } from "../core/geometry.js";
14
+ /**
15
+ * The body's dipole field at a world point (the visual/structure field, Stage B): the
16
+ * two-pole superposition scaled by the source magnitude. Shared by `magnetism` (the bar
17
+ * magnet, rendered but not followed) and `charge` (the electric field the force flows
18
+ * along). `s` is the source scalar — `strength` for B, `M` for the charge field.
19
+ *
20
+ * A body with little or no extent (an abstract scenario, a point element) would put both
21
+ * poles at the centre, where the ± contributions cancel to zero. So when the rect-derived
22
+ * separation is negligible, synthesize the dipole along the heading at a fraction of the
23
+ * body's range — every magnetism/charge source then reads as a dipole, regardless of size.
24
+ *
25
+ * Chargeable bodies (field-systems Stage C2): a body's accumulated charge `Q = b.d` (the
26
+ * bounded, eased density the field writes back as `--d` on a `data-feedback` element)
27
+ * sources its field — as the element charges up, it radiates up to `1 + Q_GAIN`× its base
28
+ * field. `b.d` is 0 on point/headless bodies, so the base field is unchanged there.
29
+ */
30
+ const Q_GAIN = 1.5;
31
+ const DIPOLE_MIN_SEP = 8; // px — below this the rect gives no usable dipole axis
32
+ const DIPOLE_MIN_REACH = 60; // px — synthesized pole reach floor (covers range-0 / point bodies)
33
+ function bodyDipole(b, x, y, s) {
34
+ let poles = polePair(b);
35
+ const sep = Math.hypot(poles[0].x - poles[1].x, poles[0].y - poles[1].y);
36
+ // synthesize when the rect gives no usable separation. The pixel floors matter for a global
37
+ // body (`data-range="0"`): `range*0.06`/`range*0.18` would be 0, collapsing the dipole to a
38
+ // zero field — the floors keep it a readable dipole regardless of size.
39
+ if (sep < Math.max(b.range * 0.06, DIPOLE_MIN_SEP)) {
40
+ const half = Math.max(b.range * 0.18, DIPOLE_MIN_REACH);
41
+ const sgn = b.spin < 0 ? -1 : 1;
42
+ poles = [
43
+ { x: b.cx + b.ux * half, y: b.cy + b.uy * half, q: sgn },
44
+ { x: b.cx - b.ux * half, y: b.cy - b.uy * half, q: -sgn },
45
+ ];
46
+ }
47
+ const sq = s * (1 + Q_GAIN * (b.d ?? 0)); // charged elements radiate a stronger field
48
+ const f = dipoleField(poles, x, y);
49
+ return { x: f.x * sq, y: f.y * sq };
50
+ }
51
+ /**
52
+ * The radial monopole field of a single point charge (the electric field, §20.3): straight
53
+ * field lines out of a positive source, into a negative one — `E = σ·s·r̂/(d²+ε²)`, where `σ`
54
+ * is the body's polarity (`spin`). Unlike a magnet (a dipole — magnetic monopoles do not
55
+ * exist, so `magnetism` loops), a lone electric charge radiates, so `charge` is a monopole.
56
+ */
57
+ function bodyMonopole(b, x, y, s) {
58
+ const dx = x - b.cx;
59
+ const dy = y - b.cy;
60
+ const d = Math.max(Math.hypot(dx, dy), EPS);
61
+ const sgn = b.spin < 0 ? -1 : 1;
62
+ const mag = (sgn * s * (1 + Q_GAIN * (b.d ?? 0))) / (d * d); // 1/d², signed by polarity
63
+ return { x: (dx / d) * mag, y: (dy / d) * mag };
64
+ }
65
+ /**
66
+ * The shared softened inverse-square kernel (§20.10): `s / (d² + ε²)` along the
67
+ * unit vector toward the body, then clamp speed to the unit system's `c` (the
68
+ * hard velocity cap that *is* the speed of light in-sim).
69
+ *
70
+ * Plummer softening `ε = r_s = 2GM/c²` keeps the force finite at the core while
71
+ * staying a true `1/d²` law far out — exactly how N-body sims avoid the singularity.
72
+ * `s` is the signed source strength: `+GM` for gravity (always attractive),
73
+ * `−σ·q·GM` for charge (like repels, opposite attracts).
74
+ *
75
+ * Sign note: this engine's `e.dx/e.dy` point from the particle *toward* the body,
76
+ * so `+s` pulls inward (gravity attracts). Charge negates `σ·q·GM` so that like
77
+ * signs push outward — the §20.3 formula written for an outward-pointing `û`.
78
+ */
79
+ export function inverseSquare(b, p, e, s) {
80
+ if (e.dist >= b.range)
81
+ return; // practical cutoff radius (an N-body softening too)
82
+ const rs = (2 * e.G * b.M) / (e.c * e.c); // Schwarzschild radius → softening ε (§20.10)
83
+ const f = s / (e.dist * e.dist + rs * rs); // s/(d²+ε²)
84
+ p.vx += (e.dx / e.dist) * f;
85
+ p.vy += (e.dy / e.dist) * f;
86
+ if (e.dz)
87
+ p.vz = (p.vz ?? 0) + (e.dz / e.dist) * f; // z leg (z-axis.md) — inert when flat
88
+ clampToC(p, e.c);
89
+ }
90
+ /** Clamp a particle's speed to the unit system's `c` — the hard velocity cap that
91
+ * IS the in-sim speed of light (§20.10). Shared by the natural primitives. */
92
+ function clampToC(p, c) {
93
+ const vz = p.vz ?? 0;
94
+ const sp = Math.hypot(p.vx, p.vy, vz);
95
+ if (sp > c) {
96
+ p.vx = (p.vx / sp) * c;
97
+ p.vy = (p.vy / sp) * c;
98
+ if (vz)
99
+ p.vz = (vz / sp) * c;
100
+ }
101
+ }
102
+ /**
103
+ * The radial gravitational field at a world point (Stage B — renderable structure, not a particle
104
+ * path). Always points toward the mass: `g = M·r̂/(d²+ε²)` toward the body, sourced by `M` (the
105
+ * same `b.d` mass-gain as the EM fields, so a dense element radiates a stronger well). Pure: no
106
+ * particle, no velocity. Rendered as inward radial field lines; matter still accelerates through
107
+ * `apply()`, and a sideways-moving particle can orbit rather than fall straight in.
108
+ */
109
+ function bodyGravityField(b, x, y) {
110
+ const dx = b.cx - x; // toward the body — gravity attracts
111
+ const dy = b.cy - y;
112
+ const d = Math.max(Math.hypot(dx, dy), EPS);
113
+ const mag = (b.M * (1 + Q_GAIN * (b.d ?? 0))) / (d * d); // M/d², stronger as the body charges up
114
+ return { x: (dx / d) * mag, y: (dy / d) * mag };
115
+ }
116
+ /** §20.10 — true softened inverse-square: `F = GM·d̂/(d²+ε²)`, always attractive. */
117
+ export const gravity = {
118
+ token: 'gravity',
119
+ label: 'Gravity',
120
+ apply(b, p, e) {
121
+ inverseSquare(b, p, e, e.G * b.M); // GM, mass-sourced (M ≥ 0 → pulls in)
122
+ },
123
+ // The inward radial gravitational field (Stage B): renderable structure that `fieldflow` can
124
+ // also follow. `apply()` is unchanged — this only makes gravity visible/followable, never
125
+ // altering the force law (a field line is not always a particle path).
126
+ field: (b, x, y) => bodyGravityField(b, x, y),
127
+ meta: { desc: 'true softened inverse-square gravity (a real 1/d² law)' },
128
+ };
129
+ /** §20.3/§20.10 — the signed sibling of gravity; same kernel, sign sets direction. */
130
+ export const charge = {
131
+ token: 'charge',
132
+ label: 'Charge',
133
+ apply(b, p, e) {
134
+ const q = p.charge ?? 0; // neutral matter ignores charge fields
135
+ if (q === 0)
136
+ return;
137
+ // F = σ·q·GM/(d²+ε²); σ = body sign (data-spin), GM = G·M. Negated for the
138
+ // inward-pointing kernel so like signs repel and opposite signs attract.
139
+ inverseSquare(b, p, e, -(b.spin * q * e.G * b.M));
140
+ },
141
+ // The radial electric field the charge projects (Stage B), sourced by `M` and signed by
142
+ // `spin`: straight field lines, OUT of a + source and IN to a −. A lone charge is a
143
+ // monopole (unlike a magnet's dipole) — the force already flows charged matter along it.
144
+ field: (b, x, y) => bodyMonopole(b, x, y, b.M),
145
+ meta: { desc: 'signed inverse-square — like repels, opposite attracts' },
146
+ };
147
+ /**
148
+ * §20.10 — the Lorentz force on a moving charge. In 2D the magnetic field `B` is a
149
+ * scalar out of the plane, so the force is perpendicular to velocity: it curves a
150
+ * particle's path into a circle (cyclotron radius `r_L = m|v|/(qB)`) **without doing
151
+ * work** — speed is preserved, only the heading turns. The body's `spin` sets the
152
+ * out-of-plane sense (which way it curls); `strength` is `|B|`. Acts only on charged,
153
+ * *moving* matter; neutral particles pass straight through.
154
+ *
155
+ * `B` is graded by a `(1 − d/r)` falloff, so the curl is strongest at the core and eases
156
+ * to zero at the rim — a localized, soft-edged field rather than a uniform region with a
157
+ * hard cutoff (the field-systems plan, Stage 0). The rotation preserves speed at every
158
+ * distance; only the turn angle shrinks outward.
159
+ */
160
+ export const magnetism = {
161
+ token: 'magnetism',
162
+ label: 'Magnetism',
163
+ apply(b, p, e) {
164
+ if (e.dist >= b.range)
165
+ return; // inside the field region
166
+ const q = p.charge ?? 0;
167
+ if (q === 0)
168
+ return; // the Lorentz force needs charge
169
+ // Exact rotation by θ = q·spin·B per frame — preserves |v| to floating-point precision.
170
+ // The Euler form (p.vx += -vy*f; p.vy += vx*f) passes the ⟂ test but accumulates
171
+ // speed as sqrt(1+(qB)²)^N, which grows noticeably at strength > 0.1.
172
+ const falloff = 1 - e.dist / b.range; // ∈ (0, 1] inside the region
173
+ const theta = q * b.spin * b.strength * falloff;
174
+ const cs = Math.cos(theta);
175
+ const sn = Math.sin(theta);
176
+ const vx0 = p.vx;
177
+ p.vx = vx0 * cs - p.vy * sn;
178
+ p.vy = vx0 * sn + p.vy * cs;
179
+ },
180
+ // The dipole structure of B (Stage B). Rendered as field lines; particles curve
181
+ // perpendicular to it (the apply above) rather than following it. Sourced by `strength`.
182
+ field: (b, x, y) => bodyDipole(b, x, y, b.strength),
183
+ meta: { desc: 'Lorentz force — curves a moving charge perpendicular to its velocity' },
184
+ };
185
+ /**
186
+ * The Langevin noise amplitude `σ = √(2·k_B·T·γ)` (§20.10). In sim units `k_B = γ = 1`,
187
+ * so `σ = √(2T)`; negative `T` is floored to 0 (no imaginary kicks). Pure, so the
188
+ * fluctuation–dissipation law itself is golden-tested apart from the RNG.
189
+ */
190
+ export function thermalSigma(T) {
191
+ return Math.sqrt(2 * Math.max(0, T));
192
+ }
193
+ /**
194
+ * §20.10 — `thermal`: Langevin/Brownian agitation, the *honest* `wander`. Each frame
195
+ * a charge-free Gaussian kick `v += σ·ξ` (ξ ~ N(0,1) per axis) jiggles matter, with
196
+ * `σ = √(2T)`. Paired with `drag` (`−γv`) it's a **thermostat** — fluctuation–
197
+ * dissipation, the swarm equilibrates at temperature `T`. `T` is the body's strength,
198
+ * eased to a localized hot spot by a `(1 − d/d_max)` falloff (sourceable from heat or
199
+ * scroll energy). Box–Muller turns two uniforms into one isotropic 2-D kick.
200
+ */
201
+ export const thermal = {
202
+ token: 'thermal',
203
+ label: 'Thermal',
204
+ apply(b, p, e) {
205
+ if (e.dist >= b.range)
206
+ return;
207
+ const falloff = 1 - e.dist / b.range; // localized: hotter nearer the source
208
+ const sigma = thermalSigma(b.strength * falloff);
209
+ if (sigma === 0)
210
+ return;
211
+ // Box–Muller: (u1, u2) → one isotropic N(0,1) pair, scaled by σ.
212
+ const u1 = Math.random() || 1e-9; // avoid log(0)
213
+ const mag = sigma * Math.sqrt(-2 * Math.log(u1));
214
+ const ang = 2 * Math.PI * Math.random();
215
+ p.vx += mag * Math.cos(ang);
216
+ p.vy += mag * Math.sin(ang);
217
+ // in a depth > 0 volume the kick is isotropic in 3D — a third gaussian leg (z-axis.md).
218
+ if (e.D) {
219
+ const u2 = Math.random() || 1e-9;
220
+ p.vz = (p.vz ?? 0) + sigma * Math.sqrt(-2 * Math.log(u2)) * Math.cos(2 * Math.PI * Math.random());
221
+ }
222
+ if (b.on)
223
+ p.heat = Math.max(p.heat, falloff * 0.4);
224
+ clampToC(p, e.c);
225
+ },
226
+ meta: { desc: 'Langevin/Brownian agitation — a real temperature in the medium' },
227
+ };
228
+ /**
229
+ * §20.10 — `collide`: elastic pairwise collision (granular / billiard), the hard-sphere
230
+ * complement to the smooth, box-bound `wall`. For each neighbour `q` whose disc
231
+ * overlaps `p`'s (`d < r_p + r_q`, radius ≈ `size`) and that is *approaching*, the pair
232
+ * exchanges normal momentum: `p` takes a half-impulse along the contact normal `n`,
233
+ * `q` the other half on its own turn — so momentum is conserved and, at `e = 1`, energy
234
+ * too. `strength` is the restitution `e ∈ [0,1]`. Class [B] — uses `env.neighbors`.
235
+ */
236
+ export const collide = {
237
+ token: 'collide',
238
+ label: 'Collide',
239
+ apply(b, p, e) {
240
+ if (e.dist >= b.range)
241
+ return; // collisions resolve within the body's region
242
+ const restitution = Math.max(0, Math.min(1, b.strength));
243
+ const pr = Math.max(1, p.size);
244
+ for (const q of e.neighbors(p, pr * 4)) {
245
+ const qr = Math.max(1, q.size);
246
+ const nx = p.x - q.x;
247
+ const ny = p.y - q.y;
248
+ const nz = (p.z ?? 0) - (q.z ?? 0); // spheres, not discs, in a volume (z-axis.md)
249
+ const d = Math.hypot(nx, ny, nz);
250
+ if (d >= pr + qr || d < 1e-6)
251
+ continue; // not in contact
252
+ const ux = nx / d;
253
+ const uy = ny / d;
254
+ const uz = nz / d;
255
+ const relN = (p.vx - q.vx) * ux + (p.vy - q.vy) * uy + ((p.vz ?? 0) - (q.vz ?? 0)) * uz;
256
+ if (relN >= 0)
257
+ continue; // separating already → no impulse
258
+ // resolve the pair symmetrically in one pass (equal & opposite impulses) so the
259
+ // result is momentum-conserving and order-independent — the integrator processes
260
+ // particles sequentially, so applying only to `p` and trusting `q`'s later turn
261
+ // double-counts (q would read p's already-changed velocity). After this the pair
262
+ // is separating, so q's own apply skips it.
263
+ const j = (1 + restitution) * 0.5 * relN;
264
+ p.vx -= j * ux;
265
+ p.vy -= j * uy;
266
+ q.vx += j * ux;
267
+ q.vy += j * uy;
268
+ if (nz) {
269
+ p.vz = (p.vz ?? 0) - j * uz;
270
+ q.vz = (q.vz ?? 0) + j * uz;
271
+ }
272
+ }
273
+ },
274
+ meta: { desc: 'elastic pairwise collision — the hard-sphere billiard force' },
275
+ };
276
+ /**
277
+ * §20.10 — `diffuse` (class [C], over the scalar `grid`): the pheromone/stigmergy
278
+ * field. Each frame a particle lays a mark into the shared `diffuse` grid (which the
279
+ * engine blurs via `∂φ/∂t = D∇²φ`) and steers *up* the local gradient, following the
280
+ * smeared trail toward where matter has gathered. `strength` sets both the deposit and
281
+ * the follow gain. Self-organizing trails emerge from the deposit↔blur↔follow loop.
282
+ */
283
+ export const diffuse = {
284
+ token: 'diffuse',
285
+ label: 'Diffuse',
286
+ apply(b, p, e) {
287
+ if (e.dist >= b.range)
288
+ return;
289
+ const g = e.grid('diffuse');
290
+ g.deposit(p.x, p.y, b.strength); // lay a mark
291
+ const grad = g.gradient(p.x, p.y); // follow the blurred trail up-gradient
292
+ p.vx += grad.x * b.strength;
293
+ p.vy += grad.y * b.strength;
294
+ },
295
+ meta: { desc: 'pheromone field — deposit a mark and follow the diffused gradient' },
296
+ };
297
+ /** Frames between emitted shocks while a propagate body is engaged. A *pulse train* — not a
298
+ * continuous drip — is what keeps it a travelling wave: between pulses the grid radiates and
299
+ * damps, so no standing bump builds at the source (that bump is what used to pull matter IN). */
300
+ const WAVE_PULSE_PERIOD = 12;
301
+ /** How hard a passing wavefront carries matter outward (radiation pressure gain). */
302
+ const WAVE_PUSH = 7;
303
+ /**
304
+ * §20.10 — `propagate` (class [C], over a wave-mode `grid`): a travelling disturbance,
305
+ * `∂²φ/∂t² = c²∇²φ`. An engaged body injects an impulsive shock at its centre (via the
306
+ * body-level `source` hook, once per frame — not once per particle), and the grid carries it
307
+ * outward as a real expanding ring. Matter **rides the front out**: where the wavefront is
308
+ * passing (`|∇φ|` is steep) a particle is pushed radially *away from the source*, so the
309
+ * expanding shock sweeps matter outward with it — radiation pressure, not an inward pull.
310
+ *
311
+ * Why a pulse train, not a continuous deposit: depositing every frame builds a standing φ bump
312
+ * at the centre, whose gradient points inward — `v += ∇φ` then sucks matter toward the source
313
+ * (the opposite of a wave). Emitting a shock every `WAVE_PULSE_PERIOD` frames lets each ring
314
+ * radiate and damp away, so the field stays a sequence of outgoing fronts.
315
+ */
316
+ export const propagate = {
317
+ token: 'propagate',
318
+ label: 'Propagate',
319
+ source(b, e) {
320
+ if (!b.on)
321
+ return; // only an engaged body emits
322
+ if (e.frameN % WAVE_PULSE_PERIOD !== 0)
323
+ return; // a shock train, once per period (body-level)
324
+ e.grid('wave-propagate').deposit(b.cx, b.cy, b.strength); // 'wave…' name → wave stepping
325
+ },
326
+ apply(b, p, e) {
327
+ if (e.dist >= b.range)
328
+ return;
329
+ const g = e.grid('wave-propagate');
330
+ const grad = g.gradient(p.x, p.y);
331
+ const act = Math.hypot(grad.x, grad.y); // wavefront activity — steep where a front is passing
332
+ if (act < 1e-6)
333
+ return; // no front here → coast (the wave has moved on or not yet arrived)
334
+ // ride the front: pushed radially OUTWARD (e.dx/e.dy point toward the body, so negate).
335
+ const ux = -e.dx / e.dist;
336
+ const uy = -e.dy / e.dist;
337
+ p.vx += ux * act * b.strength * WAVE_PUSH;
338
+ p.vy += uy * act * b.strength * WAVE_PUSH;
339
+ if (e.dz)
340
+ p.vz = (p.vz ?? 0) + (-e.dz / e.dist) * act * b.strength * WAVE_PUSH;
341
+ clampToC(p, e.c);
342
+ },
343
+ meta: { desc: 'a travelling wave — a shock train expands from the source, sweeping matter out' },
344
+ };
345
+ /**
346
+ * Memory (class [C], over a slow-decaying `memory` grid) — the field remembers.
347
+ * Each frame a particle lays occupancy where it sits, into a grid that barely blurs
348
+ * and fades slowly; the body's pull is then amplified by how worn the spot is. So
349
+ * `M(x) += λ` and the effective force `×= (1 + μ·M)`: frequently-travelled routes
350
+ * deepen and pull harder, and channels wear in over time.
351
+ */
352
+ export const memory = {
353
+ token: 'memory',
354
+ label: 'Memory',
355
+ apply(b, p, e) {
356
+ if (e.dist >= b.range)
357
+ return;
358
+ const g = e.grid('memory'); // 'memory' name → slow-decay stepping
359
+ g.deposit(p.x, p.y, b.strength * 0.15); // wear the path where matter sits
360
+ const amp = 1 + 0.5 * g.sample(p.x, p.y); // worn paths pull harder (1 + μ·M)
361
+ const f = (1 - e.dist / b.range) ** 2 * b.strength * 0.5 * amp;
362
+ p.vx += (e.dx / e.dist) * f;
363
+ p.vy += (e.dy / e.dist) * f;
364
+ if (e.dz)
365
+ p.vz = (p.vz ?? 0) + (e.dz / e.dist) * f;
366
+ },
367
+ meta: { desc: 'the field remembers — occupancy wears in paths that pull harder' },
368
+ };
369
+ /** The natural primitives, in spec order (§20.10). */
370
+ export const naturalForces = [
371
+ gravity,
372
+ charge,
373
+ magnetism,
374
+ thermal,
375
+ collide,
376
+ diffuse,
377
+ propagate,
378
+ memory,
379
+ ];
380
+ /** Register the natural primitives on a registry (§4) — opt-in, alongside the nine. */
381
+ export function registerNaturalForces(reg) {
382
+ for (const f of naturalForces)
383
+ reg.force(f);
384
+ }
385
+ //# sourceMapp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AAC,GAAG,CAAC,CAAC;QAC5B,IAAI,CAAC,CAAC,EAAE;YAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrD,CAAC;IACD,IAAI,EAAE,EAAE,IAAI,EAAE,iEAAiE,EAAE;CAClF,CAAC;AAEF,sDAAsD;AACtD,MAAM,CAAC,MAAM,aAAa,GAAqB;IAC7C,OAAO;IACP,MAAM;IACN,SAAS;IACT,OAAO;IACP,OAAO;IACP,OAAO;IACP,SAAS;IACT,MAAM;CACP,CAAC;AAEF,uFAAuF;AACvF,MAAM,UAAU,qBAAqB,CAAC,GAAa;IACjD,KAAK,MAAM,CAAC,IAAI,aAAa;QAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * field-ui — a reciprocal DOM-physics field (formerly `forces-ui`).
3
+ *
4
+ * Elements bend the field; the field's density bends them back.
5
+ * Spec: `docs/engine-reference/forces-system.md`. Roadmap: `ROADMAP.md`.
6
+ *
7
+ * Feature-complete: the catalog, core contracts, FieldStore, integrator, and the
8
+ * full force set (canonical · natural · designed-extended). Zero runtime dependencies.
9
+ */
10
+ export * from './core/types.ts';
11
+ export * from './config/forces.config.ts';
12
+ export * from './config/manual.ts';
13
+ export * from './config/palettes.ts';
14
+ export * from './config/tokens.ts';
15
+ export * from './core/math.ts';
16
+ export * from './core/geometry.ts';
17
+ export * from './core/feedback.ts';
18
+ export * from './core/attention.ts';
19
+ export * from './core/causality.ts';
20
+ export * from './core/streamlines.ts';
21
+ export * from './core/flow.ts';
22
+ export * from './core/fieldlines.ts';
23
+ export * from './core/fieldline-seeds.ts';
24
+ export * from './core/reactions.ts';
25
+ export * from './core/agents.ts';
26
+ export * from './core/currents.ts';
27
+ export * from './core/reservoir.ts';
28
+ export * from './core/spatial-hash.ts';
29
+ export * from './core/temporal.ts';
30
+ export * from './core/weights.ts';
31
+ export * from './core/thermo.ts';
32
+ export * from './core/field-store.ts';
33
+ export * from './core/conditions.ts';
34
+ export * from './core/events.ts';
35
+ export * from './core/registry.ts';
36
+ export * from './core/integrator.ts';
37
+ export * from './core/formations.ts';
38
+ export * from './core/scanner.ts';
39
+ export * from './core/shadow.ts';
40
+ export * from './core/render-modes.ts';
41
+ export * from './core/heatmap.ts';
42
+ export * from './core/surface.ts';
43
+ export * from './core/host.ts';
44
+ export * from './core/render-backend.ts';
45
+ export * from './core/field.ts';
46
+ export * from './forces/index.ts';
47
+ export * from './conformance/types.ts';
48
+ export * from './conformance/run.ts';
49
+ export * from './conformance/expectations.ts';
50
+ export * from './conformance/experiments.ts';
51
+ export * from './contracts/index.ts';
52
+ export * from './agents/index.ts';
53
+ export * from './visual/index.ts';
54
+ export * from './recipes/index.ts';
55
+ export * from './inspect/index.ts';
56
+ export * from './semantic/index.ts';
57
+ export * from './diagnostics/index.ts';
58
+ export * from './export.ts';
59
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAI/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAElC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAE7C,cAAc,sBAAsB,CAAC;AAErC,cAAc,mBAAmB,CAAC;AAElC,cAAc,mBAAmB,CAAC;AAElC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,qBAAqB,CAAC;AAEpC,cAAc,wBAAwB,CAAC;AAEvC,cAAc,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,71 @@
1
+ /**
2
+ * field-ui — a reciprocal DOM-physics field (formerly `forces-ui`).
3
+ *
4
+ * Elements bend the field; the field's density bends them back.
5
+ * Spec: `docs/engine-reference/forces-system.md`. Roadmap: `ROADMAP.md`.
6
+ *
7
+ * Feature-complete: the catalog, core contracts, FieldStore, integrator, and the
8
+ * full force set (canonical · natural · designed-extended). Zero runtime dependencies.
9
+ */
10
+ export * from "./core/types.js";
11
+ export * from "./config/forces.config.js";
12
+ export * from "./config/manual.js";
13
+ export * from "./config/palettes.js";
14
+ export * from "./config/tokens.js";
15
+ export * from "./core/math.js";
16
+ export * from "./core/geometry.js";
17
+ export * from "./core/feedback.js";
18
+ export * from "./core/attention.js";
19
+ export * from "./core/causality.js";
20
+ export * from "./core/streamlines.js";
21
+ export * from "./core/flow.js";
22
+ export * from "./core/fieldlines.js";
23
+ export * from "./core/fieldline-seeds.js";
24
+ export * from "./core/reactions.js";
25
+ export * from "./core/agents.js";
26
+ export * from "./core/currents.js";
27
+ export * from "./core/reservoir.js";
28
+ export * from "./core/spatial-hash.js";
29
+ export * from "./core/temporal.js";
30
+ export * from "./core/weights.js";
31
+ export * from "./core/thermo.js";
32
+ export * from "./core/field-store.js";
33
+ export * from "./core/conditions.js";
34
+ export * from "./core/events.js";
35
+ export * from "./core/registry.js";
36
+ export * from "./core/integrator.js";
37
+ export * from "./core/formations.js";
38
+ export * from "./core/scanner.js";
39
+ export * from "./core/shadow.js";
40
+ export * from "./core/render-modes.js";
41
+ export * from "./core/heatmap.js";
42
+ export * from "./core/surface.js";
43
+ export * from "./core/host.js";
44
+ // RenderBackend (#373): the structural drawing seam alongside FieldHost. Exported so an external
45
+ // surface (WebGL/WebGPU/Three.js — see @fundamental-engine/three) can implement the contract by name and
46
+ // inject it via `createField({ overlayBackend })`.
47
+ export * from "./core/render-backend.js";
48
+ export * from "./core/field.js";
49
+ export * from "./forces/index.js";
50
+ // physics conformance — the Lab-as-detector framework (shared by tests + the Lab UI)
51
+ export * from "./conformance/types.js";
52
+ export * from "./conformance/run.js";
53
+ export * from "./conformance/expectations.js";
54
+ export * from "./conformance/experiments.js";
55
+ // formal contracts (Phase 4) — contract types, force passports, and dev-mode enforcement guards
56
+ export * from "./contracts/index.js";
57
+ // the FieldAgent model (Phase 5) — element/relationship/user/layout/data agents + event thresholder
58
+ export * from "./agents/index.js";
59
+ // the visual language layer (Phase 6) — metric→appearance mappings, lint rules, semantic-text
60
+ export * from "./visual/index.js";
61
+ // authoring & recipes (Phase 7) — FieldRecipe schema, intent compiler, gallery, explain/diff
62
+ export * from "./recipes/index.js";
63
+ // inspection & productization (Phase 8) — snapshot regression, budget inspector, system report
64
+ export * from "./inspect/index.js";
65
+ // the semantic layer (BA2) — meaning→metric maps, interaction materials, field states
66
+ export * from "./semantic/index.js";
67
+ // diagnostics (B4) — energy, potential, probe force-vectors + causality, heatmap variants
68
+ export * from "./diagnostics/index.js";
69
+ // field export (C4) — PNG raster + SVG vector serialization + download helpers
70
+ export * from "./export.js";
71
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,iGAAiG;AACjG,yGAAyG;AACzG,mDAAmD;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,qFAAqF;AACrF,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,gGAAgG;AAChG,cAAc,sBAAsB,CAAC;AACrC,oGAAoG;AACpG,cAAc,mBAAmB,CAAC;AAClC,8FAA8F;AAC9F,cAAc,mBAAmB,CAAC;AAClC,6FAA6F;AAC7F,cAAc,oBAAoB,CAAC;AACnC,+FAA+F;AAC/F,cAAc,oBAAoB,CAAC;AACnC,sFAAsF;AACtF,cAAc,qBAAqB,CAAC;AACpC,0FAA0F;AAC1F,cAAc,wBAAwB,CAAC;AACvC,+EAA+E;AAC/E,cAAc,aAAa,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Performance budget inspector (system-contracts §15, testing §11). Compare live counts against a
3
+ * PerformanceBudget and report every metric over its limit. Pure — the inspector reports; the
4
+ * caller (or a dev overlay) decides what to do. Used to keep a scene within the §15 defaults.
5
+ */
6
+ import type { PerformanceBudget } from '../contracts/types.ts';
7
+ export interface BudgetFinding {
8
+ field: keyof PerformanceBudget;
9
+ value: number;
10
+ limit: number;
11
+ over: number;
12
+ }
13
+ /** Report each live count that exceeds its budget (empty = within budget). */
14
+ export declare function inspectBudget(counts: Partial<PerformanceBudget>, budget?: PerformanceBudget): BudgetFinding[];
15
+ /** True when every provided count is within budget. */
16
+ export declare function withinBudget(counts: Partial<PerformanceBudget>, budget?: PerformanceBudget): boolean;
17
+ //# sourceMappingURL=budget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"budget.d.ts","sourceRoot":"","sources":["../../src/inspect/budget.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG/D,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,iBAAiB,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,8EAA8E;AAC9E,wBAAgB,aAAa,CAC3B,MAAM,EAAE,OAAO,CAAC,iBAAiB,CAAC,EAClC,MAAM,GAAE,iBAAkC,GACzC,aAAa,EAAE,CASjB;AAED,uDAAuD;AACvD,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,iBAAiB,CAAC,EAAE,MAAM,GAAE,iBAAkC,GAAG,OAAO,CAEpH"}
@@ -0,0 +1,19 @@
1
+ import { DEFAULT_BUDGET } from "../contracts/types.js";
2
+ /** Report each live count that exceeds its budget (empty = within budget). */
3
+ export function inspectBudget(counts, budget = DEFAULT_BUDGET) {
4
+ const out = [];
5
+ for (const key of Object.keys(budget)) {
6
+ const value = counts[key];
7
+ if (value == null)
8
+ continue;
9
+ const limit = budget[key];
10
+ if (value > limit)
11
+ out.push({ field: key, value, limit, over: value - limit });
12
+ }
13
+ return out;
14
+ }
15
+ /** True when every provided count is within budget. */
16
+ export function withinBudget(counts, budget = DEFAULT_BUDGET) {
17
+ return inspectBudget(counts, budget).length === 0;
18
+ }
19
+ //# sourceMappingURL=budget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"budget.js","sourceRoot":"","sources":["../../src/inspect/budget.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AASvD,8EAA8E;AAC9E,MAAM,UAAU,aAAa,CAC3B,MAAkC,EAClC,SAA4B,cAAc;IAE1C,MAAM,GAAG,GAAoB,EAAE,CAAC;IAChC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAgC,EAAE,CAAC;QACrE,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,KAAK,IAAI,IAAI;YAAE,SAAS;QAC5B,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,KAAK,GAAG,KAAK;YAAE,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,KAAK,EAAE,CAAC,CAAC;IACjF,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,uDAAuD;AACvD,MAAM,UAAU,YAAY,CAAC,MAAkC,EAAE,SAA4B,cAAc;IACzG,OAAO,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;AACpD,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Inspection & productization (Phase 8 — testing-and-conformance). The harnesses that make the
3
+ * system observable and regression-safe: deterministic snapshot capture/compare, the performance
4
+ * budget inspector, and the aggregate system report. All pure (snapshot runs the pure simulation),
5
+ * so they double as CI checks and Inspector data sources.
6
+ */
7
+ export * from './snapshot.ts';
8
+ export * from './budget.ts';
9
+ export * from './report.ts';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/inspect/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Inspection & productization (Phase 8 — testing-and-conformance). The harnesses that make the
3
+ * system observable and regression-safe: deterministic snapshot capture/compare, the performance
4
+ * budget inspector, and the aggregate system report. All pure (snapshot runs the pure simulation),
5
+ * so they double as CI checks and Inspector data sources.
6
+ */
7
+ export * from "./snapshot.js";
8
+ export * from "./budget.js";
9
+ export * from "./report.js";
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/inspect/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,17 @@
1
+ export interface SystemReport {
2
+ forces: number;
3
+ passports: number;
4
+ conformanceExperiments: number;
5
+ contracts: number;
6
+ agentTypes: number;
7
+ recipes: number;
8
+ /** force tokens registered but missing a passport (should be empty). */
9
+ forcesMissingPassport: string[];
10
+ /** force tokens missing a conformance experiment (should be empty). */
11
+ forcesMissingConformance: string[];
12
+ }
13
+ /** Build the system report from the live registry + catalogs. */
14
+ export declare function systemReport(): SystemReport;
15
+ /** Render the system report as a short Markdown summary. */
16
+ export declare function reportText(r?: SystemReport): string;
17
+ //# sourceMappingURL=report.d.ts.map