@vectojs/core 0.1.0 → 0.2.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/animation/drivers.d.ts +48 -0
- package/dist/animation/easing.d.ts +16 -0
- package/dist/{chunk-53DAQC3U.js → chunk-W3SFIVXO.js} +356 -60
- package/dist/{chunk-M2IZPGOL.mjs → chunk-Y2N7TGEH.mjs} +303 -7
- package/dist/components/GridTextEntity.d.ts +15 -0
- package/dist/components/SplineEntity.d.ts +144 -0
- package/dist/components/TextEntity.d.ts +35 -0
- package/dist/index.d.ts +26 -577
- package/dist/index.js +60 -78
- package/dist/index.mjs +15 -33
- package/dist/{layout.d.mts → layout/LayoutEngine.d.ts} +15 -70
- package/dist/layout/LayoutWorker.d.ts +23 -0
- package/dist/layout/LayoutWorkerManager.d.ts +22 -0
- package/dist/layout/LayoutWorkerSource.d.ts +1 -0
- package/dist/layout/index.d.ts +3 -0
- package/dist/layout/measure.d.ts +20 -0
- package/dist/math/SpatialHashGrid.d.ts +53 -0
- package/dist/math/SpringPhysics.d.ts +13 -0
- package/dist/renderer/CanvasRenderer.d.ts +81 -0
- package/dist/renderer/IRenderer.d.ts +178 -0
- package/dist/renderer/SVGRenderer.d.ts +69 -0
- package/dist/renderer/WebGLPointRenderer.d.ts +62 -0
- package/dist/renderer/WebGPUParticleSystemManager.d.ts +14 -0
- package/dist/renderer/colorParse.d.ts +17 -0
- package/dist/renderer/index.d.ts +6 -0
- package/dist/text/ArabicShaper.d.ts +10 -0
- package/dist/text/BidiResolver.d.ts +6 -0
- package/dist/{text.d.ts → text/MSDFFont.d.ts} +10 -82
- package/dist/text/MSDFTextEntity.d.ts +30 -0
- package/dist/text/SVGEntity.d.ts +22 -0
- package/dist/text/index.d.ts +5 -0
- package/dist/text.js +2 -2
- package/dist/text.mjs +1 -1
- package/dist/tree/ComputeParticleEntity.d.ts +118 -0
- package/dist/tree/DOMPortalEntity.d.ts +18 -0
- package/dist/{Entity-D-rfAFCf.d.mts → tree/Entity.d.ts} +59 -197
- package/dist/tree/Scene.d.ts +295 -0
- package/package.json +5 -5
- package/dist/Entity-D-rfAFCf.d.ts +0 -572
- package/dist/index-ByBDSmMK.d.mts +0 -365
- package/dist/index-C3Fd_XmG.d.ts +0 -365
- package/dist/index.d.mts +0 -577
- package/dist/layout.d.ts +0 -319
- package/dist/renderer.d.mts +0 -2
- package/dist/renderer.d.ts +0 -2
- package/dist/text.d.mts +0 -201
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7;
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
@@ -17,7 +17,12 @@ var _chunkLIX7DJTIjs = require('./chunk-LIX7DJTI.js');
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
var _chunkW3SFIVXOjs = require('./chunk-W3SFIVXO.js');
|
|
21
26
|
|
|
22
27
|
|
|
23
28
|
|
|
@@ -34,7 +39,7 @@ var PARTICLE_OFFSET_ORIGIN_X = 4;
|
|
|
34
39
|
var PARTICLE_OFFSET_ORIGIN_Y = 5;
|
|
35
40
|
var PARTICLE_OFFSET_SIZE = 6;
|
|
36
41
|
var PARTICLE_OFFSET_LIFE = 7;
|
|
37
|
-
var ComputeParticleEntity = (_class = class extends
|
|
42
|
+
var ComputeParticleEntity = (_class = class extends _chunkW3SFIVXOjs.Entity {
|
|
38
43
|
|
|
39
44
|
|
|
40
45
|
|
|
@@ -323,6 +328,10 @@ var Scene = (_class2 = class _Scene {
|
|
|
323
328
|
__init12() {this.respectReducedMotion = true}
|
|
324
329
|
/** Cached media-query list; `.matches` is read live each frame. */
|
|
325
330
|
__init13() {this.reducedMotionQuery = null}
|
|
331
|
+
/** True when the OS asks for reduced motion and we respect it. Read by the animation drivers. */
|
|
332
|
+
get prefersReducedMotion() {
|
|
333
|
+
return this.respectReducedMotion && !!_optionalChain([this, 'access', _13 => _13.reducedMotionQuery, 'optionalAccess', _14 => _14.matches]);
|
|
334
|
+
}
|
|
326
335
|
/**
|
|
327
336
|
* Throttle interval (ms) for the a11y/automation shadow sync. `0` = every
|
|
328
337
|
* frame. See {@link SceneOptions.a11ySyncInterval}.
|
|
@@ -390,13 +399,13 @@ var Scene = (_class2 = class _Scene {
|
|
|
390
399
|
this.height = typeof window !== "undefined" ? window.innerHeight : canvas.clientHeight || canvas.height || 600;
|
|
391
400
|
}
|
|
392
401
|
const globalProcess = typeof globalThis !== "undefined" ? globalThis.process : void 0;
|
|
393
|
-
const isTest = globalProcess && (_optionalChain([globalProcess, 'access',
|
|
402
|
+
const isTest = globalProcess && (_optionalChain([globalProcess, 'access', _15 => _15.env, 'optionalAccess', _16 => _16.NODE_ENV]) === "test" || _optionalChain([globalProcess, 'access', _17 => _17.env, 'optionalAccess', _18 => _18.VITEST]) === "true");
|
|
394
403
|
this.maxFPS = _nullishCoalesce(options.maxFPS, () => ( (isTest ? 0 : 60)));
|
|
395
404
|
this.respectReducedMotion = _nullishCoalesce(options.respectReducedMotion, () => ( true));
|
|
396
405
|
this.particleBackend = _nullishCoalesce(options.particleBackend, () => ( "auto"));
|
|
397
406
|
this.a11ySyncInterval = _nullishCoalesce(options.a11ySyncInterval, () => ( 0));
|
|
398
407
|
this.reducedMotionQuery = typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia("(prefers-reduced-motion: reduce)") : null;
|
|
399
|
-
this.root = new class RootEntity extends
|
|
408
|
+
this.root = new class RootEntity extends _chunkW3SFIVXOjs.Entity {
|
|
400
409
|
isPointInside() {
|
|
401
410
|
return false;
|
|
402
411
|
}
|
|
@@ -405,7 +414,7 @@ var Scene = (_class2 = class _Scene {
|
|
|
405
414
|
}
|
|
406
415
|
}("root");
|
|
407
416
|
this.root._scene = this;
|
|
408
|
-
this.overlayRoot = new class OverlayRoot extends
|
|
417
|
+
this.overlayRoot = new class OverlayRoot extends _chunkW3SFIVXOjs.Entity {
|
|
409
418
|
isPointInside() {
|
|
410
419
|
return false;
|
|
411
420
|
}
|
|
@@ -568,12 +577,12 @@ var Scene = (_class2 = class _Scene {
|
|
|
568
577
|
this.canvas.removeEventListener("pointerleave", this.pointerLeaveListener);
|
|
569
578
|
}
|
|
570
579
|
}
|
|
571
|
-
_optionalChain([this, 'access',
|
|
572
|
-
_optionalChain([this, 'access',
|
|
580
|
+
_optionalChain([this, 'access', _19 => _19.a11yRoot, 'optionalAccess', _20 => _20.remove, 'call', _21 => _21()]);
|
|
581
|
+
_optionalChain([this, 'access', _22 => _22.portalRoot, 'optionalAccess', _23 => _23.remove, 'call', _24 => _24()]);
|
|
573
582
|
this.a11yElements.clear();
|
|
574
|
-
_optionalChain([this, 'access',
|
|
575
|
-
_optionalChain([this, 'access',
|
|
576
|
-
_optionalChain([this, 'access',
|
|
583
|
+
_optionalChain([this, 'access', _25 => _25.pointRenderer, 'optionalAccess', _26 => _26.destroy, 'call', _27 => _27()]);
|
|
584
|
+
_optionalChain([this, 'access', _28 => _28.glCanvas, 'optionalAccess', _29 => _29.remove, 'call', _30 => _30()]);
|
|
585
|
+
_optionalChain([this, 'access', _31 => _31.gpuCanvas, 'optionalAccess', _32 => _32.remove, 'call', _33 => _33()]);
|
|
577
586
|
this.gpuCanvas = null;
|
|
578
587
|
this.gpuContext = null;
|
|
579
588
|
if (this.recoveryTimerId) {
|
|
@@ -713,42 +722,42 @@ var Scene = (_class2 = class _Scene {
|
|
|
713
722
|
el.style.background = "transparent";
|
|
714
723
|
}
|
|
715
724
|
el.addEventListener("click", (e) => {
|
|
716
|
-
node.dispatchEvent(new (0,
|
|
725
|
+
node.dispatchEvent(new (0, _chunkW3SFIVXOjs.VectoJSEvent)("click", node, e));
|
|
717
726
|
});
|
|
718
727
|
el.addEventListener("mouseenter", (e) => {
|
|
719
728
|
if (this.debugA11y) el.style.backgroundColor = "rgba(56, 189, 248, 0.2)";
|
|
720
|
-
node.dispatchEvent(new (0,
|
|
729
|
+
node.dispatchEvent(new (0, _chunkW3SFIVXOjs.VectoJSEvent)("hover", node, e, false));
|
|
721
730
|
});
|
|
722
731
|
el.addEventListener("mouseleave", (e) => {
|
|
723
732
|
if (this.debugA11y) el.style.backgroundColor = "rgba(56, 189, 248, 0.05)";
|
|
724
|
-
node.dispatchEvent(new (0,
|
|
733
|
+
node.dispatchEvent(new (0, _chunkW3SFIVXOjs.VectoJSEvent)("pointerleave", node, e, false));
|
|
725
734
|
});
|
|
726
735
|
const capEl = el;
|
|
727
736
|
el.addEventListener("pointerdown", (e) => {
|
|
728
737
|
if (typeof capEl.setPointerCapture === "function") capEl.setPointerCapture(e.pointerId);
|
|
729
|
-
node.dispatchEvent(new (0,
|
|
738
|
+
node.dispatchEvent(new (0, _chunkW3SFIVXOjs.VectoJSEvent)("pointerdown", node, e));
|
|
730
739
|
});
|
|
731
740
|
el.addEventListener("pointerup", (e) => {
|
|
732
741
|
if (typeof capEl.releasePointerCapture === "function")
|
|
733
742
|
capEl.releasePointerCapture(e.pointerId);
|
|
734
|
-
node.dispatchEvent(new (0,
|
|
743
|
+
node.dispatchEvent(new (0, _chunkW3SFIVXOjs.VectoJSEvent)("pointerup", node, e));
|
|
735
744
|
});
|
|
736
745
|
el.addEventListener(
|
|
737
746
|
"pointermove",
|
|
738
|
-
(e) => node.dispatchEvent(new (0,
|
|
747
|
+
(e) => node.dispatchEvent(new (0, _chunkW3SFIVXOjs.VectoJSEvent)("pointermove", node, e))
|
|
739
748
|
);
|
|
740
749
|
el.addEventListener(
|
|
741
750
|
"wheel",
|
|
742
751
|
(e) => {
|
|
743
|
-
node.dispatchEvent(new (0,
|
|
752
|
+
node.dispatchEvent(new (0, _chunkW3SFIVXOjs.VectoJSEvent)("wheel", node, e));
|
|
744
753
|
},
|
|
745
754
|
{ passive: false }
|
|
746
755
|
);
|
|
747
756
|
el.addEventListener("keydown", (e) => {
|
|
748
|
-
node.dispatchEvent(new (0,
|
|
757
|
+
node.dispatchEvent(new (0, _chunkW3SFIVXOjs.VectoJSEvent)("keydown", node, e));
|
|
749
758
|
});
|
|
750
759
|
el.addEventListener("keyup", (e) => {
|
|
751
|
-
node.dispatchEvent(new (0,
|
|
760
|
+
node.dispatchEvent(new (0, _chunkW3SFIVXOjs.VectoJSEvent)("keyup", node, e));
|
|
752
761
|
});
|
|
753
762
|
if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {
|
|
754
763
|
const input = el;
|
|
@@ -774,7 +783,7 @@ var Scene = (_class2 = class _Scene {
|
|
|
774
783
|
});
|
|
775
784
|
el.addEventListener("compositionupdate", (e) => {
|
|
776
785
|
const data = _nullishCoalesce(e.data, () => ( ""));
|
|
777
|
-
composition = { start: _nullishCoalesce(_optionalChain([composition, 'optionalAccess',
|
|
786
|
+
composition = { start: _nullishCoalesce(_optionalChain([composition, 'optionalAccess', _34 => _34.start]), () => ( 0)), length: data.length };
|
|
778
787
|
forward();
|
|
779
788
|
});
|
|
780
789
|
el.addEventListener("compositionend", () => {
|
|
@@ -820,7 +829,7 @@ var Scene = (_class2 = class _Scene {
|
|
|
820
829
|
el.addEventListener("keydown", (e) => {
|
|
821
830
|
if (e.key === "Enter" || e.key === " ") {
|
|
822
831
|
e.preventDefault();
|
|
823
|
-
node.dispatchEvent(new (0,
|
|
832
|
+
node.dispatchEvent(new (0, _chunkW3SFIVXOjs.VectoJSEvent)("click", node, e));
|
|
824
833
|
}
|
|
825
834
|
});
|
|
826
835
|
}
|
|
@@ -1073,7 +1082,7 @@ var Scene = (_class2 = class _Scene {
|
|
|
1073
1082
|
* (and {@link respectReducedMotion} is on). `0` means uncapped.
|
|
1074
1083
|
*/
|
|
1075
1084
|
effectiveMaxFPS() {
|
|
1076
|
-
const reduced = this.respectReducedMotion && !!_optionalChain([this, 'access',
|
|
1085
|
+
const reduced = this.respectReducedMotion && !!_optionalChain([this, 'access', _35 => _35.reducedMotionQuery, 'optionalAccess', _36 => _36.matches]);
|
|
1077
1086
|
if (reduced)
|
|
1078
1087
|
return this.maxFPS > 0 ? Math.min(this.maxFPS, REDUCED_MOTION_FPS) : REDUCED_MOTION_FPS;
|
|
1079
1088
|
return this.maxFPS;
|
|
@@ -1229,7 +1238,7 @@ var Scene = (_class2 = class _Scene {
|
|
|
1229
1238
|
renderer.clear();
|
|
1230
1239
|
const isMainRenderer = renderer === this.renderer;
|
|
1231
1240
|
if (isMainRenderer) {
|
|
1232
|
-
_optionalChain([this, 'access',
|
|
1241
|
+
_optionalChain([this, 'access', _37 => _37.pointRenderer, 'optionalAccess', _38 => _38.begin, 'call', _39 => _39()]);
|
|
1233
1242
|
}
|
|
1234
1243
|
const vw = this.width;
|
|
1235
1244
|
const vh = this.height;
|
|
@@ -1343,7 +1352,7 @@ var Scene = (_class2 = class _Scene {
|
|
|
1343
1352
|
this.reconcilePortals();
|
|
1344
1353
|
renderer.flush();
|
|
1345
1354
|
if (isMainRenderer) {
|
|
1346
|
-
_optionalChain([this, 'access',
|
|
1355
|
+
_optionalChain([this, 'access', _40 => _40.pointRenderer, 'optionalAccess', _41 => _41.flush, 'call', _42 => _42()]);
|
|
1347
1356
|
}
|
|
1348
1357
|
}
|
|
1349
1358
|
/**
|
|
@@ -1363,7 +1372,7 @@ var Scene = (_class2 = class _Scene {
|
|
|
1363
1372
|
if (typeof this.renderer.resize === "function") {
|
|
1364
1373
|
this.renderer.resize(width, height);
|
|
1365
1374
|
}
|
|
1366
|
-
_optionalChain([this, 'access',
|
|
1375
|
+
_optionalChain([this, 'access', _43 => _43.pointRenderer, 'optionalAccess', _44 => _44.resize, 'call', _45 => _45(width, height)]);
|
|
1367
1376
|
this.markDirty();
|
|
1368
1377
|
}
|
|
1369
1378
|
/**
|
|
@@ -1514,7 +1523,7 @@ function defaultMeasurer() {
|
|
|
1514
1523
|
if (sharedMeasurer === void 0) sharedMeasurer = _chunk72WVPMSJjs.createCanvasMeasurer.call(void 0, "sans-serif");
|
|
1515
1524
|
return sharedMeasurer;
|
|
1516
1525
|
}
|
|
1517
|
-
var TextEntity = (_class3 = class extends
|
|
1526
|
+
var TextEntity = (_class3 = class extends _chunkW3SFIVXOjs.Entity {
|
|
1518
1527
|
|
|
1519
1528
|
|
|
1520
1529
|
|
|
@@ -1613,7 +1622,7 @@ var TextEntity = (_class3 = class extends _chunk53DAQC3Ujs.Entity {
|
|
|
1613
1622
|
}, _class3);
|
|
1614
1623
|
|
|
1615
1624
|
// src/components/GridTextEntity.ts
|
|
1616
|
-
var GridTextEntity = (_class4 = class extends
|
|
1625
|
+
var GridTextEntity = (_class4 = class extends _chunkW3SFIVXOjs.Entity {
|
|
1617
1626
|
|
|
1618
1627
|
__init53() {this.fillStyle = "#ffffff"}
|
|
1619
1628
|
__init54() {this.grid = []}
|
|
@@ -1632,7 +1641,7 @@ var GridTextEntity = (_class4 = class extends _chunk53DAQC3Ujs.Entity {
|
|
|
1632
1641
|
updateGrid(ascii) {
|
|
1633
1642
|
this.grid = ascii;
|
|
1634
1643
|
this.rows = ascii.length;
|
|
1635
|
-
this.cols = _optionalChain([ascii, 'access',
|
|
1644
|
+
this.cols = _optionalChain([ascii, 'access', _46 => _46[0], 'optionalAccess', _47 => _47.length]) || 0;
|
|
1636
1645
|
}
|
|
1637
1646
|
isPointInside(_globalX, _globalY) {
|
|
1638
1647
|
return false;
|
|
@@ -1707,7 +1716,7 @@ function distSqToSegment(px, py, x1, y1, x2, y2) {
|
|
|
1707
1716
|
const ey = py - cy;
|
|
1708
1717
|
return ex * ex + ey * ey;
|
|
1709
1718
|
}
|
|
1710
|
-
var SplineEntity = (_class5 = class extends
|
|
1719
|
+
var SplineEntity = (_class5 = class extends _chunkW3SFIVXOjs.Entity {
|
|
1711
1720
|
|
|
1712
1721
|
|
|
1713
1722
|
|
|
@@ -2029,7 +2038,7 @@ var SpatialHashGrid = (_class6 = class {
|
|
|
2029
2038
|
const keys = this.entityCells.get(id);
|
|
2030
2039
|
if (!keys) return;
|
|
2031
2040
|
for (const key of keys) {
|
|
2032
|
-
_optionalChain([this, 'access',
|
|
2041
|
+
_optionalChain([this, 'access', _48 => _48.grid, 'access', _49 => _49.get, 'call', _50 => _50(key), 'optionalAccess', _51 => _51.delete, 'call', _52 => _52(id)]);
|
|
2033
2042
|
}
|
|
2034
2043
|
this.entityCells.delete(id);
|
|
2035
2044
|
}
|
|
@@ -2064,51 +2073,20 @@ var SpatialHashGrid = (_class6 = class {
|
|
|
2064
2073
|
}
|
|
2065
2074
|
}, _class6);
|
|
2066
2075
|
|
|
2067
|
-
// src/math/SpringPhysics.ts
|
|
2068
|
-
var SpringPhysics = (_class7 = class {
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
__init63() {this.velocity = 0}
|
|
2072
|
-
__init64() {this.stiffness = 180}
|
|
2073
|
-
__init65() {this.damping = 12}
|
|
2074
|
-
__init66() {this.mass = 1}
|
|
2075
|
-
__init67() {this.valEpsilon = 5e-3}
|
|
2076
|
-
__init68() {this.velEpsilon = 5e-3}
|
|
2077
|
-
constructor(initial) {;_class7.prototype.__init63.call(this);_class7.prototype.__init64.call(this);_class7.prototype.__init65.call(this);_class7.prototype.__init66.call(this);_class7.prototype.__init67.call(this);_class7.prototype.__init68.call(this);
|
|
2078
|
-
this.value = initial;
|
|
2079
|
-
this.target = initial;
|
|
2080
|
-
}
|
|
2081
|
-
update(dt) {
|
|
2082
|
-
if (this.isAtRest()) {
|
|
2083
|
-
this.value = this.target;
|
|
2084
|
-
this.velocity = 0;
|
|
2085
|
-
return;
|
|
2086
|
-
}
|
|
2087
|
-
const forceSpring = -this.stiffness * (this.value - this.target);
|
|
2088
|
-
const forceDamping = -this.damping * this.velocity;
|
|
2089
|
-
const acceleration = (forceSpring + forceDamping) / this.mass;
|
|
2090
|
-
this.velocity += acceleration * dt;
|
|
2091
|
-
this.value += this.velocity * dt;
|
|
2092
|
-
}
|
|
2093
|
-
isAtRest() {
|
|
2094
|
-
return Math.abs(this.value - this.target) < this.valEpsilon && Math.abs(this.velocity) < this.velEpsilon;
|
|
2095
|
-
}
|
|
2096
|
-
}, _class7);
|
|
2097
|
-
|
|
2098
2076
|
// src/tree/DOMPortalEntity.ts
|
|
2099
|
-
var DOMPortalEntity = (
|
|
2077
|
+
var DOMPortalEntity = (_class7 = class extends _chunkW3SFIVXOjs.Entity {
|
|
2100
2078
|
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2079
|
+
__init63() {this.isDOMPortal = true}
|
|
2080
|
+
__init64() {this.domListeners = []}
|
|
2081
|
+
__init65() {this.resizeObserver = null}
|
|
2082
|
+
__init66() {this.cachedWidth = 100}
|
|
2083
|
+
__init67() {this.cachedHeight = 100}
|
|
2084
|
+
__init68() {this.lastWidth = ""}
|
|
2085
|
+
__init69() {this.lastHeight = ""}
|
|
2086
|
+
__init70() {this.lastTransform = ""}
|
|
2087
|
+
__init71() {this.lastZIndex = ""}
|
|
2110
2088
|
constructor(domElement, width, height, id) {
|
|
2111
|
-
super(id);
|
|
2089
|
+
super(id);_class7.prototype.__init63.call(this);_class7.prototype.__init64.call(this);_class7.prototype.__init65.call(this);_class7.prototype.__init66.call(this);_class7.prototype.__init67.call(this);_class7.prototype.__init68.call(this);_class7.prototype.__init69.call(this);_class7.prototype.__init70.call(this);_class7.prototype.__init71.call(this);;
|
|
2112
2090
|
this.domElement = domElement;
|
|
2113
2091
|
this.width = _nullishCoalesce(width, () => ( 0));
|
|
2114
2092
|
this.height = _nullishCoalesce(height, () => ( 0));
|
|
@@ -2130,7 +2108,7 @@ var DOMPortalEntity = (_class8 = class extends _chunk53DAQC3Ujs.Entity {
|
|
|
2130
2108
|
const events = ["click", "pointerdown", "pointerup", "pointermove", "wheel"];
|
|
2131
2109
|
for (const type of events) {
|
|
2132
2110
|
const handler = (e) => {
|
|
2133
|
-
this.dispatchEvent(new (0,
|
|
2111
|
+
this.dispatchEvent(new (0, _chunkW3SFIVXOjs.VectoJSEvent)(type, this, e));
|
|
2134
2112
|
};
|
|
2135
2113
|
this.domElement.addEventListener(type, handler);
|
|
2136
2114
|
this.domListeners.push({ type, handler, capture: false });
|
|
@@ -2141,7 +2119,7 @@ var DOMPortalEntity = (_class8 = class extends _chunk53DAQC3Ujs.Entity {
|
|
|
2141
2119
|
];
|
|
2142
2120
|
for (const { native, vecto } of hoverEvents) {
|
|
2143
2121
|
const handler = (e) => {
|
|
2144
|
-
this.dispatchEvent(new (0,
|
|
2122
|
+
this.dispatchEvent(new (0, _chunkW3SFIVXOjs.VectoJSEvent)(vecto, this, e, false));
|
|
2145
2123
|
};
|
|
2146
2124
|
this.domElement.addEventListener(native, handler);
|
|
2147
2125
|
this.domListeners.push({ type: native, handler, capture: false });
|
|
@@ -2149,7 +2127,7 @@ var DOMPortalEntity = (_class8 = class extends _chunk53DAQC3Ujs.Entity {
|
|
|
2149
2127
|
const focusEvents = ["focus", "blur"];
|
|
2150
2128
|
for (const type of focusEvents) {
|
|
2151
2129
|
const handler = (e) => {
|
|
2152
|
-
this.dispatchEvent(new (0,
|
|
2130
|
+
this.dispatchEvent(new (0, _chunkW3SFIVXOjs.VectoJSEvent)(type, this, e, true));
|
|
2153
2131
|
};
|
|
2154
2132
|
this.domElement.addEventListener(type, handler, true);
|
|
2155
2133
|
this.domListeners.push({ type, handler, capture: true });
|
|
@@ -2192,7 +2170,7 @@ var DOMPortalEntity = (_class8 = class extends _chunk53DAQC3Ujs.Entity {
|
|
|
2192
2170
|
}
|
|
2193
2171
|
super.destroy();
|
|
2194
2172
|
}
|
|
2195
|
-
},
|
|
2173
|
+
}, _class7);
|
|
2196
2174
|
|
|
2197
2175
|
// src/index.ts
|
|
2198
2176
|
Scene.registerWebGLPointRendererCreator(_chunkLIX7DJTIjs.createWebGLPointRenderer);
|
|
@@ -2235,4 +2213,8 @@ Scene.registerWebGPUParticleSystemManager(_chunkLIX7DJTIjs.WebGPUParticleSystemM
|
|
|
2235
2213
|
|
|
2236
2214
|
|
|
2237
2215
|
|
|
2238
|
-
|
|
2216
|
+
|
|
2217
|
+
|
|
2218
|
+
|
|
2219
|
+
|
|
2220
|
+
exports.ArabicShaper = _chunkRW6NC4RBjs.ArabicShaper; exports.BidiResolver = _chunkRW6NC4RBjs.BidiResolver; exports.CanvasRenderer = _chunkLIX7DJTIjs.CanvasRenderer; exports.ComputeParticleEntity = ComputeParticleEntity; exports.DOMPortalEntity = DOMPortalEntity; exports.Easing = _chunkW3SFIVXOjs.Easing; exports.Entity = _chunkW3SFIVXOjs.Entity; exports.GridTextEntity = GridTextEntity; exports.LayoutEngine = _chunk72WVPMSJjs.LayoutEngine; exports.LayoutResultBuffer = _chunk72WVPMSJjs.LayoutResultBuffer; exports.LayoutWorkerManager = _chunkRW6NC4RBjs.LayoutWorkerManager; exports.MSDFFont = _chunkW3SFIVXOjs.MSDFFont; exports.MSDFTextEntity = _chunkW3SFIVXOjs.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 = _chunkW3SFIVXOjs.SVGEntity; exports.SVGRenderer = _chunkLIX7DJTIjs.SVGRenderer; exports.Scene = Scene; exports.SpatialHashGrid = SpatialHashGrid; exports.SplineEntity = SplineEntity; exports.SpringDriver = _chunkW3SFIVXOjs.SpringDriver; exports.SpringPhysics = _chunkW3SFIVXOjs.SpringPhysics; exports.TextEntity = TextEntity; exports.TweenDriver = _chunkW3SFIVXOjs.TweenDriver; exports.VectoJSEvent = _chunkW3SFIVXOjs.VectoJSEvent; exports.WebGPUParticleSystemManager = _chunkLIX7DJTIjs.WebGPUParticleSystemManager; exports.computeLineSegments = _chunk72WVPMSJjs.computeLineSegments; exports.createCanvasMeasurer = _chunk72WVPMSJjs.createCanvasMeasurer; exports.createWebGLPointRenderer = _chunkLIX7DJTIjs.createWebGLPointRenderer; exports.isTweenConfig = _chunkW3SFIVXOjs.isTweenConfig; exports.loadSpline = loadSpline; exports.parseColorToRGBA = _chunkLIX7DJTIjs.parseColorToRGBA; exports.polySegmentToBezier = polySegmentToBezier;
|
package/dist/index.mjs
CHANGED
|
@@ -12,12 +12,17 @@ import {
|
|
|
12
12
|
parseColorToRGBA
|
|
13
13
|
} from "./chunk-2Y45S4JK.mjs";
|
|
14
14
|
import {
|
|
15
|
+
Easing,
|
|
15
16
|
Entity,
|
|
16
17
|
MSDFFont,
|
|
17
18
|
MSDFTextEntity,
|
|
18
19
|
SVGEntity,
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
SpringDriver,
|
|
21
|
+
SpringPhysics,
|
|
22
|
+
TweenDriver,
|
|
23
|
+
VectoJSEvent,
|
|
24
|
+
isTweenConfig
|
|
25
|
+
} from "./chunk-Y2N7TGEH.mjs";
|
|
21
26
|
import {
|
|
22
27
|
ArabicShaper,
|
|
23
28
|
BidiResolver,
|
|
@@ -323,6 +328,10 @@ var Scene = class _Scene {
|
|
|
323
328
|
respectReducedMotion = true;
|
|
324
329
|
/** Cached media-query list; `.matches` is read live each frame. */
|
|
325
330
|
reducedMotionQuery = null;
|
|
331
|
+
/** True when the OS asks for reduced motion and we respect it. Read by the animation drivers. */
|
|
332
|
+
get prefersReducedMotion() {
|
|
333
|
+
return this.respectReducedMotion && !!this.reducedMotionQuery?.matches;
|
|
334
|
+
}
|
|
326
335
|
/**
|
|
327
336
|
* Throttle interval (ms) for the a11y/automation shadow sync. `0` = every
|
|
328
337
|
* frame. See {@link SceneOptions.a11ySyncInterval}.
|
|
@@ -2064,37 +2073,6 @@ var SpatialHashGrid = class {
|
|
|
2064
2073
|
}
|
|
2065
2074
|
};
|
|
2066
2075
|
|
|
2067
|
-
// src/math/SpringPhysics.ts
|
|
2068
|
-
var SpringPhysics = class {
|
|
2069
|
-
value;
|
|
2070
|
-
target;
|
|
2071
|
-
velocity = 0;
|
|
2072
|
-
stiffness = 180;
|
|
2073
|
-
damping = 12;
|
|
2074
|
-
mass = 1;
|
|
2075
|
-
valEpsilon = 5e-3;
|
|
2076
|
-
velEpsilon = 5e-3;
|
|
2077
|
-
constructor(initial) {
|
|
2078
|
-
this.value = initial;
|
|
2079
|
-
this.target = initial;
|
|
2080
|
-
}
|
|
2081
|
-
update(dt) {
|
|
2082
|
-
if (this.isAtRest()) {
|
|
2083
|
-
this.value = this.target;
|
|
2084
|
-
this.velocity = 0;
|
|
2085
|
-
return;
|
|
2086
|
-
}
|
|
2087
|
-
const forceSpring = -this.stiffness * (this.value - this.target);
|
|
2088
|
-
const forceDamping = -this.damping * this.velocity;
|
|
2089
|
-
const acceleration = (forceSpring + forceDamping) / this.mass;
|
|
2090
|
-
this.velocity += acceleration * dt;
|
|
2091
|
-
this.value += this.velocity * dt;
|
|
2092
|
-
}
|
|
2093
|
-
isAtRest() {
|
|
2094
|
-
return Math.abs(this.value - this.target) < this.valEpsilon && Math.abs(this.velocity) < this.velEpsilon;
|
|
2095
|
-
}
|
|
2096
|
-
};
|
|
2097
|
-
|
|
2098
2076
|
// src/tree/DOMPortalEntity.ts
|
|
2099
2077
|
var DOMPortalEntity = class extends Entity {
|
|
2100
2078
|
domElement;
|
|
@@ -2203,6 +2181,7 @@ export {
|
|
|
2203
2181
|
CanvasRenderer,
|
|
2204
2182
|
ComputeParticleEntity,
|
|
2205
2183
|
DOMPortalEntity,
|
|
2184
|
+
Easing,
|
|
2206
2185
|
Entity,
|
|
2207
2186
|
GridTextEntity,
|
|
2208
2187
|
LayoutEngine,
|
|
@@ -2225,13 +2204,16 @@ export {
|
|
|
2225
2204
|
Scene,
|
|
2226
2205
|
SpatialHashGrid,
|
|
2227
2206
|
SplineEntity,
|
|
2207
|
+
SpringDriver,
|
|
2228
2208
|
SpringPhysics,
|
|
2229
2209
|
TextEntity,
|
|
2210
|
+
TweenDriver,
|
|
2230
2211
|
VectoJSEvent,
|
|
2231
2212
|
WebGPUParticleSystemManager,
|
|
2232
2213
|
computeLineSegments,
|
|
2233
2214
|
createCanvasMeasurer,
|
|
2234
2215
|
createWebGLPointRenderer,
|
|
2216
|
+
isTweenConfig,
|
|
2235
2217
|
loadSpline,
|
|
2236
2218
|
parseColorToRGBA,
|
|
2237
2219
|
polySegmentToBezier
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Each entry provides the glyph's pixel `width` at `baseSize`, and an `ast`
|
|
5
5
|
* property holding the raw vector path data used by the renderer.
|
|
6
6
|
*/
|
|
7
|
-
interface GlyphAtlas {
|
|
7
|
+
export interface GlyphAtlas {
|
|
8
8
|
[char: string]: {
|
|
9
9
|
width: number;
|
|
10
10
|
baseSize: number;
|
|
@@ -18,14 +18,14 @@ interface GlyphAtlas {
|
|
|
18
18
|
* Implemented by {@link createCanvasMeasurer} (canvas `measureText`), but kept
|
|
19
19
|
* abstract so callers can supply their own metrics source.
|
|
20
20
|
*/
|
|
21
|
-
interface GlyphMeasurer {
|
|
21
|
+
export interface GlyphMeasurer {
|
|
22
22
|
measure(char: string, fontSize: number): number;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Per-run inline style for rich text ({@link LayoutEngine.prepareRich}). All
|
|
26
26
|
* fields are optional and inherited from the call's base style when omitted.
|
|
27
27
|
*/
|
|
28
|
-
interface TextStyle {
|
|
28
|
+
export interface TextStyle {
|
|
29
29
|
/** Font size in px for this run; overrides the base size (affects width + line height). */
|
|
30
30
|
fontSize?: number;
|
|
31
31
|
/** Fill color, e.g. `'#38bdf8'`. */
|
|
@@ -38,14 +38,14 @@ interface TextStyle {
|
|
|
38
38
|
href?: string;
|
|
39
39
|
}
|
|
40
40
|
/** A run of text sharing one {@link TextStyle}, the input unit of {@link LayoutEngine.prepareRich}. */
|
|
41
|
-
interface StyledSpan {
|
|
41
|
+
export interface StyledSpan {
|
|
42
42
|
text: string;
|
|
43
43
|
style?: TextStyle;
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* A single positioned glyph produced by {@link LayoutEngine.layoutText}.
|
|
47
47
|
*/
|
|
48
|
-
interface LayoutNode {
|
|
48
|
+
export interface LayoutNode {
|
|
49
49
|
char: string;
|
|
50
50
|
x: number;
|
|
51
51
|
y: number;
|
|
@@ -62,14 +62,14 @@ interface LayoutNode {
|
|
|
62
62
|
* The complete output of a text layout pass — an ordered list of positioned
|
|
63
63
|
* glyphs and the total bounding-box dimensions.
|
|
64
64
|
*/
|
|
65
|
-
interface LayoutResult {
|
|
65
|
+
export interface LayoutResult {
|
|
66
66
|
nodes: LayoutNode[];
|
|
67
67
|
totalWidth: number;
|
|
68
68
|
totalHeight: number;
|
|
69
69
|
fallbackToCanvas?: boolean;
|
|
70
70
|
}
|
|
71
71
|
/** A single measured grapheme (the "cold" half of the cold/hot split). */
|
|
72
|
-
interface PreparedGlyph {
|
|
72
|
+
export interface PreparedGlyph {
|
|
73
73
|
char: string;
|
|
74
74
|
/** Advance width at the prepared `fontSize`. */
|
|
75
75
|
width: number;
|
|
@@ -81,7 +81,7 @@ interface PreparedGlyph {
|
|
|
81
81
|
combining?: string[];
|
|
82
82
|
}
|
|
83
83
|
/** A measured word/segment, ready to be placed without re-measuring. */
|
|
84
|
-
interface PreparedWord {
|
|
84
|
+
export interface PreparedWord {
|
|
85
85
|
glyphs: PreparedGlyph[];
|
|
86
86
|
/** Sum of glyph advances — used for word-level wrap decisions. */
|
|
87
87
|
width: number;
|
|
@@ -90,7 +90,7 @@ interface PreparedWord {
|
|
|
90
90
|
isWhitespace: boolean;
|
|
91
91
|
}
|
|
92
92
|
/** A measured paragraph; `isEmpty` marks a blank line (forced newline). */
|
|
93
|
-
interface PreparedParagraph {
|
|
93
|
+
export interface PreparedParagraph {
|
|
94
94
|
words: PreparedWord[];
|
|
95
95
|
isEmpty: boolean;
|
|
96
96
|
fallbackToCanvas?: boolean;
|
|
@@ -103,7 +103,7 @@ interface PreparedParagraph {
|
|
|
103
103
|
* re-layouts ({@link LayoutEngine.layoutPrepared}) on resize / reposition,
|
|
104
104
|
* avoiding the per-frame `Intl.Segmenter` + measurement cost.
|
|
105
105
|
*/
|
|
106
|
-
interface PreparedText {
|
|
106
|
+
export interface PreparedText {
|
|
107
107
|
paragraphs: PreparedParagraph[];
|
|
108
108
|
fontSize: number;
|
|
109
109
|
fallbackToCanvas?: boolean;
|
|
@@ -113,14 +113,14 @@ interface PreparedText {
|
|
|
113
113
|
* flow around — the v1 of text flow exclusion shapes. A left/right rect acts
|
|
114
114
|
* like a CSS float; a centered rect splits the affected lines in two.
|
|
115
115
|
*/
|
|
116
|
-
interface ExclusionRect {
|
|
116
|
+
export interface ExclusionRect {
|
|
117
117
|
x: number;
|
|
118
118
|
y: number;
|
|
119
119
|
width: number;
|
|
120
120
|
height: number;
|
|
121
121
|
}
|
|
122
122
|
/** A free horizontal interval `[x0, x1)` available for text on one line. */
|
|
123
|
-
interface LineSegment {
|
|
123
|
+
export interface LineSegment {
|
|
124
124
|
x0: number;
|
|
125
125
|
x1: number;
|
|
126
126
|
}
|
|
@@ -133,12 +133,12 @@ interface LineSegment {
|
|
|
133
133
|
*
|
|
134
134
|
* Time O(n log n) in the number of overlapping exclusions; space O(n).
|
|
135
135
|
*/
|
|
136
|
-
declare function computeLineSegments(top: number, bottom: number, maxWidth: number, exclusions: ExclusionRect[]): LineSegment[];
|
|
136
|
+
export declare function computeLineSegments(top: number, bottom: number, maxWidth: number, exclusions: ExclusionRect[]): LineSegment[];
|
|
137
137
|
/**
|
|
138
138
|
* VectoJS Global Layout Engine (Intl.Segmenter)
|
|
139
139
|
* Advanced Typography Engine supporting CJK, Emoji, and Western Graphemes
|
|
140
140
|
*/
|
|
141
|
-
declare class LayoutEngine {
|
|
141
|
+
export declare class LayoutEngine {
|
|
142
142
|
maxWidth: number;
|
|
143
143
|
maxHeight: number;
|
|
144
144
|
preserveLeadingSpaces: boolean;
|
|
@@ -243,7 +243,7 @@ declare class LayoutEngine {
|
|
|
243
243
|
* Pre-allocated buffer for zero-GC layout results.
|
|
244
244
|
* Reuse a single instance across frames by calling reset() before each layout pass.
|
|
245
245
|
*/
|
|
246
|
-
declare class LayoutResultBuffer {
|
|
246
|
+
export declare class LayoutResultBuffer {
|
|
247
247
|
static readonly CAPACITY = 16384;
|
|
248
248
|
/** X positions of each glyph. */
|
|
249
249
|
xs: Float32Array;
|
|
@@ -262,58 +262,3 @@ declare class LayoutResultBuffer {
|
|
|
262
262
|
/** Convert to the standard LayoutResult format (allocates — use sparingly). */
|
|
263
263
|
toLayoutResult(): LayoutResult;
|
|
264
264
|
}
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* Create a {@link GlyphMeasurer} backed by a single lazily-created offscreen
|
|
268
|
-
* Canvas 2D context.
|
|
269
|
-
*
|
|
270
|
-
* Each grapheme is measured once at `baseSize` and cached; because canvas
|
|
271
|
-
* `measureText` advance width is linear in font size, later queries at any
|
|
272
|
-
* `fontSize` are derived by pure arithmetic (no re-measure). This gives the
|
|
273
|
-
* {@link LayoutEngine} real per-glyph metrics for text that has no pre-baked
|
|
274
|
-
* vector atlas, fixing the coarse `0.5em` line-breaking fallback.
|
|
275
|
-
*
|
|
276
|
-
* Returns `null` in DOM-free environments (SSR, workers without a canvas) so
|
|
277
|
-
* callers stay portable and the engine keeps its `0.5em` fallback.
|
|
278
|
-
*
|
|
279
|
-
* @param fontFamily - CSS font family used for measurement; should match what
|
|
280
|
-
* the renderer actually draws (e.g. `TextEntity` falls back to `sans-serif`).
|
|
281
|
-
* @param baseSize - Pixel size at which each glyph is measured and cached.
|
|
282
|
-
* @returns A measurer, or `null` when no Canvas 2D context is available.
|
|
283
|
-
*/
|
|
284
|
-
declare function createCanvasMeasurer(fontFamily?: string, baseSize?: number): GlyphMeasurer | null;
|
|
285
|
-
|
|
286
|
-
interface LayoutWorkerResponse {
|
|
287
|
-
id: string;
|
|
288
|
-
seqId: number;
|
|
289
|
-
width: number;
|
|
290
|
-
height: number;
|
|
291
|
-
codePoints: Uint32Array;
|
|
292
|
-
xCoords: Float32Array;
|
|
293
|
-
yCoords: Float32Array;
|
|
294
|
-
packedStyles: Uint32Array;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
declare class LayoutWorkerManager {
|
|
298
|
-
private static instance;
|
|
299
|
-
private worker;
|
|
300
|
-
private registeredFonts;
|
|
301
|
-
private pendingCallbacks;
|
|
302
|
-
private seqIdCounter;
|
|
303
|
-
private debounceTimers;
|
|
304
|
-
private constructor();
|
|
305
|
-
static getInstance(): LayoutWorkerManager;
|
|
306
|
-
queueLayout(entityId: string, text: string, options: {
|
|
307
|
-
fontId: string;
|
|
308
|
-
fontSize: number;
|
|
309
|
-
maxWidth: number;
|
|
310
|
-
maxHeight: number;
|
|
311
|
-
fontData?: any;
|
|
312
|
-
lineHeight?: number;
|
|
313
|
-
letterSpacing?: number;
|
|
314
|
-
callback: (res: LayoutWorkerResponse) => void;
|
|
315
|
-
}): void;
|
|
316
|
-
cancelLayout(entityId: string): void;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
export { type ExclusionRect, type GlyphAtlas, type GlyphMeasurer, LayoutEngine, type LayoutNode, type LayoutResult, LayoutResultBuffer, LayoutWorkerManager, type LineSegment, type PreparedGlyph, type PreparedParagraph, type PreparedText, type PreparedWord, type StyledSpan, type TextStyle, computeLineSegments, createCanvasMeasurer };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { MSDFFontData } from '../text/MSDFFont';
|
|
2
|
+
export interface LayoutWorkerRequest {
|
|
3
|
+
id: string;
|
|
4
|
+
seqId: number;
|
|
5
|
+
text: string;
|
|
6
|
+
fontId: string;
|
|
7
|
+
fontData?: MSDFFontData;
|
|
8
|
+
maxWidth: number;
|
|
9
|
+
maxHeight: number;
|
|
10
|
+
fontSize: number;
|
|
11
|
+
lineHeight?: number;
|
|
12
|
+
letterSpacing?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface LayoutWorkerResponse {
|
|
15
|
+
id: string;
|
|
16
|
+
seqId: number;
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
codePoints: Uint32Array;
|
|
20
|
+
xCoords: Float32Array;
|
|
21
|
+
yCoords: Float32Array;
|
|
22
|
+
packedStyles: Uint32Array;
|
|
23
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { LayoutWorkerResponse } from './LayoutWorker';
|
|
2
|
+
export declare class LayoutWorkerManager {
|
|
3
|
+
private static instance;
|
|
4
|
+
private worker;
|
|
5
|
+
private registeredFonts;
|
|
6
|
+
private pendingCallbacks;
|
|
7
|
+
private seqIdCounter;
|
|
8
|
+
private debounceTimers;
|
|
9
|
+
private constructor();
|
|
10
|
+
static getInstance(): LayoutWorkerManager;
|
|
11
|
+
queueLayout(entityId: string, text: string, options: {
|
|
12
|
+
fontId: string;
|
|
13
|
+
fontSize: number;
|
|
14
|
+
maxWidth: number;
|
|
15
|
+
maxHeight: number;
|
|
16
|
+
fontData?: any;
|
|
17
|
+
lineHeight?: number;
|
|
18
|
+
letterSpacing?: number;
|
|
19
|
+
callback: (res: LayoutWorkerResponse) => void;
|
|
20
|
+
}): void;
|
|
21
|
+
cancelLayout(entityId: string): void;
|
|
22
|
+
}
|