@descix/frqtl-node 0.0.0-stage → 0.6.0-p0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/CLAUDE.md +87 -0
  2. package/README.md +84 -2
  3. package/dist/dist-manifest.json +218 -0
  4. package/dist/eyes/index.js +109 -0
  5. package/dist/fat/pkg-node/egpt_wasm.js +1277 -0
  6. package/dist/fat/pkg-node/egpt_wasm_bg.wasm +0 -0
  7. package/dist/fat/pkg-node/package.json +12 -0
  8. package/dist/frqtl/assets/vendor/chroma.mjs +64 -0
  9. package/dist/frqtl/compat/boot-node.js +34 -0
  10. package/dist/frqtl/compat/engine.js +127 -0
  11. package/dist/frqtl/compat/package-root.js +24 -0
  12. package/dist/frqtl/compat/providers/wasm-engine.js +2501 -0
  13. package/dist/frqtl/compat/providers/wasm-load-browser.js +134 -0
  14. package/dist/frqtl/compat/providers/wasm-load-node.js +59 -0
  15. package/dist/frqtl/compat/renderer/FieldBuilder.js +145 -0
  16. package/dist/frqtl/compat/renderer/Filters.js +163 -0
  17. package/dist/frqtl/compat/renderer/RenderFamily.js +85 -0
  18. package/dist/frqtl/compat/renderer/RenderMesh.js +100 -0
  19. package/dist/frqtl/compat/renderer/RenderShape.js +154 -0
  20. package/dist/frqtl/compat/renderer/camera2d-geometry.js +183 -0
  21. package/dist/frqtl/compat/renderer/captureStill-common.js +259 -0
  22. package/dist/frqtl/compat/renderer/display-slot.js +96 -0
  23. package/dist/frqtl/compat/renderer/lo-drawn-center.js +231 -0
  24. package/dist/frqtl/compat/renderer/orbit-bag.js +216 -0
  25. package/dist/frqtl/compat/renderer/providers/godrays-layer.js +213 -0
  26. package/dist/frqtl/compat/renderer/providers/index.js +22 -0
  27. package/dist/frqtl/compat/renderer/providers/p5-provider.js +861 -0
  28. package/dist/frqtl/compat/renderer/providers/three-camera-contract.js +160 -0
  29. package/dist/frqtl/compat/renderer/providers/three-camera-geometry.js +571 -0
  30. package/dist/frqtl/compat/renderer/providers/three-provider.js +2474 -0
  31. package/dist/frqtl/compat/renderer/renderCapabilities-common.js +186 -0
  32. package/dist/frqtl/compat/renderer/renderer-provider-contract.js +238 -0
  33. package/dist/frqtl/compat/renderer/unprojectStill.js +172 -0
  34. package/dist/frqtl/compat/vendor.js +196 -0
  35. package/dist/frqtl/node-entry.js +17 -0
  36. package/dist/frqtl/objects/FrqtlApp.js +2922 -0
  37. package/dist/frqtl/objects/ObjectFactory.js +297 -0
  38. package/dist/frqtl/objects/RecipeContext.js +322 -0
  39. package/dist/frqtl/objects/collectors/DataCollector.js +116 -0
  40. package/dist/frqtl/objects/constants/WallBehaviors.js +178 -0
  41. package/dist/frqtl/objects/geometry/SlabFace.js +258 -0
  42. package/dist/frqtl/objects/instruments/capture-host.js +453 -0
  43. package/dist/frqtl/objects/instruments/capture.js +711 -0
  44. package/dist/frqtl/objects/instruments/hosted-eyes.js +985 -0
  45. package/dist/frqtl/objects/kinds-entry.js +14 -0
  46. package/dist/frqtl/objects/kinds.js +190 -0
  47. package/dist/frqtl/objects/objects/Box.js +273 -0
  48. package/dist/frqtl/objects/objects/Bullet.js +155 -0
  49. package/dist/frqtl/objects/objects/CircuitGate.js +380 -0
  50. package/dist/frqtl/objects/objects/CircuitProbe.js +214 -0
  51. package/dist/frqtl/objects/objects/DirectedTunnel.js +412 -0
  52. package/dist/frqtl/objects/objects/EgptFractal.js +164 -0
  53. package/dist/frqtl/objects/objects/LightSource.js +354 -0
  54. package/dist/frqtl/objects/objects/QuantumEmitter.js +760 -0
  55. package/dist/frqtl/objects/objects/Tube.js +471 -0
  56. package/dist/frqtl/objects/objects/absorbRadiation.js +310 -0
  57. package/dist/frqtl/objects/objects/actionCompiler.js +1747 -0
  58. package/dist/frqtl/objects/objects/controlAction.js +89 -0
  59. package/dist/frqtl/objects/objects/controlBind.js +278 -0
  60. package/dist/frqtl/objects/objects/directedRedirectProgram.js +120 -0
  61. package/dist/frqtl/objects/objects/emitterProgram.js +209 -0
  62. package/dist/frqtl/objects/objects/frqtl-control-slider.js +197 -0
  63. package/dist/frqtl/objects/objects/frqtl-control-sync.js +272 -0
  64. package/dist/frqtl/objects/objects/frqtl-control-widgets.js +219 -0
  65. package/dist/frqtl/objects/objects/frqtl-control-write-queue.js +174 -0
  66. package/dist/frqtl/objects/objects/makeControlsForObject.js +824 -0
  67. package/dist/frqtl/objects/objects/makeControlsForRenderSurface.js +161 -0
  68. package/dist/frqtl/objects/objects/slitLinerScatter.js +263 -0
  69. package/dist/frqtl/objects/objects/sustainedSource.js +299 -0
  70. package/dist/frqtl/objects/objects/tagger.js +228 -0
  71. package/dist/frqtl/objects/schema/engine-scopes.js +469 -0
  72. package/dist/frqtl/objects/schema/index.js +256 -0
  73. package/dist/frqtl/objects/schema/scopes.js +457 -0
  74. package/dist/frqtl/objects/schema/validate-descriptor.js +49 -0
  75. package/dist/frqtl/objects/schema/valueNormalizer.js +366 -0
  76. package/dist/frqtl/objects/setup/_collisionMatrixLanes.js +66 -0
  77. package/dist/frqtl/objects/setup/_setupOptions.js +118 -0
  78. package/dist/frqtl/objects/setup/_worldInit.js +162 -0
  79. package/dist/frqtl/objects/setup/setupBlackbodySubstrate.js +242 -0
  80. package/dist/frqtl/objects/setup/setupCircuitBasic.js +447 -0
  81. package/dist/frqtl/objects/setup/setupCollisionMatrix.js +188 -0
  82. package/dist/frqtl/objects/setup/setupConeEmitter3D.js +251 -0
  83. package/dist/frqtl/objects/setup/setupDoubleSlit.js +327 -0
  84. package/dist/frqtl/objects/setup/setupDoubleSlit_Laser.js +229 -0
  85. package/dist/frqtl/objects/setup/setupEmpty.js +59 -0
  86. package/dist/frqtl/objects/setup/setupFxSmoke.js +209 -0
  87. package/dist/frqtl/objects/setup/setupG1Race.js +80 -0
  88. package/dist/frqtl/objects/setup/setupG2Sweep.js +89 -0
  89. package/dist/frqtl/objects/setup/setupG3Collide.js +177 -0
  90. package/dist/frqtl/objects/setup/setupLightSourceLab.js +280 -0
  91. package/dist/frqtl/objects/setup/setupOscillator.js +68 -0
  92. package/dist/frqtl/objects/setup/setupParticleWalk.js +93 -0
  93. package/dist/frqtl/objects/setup/setupParticleWalk3D.js +133 -0
  94. package/dist/frqtl/objects/setup/setupSphereEmitter3D.js +1259 -0
  95. package/dist/frqtl/objects/setup/setupTraceCircuit.js +239 -0
  96. package/dist/frqtl/objects/setup/setupTunnelLab.js +242 -0
  97. package/dist/frqtl/objects/setup/setupTunnelPointExit.js +306 -0
  98. package/dist/frqtl/objects/setup/setupWaveInterference.js +178 -0
  99. package/dist/frqtl/objects/v1-replacements.js +30 -0
  100. package/dist/frqtl/package-core.js +23 -0
  101. package/dist/frqtl/parts/CameraControls.js +643 -0
  102. package/dist/frqtl/parts/CameraPath.js +575 -0
  103. package/dist/frqtl/parts/CollisionActions.js +35 -0
  104. package/dist/frqtl/parts/CollisionTypes.js +31 -0
  105. package/dist/frqtl/parts/DetectorWall.js +496 -0
  106. package/dist/frqtl/parts/FrqtlControlOverlay.js +227 -0
  107. package/dist/frqtl/parts/FrqtlControlsPanel.js +415 -0
  108. package/dist/frqtl/parts/FrqtlVision.js +818 -0
  109. package/dist/frqtl/parts/GraphingDetectorWall.js +490 -0
  110. package/dist/frqtl/parts/LargeObject.js +406 -0
  111. package/dist/frqtl/parts/LightColor.js +255 -0
  112. package/dist/frqtl/parts/LiveChart.js +285 -0
  113. package/dist/frqtl/parts/LogicGate.js +720 -0
  114. package/dist/frqtl/parts/OvenBox.js +612 -0
  115. package/dist/frqtl/parts/PointSource.js +763 -0
  116. package/dist/frqtl/parts/Rectangle.js +200 -0
  117. package/dist/frqtl/parts/SlitLightSource.js +234 -0
  118. package/dist/frqtl/parts/SlitScreen.js +628 -0
  119. package/dist/frqtl/parts/SphereEmitter.js +946 -0
  120. package/dist/frqtl/parts/Trace.js +508 -0
  121. package/dist/frqtl/parts/Tunnel.js +1057 -0
  122. package/dist/frqtl/parts/Wall.js +1211 -0
  123. package/dist/frqtl/parts/index.js +33 -0
  124. package/dist/frqtl/scenes/absorbing-wall-3d.js +33 -0
  125. package/dist/frqtl/scenes/absorbing-wall.js +32 -0
  126. package/dist/frqtl/scenes/atomic-model.js +88 -0
  127. package/dist/frqtl/scenes/big-bang.js +46 -0
  128. package/dist/frqtl/scenes/blackbody.js +81 -0
  129. package/dist/frqtl/scenes/circuit-sat.js +127 -0
  130. package/dist/frqtl/scenes/collision-matrix-3d.js +107 -0
  131. package/dist/frqtl/scenes/counting-wall-3d.js +36 -0
  132. package/dist/frqtl/scenes/counting-wall.js +38 -0
  133. package/dist/frqtl/scenes/double-slit.js +31 -0
  134. package/dist/frqtl/scenes/dse-one-emitter.js +196 -0
  135. package/dist/frqtl/scenes/dse-one-slit.js +114 -0
  136. package/dist/frqtl/scenes/dse-photoelectric.js +70 -0
  137. package/dist/frqtl/scenes/dse-tunnel-rebuild.js +244 -0
  138. package/dist/frqtl/scenes/dse-two-emitters.js +196 -0
  139. package/dist/frqtl/scenes/dse-two-slits.js +132 -0
  140. package/dist/frqtl/scenes/empty.js +14 -0
  141. package/dist/frqtl/scenes/laser-buildup.js +49 -0
  142. package/dist/frqtl/scenes/mirror-3d.js +56 -0
  143. package/dist/frqtl/scenes/mirror-route.js +140 -0
  144. package/dist/frqtl/scenes/mirror.js +38 -0
  145. package/dist/frqtl/scenes/omni-3d.js +27 -0
  146. package/dist/frqtl/scenes/omni-source.js +22 -0
  147. package/dist/frqtl/scenes/self-interference.js +39 -0
  148. package/dist/frqtl/scenes/smoking-gun.js +122 -0
  149. package/dist/frqtl/scenes/straight-walk.js +22 -0
  150. package/dist/frqtl/scenes/sun.js +39 -0
  151. package/dist/frqtl/scenes/two-source.js +37 -0
  152. package/dist/frqtl/scenes/wave.js +26 -0
  153. package/dist/shim/bundle/frqnb.js +112 -0
  154. package/dist/shim/bundle/index.js +121 -0
  155. package/dist/shim/bundle/indexHtml.js +107 -0
  156. package/dist/shim/bundle/manifest.js +95 -0
  157. package/dist/shim/bundle/zip.js +243 -0
  158. package/dist/shim/bus.js +67 -0
  159. package/dist/shim/controls/index.js +627 -0
  160. package/dist/shim/controls/registry.js +274 -0
  161. package/dist/shim/engine/artifact-shell.js +212 -0
  162. package/dist/shim/engine/boot-phases.js +44 -0
  163. package/dist/shim/engine/engine-stack-boot.js +59 -0
  164. package/dist/shim/engine/router.js +692 -0
  165. package/dist/shim/experiment-frame/index.js +296 -0
  166. package/dist/shim/expr/ast-schema.js +369 -0
  167. package/dist/shim/field-descriptor/index.js +326 -0
  168. package/dist/shim/frame-data/index.js +224 -0
  169. package/dist/shim/index.js +67 -0
  170. package/dist/shim/notebook/canvas-guard.js +82 -0
  171. package/dist/shim/notebook/catalog.js +35 -0
  172. package/dist/shim/notebook/format.js +736 -0
  173. package/dist/shim/notebook/frqtl-setups-importmap.js +81 -0
  174. package/dist/shim/notebook/kernel.js +672 -0
  175. package/dist/shim/notebook/knob.js +151 -0
  176. package/dist/shim/notebook/module-resolver.js +260 -0
  177. package/dist/shim/notebook/notebook-knobs.js +65 -0
  178. package/dist/shim/notebook/produced-bindings.js +67 -0
  179. package/dist/shim/notebook/realm-registry.js +121 -0
  180. package/dist/shim/notebook/realm-transport.js +73 -0
  181. package/dist/shim/notebook/setup-builder.js +510 -0
  182. package/dist/shim/notebook/store.js +159 -0
  183. package/dist/shim/notebook/vendor-importmap.js +134 -0
  184. package/dist/shim/notebook/view-builder.js +189 -0
  185. package/dist/shim/notebook/view-ctx.js +100 -0
  186. package/dist/shim/notebook/view-handle.js +202 -0
  187. package/dist/shim/notebook/warmup.js +102 -0
  188. package/dist/shim/package.json +4 -0
  189. package/dist/shim/page-params/index.js +214 -0
  190. package/dist/shim/project/identity.js +112 -0
  191. package/dist/shim/project/index.js +19 -0
  192. package/dist/shim/project/link.js +402 -0
  193. package/dist/shim/project/node-specifier-hook.mjs +35 -0
  194. package/dist/shim/project/register-node.mjs +17 -0
  195. package/dist/shim/project/specifiers.js +106 -0
  196. package/dist/shim/registry/copy-gate.js +110 -0
  197. package/dist/shim/registry/exhibits.js +455 -0
  198. package/dist/shim/registry/experiments.js +215 -0
  199. package/dist/shim/registry/index.js +19 -0
  200. package/dist/shim/registry/scene-source.js +157 -0
  201. package/dist/shim/registry/walkthrough.js +807 -0
  202. package/dist/shim/render/capture-envelope.js +279 -0
  203. package/dist/shim/render/heat-colormap.js +92 -0
  204. package/dist/shim/render/render-stages.js +855 -0
  205. package/dist/shim/render/sun-look.js +33 -0
  206. package/dist/shim/render-state/apply.js +262 -0
  207. package/dist/shim/render-state/index.js +74 -0
  208. package/dist/shim/rpc/index.js +207 -0
  209. package/dist/shim/runtime/index.js +1023 -0
  210. package/dist/shim/storage/boot.js +69 -0
  211. package/dist/shim/storage/index.js +169 -0
  212. package/dist/shim/storage/local-storage-provider.js +230 -0
  213. package/dist/shim/storage/make-namespace-store.js +132 -0
  214. package/dist/shim/storage/modules.js +249 -0
  215. package/dist/shim/storage/projects.js +150 -0
  216. package/llms.txt +12 -0
  217. package/package.json +62 -4
