@descix/frqtl-web 0.6.0-p1.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/CLAUDE.md +23 -14
  2. package/README.md +51 -13
  3. package/dist/artifact/double-slit.html +2 -2
  4. package/dist/dist-manifest.json +74 -71
  5. package/dist/experiments/empty/index.html +26 -11
  6. package/dist/frqtl/compat/providers/wasm-engine.js +3 -4
  7. package/dist/frqtl/compat/renderer/providers/p5-provider.js +1 -1
  8. package/dist/frqtl/experiments/_shared/doors.js +17 -12
  9. package/dist/frqtl/objects/FrqtlApp.js +33 -6
  10. package/dist/frqtl/objects/RecipeContext.js +284 -13
  11. package/dist/frqtl/objects/constants/WallBehaviors.js +1 -1
  12. package/dist/frqtl/objects/instruments/capture.js +1 -24
  13. package/dist/frqtl/objects/instruments/hosted-eyes.js +216 -29
  14. package/dist/frqtl/objects/objects/makeControlsForObject.js +5 -5
  15. package/dist/frqtl/objects/record/Record.js +346 -0
  16. package/dist/frqtl/objects/record/open-record.js +22 -0
  17. package/dist/frqtl/objects/schema/engine-scopes.js +2 -2
  18. package/dist/frqtl/objects/schema/scopes.js +2 -2
  19. package/dist/frqtl/objects/setup/_worldInit.js +1 -2
  20. package/dist/frqtl/objects/setup/setupBlackbodySubstrate.js +1 -2
  21. package/dist/frqtl/parts/CameraControls.js +8 -0
  22. package/dist/frqtl/parts/DetectorWall.js +1 -1
  23. package/dist/frqtl/parts/FrqtlVision.js +21 -6
  24. package/dist/frqtl/parts/GraphingDetectorWall.js +7 -7
  25. package/dist/frqtl/parts/LargeObject.js +2 -2
  26. package/dist/frqtl/parts/LiveChart.js +2 -2
  27. package/dist/frqtl/parts/LogicGate.js +3 -3
  28. package/dist/frqtl/parts/OvenBox.js +1 -1
  29. package/dist/frqtl/parts/PointSource.js +1 -1
  30. package/dist/frqtl/parts/SlitLightSource.js +1 -1
  31. package/dist/frqtl/parts/SlitScreen.js +1 -1
  32. package/dist/frqtl/parts/SphereEmitter.js +12 -12
  33. package/dist/frqtl/parts/Trace.js +1 -1
  34. package/dist/frqtl/parts/Tunnel.js +11 -11
  35. package/dist/frqtl/parts/Wall.js +20 -10
  36. package/dist/frqtl/scenes/circuit-sat.js +1 -0
  37. package/dist/frqtl/scenes/dse-one-emitter.js +32 -34
  38. package/dist/frqtl/scenes/dse-two-emitters.js +33 -34
  39. package/dist/frqtl/scenes/mirror-route.js +96 -79
  40. package/dist/frqtl-web.min.js +54 -50
  41. package/dist/sdk.html +2 -2
  42. package/dist/shim/bundle/index.js +118 -96
  43. package/dist/shim/bundle/indexHtml.js +66 -39
  44. package/dist/shim/controls/index.js +1 -1
  45. package/dist/shim/engine/artifact-shell.js +1 -1
  46. package/dist/shim/engine/router.js +3 -3
  47. package/dist/shim/host/host-view.js +228 -0
  48. package/dist/shim/host/index.js +18 -0
  49. package/dist/shim/index.js +3 -5
  50. package/dist/shim/notebook/format.js +1 -1
  51. package/dist/shim/notebook/kernel.js +1 -1
  52. package/dist/shim/notebook/setup-builder.js +2 -2
  53. package/dist/shim/notebook/store.js +2 -3
  54. package/dist/shim/package.json +1 -0
  55. package/dist/shim/page-params/index.js +2 -30
  56. package/dist/shim/project/fork.js +293 -0
  57. package/dist/shim/project/identity.js +3 -1
  58. package/dist/shim/project/index.js +16 -3
  59. package/dist/shim/project/link.js +224 -46
  60. package/dist/shim/project/manifest.js +151 -0
  61. package/dist/shim/project/parts-writer.js +68 -7
  62. package/dist/shim/project/read-text.js +43 -0
  63. package/dist/shim/project/record-format.js +345 -0
  64. package/dist/shim/project/specifiers.js +104 -15
  65. package/dist/shim/registry/exhibits.js +15 -34
  66. package/dist/shim/registry/index.js +3 -3
  67. package/dist/shim/registry/scene-roster.js +35 -0
  68. package/dist/shim/registry/scene-source.js +48 -64
  69. package/dist/shim/registry/walkthrough.js +6 -6
  70. package/dist/shim/render-state/apply.js +66 -31
  71. package/dist/shim/render-state/index.js +6 -2
  72. package/dist/shim/runtime/index.js +4 -4
  73. package/dist/shim/storage/codec-chains.js +88 -0
  74. package/dist/shim/storage/folders.js +205 -0
  75. package/dist/shim/storage/index.js +64 -8
  76. package/dist/shim/storage/make-namespace-store.js +5 -5
  77. package/llms.txt +13 -10
  78. package/package.json +20 -2
  79. package/dist/frqtl/experiments/_shared/fx-experiment.js +0 -449
  80. package/dist/js/models/flamingo-draco.glb +0 -0
  81. package/dist/js/models/flamingo.glb +0 -0
  82. package/dist/shim/bundle/frqnb.js +0 -112
  83. package/dist/shim/bundle/manifest.js +0 -95
  84. package/dist/shim/registry/experiments.js +0 -215
  85. package/dist/shim/storage/modules.js +0 -249
  86. package/dist/shim/storage/projects.js +0 -150
