@vectojs/core 0.2.8 → 1.0.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/dist/{chunk-XB3ZY5MF.js → chunk-BPMNCGU7.js} +9 -1
- package/dist/{chunk-G6GQO7W2.mjs → chunk-PY4KGL5Y.mjs} +18 -7
- package/dist/{chunk-XRWZS2DM.js → chunk-U4UYRERW.js} +18 -7
- package/dist/{chunk-YBW7ECZP.mjs → chunk-WT2XZHJQ.mjs} +9 -1
- package/dist/index.js +29 -29
- package/dist/index.mjs +2 -2
- package/dist/renderer.js +2 -2
- package/dist/renderer.mjs +1 -1
- package/dist/text.js +2 -2
- package/dist/text.mjs +1 -1
- package/dist/tree/Entity.d.ts +13 -3
- package/package.json +1 -1
|
@@ -701,6 +701,7 @@ var SVGRenderer = (_class2 = class {
|
|
|
701
701
|
}, _class2);
|
|
702
702
|
|
|
703
703
|
// src/renderer/colorParse.ts
|
|
704
|
+
var CACHE_MAX = 1e3;
|
|
704
705
|
var cache = /* @__PURE__ */ new Map();
|
|
705
706
|
var fallbackCtx;
|
|
706
707
|
function fromHex(hex) {
|
|
@@ -744,10 +745,17 @@ function fromCanvas(css) {
|
|
|
744
745
|
}
|
|
745
746
|
function parseColorToRGBA(css) {
|
|
746
747
|
const hit = cache.get(css);
|
|
747
|
-
if (hit)
|
|
748
|
+
if (hit) {
|
|
749
|
+
cache.delete(css);
|
|
750
|
+
cache.set(css, hit);
|
|
751
|
+
return hit;
|
|
752
|
+
}
|
|
748
753
|
const trimmed = css.trim();
|
|
749
754
|
const rgba = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce((trimmed[0] === "#" ? fromHex(trimmed) : null), () => ( fromRgbFunc(trimmed))), () => ( fromCanvas(trimmed))), () => ( [0, 0, 0, 1]));
|
|
750
755
|
cache.set(css, rgba);
|
|
756
|
+
if (cache.size > CACHE_MAX) {
|
|
757
|
+
cache.delete(cache.keys().next().value);
|
|
758
|
+
}
|
|
751
759
|
return rgba;
|
|
752
760
|
}
|
|
753
761
|
|
|
@@ -360,10 +360,21 @@ var Entity = class {
|
|
|
360
360
|
/**
|
|
361
361
|
* Append a child entity to this node's children array.
|
|
362
362
|
*
|
|
363
|
+
* If `child` already has a parent (including `this`), it's detached from it
|
|
364
|
+
* first — otherwise re-adding an already-added child duplicates it in
|
|
365
|
+
* `children[]` (one `remove()` call only strips the first occurrence,
|
|
366
|
+
* leaving a stale entry that keeps rendering/updating despite
|
|
367
|
+
* `child.parent` reporting `null`), and re-parenting to a different entity
|
|
368
|
+
* without an explicit `remove()` first leaves the old parent holding a
|
|
369
|
+
* stale reference whose own `.parent` disagrees with where it now lives.
|
|
370
|
+
* `child.parent` is only ever `null` or `this`'s ultimate owner, so this
|
|
371
|
+
* check is O(1) for the overwhelming common case (a brand-new entity).
|
|
372
|
+
*
|
|
363
373
|
* @param child - The entity to add as a child.
|
|
364
374
|
* @returns `this` for method chaining.
|
|
365
375
|
*/
|
|
366
376
|
add(child) {
|
|
377
|
+
if (child.parent) child.parent.remove(child);
|
|
367
378
|
child.parent = this;
|
|
368
379
|
this.children.push(child);
|
|
369
380
|
const s = this.scene;
|
|
@@ -716,9 +727,9 @@ var Entity = class {
|
|
|
716
727
|
* Return the exact accumulated Canvas `T * S * R` transform for this entity.
|
|
717
728
|
*/
|
|
718
729
|
getWorldTransform() {
|
|
719
|
-
const path =
|
|
730
|
+
const path = [this];
|
|
720
731
|
let ancestor = this.parent;
|
|
721
|
-
while (ancestor
|
|
732
|
+
while (ancestor) {
|
|
722
733
|
path.push(ancestor);
|
|
723
734
|
ancestor = ancestor.parent;
|
|
724
735
|
}
|
|
@@ -802,8 +813,8 @@ var Entity = class {
|
|
|
802
813
|
}
|
|
803
814
|
/**
|
|
804
815
|
* Accumulated world scale factors: this entity's own `scaleX`/`scaleY` times
|
|
805
|
-
* those of every ancestor
|
|
806
|
-
*
|
|
816
|
+
* those of every ancestor. Useful for mapping a world-space point back into
|
|
817
|
+
* local space for hit-testing.
|
|
807
818
|
*
|
|
808
819
|
* @returns The world scale `{ x, y }`.
|
|
809
820
|
*/
|
|
@@ -811,7 +822,7 @@ var Entity = class {
|
|
|
811
822
|
let sx = this.scaleX;
|
|
812
823
|
let sy = this.scaleY;
|
|
813
824
|
let curr = this.parent;
|
|
814
|
-
while (curr
|
|
825
|
+
while (curr) {
|
|
815
826
|
sx *= curr.scaleX;
|
|
816
827
|
sy *= curr.scaleY;
|
|
817
828
|
curr = curr.parent;
|
|
@@ -820,14 +831,14 @@ var Entity = class {
|
|
|
820
831
|
}
|
|
821
832
|
/**
|
|
822
833
|
* Accumulated world rotation: this entity's own `rotation` plus
|
|
823
|
-
* that of every ancestor
|
|
834
|
+
* that of every ancestor.
|
|
824
835
|
*
|
|
825
836
|
* @returns The accumulated world rotation in radians.
|
|
826
837
|
*/
|
|
827
838
|
getWorldRotation() {
|
|
828
839
|
let rot = this.rotation;
|
|
829
840
|
let curr = this.parent;
|
|
830
|
-
while (curr
|
|
841
|
+
while (curr) {
|
|
831
842
|
rot += curr.rotation;
|
|
832
843
|
curr = curr.parent;
|
|
833
844
|
}
|
|
@@ -360,10 +360,21 @@ var Entity = (_class4 = class {
|
|
|
360
360
|
/**
|
|
361
361
|
* Append a child entity to this node's children array.
|
|
362
362
|
*
|
|
363
|
+
* If `child` already has a parent (including `this`), it's detached from it
|
|
364
|
+
* first — otherwise re-adding an already-added child duplicates it in
|
|
365
|
+
* `children[]` (one `remove()` call only strips the first occurrence,
|
|
366
|
+
* leaving a stale entry that keeps rendering/updating despite
|
|
367
|
+
* `child.parent` reporting `null`), and re-parenting to a different entity
|
|
368
|
+
* without an explicit `remove()` first leaves the old parent holding a
|
|
369
|
+
* stale reference whose own `.parent` disagrees with where it now lives.
|
|
370
|
+
* `child.parent` is only ever `null` or `this`'s ultimate owner, so this
|
|
371
|
+
* check is O(1) for the overwhelming common case (a brand-new entity).
|
|
372
|
+
*
|
|
363
373
|
* @param child - The entity to add as a child.
|
|
364
374
|
* @returns `this` for method chaining.
|
|
365
375
|
*/
|
|
366
376
|
add(child) {
|
|
377
|
+
if (child.parent) child.parent.remove(child);
|
|
367
378
|
child.parent = this;
|
|
368
379
|
this.children.push(child);
|
|
369
380
|
const s = this.scene;
|
|
@@ -716,9 +727,9 @@ var Entity = (_class4 = class {
|
|
|
716
727
|
* Return the exact accumulated Canvas `T * S * R` transform for this entity.
|
|
717
728
|
*/
|
|
718
729
|
getWorldTransform() {
|
|
719
|
-
const path =
|
|
730
|
+
const path = [this];
|
|
720
731
|
let ancestor = this.parent;
|
|
721
|
-
while (ancestor
|
|
732
|
+
while (ancestor) {
|
|
722
733
|
path.push(ancestor);
|
|
723
734
|
ancestor = ancestor.parent;
|
|
724
735
|
}
|
|
@@ -802,8 +813,8 @@ var Entity = (_class4 = class {
|
|
|
802
813
|
}
|
|
803
814
|
/**
|
|
804
815
|
* Accumulated world scale factors: this entity's own `scaleX`/`scaleY` times
|
|
805
|
-
* those of every ancestor
|
|
806
|
-
*
|
|
816
|
+
* those of every ancestor. Useful for mapping a world-space point back into
|
|
817
|
+
* local space for hit-testing.
|
|
807
818
|
*
|
|
808
819
|
* @returns The world scale `{ x, y }`.
|
|
809
820
|
*/
|
|
@@ -811,7 +822,7 @@ var Entity = (_class4 = class {
|
|
|
811
822
|
let sx = this.scaleX;
|
|
812
823
|
let sy = this.scaleY;
|
|
813
824
|
let curr = this.parent;
|
|
814
|
-
while (curr
|
|
825
|
+
while (curr) {
|
|
815
826
|
sx *= curr.scaleX;
|
|
816
827
|
sy *= curr.scaleY;
|
|
817
828
|
curr = curr.parent;
|
|
@@ -820,14 +831,14 @@ var Entity = (_class4 = class {
|
|
|
820
831
|
}
|
|
821
832
|
/**
|
|
822
833
|
* Accumulated world rotation: this entity's own `rotation` plus
|
|
823
|
-
* that of every ancestor
|
|
834
|
+
* that of every ancestor.
|
|
824
835
|
*
|
|
825
836
|
* @returns The accumulated world rotation in radians.
|
|
826
837
|
*/
|
|
827
838
|
getWorldRotation() {
|
|
828
839
|
let rot = this.rotation;
|
|
829
840
|
let curr = this.parent;
|
|
830
|
-
while (curr
|
|
841
|
+
while (curr) {
|
|
831
842
|
rot += curr.rotation;
|
|
832
843
|
curr = curr.parent;
|
|
833
844
|
}
|
|
@@ -701,6 +701,7 @@ var SVGRenderer = class {
|
|
|
701
701
|
};
|
|
702
702
|
|
|
703
703
|
// src/renderer/colorParse.ts
|
|
704
|
+
var CACHE_MAX = 1e3;
|
|
704
705
|
var cache = /* @__PURE__ */ new Map();
|
|
705
706
|
var fallbackCtx;
|
|
706
707
|
function fromHex(hex) {
|
|
@@ -744,10 +745,17 @@ function fromCanvas(css) {
|
|
|
744
745
|
}
|
|
745
746
|
function parseColorToRGBA(css) {
|
|
746
747
|
const hit = cache.get(css);
|
|
747
|
-
if (hit)
|
|
748
|
+
if (hit) {
|
|
749
|
+
cache.delete(css);
|
|
750
|
+
cache.set(css, hit);
|
|
751
|
+
return hit;
|
|
752
|
+
}
|
|
748
753
|
const trimmed = css.trim();
|
|
749
754
|
const rgba = (trimmed[0] === "#" ? fromHex(trimmed) : null) ?? fromRgbFunc(trimmed) ?? fromCanvas(trimmed) ?? [0, 0, 0, 1];
|
|
750
755
|
cache.set(css, rgba);
|
|
756
|
+
if (cache.size > CACHE_MAX) {
|
|
757
|
+
cache.delete(cache.keys().next().value);
|
|
758
|
+
}
|
|
751
759
|
return rgba;
|
|
752
760
|
}
|
|
753
761
|
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ var _chunkXLZDOFSBjs = require('./chunk-XLZDOFSB.js');
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkBPMNCGU7js = require('./chunk-BPMNCGU7.js');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
@@ -24,7 +24,7 @@ var _chunkXB3ZY5MFjs = require('./chunk-XB3ZY5MF.js');
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
var
|
|
27
|
+
var _chunkU4UYRERWjs = require('./chunk-U4UYRERW.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
|
|
44
|
+
var ComputeParticleEntity = (_class = class extends _chunkU4UYRERWjs.Entity {
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
|
|
@@ -428,7 +428,7 @@ var Scene = (_class2 = class _Scene {
|
|
|
428
428
|
this.a11ySyncInterval = _nullishCoalesce(options.a11ySyncInterval, () => ( 0));
|
|
429
429
|
this.contentProjectionEnabled = _nullishCoalesce(options.contentProjection, () => ( true));
|
|
430
430
|
this.reducedMotionQuery = typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia("(prefers-reduced-motion: reduce)") : null;
|
|
431
|
-
this.root = new class RootEntity extends
|
|
431
|
+
this.root = new class RootEntity extends _chunkU4UYRERWjs.Entity {
|
|
432
432
|
isPointInside() {
|
|
433
433
|
return false;
|
|
434
434
|
}
|
|
@@ -437,7 +437,7 @@ var Scene = (_class2 = class _Scene {
|
|
|
437
437
|
}
|
|
438
438
|
}("root");
|
|
439
439
|
this.root._scene = this;
|
|
440
|
-
this.overlayRoot = new class OverlayRoot extends
|
|
440
|
+
this.overlayRoot = new class OverlayRoot extends _chunkU4UYRERWjs.Entity {
|
|
441
441
|
isPointInside() {
|
|
442
442
|
return false;
|
|
443
443
|
}
|
|
@@ -448,7 +448,7 @@ var Scene = (_class2 = class _Scene {
|
|
|
448
448
|
if (options.renderer) {
|
|
449
449
|
this.renderer = options.renderer;
|
|
450
450
|
} else {
|
|
451
|
-
this.renderer = new (0,
|
|
451
|
+
this.renderer = new (0, _chunkBPMNCGU7js.CanvasRenderer)(
|
|
452
452
|
canvas,
|
|
453
453
|
this.disableWindowResize ? { width: this.width, height: this.height } : void 0
|
|
454
454
|
);
|
|
@@ -790,42 +790,42 @@ var Scene = (_class2 = class _Scene {
|
|
|
790
790
|
el.style.background = "transparent";
|
|
791
791
|
}
|
|
792
792
|
el.addEventListener("click", (e) => {
|
|
793
|
-
node.dispatchEvent(new (0,
|
|
793
|
+
node.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)("click", node, e));
|
|
794
794
|
});
|
|
795
795
|
el.addEventListener("mouseenter", (e) => {
|
|
796
796
|
if (this.debugA11y) el.style.backgroundColor = "rgba(56, 189, 248, 0.2)";
|
|
797
|
-
node.dispatchEvent(new (0,
|
|
797
|
+
node.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)("hover", node, e, false));
|
|
798
798
|
});
|
|
799
799
|
el.addEventListener("mouseleave", (e) => {
|
|
800
800
|
if (this.debugA11y) el.style.backgroundColor = "rgba(56, 189, 248, 0.05)";
|
|
801
|
-
node.dispatchEvent(new (0,
|
|
801
|
+
node.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)("pointerleave", node, e, false));
|
|
802
802
|
});
|
|
803
803
|
const capEl = el;
|
|
804
804
|
el.addEventListener("pointerdown", (e) => {
|
|
805
805
|
if (typeof capEl.setPointerCapture === "function") capEl.setPointerCapture(e.pointerId);
|
|
806
|
-
node.dispatchEvent(new (0,
|
|
806
|
+
node.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)("pointerdown", node, e));
|
|
807
807
|
});
|
|
808
808
|
el.addEventListener("pointerup", (e) => {
|
|
809
809
|
if (typeof capEl.releasePointerCapture === "function")
|
|
810
810
|
capEl.releasePointerCapture(e.pointerId);
|
|
811
|
-
node.dispatchEvent(new (0,
|
|
811
|
+
node.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)("pointerup", node, e));
|
|
812
812
|
});
|
|
813
813
|
el.addEventListener(
|
|
814
814
|
"pointermove",
|
|
815
|
-
(e) => node.dispatchEvent(new (0,
|
|
815
|
+
(e) => node.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)("pointermove", node, e))
|
|
816
816
|
);
|
|
817
817
|
el.addEventListener(
|
|
818
818
|
"wheel",
|
|
819
819
|
(e) => {
|
|
820
|
-
node.dispatchEvent(new (0,
|
|
820
|
+
node.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)("wheel", node, e));
|
|
821
821
|
},
|
|
822
822
|
{ passive: false }
|
|
823
823
|
);
|
|
824
824
|
el.addEventListener("keydown", (e) => {
|
|
825
|
-
node.dispatchEvent(new (0,
|
|
825
|
+
node.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)("keydown", node, e));
|
|
826
826
|
});
|
|
827
827
|
el.addEventListener("keyup", (e) => {
|
|
828
|
-
node.dispatchEvent(new (0,
|
|
828
|
+
node.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)("keyup", node, e));
|
|
829
829
|
});
|
|
830
830
|
if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {
|
|
831
831
|
const input = el;
|
|
@@ -898,7 +898,7 @@ var Scene = (_class2 = class _Scene {
|
|
|
898
898
|
el.addEventListener("keydown", (e) => {
|
|
899
899
|
if (e.key === "Enter" || e.key === " ") {
|
|
900
900
|
e.preventDefault();
|
|
901
|
-
node.dispatchEvent(new (0,
|
|
901
|
+
node.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)("click", node, e));
|
|
902
902
|
}
|
|
903
903
|
});
|
|
904
904
|
}
|
|
@@ -923,7 +923,7 @@ var Scene = (_class2 = class _Scene {
|
|
|
923
923
|
if (el.placeholder !== attrs.placeholder) el.placeholder = attrs.placeholder;
|
|
924
924
|
}
|
|
925
925
|
if (attrs.href !== void 0 && el instanceof HTMLAnchorElement) {
|
|
926
|
-
const safeHref =
|
|
926
|
+
const safeHref = _chunkBPMNCGU7js.sanitizeUrl.call(void 0, attrs.href);
|
|
927
927
|
if (el.getAttribute("href") !== safeHref) el.setAttribute("href", safeHref);
|
|
928
928
|
}
|
|
929
929
|
if (el instanceof HTMLImageElement) {
|
|
@@ -1032,7 +1032,7 @@ var Scene = (_class2 = class _Scene {
|
|
|
1032
1032
|
el.addEventListener(
|
|
1033
1033
|
"wheel",
|
|
1034
1034
|
(e2) => {
|
|
1035
|
-
node.dispatchEvent(new (0,
|
|
1035
|
+
node.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)("wheel", node, e2));
|
|
1036
1036
|
},
|
|
1037
1037
|
{ passive: false }
|
|
1038
1038
|
);
|
|
@@ -1595,7 +1595,7 @@ var Scene = (_class2 = class _Scene {
|
|
|
1595
1595
|
* Export the current scene state to a lightweight, flat SVG XML string.
|
|
1596
1596
|
*/
|
|
1597
1597
|
toSVG() {
|
|
1598
|
-
const renderer = new (0,
|
|
1598
|
+
const renderer = new (0, _chunkBPMNCGU7js.SVGRenderer)(this.width, this.height);
|
|
1599
1599
|
this.render(renderer, 0, 0);
|
|
1600
1600
|
return renderer.toXMLString();
|
|
1601
1601
|
}
|
|
@@ -1792,7 +1792,7 @@ function defaultMeasurer() {
|
|
|
1792
1792
|
if (sharedMeasurer === void 0) sharedMeasurer = _chunkXLZDOFSBjs.createCanvasMeasurer.call(void 0, "sans-serif");
|
|
1793
1793
|
return sharedMeasurer;
|
|
1794
1794
|
}
|
|
1795
|
-
var TextEntity = (_class3 = class extends
|
|
1795
|
+
var TextEntity = (_class3 = class extends _chunkU4UYRERWjs.Entity {
|
|
1796
1796
|
|
|
1797
1797
|
|
|
1798
1798
|
|
|
@@ -1918,7 +1918,7 @@ var TextEntity = (_class3 = class extends _chunkXRWZS2DMjs.Entity {
|
|
|
1918
1918
|
}, _class3);
|
|
1919
1919
|
|
|
1920
1920
|
// src/components/GridTextEntity.ts
|
|
1921
|
-
var GridTextEntity = (_class4 = class extends
|
|
1921
|
+
var GridTextEntity = (_class4 = class extends _chunkU4UYRERWjs.Entity {
|
|
1922
1922
|
|
|
1923
1923
|
__init59() {this.fillStyle = "#ffffff"}
|
|
1924
1924
|
__init60() {this.grid = []}
|
|
@@ -2012,7 +2012,7 @@ function distSqToSegment(px, py, x1, y1, x2, y2) {
|
|
|
2012
2012
|
const ey = py - cy;
|
|
2013
2013
|
return ex * ex + ey * ey;
|
|
2014
2014
|
}
|
|
2015
|
-
var SplineEntity = (_class5 = class extends
|
|
2015
|
+
var SplineEntity = (_class5 = class extends _chunkU4UYRERWjs.Entity {
|
|
2016
2016
|
|
|
2017
2017
|
|
|
2018
2018
|
|
|
@@ -2381,7 +2381,7 @@ var SpatialHashGrid = (_class6 = class {
|
|
|
2381
2381
|
}, _class6);
|
|
2382
2382
|
|
|
2383
2383
|
// src/tree/DOMPortalEntity.ts
|
|
2384
|
-
var DOMPortalEntity = (_class7 = class extends
|
|
2384
|
+
var DOMPortalEntity = (_class7 = class extends _chunkU4UYRERWjs.Entity {
|
|
2385
2385
|
|
|
2386
2386
|
__init71() {this.isDOMPortal = true}
|
|
2387
2387
|
__init72() {this.domListeners = []}
|
|
@@ -2416,7 +2416,7 @@ var DOMPortalEntity = (_class7 = class extends _chunkXRWZS2DMjs.Entity {
|
|
|
2416
2416
|
const events = ["click", "pointerdown", "pointerup", "pointermove", "wheel"];
|
|
2417
2417
|
for (const type of events) {
|
|
2418
2418
|
const handler = (e) => {
|
|
2419
|
-
this.dispatchEvent(new (0,
|
|
2419
|
+
this.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)(type, this, e));
|
|
2420
2420
|
};
|
|
2421
2421
|
this.domElement.addEventListener(type, handler);
|
|
2422
2422
|
this.domListeners.push({ type, handler, capture: false });
|
|
@@ -2427,7 +2427,7 @@ var DOMPortalEntity = (_class7 = class extends _chunkXRWZS2DMjs.Entity {
|
|
|
2427
2427
|
];
|
|
2428
2428
|
for (const { native, vecto } of hoverEvents) {
|
|
2429
2429
|
const handler = (e) => {
|
|
2430
|
-
this.dispatchEvent(new (0,
|
|
2430
|
+
this.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)(vecto, this, e, false));
|
|
2431
2431
|
};
|
|
2432
2432
|
this.domElement.addEventListener(native, handler);
|
|
2433
2433
|
this.domListeners.push({ type: native, handler, capture: false });
|
|
@@ -2435,7 +2435,7 @@ var DOMPortalEntity = (_class7 = class extends _chunkXRWZS2DMjs.Entity {
|
|
|
2435
2435
|
const focusEvents = ["focus", "blur"];
|
|
2436
2436
|
for (const type of focusEvents) {
|
|
2437
2437
|
const handler = (e) => {
|
|
2438
|
-
this.dispatchEvent(new (0,
|
|
2438
|
+
this.dispatchEvent(new (0, _chunkU4UYRERWjs.VectoJSEvent)(type, this, e, true));
|
|
2439
2439
|
};
|
|
2440
2440
|
this.domElement.addEventListener(type, handler, true);
|
|
2441
2441
|
this.domListeners.push({ type, handler, capture: true });
|
|
@@ -2474,8 +2474,8 @@ var DOMPortalEntity = (_class7 = class extends _chunkXRWZS2DMjs.Entity {
|
|
|
2474
2474
|
}, _class7);
|
|
2475
2475
|
|
|
2476
2476
|
// src/index.ts
|
|
2477
|
-
Scene.registerWebGLPointRendererCreator(
|
|
2478
|
-
Scene.registerWebGPUParticleSystemManager(
|
|
2477
|
+
Scene.registerWebGLPointRendererCreator(_chunkBPMNCGU7js.createWebGLPointRenderer);
|
|
2478
|
+
Scene.registerWebGPUParticleSystemManager(_chunkBPMNCGU7js.WebGPUParticleSystemManager);
|
|
2479
2479
|
|
|
2480
2480
|
|
|
2481
2481
|
|
|
@@ -2520,4 +2520,4 @@ Scene.registerWebGPUParticleSystemManager(_chunkXB3ZY5MFjs.WebGPUParticleSystemM
|
|
|
2520
2520
|
|
|
2521
2521
|
|
|
2522
2522
|
|
|
2523
|
-
exports.ArabicShaper = _chunkCTZQOM5Zjs.ArabicShaper; exports.BidiResolver = _chunkCTZQOM5Zjs.BidiResolver; exports.CanvasRenderer =
|
|
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;
|
package/dist/index.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
isSafeUrl,
|
|
13
13
|
parseColorToRGBA,
|
|
14
14
|
sanitizeUrl
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-WT2XZHJQ.mjs";
|
|
16
16
|
import {
|
|
17
17
|
Easing,
|
|
18
18
|
Entity,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
TweenDriver,
|
|
25
25
|
VectoJSEvent,
|
|
26
26
|
isTweenConfig
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-PY4KGL5Y.mjs";
|
|
28
28
|
import {
|
|
29
29
|
ArabicShaper,
|
|
30
30
|
BidiResolver,
|
package/dist/renderer.js
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkBPMNCGU7js = require('./chunk-BPMNCGU7.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
exports.CanvasRenderer =
|
|
14
|
+
exports.CanvasRenderer = _chunkBPMNCGU7js.CanvasRenderer; exports.SVGRenderer = _chunkBPMNCGU7js.SVGRenderer; exports.WebGPUParticleSystemManager = _chunkBPMNCGU7js.WebGPUParticleSystemManager; exports.createWebGLPointRenderer = _chunkBPMNCGU7js.createWebGLPointRenderer; exports.parseColorToRGBA = _chunkBPMNCGU7js.parseColorToRGBA;
|
package/dist/renderer.mjs
CHANGED
package/dist/text.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkU4UYRERWjs = require('./chunk-U4UYRERW.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 =
|
|
16
|
+
exports.ArabicShaper = _chunkCTZQOM5Zjs.ArabicShaper; exports.BidiResolver = _chunkCTZQOM5Zjs.BidiResolver; exports.MSDFFont = _chunkU4UYRERWjs.MSDFFont; exports.MSDFTextEntity = _chunkU4UYRERWjs.MSDFTextEntity; exports.SVGEntity = _chunkU4UYRERWjs.SVGEntity;
|
package/dist/text.mjs
CHANGED
package/dist/tree/Entity.d.ts
CHANGED
|
@@ -262,6 +262,16 @@ export declare abstract class Entity {
|
|
|
262
262
|
/**
|
|
263
263
|
* Append a child entity to this node's children array.
|
|
264
264
|
*
|
|
265
|
+
* If `child` already has a parent (including `this`), it's detached from it
|
|
266
|
+
* first — otherwise re-adding an already-added child duplicates it in
|
|
267
|
+
* `children[]` (one `remove()` call only strips the first occurrence,
|
|
268
|
+
* leaving a stale entry that keeps rendering/updating despite
|
|
269
|
+
* `child.parent` reporting `null`), and re-parenting to a different entity
|
|
270
|
+
* without an explicit `remove()` first leaves the old parent holding a
|
|
271
|
+
* stale reference whose own `.parent` disagrees with where it now lives.
|
|
272
|
+
* `child.parent` is only ever `null` or `this`'s ultimate owner, so this
|
|
273
|
+
* check is O(1) for the overwhelming common case (a brand-new entity).
|
|
274
|
+
*
|
|
265
275
|
* @param child - The entity to add as a child.
|
|
266
276
|
* @returns `this` for method chaining.
|
|
267
277
|
*/
|
|
@@ -405,8 +415,8 @@ export declare abstract class Entity {
|
|
|
405
415
|
getWorldBounds(): Bounds;
|
|
406
416
|
/**
|
|
407
417
|
* Accumulated world scale factors: this entity's own `scaleX`/`scaleY` times
|
|
408
|
-
* those of every ancestor
|
|
409
|
-
*
|
|
418
|
+
* those of every ancestor. Useful for mapping a world-space point back into
|
|
419
|
+
* local space for hit-testing.
|
|
410
420
|
*
|
|
411
421
|
* @returns The world scale `{ x, y }`.
|
|
412
422
|
*/
|
|
@@ -416,7 +426,7 @@ export declare abstract class Entity {
|
|
|
416
426
|
};
|
|
417
427
|
/**
|
|
418
428
|
* Accumulated world rotation: this entity's own `rotation` plus
|
|
419
|
-
* that of every ancestor
|
|
429
|
+
* that of every ancestor.
|
|
420
430
|
*
|
|
421
431
|
* @returns The accumulated world rotation in radians.
|
|
422
432
|
*/
|