@vectojs/core 1.0.0 → 1.0.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/README.md +3 -3
- package/dist/index.js +45 -34
- package/dist/index.mjs +11 -0
- package/dist/tree/Scene.d.ts +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
transforms, render scheduling, layout, text flow, spatial hit-testing, event propagation, renderer
|
|
11
11
|
backends, and the accessibility/automation projection layer.
|
|
12
12
|
|
|
13
|
-
[Core guide](https://vectojs.
|
|
14
|
-
[API reference](https://vectojs.
|
|
13
|
+
[Core guide](https://vectojs.org/learn/core-scene/) ·
|
|
14
|
+
[API reference](https://vectojs.org/reference/core-api/) ·
|
|
15
15
|
[Main repository](https://github.com/vectojs/vectojs)
|
|
16
16
|
|
|
17
17
|
## Install
|
|
@@ -110,7 +110,7 @@ into the VectoJS event system.
|
|
|
110
110
|
|
|
111
111
|
This projection is intentionally thin. Applications still own accessible names, keyboard behavior,
|
|
112
112
|
focus order, contrast, and correct control semantics. See the
|
|
113
|
-
[accessibility guide](https://vectojs.
|
|
113
|
+
[accessibility guide](https://vectojs.org/learn/accessibility/).
|
|
114
114
|
|
|
115
115
|
## Performance model
|
|
116
116
|
|
package/dist/index.js
CHANGED
|
@@ -406,7 +406,8 @@ var Scene = (_class2 = class _Scene {
|
|
|
406
406
|
__init50() {this.pointerMoveListener = null}
|
|
407
407
|
__init51() {this.pointerLeaveListener = null}
|
|
408
408
|
__init52() {this.hasWarnedZeroSize = false}
|
|
409
|
-
|
|
409
|
+
__init53() {this.fontLoadHandler = null}
|
|
410
|
+
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);
|
|
410
411
|
this.canvas = canvas;
|
|
411
412
|
this.debugA11y = _nullishCoalesce(options.debugA11y, () => ( false));
|
|
412
413
|
this.disableWindowResize = _nullishCoalesce(options.disableWindowResize, () => ( false));
|
|
@@ -502,6 +503,13 @@ var Scene = (_class2 = class _Scene {
|
|
|
502
503
|
this.resizeHandler = () => {
|
|
503
504
|
this.resize(window.innerWidth, window.innerHeight);
|
|
504
505
|
};
|
|
506
|
+
if (typeof document !== "undefined" && document.fonts) {
|
|
507
|
+
this.fontLoadHandler = () => {
|
|
508
|
+
this.markDirty();
|
|
509
|
+
};
|
|
510
|
+
document.fonts.ready.then(this.fontLoadHandler);
|
|
511
|
+
document.fonts.addEventListener("loadingdone", this.fontLoadHandler);
|
|
512
|
+
}
|
|
505
513
|
this.setupEvents();
|
|
506
514
|
}
|
|
507
515
|
/**
|
|
@@ -613,6 +621,9 @@ var Scene = (_class2 = class _Scene {
|
|
|
613
621
|
if (this.destroyed) return;
|
|
614
622
|
this.destroyed = true;
|
|
615
623
|
this.stop();
|
|
624
|
+
if (typeof document !== "undefined" && document.fonts && this.fontLoadHandler) {
|
|
625
|
+
document.fonts.removeEventListener("loadingdone", this.fontLoadHandler);
|
|
626
|
+
}
|
|
616
627
|
while (this.root.children.length > 0) this.destroyEntitySubtree(this.root.children.at(-1));
|
|
617
628
|
while (this.overlayRoot.children.length > 0) {
|
|
618
629
|
this.destroyEntitySubtree(this.overlayRoot.children.at(-1));
|
|
@@ -1797,15 +1808,15 @@ var TextEntity = (_class3 = class extends _chunkU4UYRERWjs.Entity {
|
|
|
1797
1808
|
|
|
1798
1809
|
|
|
1799
1810
|
|
|
1800
|
-
|
|
1811
|
+
__init54() {this.nodes = []}
|
|
1801
1812
|
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1813
|
+
__init55() {this.fillStyle = "#94a3b8"}
|
|
1814
|
+
__init56() {this.strokeStyle = null}
|
|
1815
|
+
__init57() {this.hoveredFillStyle = "#ffffff"}
|
|
1816
|
+
__init58() {this.lineWidth = 1}
|
|
1817
|
+
__init59() {this.isHovered = false}
|
|
1807
1818
|
constructor(text, atlas, maxWidth, fontSize = 24) {
|
|
1808
|
-
super();_class3.prototype.
|
|
1819
|
+
super();_class3.prototype.__init54.call(this);_class3.prototype.__init55.call(this);_class3.prototype.__init56.call(this);_class3.prototype.__init57.call(this);_class3.prototype.__init58.call(this);_class3.prototype.__init59.call(this);;
|
|
1809
1820
|
this.text = text;
|
|
1810
1821
|
this.atlas = atlas;
|
|
1811
1822
|
this.fontSize = fontSize;
|
|
@@ -1920,15 +1931,15 @@ var TextEntity = (_class3 = class extends _chunkU4UYRERWjs.Entity {
|
|
|
1920
1931
|
// src/components/GridTextEntity.ts
|
|
1921
1932
|
var GridTextEntity = (_class4 = class extends _chunkU4UYRERWjs.Entity {
|
|
1922
1933
|
|
|
1923
|
-
|
|
1924
|
-
|
|
1934
|
+
__init60() {this.fillStyle = "#ffffff"}
|
|
1935
|
+
__init61() {this.grid = []}
|
|
1925
1936
|
// Array of rows
|
|
1926
|
-
|
|
1927
|
-
|
|
1937
|
+
__init62() {this.cols = 0}
|
|
1938
|
+
__init63() {this.rows = 0}
|
|
1928
1939
|
|
|
1929
1940
|
|
|
1930
1941
|
constructor(_atlas, fontSize = 10) {
|
|
1931
|
-
super();_class4.prototype.
|
|
1942
|
+
super();_class4.prototype.__init60.call(this);_class4.prototype.__init61.call(this);_class4.prototype.__init62.call(this);_class4.prototype.__init63.call(this);;
|
|
1932
1943
|
this.fontSize = fontSize;
|
|
1933
1944
|
this.charWidth = fontSize * 1;
|
|
1934
1945
|
this.charHeight = fontSize * 1.1;
|
|
@@ -2020,23 +2031,23 @@ var SplineEntity = (_class5 = class extends _chunkU4UYRERWjs.Entity {
|
|
|
2020
2031
|
|
|
2021
2032
|
|
|
2022
2033
|
|
|
2023
|
-
|
|
2024
|
-
|
|
2034
|
+
__init64() {this.offscreen = null}
|
|
2035
|
+
__init65() {this.baked = false}
|
|
2025
2036
|
/** Logical (CSS-pixel) size of the baked bitmap — the blit destination size. */
|
|
2026
|
-
|
|
2027
|
-
|
|
2037
|
+
__init66() {this.bakedWidth = 0}
|
|
2038
|
+
__init67() {this.bakedHeight = 0}
|
|
2028
2039
|
/** Gradient strokes can't be baked to a solid-color bitmap; they render per-frame. */
|
|
2029
2040
|
|
|
2030
2041
|
/** Lazily-flattened polylines (one Float32Array of [x,y,...] per segment) for hit-testing. */
|
|
2031
|
-
|
|
2042
|
+
__init68() {this.polylines = null}
|
|
2032
2043
|
/**
|
|
2033
2044
|
* When `true`, the renderer draws a rounded-rect outline of the entity's
|
|
2034
2045
|
* local bounds after painting the curves. Useful for drag feedback and
|
|
2035
2046
|
* debugging hit areas. Defaults to `false`.
|
|
2036
2047
|
*/
|
|
2037
|
-
|
|
2048
|
+
__init69() {this.showBounds = false}
|
|
2038
2049
|
constructor(doc, opts = {}) {
|
|
2039
|
-
super();_class5.prototype.
|
|
2050
|
+
super();_class5.prototype.__init64.call(this);_class5.prototype.__init65.call(this);_class5.prototype.__init66.call(this);_class5.prototype.__init67.call(this);_class5.prototype.__init68.call(this);_class5.prototype.__init69.call(this);;
|
|
2040
2051
|
this.doc = doc;
|
|
2041
2052
|
this.lineWidth = _nullishCoalesce(opts.lineWidth, () => ( 2));
|
|
2042
2053
|
this.cache = _nullishCoalesce(opts.cache, () => ( true));
|
|
@@ -2289,9 +2300,9 @@ async function loadSpline(url) {
|
|
|
2289
2300
|
// src/math/SpatialHashGrid.ts
|
|
2290
2301
|
var SpatialHashGrid = (_class6 = class {
|
|
2291
2302
|
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
constructor(cellSize = 64) {;_class6.prototype.
|
|
2303
|
+
__init70() {this.grid = /* @__PURE__ */ new Map()}
|
|
2304
|
+
__init71() {this.entityCells = /* @__PURE__ */ new Map()}
|
|
2305
|
+
constructor(cellSize = 64) {;_class6.prototype.__init70.call(this);_class6.prototype.__init71.call(this);
|
|
2295
2306
|
this.cellSize = cellSize;
|
|
2296
2307
|
}
|
|
2297
2308
|
hash(cx, cy) {
|
|
@@ -2383,18 +2394,18 @@ var SpatialHashGrid = (_class6 = class {
|
|
|
2383
2394
|
// src/tree/DOMPortalEntity.ts
|
|
2384
2395
|
var DOMPortalEntity = (_class7 = class extends _chunkU4UYRERWjs.Entity {
|
|
2385
2396
|
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2397
|
+
__init72() {this.isDOMPortal = true}
|
|
2398
|
+
__init73() {this.domListeners = []}
|
|
2399
|
+
__init74() {this.resizeObserver = null}
|
|
2400
|
+
__init75() {this.cachedWidth = 100}
|
|
2401
|
+
__init76() {this.cachedHeight = 100}
|
|
2402
|
+
__init77() {this.lastWidth = ""}
|
|
2403
|
+
__init78() {this.lastHeight = ""}
|
|
2404
|
+
__init79() {this.lastTransform = ""}
|
|
2405
|
+
__init80() {this.lastZIndex = ""}
|
|
2406
|
+
__init81() {this.lastOpacity = ""}
|
|
2396
2407
|
constructor(domElement, width, height, id) {
|
|
2397
|
-
super(id);_class7.prototype.
|
|
2408
|
+
super(id);_class7.prototype.__init72.call(this);_class7.prototype.__init73.call(this);_class7.prototype.__init74.call(this);_class7.prototype.__init75.call(this);_class7.prototype.__init76.call(this);_class7.prototype.__init77.call(this);_class7.prototype.__init78.call(this);_class7.prototype.__init79.call(this);_class7.prototype.__init80.call(this);_class7.prototype.__init81.call(this);;
|
|
2398
2409
|
this.domElement = domElement;
|
|
2399
2410
|
this.width = _nullishCoalesce(width, () => ( 0));
|
|
2400
2411
|
this.height = _nullishCoalesce(height, () => ( 0));
|
package/dist/index.mjs
CHANGED
|
@@ -406,6 +406,7 @@ var Scene = class _Scene {
|
|
|
406
406
|
pointerMoveListener = null;
|
|
407
407
|
pointerLeaveListener = null;
|
|
408
408
|
hasWarnedZeroSize = false;
|
|
409
|
+
fontLoadHandler = null;
|
|
409
410
|
constructor(canvas, options = {}) {
|
|
410
411
|
this.canvas = canvas;
|
|
411
412
|
this.debugA11y = options.debugA11y ?? false;
|
|
@@ -502,6 +503,13 @@ var Scene = class _Scene {
|
|
|
502
503
|
this.resizeHandler = () => {
|
|
503
504
|
this.resize(window.innerWidth, window.innerHeight);
|
|
504
505
|
};
|
|
506
|
+
if (typeof document !== "undefined" && document.fonts) {
|
|
507
|
+
this.fontLoadHandler = () => {
|
|
508
|
+
this.markDirty();
|
|
509
|
+
};
|
|
510
|
+
document.fonts.ready.then(this.fontLoadHandler);
|
|
511
|
+
document.fonts.addEventListener("loadingdone", this.fontLoadHandler);
|
|
512
|
+
}
|
|
505
513
|
this.setupEvents();
|
|
506
514
|
}
|
|
507
515
|
/**
|
|
@@ -613,6 +621,9 @@ var Scene = class _Scene {
|
|
|
613
621
|
if (this.destroyed) return;
|
|
614
622
|
this.destroyed = true;
|
|
615
623
|
this.stop();
|
|
624
|
+
if (typeof document !== "undefined" && document.fonts && this.fontLoadHandler) {
|
|
625
|
+
document.fonts.removeEventListener("loadingdone", this.fontLoadHandler);
|
|
626
|
+
}
|
|
616
627
|
while (this.root.children.length > 0) this.destroyEntitySubtree(this.root.children.at(-1));
|
|
617
628
|
while (this.overlayRoot.children.length > 0) {
|
|
618
629
|
this.destroyEntitySubtree(this.overlayRoot.children.at(-1));
|
package/dist/tree/Scene.d.ts
CHANGED
|
@@ -197,6 +197,7 @@ export declare class Scene {
|
|
|
197
197
|
private pointerMoveListener;
|
|
198
198
|
private pointerLeaveListener;
|
|
199
199
|
private hasWarnedZeroSize;
|
|
200
|
+
private fontLoadHandler;
|
|
200
201
|
constructor(canvas: HTMLCanvasElement, options?: SceneOptions);
|
|
201
202
|
/**
|
|
202
203
|
* Expose the underlying {@link IRenderer} for advanced direct-draw operations.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vectojs/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
"dependencies": {},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@vitest/coverage-v8": "^4.1.9",
|
|
62
|
-
"esbuild": "^0.
|
|
62
|
+
"esbuild": "^0.28.1",
|
|
63
63
|
"jsdom": "^29.1.1",
|
|
64
64
|
"tsup": "^8.3.5",
|
|
65
65
|
"vitest": "^4.1.9",
|
|
66
|
-
"puppeteer-core": "^
|
|
66
|
+
"puppeteer-core": "^25.3.0"
|
|
67
67
|
}
|
|
68
68
|
}
|