@fundamental-engine/elements 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.
package/dist/index.js ADDED
@@ -0,0 +1,476 @@
1
+ import { PALETTE } from '@fundamental-engine/core';
2
+ import { createBrowserField } from '@fundamental-engine/platform';
3
+ import { HTMLElementBase } from "./base.js";
4
+ import { shouldUsePlatformRuntime, startPlatformRuntime, makeFeedbackSink } from "./platform-runtime.js";
5
+ // Experimental platform runtime (Phase D). Re-exported so apps can opt in globally.
6
+ export { usePlatformRuntime, isPlatformRuntimeDefault, shouldUsePlatformRuntime, startPlatformRuntime } from "./platform-runtime.js";
7
+ /**
8
+ * `<field-root>` — the reciprocal field as a custom element.
9
+ *
10
+ * Drop it once on a page; it renders a full-viewport canvas behind the content
11
+ * and scans the document for `[data-body]` / `[data-preset]` elements, turning
12
+ * each into a body in the field (§2.1).
13
+ *
14
+ * The point of shipping a **custom element**: it works in React, Svelte, Astro,
15
+ * Vue, or plain HTML unchanged — "every element is a body" as a native, portable
16
+ * primitive, with no framework lock-in for consumers.
17
+ *
18
+ * Plain `HTMLElement` (the field is just a canvas — no templating). Lit earns its
19
+ * place when there's UI to template, e.g. the Lab controls (§14).
20
+ *
21
+ * @summary The page-singleton reciprocal field — a full-viewport canvas that turns
22
+ * `[data-body]` / `[data-preset]` elements into bodies. Registered as `<field-root>`
23
+ * (canonical) and `<field-field>`.
24
+ * @attr {string} accent - Accent color (hex) the field draws particles and overlay in.
25
+ * @attr {number} density - Particle-density multiplier (default `1`; `0.5` halves the count).
26
+ * @attr {number} waves - Intensity of the resting wave currents (the ambient drift).
27
+ * @attr {string} render - Underlay render mode (Field Surfaces, behind content): `dots` | `trails` | `links` | `metaballs` | `voronoi` | `streamlines` | `none`. `none` is the signals-only engine (#297): the simulation and feedback signals run, but no canvas context is acquired and nothing is ever drawn.
28
+ * @attr {string} overlay - Overlay readings (Field Surfaces, in front of content): `off` | `streamlines` | `force-vectors` | `field-lines` | `grid` | `temperature` | `energy` | `path` | `data` — or a space-separated stack (readings are additive, drawn in order).
29
+ * @attr {string} palette - Named color palette for the field.
30
+ * @attr {number} mass - Global mass scaling applied to bodies.
31
+ * @attr {boolean} attention - Enables the conserved-attention behaviour (one finite budget, redistributed).
32
+ * @attr {boolean} causality - Enables the causality demo behaviour.
33
+ * @attr {string} background - Substrate background: `transparent` clears to transparent so the underlay composites over light content (an image, a 3D scene, a light page); default `opaque` paints the near-black substrate.
34
+ * @attr {number} depth - Optional z-volume (default `0`, the flat field). `> 0` opens a shallow depth the matter drifts through, projected as a size/alpha recession. Construction-time — changing it rebuilds.
35
+ */
36
+ /** A no-op scalar grid returned by `grid()` before the element's field has started. */
37
+ const NULL_GRID = {
38
+ sample: () => 0,
39
+ deposit: () => { },
40
+ gradient: () => ({ x: 0, y: 0 }),
41
+ decay: () => { },
42
+ clear: () => { },
43
+ };
44
+ export class FieldField extends HTMLElementBase {
45
+ /**
46
+ * The engine options `<field-root>` forwards to `createBrowserField`, as ONE declarative table —
47
+ * the single source of truth for the option object built in `start()`, so a new forwarded
48
+ * `FieldOption` can never be silently dropped from forwarding the way `depth` once was. `accent`
49
+ * (raw passthrough so a `palette` with no `accent` adopts the palette stop) and
50
+ * `overlayCanvas`/`feedbackSink` (managed internally) are special-cased in `start()` and absent here.
51
+ *
52
+ * `observedAttributes` stays an explicit literal below — the Custom-Elements-Manifest analyzer reads
53
+ * it statically and can't enumerate a computed array — but the `option-attrs-observed` test pins it
54
+ * to this table (every `attr` here must be observed), so the two lists can't drift apart.
55
+ */
56
+ static OPTIONS = [
57
+ { key: 'density', attr: 'density', read: (el) => el.density },
58
+ { key: 'waves', attr: 'waves', read: (el) => el.waves },
59
+ { key: 'depth', attr: 'depth', read: (el) => el.depth },
60
+ { key: 'background', attr: 'background', read: (el) => el.background },
61
+ { key: 'render', attr: 'render', read: (el) => el.renderMode },
62
+ { key: 'overlay', attr: 'overlay', read: (el) => el.overlay },
63
+ { key: 'palette', attr: 'palette', read: (el) => el.palette },
64
+ { key: 'mass', attr: 'mass', read: (el) => el.mass },
65
+ { key: 'attention', attr: 'attention', read: (el) => el.attention },
66
+ { key: 'causality', attr: 'causality', read: (el) => el.causality },
67
+ { key: 'heatmap', attr: 'heatmap', read: (el) => el.heatmap },
68
+ { key: 'dprCap', attr: 'dpr-cap', read: (el) => el.dprCap },
69
+ ];
70
+ // Literal (not computed) so the CEM analyzer can enumerate it; the test keeps it in sync with OPTIONS.
71
+ static observedAttributes = [
72
+ 'accent',
73
+ 'density',
74
+ 'waves',
75
+ 'depth',
76
+ 'render',
77
+ 'overlay',
78
+ 'palette',
79
+ 'mass',
80
+ 'attention',
81
+ 'causality',
82
+ 'heatmap',
83
+ 'dpr-cap',
84
+ 'background',
85
+ ];
86
+ canvas;
87
+ field;
88
+ /** Field Surfaces: the optional front overlay surface (light-DOM, above content). */
89
+ overlayCanvas;
90
+ /** element-level visibility: pages can hide the field (display:none) — skip draw work then. */
91
+ visibilityObserver;
92
+ fieldVisible = true;
93
+ /** experimental platform runtime (Phase D); present only when the flag is on. */
94
+ platformRuntime;
95
+ /**
96
+ * The live `@fundamental-engine/platform` instance backing this field (Phase D default), or `undefined` on
97
+ * the legacy path. Read-only introspection for tools like the Inspector — the registries here are
98
+ * the real running state (measurements, state, feedback bindings, relationships, overlays, lint).
99
+ * Read with `measure.last()` etc.; don't call `measure.measure()` off the read phase.
100
+ */
101
+ get platform() {
102
+ return this.platformRuntime?.platform;
103
+ }
104
+ constructor() {
105
+ super();
106
+ const root = this.attachShadow({ mode: 'open' });
107
+ const style = document.createElement('style');
108
+ style.textContent =
109
+ ':host{position:fixed;inset:0;z-index:0;display:block;pointer-events:none}' +
110
+ 'canvas{width:100%;height:100%;display:block}';
111
+ this.canvas = document.createElement('canvas');
112
+ root.append(style, this.canvas);
113
+ }
114
+ /** the travelling accent (§9); defaults to the first palette color. */
115
+ get accent() {
116
+ return this.getAttribute('accent') ?? PALETTE[0] ?? '#4da3ff';
117
+ }
118
+ /** particle-count multiplier (§2.5). */
119
+ get density() {
120
+ const v = Number(this.getAttribute('density'));
121
+ return Number.isFinite(v) && v > 0 ? v : 1;
122
+ }
123
+ /** draw the background Currents (§24). */
124
+ get waves() {
125
+ return this.getAttribute('waves') !== 'false';
126
+ }
127
+ /** render mode (§20.6); `none` = the signals-only engine — simulate + feed back, never draw (#297). */
128
+ get renderMode() {
129
+ const v = this.getAttribute('render');
130
+ return v === 'trails' || v === 'links' || v === 'metaballs' || v === 'voronoi' || v === 'streamlines' || v === 'flow' || v === 'none'
131
+ ? v
132
+ : 'dots';
133
+ }
134
+ /** substrate background: `transparent` (present and not `"false"`) clears to transparent so the
135
+ * underlay composites over light content; default `opaque` paints the near-black substrate. */
136
+ get background() {
137
+ const v = this.getAttribute('background');
138
+ return v === 'transparent' || (v === '' && this.hasAttribute('background')) ? 'transparent' : 'opaque';
139
+ }
140
+ /** Field Surfaces: the overlay reading(s) — one mode or a space-separated additive stack. Default `off`. */
141
+ get overlay() {
142
+ const KNOWN = [
143
+ 'streamlines',
144
+ 'force-vectors',
145
+ 'field-lines',
146
+ 'grid',
147
+ 'temperature',
148
+ 'energy',
149
+ 'path',
150
+ 'data',
151
+ ];
152
+ const list = (this.getAttribute('overlay') ?? '')
153
+ .split(/\s+/)
154
+ .filter((t) => KNOWN.includes(t));
155
+ if (!list.length)
156
+ return 'off';
157
+ return list.length === 1 ? list[0] : list;
158
+ }
159
+ /** color template name for the travelling accent (§9), or undefined for `ours`. */
160
+ get palette() {
161
+ return this.getAttribute('palette') ?? undefined;
162
+ }
163
+ /** conserved attention (§2.4): present and not `"false"` → one finite strength budget. */
164
+ get attention() {
165
+ return this.hasAttribute('attention') && this.getAttribute('attention') !== 'false';
166
+ }
167
+ /** cross-boundary causality (Concept 4): present and not `"false"` → density spills. */
168
+ get causality() {
169
+ return this.hasAttribute('causality') && this.getAttribute('causality') !== 'false';
170
+ }
171
+ /** first-class mass (§21.3): present and not `"false"` → particle mass ∝ size. */
172
+ get mass() {
173
+ return this.hasAttribute('mass') && this.getAttribute('mass') !== 'false';
174
+ }
175
+ /** density heatmap (field-systems H1): present and not `"false"` → the pooling glow underlay. */
176
+ get heatmap() {
177
+ return this.hasAttribute('heatmap') && this.getAttribute('heatmap') !== 'false';
178
+ }
179
+ /** `dpr-cap` — backing-store DPR ceiling (#410); undefined (engine default 2) if absent/invalid. */
180
+ get dprCap() {
181
+ const v = Number(this.getAttribute('dpr-cap'));
182
+ return v > 0 ? v : undefined;
183
+ }
184
+ /** `depth` — optional z-volume; undefined (engine default 0, the flat field) if absent/invalid. */
185
+ get depth() {
186
+ const v = Number(this.getAttribute('depth'));
187
+ return Number.isFinite(v) && v > 0 ? v : undefined;
188
+ }
189
+ // ── the FieldHandle surface, proxied onto the element (§13) ────────────────
190
+ /** re-scan the document for `[data-body]` bodies after a DOM change. */
191
+ scan() {
192
+ this.field?.scan();
193
+ }
194
+ /** alias of `scan`. */
195
+ rescan() {
196
+ this.field?.scan();
197
+ }
198
+ /** recolor the travelling accent (§9). */
199
+ setAccent(hex) {
200
+ this.field?.setAccent(hex);
201
+ }
202
+ /** swap the accent color template live (§9). */
203
+ setPalette(palette) {
204
+ this.field?.setPalette(palette);
205
+ }
206
+ /** switch the global formation (§7). */
207
+ setFormation(name) {
208
+ this.field?.setFormation(name);
209
+ }
210
+ /** toggle conserved attention (§2.4) live. */
211
+ setAttention(on) {
212
+ this.field?.setAttention(on);
213
+ }
214
+ /** toggle cross-boundary causality (Concept 4) live. */
215
+ setCausality(on) {
216
+ this.field?.setCausality(on);
217
+ }
218
+ /** switch the substrate background live: `transparent` composites the underlay over light content. */
219
+ setBackground(mode) {
220
+ this.field?.setBackground(mode);
221
+ }
222
+ /** toggle the density heatmap layer (field-systems H1) live. */
223
+ setHeatmap(on) {
224
+ this.field?.setHeatmap(on);
225
+ }
226
+ /** lower/raise the backing-store DPR ceiling at runtime (the dominant fill-rate lever). */
227
+ setDprCap(cap) {
228
+ this.field?.setDprCap(cap);
229
+ }
230
+ /** switch the underlay render mode (§20.6) live; `none` = signals-only — stop drawing, keep the signals (#297). */
231
+ setRender(mode) {
232
+ this.field?.setRender(mode);
233
+ }
234
+ /** render field readings on the overlay surface (Field Surfaces — in front of content); one mode or an additive stack. */
235
+ setOverlay(mode) {
236
+ this.field?.setOverlay(mode);
237
+ syncOverlaySurface(this.overlayCanvas, mode);
238
+ }
239
+ /** wire glowing connector lines between a set, or clear with null (§10). */
240
+ threads(list) {
241
+ this.field?.threads(list);
242
+ }
243
+ /** a discrete one-shot: shove + heat matter near (x, y), optionally tinting it (§11). */
244
+ burst(x, y, hex) {
245
+ this.field?.burst(x, y, hex);
246
+ }
247
+ /** place/move a dynamic flow focus the field bends toward — pulls matter, curves the streamlines. */
248
+ flowTo(x, y, opts) {
249
+ this.field?.flowTo(x, y, opts);
250
+ }
251
+ /** remove the flow focus. */
252
+ clearFlow() {
253
+ this.field?.clearFlow();
254
+ }
255
+ /** bind a data record to each base particle (its `weight` scales mass + size); pick back with `atomAt`. */
256
+ seed(atoms) {
257
+ this.field?.seed(atoms);
258
+ }
259
+ /** add an engine-stepped agent; returns an inert no-op handle if the field hasn't started. */
260
+ addAgent(spec) {
261
+ return this.field?.addAgent(spec) ?? { particle: {}, remove: () => { } };
262
+ }
263
+ /** add a programmatic body (no DOM) from a spec; a no-op handle until the field starts. */
264
+ addBody(spec) {
265
+ return this.field?.addBody(spec) ?? { data: spec.data, channels: {}, set: () => { }, remove: () => { } };
266
+ }
267
+ /** register a named external scalar field channel the engine samples; inert handle until the field starts. */
268
+ addField(name, sampler) {
269
+ return this.field?.addField(name, sampler) ?? { name, set: () => { }, remove: () => { } };
270
+ }
271
+ /** sample a registered field channel at (x, y); 0 for an unknown channel or before the field starts. */
272
+ sampleField(name, x, y) {
273
+ return this.field?.sampleField(name, x, y) ?? 0;
274
+ }
275
+ /** the seeded record on the nearest particle to (x, y), or null — for hover-to-inspect. */
276
+ atomAt(x, y) {
277
+ return this.field?.atomAt(x, y) ?? null;
278
+ }
279
+ /** focus the nearest seeded particle (hold + light it), returning its record — the dwell affordance. */
280
+ focusAt(x, y) {
281
+ return this.field?.focusAt(x, y) ?? null;
282
+ }
283
+ /** release the focused particle. */
284
+ clearFocus() {
285
+ this.field?.clearFocus();
286
+ }
287
+ /** live particle-pool size — `store.size` forwarded through the public handle. */
288
+ particleCount() {
289
+ return this.field?.particleCount() ?? 0;
290
+ }
291
+ /** copy live particle state into `out` (stride 5: x, y, z, heat, size); returns the count written
292
+ * (0 before the field starts) — the render-agnostic swarm read-out an alternative surface draws. */
293
+ readParticles(out) {
294
+ return this.field?.readParticles(out) ?? 0;
295
+ }
296
+ /** copy each live particle's stable id into a Uint32Array, parallel to readParticles. */
297
+ readParticleIds(out) {
298
+ return this.field?.readParticleIds(out) ?? 0;
299
+ }
300
+ /** kinetic/thermal/total energy snapshot for the current frame. */
301
+ energy() {
302
+ return this.field?.energy() ?? { kinetic: 0, thermal: 0, total: 0, count: 0 };
303
+ }
304
+ /** sample the live field at `(x, y)` — the net force vector a still test particle would feel
305
+ * (zero before the field starts). The seam external visualizers consume to build field geometry. */
306
+ sample(x, y) {
307
+ return this.field?.sample(x, y) ?? { x: 0, y: 0 };
308
+ }
309
+ /** sample the smooth density scalar ∈ [0,1] at `(x, y)` (needs `heatmap`); 0 when off/not started. */
310
+ sampleScalar(x, y) {
311
+ return this.field?.sampleScalar(x, y) ?? 0;
312
+ }
313
+ /** sample the density gradient ∇ at `(x, y)` — up-density direction (needs `heatmap`); `{0,0}` when off/not started. */
314
+ sampleGradient(x, y) {
315
+ return this.field?.sampleGradient(x, y) ?? { x: 0, y: 0 };
316
+ }
317
+ /** open a named host-authorable scalar grid (deposit/sample/gradient/decay); a no-op grid until the field starts. */
318
+ grid(name) {
319
+ return this.field?.grid(name) ?? NULL_GRID;
320
+ }
321
+ /** subscribe to a discrete field event (absorb/release/settle); a no-op unsubscribe until the field starts. */
322
+ on(type, cb) {
323
+ return this.field?.on(type, cb) ?? (() => { });
324
+ }
325
+ connectedCallback() {
326
+ // the field is decorative ambiance — hide it from assistive tech (§18 a11y).
327
+ if (!this.hasAttribute('aria-hidden'))
328
+ this.setAttribute('aria-hidden', 'true');
329
+ this.start();
330
+ // Pages can hide the singleton field with CSS (display:none) — e.g. surfaces that want the
331
+ // engine's signals but no particle swarm. The host is position:fixed inset:0, so IO reports
332
+ // not-intersecting exactly when it's hidden or zero-sized; the engine then skips all draw
333
+ // work while the simulation (scrollV, feedback vars, events) keeps running.
334
+ if (typeof IntersectionObserver !== 'undefined' && !this.visibilityObserver) {
335
+ this.visibilityObserver = new IntersectionObserver((entries) => {
336
+ this.fieldVisible = entries.some((e) => e.isIntersecting);
337
+ this.field?.setVisible(this.fieldVisible);
338
+ });
339
+ this.visibilityObserver.observe(this);
340
+ }
341
+ }
342
+ disconnectedCallback() {
343
+ this.visibilityObserver?.disconnect();
344
+ this.visibilityObserver = undefined;
345
+ this.field?.destroy();
346
+ this.field = undefined;
347
+ // Field Surfaces: remove the light-DOM overlay surface this element owns.
348
+ this.overlayCanvas?.remove();
349
+ this.overlayCanvas = undefined;
350
+ this.platformRuntime?.destroy();
351
+ this.platformRuntime = undefined;
352
+ }
353
+ /**
354
+ * React to live attribute changes after mount (§13). The color / render / toggle attributes
355
+ * apply through the field's setters; the construction-time ones (`density`, `waves`, `mass`)
356
+ * rebuild the field. Fires before `connectedCallback` for the initial attributes too, which the
357
+ * `this.field` guard skips — the first mount reads every attribute itself.
358
+ */
359
+ attributeChangedCallback(name, oldVal, newVal) {
360
+ if (!this.field || oldVal === newVal)
361
+ return;
362
+ switch (name) {
363
+ case 'accent':
364
+ this.field.setAccent(this.accent);
365
+ break;
366
+ case 'palette':
367
+ this.field.setPalette(this.palette ?? 'ours');
368
+ break;
369
+ case 'render':
370
+ this.field.setRender(this.renderMode);
371
+ break;
372
+ case 'overlay':
373
+ this.field.setOverlay(this.overlay);
374
+ syncOverlaySurface(this.overlayCanvas, this.overlay);
375
+ break;
376
+ case 'attention':
377
+ this.field.setAttention(this.attention);
378
+ break;
379
+ case 'causality':
380
+ this.field.setCausality(this.causality);
381
+ break;
382
+ case 'heatmap':
383
+ this.field.setHeatmap(this.heatmap);
384
+ break;
385
+ case 'dpr-cap':
386
+ this.field.setDprCap(this.dprCap ?? 2);
387
+ break;
388
+ case 'background':
389
+ this.field.setBackground(this.background);
390
+ break;
391
+ default: // density / waves / mass are construction-time → rebuild
392
+ this.field.destroy();
393
+ this.start();
394
+ }
395
+ }
396
+ /** (re)create the engine on the canvas, reading the current attributes. */
397
+ start() {
398
+ // tear down any prior platform runtime before a rebuild (idempotent)
399
+ this.platformRuntime?.destroy();
400
+ this.platformRuntime = undefined;
401
+ // Phase D: when the experimental flag is on, start the platform runtime FIRST (so the engine can
402
+ // hand it feedback via a sink), then create the engine with that sink. D2 measures bodies; D3
403
+ // routes feedback through FeedbackRegistry. Default off → no runtime, no sink (unchanged).
404
+ let feedbackSink;
405
+ if (shouldUsePlatformRuntime(this)) {
406
+ const scanRoot = this.ownerDocument?.documentElement ?? this;
407
+ this.platformRuntime = startPlatformRuntime(scanRoot);
408
+ feedbackSink = makeFeedbackSink(this.platformRuntime.platform);
409
+ }
410
+ // Field Surfaces: ensure the front overlay surface exists (light DOM — the shadow host is
411
+ // z-index:0, behind content). A fixed, full-viewport, click-through canvas above content; core
412
+ // sizes its backing store and draws the overlay mode onto it. Created once, reused across rebuilds.
413
+ if (!this.overlayCanvas && typeof document !== 'undefined') {
414
+ const oc = document.createElement('canvas');
415
+ oc.setAttribute('aria-hidden', 'true');
416
+ oc.style.cssText =
417
+ 'position:fixed;inset:0;width:100%;height:100%;pointer-events:none;z-index:5;mix-blend-mode:screen';
418
+ document.body.appendChild(oc);
419
+ this.overlayCanvas = oc;
420
+ }
421
+ const opts = {
422
+ // pass the raw attribute so a `palette` with no `accent` adopts the palette's first stop
423
+ accent: this.getAttribute('accent') ?? undefined,
424
+ overlayCanvas: this.overlayCanvas,
425
+ feedbackSink,
426
+ };
427
+ // the rest of the engine options come from the one declarative table (above), so a new
428
+ // FieldOption can never be silently dropped here the way `depth` once was.
429
+ for (const o of FieldField.OPTIONS)
430
+ opts[o.key] = o.read(this);
431
+ this.field = createBrowserField(this.canvas, opts);
432
+ // attach the handle so the platform write phase can read scrollV → --field-scroll-v
433
+ // and the quality governor can monitor frame duration
434
+ this.platformRuntime?.attachHandle(this.field);
435
+ // a rebuild (density/waves/mass change) starts a fresh engine that defaults to visible —
436
+ // re-apply the last observed element visibility so a hidden field stays draw-skipped.
437
+ if (!this.fieldVisible)
438
+ this.field.setVisible(false);
439
+ // take the overlay canvas out of the compositing tree unless a reading is actually active.
440
+ syncOverlaySurface(this.overlayCanvas, this.overlay);
441
+ }
442
+ }
443
+ /**
444
+ * Field Surfaces perf: the overlay canvas is a full-viewport `mix-blend-mode: screen` layer, so while
445
+ * it's in the compositing tree the browser re-blends the whole screen against the animating underlay
446
+ * every frame — even with nothing drawn on it. Take it OUT of the tree (`display:none`) whenever no
447
+ * reading is active, and put it back only when one is. Keeps the common `overlay: off` case as cheap
448
+ * as a single-canvas field. Module-level (not a class member) so it stays out of the public manifest.
449
+ */
450
+ function syncOverlaySurface(canvas, input) {
451
+ if (!canvas)
452
+ return;
453
+ const active = Array.isArray(input) ? input.some((m) => m !== 'off') : input !== 'off';
454
+ canvas.style.display = active ? '' : 'none';
455
+ }
456
+ if (typeof customElements !== 'undefined' && !customElements.get('field-field')) {
457
+ customElements.define('field-field', FieldField);
458
+ }
459
+ /**
460
+ * `<field-root>` — the recommended tag for the singleton field. The registry rejects registering one
461
+ * constructor under two tag names, so this is a thin subclass of {@link FieldField} with identical
462
+ * behaviour, attributes, and body contract.
463
+ */
464
+ export class FieldRoot extends FieldField {
465
+ }
466
+ if (typeof customElements !== 'undefined') {
467
+ if (!customElements.get('field-root'))
468
+ customElements.define('field-root', FieldRoot);
469
+ }
470
+ export * from "./field-cell.js";
471
+ export * from "./cell-force.js";
472
+ export * from "./mount.js";
473
+ // shadow-DOM participation: the helper a custom element uses to join the field without
474
+ // repeating registration-event boilerplate (docs/engine-reference/shadow-dom.md §31.1).
475
+ export { FieldController, REGISTER_BODY, UNREGISTER_BODY, UPDATE_BODY, } from '@fundamental-engine/core';
476
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAyS,MAAM,0BAA0B,CAAC;AAC1V,OAAO,EAAE,kBAAkB,EAAsB,MAAM,8BAA8B,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,gBAAgB,EAAwB,MAAM,uBAAuB,CAAC;AAE/H,oFAAoF;AACpF,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAGrI;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,uFAAuF;AACvF,MAAM,SAAS,GAAe;IAC5B,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;IACf,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;IACjB,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAChC,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;IACf,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;CAChB,CAAC;AAEF,MAAM,OAAO,UAAW,SAAQ,eAAe;IAC7C;;;;;;;;;;OAUG;IACK,MAAM,CAAU,OAAO,GAI1B;QACH,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE;QAC7D,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO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AAC;AAChC,cAAc,YAAY,CAAC;AAC3B,uFAAuF;AACvF,wFAAwF;AACxF,OAAO,EACL,eAAe,EACf,aAAa,EACb,eAAe,EACf,WAAW,GACZ,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The framework-free imperative mount now lives in `@fundamental-engine/vanilla` — the package with
3
+ * no custom-element side effects, the natural home for a framework-free API. It is re-exported
4
+ * here so `import { mountField } from '@fundamental-engine/elements'` keeps working unchanged.
5
+ */
6
+ export { mountField } from '@fundamental-engine/vanilla';
7
+ export type { MountOptions } from '@fundamental-engine/vanilla';
8
+ //# sourceMappingURL=mount.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,YAAY,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC"}
package/dist/mount.js ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The framework-free imperative mount now lives in `@fundamental-engine/vanilla` — the package with
3
+ * no custom-element side effects, the natural home for a framework-free API. It is re-exported
4
+ * here so `import { mountField } from '@fundamental-engine/elements'` keeps working unchanged.
5
+ */
6
+ export { mountField } from '@fundamental-engine/vanilla';
7
+ //# sourceMappingURL=mount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mount.js","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Experimental platform-backed runtime for `<field-root>` (Phase D: runtime platform unification).
3
+ *
4
+ * D1 establishes the *path*, not the migration: when the experimental flag is on, the element starts
5
+ * a `@fundamental-engine/platform` runtime alongside the legacy `createField` engine. For now it only measures
6
+ * the scan root each frame on the six-phase scheduler — a foothold the later phases fill in (D2 moves
7
+ * body scanning onto MeasurementRegistry, D3 feedback onto FeedbackRegistry, D4 shadow, D5
8
+ * relationships). Default is OFF, so behavior is unchanged until D6 flips it.
9
+ *
10
+ * The legacy engine still owns everything visible in D1; the platform adds nothing observable, which
11
+ * is exactly the parity guarantee: flag on and flag off render identically.
12
+ */
13
+ import { type FieldPlatform } from '@fundamental-engine/platform';
14
+ import type { FieldHandle } from '@fundamental-engine/core';
15
+ import { type FeedbackSink, type RegisterBodyDetail } from '@fundamental-engine/core';
16
+ /** A minimal view of MeasurementRegistry — what body syncing + shadow registration need. */
17
+ interface MeasureSink {
18
+ has(el: Element): boolean;
19
+ register(el: Element, opts?: {
20
+ role?: string;
21
+ getRect?: () => DOMRect;
22
+ }): void;
23
+ unregister(el: Element): void;
24
+ }
25
+ /**
26
+ * Sync the scan root's body elements into the MeasurementRegistry (D2). New `[data-body]` /
27
+ * `[data-preset]` / `[data-intent]` / `[data-field-role]` elements are registered for measurement;
28
+ * disconnected ones are pruned by the read phase. Returns how many were newly registered. Pure given
29
+ * the sink + root — the selector is core's `bodyElements`, so the platform never drifts from the
30
+ * legacy scanner. Note (D2): an element that loses its body attribute while staying connected is not
31
+ * yet unregistered — a later refinement; today the legacy engine remains the source of truth for
32
+ * rendering, so this is measurement-only and has no observable effect.
33
+ */
34
+ export declare function syncBodies(sink: MeasureSink, root: ParentNode): number;
35
+ /**
36
+ * Register a shadow-DOM host for measurement from a `register-body` event detail (D4). The host's
37
+ * custom `getRect` (for closed roots / inner cores) flows straight into MeasurementRegistry's rect
38
+ * override. Pure given the sink + detail. `syncBodies`' `if (!has)` guard means it won't clobber a
39
+ * host registered here, so the two discovery paths coexist (the legacy engine still drives the
40
+ * body's simulation; the platform owns its geometry).
41
+ */
42
+ export declare function registerShadowBody(sink: MeasureSink, detail: RegisterBodyDetail | undefined): void;
43
+ /** Unregister a shadow-DOM host from measurement on its `unregister-body` event (D4). Pure. */
44
+ export declare function unregisterShadowBody(sink: MeasureSink, detail: RegisterBodyDetail | undefined): void;
45
+ /**
46
+ * Relationship discovery is heavier than body syncing (it builds graph edges from every native
47
+ * link), so the runtime re-discovers on a throttle rather than every frame (D5). Pure.
48
+ */
49
+ export declare function shouldDiscoverRelationships(frame: number, every?: number): boolean;
50
+ /** Enable (or disable) the platform runtime for every `<field-root>` by default (D6: default on). */
51
+ export declare function usePlatformRuntime(on?: boolean): void;
52
+ /** Whether the platform runtime is the current default. */
53
+ export declare function isPlatformRuntimeDefault(): boolean;
54
+ /**
55
+ * Decide whether an element should use the platform runtime: an explicit `experimental-platform`
56
+ * attribute opts a single element in/out (`="off"` forces the legacy path), otherwise the global
57
+ * default applies (on since D6). Pure — the element's only branch point.
58
+ */
59
+ export declare function shouldUsePlatformRuntime(el: {
60
+ getAttribute(name: string): string | null;
61
+ hasAttribute(name: string): boolean;
62
+ }, def?: boolean): boolean;
63
+ /**
64
+ * Build a feedback sink (D3) that routes the engine's per-body channels through the platform's
65
+ * FeedbackRegistry. The eased density value is the engine's own — only the *write* moves — so the
66
+ * signal is preserved exactly. Writes apply on the platform's write phase (its scheduler tick).
67
+ *
68
+ * Since #228 the sink contract is the engine's ONLY write path: with no sink configured,
69
+ * `createField` installs an internal default sink (`core/feedback-sink.ts`) whose direct writes are
70
+ * byte-identical to the engine's historical behavior. This platform sink replaces that default when
71
+ * the runtime is on, moving the same channels onto FeedbackRegistry (write-phase batching,
72
+ * `cssWritesLastFrame()` accounting, governor throttling).
73
+ */
74
+ export declare function makeFeedbackSink(platform: FieldPlatform): FeedbackSink;
75
+ export interface PlatformRuntime {
76
+ platform: FieldPlatform;
77
+ /**
78
+ * Attach the FieldHandle after it's created (the platform starts before the field handle
79
+ * exists). Once attached, the write phase writes `--field-scroll-v` to `:root` each frame
80
+ * and the quality governor monitors frame duration.
81
+ */
82
+ attachHandle(handle: FieldHandle): void;
83
+ destroy(): void;
84
+ }
85
+ /**
86
+ * Start the platform runtime over a scan root. Thin DOM glue (rAF + viewport size); SSR-safe — with
87
+ * no `window` it returns a created-but-idle platform. D2+ register bodies/feedback/relationships
88
+ * here; D1 measures only the root.
89
+ */
90
+ export declare function startPlatformRuntime(root: Element): PlatformRuntime;
91
+ export {};
92
+ //# sourceMappingURL=platform-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform-runtime.d.ts","sourceRoot":"","sources":["../src/platform-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAwC,KAAK,aAAa,EAAE,MAAM,8BAA8B,CAAC;AACxG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACxB,MAAM,0BAA0B,CAAC;AAElC,4FAA4F;AAC5F,UAAU,WAAW;IACnB,GAAG,CAAC,EAAE,EAAE,OAAO,GAAG,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAC/E,UAAU,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAAC;CAC/B;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CAStE;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,kBAAkB,GAAG,SAAS,GAAG,IAAI,CAElG;AAED,+FAA+F;AAC/F,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,kBAAkB,GAAG,SAAS,GAAG,IAAI,CAEpG;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,OAAO,CAE9E;AAUD,qGAAqG;AACrG,w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