@vectojs/core 1.11.0 → 1.11.1

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 CHANGED
@@ -701,40 +701,47 @@ var Scene = (_class2 = class _Scene {
701
701
  __init39() {this.activePortalsPrevFrame = /* @__PURE__ */ new Set()}
702
702
  __init40() {this.portalEntities = /* @__PURE__ */ new Map()}
703
703
  __init41() {this.renderOrderCounter = 0}
704
+ /**
705
+ * Authoritative paint order for semantic nodes discovered during the main
706
+ * render. A node may not have a DOM projection until the following a11y
707
+ * sync, so retaining the order prevents a newly opened overlay from spending
708
+ * its first frame below previously projected controls.
709
+ */
710
+ __init42() {this.a11yRenderOrders = /* @__PURE__ */ new Map()}
704
711
  // Optional WebGL point-cloud layer (see SceneOptions.pointBackend).
705
- __init42() {this.pointRenderer = null}
706
- __init43() {this.glCanvas = null}
712
+ __init43() {this.pointRenderer = null}
713
+ __init44() {this.glCanvas = null}
707
714
 
708
715
 
709
716
 
710
- __init44() {this.disableWindowResize = false}
717
+ __init45() {this.disableWindowResize = false}
711
718
  /** See {@link SceneOptions.maxDPR}. `undefined` = uncapped (real DPR). */
712
719
 
713
720
  // WebGPU properties
714
- __init45() {this.destroyed = false}
715
- __init46() {this.device = null}
716
- __init47() {this.deviceLost = false}
717
- __init48() {this.particleBackend = "auto"}
718
- __init49() {this._webgpuDisabled = false}
721
+ __init46() {this.destroyed = false}
722
+ __init47() {this.device = null}
723
+ __init48() {this.deviceLost = false}
724
+ __init49() {this.particleBackend = "auto"}
725
+ __init50() {this._webgpuDisabled = false}
719
726
  get webgpuDisabled() {
720
727
  return this._webgpuDisabled || this.particleBackend === "cpu";
721
728
  }
722
729
  set webgpuDisabled(value) {
723
730
  this._webgpuDisabled = value;
724
731
  }
725
- __init50() {this.recoveryTimerId = null}
726
- __init51() {this.manager = null}
727
- __init52() {this.initializingWebGPU = false}
728
- __init53() {this.gpuCanvas = null}
729
- __init54() {this.gpuContext = null}
732
+ __init51() {this.recoveryTimerId = null}
733
+ __init52() {this.manager = null}
734
+ __init53() {this.initializingWebGPU = false}
735
+ __init54() {this.gpuCanvas = null}
736
+ __init55() {this.gpuContext = null}
730
737
  /** True while the GPU canvas holds a presented particle frame (needs clearing when they leave). */
731
- __init55() {this.gpuHasContent = false}
732
- __init56() {this.mouseX = -9999}
733
- __init57() {this.mouseY = -9999}
734
- __init58() {this.pointerMoveListener = null}
735
- __init59() {this.pointerLeaveListener = null}
736
- __init60() {this.hasWarnedZeroSize = false}
737
- __init61() {this.fontLoadHandler = null}
738
+ __init56() {this.gpuHasContent = false}
739
+ __init57() {this.mouseX = -9999}
740
+ __init58() {this.mouseY = -9999}
741
+ __init59() {this.pointerMoveListener = null}
742
+ __init60() {this.pointerLeaveListener = null}
743
+ __init61() {this.hasWarnedZeroSize = false}
744
+ __init62() {this.fontLoadHandler = null}
738
745
  // ── Dev-mode warning infrastructure ──────────────────────────────
739
746
  //
740
747
  // Enable with `Scene.devMode = true` or by setting `globalThis.__DEV__`.
@@ -752,7 +759,7 @@ var Scene = (_class2 = class _Scene {
752
759
  return false;
753
760
  }
754
761
 
755
- __init62() {this._devFrameCount = 0}
762
+ __init63() {this._devFrameCount = 0}
756
763
  _devWarn(message) {
757
764
  if (!this._devActive) return;
758
765
  console.warn(`[vectojs/dev] ${message}`);
@@ -796,7 +803,7 @@ var Scene = (_class2 = class _Scene {
796
803
  };
797
804
  walkProjections(this.root);
798
805
  }
799
- 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);
806
+ 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);
800
807
  this.canvas = canvas;
801
808
  this.debugA11y = _nullishCoalesce(options.debugA11y, () => ( false));
802
809
  this.disableWindowResize = _nullishCoalesce(options.disableWindowResize, () => ( false));
@@ -1463,6 +1470,10 @@ var Scene = (_class2 = class _Scene {
1463
1470
  if (el.style.pointerEvents !== semanticPointerEvents) {
1464
1471
  el.style.pointerEvents = semanticPointerEvents;
1465
1472
  }
1473
+ const renderOrder = this.a11yRenderOrders.get(node.id);
1474
+ if (renderOrder !== void 0 && el.style.zIndex !== String(renderOrder)) {
1475
+ el.style.zIndex = String(renderOrder);
1476
+ }
1466
1477
  const implicitTabIndex = !isNativelyFocusable(el) && attrs.role && INTERACTIVE_A11Y_ROLES.has(attrs.role) ? 0 : null;
1467
1478
  const desiredTabIndex = _nullishCoalesce(attrs.tabIndex, () => ( implicitTabIndex));
1468
1479
  if (desiredTabIndex === null) {
@@ -2223,6 +2234,7 @@ var Scene = (_class2 = class _Scene {
2223
2234
  }
2224
2235
  if (isMainRenderer) {
2225
2236
  this.renderOrderCounter = 0;
2237
+ this.a11yRenderOrders.clear();
2226
2238
  this.activePortalsThisFrame.clear();
2227
2239
  }
2228
2240
  const computeEntities = [];
@@ -2381,8 +2393,11 @@ var Scene = (_class2 = class _Scene {
2381
2393
  const orthogonalTolerance = Math.max(1, worldScaleX * worldScaleY) * 1e-6;
2382
2394
  const isSimilarityTransform = Number.isFinite(worldScaleX) && Number.isFinite(worldScaleY) && Math.abs(worldScaleX - worldScaleY) <= scaleTolerance && Math.abs(a * c + b * d) <= orthogonalTolerance;
2383
2395
  const a11yEl = isMainRenderer ? this.a11yElements.get(node.id) : void 0;
2384
- if (a11yEl) {
2385
- a11yEl.style.zIndex = String(this.renderOrderCounter++);
2396
+ const willProjectA11y = isMainRenderer && node.interactive && (node.width > 0 || node.a11yFullViewport);
2397
+ if (a11yEl || willProjectA11y) {
2398
+ const renderOrder = this.renderOrderCounter++;
2399
+ if (willProjectA11y) this.a11yRenderOrders.set(node.id, renderOrder);
2400
+ if (a11yEl) a11yEl.style.zIndex = String(renderOrder);
2386
2401
  }
2387
2402
  if (node.isDOMPortal) {
2388
2403
  if (isMainRenderer) {
@@ -2711,15 +2726,15 @@ var TextEntity = (_class3 = class extends _chunk2Z23LTH3js.Entity {
2711
2726
 
2712
2727
 
2713
2728
 
2714
- __init63() {this.nodes = []}
2729
+ __init64() {this.nodes = []}
2715
2730
 
2716
- __init64() {this.fillStyle = "#94a3b8"}
2717
- __init65() {this.strokeStyle = null}
2718
- __init66() {this.hoveredFillStyle = "#ffffff"}
2719
- __init67() {this.lineWidth = 1}
2720
- __init68() {this.isHovered = false}
2731
+ __init65() {this.fillStyle = "#94a3b8"}
2732
+ __init66() {this.strokeStyle = null}
2733
+ __init67() {this.hoveredFillStyle = "#ffffff"}
2734
+ __init68() {this.lineWidth = 1}
2735
+ __init69() {this.isHovered = false}
2721
2736
  constructor(text, atlas, maxWidth, fontSize = 24) {
2722
- super();_class3.prototype.__init63.call(this);_class3.prototype.__init64.call(this);_class3.prototype.__init65.call(this);_class3.prototype.__init66.call(this);_class3.prototype.__init67.call(this);_class3.prototype.__init68.call(this);;
2737
+ super();_class3.prototype.__init64.call(this);_class3.prototype.__init65.call(this);_class3.prototype.__init66.call(this);_class3.prototype.__init67.call(this);_class3.prototype.__init68.call(this);_class3.prototype.__init69.call(this);;
2723
2738
  this.text = text;
2724
2739
  this.atlas = atlas;
2725
2740
  this.fontSize = fontSize;
@@ -2834,15 +2849,15 @@ var TextEntity = (_class3 = class extends _chunk2Z23LTH3js.Entity {
2834
2849
  // src/components/GridTextEntity.ts
2835
2850
  var GridTextEntity = (_class4 = class extends _chunk2Z23LTH3js.Entity {
2836
2851
 
2837
- __init69() {this.fillStyle = "#ffffff"}
2838
- __init70() {this.grid = []}
2852
+ __init70() {this.fillStyle = "#ffffff"}
2853
+ __init71() {this.grid = []}
2839
2854
  // Array of rows
2840
- __init71() {this.cols = 0}
2841
- __init72() {this.rows = 0}
2855
+ __init72() {this.cols = 0}
2856
+ __init73() {this.rows = 0}
2842
2857
 
2843
2858
 
2844
2859
  constructor(_atlas, fontSize = 10) {
2845
- super();_class4.prototype.__init69.call(this);_class4.prototype.__init70.call(this);_class4.prototype.__init71.call(this);_class4.prototype.__init72.call(this);;
2860
+ super();_class4.prototype.__init70.call(this);_class4.prototype.__init71.call(this);_class4.prototype.__init72.call(this);_class4.prototype.__init73.call(this);;
2846
2861
  this.fontSize = fontSize;
2847
2862
  this.charWidth = fontSize * 1;
2848
2863
  this.charHeight = fontSize * 1.1;
@@ -2934,23 +2949,23 @@ var SplineEntity = (_class5 = class extends _chunk2Z23LTH3js.Entity {
2934
2949
 
2935
2950
 
2936
2951
 
2937
- __init73() {this.offscreen = null}
2938
- __init74() {this.baked = false}
2952
+ __init74() {this.offscreen = null}
2953
+ __init75() {this.baked = false}
2939
2954
  /** Logical (CSS-pixel) size of the baked bitmap — the blit destination size. */
2940
- __init75() {this.bakedWidth = 0}
2941
- __init76() {this.bakedHeight = 0}
2955
+ __init76() {this.bakedWidth = 0}
2956
+ __init77() {this.bakedHeight = 0}
2942
2957
  /** Gradient strokes can't be baked to a solid-color bitmap; they render per-frame. */
2943
2958
 
2944
2959
  /** Lazily-flattened polylines (one Float32Array of [x,y,...] per segment) for hit-testing. */
2945
- __init77() {this.polylines = null}
2960
+ __init78() {this.polylines = null}
2946
2961
  /**
2947
2962
  * When `true`, the renderer draws a rounded-rect outline of the entity's
2948
2963
  * local bounds after painting the curves. Useful for drag feedback and
2949
2964
  * debugging hit areas. Defaults to `false`.
2950
2965
  */
2951
- __init78() {this.showBounds = false}
2966
+ __init79() {this.showBounds = false}
2952
2967
  constructor(doc, opts = {}) {
2953
- super();_class5.prototype.__init73.call(this);_class5.prototype.__init74.call(this);_class5.prototype.__init75.call(this);_class5.prototype.__init76.call(this);_class5.prototype.__init77.call(this);_class5.prototype.__init78.call(this);;
2968
+ super();_class5.prototype.__init74.call(this);_class5.prototype.__init75.call(this);_class5.prototype.__init76.call(this);_class5.prototype.__init77.call(this);_class5.prototype.__init78.call(this);_class5.prototype.__init79.call(this);;
2954
2969
  this.doc = doc;
2955
2970
  this.lineWidth = _nullishCoalesce(opts.lineWidth, () => ( 2));
2956
2971
  this.cache = _nullishCoalesce(opts.cache, () => ( true));
@@ -3325,9 +3340,9 @@ var Group = class extends _chunk2Z23LTH3js.Entity {
3325
3340
  // src/math/SpatialHashGrid.ts
3326
3341
  var SpatialHashGrid = (_class6 = class {
3327
3342
 
3328
- __init79() {this.grid = /* @__PURE__ */ new Map()}
3329
- __init80() {this.entityCells = /* @__PURE__ */ new Map()}
3330
- constructor(cellSize = 64) {;_class6.prototype.__init79.call(this);_class6.prototype.__init80.call(this);
3343
+ __init80() {this.grid = /* @__PURE__ */ new Map()}
3344
+ __init81() {this.entityCells = /* @__PURE__ */ new Map()}
3345
+ constructor(cellSize = 64) {;_class6.prototype.__init80.call(this);_class6.prototype.__init81.call(this);
3331
3346
  this.cellSize = cellSize;
3332
3347
  }
3333
3348
  hash(cx, cy) {
@@ -3419,18 +3434,18 @@ var SpatialHashGrid = (_class6 = class {
3419
3434
  // src/tree/DOMPortalEntity.ts
3420
3435
  var DOMPortalEntity = (_class7 = class extends _chunk2Z23LTH3js.Entity {
3421
3436
 
3422
- __init81() {this.isDOMPortal = true}
3423
- __init82() {this.domListeners = []}
3424
- __init83() {this.resizeObserver = null}
3425
- __init84() {this.cachedWidth = 100}
3426
- __init85() {this.cachedHeight = 100}
3427
- __init86() {this.lastWidth = ""}
3428
- __init87() {this.lastHeight = ""}
3429
- __init88() {this.lastTransform = ""}
3430
- __init89() {this.lastZIndex = ""}
3431
- __init90() {this.lastOpacity = ""}
3437
+ __init82() {this.isDOMPortal = true}
3438
+ __init83() {this.domListeners = []}
3439
+ __init84() {this.resizeObserver = null}
3440
+ __init85() {this.cachedWidth = 100}
3441
+ __init86() {this.cachedHeight = 100}
3442
+ __init87() {this.lastWidth = ""}
3443
+ __init88() {this.lastHeight = ""}
3444
+ __init89() {this.lastTransform = ""}
3445
+ __init90() {this.lastZIndex = ""}
3446
+ __init91() {this.lastOpacity = ""}
3432
3447
  constructor(domElement, width, height, id) {
3433
- super(id);_class7.prototype.__init81.call(this);_class7.prototype.__init82.call(this);_class7.prototype.__init83.call(this);_class7.prototype.__init84.call(this);_class7.prototype.__init85.call(this);_class7.prototype.__init86.call(this);_class7.prototype.__init87.call(this);_class7.prototype.__init88.call(this);_class7.prototype.__init89.call(this);_class7.prototype.__init90.call(this);;
3448
+ super(id);_class7.prototype.__init82.call(this);_class7.prototype.__init83.call(this);_class7.prototype.__init84.call(this);_class7.prototype.__init85.call(this);_class7.prototype.__init86.call(this);_class7.prototype.__init87.call(this);_class7.prototype.__init88.call(this);_class7.prototype.__init89.call(this);_class7.prototype.__init90.call(this);_class7.prototype.__init91.call(this);;
3434
3449
  this.domElement = domElement;
3435
3450
  this.width = _nullishCoalesce(width, () => ( 0));
3436
3451
  this.height = _nullishCoalesce(height, () => ( 0));
package/dist/index.mjs CHANGED
@@ -701,6 +701,13 @@ var Scene = class _Scene {
701
701
  activePortalsPrevFrame = /* @__PURE__ */ new Set();
702
702
  portalEntities = /* @__PURE__ */ new Map();
703
703
  renderOrderCounter = 0;
704
+ /**
705
+ * Authoritative paint order for semantic nodes discovered during the main
706
+ * render. A node may not have a DOM projection until the following a11y
707
+ * sync, so retaining the order prevents a newly opened overlay from spending
708
+ * its first frame below previously projected controls.
709
+ */
710
+ a11yRenderOrders = /* @__PURE__ */ new Map();
704
711
  // Optional WebGL point-cloud layer (see SceneOptions.pointBackend).
705
712
  pointRenderer = null;
706
713
  glCanvas = null;
@@ -1463,6 +1470,10 @@ var Scene = class _Scene {
1463
1470
  if (el.style.pointerEvents !== semanticPointerEvents) {
1464
1471
  el.style.pointerEvents = semanticPointerEvents;
1465
1472
  }
1473
+ const renderOrder = this.a11yRenderOrders.get(node.id);
1474
+ if (renderOrder !== void 0 && el.style.zIndex !== String(renderOrder)) {
1475
+ el.style.zIndex = String(renderOrder);
1476
+ }
1466
1477
  const implicitTabIndex = !isNativelyFocusable(el) && attrs.role && INTERACTIVE_A11Y_ROLES.has(attrs.role) ? 0 : null;
1467
1478
  const desiredTabIndex = attrs.tabIndex ?? implicitTabIndex;
1468
1479
  if (desiredTabIndex === null) {
@@ -2223,6 +2234,7 @@ var Scene = class _Scene {
2223
2234
  }
2224
2235
  if (isMainRenderer) {
2225
2236
  this.renderOrderCounter = 0;
2237
+ this.a11yRenderOrders.clear();
2226
2238
  this.activePortalsThisFrame.clear();
2227
2239
  }
2228
2240
  const computeEntities = [];
@@ -2381,8 +2393,11 @@ var Scene = class _Scene {
2381
2393
  const orthogonalTolerance = Math.max(1, worldScaleX * worldScaleY) * 1e-6;
2382
2394
  const isSimilarityTransform = Number.isFinite(worldScaleX) && Number.isFinite(worldScaleY) && Math.abs(worldScaleX - worldScaleY) <= scaleTolerance && Math.abs(a * c + b * d) <= orthogonalTolerance;
2383
2395
  const a11yEl = isMainRenderer ? this.a11yElements.get(node.id) : void 0;
2384
- if (a11yEl) {
2385
- a11yEl.style.zIndex = String(this.renderOrderCounter++);
2396
+ const willProjectA11y = isMainRenderer && node.interactive && (node.width > 0 || node.a11yFullViewport);
2397
+ if (a11yEl || willProjectA11y) {
2398
+ const renderOrder = this.renderOrderCounter++;
2399
+ if (willProjectA11y) this.a11yRenderOrders.set(node.id, renderOrder);
2400
+ if (a11yEl) a11yEl.style.zIndex = String(renderOrder);
2386
2401
  }
2387
2402
  if (node.isDOMPortal) {
2388
2403
  if (isMainRenderer) {
@@ -205,6 +205,13 @@ export declare class Scene {
205
205
  private activePortalsPrevFrame;
206
206
  private portalEntities;
207
207
  private renderOrderCounter;
208
+ /**
209
+ * Authoritative paint order for semantic nodes discovered during the main
210
+ * render. A node may not have a DOM projection until the following a11y
211
+ * sync, so retaining the order prevents a newly opened overlay from spending
212
+ * its first frame below previously projected controls.
213
+ */
214
+ private a11yRenderOrders;
208
215
  private pointRenderer;
209
216
  private glCanvas;
210
217
  private debugA11y;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectojs/core",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },