@vectojs/core 0.1.0 → 0.2.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 (46) hide show
  1. package/dist/animation/drivers.d.ts +48 -0
  2. package/dist/animation/easing.d.ts +16 -0
  3. package/dist/{chunk-M2IZPGOL.mjs → chunk-H3QIE77O.mjs} +316 -12
  4. package/dist/{chunk-53DAQC3U.js → chunk-LA3FJLP2.js} +369 -65
  5. package/dist/components/GridTextEntity.d.ts +15 -0
  6. package/dist/components/SplineEntity.d.ts +144 -0
  7. package/dist/components/TextEntity.d.ts +35 -0
  8. package/dist/index.d.ts +26 -577
  9. package/dist/index.js +121 -136
  10. package/dist/index.mjs +19 -34
  11. package/dist/{layout.d.mts → layout/LayoutEngine.d.ts} +15 -70
  12. package/dist/layout/LayoutWorker.d.ts +23 -0
  13. package/dist/layout/LayoutWorkerManager.d.ts +22 -0
  14. package/dist/layout/LayoutWorkerSource.d.ts +1 -0
  15. package/dist/layout/index.d.ts +3 -0
  16. package/dist/layout/measure.d.ts +20 -0
  17. package/dist/math/SpatialHashGrid.d.ts +53 -0
  18. package/dist/math/SpringPhysics.d.ts +13 -0
  19. package/dist/renderer/CanvasRenderer.d.ts +81 -0
  20. package/dist/renderer/IRenderer.d.ts +178 -0
  21. package/dist/renderer/SVGRenderer.d.ts +69 -0
  22. package/dist/renderer/WebGLPointRenderer.d.ts +62 -0
  23. package/dist/renderer/WebGPUParticleSystemManager.d.ts +14 -0
  24. package/dist/renderer/colorParse.d.ts +17 -0
  25. package/dist/renderer/index.d.ts +6 -0
  26. package/dist/text/ArabicShaper.d.ts +10 -0
  27. package/dist/text/BidiResolver.d.ts +6 -0
  28. package/dist/{text.d.ts → text/MSDFFont.d.ts} +10 -82
  29. package/dist/text/MSDFTextEntity.d.ts +30 -0
  30. package/dist/text/SVGEntity.d.ts +22 -0
  31. package/dist/text/index.d.ts +5 -0
  32. package/dist/text.js +2 -2
  33. package/dist/text.mjs +1 -1
  34. package/dist/tree/ComputeParticleEntity.d.ts +118 -0
  35. package/dist/tree/DOMPortalEntity.d.ts +18 -0
  36. package/dist/{Entity-D-rfAFCf.d.mts → tree/Entity.d.ts} +71 -201
  37. package/dist/tree/Scene.d.ts +302 -0
  38. package/package.json +5 -5
  39. package/dist/Entity-D-rfAFCf.d.ts +0 -572
  40. package/dist/index-ByBDSmMK.d.mts +0 -365
  41. package/dist/index-C3Fd_XmG.d.ts +0 -365
  42. package/dist/index.d.mts +0 -577
  43. package/dist/layout.d.ts +0 -319
  44. package/dist/renderer.d.mts +0 -2
  45. package/dist/renderer.d.ts +0 -2
  46. package/dist/text.d.mts +0 -201
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7;
2
2
 
3
3
 
4
4
 
@@ -17,7 +17,12 @@ var _chunkLIX7DJTIjs = require('./chunk-LIX7DJTI.js');
17
17
 
18
18
 
19
19
 
20
- var _chunk53DAQC3Ujs = require('./chunk-53DAQC3U.js');
20
+
21
+
22
+
23
+
24
+
25
+ var _chunkLA3FJLP2js = require('./chunk-LA3FJLP2.js');
21
26
 
22
27
 
23
28
 
@@ -34,7 +39,7 @@ var PARTICLE_OFFSET_ORIGIN_X = 4;
34
39
  var PARTICLE_OFFSET_ORIGIN_Y = 5;
35
40
  var PARTICLE_OFFSET_SIZE = 6;
36
41
  var PARTICLE_OFFSET_LIFE = 7;