@@ -18,9 +18,8 @@
18
18
  WORLD INTROSPECTION — what SAMPLER is this world actually running?
19
19
 
20
20
  The one stamping site on this page for resolved-world `data-*` attributes
21
- (the pattern documented on lib/frqtl/experiments/single-source-interference/
22
- index.html's #ssi-metrics; SAME attribute name, same resolution ladder, same
23
- 'engine-default' sentinel — a second spelling would defeat the purpose).
21
+ (one attribute name, one resolution ladder, one 'engine-default' sentinel — a
22
+ second spelling would defeat the purpose).
24
23
 
25
24
  WHY it exists: a fixed-vs-average A/B whose two arms cannot be told apart
26
25
  from the evidence is a null experiment. This element makes the arm READABLE
@@ -54,7 +53,24 @@
54
53
  "@descix/frqtl-web/compat/renderer/orbit-bag.js": "../../frqtl/compat/renderer/orbit-bag.js",
55
54
  "@descix/frqtl-web/objects/setup/_collisionMatrixLanes.js": "../../frqtl/objects/setup/_collisionMatrixLanes.js",
56
55
  "@descix/frqtl-web/compat/engine.js": "../../frqtl/compat/engine.js",
57
- "@descix/frqtl-web/kinds": "../../frqtl/objects/kinds-entry.js"
56
+ "@descix/frqtl-web/kinds": "../../frqtl/objects/kinds-entry.js",
57
+ "@descix/frqtl-web/objects/objects/tagger.js": "../../frqtl/objects/objects/tagger.js",
58
+ "@descix/frqtl-web/objects/schema/index.js": "../../frqtl/objects/schema/index.js",
59
+ "@descix/frqtl-web/shim/render/heat-colormap.js": "../../shim/render/heat-colormap.js",
60
+ "@descix/frqtl-web/objects/schema/valueNormalizer.js": "../../frqtl/objects/schema/valueNormalizer.js",
61
+ "@descix/frqtl-web/objects/objects/Box.js": "../../frqtl/objects/objects/Box.js",
62
+ "@descix/frqtl-web/objects/objects/QuantumEmitter.js": "../../frqtl/objects/objects/QuantumEmitter.js",
63
+ "@descix/frqtl-web/shim/expr/ast-schema.js": "../../shim/expr/ast-schema.js",
64
+ "@descix/frqtl-web/objects/objects/actionCompiler.js": "../../frqtl/objects/objects/actionCompiler.js",
65
+ "@descix/frqtl-web/objects/v1-replacements.js": "../../frqtl/objects/v1-replacements.js",
66
+ "@descix/frqtl-web/objects/objects/slitLinerScatter.js": "../../frqtl/objects/objects/slitLinerScatter.js",
67
+ "@descix/frqtl-web/objects/setup/setupSphereEmitter3D.js": "../../frqtl/objects/setup/setupSphereEmitter3D.js",
68
+ "@descix/frqtl-web/objects/objects/directedRedirectProgram.js": "../../frqtl/objects/objects/directedRedirectProgram.js",
69
+ "@descix/frqtl-web/compat/renderer/lo-drawn-center.js": "../../frqtl/compat/renderer/lo-drawn-center.js",
70
+ "@descix/frqtl-web/objects/setup/setupTunnelPointExit.js": "../../frqtl/objects/setup/setupTunnelPointExit.js",
71
+ "@descix/frqtl-web/objects/constants/WallBehaviors.js": "../../frqtl/objects/constants/WallBehaviors.js",
72
+ "@descix/frqtl-web/objects/objects/absorbRadiation.js": "../../frqtl/objects/objects/absorbRadiation.js",
73
+ "@descix/frqtl-web/objects/geometry/SlabFace.js": "../../frqtl/objects/geometry/SlabFace.js"
58
74
  }
