@vectojs/core 1.13.0 → 1.15.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-XIEQHSBB.mjs → chunk-64UFEHOJ.mjs} +7 -464
- package/dist/{chunk-2Z23LTH3.js → chunk-J6NHSFIE.js} +60 -517
- package/dist/index.d.ts +4 -12
- package/dist/index.js +183 -273
- package/dist/index.mjs +79 -169
- package/dist/layout/index.d.ts +1 -3
- package/dist/layout.js +2 -16
- package/dist/layout.mjs +2 -16
- package/dist/text/MSDFTextEntity.d.ts +1 -1
- package/dist/text/index.d.ts +1 -5
- package/dist/text.js +5 -16
- package/dist/text.mjs +6 -17
- package/dist/tree/Entity.d.ts +2 -2
- package/dist/tree/Scene.d.ts +22 -0
- package/package.json +8 -6
- package/dist/animation/drivers.d.ts +0 -48
- package/dist/animation/easing.d.ts +0 -16
- package/dist/chunk-4AR425AR.js +0 -1121
- package/dist/chunk-BA5HUUDF.js +0 -760
- package/dist/chunk-IESDTEJ4.mjs +0 -1121
- package/dist/chunk-X7I465AQ.mjs +0 -760
- package/dist/layout/LayoutEngine.d.ts +0 -289
- package/dist/layout/LayoutWorker.d.ts +0 -23
- package/dist/layout/LayoutWorkerManager.d.ts +0 -26
- package/dist/layout/LayoutWorkerSource.d.ts +0 -1
- package/dist/layout/measure.d.ts +0 -20
- package/dist/math/SpatialHashGrid.d.ts +0 -53
- package/dist/math/SpringPhysics.d.ts +0 -13
- package/dist/text/ArabicShaper.d.ts +0 -10
- package/dist/text/BidiResolver.d.ts +0 -5
- package/dist/text/MSDFFont.d.ts +0 -129
- package/dist/text/PreparedContentGrid.d.ts +0 -60
- package/dist/text/Typography.d.ts +0 -11
package/dist/index.js
CHANGED
|
@@ -1,10 +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;
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _chunkBA5HUUDFjs = require('./chunk-BA5HUUDF.js');
|
|
7
|
-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); } 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;
|
|
8
2
|
|
|
9
3
|
|
|
10
4
|
|
|
@@ -19,21 +13,7 @@ var _chunkBEUIB3U7js = require('./chunk-BEUIB3U7.js');
|
|
|
19
13
|
|
|
20
14
|
|
|
21
15
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
var _chunk2Z23LTH3js = require('./chunk-2Z23LTH3.js');
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
var _chunk4AR425ARjs = require('./chunk-4AR425AR.js');
|
|
16
|
+
var _chunkJ6NHSFIEjs = require('./chunk-J6NHSFIE.js');
|
|
37
17
|
|
|
38
18
|
// src/tree/ComputeParticleEntity.ts
|
|
39
19
|
var PARTICLE_STRIDE_FLOATS = 8;
|
|
@@ -45,7 +25,7 @@ var PARTICLE_OFFSET_ORIGIN_X = 4;
|
|
|
45
25
|
var PARTICLE_OFFSET_ORIGIN_Y = 5;
|
|
46
26
|
var PARTICLE_OFFSET_SIZE = 6;
|
|
47
27
|
var PARTICLE_OFFSET_LIFE = 7;
|
|
48
|
-
var ComputeParticleEntity = (_class = class extends
|
|
28
|
+
var ComputeParticleEntity = (_class = class extends _chunkJ6NHSFIEjs.Entity {
|
|
49
29
|
|
|
50
30
|
|
|
51
31
|
|
|
@@ -330,6 +310,7 @@ var ComputeParticleEntity = (_class = class extends _chunk2Z23LTH3js.Entity {
|
|
|
330
310
|
}, _class);
|
|
331
311
|
|
|
332
312
|
// src/tree/Scene.ts
|
|
313
|
+
var _text = require('@vectojs/text'); _createStarExport(_text);
|
|
333
314
|
var INTERACTIVE_A11Y_ROLES = /* @__PURE__ */ new Set([
|
|
334
315
|
"button",
|
|
335
316
|
"switch",
|
|
@@ -720,73 +701,76 @@ var Scene = (_class2 = class _Scene {
|
|
|
720
701
|
__init29() {this.contentMetricScaleEpoch = -1}
|
|
721
702
|
__init30() {this.contentMetricScaleX = 1}
|
|
722
703
|
__init31() {this.contentProjectionEnabled = true}
|
|
704
|
+
// Virtualization margin (px) for content projection; `undefined` → one
|
|
705
|
+
// viewport height, resolved at sync time. `Infinity` = materialize everything.
|
|
706
|
+
__init32() {this.contentProjectionMargin = void 0}
|
|
723
707
|
/**
|
|
724
708
|
* True while a text-selection drag that started on a projection's blank
|
|
725
709
|
* region (no text node under the press) is being driven manually — the
|
|
726
710
|
* browser has no native anchor for it, so mousemove extends the Selection
|
|
727
711
|
* from the position we resolved ourselves.
|
|
728
712
|
*/
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
713
|
+
__init33() {this.blankRegionSelectionDrag = false}
|
|
714
|
+
__init34() {this.contentSelectionAnchor = null}
|
|
715
|
+
__init35() {this.contentSelectionEndListener = null}
|
|
732
716
|
// Animation/interactive flags collected during the render walk (tree-walk
|
|
733
717
|
// fusion): the loop reads last frame's answers instead of re-walking the
|
|
734
718
|
// tree up to 4× per tick. Start true so the first tick stays conservative.
|
|
735
|
-
|
|
736
|
-
|
|
719
|
+
__init36() {this.frameHadAnimation = true}
|
|
720
|
+
__init37() {this.frameHadInteractive = true}
|
|
737
721
|
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
722
|
+
__init38() {this.focusedA11yElement = null}
|
|
723
|
+
__init39() {this.caretBlinkTimer = null}
|
|
724
|
+
__init40() {this.a11yNeedsReorder = true}
|
|
725
|
+
__init41() {this.portalRoot = null}
|
|
726
|
+
__init42() {this.fullViewportElements = []}
|
|
727
|
+
__init43() {this.normalElements = []}
|
|
728
|
+
__init44() {this.activeIds = /* @__PURE__ */ new Set()}
|
|
729
|
+
__init45() {this.activePortalsThisFrame = /* @__PURE__ */ new Set()}
|
|
730
|
+
__init46() {this.activePortalsPrevFrame = /* @__PURE__ */ new Set()}
|
|
731
|
+
__init47() {this.portalEntities = /* @__PURE__ */ new Map()}
|
|
732
|
+
__init48() {this.renderOrderCounter = 0}
|
|
749
733
|
/**
|
|
750
734
|
* Authoritative paint order for semantic nodes discovered during the main
|
|
751
735
|
* render. A node may not have a DOM projection until the following a11y
|
|
752
736
|
* sync, so retaining the order prevents a newly opened overlay from spending
|
|
753
737
|
* its first frame below previously projected controls.
|
|
754
738
|
*/
|
|
755
|
-
|
|
739
|
+
__init49() {this.a11yRenderOrders = /* @__PURE__ */ new Map()}
|
|
756
740
|
// Optional WebGL point-cloud layer (see SceneOptions.pointBackend).
|
|
757
|
-
|
|
758
|
-
|
|
741
|
+
__init50() {this.pointRenderer = null}
|
|
742
|
+
__init51() {this.glCanvas = null}
|
|
759
743
|
|
|
760
744
|
|
|
761
745
|
|
|
762
|
-
|
|
746
|
+
__init52() {this.disableWindowResize = false}
|
|
763
747
|
/** See {@link SceneOptions.maxDPR}. `undefined` = uncapped (real DPR). */
|
|
764
748
|
|
|
765
749
|
// WebGPU properties
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
750
|
+
__init53() {this.destroyed = false}
|
|
751
|
+
__init54() {this.device = null}
|
|
752
|
+
__init55() {this.deviceLost = false}
|
|
753
|
+
__init56() {this.particleBackend = "auto"}
|
|
754
|
+
__init57() {this._webgpuDisabled = false}
|
|
771
755
|
get webgpuDisabled() {
|
|
772
756
|
return this._webgpuDisabled || this.particleBackend === "cpu";
|
|
773
757
|
}
|
|
774
758
|
set webgpuDisabled(value) {
|
|
775
759
|
this._webgpuDisabled = value;
|
|
776
760
|
}
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
761
|
+
__init58() {this.recoveryTimerId = null}
|
|
762
|
+
__init59() {this.manager = null}
|
|
763
|
+
__init60() {this.initializingWebGPU = false}
|
|
764
|
+
__init61() {this.gpuCanvas = null}
|
|
765
|
+
__init62() {this.gpuContext = null}
|
|
782
766
|
/** True while the GPU canvas holds a presented particle frame (needs clearing when they leave). */
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
767
|
+
__init63() {this.gpuHasContent = false}
|
|
768
|
+
__init64() {this.mouseX = -9999}
|
|
769
|
+
__init65() {this.mouseY = -9999}
|
|
770
|
+
__init66() {this.pointerMoveListener = null}
|
|
771
|
+
__init67() {this.pointerLeaveListener = null}
|
|
772
|
+
__init68() {this.hasWarnedZeroSize = false}
|
|
773
|
+
__init69() {this.fontLoadHandler = null}
|
|
790
774
|
// ── Dev-mode warning infrastructure ──────────────────────────────
|
|
791
775
|
//
|
|
792
776
|
// Enable with `Scene.devMode = true` or by setting `globalThis.__DEV__`.
|
|
@@ -804,7 +788,7 @@ var Scene = (_class2 = class _Scene {
|
|
|
804
788
|
return false;
|
|
805
789
|
}
|
|
806
790
|
|
|
807
|
-
|
|
791
|
+
__init70() {this._devFrameCount = 0}
|
|
808
792
|
_devWarn(message) {
|
|
809
793
|
if (!this._devActive) return;
|
|
810
794
|
console.warn(`[vectojs/dev] ${message}`);
|
|
@@ -848,7 +832,7 @@ var Scene = (_class2 = class _Scene {
|
|
|
848
832
|
};
|
|
849
833
|
walkProjections(this.root);
|
|
850
834
|
}
|
|
851
|
-
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);_class2.prototype.__init54.call(this);_class2.prototype.__init55.call(this);_class2.prototype.__init56.call(this);_class2.prototype.__init57.call(this);_class2.prototype.__init58.call(this);_class2.prototype.__init59.call(this);_class2.prototype.__init60.call(this);_class2.prototype.__init61.call(this);_class2.prototype.__init62.call(this);_class2.prototype.__init63.call(this);_class2.prototype.__init64.call(this);_class2.prototype.__init65.call(this);_class2.prototype.__init66.call(this);_class2.prototype.__init67.call(this);_class2.prototype.__init68.call(this);_class2.prototype.__init69.call(this);
|
|
835
|
+
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);_class2.prototype.__init54.call(this);_class2.prototype.__init55.call(this);_class2.prototype.__init56.call(this);_class2.prototype.__init57.call(this);_class2.prototype.__init58.call(this);_class2.prototype.__init59.call(this);_class2.prototype.__init60.call(this);_class2.prototype.__init61.call(this);_class2.prototype.__init62.call(this);_class2.prototype.__init63.call(this);_class2.prototype.__init64.call(this);_class2.prototype.__init65.call(this);_class2.prototype.__init66.call(this);_class2.prototype.__init67.call(this);_class2.prototype.__init68.call(this);_class2.prototype.__init69.call(this);_class2.prototype.__init70.call(this);
|
|
852
836
|
this.canvas = canvas;
|
|
853
837
|
this.debugA11y = _nullishCoalesce(options.debugA11y, () => ( false));
|
|
854
838
|
this.disableWindowResize = _nullishCoalesce(options.disableWindowResize, () => ( false));
|
|
@@ -870,9 +854,10 @@ var Scene = (_class2 = class _Scene {
|
|
|
870
854
|
this.particleBackend = _nullishCoalesce(options.particleBackend, () => ( "auto"));
|
|
871
855
|
this.a11ySyncInterval = _nullishCoalesce(options.a11ySyncInterval, () => ( 0));
|
|
872
856
|
this.contentProjectionEnabled = _nullishCoalesce(options.contentProjection, () => ( true));
|
|
857
|
+
this.contentProjectionMargin = options.contentProjectionMargin;
|
|
873
858
|
this._devActive = _Scene._devModeDetected();
|
|
874
859
|
this.reducedMotionQuery = typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia("(prefers-reduced-motion: reduce)") : null;
|
|
875
|
-
this.root = new class RootEntity extends
|
|
860
|
+
this.root = new class RootEntity extends _chunkJ6NHSFIEjs.Entity {
|
|
876
861
|
isPointInside() {
|
|
877
862
|
return false;
|
|
878
863
|
}
|
|
@@ -881,7 +866,7 @@ var Scene = (_class2 = class _Scene {
|
|
|
881
866
|
}
|
|
882
867
|
}("root");
|
|
883
868
|
this.root._scene = this;
|
|
884
|
-
this.overlayRoot = new class OverlayRoot extends
|
|
869
|
+
this.overlayRoot = new class OverlayRoot extends _chunkJ6NHSFIEjs.Entity {
|
|
885
870
|
isPointInside() {
|
|
886
871
|
return false;
|
|
887
872
|
}
|
|
@@ -1034,7 +1019,7 @@ var Scene = (_class2 = class _Scene {
|
|
|
1034
1019
|
};
|
|
1035
1020
|
if (typeof document !== "undefined" && document.fonts) {
|
|
1036
1021
|
this.fontLoadHandler = () => {
|
|
1037
|
-
|
|
1022
|
+
_text.clearCssLineBoxMetrics.call(void 0, );
|
|
1038
1023
|
this.contentFontEpoch++;
|
|
1039
1024
|
this.markDirty();
|
|
1040
1025
|
};
|
|
@@ -1415,18 +1400,18 @@ var Scene = (_class2 = class _Scene {
|
|
|
1415
1400
|
el.style.background = "transparent";
|
|
1416
1401
|
}
|
|
1417
1402
|
el.addEventListener("click", (e) => {
|
|
1418
|
-
node.dispatchEvent(new (0,
|
|
1403
|
+
node.dispatchEvent(new (0, _chunkJ6NHSFIEjs.VectoJSEvent)("click", node, e));
|
|
1419
1404
|
});
|
|
1420
1405
|
el.addEventListener("dblclick", (e) => {
|
|
1421
|
-
node.dispatchEvent(new (0,
|
|
1406
|
+
node.dispatchEvent(new (0, _chunkJ6NHSFIEjs.VectoJSEvent)("dblclick", node, e));
|
|
1422
1407
|
});
|
|
1423
1408
|
el.addEventListener("mouseenter", (e) => {
|
|
1424
1409
|
if (this.debugA11y) el.style.backgroundColor = "rgba(56, 189, 248, 0.2)";
|
|
1425
|
-
node.dispatchEvent(new (0,
|
|
1410
|
+
node.dispatchEvent(new (0, _chunkJ6NHSFIEjs.VectoJSEvent)("hover", node, e, false));
|
|
1426
1411
|
});
|
|
1427
1412
|
el.addEventListener("mouseleave", (e) => {
|
|
1428
1413
|
if (this.debugA11y) el.style.backgroundColor = "rgba(56, 189, 248, 0.05)";
|
|
1429
|
-
node.dispatchEvent(new (0,
|
|
1414
|
+
node.dispatchEvent(new (0, _chunkJ6NHSFIEjs.VectoJSEvent)("pointerleave", node, e, false));
|
|
1430
1415
|
});
|
|
1431
1416
|
const capEl = el;
|
|
1432
1417
|
const releasePointer = (event) => {
|
|
@@ -1442,32 +1427,32 @@ var Scene = (_class2 = class _Scene {
|
|
|
1442
1427
|
};
|
|
1443
1428
|
el.addEventListener("pointerdown", (e) => {
|
|
1444
1429
|
if (typeof capEl.setPointerCapture === "function") capEl.setPointerCapture(e.pointerId);
|
|
1445
|
-
node.dispatchEvent(new (0,
|
|
1430
|
+
node.dispatchEvent(new (0, _chunkJ6NHSFIEjs.VectoJSEvent)("pointerdown", node, e));
|
|
1446
1431
|
});
|
|
1447
1432
|
el.addEventListener("pointerup", (e) => {
|
|
1448
1433
|
releasePointer(e);
|
|
1449
|
-
node.dispatchEvent(new (0,
|
|
1434
|
+
node.dispatchEvent(new (0, _chunkJ6NHSFIEjs.VectoJSEvent)("pointerup", node, e));
|
|
1450
1435
|
});
|
|
1451
1436
|
el.addEventListener("pointercancel", (e) => {
|
|
1452
1437
|
releasePointer(e);
|
|
1453
|
-
node.dispatchEvent(new (0,
|
|
1438
|
+
node.dispatchEvent(new (0, _chunkJ6NHSFIEjs.VectoJSEvent)("pointercancel", node, e));
|
|
1454
1439
|
});
|
|
1455
1440
|
el.addEventListener(
|
|
1456
1441
|
"pointermove",
|
|
1457
|
-
(e) => node.dispatchEvent(new (0,
|
|
1442
|
+
(e) => node.dispatchEvent(new (0, _chunkJ6NHSFIEjs.VectoJSEvent)("pointermove", node, e))
|
|
1458
1443
|
);
|
|
1459
1444
|
el.addEventListener(
|
|
1460
1445
|
"wheel",
|
|
1461
1446
|
(e) => {
|
|
1462
|
-
node.dispatchEvent(new (0,
|
|
1447
|
+
node.dispatchEvent(new (0, _chunkJ6NHSFIEjs.VectoJSEvent)("wheel", node, e));
|
|
1463
1448
|
},
|
|
1464
1449
|
{ passive: false }
|
|
1465
1450
|
);
|
|
1466
1451
|
el.addEventListener("keydown", (e) => {
|
|
1467
|
-
node.dispatchEvent(new (0,
|
|
1452
|
+
node.dispatchEvent(new (0, _chunkJ6NHSFIEjs.VectoJSEvent)("keydown", node, e));
|
|
1468
1453
|
});
|
|
1469
1454
|
el.addEventListener("keyup", (e) => {
|
|
1470
|
-
node.dispatchEvent(new (0,
|
|
1455
|
+
node.dispatchEvent(new (0, _chunkJ6NHSFIEjs.VectoJSEvent)("keyup", node, e));
|
|
1471
1456
|
});
|
|
1472
1457
|
if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {
|
|
1473
1458
|
const input = el;
|
|
@@ -1527,7 +1512,7 @@ var Scene = (_class2 = class _Scene {
|
|
|
1527
1512
|
el.addEventListener("keydown", (e) => {
|
|
1528
1513
|
if (e.key === "Enter" || e.key === " ") {
|
|
1529
1514
|
e.preventDefault();
|
|
1530
|
-
node.dispatchEvent(new (0,
|
|
1515
|
+
node.dispatchEvent(new (0, _chunkJ6NHSFIEjs.VectoJSEvent)("click", node, e));
|
|
1531
1516
|
}
|
|
1532
1517
|
});
|
|
1533
1518
|
}
|
|
@@ -1661,6 +1646,56 @@ var Scene = (_class2 = class _Scene {
|
|
|
1661
1646
|
* hidden (`display: none`) so text-heavy scenes only materialize what is
|
|
1662
1647
|
* visible to the browser's text machinery anyway.
|
|
1663
1648
|
*/
|
|
1649
|
+
/**
|
|
1650
|
+
* Whether `node`'s world-space box, expanded by `margin` px on every side,
|
|
1651
|
+
* overlaps the scene viewport AND every `clipChildren` ancestor's box. Used
|
|
1652
|
+
* both to virtualize content projection (materialize only near-viewport text,
|
|
1653
|
+
* at `margin = contentProjectionMargin`) and for the exact `display:none`
|
|
1654
|
+
* visibility test (`margin = 0`). Boundless nodes (width/height 0) opt out of
|
|
1655
|
+
* culling and always count as visible, matching the legacy behavior.
|
|
1656
|
+
*/
|
|
1657
|
+
projectionBoxVisible(node, tf, margin) {
|
|
1658
|
+
if (!(node.width > 0 && node.height > 0)) return true;
|
|
1659
|
+
const { a, b, c, d, e, f } = tf;
|
|
1660
|
+
const worldCorners = [];
|
|
1661
|
+
let minX = Infinity;
|
|
1662
|
+
let minY = Infinity;
|
|
1663
|
+
let maxX = -Infinity;
|
|
1664
|
+
let maxY = -Infinity;
|
|
1665
|
+
for (let i = 0; i < 4; i++) {
|
|
1666
|
+
const lx = i & 1 ? node.width : 0;
|
|
1667
|
+
const ly = i & 2 ? node.height : 0;
|
|
1668
|
+
const wx = a * lx + c * ly + e;
|
|
1669
|
+
const wy = b * lx + d * ly + f;
|
|
1670
|
+
worldCorners.push({ x: wx, y: wy });
|
|
1671
|
+
if (wx < minX) minX = wx;
|
|
1672
|
+
if (wx > maxX) maxX = wx;
|
|
1673
|
+
if (wy < minY) minY = wy;
|
|
1674
|
+
if (wy > maxY) maxY = wy;
|
|
1675
|
+
}
|
|
1676
|
+
if (!(maxX >= -margin && minX <= this.width + margin && maxY >= -margin && minY <= this.height + margin)) {
|
|
1677
|
+
return false;
|
|
1678
|
+
}
|
|
1679
|
+
for (let ancestor = node.parent; ancestor; ancestor = ancestor.parent) {
|
|
1680
|
+
if (!ancestor.clipChildren || ancestor.width <= 0 || ancestor.height <= 0) continue;
|
|
1681
|
+
let localMinX = Infinity;
|
|
1682
|
+
let localMinY = Infinity;
|
|
1683
|
+
let localMaxX = -Infinity;
|
|
1684
|
+
let localMaxY = -Infinity;
|
|
1685
|
+
for (const corner of worldCorners) {
|
|
1686
|
+
const local = ancestor.worldToLocal(corner.x, corner.y);
|
|
1687
|
+
if (!local) continue;
|
|
1688
|
+
localMinX = Math.min(localMinX, local.x);
|
|
1689
|
+
localMinY = Math.min(localMinY, local.y);
|
|
1690
|
+
localMaxX = Math.max(localMaxX, local.x);
|
|
1691
|
+
localMaxY = Math.max(localMaxY, local.y);
|
|
1692
|
+
}
|
|
1693
|
+
if (!(localMaxX >= -margin && localMinX <= ancestor.width + margin && localMaxY >= -margin && localMinY <= ancestor.height + margin)) {
|
|
1694
|
+
return false;
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
return true;
|
|
1698
|
+
}
|
|
1664
1699
|
syncContentProjection(node) {
|
|
1665
1700
|
if (!this.contentProjectionEnabled || !this.a11yRoot) return;
|
|
1666
1701
|
const projection = node.getContentProjection();
|
|
@@ -1674,6 +1709,17 @@ var Scene = (_class2 = class _Scene {
|
|
|
1674
1709
|
}
|
|
1675
1710
|
return;
|
|
1676
1711
|
}
|
|
1712
|
+
const worldTf = node.getWorldTransform();
|
|
1713
|
+
const margin = _nullishCoalesce(this.contentProjectionMargin, () => ( this.height));
|
|
1714
|
+
if (Number.isFinite(margin) && !this.projectionBoxVisible(node, worldTf, margin)) {
|
|
1715
|
+
if (el) {
|
|
1716
|
+
this.clearContentGridState(node.id, el);
|
|
1717
|
+
el.remove();
|
|
1718
|
+
this.contentElements.delete(node.id);
|
|
1719
|
+
this.a11yNeedsReorder = true;
|
|
1720
|
+
}
|
|
1721
|
+
return;
|
|
1722
|
+
}
|
|
1677
1723
|
if (!el) {
|
|
1678
1724
|
el = document.createElement("div");
|
|
1679
1725
|
el.setAttribute("data-vecto-content", node.id);
|
|
@@ -1690,7 +1736,7 @@ var Scene = (_class2 = class _Scene {
|
|
|
1690
1736
|
el.addEventListener(
|
|
1691
1737
|
"wheel",
|
|
1692
1738
|
(e2) => {
|
|
1693
|
-
node.dispatchEvent(new (0,
|
|
1739
|
+
node.dispatchEvent(new (0, _chunkJ6NHSFIEjs.VectoJSEvent)("wheel", node, e2));
|
|
1694
1740
|
},
|
|
1695
1741
|
{ passive: false }
|
|
1696
1742
|
);
|
|
@@ -1721,7 +1767,7 @@ var Scene = (_class2 = class _Scene {
|
|
|
1721
1767
|
lineElement.style.position = "absolute";
|
|
1722
1768
|
lineElement.dir = "auto";
|
|
1723
1769
|
lineElement.style.left = `${line.x}px`;
|
|
1724
|
-
lineElement.style.top = `${line.y + line.baseline -
|
|
1770
|
+
lineElement.style.top = `${line.y + line.baseline - _text.cssLineBoxBaseline.call(void 0, lineFont, lineHeight2)}px`;
|
|
1725
1771
|
lineElement.style.whiteSpace = "pre";
|
|
1726
1772
|
if (lineFont) lineElement.style.font = lineFont;
|
|
1727
1773
|
lineElement.style.lineHeight = `${lineHeight2}px`;
|
|
@@ -1770,52 +1816,17 @@ var Scene = (_class2 = class _Scene {
|
|
|
1770
1816
|
el.style.userSelect = selectable ? "text" : "none";
|
|
1771
1817
|
el.style.cursor = selectable ? "text" : "";
|
|
1772
1818
|
}
|
|
1773
|
-
const { a, b, c, d, e, f } =
|
|
1819
|
+
const { a, b, c, d, e, f } = worldTf;
|
|
1774
1820
|
const contentX = _nullishCoalesce(projection.contentX, () => ( 0));
|
|
1775
1821
|
const contentY = _nullishCoalesce(projection.contentY, () => ( 0));
|
|
1776
|
-
const baselineOffset = lines && lines.length > 0 ? 0 : projection.baseline === void 0 ? 0 : projection.baseline -
|
|
1822
|
+
const baselineOffset = lines && lines.length > 0 ? 0 : projection.baseline === void 0 ? 0 : projection.baseline - _text.cssLineBoxBaseline.call(void 0, font, _nullishCoalesce(projection.lineHeight, () => ( 16)));
|
|
1777
1823
|
const localY = contentY + baselineOffset;
|
|
1778
1824
|
el.style.left = `${e + a * contentX + c * localY}px`;
|
|
1779
1825
|
el.style.top = `${f + b * contentX + d * localY}px`;
|
|
1780
1826
|
if (node.width > 0) el.style.width = `${node.width}px`;
|
|
1781
1827
|
if (node.height > 0) el.style.height = `${node.height}px`;
|
|
1782
1828
|
el.style.transform = `matrix(${a}, ${b}, ${c}, ${d}, 0, 0)`;
|
|
1783
|
-
|
|
1784
|
-
if (node.width > 0 && node.height > 0) {
|
|
1785
|
-
const worldCorners = [];
|
|
1786
|
-
let minX = Infinity;
|
|
1787
|
-
let minY = Infinity;
|
|
1788
|
-
let maxX = -Infinity;
|
|
1789
|
-
let maxY = -Infinity;
|
|
1790
|
-
for (let i = 0; i < 4; i++) {
|
|
1791
|
-
const lx = i & 1 ? node.width : 0;
|
|
1792
|
-
const ly = i & 2 ? node.height : 0;
|
|
1793
|
-
const wx = a * lx + c * ly + e;
|
|
1794
|
-
const wy = b * lx + d * ly + f;
|
|
1795
|
-
worldCorners.push({ x: wx, y: wy });
|
|
1796
|
-
if (wx < minX) minX = wx;
|
|
1797
|
-
if (wx > maxX) maxX = wx;
|
|
1798
|
-
if (wy < minY) minY = wy;
|
|
1799
|
-
if (wy > maxY) maxY = wy;
|
|
1800
|
-
}
|
|
1801
|
-
visible = maxX >= 0 && minX <= this.width && maxY >= 0 && minY <= this.height;
|
|
1802
|
-
for (let ancestor = node.parent; visible && ancestor; ancestor = ancestor.parent) {
|
|
1803
|
-
if (!ancestor.clipChildren || ancestor.width <= 0 || ancestor.height <= 0) continue;
|
|
1804
|
-
let localMinX = Infinity;
|
|
1805
|
-
let localMinY = Infinity;
|
|
1806
|
-
let localMaxX = -Infinity;
|
|
1807
|
-
let localMaxY = -Infinity;
|
|
1808
|
-
for (const corner of worldCorners) {
|
|
1809
|
-
const local = ancestor.worldToLocal(corner.x, corner.y);
|
|
1810
|
-
if (!local) continue;
|
|
1811
|
-
localMinX = Math.min(localMinX, local.x);
|
|
1812
|
-
localMinY = Math.min(localMinY, local.y);
|
|
1813
|
-
localMaxX = Math.max(localMaxX, local.x);
|
|
1814
|
-
localMaxY = Math.max(localMaxY, local.y);
|
|
1815
|
-
}
|
|
1816
|
-
visible = localMaxX >= 0 && localMinX <= ancestor.width && localMaxY >= 0 && localMinY <= ancestor.height;
|
|
1817
|
-
}
|
|
1818
|
-
}
|
|
1829
|
+
const visible = this.projectionBoxVisible(node, worldTf, 0);
|
|
1819
1830
|
const display = visible ? "" : "none";
|
|
1820
1831
|
if (el.style.display !== display) el.style.display = display;
|
|
1821
1832
|
}
|
|
@@ -1845,7 +1856,7 @@ var Scene = (_class2 = class _Scene {
|
|
|
1845
1856
|
lineElement.dataset.vectoGridLine = `${lineIndex}`;
|
|
1846
1857
|
lineElement.style.position = "absolute";
|
|
1847
1858
|
lineElement.style.left = `${_nullishCoalesce(_optionalChain([projectedLine, 'optionalAccess', _78 => _78.x]), () => ( 0))}px`;
|
|
1848
|
-
lineElement.style.top = `${(_nullishCoalesce(_optionalChain([projectedLine, 'optionalAccess', _79 => _79.y]), () => ( lineIndex * grid.lineHeight))) + baseline -
|
|
1859
|
+
lineElement.style.top = `${(_nullishCoalesce(_optionalChain([projectedLine, 'optionalAccess', _79 => _79.y]), () => ( lineIndex * grid.lineHeight))) + baseline - _text.cssLineBoxBaseline.call(void 0, lineFont, lineHeight)}px`;
|
|
1849
1860
|
lineElement.style.width = `${gridLine.width}px`;
|
|
1850
1861
|
lineElement.style.height = `${lineHeight}px`;
|
|
1851
1862
|
lineElement.style.whiteSpace = "pre";
|
|
@@ -2459,7 +2470,7 @@ var Scene = (_class2 = class _Scene {
|
|
|
2459
2470
|
if (!walkHadAnimation && node.hasPendingAnimations()) walkHadAnimation = true;
|
|
2460
2471
|
if (!walkHadInteractive && node.interactive) walkHadInteractive = true;
|
|
2461
2472
|
if (this._devActive && this._devFrameCount % 120 === 0) {
|
|
2462
|
-
if (node.update !==
|
|
2473
|
+
if (node.update !== _chunkJ6NHSFIEjs.Entity.prototype.update && node.hasPendingAnimations === _chunkJ6NHSFIEjs.Entity.prototype.hasPendingAnimations) {
|
|
2463
2474
|
this._devWarn(
|
|
2464
2475
|
`Entity "${node.id}" overrides update() but not hasPendingAnimations(). Custom motion in update() without overriding hasPendingAnimations() causes the idle throttle to drop the animation to ~2fps. Override hasPendingAnimations() to return true while motion is in flight.`
|
|
2465
2476
|
);
|
|
@@ -2808,29 +2819,33 @@ var Scene = (_class2 = class _Scene {
|
|
|
2808
2819
|
}, _class2.__initStatic(), _class2.__initStatic2(), _class2.__initStatic3(), _class2);
|
|
2809
2820
|
|
|
2810
2821
|
// src/components/TextEntity.ts
|
|
2822
|
+
|
|
2823
|
+
|
|
2824
|
+
|
|
2825
|
+
var _layout = require('@vectojs/layout'); _createStarExport(_layout);
|
|
2811
2826
|
var sharedMeasurer;
|
|
2812
2827
|
function defaultMeasurer() {
|
|
2813
|
-
if (sharedMeasurer === void 0) sharedMeasurer =
|
|
2828
|
+
if (sharedMeasurer === void 0) sharedMeasurer = _layout.createCanvasMeasurer.call(void 0, "sans-serif");
|
|
2814
2829
|
return sharedMeasurer;
|
|
2815
2830
|
}
|
|
2816
|
-
var TextEntity = (_class3 = class extends
|
|
2831
|
+
var TextEntity = (_class3 = class extends _chunkJ6NHSFIEjs.Entity {
|
|
2817
2832
|
|
|
2818
2833
|
|
|
2819
2834
|
|
|
2820
2835
|
|
|
2821
|
-
|
|
2836
|
+
__init71() {this.nodes = []}
|
|
2822
2837
|
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2838
|
+
__init72() {this.fillStyle = "#94a3b8"}
|
|
2839
|
+
__init73() {this.strokeStyle = null}
|
|
2840
|
+
__init74() {this.hoveredFillStyle = "#ffffff"}
|
|
2841
|
+
__init75() {this.lineWidth = 1}
|
|
2842
|
+
__init76() {this.isHovered = false}
|
|
2828
2843
|
constructor(text, atlas, maxWidth, fontSize = 24) {
|
|
2829
|
-
super();_class3.prototype.
|
|
2844
|
+
super();_class3.prototype.__init71.call(this);_class3.prototype.__init72.call(this);_class3.prototype.__init73.call(this);_class3.prototype.__init74.call(this);_class3.prototype.__init75.call(this);_class3.prototype.__init76.call(this);;
|
|
2830
2845
|
this.text = text;
|
|
2831
2846
|
this.atlas = atlas;
|
|
2832
2847
|
this.fontSize = fontSize;
|
|
2833
|
-
this.layout = new (0,
|
|
2848
|
+
this.layout = new (0, _layout.LayoutEngine)(maxWidth, 1e4, defaultMeasurer());
|
|
2834
2849
|
this.prepared = this.layout.prepare(this.text, this.atlas, this.fontSize);
|
|
2835
2850
|
this.applyLayout();
|
|
2836
2851
|
this.interactive = true;
|
|
@@ -2939,17 +2954,17 @@ var TextEntity = (_class3 = class extends _chunk2Z23LTH3js.Entity {
|
|
|
2939
2954
|
}, _class3);
|
|
2940
2955
|
|
|
2941
2956
|
// src/components/GridTextEntity.ts
|
|
2942
|
-
var GridTextEntity = (_class4 = class extends
|
|
2957
|
+
var GridTextEntity = (_class4 = class extends _chunkJ6NHSFIEjs.Entity {
|
|
2943
2958
|
|
|
2944
|
-
|
|
2945
|
-
|
|
2959
|
+
__init77() {this.fillStyle = "#ffffff"}
|
|
2960
|
+
__init78() {this.grid = []}
|
|
2946
2961
|
// Array of rows
|
|
2947
|
-
|
|
2948
|
-
|
|
2962
|
+
__init79() {this.cols = 0}
|
|
2963
|
+
__init80() {this.rows = 0}
|
|
2949
2964
|
|
|
2950
2965
|
|
|
2951
2966
|
constructor(_atlas, fontSize = 10) {
|
|
2952
|
-
super();_class4.prototype.
|
|
2967
|
+
super();_class4.prototype.__init77.call(this);_class4.prototype.__init78.call(this);_class4.prototype.__init79.call(this);_class4.prototype.__init80.call(this);;
|
|
2953
2968
|
this.fontSize = fontSize;
|
|
2954
2969
|
this.charWidth = fontSize * 1;
|
|
2955
2970
|
this.charHeight = fontSize * 1.1;
|
|
@@ -3033,7 +3048,7 @@ function distSqToSegment(px, py, x1, y1, x2, y2) {
|
|
|
3033
3048
|
const ey = py - cy;
|
|
3034
3049
|
return ex * ex + ey * ey;
|
|
3035
3050
|
}
|
|
3036
|
-
var SplineEntity = (_class5 = class extends
|
|
3051
|
+
var SplineEntity = (_class5 = class extends _chunkJ6NHSFIEjs.Entity {
|
|
3037
3052
|
|
|
3038
3053
|
|
|
3039
3054
|
|
|
@@ -3041,23 +3056,23 @@ var SplineEntity = (_class5 = class extends _chunk2Z23LTH3js.Entity {
|
|
|
3041
3056
|
|
|
3042
3057
|
|
|
3043
3058
|
|
|
3044
|
-
|
|
3045
|
-
|
|
3059
|
+
__init81() {this.offscreen = null}
|
|
3060
|
+
__init82() {this.baked = false}
|
|
3046
3061
|
/** Logical (CSS-pixel) size of the baked bitmap — the blit destination size. */
|
|
3047
|
-
|
|
3048
|
-
|
|
3062
|
+
__init83() {this.bakedWidth = 0}
|
|
3063
|
+
__init84() {this.bakedHeight = 0}
|
|
3049
3064
|
/** Gradient strokes can't be baked to a solid-color bitmap; they render per-frame. */
|
|
3050
3065
|
|
|
3051
3066
|
/** Lazily-flattened polylines (one Float32Array of [x,y,...] per segment) for hit-testing. */
|
|
3052
|
-
|
|
3067
|
+
__init85() {this.polylines = null}
|
|
3053
3068
|
/**
|
|
3054
3069
|
* When `true`, the renderer draws a rounded-rect outline of the entity's
|
|
3055
3070
|
* local bounds after painting the curves. Useful for drag feedback and
|
|
3056
3071
|
* debugging hit areas. Defaults to `false`.
|
|
3057
3072
|
*/
|
|
3058
|
-
|
|
3073
|
+
__init86() {this.showBounds = false}
|
|
3059
3074
|
constructor(doc, opts = {}) {
|
|
3060
|
-
super();_class5.prototype.
|
|
3075
|
+
super();_class5.prototype.__init81.call(this);_class5.prototype.__init82.call(this);_class5.prototype.__init83.call(this);_class5.prototype.__init84.call(this);_class5.prototype.__init85.call(this);_class5.prototype.__init86.call(this);;
|
|
3061
3076
|
this.doc = doc;
|
|
3062
3077
|
this.lineWidth = _nullishCoalesce(opts.lineWidth, () => ( 2));
|
|
3063
3078
|
this.cache = _nullishCoalesce(opts.cache, () => ( true));
|
|
@@ -3308,7 +3323,7 @@ async function loadSpline(url) {
|
|
|
3308
3323
|
}
|
|
3309
3324
|
|
|
3310
3325
|
// src/components/Rect.ts
|
|
3311
|
-
var Rect = class extends
|
|
3326
|
+
var Rect = class extends _chunkJ6NHSFIEjs.Entity {
|
|
3312
3327
|
|
|
3313
3328
|
|
|
3314
3329
|
|
|
@@ -3357,7 +3372,7 @@ var Rect = class extends _chunk2Z23LTH3js.Entity {
|
|
|
3357
3372
|
};
|
|
3358
3373
|
|
|
3359
3374
|
// src/components/Circle.ts
|
|
3360
|
-
var Circle = class extends
|
|
3375
|
+
var Circle = class extends _chunkJ6NHSFIEjs.Entity {
|
|
3361
3376
|
|
|
3362
3377
|
|
|
3363
3378
|
|
|
@@ -3417,7 +3432,7 @@ var Circle = class extends _chunk2Z23LTH3js.Entity {
|
|
|
3417
3432
|
};
|
|
3418
3433
|
|
|
3419
3434
|
// src/components/Group.ts
|
|
3420
|
-
var Group = class extends
|
|
3435
|
+
var Group = class extends _chunkJ6NHSFIEjs.Entity {
|
|
3421
3436
|
constructor(...children) {
|
|
3422
3437
|
super();
|
|
3423
3438
|
if (children.length > 0) this.add(...children);
|
|
@@ -3429,115 +3444,27 @@ var Group = class extends _chunk2Z23LTH3js.Entity {
|
|
|
3429
3444
|
}
|
|
3430
3445
|
};
|
|
3431
3446
|
|
|
3432
|
-
// src/
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
constructor(cellSize = 64) {;_class6.prototype.__init86.call(this);_class6.prototype.__init87.call(this);
|
|
3438
|
-
this.cellSize = cellSize;
|
|
3439
|
-
}
|
|
3440
|
-
hash(cx, cy) {
|
|
3441
|
-
const x = cx < 0 ? -2 * cx - 1 : 2 * cx;
|
|
3442
|
-
const y = cy < 0 ? -2 * cy - 1 : 2 * cy;
|
|
3443
|
-
return (x + y) * (x + y + 1) / 2 + y;
|
|
3444
|
-
}
|
|
3445
|
-
cellsForAABB(x, y, w, h) {
|
|
3446
|
-
const minCx = Math.floor(x / this.cellSize);
|
|
3447
|
-
const minCy = Math.floor(y / this.cellSize);
|
|
3448
|
-
const maxCx = Math.floor((x + w) / this.cellSize);
|
|
3449
|
-
const maxCy = Math.floor((y + h) / this.cellSize);
|
|
3450
|
-
const keys = [];
|
|
3451
|
-
for (let cx = minCx; cx <= maxCx; cx++) {
|
|
3452
|
-
for (let cy = minCy; cy <= maxCy; cy++) {
|
|
3453
|
-
keys.push(this.hash(cx, cy));
|
|
3454
|
-
}
|
|
3455
|
-
}
|
|
3456
|
-
return keys;
|
|
3457
|
-
}
|
|
3458
|
-
/**
|
|
3459
|
-
* Insert or update an entity's axis-aligned bounding box in the grid.
|
|
3460
|
-
*
|
|
3461
|
-
* If the entity is already registered its old cell memberships are removed
|
|
3462
|
-
* before the new ones are computed, so this method is safe to call every
|
|
3463
|
-
* frame.
|
|
3464
|
-
*
|
|
3465
|
-
* @param id - Unique string identifier for the entity.
|
|
3466
|
-
* @param x - Left edge of the AABB in world space.
|
|
3467
|
-
* @param y - Top edge of the AABB in world space.
|
|
3468
|
-
* @param w - Width of the AABB.
|
|
3469
|
-
* @param h - Height of the AABB.
|
|
3470
|
-
*/
|
|
3471
|
-
insert(id, x, y, w, h) {
|
|
3472
|
-
this.remove(id);
|
|
3473
|
-
const keys = this.cellsForAABB(x, y, w, h);
|
|
3474
|
-
this.entityCells.set(id, keys);
|
|
3475
|
-
for (const key of keys) {
|
|
3476
|
-
if (!this.grid.has(key)) this.grid.set(key, /* @__PURE__ */ new Set());
|
|
3477
|
-
this.grid.get(key).add(id);
|
|
3478
|
-
}
|
|
3479
|
-
}
|
|
3480
|
-
/**
|
|
3481
|
-
* Remove an entity from all grid cells it currently occupies.
|
|
3482
|
-
*
|
|
3483
|
-
* Silently does nothing if the entity is not registered.
|
|
3484
|
-
*
|
|
3485
|
-
* @param id - Unique string identifier of the entity to remove.
|
|
3486
|
-
*/
|
|
3487
|
-
remove(id) {
|
|
3488
|
-
const keys = this.entityCells.get(id);
|
|
3489
|
-
if (!keys) return;
|
|
3490
|
-
for (const key of keys) {
|
|
3491
|
-
_optionalChain([this, 'access', _119 => _119.grid, 'access', _120 => _120.get, 'call', _121 => _121(key), 'optionalAccess', _122 => _122.delete, 'call', _123 => _123(id)]);
|
|
3492
|
-
}
|
|
3493
|
-
this.entityCells.delete(id);
|
|
3494
|
-
}
|
|
3495
|
-
/**
|
|
3496
|
-
* Return all entity IDs whose grid cells overlap the given AABB.
|
|
3497
|
-
*
|
|
3498
|
-
* Time complexity: O(k) where k is the number of cells the query AABB spans
|
|
3499
|
-
* plus the number of results — O(1) average for small, similarly-sized entities.
|
|
3500
|
-
*
|
|
3501
|
-
* @param x - Left edge of the query AABB.
|
|
3502
|
-
* @param y - Top edge of the query AABB.
|
|
3503
|
-
* @param w - Width of the query AABB.
|
|
3504
|
-
* @param h - Height of the query AABB.
|
|
3505
|
-
* @returns A `Set` of entity ID strings whose cells intersect the query region.
|
|
3506
|
-
*/
|
|
3507
|
-
query(x, y, w, h) {
|
|
3508
|
-
const result = /* @__PURE__ */ new Set();
|
|
3509
|
-
for (const key of this.cellsForAABB(x, y, w, h)) {
|
|
3510
|
-
const cell = this.grid.get(key);
|
|
3511
|
-
if (cell) for (const id of cell) result.add(id);
|
|
3512
|
-
}
|
|
3513
|
-
return result;
|
|
3514
|
-
}
|
|
3515
|
-
/**
|
|
3516
|
-
* Clear all cells and entity registrations, resetting the grid to an empty state.
|
|
3517
|
-
*
|
|
3518
|
-
* Call once per frame before re-inserting all dynamic entities.
|
|
3519
|
-
*/
|
|
3520
|
-
clear() {
|
|
3521
|
-
this.grid.clear();
|
|
3522
|
-
this.entityCells.clear();
|
|
3523
|
-
}
|
|
3524
|
-
}, _class6);
|
|
3447
|
+
// src/index.ts
|
|
3448
|
+
|
|
3449
|
+
|
|
3450
|
+
var _math = require('@vectojs/math'); _createStarExport(_math);
|
|
3451
|
+
var _animation = require('@vectojs/animation'); _createStarExport(_animation);
|
|
3525
3452
|
|
|
3526
3453
|
// src/tree/DOMPortalEntity.ts
|
|
3527
|
-
var DOMPortalEntity = (
|
|
3454
|
+
var DOMPortalEntity = (_class6 = class extends _chunkJ6NHSFIEjs.Entity {
|
|
3528
3455
|
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3456
|
+
__init87() {this.isDOMPortal = true}
|
|
3457
|
+
__init88() {this.domListeners = []}
|
|
3458
|
+
__init89() {this.resizeObserver = null}
|
|
3459
|
+
__init90() {this.cachedWidth = 100}
|
|
3460
|
+
__init91() {this.cachedHeight = 100}
|
|
3461
|
+
__init92() {this.lastWidth = ""}
|
|
3462
|
+
__init93() {this.lastHeight = ""}
|
|
3463
|
+
__init94() {this.lastTransform = ""}
|
|
3464
|
+
__init95() {this.lastZIndex = ""}
|
|
3465
|
+
__init96() {this.lastOpacity = ""}
|
|
3539
3466
|
constructor(domElement, width, height, id) {
|
|
3540
|
-
super(id);
|
|
3467
|
+
super(id);_class6.prototype.__init87.call(this);_class6.prototype.__init88.call(this);_class6.prototype.__init89.call(this);_class6.prototype.__init90.call(this);_class6.prototype.__init91.call(this);_class6.prototype.__init92.call(this);_class6.prototype.__init93.call(this);_class6.prototype.__init94.call(this);_class6.prototype.__init95.call(this);_class6.prototype.__init96.call(this);;
|
|
3541
3468
|
this.domElement = domElement;
|
|
3542
3469
|
this.width = _nullishCoalesce(width, () => ( 0));
|
|
3543
3470
|
this.height = _nullishCoalesce(height, () => ( 0));
|
|
@@ -3566,7 +3493,7 @@ var DOMPortalEntity = (_class7 = class extends _chunk2Z23LTH3js.Entity {
|
|
|
3566
3493
|
];
|
|
3567
3494
|
for (const type of events) {
|
|
3568
3495
|
const handler = (e) => {
|
|
3569
|
-
this.dispatchEvent(new (0,
|
|
3496
|
+
this.dispatchEvent(new (0, _chunkJ6NHSFIEjs.VectoJSEvent)(type, this, e));
|
|
3570
3497
|
};
|
|
3571
3498
|
this.domElement.addEventListener(type, handler);
|
|
3572
3499
|
this.domListeners.push({ type, handler, capture: false });
|
|
@@ -3577,7 +3504,7 @@ var DOMPortalEntity = (_class7 = class extends _chunk2Z23LTH3js.Entity {
|
|
|
3577
3504
|
];
|
|
3578
3505
|
for (const { native, vecto } of hoverEvents) {
|
|
3579
3506
|
const handler = (e) => {
|
|
3580
|
-
this.dispatchEvent(new (0,
|
|
3507
|
+
this.dispatchEvent(new (0, _chunkJ6NHSFIEjs.VectoJSEvent)(vecto, this, e, false));
|
|
3581
3508
|
};
|
|
3582
3509
|
this.domElement.addEventListener(native, handler);
|
|
3583
3510
|
this.domListeners.push({ type: native, handler, capture: false });
|
|
@@ -3585,7 +3512,7 @@ var DOMPortalEntity = (_class7 = class extends _chunk2Z23LTH3js.Entity {
|
|
|
3585
3512
|
const focusEvents = ["focus", "blur"];
|
|
3586
3513
|
for (const type of focusEvents) {
|
|
3587
3514
|
const handler = (e) => {
|
|
3588
|
-
this.dispatchEvent(new (0,
|
|
3515
|
+
this.dispatchEvent(new (0, _chunkJ6NHSFIEjs.VectoJSEvent)(type, this, e, true));
|
|
3589
3516
|
};
|
|
3590
3517
|
this.domElement.addEventListener(type, handler, true);
|
|
3591
3518
|
this.domListeners.push({ type, handler, capture: true });
|
|
@@ -3621,7 +3548,7 @@ var DOMPortalEntity = (_class7 = class extends _chunk2Z23LTH3js.Entity {
|
|
|
3621
3548
|
}
|
|
3622
3549
|
super.destroy();
|
|
3623
3550
|
}
|
|
3624
|
-
},
|
|
3551
|
+
}, _class6);
|
|
3625
3552
|
|
|
3626
3553
|
// src/index.ts
|
|
3627
3554
|
Scene.registerWebGLPointRendererCreator(_chunkBEUIB3U7js.createWebGLPointRenderer);
|
|
@@ -3660,21 +3587,4 @@ Scene.registerWebGPUParticleSystemManager(_chunkBEUIB3U7js.WebGPUParticleSystemM
|
|
|
3660
3587
|
|
|
3661
3588
|
|
|
3662
3589
|
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
exports.ArabicShaper = _chunk4AR425ARjs.ArabicShaper; exports.BidiResolver = _chunk4AR425ARjs.BidiResolver; exports.CanvasRenderer = _chunkBEUIB3U7js.CanvasRenderer; exports.Circle = Circle; exports.ComputeParticleEntity = ComputeParticleEntity; exports.DOMPortalEntity = DOMPortalEntity; exports.Easing = _chunk2Z23LTH3js.Easing; exports.Entity = _chunk2Z23LTH3js.Entity; exports.GridTextEntity = GridTextEntity; exports.Group = Group; exports.LayoutEngine = _chunkBA5HUUDFjs.LayoutEngine; exports.LayoutResultBuffer = _chunkBA5HUUDFjs.LayoutResultBuffer; exports.LayoutWorkerManager = _chunk4AR425ARjs.LayoutWorkerManager; exports.MSDFFont = _chunk2Z23LTH3js.MSDFFont; exports.MSDFTextEntity = _chunk2Z23LTH3js.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.Rect = Rect; exports.SVGEntity = _chunk2Z23LTH3js.SVGEntity; exports.SVGRenderer = _chunkBEUIB3U7js.SVGRenderer; exports.Scene = Scene; exports.SpatialHashGrid = SpatialHashGrid; exports.SplineEntity = SplineEntity; exports.SpringDriver = _chunk2Z23LTH3js.SpringDriver; exports.SpringPhysics = _chunk2Z23LTH3js.SpringPhysics; exports.TextEntity = TextEntity; exports.TextRasterCache = _chunkBEUIB3U7js.TextRasterCache; exports.TweenDriver = _chunk2Z23LTH3js.TweenDriver; exports.VectoJSEvent = _chunk2Z23LTH3js.VectoJSEvent; exports.WebGPUParticleSystemManager = _chunkBEUIB3U7js.WebGPUParticleSystemManager; exports.clearCssLineBoxMetrics = _chunk2Z23LTH3js.clearCssLineBoxMetrics; exports.computeLineSegments = _chunkBA5HUUDFjs.computeLineSegments; exports.createCanvasMeasurer = _chunkBA5HUUDFjs.createCanvasMeasurer; exports.createWebGLPointRenderer = _chunkBEUIB3U7js.createWebGLPointRenderer; exports.cssLineBoxBaseline = _chunk2Z23LTH3js.cssLineBoxBaseline; exports.isSafeUrl = _chunkBEUIB3U7js.isSafeUrl; exports.isTweenConfig = _chunk2Z23LTH3js.isTweenConfig; exports.loadSpline = loadSpline; exports.parseColorToRGBA = _chunkBEUIB3U7js.parseColorToRGBA; exports.polySegmentToBezier = polySegmentToBezier; exports.prepareContentGrid = _chunk2Z23LTH3js.prepareContentGrid; exports.sanitizeUrl = _chunkBEUIB3U7js.sanitizeUrl;
|
|
3590
|
+
exports.CanvasRenderer = _chunkBEUIB3U7js.CanvasRenderer; exports.Circle = Circle; exports.ComputeParticleEntity = ComputeParticleEntity; exports.DOMPortalEntity = DOMPortalEntity; exports.Entity = _chunkJ6NHSFIEjs.Entity; exports.GridTextEntity = GridTextEntity; exports.Group = Group; exports.MSDFTextEntity = _chunkJ6NHSFIEjs.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.Rect = Rect; exports.SVGEntity = _chunkJ6NHSFIEjs.SVGEntity; exports.SVGRenderer = _chunkBEUIB3U7js.SVGRenderer; exports.Scene = Scene; exports.SplineEntity = SplineEntity; exports.TextEntity = TextEntity; exports.TextRasterCache = _chunkBEUIB3U7js.TextRasterCache; exports.VectoJSEvent = _chunkJ6NHSFIEjs.VectoJSEvent; exports.WebGPUParticleSystemManager = _chunkBEUIB3U7js.WebGPUParticleSystemManager; exports.createWebGLPointRenderer = _chunkBEUIB3U7js.createWebGLPointRenderer; exports.isSafeUrl = _chunkBEUIB3U7js.isSafeUrl; exports.loadSpline = loadSpline; exports.parseColorToRGBA = _chunkBEUIB3U7js.parseColorToRGBA; exports.polySegmentToBezier = polySegmentToBezier; exports.sanitizeUrl = _chunkBEUIB3U7js.sanitizeUrl;
|