@vectojs/core 1.32.5 → 1.32.6
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/index.js +43 -16
- package/dist/index.mjs +27 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5340,6 +5340,13 @@ var Scene = (_class7 = class _Scene {
|
|
|
5340
5340
|
const fullLen = this.fullViewportElements.length;
|
|
5341
5341
|
const normalLen = this.normalElements.length;
|
|
5342
5342
|
const totalLen = fullLen + normalLen;
|
|
5343
|
+
let selection = null;
|
|
5344
|
+
let selAnchorNode = null;
|
|
5345
|
+
let selFocusNode = null;
|
|
5346
|
+
let selAnchorOffset = 0;
|
|
5347
|
+
let selFocusOffset = 0;
|
|
5348
|
+
let selectionSnapshotTaken = false;
|
|
5349
|
+
let selectionMoved = false;
|
|
5343
5350
|
this.a11yOrderCursors.clear();
|
|
5344
5351
|
for (let i = 0; i < totalLen; i++) {
|
|
5345
5352
|
const expected = i < fullLen ? this.fullViewportElements[i] : this.normalElements[i - fullLen];
|
|
@@ -5350,10 +5357,30 @@ var Scene = (_class7 = class _Scene {
|
|
|
5350
5357
|
const current = parent.childNodes[at];
|
|
5351
5358
|
if (current !== expected) {
|
|
5352
5359
|
const refocus = document.activeElement === expected;
|
|
5360
|
+
if (!selectionSnapshotTaken) {
|
|
5361
|
+
selectionSnapshotTaken = true;
|
|
5362
|
+
const live = typeof window !== "undefined" && typeof window.getSelection === "function" ? window.getSelection() : null;
|
|
5363
|
+
if (_optionalChain([live, 'optionalAccess', _150 => _150.anchorNode]) && live.focusNode) {
|
|
5364
|
+
selection = live;
|
|
5365
|
+
selAnchorNode = live.anchorNode;
|
|
5366
|
+
selFocusNode = live.focusNode;
|
|
5367
|
+
selAnchorOffset = live.anchorOffset;
|
|
5368
|
+
selFocusOffset = live.focusOffset;
|
|
5369
|
+
}
|
|
5370
|
+
}
|
|
5371
|
+
if (!selectionMoved && (selAnchorNode !== null && expected.contains(selAnchorNode) || selFocusNode !== null && expected.contains(selFocusNode))) {
|
|
5372
|
+
selectionMoved = true;
|
|
5373
|
+
}
|
|
5353
5374
|
parent.insertBefore(expected, current || null);
|
|
5354
5375
|
if (refocus) expected.focus({ preventScroll: true });
|
|
5355
5376
|
}
|
|
5356
5377
|
}
|
|
5378
|
+
if (selectionMoved && selection && selAnchorNode && selFocusNode) {
|
|
5379
|
+
try {
|
|
5380
|
+
selection.setBaseAndExtent(selAnchorNode, selAnchorOffset, selFocusNode, selFocusOffset);
|
|
5381
|
+
} catch (e15) {
|
|
5382
|
+
}
|
|
5383
|
+
}
|
|
5357
5384
|
this.a11yNeedsReorder = false;
|
|
5358
5385
|
}
|
|
5359
5386
|
/**
|
|
@@ -5454,12 +5481,12 @@ var Scene = (_class7 = class _Scene {
|
|
|
5454
5481
|
syncOverlayGeometry() {
|
|
5455
5482
|
const parent = this.canvas.parentElement;
|
|
5456
5483
|
if (!parent) return;
|
|
5457
|
-
const canvasRect = _optionalChain([this, 'access',
|
|
5458
|
-
const parentRect = _optionalChain([parent, 'access',
|
|
5459
|
-
const cssWidth = _optionalChain([canvasRect, 'optionalAccess',
|
|
5460
|
-
const cssHeight = _optionalChain([canvasRect, 'optionalAccess',
|
|
5461
|
-
const left = (_nullishCoalesce(_optionalChain([canvasRect, 'optionalAccess',
|
|
5462
|
-
const top = (_nullishCoalesce(_optionalChain([canvasRect, 'optionalAccess',
|
|
5484
|
+
const canvasRect = _optionalChain([this, 'access', _151 => _151.canvas, 'access', _152 => _152.getBoundingClientRect, 'optionalCall', _153 => _153()]);
|
|
5485
|
+
const parentRect = _optionalChain([parent, 'access', _154 => _154.getBoundingClientRect, 'optionalCall', _155 => _155()]);
|
|
5486
|
+
const cssWidth = _optionalChain([canvasRect, 'optionalAccess', _156 => _156.width]) || this.canvas.clientWidth || this.width;
|
|
5487
|
+
const cssHeight = _optionalChain([canvasRect, 'optionalAccess', _157 => _157.height]) || this.canvas.clientHeight || this.height;
|
|
5488
|
+
const left = (_nullishCoalesce(_optionalChain([canvasRect, 'optionalAccess', _158 => _158.left]), () => ( 0))) - (_nullishCoalesce(_optionalChain([parentRect, 'optionalAccess', _159 => _159.left]), () => ( 0))) - (parent.clientLeft || 0) + parent.scrollLeft;
|
|
5489
|
+
const top = (_nullishCoalesce(_optionalChain([canvasRect, 'optionalAccess', _160 => _160.top]), () => ( 0))) - (_nullishCoalesce(_optionalChain([parentRect, 'optionalAccess', _161 => _161.top]), () => ( 0))) - (parent.clientTop || 0) + parent.scrollTop;
|
|
5463
5490
|
const scaleX = this.width > 0 ? cssWidth / this.width : 1;
|
|
5464
5491
|
const scaleY = this.height > 0 ? cssHeight / this.height : 1;
|
|
5465
5492
|
const prev = this._overlayGeometry;
|
|
@@ -5598,7 +5625,7 @@ var Scene = (_class7 = class _Scene {
|
|
|
5598
5625
|
* (and {@link respectReducedMotion} is on). `0` means uncapped.
|
|
5599
5626
|
*/
|
|
5600
5627
|
effectiveMaxFPS() {
|
|
5601
|
-
const reduced = this.respectReducedMotion && !!_optionalChain([this, 'access',
|
|
5628
|
+
const reduced = this.respectReducedMotion && !!_optionalChain([this, 'access', _162 => _162.reducedMotionQuery, 'optionalAccess', _163 => _163.matches]);
|
|
5602
5629
|
if (reduced)
|
|
5603
5630
|
return this.maxFPS > 0 ? Math.min(this.maxFPS, REDUCED_MOTION_FPS) : REDUCED_MOTION_FPS;
|
|
5604
5631
|
return this.maxFPS;
|
|
@@ -5693,7 +5720,7 @@ var Scene = (_class7 = class _Scene {
|
|
|
5693
5720
|
* @param time - Current absolute time in milliseconds (default 0).
|
|
5694
5721
|
*/
|
|
5695
5722
|
render(renderer, dt = 0, time = 0) {
|
|
5696
|
-
if (_optionalChain([renderer, 'access',
|
|
5723
|
+
if (_optionalChain([renderer, 'access', _164 => _164.isContextLost, 'optionalCall', _165 => _165()])) return;
|
|
5697
5724
|
const isMainRenderer = renderer === this.renderer;
|
|
5698
5725
|
if (isMainRenderer && this.a11yRoot && this.canvas.parentElement) {
|
|
5699
5726
|
const parentStyle = this.canvas.parentElement.style;
|
|
@@ -5837,7 +5864,7 @@ var Scene = (_class7 = class _Scene {
|
|
|
5837
5864
|
}
|
|
5838
5865
|
renderer.clear();
|
|
5839
5866
|
if (isMainRenderer) {
|
|
5840
|
-
_optionalChain([this, 'access',
|
|
5867
|
+
_optionalChain([this, 'access', _166 => _166.pointRenderer, 'optionalAccess', _167 => _167.begin, 'call', _168 => _168()]);
|
|
5841
5868
|
}
|
|
5842
5869
|
const vw = this.width;
|
|
5843
5870
|
const vh = this.height;
|
|
@@ -6051,9 +6078,9 @@ var Scene = (_class7 = class _Scene {
|
|
|
6051
6078
|
const flushT0 = this._phaseTiming ? performance.now() : 0;
|
|
6052
6079
|
renderer.flush();
|
|
6053
6080
|
if (isMainRenderer) {
|
|
6054
|
-
_optionalChain([this, 'access',
|
|
6081
|
+
_optionalChain([this, 'access', _169 => _169.pointRenderer, 'optionalAccess', _170 => _170.flush, 'call', _171 => _171()]);
|
|
6055
6082
|
}
|
|
6056
|
-
_optionalChain([renderer, 'access',
|
|
6083
|
+
_optionalChain([renderer, 'access', _172 => _172.present, 'optionalCall', _173 => _173()]);
|
|
6057
6084
|
if (this._phaseTiming) this._recordPhase("flush", performance.now() - flushT0);
|
|
6058
6085
|
if (flushTiming) endVectoUserTiming(flushTiming);
|
|
6059
6086
|
if (this._devActive) {
|
|
@@ -6148,7 +6175,7 @@ var Scene = (_class7 = class _Scene {
|
|
|
6148
6175
|
});
|
|
6149
6176
|
pass.end();
|
|
6150
6177
|
this.device.queue.submit([encoder.finish()]);
|
|
6151
|
-
} catch (
|
|
6178
|
+
} catch (e16) {
|
|
6152
6179
|
}
|
|
6153
6180
|
this.gpuHasContent = false;
|
|
6154
6181
|
}
|
|
@@ -6335,8 +6362,8 @@ function pointInBounds(b, x, y) {
|
|
|
6335
6362
|
function contentGridLineSignature(grid, line, projected, lineHeight, baseline, font, isFirstLine) {
|
|
6336
6363
|
const parts = [
|
|
6337
6364
|
// Line box: position, size, and the font that resolves its baseline.
|
|
6338
|
-
`${_nullishCoalesce(_optionalChain([projected, 'optionalAccess',
|
|
6339
|
-
`${_nullishCoalesce(_optionalChain([projected, 'optionalAccess',
|
|
6365
|
+
`${_nullishCoalesce(_optionalChain([projected, 'optionalAccess', _174 => _174.x]), () => ( 0))}`,
|
|
6366
|
+
`${_nullishCoalesce(_optionalChain([projected, 'optionalAccess', _175 => _175.y]), () => ( ""))}`,
|
|
6340
6367
|
`${lineHeight}`,
|
|
6341
6368
|
`${baseline}`,
|
|
6342
6369
|
font,
|
|
@@ -6529,7 +6556,7 @@ var GridTextEntity = (_class9 = class extends _chunkTRT2TRCWjs.Entity {
|
|
|
6529
6556
|
updateGrid(ascii) {
|
|
6530
6557
|
this.grid = ascii;
|
|
6531
6558
|
this.rows = ascii.length;
|
|
6532
|
-
this.cols = _optionalChain([ascii, 'access',
|
|
6559
|
+
this.cols = _optionalChain([ascii, 'access', _176 => _176[0], 'optionalAccess', _177 => _177.length]) || 0;
|
|
6533
6560
|
}
|
|
6534
6561
|
isPointInside(_globalX, _globalY) {
|
|
6535
6562
|
return false;
|
|
@@ -6639,7 +6666,7 @@ var SplineEntity = (_class10 = class extends _chunkTRT2TRCWjs.Entity {
|
|
|
6639
6666
|
this.width = this.bounds.width;
|
|
6640
6667
|
this.height = this.bounds.height;
|
|
6641
6668
|
const isGradient = (c) => c !== null && !Array.isArray(c);
|
|
6642
|
-
this.containsGradient = (_nullishCoalesce(_optionalChain([this, 'access',
|
|
6669
|
+
this.containsGradient = (_nullishCoalesce(_optionalChain([this, 'access', _178 => _178.doc, 'access', _179 => _179.equations, 'optionalAccess', _180 => _180.some, 'call', _181 => _181((eq) => isGradient(eq.color_rgb))]), () => ( false))) || (_nullishCoalesce(_optionalChain([this, 'access', _182 => _182.doc, 'access', _183 => _183.paths, 'optionalAccess', _184 => _184.some, 'call', _185 => _185((p) => isGradient(p.color_rgb))]), () => ( false)));
|
|
6643
6670
|
this.interactive = true;
|
|
6644
6671
|
}
|
|
6645
6672
|
computeBounds() {
|
package/dist/index.mjs
CHANGED
|
@@ -5339,6 +5339,13 @@ var Scene = class _Scene {
|
|
|
5339
5339
|
const fullLen = this.fullViewportElements.length;
|
|
5340
5340
|
const normalLen = this.normalElements.length;
|
|
5341
5341
|
const totalLen = fullLen + normalLen;
|
|
5342
|
+
let selection = null;
|
|
5343
|
+
let selAnchorNode = null;
|
|
5344
|
+
let selFocusNode = null;
|
|
5345
|
+
let selAnchorOffset = 0;
|
|
5346
|
+
let selFocusOffset = 0;
|
|
5347
|
+
let selectionSnapshotTaken = false;
|
|
5348
|
+
let selectionMoved = false;
|
|
5342
5349
|
this.a11yOrderCursors.clear();
|
|
5343
5350
|
for (let i = 0; i < totalLen; i++) {
|
|
5344
5351
|
const expected = i < fullLen ? this.fullViewportElements[i] : this.normalElements[i - fullLen];
|
|
@@ -5349,10 +5356,30 @@ var Scene = class _Scene {
|
|
|
5349
5356
|
const current = parent.childNodes[at];
|
|
5350
5357
|
if (current !== expected) {
|
|
5351
5358
|
const refocus = document.activeElement === expected;
|
|
5359
|
+
if (!selectionSnapshotTaken) {
|
|
5360
|
+
selectionSnapshotTaken = true;
|
|
5361
|
+
const live = typeof window !== "undefined" && typeof window.getSelection === "function" ? window.getSelection() : null;
|
|
5362
|
+
if (live?.anchorNode && live.focusNode) {
|
|
5363
|
+
selection = live;
|
|
5364
|
+
selAnchorNode = live.anchorNode;
|
|
5365
|
+
selFocusNode = live.focusNode;
|
|
5366
|
+
selAnchorOffset = live.anchorOffset;
|
|
5367
|
+
selFocusOffset = live.focusOffset;
|
|
5368
|
+
}
|
|
5369
|
+
}
|
|
5370
|
+
if (!selectionMoved && (selAnchorNode !== null && expected.contains(selAnchorNode) || selFocusNode !== null && expected.contains(selFocusNode))) {
|
|
5371
|
+
selectionMoved = true;
|
|
5372
|
+
}
|
|
5352
5373
|
parent.insertBefore(expected, current || null);
|
|
5353
5374
|
if (refocus) expected.focus({ preventScroll: true });
|
|
5354
5375
|
}
|
|
5355
5376
|
}
|
|
5377
|
+
if (selectionMoved && selection && selAnchorNode && selFocusNode) {
|
|
5378
|
+
try {
|
|
5379
|
+
selection.setBaseAndExtent(selAnchorNode, selAnchorOffset, selFocusNode, selFocusOffset);
|
|
5380
|
+
} catch {
|
|
5381
|
+
}
|
|
5382
|
+
}
|
|
5356
5383
|
this.a11yNeedsReorder = false;
|
|
5357
5384
|
}
|
|
5358
5385
|
/**
|