59
75
  }
60
76
  </script>
@@ -114,9 +130,8 @@
114
130
  /**
115
131
  * _resolvedStepping() — WHICH WAVE-WALK SAMPLER IS THIS WORLD RUNNING?
116
132
  *
117
- * The SAME resolution ladder single-source-interference/index.html documents for
118
- * its own #ssi-metrics stamp, one hop up (a recipe page has no LOCKED opts bag —
119
- * its declared world config IS `exp.world.cfg`):
133
+ * The resolution ladder (a recipe page has no LOCKED opts bag — its declared world
134
+ * config IS `exp.world.cfg`):
120
135
  *
121
136
  * 1. the universe's own RESOLVED read-back, when the provider ever exposes one
122
137
  * (truth-in-labeling: what RAN beats what was asked). Vestigial today —
@@ -186,8 +201,8 @@
186
201
  var exp = experiment;
187
202
  try {
188
203
  if (!project || typeof project !== 'object' || project.mint !== undefined || project.bare !== undefined) {
189
- throw new Error('[empty] FrqtlPage.applyModuleSource(project): project is { files: { "sketch.js": text, … }, ' +
190
- 'entry: "sketch.js" } (or { url, entry }) — a sketch held as one string is the one-file project. ' +
204
+ throw new Error('[empty] FrqtlPage.applyModuleSource(project): project is { files: { "frqtl.json": text, "sketch.js": text, … } } ' +
205
+ '(or { url }; + entry: "sketch.js" when it carries no frqtl.json) — a sketch held as one string is the one-file project. ' +
191
206
  'This page links with its own mint. (got ' + (typeof project === 'string' ? 'a string' : typeof project) + ') (FAIL-LOUD.)');
192
207
  }
193
208
  exp._built = false;
@@ -215,7 +230,7 @@
215
230
  *
216
231
  * A public hook gets a public name: this IS the shipped, documented way to load a scene into
217
232
  * the blank page — the ONE door every host comes through (STUDIO's author surface, the GYM's
218
- * rung frame via rung-frame.js applySceneText, the hosted eyes, the getting-started doc) — and
233
+ * rung frame via rung-frame.js applySceneProject, the hosted eyes, the getting-started doc) — and
219
234
  * the ONE door a host hands a renderState bag through (applyRenderState). The
220
235
  * page itself states NO world: every scene does, in its first statement — the blank STUDIO
221
236
  * universe is the scene file scenes/empty.js like any other. A member joins this object only
@@ -226,7 +241,7 @@
226
241
  isReady: function () { return !!experiment; },
227
242
 
228
243
  /**
229
- * Apply a scene / saved project — { files, entry } or { url, entry } — against this page's facade. Leaves the
244
+ * Apply a scene / saved project — { files } or { url } (+ entry when it carries no frqtl.json) — against this page's facade. Leaves the
230
245
  * loop STOPPED and makes the runner the scene's co-init call built the page's runner
231
246
  * (FrqtlPage.runner).
232
247
  *
@@ -743,8 +743,7 @@ import { Rectangle } from '../../parts/Rectangle.js';
743
743
  // can parent — density clustering). ENGINE TRUTH, ASKED ON EVERY READ: init() ferries the
744
744
  // mode in the CONFIG BAG (`frame_gen_mode`), the ENGINE holds it, and this getter asks the
745
745
  // running universe what it actually HOLDS. A JS copy would go stale the moment a re-init
746
- // changed the mode — which is exactly how STUDIO's codegen came to print a mode the run
747
- // was not using.
746
+ // changed the mode — and a writer that read it would write a mode the run was not using.
748
747
  //
749
748
  // `_frameGenMode` survives for exactly ONE read: the window between create() and init(),
750
749
  // when there is no engine to ask. It is NOT an input to init() — init() takes its own
@@ -1007,8 +1006,8 @@ import { Rectangle } from '../../parts/Rectangle.js';
1007
1006
  }
1008
1007
  // READ-BACK of the RESOLVED axes (what this run actually uses, including the
1009
1008
  // engine's serde default when the sketch omitted them). Truth-in-labeling: any
1010
- // consumer that must re-declare this world (STUDIO codegen re-emitting the
1011
- // sketch's world step) DERIVES it from here rather than guessing.
1009
+ // consumer that must re-declare this world (a host re-stating the sketch's world step)
1010
+ // DERIVES it from here rather than guessing.
1012
1011
  this.activeAxes = config.active_axes
1013
1012
  ? { x: config.active_axes.x, y: config.active_axes.y, z: config.active_axes.z }
1014
1013
  : { x: true, y: true, z: false };
@@ -803,7 +803,7 @@ import * as RendererProviderContract from '../renderer-provider-contract.js';
803
803
  setPreset: function (name) {
804
804
  // A preset is a FULL framing reset — the reliable way back. A name this
805
805
  // camera does not offer THROWS (a silent no-op would leave a saved or
806
- // codegen'd preset doing nothing with no signal).
806
+ // written preset doing nothing with no signal).
807
807
  var all = _presets(), p = all[name];
808
808
  if (!p) {
809
809
  throw new Error('[p5-provider camera] setPreset("' + name + '"): this camera offers ' +
@@ -8,14 +8,17 @@
8
8
  * default 'p5'), seed (default 42), onTick, render (one runner.setRenderOptions batch after start).
9
9
  *
10
10
  * bootProject(mount, project, opts?) → Promise<{ runner, recipeContext, display, retainedRenderRows }>
11
- * project = { files: { 'sketch.js': text, 'parts/X.js': text, … }, entry } | { url: '<served folder>/', entry }
11
+ * project = { files: { 'frqtl.json': text, 'sketch.js': text, 'parts/X.js': text, … }, entry? }
12
+ * | { url: '<served folder>/', entry? }
12
13
  * — linked by THE link site through linkInPage (lib/shim/project/link.js linkProject; `mint` defaults to blobMint;
13
14
  * a project may carry its host's `mint` / `bare`), its entry's default export built on the page.
14
- * `entry` is REQUIRED. A one-string sketch is { files: { 'sketch.js': src }, entry: 'sketch.js' }.
15
- * opts: renderState (a saved bag: its renderer/seed pick the boot, then the whole bag is applied
16
- * through the boot's applyRenderState), seed (overrides renderState.seed), onTick.
17
- * The runner's SceneRecord carries the project's identity (identity.js projectIdentity) as
18
- * `sourceSha256`.
15
+ * `entry` is optional when the folder's frqtl.json names it (lib/shim/project/manifest.js); beside a
16
+ * manifest it must equal manifest.entry; with no manifest it is REQUIRED. A one-string sketch is
17
+ * { files: { 'sketch.js': src }, entry: 'sketch.js' }.
18
+ * opts: renderState (the HOST's boot bag — its renderer/seed pick the boot, then the whole bag is applied
19
+ * through the boot's applyRenderState; never a fact of frqtl.json), seed (overrides renderState.seed), onTick.
20
+ * The runner's SceneRecord carries the project's identity (identity.js projectIdentity over the linked
21
+ * set, frqtl.json included) as `sourceSha256`.
19
22
  *
20
23
  * display — the display slot's value after the boot (compat/renderer/display-slot.js), ferried.
21
24
  *
@@ -197,12 +200,12 @@ function claimDocument(door) {
197
200
  /**
198
201
  * THE page host's link: linkProject with the page's mint (blobMint) unless the project carries its host's own.
199
202
  * bootProject and the empty page (FrqtlPage.applyModuleSource) both link through it.
200
- * @param {{files?: Object<string,string>, url?: string, entry: string, mint?: Function, bare?: Function}} project
201
- * @returns {Promise<{buildExperiment: function, files: Object<string, Uint8Array>}>}
203
+ * @param {{files?: Object<string,string>, url?: string, entry?: string, mint?: Function, bare?: Function}} project
204
+ * @returns {Promise<object>} linkProject's result (its contract: lib/shim/project/link.js)
202
205
  */
