@vectojs/core 1.0.0 → 1.3.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.
package/README.md CHANGED
@@ -10,8 +10,8 @@
10
10
  transforms, render scheduling, layout, text flow, spatial hit-testing, event propagation, renderer
11
11
  backends, and the accessibility/automation projection layer.
12
12
 
13
- [Core guide](https://vectojs.xuepoo.xyz/learn/core-scene/) ·
14
- [API reference](https://vectojs.xuepoo.xyz/reference/core-api/) ·
13
+ [Core guide](https://vectojs.org/learn/core-scene/) ·
14
+ [API reference](https://vectojs.org/reference/core-api/) ·
15
15
  [Main repository](https://github.com/vectojs/vectojs)
16
16
 
17
17
  ## Install
@@ -110,7 +110,7 @@ into the VectoJS event system.
110
110
 
111
111
  This projection is intentionally thin. Applications still own accessible names, keyboard behavior,
112
112
  focus order, contrast, and correct control semantics. See the
113
- [accessibility guide](https://vectojs.xuepoo.xyz/learn/accessibility/).
113
+ [accessibility guide](https://vectojs.org/learn/accessibility/).
114
114
 
115
115
  ## Performance model
116
116
 
@@ -408,6 +408,7 @@ var Entity = class {
408
408
  child.parent = null;
409
409
  const s = this.scene;
410
410
  if (s) {
411
+ s.detachA11y(child);
411
412
  s.a11yNeedsReorder = true;
412
413
  s.markDirty();
413
414
  }
@@ -408,6 +408,7 @@ var Entity = (_class4 = class {
408
408
  child.parent = null;
409
409
  const s = this.scene;
410
410
  if (s) {
411
+ s.detachA11y(child);
411
412
  s.a11yNeedsReorder = true;
412
413
  s.markDirty();
413
414
  }
package/dist/index.js CHANGED
@@ -24,7 +24,7 @@ var _chunkBPMNCGU7js = require('./chunk-BPMNCGU7.js');
24
24
 
25
25
 
26
26
 
27
- var _chunkU4UYRERWjs = require('./chunk-U4UYRERW.js');
27
+ var _chunkNHNOKBD4js = require('./chunk-NHNOKBD4.js');
28
28
 
29
29
 
30
30
 
@@ -41,7 +41,7 @@ var PARTICLE_OFFSET_ORIGIN_X = 4;
41
41
  var PARTICLE_OFFSET_ORIGIN_Y = 5;
42
42
  var PARTICLE_OFFSET_SIZE = 6;
43
43
  var PARTICLE_OFFSET_LIFE = 7;
44
- var ComputeParticleEntity = (_class = class extends _chunkU4UYRERWjs.Entity {
44
+ var ComputeParticleEntity = (_class = class extends _chunkNHNOKBD4js.Entity {
45
45
 
46
46
 
47
47
 
@@ -406,7 +406,8 @@ var Scene = (_class2 = class _Scene {
406
406
  __init50() {this.pointerMoveListener = null}
407
407
  __init51() {this.pointerLeaveListener = null}
408
408
  __init52() {this.hasWarnedZeroSize = false}
409
- 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);_class2.prototype.__init48.call(this);_class2.prototype.__init49.call(this);_class2.prototype.__init50.call(this);_class2.prototype.__init51.call(this);_class2.prototype.__init52.call(this);
409
+ __init53() {this.fontLoadHandler = null}
410
+ 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);_class2.prototype.__init48.call(this);_class2.prototype.__init49.call(this);_class2.prototype.__init50.call(this);_class2.prototype.__init51.call(this);_class2.prototype.__init52.call(this);_class2.prototype.__init53.call(this);
410
411
  this.canvas = canvas;
411
412
  this.debugA11y = _nullishCoalesce(options.debugA11y, () => ( false));
412
413
  this.disableWindowResize = _nullishCoalesce(options.disableWindowResize, () => ( false));
@@ -428,7 +429,7 @@ var Scene = (_class2 = class _Scene {
428
429
  this.a11ySyncInterval = _nullishCoalesce(options.a11ySyncInterval, () => ( 0));
429
430
  this.contentProjectionEnabled = _nullishCoalesce(options.contentProjection, () => ( true));
430
431
  this.reducedMotionQuery = typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia("(prefers-reduced-motion: reduce)") : null;
431
- this.root = new class RootEntity extends _chunkU4UYRERWjs.Entity {
432
+ this.root = new class RootEntity extends _chunkNHNOKBD4js.Entity {
432
433
  isPointInside() {
433
434
  return false;
434
435
  }
@@ -437,7 +438,7 @@ var Scene = (_class2 = class _Scene {
437
438
  }
438
439
  }("root");
439
440
  this.root._scene = this;
440
- this.overlayRoot = new class OverlayRoot extends _chunkU4UYRERWjs.Entity {
441
+ this.overlayRoot = new class OverlayRoot extends _chunkNHNOKBD4js.Entity {
441
442
  isPointInside() {
442
443
  return false;
443
444
  }
@@ -502,6 +503,13 @@ var Scene = (_class2 = class _Scene {
502
503
  this.resizeHandler = () => {
503
504
  this.resize(window.innerWidth, window.innerHeight);
504
505
  };
506
+ if (typeof document !== "undefined" && document.fonts) {
507
+ this.fontLoadHandler = () => {
508
+ this.markDirty();
509
+ };
510
+ document.fonts.ready.then(this.fontLoadHandler);
511
+ document.fonts.addEventListener("loadingdone", this.fontLoadHandler);
512
+ }
505
513
  this.setupEvents();
506
514
  }
507
515
  /**
@@ -613,6 +621,9 @@ var Scene = (_class2 = class _Scene {
613
621
  if (this.destroyed) return;
614
622
  this.destroyed = true;
615
623
  this.stop();
624
+ if (typeof document !== "undefined" && document.fonts && this.fontLoadHandler) {
625
+ document.fonts.removeEventListener("loadingdone", this.fontLoadHandler);
626
+ }
616
627
  while (this.root.children.length > 0) this.destroyEntitySubtree(this.root.children.at(-1));
617
628
  while (this.overlayRoot.children.length > 0) {
618
629
  this.destroyEntitySubtree(this.overlayRoot.children.at(-1));
@@ -790,42 +801,42 @@ var Scene = (_class2 = class _Scene {
790
801
  el.style.background = "transparent";
791
802
  }
792
803
  el.addEventListener("click", (e) => {
793
- node.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)("click", node, e));
804
+ node.dispatchEvent(new (0, _chunkNHNOKBD4js.VectoJSEvent)("click", node, e));
794
805
  });
795
806
  el.addEventListener("mouseenter", (e) => {
796
807
  if (this.debugA11y) el.style.backgroundColor = "rgba(56, 189, 248, 0.2)";
797
- node.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)("hover", node, e, false));
808
+ node.dispatchEvent(new (0, _chunkNHNOKBD4js.VectoJSEvent)("hover", node, e, false));
798
809
  });
799
810
  el.addEventListener("mouseleave", (e) => {
800
811
  if (this.debugA11y) el.style.backgroundColor = "rgba(56, 189, 248, 0.05)";
801
- node.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)("pointerleave", node, e, false));
812
+ node.dispatchEvent(new (0, _chunkNHNOKBD4js.VectoJSEvent)("pointerleave", node, e, false));
802
813
  });
803
814
  const capEl = el;
804
815
  el.addEventListener("pointerdown", (e) => {
805
816
  if (typeof capEl.setPointerCapture === "function") capEl.setPointerCapture(e.pointerId);
806
- node.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)("pointerdown", node, e));
817
+ node.dispatchEvent(new (0, _chunkNHNOKBD4js.VectoJSEvent)("pointerdown", node, e));
807
818
  });
808
819
  el.addEventListener("pointerup", (e) => {
809
820
  if (typeof capEl.releasePointerCapture === "function")
810
821
  capEl.releasePointerCapture(e.pointerId);
811
- node.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)("pointerup", node, e));
822
+ node.dispatchEvent(new (0, _chunkNHNOKBD4js.VectoJSEvent)("pointerup", node, e));
812
823
  });
813
824
  el.addEventListener(
814
825
  "pointermove",
815
- (e) => node.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)("pointermove", node, e))
826
+ (e) => node.dispatchEvent(new (0, _chunkNHNOKBD4js.VectoJSEvent)("pointermove", node, e))
816
827
  );
817
828
  el.addEventListener(
818
829
  "wheel",
819
830
  (e) => {
820
- node.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)("wheel", node, e));
831
+ node.dispatchEvent(new (0, _chunkNHNOKBD4js.VectoJSEvent)("wheel", node, e));
821
832
  },
822
833
  { passive: false }
823
834
  );
824
835
  el.addEventListener("keydown", (e) => {
825
- node.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)("keydown", node, e));
836
+ node.dispatchEvent(new (0, _chunkNHNOKBD4js.VectoJSEvent)("keydown", node, e));
826
837
  });
827
838
  el.addEventListener("keyup", (e) => {
828
- node.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)("keyup", node, e));
839
+ node.dispatchEvent(new (0, _chunkNHNOKBD4js.VectoJSEvent)("keyup", node, e));
829
840
  });
830
841
  if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {
831
842
  const input = el;
@@ -898,7 +909,7 @@ var Scene = (_class2 = class _Scene {
898
909
  el.addEventListener("keydown", (e) => {
899
910
  if (e.key === "Enter" || e.key === " ") {
900
911
  e.preventDefault();
901
- node.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)("click", node, e));
912
+ node.dispatchEvent(new (0, _chunkNHNOKBD4js.VectoJSEvent)("click", node, e));
902
913
  }
903
914
  });
904
915
  }
@@ -925,6 +936,9 @@ var Scene = (_class2 = class _Scene {
925
936
  if (attrs.href !== void 0 && el instanceof HTMLAnchorElement) {
926
937
  const safeHref = _chunkBPMNCGU7js.sanitizeUrl.call(void 0, attrs.href);
927
938
  if (el.getAttribute("href") !== safeHref) el.setAttribute("href", safeHref);
939
+ if (attrs.target !== void 0 && el.getAttribute("target") !== attrs.target) {
940
+ el.setAttribute("target", attrs.target);
941
+ }
928
942
  }
929
943
  if (el instanceof HTMLImageElement) {
930
944
  if (attrs.src !== void 0 && el.src !== attrs.src) el.src = attrs.src;
@@ -1032,7 +1046,7 @@ var Scene = (_class2 = class _Scene {
1032
1046
  el.addEventListener(
1033
1047
  "wheel",
1034
1048
  (e2) => {
1035
- node.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)("wheel", node, e2));
1049
+ node.dispatchEvent(new (0, _chunkNHNOKBD4js.VectoJSEvent)("wheel", node, e2));
1036
1050
  },
1037
1051
  { passive: false }
1038
1052
  );
@@ -1792,20 +1806,20 @@ function defaultMeasurer() {
1792
1806
  if (sharedMeasurer === void 0) sharedMeasurer = _chunkXLZDOFSBjs.createCanvasMeasurer.call(void 0, "sans-serif");
1793
1807
  return sharedMeasurer;
1794
1808
  }
1795
- var TextEntity = (_class3 = class extends _chunkU4UYRERWjs.Entity {
1809
+ var TextEntity = (_class3 = class extends _chunkNHNOKBD4js.Entity {
1796
1810
 
1797
1811
 
1798
1812
 
1799
1813
 
1800
- __init53() {this.nodes = []}
1814
+ __init54() {this.nodes = []}
1801
1815
 
1802
- __init54() {this.fillStyle = "#94a3b8"}
1803
- __init55() {this.strokeStyle = null}
1804
- __init56() {this.hoveredFillStyle = "#ffffff"}
1805
- __init57() {this.lineWidth = 1}
1806
- __init58() {this.isHovered = false}
1816
+ __init55() {this.fillStyle = "#94a3b8"}
1817
+ __init56() {this.strokeStyle = null}
1818
+ __init57() {this.hoveredFillStyle = "#ffffff"}
1819
+ __init58() {this.lineWidth = 1}
1820
+ __init59() {this.isHovered = false}
1807
1821
  constructor(text, atlas, maxWidth, fontSize = 24) {
1808
- super();_class3.prototype.__init53.call(this);_class3.prototype.__init54.call(this);_class3.prototype.__init55.call(this);_class3.prototype.__init56.call(this);_class3.prototype.__init57.call(this);_class3.prototype.__init58.call(this);;
1822
+ super();_class3.prototype.__init54.call(this);_class3.prototype.__init55.call(this);_class3.prototype.__init56.call(this);_class3.prototype.__init57.call(this);_class3.prototype.__init58.call(this);_class3.prototype.__init59.call(this);;
1809
1823
  this.text = text;
1810
1824
  this.atlas = atlas;
1811
1825
  this.fontSize = fontSize;
@@ -1918,17 +1932,17 @@ var TextEntity = (_class3 = class extends _chunkU4UYRERWjs.Entity {
1918
1932
  }, _class3);
1919
1933
 
1920
1934
  // src/components/GridTextEntity.ts
1921
- var GridTextEntity = (_class4 = class extends _chunkU4UYRERWjs.Entity {
1935
+ var GridTextEntity = (_class4 = class extends _chunkNHNOKBD4js.Entity {
1922
1936
 
1923
- __init59() {this.fillStyle = "#ffffff"}
1924
- __init60() {this.grid = []}
1937
+ __init60() {this.fillStyle = "#ffffff"}
1938
+ __init61() {this.grid = []}
1925
1939
  // Array of rows
1926
- __init61() {this.cols = 0}
1927
- __init62() {this.rows = 0}
1940
+ __init62() {this.cols = 0}
1941
+ __init63() {this.rows = 0}
1928
1942
 
1929
1943
 
1930
1944
  constructor(_atlas, fontSize = 10) {
1931
- super();_class4.prototype.__init59.call(this);_class4.prototype.__init60.call(this);_class4.prototype.__init61.call(this);_class4.prototype.__init62.call(this);;
1945
+ super();_class4.prototype.__init60.call(this);_class4.prototype.__init61.call(this);_class4.prototype.__init62.call(this);_class4.prototype.__init63.call(this);;
1932
1946
  this.fontSize = fontSize;
1933
1947
  this.charWidth = fontSize * 1;
1934
1948
  this.charHeight = fontSize * 1.1;
@@ -2012,7 +2026,7 @@ function distSqToSegment(px, py, x1, y1, x2, y2) {
2012
2026
  const ey = py - cy;
2013
2027
  return ex * ex + ey * ey;
2014
2028
  }
2015
- var SplineEntity = (_class5 = class extends _chunkU4UYRERWjs.Entity {
2029
+ var SplineEntity = (_class5 = class extends _chunkNHNOKBD4js.Entity {
2016
2030
 
2017
2031
 
2018
2032
 
@@ -2020,23 +2034,23 @@ var SplineEntity = (_class5 = class extends _chunkU4UYRERWjs.Entity {
2020
2034
 
2021
2035
 
2022
2036
 
2023
- __init63() {this.offscreen = null}
2024
- __init64() {this.baked = false}
2037
+ __init64() {this.offscreen = null}
2038
+ __init65() {this.baked = false}
2025
2039
  /** Logical (CSS-pixel) size of the baked bitmap — the blit destination size. */
2026
- __init65() {this.bakedWidth = 0}
2027
- __init66() {this.bakedHeight = 0}
2040
+ __init66() {this.bakedWidth = 0}
2041
+ __init67() {this.bakedHeight = 0}
2028
2042
  /** Gradient strokes can't be baked to a solid-color bitmap; they render per-frame. */
2029
2043
 
2030
2044
  /** Lazily-flattened polylines (one Float32Array of [x,y,...] per segment) for hit-testing. */
2031
- __init67() {this.polylines = null}
2045
+ __init68() {this.polylines = null}
2032
2046
  /**
2033
2047
  * When `true`, the renderer draws a rounded-rect outline of the entity's
2034
2048
  * local bounds after painting the curves. Useful for drag feedback and
2035
2049
  * debugging hit areas. Defaults to `false`.
2036
2050
  */
2037
- __init68() {this.showBounds = false}
2051
+ __init69() {this.showBounds = false}
2038
2052
  constructor(doc, opts = {}) {
2039
- super();_class5.prototype.__init63.call(this);_class5.prototype.__init64.call(this);_class5.prototype.__init65.call(this);_class5.prototype.__init66.call(this);_class5.prototype.__init67.call(this);_class5.prototype.__init68.call(this);;
2053
+ super();_class5.prototype.__init64.call(this);_class5.prototype.__init65.call(this);_class5.prototype.__init66.call(this);_class5.prototype.__init67.call(this);_class5.prototype.__init68.call(this);_class5.prototype.__init69.call(this);;
2040
2054
  this.doc = doc;
2041
2055
  this.lineWidth = _nullishCoalesce(opts.lineWidth, () => ( 2));
2042
2056
  this.cache = _nullishCoalesce(opts.cache, () => ( true));
@@ -2289,9 +2303,9 @@ async function loadSpline(url) {
2289
2303
  // src/math/SpatialHashGrid.ts
2290
2304
  var SpatialHashGrid = (_class6 = class {
2291
2305
 
2292
- __init69() {this.grid = /* @__PURE__ */ new Map()}
2293
- __init70() {this.entityCells = /* @__PURE__ */ new Map()}
2294
- constructor(cellSize = 64) {;_class6.prototype.__init69.call(this);_class6.prototype.__init70.call(this);
2306
+ __init70() {this.grid = /* @__PURE__ */ new Map()}
2307
+ __init71() {this.entityCells = /* @__PURE__ */ new Map()}
2308
+ constructor(cellSize = 64) {;_class6.prototype.__init70.call(this);_class6.prototype.__init71.call(this);
2295
2309
  this.cellSize = cellSize;
2296
2310
  }
2297
2311
  hash(cx, cy) {
@@ -2381,20 +2395,20 @@ var SpatialHashGrid = (_class6 = class {
2381
2395
  }, _class6);
2382
2396
 
2383
2397
  // src/tree/DOMPortalEntity.ts
2384
- var DOMPortalEntity = (_class7 = class extends _chunkU4UYRERWjs.Entity {
2398
+ var DOMPortalEntity = (_class7 = class extends _chunkNHNOKBD4js.Entity {
2385
2399
 
2386
- __init71() {this.isDOMPortal = true}
2387
- __init72() {this.domListeners = []}
2388
- __init73() {this.resizeObserver = null}
2389
- __init74() {this.cachedWidth = 100}
2390
- __init75() {this.cachedHeight = 100}
2391
- __init76() {this.lastWidth = ""}
2392
- __init77() {this.lastHeight = ""}
2393
- __init78() {this.lastTransform = ""}
2394
- __init79() {this.lastZIndex = ""}
2395
- __init80() {this.lastOpacity = ""}
2400
+ __init72() {this.isDOMPortal = true}
2401
+ __init73() {this.domListeners = []}
2402
+ __init74() {this.resizeObserver = null}
2403
+ __init75() {this.cachedWidth = 100}
2404
+ __init76() {this.cachedHeight = 100}
2405
+ __init77() {this.lastWidth = ""}
2406
+ __init78() {this.lastHeight = ""}
2407
+ __init79() {this.lastTransform = ""}
2408
+ __init80() {this.lastZIndex = ""}
2409
+ __init81() {this.lastOpacity = ""}
2396
2410
  constructor(domElement, width, height, id) {
2397
- super(id);_class7.prototype.__init71.call(this);_class7.prototype.__init72.call(this);_class7.prototype.__init73.call(this);_class7.prototype.__init74.call(this);_class7.prototype.__init75.call(this);_class7.prototype.__init76.call(this);_class7.prototype.__init77.call(this);_class7.prototype.__init78.call(this);_class7.prototype.__init79.call(this);_class7.prototype.__init80.call(this);;
2411
+ super(id);_class7.prototype.__init72.call(this);_class7.prototype.__init73.call(this);_class7.prototype.__init74.call(this);_class7.prototype.__init75.call(this);_class7.prototype.__init76.call(this);_class7.prototype.__init77.call(this);_class7.prototype.__init78.call(this);_class7.prototype.__init79.call(this);_class7.prototype.__init80.call(this);_class7.prototype.__init81.call(this);;
2398
2412
  this.domElement = domElement;
2399
2413
  this.width = _nullishCoalesce(width, () => ( 0));
2400
2414
  this.height = _nullishCoalesce(height, () => ( 0));
@@ -2416,7 +2430,7 @@ var DOMPortalEntity = (_class7 = class extends _chunkU4UYRERWjs.Entity {
2416
2430
  const events = ["click", "pointerdown", "pointerup", "pointermove", "wheel"];
2417
2431
  for (const type of events) {
2418
2432
  const handler = (e) => {
2419
- this.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)(type, this, e));
2433
+ this.dispatchEvent(new (0, _chunkNHNOKBD4js.VectoJSEvent)(type, this, e));
2420
2434
  };
2421
2435
  this.domElement.addEventListener(type, handler);
2422
2436
  this.domListeners.push({ type, handler, capture: false });
@@ -2427,7 +2441,7 @@ var DOMPortalEntity = (_class7 = class extends _chunkU4UYRERWjs.Entity {
2427
2441
  ];
2428
2442
  for (const { native, vecto } of hoverEvents) {
2429
2443
  const handler = (e) => {
2430
- this.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)(vecto, this, e, false));
2444
+ this.dispatchEvent(new (0, _chunkNHNOKBD4js.VectoJSEvent)(vecto, this, e, false));
2431
2445
  };
2432
2446
  this.domElement.addEventListener(native, handler);
2433
2447
  this.domListeners.push({ type: native, handler, capture: false });
@@ -2435,7 +2449,7 @@ var DOMPortalEntity = (_class7 = class extends _chunkU4UYRERWjs.Entity {
2435
2449
  const focusEvents = ["focus", "blur"];
2436
2450
  for (const type of focusEvents) {
2437
2451
  const handler = (e) => {
2438
- this.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)(type, this, e, true));
2452
+ this.dispatchEvent(new (0, _chunkNHNOKBD4js.VectoJSEvent)(type, this, e, true));
2439
2453
  };
2440
2454
  this.domElement.addEventListener(type, handler, true);
2441
2455
  this.domListeners.push({ type, handler, capture: true });
@@ -2520,4 +2534,4 @@ Scene.registerWebGPUParticleSystemManager(_chunkBPMNCGU7js.WebGPUParticleSystemM
2520
2534
 
2521
2535
 
2522
2536
 
2523
- exports.ArabicShaper = _chunkCTZQOM5Zjs.ArabicShaper; exports.BidiResolver = _chunkCTZQOM5Zjs.BidiResolver; exports.CanvasRenderer = _chunkBPMNCGU7js.CanvasRenderer; exports.ComputeParticleEntity = ComputeParticleEntity; exports.DOMPortalEntity = DOMPortalEntity; exports.Easing = _chunkU4UYRERWjs.Easing; exports.Entity = _chunkU4UYRERWjs.Entity; exports.GridTextEntity = GridTextEntity; exports.LayoutEngine = _chunkXLZDOFSBjs.LayoutEngine; exports.LayoutResultBuffer = _chunkXLZDOFSBjs.LayoutResultBuffer; exports.LayoutWorkerManager = _chunkCTZQOM5Zjs.LayoutWorkerManager; exports.MSDFFont = _chunkU4UYRERWjs.MSDFFont; exports.MSDFTextEntity = _chunkU4UYRERWjs.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 = _chunkU4UYRERWjs.SVGEntity; exports.SVGRenderer = _chunkBPMNCGU7js.SVGRenderer; exports.Scene = Scene; exports.SpatialHashGrid = SpatialHashGrid; exports.SplineEntity = SplineEntity; exports.SpringDriver = _chunkU4UYRERWjs.SpringDriver; exports.SpringPhysics = _chunkU4UYRERWjs.SpringPhysics; exports.TextEntity = TextEntity; exports.TweenDriver = _chunkU4UYRERWjs.TweenDriver; exports.VectoJSEvent = _chunkU4UYRERWjs.VectoJSEvent; exports.WebGPUParticleSystemManager = _chunkBPMNCGU7js.WebGPUParticleSystemManager; exports.computeLineSegments = _chunkXLZDOFSBjs.computeLineSegments; exports.createCanvasMeasurer = _chunkXLZDOFSBjs.createCanvasMeasurer; exports.createWebGLPointRenderer = _chunkBPMNCGU7js.createWebGLPointRenderer; exports.isSafeUrl = _chunkBPMNCGU7js.isSafeUrl; exports.isTweenConfig = _chunkU4UYRERWjs.isTweenConfig; exports.loadSpline = loadSpline; exports.parseColorToRGBA = _chunkBPMNCGU7js.parseColorToRGBA; exports.polySegmentToBezier = polySegmentToBezier; exports.sanitizeUrl = _chunkBPMNCGU7js.sanitizeUrl;
2537
+ exports.ArabicShaper = _chunkCTZQOM5Zjs.ArabicShaper; exports.BidiResolver = _chunkCTZQOM5Zjs.BidiResolver; exports.CanvasRenderer = _chunkBPMNCGU7js.CanvasRenderer; exports.ComputeParticleEntity = ComputeParticleEntity; exports.DOMPortalEntity = DOMPortalEntity; exports.Easing = _chunkNHNOKBD4js.Easing; exports.Entity = _chunkNHNOKBD4js.Entity; exports.GridTextEntity = GridTextEntity; exports.LayoutEngine = _chunkXLZDOFSBjs.LayoutEngine; exports.LayoutResultBuffer = _chunkXLZDOFSBjs.LayoutResultBuffer; exports.LayoutWorkerManager = _chunkCTZQOM5Zjs.LayoutWorkerManager; exports.MSDFFont = _chunkNHNOKBD4js.MSDFFont; exports.MSDFTextEntity = _chunkNHNOKBD4js.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 = _chunkNHNOKBD4js.SVGEntity; exports.SVGRenderer = _chunkBPMNCGU7js.SVGRenderer; exports.Scene = Scene; exports.SpatialHashGrid = SpatialHashGrid; exports.SplineEntity = SplineEntity; exports.SpringDriver = _chunkNHNOKBD4js.SpringDriver; exports.SpringPhysics = _chunkNHNOKBD4js.SpringPhysics; exports.TextEntity = TextEntity; exports.TweenDriver = _chunkNHNOKBD4js.TweenDriver; exports.VectoJSEvent = _chunkNHNOKBD4js.VectoJSEvent; exports.WebGPUParticleSystemManager = _chunkBPMNCGU7js.WebGPUParticleSystemManager; exports.computeLineSegments = _chunkXLZDOFSBjs.computeLineSegments; exports.createCanvasMeasurer = _chunkXLZDOFSBjs.createCanvasMeasurer; exports.createWebGLPointRenderer = _chunkBPMNCGU7js.createWebGLPointRenderer; exports.isSafeUrl = _chunkBPMNCGU7js.isSafeUrl; exports.isTweenConfig = _chunkNHNOKBD4js.isTweenConfig; exports.loadSpline = loadSpline; exports.parseColorToRGBA = _chunkBPMNCGU7js.parseColorToRGBA; exports.polySegmentToBezier = polySegmentToBezier; exports.sanitizeUrl = _chunkBPMNCGU7js.sanitizeUrl;
package/dist/index.mjs CHANGED
@@ -24,7 +24,7 @@ import {
24
24
  TweenDriver,
25
25
  VectoJSEvent,
26
26
  isTweenConfig
27
- } from "./chunk-PY4KGL5Y.mjs";
27
+ } from "./chunk-N7DNUDVY.mjs";
28
28
  import {
29
29
  ArabicShaper,
30
30
  BidiResolver,
@@ -406,6 +406,7 @@ var Scene = class _Scene {
406
406
  pointerMoveListener = null;
407
407
  pointerLeaveListener = null;
408
408
  hasWarnedZeroSize = false;
409
+ fontLoadHandler = null;
409
410
  constructor(canvas, options = {}) {
410
411
  this.canvas = canvas;
411
412
  this.debugA11y = options.debugA11y ?? false;
@@ -502,6 +503,13 @@ var Scene = class _Scene {
502
503
  this.resizeHandler = () => {
503
504
  this.resize(window.innerWidth, window.innerHeight);
504
505
  };
506
+ if (typeof document !== "undefined" && document.fonts) {
507
+ this.fontLoadHandler = () => {
508
+ this.markDirty();
509
+ };
510
+ document.fonts.ready.then(this.fontLoadHandler);
511
+ document.fonts.addEventListener("loadingdone", this.fontLoadHandler);
512
+ }
505
513
  this.setupEvents();
506
514
  }
507
515
  /**
@@ -613,6 +621,9 @@ var Scene = class _Scene {
613
621
  if (this.destroyed) return;
614
622
  this.destroyed = true;
615
623
  this.stop();
624
+ if (typeof document !== "undefined" && document.fonts && this.fontLoadHandler) {
625
+ document.fonts.removeEventListener("loadingdone", this.fontLoadHandler);
626
+ }
616
627
  while (this.root.children.length > 0) this.destroyEntitySubtree(this.root.children.at(-1));
617
628
  while (this.overlayRoot.children.length > 0) {
618
629
  this.destroyEntitySubtree(this.overlayRoot.children.at(-1));
@@ -925,6 +936,9 @@ var Scene = class _Scene {
925
936
  if (attrs.href !== void 0 && el instanceof HTMLAnchorElement) {
926
937
  const safeHref = sanitizeUrl(attrs.href);
927
938
  if (el.getAttribute("href") !== safeHref) el.setAttribute("href", safeHref);
939
+ if (attrs.target !== void 0 && el.getAttribute("target") !== attrs.target) {
940
+ el.setAttribute("target", attrs.target);
941
+ }
928
942
  }
929
943
  if (el instanceof HTMLImageElement) {
930
944
  if (attrs.src !== void 0 && el.src !== attrs.src) el.src = attrs.src;
package/dist/text.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkU4UYRERWjs = require('./chunk-U4UYRERW.js');
5
+ var _chunkNHNOKBD4js = require('./chunk-NHNOKBD4.js');
6
6
 
7
7
 
8
8
 
@@ -13,4 +13,4 @@ var _chunkCTZQOM5Zjs = require('./chunk-CTZQOM5Z.js');
13
13
 
14
14
 
15
15
 
16
- exports.ArabicShaper = _chunkCTZQOM5Zjs.ArabicShaper; exports.BidiResolver = _chunkCTZQOM5Zjs.BidiResolver; exports.MSDFFont = _chunkU4UYRERWjs.MSDFFont; exports.MSDFTextEntity = _chunkU4UYRERWjs.MSDFTextEntity; exports.SVGEntity = _chunkU4UYRERWjs.SVGEntity;
16
+ exports.ArabicShaper = _chunkCTZQOM5Zjs.ArabicShaper; exports.BidiResolver = _chunkCTZQOM5Zjs.BidiResolver; exports.MSDFFont = _chunkNHNOKBD4js.MSDFFont; exports.MSDFTextEntity = _chunkNHNOKBD4js.MSDFTextEntity; exports.SVGEntity = _chunkNHNOKBD4js.SVGEntity;
package/dist/text.mjs CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  MSDFFont,
3
3
  MSDFTextEntity,
4
4
  SVGEntity
5
- } from "./chunk-PY4KGL5Y.mjs";
5
+ } from "./chunk-N7DNUDVY.mjs";
6
6
  import {
7
7
  ArabicShaper,
8
8
  BidiResolver
@@ -89,6 +89,8 @@ export interface A11yAttributes {
89
89
  label?: string;
90
90
  /** Destination URL; only meaningful for `tag: 'a'`. */
91
91
  href?: string;
92
+ /** Link target; only meaningful for `tag: 'a'`. Defaults to current window. */
93
+ target?: string;
92
94
  /** Image source; only meaningful for `tag: 'img'`. */
93
95
  src?: string;
94
96
  /** Alternative text; only meaningful for `tag: 'img'`. */
@@ -197,6 +197,7 @@ export declare class Scene {
197
197
  private pointerMoveListener;
198
198
  private pointerLeaveListener;
199
199
  private hasWarnedZeroSize;
200
+ private fontLoadHandler;
200
201
  constructor(canvas: HTMLCanvasElement, options?: SceneOptions);
201
202
  /**
202
203
  * Expose the underlying {@link IRenderer} for advanced direct-draw operations.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectojs/core",
3
- "version": "1.0.0",
3
+ "version": "1.3.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -58,11 +58,11 @@
58
58
  },
59
59
  "dependencies": {},
60
60
  "devDependencies": {
61
- "@vitest/coverage-v8": "^4.1.9",
62
- "esbuild": "^0.21.5",
61
+ "@vitest/coverage-v8": "^4.1.10",
62
+ "esbuild": "^0.28.1",
63
63
  "jsdom": "^29.1.1",
64
64
  "tsup": "^8.3.5",
65
- "vitest": "^4.1.9",
66
- "puppeteer-core": "^22.12.1"
65
+ "vitest": "^4.1.10",
66
+ "puppeteer-core": "^25.3.0"
67
67
  }
68
68
  }