37
- var ComputeParticleEntity = (_class = class extends _chunk53DAQC3Ujs.Entity {
42
+ var ComputeParticleEntity = (_class = class extends _chunkLA3FJLP2js.Entity {
38
43
 
39
44
 
40
45
 
@@ -313,72 +318,78 @@ var Scene = (_class2 = class _Scene {
313
318
  */
314
319
  __init9() {this.renderMode = "always"}
315
320
  __init10() {this.dirty = true}
321
+ /** Whether to throttle rendering to 2 FPS when the scene is static to save power. */
322
+ __init11() {this.autoThrottle = true}
316
323
  /**
317
324
  * Frame-rate cap (power saving). `0` = uncapped (native refresh). When set,
318
325
  * the loop renders at most `maxFPS` times per second; animations still run,
319
326
  * just less often. See {@link SceneOptions.maxFPS}.
320
327
  */
321
- __init11() {this.maxFPS = 60}
328
+ __init12() {this.maxFPS = 60}
322
329
  /** Whether the OS prefers-reduced-motion setting auto-caps the loop. */
323
- __init12() {this.respectReducedMotion = true}
330
+ __init13() {this.respectReducedMotion = true}
324
331
  /** Cached media-query list; `.matches` is read live each frame. */
325
- __init13() {this.reducedMotionQuery = null}
332
+ __init14() {this.reducedMotionQuery = null}
333
+ /** True when the OS asks for reduced motion and we respect it. Read by the animation drivers. */
334
+ get prefersReducedMotion() {
335
+ return this.respectReducedMotion && !!_optionalChain([this, 'access', _13 => _13.reducedMotionQuery, 'optionalAccess', _14 => _14.matches]);
336
+ }
326
337
  /**
327
338
  * Throttle interval (ms) for the a11y/automation shadow sync. `0` = every
328
339
  * frame. See {@link SceneOptions.a11ySyncInterval}.
329
340
  */
330
- __init14() {this.a11ySyncInterval = 0}
341
+ __init15() {this.a11ySyncInterval = 0}
331
342
  /** Timestamp of the last a11y sync, for throttling. */
332
- __init15() {this.lastA11ySync = -Infinity}
343
+ __init16() {this.lastA11ySync = -Infinity}
333
344
  /** True if we skipped an a11y sync during animation and need to sync when at rest. */
334
- __init16() {this.a11yPendingSyncAfterAnimation = false}
345
+ __init17() {this.a11yPendingSyncAfterAnimation = false}
335
346
  // A11y / Automation Layer. `null` in non-DOM (SSR/Node) environments — the
336
347
  // whole projection degrades to a no-op so the engine's logic stays usable
337
348
  // server-side (e.g. headless layout / vector export) without jsdom.
338
349
 
339
- __init17() {this.a11yElements = /* @__PURE__ */ new Map()}
350
+ __init18() {this.a11yElements = /* @__PURE__ */ new Map()}
340
351
 
341
- __init18() {this.focusedA11yElement = null}
342
- __init19() {this.caretBlinkTimer = null}
343
- __init20() {this.a11yNeedsReorder = true}
344
- __init21() {this.portalRoot = null}
345
- __init22() {this.fullViewportElements = []}
346
- __init23() {this.normalElements = []}
347
- __init24() {this.activeIds = /* @__PURE__ */ new Set()}
348
- __init25() {this.activePortalsThisFrame = /* @__PURE__ */ new Set()}
349
- __init26() {this.activePortalsPrevFrame = /* @__PURE__ */ new Set()}
350
- __init27() {this.portalEntities = /* @__PURE__ */ new Map()}
351
- __init28() {this.renderOrderCounter = 0}
352
+ __init19() {this.focusedA11yElement = null}
353
+ __init20() {this.caretBlinkTimer = null}
354
+ __init21() {this.a11yNeedsReorder = true}
355
+ __init22() {this.portalRoot = null}
356
+ __init23() {this.fullViewportElements = []}
357
+ __init24() {this.normalElements = []}
358
+ __init25() {this.activeIds = /* @__PURE__ */ new Set()}
359
+ __init26() {this.activePortalsThisFrame = /* @__PURE__ */ new Set()}
360
+ __init27() {this.activePortalsPrevFrame = /* @__PURE__ */ new Set()}
361
+ __init28() {this.portalEntities = /* @__PURE__ */ new Map()}
362
+ __init29() {this.renderOrderCounter = 0}
352
363
  // Optional WebGL point-cloud layer (see SceneOptions.pointBackend).
353
- __init29() {this.pointRenderer = null}
354
- __init30() {this.glCanvas = null}
364
+ __init30() {this.pointRenderer = null}
365
+ __init31() {this.glCanvas = null}
355
366
 
356
367
 
357
368
 
358
- __init31() {this.disableWindowResize = false}
369
+ __init32() {this.disableWindowResize = false}
359
370
  // WebGPU properties
360
- __init32() {this.destroyed = false}
361
- __init33() {this.device = null}
362
- __init34() {this.deviceLost = false}
363
- __init35() {this.particleBackend = "auto"}
364
- __init36() {this._webgpuDisabled = false}
371
+ __init33() {this.destroyed = false}
372
+ __init34() {this.device = null}
373
+ __init35() {this.deviceLost = false}
374
+ __init36() {this.particleBackend = "auto"}
375
+ __init37() {this._webgpuDisabled = false}
365
376
  get webgpuDisabled() {
366
377
  return this._webgpuDisabled || this.particleBackend === "cpu";
367
378
  }
368
379
  set webgpuDisabled(value) {
369
380
  this._webgpuDisabled = value;
370
381
  }
371
- __init37() {this.recoveryTimerId = null}
372
- __init38() {this.manager = null}
373
- __init39() {this.initializingWebGPU = false}
374
- __init40() {this.gpuCanvas = null}
375
- __init41() {this.gpuContext = null}
376
- __init42() {this.mouseX = -9999}
377
- __init43() {this.mouseY = -9999}
378
- __init44() {this.pointerMoveListener = null}
379
- __init45() {this.pointerLeaveListener = null}
380
- __init46() {this.hasWarnedZeroSize = false}
381
- constructor(canvas, options = {}) {;_class2.prototype.__init7.call(this);_class2.prototype.__init8.call(this);_class2.prototype.__init9.call(this);_class2.prototype.__init10.call(this);_class2.prototype.__init11.call(this);_class2.prototype.__init12.call(this);_class2.prototype.__init13.call(this);_class2.prototype.__init14.call(this);_class2.prototype.__init15.call(this);_class2.prototype.__init16.call(this);_class2.prototype.__init17.call(this);_class2.prototype.__init18.call(this);_class2.prototype.__init19.call(this);_class2.prototype.__init20.call(this);_class2.prototype.__init21.call(this);_class2.prototype.__init22.call(this);_class2.prototype.__init23.call(this);_class2.prototype.__init24.call(this);_class2.prototype.__init25.call(this);_class2.prototype.__init26.call(this);_class2.prototype.__init27.call(this);_class2.prototype.__init28.call(this);_class2.prototype.__init29.call(this);_class2.prototype.__init30.call(this);_class2.prototype.__init31.call(this);_class2.prototype.__init32.call(this);_class2.prototype.__init33.call(this);_class2.prototype.__init34.call(this);_class2.prototype.__init35.call(this);_class2.prototype.__init36.call(this);_class2.prototype.__init37.call(this);_class2.prototype.__init38.call(this);_class2.prototype.__init39.call(this);_class2.prototype.__init40.call(this);_class2.prototype.__init41.call(this);_class2.prototype.__init42.call(this);_class2.prototype.__init43.call(this);_class2.prototype.__init44.call(this);_class2.prototype.__init45.call(this);_class2.prototype.__init46.call(this);
382
+ __init38() {this.recoveryTimerId = null}
383
+ __init39() {this.manager = null}
384
+ __init40() {this.initializingWebGPU = false}
385
+ __init41() {this.gpuCanvas = null}
386
+ __init42() {this.gpuContext = null}
387
+ __init43() {this.mouseX = -9999}
388
+ __init44() {this.mouseY = -9999}
389
+ __init45() {this.pointerMoveListener = null}
390
+ __init46() {this.pointerLeaveListener = null}
391
+ __init47() {this.hasWarnedZeroSize = false}
392
+ constructor(canvas, options = {}) {;_class2.prototype.__init7.call(this);_class2.prototype.__init8.call(this);_class2.prototype.__init9.call(this);_class2.prototype.__init10.call(this);_class2.prototype.__init11.call(this);_class2.prototype.__init12.call(this);_class2.prototype.__init13.call(this);_class2.prototype.__init14.call(this);_class2.prototype.__init15.call(this);_class2.prototype.__init16.call(this);_class2.prototype.__init17.call(this);_class2.prototype.__init18.call(this);_class2.prototype.__init19.call(this);_class2.prototype.__init20.call(this);_class2.prototype.__init21.call(this);_class2.prototype.__init22.call(this);_class2.prototype.__init23.call(this);_class2.prototype.__init24.call(this);_class2.prototype.__init25.call(this);_class2.prototype.__init26.call(this);_class2.prototype.__init27.call(this);_class2.prototype.__init28.call(this);_class2.prototype.__init29.call(this);_class2.prototype.__init30.call(this);_class2.prototype.__init31.call(this);_class2.prototype.__init32.call(this);_class2.prototype.__init33.call(this);_class2.prototype.__init34.call(this);_class2.prototype.__init35.call(this);_class2.prototype.__init36.call(this);_class2.prototype.__init37.call(this);_class2.prototype.__init38.call(this);_class2.prototype.__init39.call(this);_class2.prototype.__init40.call(this);_class2.prototype.__init41.call(this);_class2.prototype.__init42.call(this);_class2.prototype.__init43.call(this);_class2.prototype.__init44.call(this);_class2.prototype.__init45.call(this);_class2.prototype.__init46.call(this);_class2.prototype.__init47.call(this);
382
393
  this.canvas = canvas;
383
394
  this.debugA11y = _nullishCoalesce(options.debugA11y, () => ( false));
384
395
  this.disableWindowResize = _nullishCoalesce(options.disableWindowResize, () => ( false));
@@ -390,13 +401,14 @@ var Scene = (_class2 = class _Scene {
390
401
  this.height = typeof window !== "undefined" ? window.innerHeight : canvas.clientHeight || canvas.height || 600;
391
402
  }
392
403
  const globalProcess = typeof globalThis !== "undefined" ? globalThis.process : void 0;
393
- const isTest = globalProcess && (_optionalChain([globalProcess, 'access', _13 => _13.env, 'optionalAccess', _14 => _14.NODE_ENV]) === "test" || _optionalChain([globalProcess, 'access', _15 => _15.env, 'optionalAccess', _16 => _16.VITEST]) === "true");
404
+ const isTest = globalProcess && (_optionalChain([globalProcess, 'access', _15 => _15.env, 'optionalAccess', _16 => _16.NODE_ENV]) === "test" || _optionalChain([globalProcess, 'access', _17 => _17.env, 'optionalAccess', _18 => _18.VITEST]) === "true");
394
405
  this.maxFPS = _nullishCoalesce(options.maxFPS, () => ( (isTest ? 0 : 60)));
395
406
  this.respectReducedMotion = _nullishCoalesce(options.respectReducedMotion, () => ( true));
407
+ this.autoThrottle = _nullishCoalesce(options.autoThrottle, () => ( true));
396
408
  this.particleBackend = _nullishCoalesce(options.particleBackend, () => ( "auto"));
397
409
  this.a11ySyncInterval = _nullishCoalesce(options.a11ySyncInterval, () => ( 0));
398
410
  this.reducedMotionQuery = typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia("(prefers-reduced-motion: reduce)") : null;
399
- this.root = new class RootEntity extends _chunk53DAQC3Ujs.Entity {
411
+ this.root = new class RootEntity extends _chunkLA3FJLP2js.Entity {
400
412
  isPointInside() {
401
413
  return false;
402
414
  }
@@ -405,7 +417,7 @@ var Scene = (_class2 = class _Scene {
405
417
  }
406
418
  }("root");
407
419
  this.root._scene = this;
408
- this.overlayRoot = new class OverlayRoot extends _chunk53DAQC3Ujs.Entity {
420
+ this.overlayRoot = new class OverlayRoot extends _chunkLA3FJLP2js.Entity {
409
421
  isPointInside() {
410
422
  return false;
411
423
  }
@@ -568,12 +580,12 @@ var Scene = (_class2 = class _Scene {
568
580
  this.canvas.removeEventListener("pointerleave", this.pointerLeaveListener);
569
581
  }
570
582
  }
571
- _optionalChain([this, 'access', _17 => _17.a11yRoot, 'optionalAccess', _18 => _18.remove, 'call', _19 => _19()]);
572
- _optionalChain([this, 'access', _20 => _20.portalRoot, 'optionalAccess', _21 => _21.remove, 'call', _22 => _22()]);
583
+ _optionalChain([this, 'access', _19 => _19.a11yRoot, 'optionalAccess', _20 => _20.remove, 'call', _21 => _21()]);
584
+ _optionalChain([this, 'access', _22 => _22.portalRoot, 'optionalAccess', _23 => _23.remove, 'call', _24 => _24()]);
573
585
  this.a11yElements.clear();
574
- _optionalChain([this, 'access', _23 => _23.pointRenderer, 'optionalAccess', _24 => _24.destroy, 'call', _25 => _25()]);
575
- _optionalChain([this, 'access', _26 => _26.glCanvas, 'optionalAccess', _27 => _27.remove, 'call', _28 => _28()]);
576
- _optionalChain([this, 'access', _29 => _29.gpuCanvas, 'optionalAccess', _30 => _30.remove, 'call', _31 => _31()]);
586
+ _optionalChain([this, 'access', _25 => _25.pointRenderer, 'optionalAccess', _26 => _26.destroy, 'call', _27 => _27()]);
587
+ _optionalChain([this, 'access', _28 => _28.glCanvas, 'optionalAccess', _29 => _29.remove, 'call', _30 => _30()]);
588
+ _optionalChain([this, 'access', _31 => _31.gpuCanvas, 'optionalAccess', _32 => _32.remove, 'call', _33 => _33()]);
577
589
  this.gpuCanvas = null;
578
590
  this.gpuContext = null;
579
591
  if (this.recoveryTimerId) {
@@ -713,42 +725,42 @@ var Scene = (_class2 = class _Scene {
713
725
  el.style.background = "transparent";
714
726
  }
715
727
  el.addEventListener("click", (e) => {
716
- node.dispatchEvent(new (0, _chunk53DAQC3Ujs.VectoJSEvent)("click", node, e));
728
+ node.dispatchEvent(new (0, _chunkLA3FJLP2js.VectoJSEvent)("click", node, e));
717
729
  });
718
730
  el.addEventListener("mouseenter", (e) => {
719
731
  if (this.debugA11y) el.style.backgroundColor = "rgba(56, 189, 248, 0.2)";
720
- node.dispatchEvent(new (0, _chunk53DAQC3Ujs.VectoJSEvent)("hover", node, e, false));
732
+ node.dispatchEvent(new (0, _chunkLA3FJLP2js.VectoJSEvent)("hover", node, e, false));
721
733
  });
722
734
  el.addEventListener("mouseleave", (e) => {
723
735
  if (this.debugA11y) el.style.backgroundColor = "rgba(56, 189, 248, 0.05)";
724
- node.dispatchEvent(new (0, _chunk53DAQC3Ujs.VectoJSEvent)("pointerleave", node, e, false));
736
+ node.dispatchEvent(new (0, _chunkLA3FJLP2js.VectoJSEvent)("pointerleave", node, e, false));
725
737
  });
726
738
  const capEl = el;
727
739
  el.addEventListener("pointerdown", (e) => {
728
740
  if (typeof capEl.setPointerCapture === "function") capEl.setPointerCapture(e.pointerId);
729
- node.dispatchEvent(new (0, _chunk53DAQC3Ujs.VectoJSEvent)("pointerdown", node, e));
741
+ node.dispatchEvent(new (0, _chunkLA3FJLP2js.VectoJSEvent)("pointerdown", node, e));
730
742
  });
731
743
  el.addEventListener("pointerup", (e) => {
732
744
  if (typeof capEl.releasePointerCapture === "function")
733
745
  capEl.releasePointerCapture(e.pointerId);
734
- node.dispatchEvent(new (0, _chunk53DAQC3Ujs.VectoJSEvent)("pointerup", node, e));
746
+ node.dispatchEvent(new (0, _chunkLA3FJLP2js.VectoJSEvent)("pointerup", node, e));
735
747
  });
736
748
  el.addEventListener(
737
749
  "pointermove",
738
- (e) => node.dispatchEvent(new (0, _chunk53DAQC3Ujs.VectoJSEvent)("pointermove", node, e))
750
+ (e) => node.dispatchEvent(new (0, _chunkLA3FJLP2js.VectoJSEvent)("pointermove", node, e))
739
751
  );
740
752
  el.addEventListener(
741
753
  "wheel",
742
754
  (e) => {
743
- node.dispatchEvent(new (0, _chunk53DAQC3Ujs.VectoJSEvent)("wheel", node, e));
755
+ node.dispatchEvent(new (0, _chunkLA3FJLP2js.VectoJSEvent)("wheel", node, e));
744
756
  },
745
757
  { passive: false }
746
758
  );
747
759
  el.addEventListener("keydown", (e) => {
748
- node.dispatchEvent(new (0, _chunk53DAQC3Ujs.VectoJSEvent)("keydown", node, e));
760
+ node.dispatchEvent(new (0, _chunkLA3FJLP2js.VectoJSEvent)("keydown", node, e));
749
761
  });
750
762
  el.addEventListener("keyup", (e) => {
751
- node.dispatchEvent(new (0, _chunk53DAQC3Ujs.VectoJSEvent)("keyup", node, e));
763
+ node.dispatchEvent(new (0, _chunkLA3FJLP2js.VectoJSEvent)("keyup", node, e));
752
764
  });
753
765
  if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {
754
766
  const input = el;
@@ -774,7 +786,7 @@ var Scene = (_class2 = class _Scene {
774
786
  });
775
787
  el.addEventListener("compositionupdate", (e) => {
776
788
  const data = _nullishCoalesce(e.data, () => ( ""));
777
- composition = { start: _nullishCoalesce(_optionalChain([composition, 'optionalAccess', _32 => _32.start]), () => ( 0)), length: data.length };
789
+ composition = { start: _nullishCoalesce(_optionalChain([composition, 'optionalAccess', _34 => _34.start]), () => ( 0)), length: data.length };
778
790
  forward();
779
791
  });
780
792
  el.addEventListener("compositionend", () => {
@@ -820,7 +832,7 @@ var Scene = (_class2 = class _Scene {
820
832
  el.addEventListener("keydown", (e) => {
821
833
  if (e.key === "Enter" || e.key === " ") {
822
834
  e.preventDefault();
823
- node.dispatchEvent(new (0, _chunk53DAQC3Ujs.VectoJSEvent)("click", node, e));
835
+ node.dispatchEvent(new (0, _chunkLA3FJLP2js.VectoJSEvent)("click", node, e));
824
836
  }
825
837
  });
826
838
  }
@@ -1073,7 +1085,7 @@ var Scene = (_class2 = class _Scene {
1073
1085
  * (and {@link respectReducedMotion} is on). `0` means uncapped.
1074
1086
  */
1075
1087
  effectiveMaxFPS() {
1076
- const reduced = this.respectReducedMotion && !!_optionalChain([this, 'access', _33 => _33.reducedMotionQuery, 'optionalAccess', _34 => _34.matches]);
1088
+ const reduced = this.respectReducedMotion && !!_optionalChain([this, 'access', _35 => _35.reducedMotionQuery, 'optionalAccess', _36 => _36.matches]);
1077
1089
  if (reduced)
1078
1090
  return this.maxFPS > 0 ? Math.min(this.maxFPS, REDUCED_MOTION_FPS) : REDUCED_MOTION_FPS;
1079
1091
  return this.maxFPS;
@@ -1081,7 +1093,7 @@ var Scene = (_class2 = class _Scene {
1081
1093
  loop(time) {
1082
1094
  if (!this.isRunning) return;
1083
1095
  let cap = this.effectiveMaxFPS();
1084
- const isStatic = !this.dirty && !this.hasAnyPendingAnimation(this.root) && !this.hasAnyPendingAnimation(this.overlayRoot);
1096
+ const isStatic = this.autoThrottle && !this.dirty && !this.hasAnyPendingAnimation(this.root) && !this.hasAnyPendingAnimation(this.overlayRoot);
1085
1097
  if (isStatic && this.renderMode === "always" && this.maxFPS > 0) {
1086
1098
  cap = Math.min(cap, 2);
1087
1099
  }
@@ -1229,7 +1241,7 @@ var Scene = (_class2 = class _Scene {
1229
1241
  renderer.clear();
1230
1242
  const isMainRenderer = renderer === this.renderer;
1231
1243
  if (isMainRenderer) {
1232
- _optionalChain([this, 'access', _35 => _35.pointRenderer, 'optionalAccess', _36 => _36.begin, 'call', _37 => _37()]);
1244
+ _optionalChain([this, 'access', _37 => _37.pointRenderer, 'optionalAccess', _38 => _38.begin, 'call', _39 => _39()]);
1233
1245
  }
1234
1246
  const vw = this.width;
1235
1247
  const vh = this.height;
@@ -1343,7 +1355,7 @@ var Scene = (_class2 = class _Scene {
1343
1355
  this.reconcilePortals();
1344
1356
  renderer.flush();
1345
1357
  if (isMainRenderer) {
1346
- _optionalChain([this, 'access', _38 => _38.pointRenderer, 'optionalAccess', _39 => _39.flush, 'call', _40 => _40()]);
1358
+ _optionalChain([this, 'access', _40 => _40.pointRenderer, 'optionalAccess', _41 => _41.flush, 'call', _42 => _42()]);
1347
1359
  }
1348
1360
  }
1349
1361
  /**
@@ -1363,7 +1375,7 @@ var Scene = (_class2 = class _Scene {
1363
1375
  if (typeof this.renderer.resize === "function") {
1364
1376
  this.renderer.resize(width, height);
1365
1377
  }
1366
- _optionalChain([this, 'access', _41 => _41.pointRenderer, 'optionalAccess', _42 => _42.resize, 'call', _43 => _43(width, height)]);
1378
+ _optionalChain([this, 'access', _43 => _43.pointRenderer, 'optionalAccess', _44 => _44.resize, 'call', _45 => _45(width, height)]);
1367
1379
  this.markDirty();
1368
1380
  }
1369
1381
  /**
@@ -1514,20 +1526,20 @@ function defaultMeasurer() {
1514
1526
  if (sharedMeasurer === void 0) sharedMeasurer = _chunk72WVPMSJjs.createCanvasMeasurer.call(void 0, "sans-serif");
1515
1527
  return sharedMeasurer;
1516
1528
  }
1517
- var TextEntity = (_class3 = class extends _chunk53DAQC3Ujs.Entity {
1529
+ var TextEntity = (_class3 = class extends _chunkLA3FJLP2js.Entity {
1518
1530
 
1519
1531
 
1520
1532
 
1521
1533
 
1522
- __init47() {this.nodes = []}
1534
+ __init48() {this.nodes = []}
1523
1535
 
1524
- __init48() {this.fillStyle = "#94a3b8"}
1525
- __init49() {this.strokeStyle = null}
1526
- __init50() {this.hoveredFillStyle = "#ffffff"}
1527
- __init51() {this.lineWidth = 1}
1528
- __init52() {this.isHovered = false}
1536
+ __init49() {this.fillStyle = "#94a3b8"}
1537
+ __init50() {this.strokeStyle = null}
1538
+ __init51() {this.hoveredFillStyle = "#ffffff"}
1539
+ __init52() {this.lineWidth = 1}
1540
+ __init53() {this.isHovered = false}
1529
1541
  constructor(text, atlas, maxWidth, fontSize = 24) {
1530
- super();_class3.prototype.__init47.call(this);_class3.prototype.__init48.call(this);_class3.prototype.__init49.call(this);_class3.prototype.__init50.call(this);_class3.prototype.__init51.call(this);_class3.prototype.__init52.call(this);;
1542
+ super();_class3.prototype.__init48.call(this);_class3.prototype.__init49.call(this);_class3.prototype.__init50.call(this);_class3.prototype.__init51.call(this);_class3.prototype.__init52.call(this);_class3.prototype.__init53.call(this);;
1531
1543
  this.text = text;
1532
1544
  this.atlas = atlas;
1533
1545
  this.fontSize = fontSize;
@@ -1613,17 +1625,17 @@ var TextEntity = (_class3 = class extends _chunk53DAQC3Ujs.Entity {
1613
1625
  }, _class3);
1614
1626
 
1615
1627
  // src/components/GridTextEntity.ts
1616
- var GridTextEntity = (_class4 = class extends _chunk53DAQC3Ujs.Entity {
1628
+ var GridTextEntity = (_class4 = class extends _chunkLA3FJLP2js.Entity {
1617
1629
 
1618
- __init53() {this.fillStyle = "#ffffff"}
1619
- __init54() {this.grid = []}
1630
+ __init54() {this.fillStyle = "#ffffff"}
1631
+ __init55() {this.grid = []}
1620
1632
  // Array of rows
1621
- __init55() {this.cols = 0}
1622
- __init56() {this.rows = 0}
1633
+ __init56() {this.cols = 0}
1634
+ __init57() {this.rows = 0}
1623
1635
 
1624
1636
 
1625
1637
  constructor(_atlas, fontSize = 10) {
1626
- super();_class4.prototype.__init53.call(this);_class4.prototype.__init54.call(this);_class4.prototype.__init55.call(this);_class4.prototype.__init56.call(this);;
1638
+ super();_class4.prototype.__init54.call(this);_class4.prototype.__init55.call(this);_class4.prototype.__init56.call(this);_class4.prototype.__init57.call(this);;
1627
1639
  this.fontSize = fontSize;
1628
1640
  this.charWidth = fontSize * 1;
1629
1641
  this.charHeight = fontSize * 1.1;
@@ -1632,7 +1644,7 @@ var GridTextEntity = (_class4 = class extends _chunk53DAQC3Ujs.Entity {
1632
1644
  updateGrid(ascii) {
1633
1645
  this.grid = ascii;
1634
1646
  this.rows = ascii.length;
1635
- this.cols = _optionalChain([ascii, 'access', _44 => _44[0], 'optionalAccess', _45 => _45.length]) || 0;
1647
+ this.cols = _optionalChain([ascii, 'access', _46 => _46[0], 'optionalAccess', _47 => _47.length]) || 0;
1636
1648
  }
1637
1649
  isPointInside(_globalX, _globalY) {
1638
1650
  return false;
@@ -1707,7 +1719,7 @@ function distSqToSegment(px, py, x1, y1, x2, y2) {
1707
1719
  const ey = py - cy;
1708
1720
  return ex * ex + ey * ey;
1709
1721
  }
1710
- var SplineEntity = (_class5 = class extends _chunk53DAQC3Ujs.Entity {
1722
+ var SplineEntity = (_class5 = class extends _chunkLA3FJLP2js.Entity {
1711
1723
 
1712
1724
 
1713
1725
 
@@ -1715,18 +1727,18 @@ var SplineEntity = (_class5 = class extends _chunk53DAQC3Ujs.Entity {
1715
1727
 
1716
1728
 
1717
1729
 
1718
- __init57() {this.offscreen = null}
1719
- __init58() {this.baked = false}
1730
+ __init58() {this.offscreen = null}
1731
+ __init59() {this.baked = false}
1720
1732
  /** Lazily-flattened polylines (one Float32Array of [x,y,...] per segment) for hit-testing. */
1721
- __init59() {this.polylines = null}
1733
+ __init60() {this.polylines = null}
1722
1734
  /**
1723
1735
  * When `true`, the renderer draws a rounded-rect outline of the entity's
1724
1736
  * local bounds after painting the curves. Useful for drag feedback and
1725
1737
  * debugging hit areas. Defaults to `false`.
1726
1738
  */
1727
- __init60() {this.showBounds = false}
1739
+ __init61() {this.showBounds = false}
1728
1740
  constructor(doc, opts = {}) {
1729
- super();_class5.prototype.__init57.call(this);_class5.prototype.__init58.call(this);_class5.prototype.__init59.call(this);_class5.prototype.__init60.call(this);;
1741
+ super();_class5.prototype.__init58.call(this);_class5.prototype.__init59.call(this);_class5.prototype.__init60.call(this);_class5.prototype.__init61.call(this);;
1730
1742
  this.doc = doc;
1731
1743
  this.lineWidth = _nullishCoalesce(opts.lineWidth, () => ( 2));
1732
1744
  this.cache = _nullishCoalesce(opts.cache, () => ( true));
@@ -1973,9 +1985,9 @@ async function loadSpline(url) {
1973
1985
  // src/math/SpatialHashGrid.ts
1974
1986
  var SpatialHashGrid = (_class6 = class {
1975
1987
 
1976
- __init61() {this.grid = /* @__PURE__ */ new Map()}
1977
- __init62() {this.entityCells = /* @__PURE__ */ new Map()}
1978
- constructor(cellSize = 64) {;_class6.prototype.__init61.call(this);_class6.prototype.__init62.call(this);
1988
+ __init62() {this.grid = /* @__PURE__ */ new Map()}
1989
+ __init63() {this.entityCells = /* @__PURE__ */ new Map()}
1990
+ constructor(cellSize = 64) {;_class6.prototype.__init62.call(this);_class6.prototype.__init63.call(this);
1979
1991
  this.cellSize = cellSize;
1980
1992
  }
1981
1993
  hash(cx, cy) {
@@ -2029,7 +2041,7 @@ var SpatialHashGrid = (_class6 = class {
2029
2041
  const keys = this.entityCells.get(id);
2030
2042
  if (!keys) return;
2031
2043
  for (const key of keys) {
2032
- _optionalChain([this, 'access', _46 => _46.grid, 'access', _47 => _47.get, 'call', _48 => _48(key), 'optionalAccess', _49 => _49.delete, 'call', _50 => _50(id)]);
2044
+ _optionalChain([this, 'access', _48 => _48.grid, 'access', _49 => _49.get, 'call', _50 => _50(key), 'optionalAccess', _51 => _51.delete, 'call', _52 => _52(id)]);
2033
2045
  }
2034
2046
  this.entityCells.delete(id);
2035
2047
  }
@@ -2064,51 +2076,20 @@ var SpatialHashGrid = (_class6 = class {
2064
2076
  }
2065
2077
  }, _class6);
2066
2078
 
2067
- // src/math/SpringPhysics.ts
2068
- var SpringPhysics = (_class7 = class {
2069
-
2070
-
2071
- __init63() {this.velocity = 0}
2072
- __init64() {this.stiffness = 180}
2073
- __init65() {this.damping = 12}
2074
- __init66() {this.mass = 1}
2075
- __init67() {this.valEpsilon = 5e-3}
2076
- __init68() {this.velEpsilon = 5e-3}
2077
- constructor(initial) {;_class7.prototype.__init63.call(this);_class7.prototype.__init64.call(this);_class7.prototype.__init65.call(this);_class7.prototype.__init66.call(this);_class7.prototype.__init67.call(this);_class7.prototype.__init68.call(this);
2078
- this.value = initial;
2079
- this.target = initial;
2080
- }
2081
- update(dt) {
2082
- if (this.isAtRest()) {
2083
- this.value = this.target;
2084
- this.velocity = 0;
2085
- return;
2086
- }
2087
- const forceSpring = -this.stiffness * (this.value - this.target);
2088
- const forceDamping = -this.damping * this.velocity;
2089
- const acceleration = (forceSpring + forceDamping) / this.mass;
2090
- this.velocity += acceleration * dt;
2091
- this.value += this.velocity * dt;
2092
- }
2093
- isAtRest() {
2094
- return Math.abs(this.value - this.target) < this.valEpsilon && Math.abs(this.velocity) < this.velEpsilon;
2095
- }
2096
- }, _class7);
2097
-
2098
2079
  // src/tree/DOMPortalEntity.ts
2099
- var DOMPortalEntity = (_class8 = class extends _chunk53DAQC3Ujs.Entity {
2080
+ var DOMPortalEntity = (_class7 = class extends _chunkLA3FJLP2js.Entity {
2100
2081
 
2101
- __init69() {this.isDOMPortal = true}
2102
- __init70() {this.domListeners = []}
2103
- __init71() {this.resizeObserver = null}
2104
- __init72() {this.cachedWidth = 100}
2105
- __init73() {this.cachedHeight = 100}
2106
- __init74() {this.lastWidth = ""}
2107
- __init75() {this.lastHeight = ""}
2108
- __init76() {this.lastTransform = ""}
2109
- __init77() {this.lastZIndex = ""}
2082
+ __init64() {this.isDOMPortal = true}
2083
+ __init65() {this.domListeners = []}
2084
+ __init66() {this.resizeObserver = null}
2085
+ __init67() {this.cachedWidth = 100}
2086
+ __init68() {this.cachedHeight = 100}
2087
+ __init69() {this.lastWidth = ""}
2088
+ __init70() {this.lastHeight = ""}
2089
+ __init71() {this.lastTransform = ""}
2090
+ __init72() {this.lastZIndex = ""}
2110
2091
  constructor(domElement, width, height, id) {
2111
- super(id);_class8.prototype.__init69.call(this);_class8.prototype.__init70.call(this);_class8.prototype.__init71.call(this);_class8.prototype.__init72.call(this);_class8.prototype.__init73.call(this);_class8.prototype.__init74.call(this);_class8.prototype.__init75.call(this);_class8.prototype.__init76.call(this);_class8.prototype.__init77.call(this);;
2092
+ super(id);_class7.prototype.__init64.call(this);_class7.prototype.__init65.call(this);_class7.prototype.__init66.call(this);_class7.prototype.__init67.call(this);_class7.prototype.__init68.call(this);_class7.prototype.__init69.call(this);_class7.prototype.__init70.call(this);_class7.prototype.__init71.call(this);_class7.prototype.__init72.call(this);;
2112
2093
  this.domElement = domElement;
2113
2094
  this.width = _nullishCoalesce(width, () => ( 0));
2114
2095
  this.height = _nullishCoalesce(height, () => ( 0));
@@ -2130,7 +2111,7 @@ var DOMPortalEntity = (_class8 = class extends _chunk53DAQC3Ujs.Entity {
2130
2111
  const events = ["click", "pointerdown", "pointerup", "pointermove", "wheel"];
2131
2112
  for (const type of events) {
2132
2113
  const handler = (e) => {
2133
- this.dispatchEvent(new (0, _chunk53DAQC3Ujs.VectoJSEvent)(type, this, e));
2114
+ this.dispatchEvent(new (0, _chunkLA3FJLP2js.VectoJSEvent)(type, this, e));
2134
2115
  };
2135
2116
  this.domElement.addEventListener(type, handler);
2136
2117
  this.domListeners.push({ type, handler, capture: false });
@@ -2141,7 +2122,7 @@ var DOMPortalEntity = (_class8 = class extends _chunk53DAQC3Ujs.Entity {
2141
2122
  ];
2142
2123
  for (const { native, vecto } of hoverEvents) {
2143
2124
  const handler = (e) => {
2144
- this.dispatchEvent(new (0, _chunk53DAQC3Ujs.VectoJSEvent)(vecto, this, e, false));
2125
+ this.dispatchEvent(new (0, _chunkLA3FJLP2js.VectoJSEvent)(vecto, this, e, false));
2145
2126
  };
2146
2127
  this.domElement.addEventListener(native, handler);
2147
2128
  this.domListeners.push({ type: native, handler, capture: false });
@@ -2149,7 +2130,7 @@ var DOMPortalEntity = (_class8 = class extends _chunk53DAQC3Ujs.Entity {
2149
2130
  const focusEvents = ["focus", "blur"];
2150
2131
  for (const type of focusEvents) {
2151
2132
  const handler = (e) => {
2152
- this.dispatchEvent(new (0, _chunk53DAQC3Ujs.VectoJSEvent)(type, this, e, true));
2133
+ this.dispatchEvent(new (0, _chunkLA3FJLP2js.VectoJSEvent)(type, this, e, true));
2153
2134
  };
2154
2135
  this.domElement.addEventListener(type, handler, true);
2155
2136
  this.domListeners.push({ type, handler, capture: true });
@@ -2192,7 +2173,7 @@ var DOMPortalEntity = (_class8 = class extends _chunk53DAQC3Ujs.Entity {
2192
2173
  }
2193
2174
  super.destroy();
2194
2175
  }
2195
- }, _class8);
2176
+ }, _class7);
2196
2177
 
2197
2178
  // src/index.ts
2198
2179
  Scene.registerWebGLPointRendererCreator(_chunkLIX7DJTIjs.createWebGLPointRenderer);
@@ -2235,4 +2216,8 @@ Scene.registerWebGPUParticleSystemManager(_chunkLIX7DJTIjs.WebGPUParticleSystemM
2235
2216
 
2236
2217
 
2237
2218
 
2238
- exports.ArabicShaper = _chunkRW6NC4RBjs.ArabicShaper; exports.BidiResolver = _chunkRW6NC4RBjs.BidiResolver; exports.CanvasRenderer = _chunkLIX7DJTIjs.CanvasRenderer; exports.ComputeParticleEntity = ComputeParticleEntity; exports.DOMPortalEntity = DOMPortalEntity; exports.Entity = _chunk53DAQC3Ujs.Entity; exports.GridTextEntity = GridTextEntity; exports.LayoutEngine = _chunk72WVPMSJjs.LayoutEngine; exports.LayoutResultBuffer = _chunk72WVPMSJjs.LayoutResultBuffer; exports.LayoutWorkerManager = _chunkRW6NC4RBjs.LayoutWorkerManager; exports.MSDFFont = _chunk53DAQC3Ujs.MSDFFont; exports.MSDFTextEntity = _chunk53DAQC3Ujs.MSDFTextEntity; exports.PARTICLE_OFFSET_LIFE = PARTICLE_OFFSET_LIFE; exports.PARTICLE_OFFSET_ORIGIN_X = PARTICLE_OFFSET_ORIGIN_X; exports.PARTICLE_OFFSET_ORIGIN_Y = PARTICLE_OFFSET_ORIGIN_Y; exports.PARTICLE_OFFSET_POSITION_X = PARTICLE_OFFSET_POSITION_X; exports.PARTICLE_OFFSET_POSITION_Y = PARTICLE_OFFSET_POSITION_Y; exports.PARTICLE_OFFSET_SIZE = PARTICLE_OFFSET_SIZE; exports.PARTICLE_OFFSET_VELOCITY_X = PARTICLE_OFFSET_VELOCITY_X; exports.PARTICLE_OFFSET_VELOCITY_Y = PARTICLE_OFFSET_VELOCITY_Y; exports.PARTICLE_STRIDE_FLOATS = PARTICLE_STRIDE_FLOATS; exports.REDUCED_MOTION_FPS = REDUCED_MOTION_FPS; exports.SVGEntity = _chunk53DAQC3Ujs.SVGEntity; exports.SVGRenderer = _chunkLIX7DJTIjs.SVGRenderer; exports.Scene = Scene; exports.SpatialHashGrid = SpatialHashGrid; exports.SplineEntity = SplineEntity; exports.SpringPhysics = SpringPhysics; exports.TextEntity = TextEntity; exports.VectoJSEvent = _chunk53DAQC3Ujs.VectoJSEvent; exports.WebGPUParticleSystemManager = _chunkLIX7DJTIjs.WebGPUParticleSystemManager; exports.computeLineSegments = _chunk72WVPMSJjs.computeLineSegments; exports.createCanvasMeasurer = _chunk72WVPMSJjs.createCanvasMeasurer; exports.createWebGLPointRenderer = _chunkLIX7DJTIjs.createWebGLPointRenderer; exports.loadSpline = loadSpline; exports.parseColorToRGBA = _chunkLIX7DJTIjs.parseColorToRGBA; exports.polySegmentToBezier = polySegmentToBezier;
2219
+
2220
+
2221
+
2222
+
2223
+ exports.ArabicShaper = _chunkRW6NC4RBjs.ArabicShaper; exports.BidiResolver = _chunkRW6NC4RBjs.BidiResolver; exports.CanvasRenderer = _chunkLIX7DJTIjs.CanvasRenderer; exports.ComputeParticleEntity = ComputeParticleEntity; exports.DOMPortalEntity = DOMPortalEntity; exports.Easing = _chunkLA3FJLP2js.Easing; exports.Entity = _chunkLA3FJLP2js.Entity; exports.GridTextEntity = GridTextEntity; exports.LayoutEngine = _chunk72WVPMSJjs.LayoutEngine; exports.LayoutResultBuffer = _chunk72WVPMSJjs.LayoutResultBuffer; exports.LayoutWorkerManager = _chunkRW6NC4RBjs.LayoutWorkerManager; exports.MSDFFont = _chunkLA3FJLP2js.MSDFFont; exports.MSDFTextEntity = _chunkLA3FJLP2js.MSDFTextEntity; exports.PARTICLE_OFFSET_LIFE = PARTICLE_OFFSET_LIFE; exports.PARTICLE_OFFSET_ORIGIN_X = PARTICLE_OFFSET_ORIGIN_X; exports.PARTICLE_OFFSET_ORIGIN_Y = PARTICLE_OFFSET_ORIGIN_Y; exports.PARTICLE_OFFSET_POSITION_X = PARTICLE_OFFSET_POSITION_X; exports.PARTICLE_OFFSET_POSITION_Y = PARTICLE_OFFSET_POSITION_Y; exports.PARTICLE_OFFSET_SIZE = PARTICLE_OFFSET_SIZE; exports.PARTICLE_OFFSET_VELOCITY_X = PARTICLE_OFFSET_VELOCITY_X; exports.PARTICLE_OFFSET_VELOCITY_Y = PARTICLE_OFFSET_VELOCITY_Y; exports.PARTICLE_STRIDE_FLOATS = PARTICLE_STRIDE_FLOATS; exports.REDUCED_MOTION_FPS = REDUCED_MOTION_FPS; exports.SVGEntity = _chunkLA3FJLP2js.SVGEntity; exports.SVGRenderer = _chunkLIX7DJTIjs.SVGRenderer; exports.Scene = Scene; exports.SpatialHashGrid = SpatialHashGrid; exports.SplineEntity = SplineEntity; exports.SpringDriver = _chunkLA3FJLP2js.SpringDriver; exports.SpringPhysics = _chunkLA3FJLP2js.SpringPhysics; exports.TextEntity = TextEntity; exports.TweenDriver = _chunkLA3FJLP2js.TweenDriver; exports.VectoJSEvent = _chunkLA3FJLP2js.VectoJSEvent; exports.WebGPUParticleSystemManager = _chunkLIX7DJTIjs.WebGPUParticleSystemManager; exports.computeLineSegments = _chunk72WVPMSJjs.computeLineSegments; exports.createCanvasMeasurer = _chunk72WVPMSJjs.createCanvasMeasurer; exports.createWebGLPointRenderer = _chunkLIX7DJTIjs.createWebGLPointRenderer; exports.isTweenConfig = _chunkLA3FJLP2js.isTweenConfig; exports.loadSpline = loadSpline; exports.parseColorToRGBA = _chunkLIX7DJTIjs.parseColorToRGBA; exports.polySegmentToBezier = polySegmentToBezier;