203
206
  export function linkInPage(project) {
204
207
  if (!project || typeof project !== 'object') {
205
- return Promise.reject(new Error('[doors] linkInPage(project): project is { files, entry } or { url, entry } (got ' +
208
+ return Promise.reject(new Error('[doors] linkInPage(project): project is { files } or { url } (+ entry when it carries no frqtl.json) (got ' +
206
209
  typeof project + '). (FAIL-LOUD.)'));
207
210
  }
208
211
  return linkProject(Object.assign({}, project, project.mint === undefined ? { mint: blobMint } : {}));
@@ -259,12 +262,14 @@ async function bootSceneClaimed(mountEl, sketch, opts) {
259
262
  /**
260
263
  * Boot a PROJECT into `mount`: link it (linkProject), build its entry's default export.
261
264
  * @param {HTMLElement|string} mountEl
262
- * @param {{files?: Object<string,string>, url?: string, entry: string, mint?: Function, bare?: Function}} project
265
+ * @param {{files?: Object<string,string>, url?: string, entry?: string, mint?: Function, bare?: Function}} project
263
266
  * @param {{renderState?: object, seed?: number, onTick?: Function}} [opts]
264
267
  * @returns {Promise<{runner: object, recipeContext: object, display: string, retainedRenderRows: object[]}>}
265
268
  * @example
266
269
  * import { bootProject } from '@descix/frqtl-web/boot';
267
- * await bootProject('mount', { files: { 'sketch.js': src, 'parts/MyEmitter.js': fork }, entry: 'sketch.js' });
270
+ * import { manifestFor, serializeManifest } from '@descix/frqtl-web/project';
271
+ * const json = serializeManifest(manifestFor({ name: 'my-scene', entry: 'sketch.js' }));
272
+ * await bootProject('mount', { files: { 'frqtl.json': json, 'sketch.js': src, 'parts/MyEmitter.js': fork } });
268
273
  */
269
274
  export function bootProject(mountEl, project, opts) {
270
275
  let settle;
@@ -280,7 +285,7 @@ async function bootProjectClaimed(mountEl, project, opts) {
280
285
  let identity;
281
286
  try {
282
287
  if (!project || typeof project !== 'object' || typeof project === 'function') {
283
- throw new Error('[doors] bootProject(mount, project, opts): project is { files, entry } or { url, entry } ' +
288
+ throw new Error('[doors] bootProject(mount, project, opts): project is { files } or { url } (+ entry when it carries no frqtl.json) ' +
284
289
  '(a sketch function boots through bootScene). (got ' + typeof project + ')');
285
290
  }
286
291
  refuseStray('bootProject', opts, BOOT_PROJECT_OPTS);
@@ -248,7 +248,7 @@ import { paintBootFailure } from '../experiments/_shared/boot-failure.js';
248
248
  // experiment pages). When true (STUDIO authoring), the renderer DRAWS the
249
249
  // Design-only markers (a manipulable emitter's visual circle, `lo._designMarker`).
250
250
  // A render toggle at the output boundary (zero physics): it filters ONLY the
251
- // renderTick view; the pick, the aim, Layers and codegen read the census and the
251
+ // renderTick view; the pick, the aim, Layers and the parts writer read the census and the
252
252
  // declared registry directly, so an emitter stays selectable even when its marker
253
253
  // circle is suppressed.
254
254
  this._designMode = false;
@@ -814,7 +814,7 @@ import { paintBootFailure } from '../experiments/_shared/boot-failure.js';
814
814
  // is manipulable, so only what the user proactively declares is registered.
815
815
  //
816
816
  // `declared` is the ordered list of the handles the user's DECLARING calls produced
817
- // (`exp.addObject`, a palette drop, a codegen replay — all three funnel through
817
+ // (`exp.addObject`, a palette drop, a parts entry replayed — all three funnel through
818
818
  // `ObjectFactory.create`, the registry's ONE writer). It is a different fact from the world
819
819
  // census (`largeObjects` — everything the world draws and collides): a part's composition is
820
820
  // in the census but never declared. "Which declared object does this drawn thing belong to"
@@ -954,6 +954,11 @@ import { paintBootFailure } from '../experiments/_shared/boot-failure.js';
954
954
  x.inParts = true;
955
955
  };
956
956
 
957
+ /** beginWorld() — a (re-)inited world has not stepped: its last TickData is gone (worldTick reads 0, repaint draws nothing). */
958
+ FrqtlApp.prototype.beginWorld = function () {
959
+ this._lastTickData = null;
960
+ };
961
+
957
962
  /** clearDeclared() — empty the registry. Called where the world re-inits (FrqtlApp.setup, and the
958
963
  * RecipeContext co-init exp.createCanvas / exp.createScene): a fresh world has no declared objects. */
959
964
  FrqtlApp.prototype.clearDeclared = function () {
@@ -985,7 +990,7 @@ import { paintBootFailure } from '../experiments/_shared/boot-failure.js';
985
990
  * undeclaredTickFunctions() → the host tick-functions running in the world that NO declared
986
991
  * object owns: a setup factory's emitter, a page's own regulation fn, a sketch's
987
992
  * exp.addTickFunction. They are behaviour the registry cannot write down, so whatever writes the
988
- * world as declarations (codegen) refuses while any exists.
993
+ * world as declarations refuses while any exists.
989
994
  * @returns {Function[]}
990
995
  */
991
996
  FrqtlApp.prototype.undeclaredTickFunctions = function () {
@@ -1051,7 +1056,7 @@ import { paintBootFailure } from '../experiments/_shared/boot-failure.js';
1051
1056
  * getObjectByName(name, predicate?) → the DECLARED object of that name (passing `predicate` when
1052
1057
  * given), else null — the lazy by-name reference every cross-object link that must survive a
1053
1058
  * Restart uses (an emitter's gateCounter, a LiveChart source). Handles are fresh at registration
1054
- * and never survive codegen, so the reference is a NAME resolved against the registry at use
1059
+ * and never survive a re-link, so the reference is a NAME resolved against the registry at use
1055
1060
  * time. The CALLER decides whether null is FAIL-LOUD (the emission gate throws; a LiveChart
1056
1061
  * retries next scan).
1057
1062
  * @param {string} name @param {Function} [predicate] @returns {Object|null}
@@ -2296,7 +2301,7 @@ import { paintBootFailure } from '../experiments/_shared/boot-failure.js';
2296
2301
  this.stop();
2297
2302
  var self = this;
2298
2303
  function resume(result) {
2299
- self._lastTickData = null;
2304
+ self.beginWorld();
2300
2305
  // Always resume: "restart" means run the scene again from tick 0 — a restart
2301
2306
  // that left the loop paused would read as a dead button.
2302
2307
  self.start();
@@ -2388,7 +2393,7 @@ import { paintBootFailure } from '../experiments/_shared/boot-failure.js';
2388
2393
  var msg = 'FrqtlApp: the DISPLAY SLOT is empty (FrqtlDisplay.get() === null).\n\n' +
2389
2394
  'The boot module (lib/frqtl/experiments/_shared/boot.js) must select a renderer\n' +
2390
2395
  'BEFORE the draw loop fires. This is a page configuration error.\n\n' +
2391
- 'P5Renderer has been removed (WS-RENDERER Phase 1). All experiment pages\n' +
2396
+ 'P5Renderer has been removed. All experiment pages\n' +
2392
2397
  'boot the canonical RendererProvider stack through bootPage().';
2393
2398
  if (typeof document === 'undefined') {
2394
2399
  // No DOM to paint the overlay into — the message is still LOUD, on the console
@@ -2572,6 +2577,28 @@ import { paintBootFailure } from '../experiments/_shared/boot-failure.js';
2572
2577
  return this._tickSuspend;
2573
2578
  };
2574
2579
 
2580
+ /**
2581
+ * runner.worldTick — READ-ONLY: the tick of THIS world: 0 before its first step, else the last delivered tick.
2582
+ * The 0 is a stated fact, not a default: `_lastTickData` is null until the world's first step, and beginWorld()
2583
+ * (the co-init and restart()) is the one writer of that null. It does NOT read `universe.tick`: the compat wrapper
2584
+ * keeps that field across a re-init until the next doTick, so after a restart it still answers the previous
2585
+ * world's tick. Every runner holds a world (its universe is built at construction), whether a sketch built it
2586
+ * through the replay door or a page built it by hand, so this always answers. THROWS when a delivered tick is not
2587
+ * a whole number ≥ 0.
2588
+ */
2589
+ Object.defineProperty(FrqtlApp.prototype, 'worldTick', {
2590
+ configurable: true,
2591
+ get: function () {
2592
+ if (this._lastTickData === null) { return 0; }
2593
+ var t = this._lastTickData && this._lastTickData.universeData && this._lastTickData.universeData.tick;
2594
+ if (!(typeof t === 'number' && t >= 0 && t % 1 === 0)) {
2595
+ throw new Error('[FrqtlApp.worldTick] the last delivered TickData carries tick ' + String(t) +
2596
+ ', not a whole number ≥ 0. (FAIL-LOUD.)');
2597
+ }
2598
+ return t;
2599
+ }
2600
+ });
2601
+
2575
2602
  /** @returns {boolean} whether the tick clock is currently held. */
2576
2603
  Object.defineProperty(FrqtlApp.prototype, 'ticksSuspended', {
2577
2604
  configurable: true,