@@ -0,0 +1,196 @@
1
+ /* Copyright 2023-2026 by Essam Abadir */
2
+
3
+ /**
4
+ * compat/vendor.js — THE one reader of the vendor UMD globals and THE one classic-script loader.
5
+ *
6
+ * The module graph imports everything FRQTL authors. Two vendored libraries are still UMD builds that
7
+ * publish a global and are read through it: p5 (global mode — the sketch's `setup()` runs from p5's own
8
+ * load) and three.js r128 (`THREE`, with the GLTF/DRACO loaders that extend it). This file is the only
9
+ * place either global is read or written, and the only place a classic `<script>` is injected — the
10
+ * no-globals gate (sdk/_build/no-globals.mjs) holds it as one table row.
11
+ *
12
+ * vendorUrl(rel) → absolute URL of a vendored file (assets/vendor/<rel>, beside this tree)
13
+ * loadClassicScripts(urls, { onLoaded }) → Promise: inject each URL once, fetched in parallel, executed
14
+ * in list order (`onLoaded(url)` per script, in order); a failed load
15
+ * REJECTS with `err.src` naming the URL; argument errors REJECT
16
+ * loadThree({ meshLoaders }) → Promise<THREE>: three.js evaluated with AMD `define`/`require` shadowed
17
+ * (a page may carry Monaco's AMD loader), then the mesh loaders when asked
18
+ * three() → the THREE namespace; THROWS before loadThree resolved
19
+ * meshLoadersBase() → the vendored three-loaders directory URL (no trailing slash)
20
+ * runSketch({ setup, p5, onSetup }) → Promise: runs the page's sketch `setup` — installed as p5's
21
+ * global-mode `setup` hook and run by p5's own load when `p5` is true,
22
+ * else called; `onSetup` fires once setup() has RUN
23
+ * suppressP5Draw() p5's `draw` hook becomes a no-op (the runner owns the frame loop)
24
+ * resumeP5Loop() p5's `loop()`, when p5 is loaded (its event handling needs a running sketch)
25
+ * p5FrameRate(fps) p5's `frameRate(fps)`, when p5 is loaded
26
+ * P5_GLOBAL_MODE_HOOKS the page globals p5 global mode reads (`setup`, `draw`) — written ONLY here
27
+ *
28
+ * three loads through the classic path because the vendored r128 is the UMD build only; moving it to
29
+ * three.module.js + the jsm loaders is a change inside this file, owned by the p5 instance-mode / renderer
30
+ * bite (unscheduled).
31
+ *
32
+ * Zero physics: vendors draw; nothing here reads or writes a frame.
33
+ */
34
+
35
+ const VENDOR_DIR = new URL('../assets/vendor/', import.meta.url);
36
+
37
+ /**
38
+ * The page globals p5's GLOBAL MODE reads: its `setup` hook (called by p5's own load) and its `draw`
39
+ * hook (called every frame). They are p5's contract, not FRQTL surfaces, so the page door's retired-
40
+ * name refusal (experiments/_shared/page-door.js) installs no throwing accessor on them — it subtracts
41
+ * this table from the census. This file is their one writer.
42
+ * Deleter: the bite that moves p5 to instance mode (not yet scheduled; not P0c).
43
+ */
44
+ export const P5_GLOBAL_MODE_HOOKS = Object.freeze(['setup', 'draw']);
45
+
46
+ /** @param {string} rel — a path under assets/vendor/ @returns {string} its absolute URL */
47
+ export function vendorUrl(rel) {
48
+ return new URL(rel, VENDOR_DIR).href;
49
+ }
50
+
51
+ const _loads = new Map(); // url → Promise<void>, the ONE per-URL record (a failed load leaves it)
52
+
53
+ function _one(url) {
54
+ if (_loads.has(url)) { return _loads.get(url); }
55
+ const p = new Promise(function (resolve, reject) {
56
+ const s = document.createElement('script');
57
+ s.async = false; // fetched in parallel, executed in document order
58
+ s.src = url;
59
+ s.onload = function () { resolve(); };
60
+ s.onerror = function () {
61
+ // A failed load is not latched (loadThree's rule): the record and the dead tag go, so the
62
+ // next request for this URL injects a fresh tag and tries again.
63
+ _loads.delete(url);
64
+ if (s.parentNode) { s.parentNode.removeChild(s); }
65
+ const err = new Error('[vendor] classic script failed to load: ' + url);
66
+ err.src = url;
67
+ reject(err);
68
+ };
69
+ (document.head || document.body).appendChild(s);
70
+ });
71
+ _loads.set(url, p);
72
+ return p;
73
+ }
74
+
75
+ /**
76
+ * Inject classic scripts, each at most once per successful load: all tags appended together with
77
+ * async=false, so they fetch in parallel and execute in list order. `onLoaded(url)` fires per script, in
78
+ * order. A failed load rejects naming its URL and is forgotten, so a later call retries it.
79
+ *
80
+ * @param {string[]} urls
81
+ * @param {{ onLoaded?: function(string) }} [opts]
82
+ * @returns {Promise<void>}
83
+ */
84
+ export function loadClassicScripts(urls, opts) {
85
+ if (!Array.isArray(urls)) {
86
+ return Promise.reject(new TypeError('[vendor] loadClassicScripts(urls): urls must be an array of URLs (got ' + typeof urls + ')'));
87
+ }
88
+ const onLoaded = opts && opts.onLoaded;
89
+ if (onLoaded !== undefined && typeof onLoaded !== 'function') {
90
+ return Promise.reject(new TypeError('[vendor] loadClassicScripts: opts.onLoaded must be a function when given'));
91
+ }
92
+ const all = urls.map(function (u) {
93
+ return _one(u).then(function () { if (onLoaded) { onLoaded(u); } });
94
+ });
95
+ return Promise.all(all).then(function () {});
96
+ }
97
+
98
+ let _threePromise = null;
99
+
100
+ /** @returns {object} THE THREE namespace. THROWS until loadThree() resolved. */
101
+ export function three() {
102
+ const T = globalThis.THREE;
103
+ if (!T) {
104
+ throw new Error('[vendor] three.js is not loaded — boot the three renderer (bootRealm({ renderer: \'three\' })) ' +
105
+ 'before constructing a three provider. (FAIL-LOUD.)');
106
+ }
107
+ return T;
108
+ }
109
+
110
+ /** @returns {string} the vendored three-loaders directory (GLTFLoader.js, DRACOLoader.js, draco/). */
111
+ export function meshLoadersBase() {
112
+ return vendorUrl('three-loaders');
113
+ }
114
+
115
+ /**
116
+ * Load three.js (and, when asked, its GLTF/DRACO mesh loaders). Idempotent per realm once it has
117
+ * loaded; a failed load is forgotten, so the next call tries again.
118
+ *
119
+ * @param {{ meshLoaders?: boolean }} [opts]
120
+ * @returns {Promise<object>} THREE
121
+ */
122
+ export function loadThree(opts) {
123
+ const wantLoaders = !!(opts && opts.meshLoaders);
124
+ if (!_threePromise) {
125
+ const url = vendorUrl('three.min.js');
126
+ const p = fetch(url).then(function (resp) {
127
+ if (!resp.ok) { throw new Error('[vendor] three.js failed to load: HTTP ' + resp.status + ' ' + url); }
128
+ return resp.text();
129
+ }).then(function (source) {
130
+ // Shadow AMD/CommonJS so the UMD takes its global branch even beside Monaco's AMD loader.
131
+ const evalThree = new Function('define', 'require', 'module', 'exports', source + '\n//# sourceURL=' + url);
132
+ evalThree();
133
+ return three();
134
+ });
135
+ // A failed load is not latched: the next request (a later notebook cell) loads three afresh.
136
+ _threePromise = p;
137
+ p.catch(function () { if (_threePromise === p) { _threePromise = null; } });
138
+ }
139
+ if (!wantLoaders) { return _threePromise; }
140
+ return _threePromise.then(function (T) {
141
+ const base = meshLoadersBase();
142
+ return loadClassicScripts([base + '/GLTFLoader.js', base + '/DRACOLoader.js']).then(function () {
143
+ if (typeof T.GLTFLoader === 'undefined' || typeof T.DRACOLoader === 'undefined') {
144
+ throw new Error('[vendor] the mesh loaders loaded but THREE.GLTFLoader/DRACOLoader are undefined (' + base +
145
+ ') — run scripts/vendor-three-loaders.mjs to populate the vendored dir. (FAIL-LOUD.)');
146
+ }
147
+ return T;
148
+ });
149
+ });
150
+ }
151
+
152
+ /**
153
+ * Run the page's sketch. The page hands its `setup` in; on the p5 path it becomes p5's global-mode
154
+ * `setup` hook (a page global by p5's own convention, written only here) and p5's load calls it;
155
+ * otherwise it is called here. `onSetup()` fires after `setup()` has RUN (a throw inside it records nothing).
156
+ *
157
+ * @param {{ setup?: function, p5: boolean, onSetup?: function }} opts
158
+ * @returns {Promise<void>} settles once p5 loaded (p5 path) or setup() ran (direct path)
159
+ */
160
+ export function runSketch(opts) {
161
+ const useP5 = !!(opts && opts.p5);
162
+ const onSetup = opts && opts.onSetup;
163
+ const pageSetup = opts && opts.setup;
164
+ if (pageSetup !== undefined && typeof pageSetup !== 'function') {
165
+ return Promise.reject(new TypeError('[vendor] runSketch: opts.setup must be the page\'s setup function. (FAIL-LOUD.)'));
166
+ }
167
+ if (typeof pageSetup !== 'function' && !useP5) {
168
+ return Promise.reject(new Error('[vendor] runSketch: the page passes no setup() to run on this renderer. (FAIL-LOUD.)'));
169
+ }
170
+ const hooked = function () {
171
+ const out = pageSetup.apply(this, arguments);
172
+ if (onSetup) { onSetup(); }
173
+ return out;
174
+ };
175
+ if (useP5) {
176
+ if (typeof pageSetup === 'function') { globalThis.setup = hooked; } // p5 global mode calls it from its own load
177
+ return loadClassicScripts([vendorUrl('p5.min.js')]);
178
+ }
179
+ hooked();
180
+ return Promise.resolve();
181
+ }
182
+
183
+ /** p5's per-frame `draw` hook becomes a no-op: the runner's own frame loop draws. */
184
+ export function suppressP5Draw() {
185
+ globalThis.draw = function () { /* the runner's frame loop draws; p5's draw is a no-op */ };
186
+ }
187
+
188
+ /** p5's `frameRate(fps)`, when p5 is loaded (a p5 global-mode call; a no-op without p5). */
189
+ export function p5FrameRate(fps) {
190
+ if (typeof globalThis.frameRate === 'function') { globalThis.frameRate(fps); }
191
+ }
192
+
193
+ /** p5's `loop()`, when p5 is loaded — its mouse/key event handling needs a running sketch. */
194
+ export function resumeP5Loop() {
195
+ if (typeof globalThis.loop === 'function') { globalThis.loop(); }
196
+ }
@@ -0,0 +1,17 @@
1
+ /* Copyright 2023-2026 by Essam Abadir */
2
+
3
+ /**
4
+ * node-entry.js — the `.` of @descix/frqtl-node: the parts barrel, the node engine door and the shared
5
+ * package core.
6
+ *
7
+ * import { bootNode, Wall } from '@descix/frqtl-node';
8
+ * const handle = await bootNode(); // the WASM engine, once per process
9
+ * const u = handle.EGPTUniverse.create({ rect: { left: 0, top: 0, w: 600, h: 600 }, seed: 42 });
10
+ *
11
+ * `require('@descix/frqtl-node')` works from CommonJS too (require(esm): nothing in the graph awaits at
12
+ * top level).
13
+ */
14
+
15
+ export * from './parts/index.js';
16
+ export * from './package-core.js';
17
+ export { bootNode } from './compat/boot-node.js';