@graphty/graphty-element 2.3.1 → 2.4.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/AGENTS.md +4 -3
- package/dist/ai.js +3 -3
- package/dist/catalog.js +28 -27
- package/dist/chunks/{AiManager-BBmGJbH4.js → AiManager-DNJCoeTO.js} +5 -5
- package/dist/chunks/{DataSource-OeN3NeyD.js → DataSource-xL3Yn0Pa.js} +72 -61
- package/dist/chunks/{GraphSession-Bef1AYw9.js → GraphSession-PFm2tJ_j.js} +2942 -2822
- package/dist/chunks/{GraphtyLogger-5KEttFUo.js → GraphtyLogger-kbOx2zq3.js} +170 -222
- package/dist/chunks/{NodeStyle-DKj7HjMJ.js → NodeStyle-CtmA7dXi.js} +16 -14
- package/dist/chunks/{VoiceInputAdapter-Dr9Gcmds.js → VoiceInputAdapter-CDNKQgUK.js} +1 -1
- package/dist/chunks/{XRPivotCameraController-BbfgZWpS.js → XRPivotCameraController-JdlLBcD7.js} +146 -134
- package/dist/chunks/{algorithms-CpX56sUB.js → algorithms-B87OPYw4.js} +780 -635
- package/dist/chunks/{capability-check-Blhb2aBB.js → capability-check-B2oYf_30.js} +1 -1
- package/dist/chunks/{detect-Cqwshr9a.js → detect-tuYQLJbT.js} +2 -2
- package/dist/chunks/{format-detection-BXGO1lSn.js → format-detection-BG6CMwPO.js} +1 -1
- package/dist/chunks/{index-C0mIoumR.js → index-6GDfNfwJ.js} +3185 -2731
- package/dist/chunks/{optionsFromZod-17lkrAJs.js → optionsFromZod-DHLLiX_8.js} +275 -267
- package/dist/chunks/{paletteRegistry-x7WOEKZY.js → paletteRegistry-jg9uS7wo.js} +72 -70
- package/dist/chunks/pluginRegistry-MaTIDh6l.js +238 -0
- package/dist/chunks/{registry-CSba5QGJ.js → registry-DQeq4B2K.js} +8 -8
- package/dist/chunks/{scales-BRwl51k8.js → scales-BXHmwPXC.js} +572 -399
- package/dist/chunks/{types-B7bX5c0K.js → types-C_c53VgR.js} +31 -26
- package/dist/commands.d.ts +4 -0
- package/dist/custom-elements.json +1 -1
- package/dist/extend.js +8 -8
- package/dist/graphty-catalog.json +245 -12
- package/dist/graphty.bundle.js +37843 -36551
- package/dist/graphty.js +69 -65
- package/dist/index.d.ts +3 -0
- package/dist/logging.js +2 -2
- package/dist/schema.d.ts +1 -1
- package/dist/schema.js +42 -40
- package/dist/session.js +6 -6
- package/dist/src/Edge.d.ts +4 -4
- package/dist/src/Graph.d.ts +79 -7
- package/dist/src/acceleration/AccelerationController.d.ts +20 -3
- package/dist/src/acceleration/registry.d.ts +3 -0
- package/dist/src/acceleration/types.d.ts +85 -0
- package/dist/src/algorithms/Algorithm.d.ts +13 -0
- package/dist/src/algorithms/KCoreAlgorithm.d.ts +26 -0
- package/dist/src/algorithms/LinkPredictionAlgorithm.d.ts +41 -0
- package/dist/src/cameras/InputUtils.d.ts +67 -0
- package/dist/src/cameras/XRInputHandler.d.ts +0 -8
- package/dist/src/catalog/algorithms.d.ts +5 -5
- package/dist/src/catalog/index.d.ts +2 -2
- package/dist/src/catalog/layouts.d.ts +7 -6
- package/dist/src/catalog/pluginRegistry.d.ts +62 -0
- package/dist/src/catalog/registry.d.ts +7 -0
- package/dist/src/catalog/types.d.ts +77 -6
- package/dist/src/config/EdgeStyle.d.ts +35 -0
- package/dist/src/config/index.d.ts +1 -1
- package/dist/src/data/DataSource.d.ts +1 -1
- package/dist/src/data/GEXFDataSource.d.ts +23 -0
- package/dist/src/errors/codes.d.ts +16 -1
- package/dist/src/events.d.ts +30 -0
- package/dist/src/graphty-element.d.ts +66 -26
- package/dist/src/layout/GridLayoutEngine.d.ts +37 -0
- package/dist/src/layout/LayoutEngine.d.ts +7 -7
- package/dist/src/layout/NGraphLayoutEngine.d.ts +2 -0
- package/dist/src/layout/RadialLayoutEngine.d.ts +37 -0
- package/dist/src/layout/SimulationLayoutEngine.d.ts +12 -0
- package/dist/src/managers/DataManager.d.ts +69 -2
- package/dist/src/managers/EventManager.d.ts +10 -4
- package/dist/src/managers/GraphContext.d.ts +2 -1
- package/dist/src/managers/LayoutManager.d.ts +30 -3
- package/dist/src/meshes/CustomLineRenderer.d.ts +11 -9
- package/dist/src/meshes/EdgeMesh.d.ts +18 -9
- package/dist/src/meshes/FilledArrowRenderer.d.ts +61 -23
- package/dist/src/meshes/MeshCache.d.ts +18 -0
- package/dist/src/meshes/NodeEffects.d.ts +16 -11
- package/dist/src/meshes/NodeMesh.d.ts +2 -2
- package/dist/src/meshes/PatternedLineRenderer.d.ts +5 -37
- package/dist/src/meshes/PerSceneMaterials.d.ts +49 -0
- package/dist/src/meshes/RichTextParser.d.ts +26 -0
- package/dist/src/meshes/RichTextRenderer.d.ts +0 -1
- package/dist/src/session/cost/estimate.d.ts +1 -1
- package/dist/src/session/layout.d.ts +3 -3
- package/dist/src/session/runs/RunsApi.d.ts +1 -1
- package/dist/src/session/styles/StylesApi.d.ts +6 -0
- package/dist/src/session/styles/intern.d.ts +26 -5
- package/dist/src/session/styles/repaint.d.ts +2 -1
- package/dist/src/session/types.d.ts +6 -6
- package/dist/src/xr/XRSessionManager.d.ts +1 -1
- package/dist/webgpu.d.ts +8 -0
- package/dist/webgpu.js +2 -2
- package/package.json +6 -6
- package/dist/chunks/GraphtyError-BwcnblTH.js +0 -132
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as T, b as D, d as k } from "./types-
|
|
1
|
+
import { c as b, G as g, S as F } from "./pluginRegistry-MaTIDh6l.js";
|
|
2
|
+
import { a as T, b as D, d as k } from "./types-C_c53VgR.js";
|
|
3
3
|
import { remapArray as S, INVALID_INDEX as N } from "@graphty/graph-format";
|
|
4
4
|
import { z as O } from "zod/v4";
|
|
5
|
-
import { G as
|
|
6
|
-
import { c as
|
|
5
|
+
import { G as v } from "./GraphtyLogger-kbOx2zq3.js";
|
|
6
|
+
import { c as L } from "./common-DWNKjpH_.js";
|
|
7
7
|
const f = b({
|
|
8
8
|
kind: "format",
|
|
9
9
|
idOf: (i) => i.descriptor.id,
|
|
@@ -11,22 +11,22 @@ const f = b({
|
|
|
11
11
|
implementationOf: (i) => i.descriptor,
|
|
12
12
|
builtInIds: () => T
|
|
13
13
|
});
|
|
14
|
-
function
|
|
14
|
+
function st(i, t) {
|
|
15
15
|
f.register(i, t);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function rt() {
|
|
18
18
|
return f.entries();
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function $() {
|
|
21
21
|
return f.descriptors();
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function M(i) {
|
|
24
24
|
return f.byId(i);
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function nt() {
|
|
27
27
|
f.clearForTesting();
|
|
28
28
|
}
|
|
29
|
-
const
|
|
29
|
+
const R = {
|
|
30
30
|
"edge-list": "Edge List",
|
|
31
31
|
"node-list": "Node List",
|
|
32
32
|
"adjacency-list": "Adjacency List",
|
|
@@ -34,7 +34,7 @@ const M = {
|
|
|
34
34
|
gephi: "Gephi Export",
|
|
35
35
|
cytoscape: "Cytoscape Export",
|
|
36
36
|
generic: "Generic"
|
|
37
|
-
},
|
|
37
|
+
}, j = [
|
|
38
38
|
{
|
|
39
39
|
name: "delimiter",
|
|
40
40
|
plainName: "Column Separator",
|
|
@@ -47,7 +47,7 @@ const M = {
|
|
|
47
47
|
plainName: "File Shape",
|
|
48
48
|
technicalName: "variant",
|
|
49
49
|
type: "enum",
|
|
50
|
-
values: Object.entries(
|
|
50
|
+
values: Object.entries(R).map(([i, t]) => ({ value: i, label: t })),
|
|
51
51
|
description: "Which CSV shape to read. Worked out from the header row when it is not set."
|
|
52
52
|
},
|
|
53
53
|
{
|
|
@@ -72,7 +72,7 @@ const M = {
|
|
|
72
72
|
type: "string",
|
|
73
73
|
description: "Where to find the node an edge ends at. Left unset, the element looks for target, then dst, then to."
|
|
74
74
|
}
|
|
75
|
-
],
|
|
75
|
+
], z = [
|
|
76
76
|
{
|
|
77
77
|
name: "nodeIdPath",
|
|
78
78
|
plainName: "Node Id Field",
|
|
@@ -88,7 +88,7 @@ const M = {
|
|
|
88
88
|
mimeTypes: ["application/json"],
|
|
89
89
|
canImport: !0,
|
|
90
90
|
canExport: !1,
|
|
91
|
-
options: [...
|
|
91
|
+
options: [...z, ...h]
|
|
92
92
|
},
|
|
93
93
|
{
|
|
94
94
|
id: "csv",
|
|
@@ -97,7 +97,7 @@ const M = {
|
|
|
97
97
|
mimeTypes: ["text/csv", "text/tab-separated-values", "text/plain"],
|
|
98
98
|
canImport: !0,
|
|
99
99
|
canExport: !1,
|
|
100
|
-
options: [...
|
|
100
|
+
options: [...j, ...h]
|
|
101
101
|
},
|
|
102
102
|
{
|
|
103
103
|
id: "graphml",
|
|
@@ -149,16 +149,16 @@ const M = {
|
|
|
149
149
|
canExport: !1,
|
|
150
150
|
options: h
|
|
151
151
|
}
|
|
152
|
-
],
|
|
152
|
+
], ot = [
|
|
153
153
|
{ id: "sif", reason: "No data source reads the Cytoscape simple interaction format." },
|
|
154
154
|
{ id: "cx2", reason: "No data source reads the Cytoscape Exchange format." }
|
|
155
155
|
];
|
|
156
|
-
function ot(i) {
|
|
157
|
-
return _.find((t) => t.id === i) ?? $(i)?.descriptor;
|
|
158
|
-
}
|
|
159
156
|
function at(i) {
|
|
157
|
+
return _.find((t) => t.id === i) ?? M(i)?.descriptor;
|
|
158
|
+
}
|
|
159
|
+
function lt(i) {
|
|
160
160
|
const t = i.toLowerCase();
|
|
161
|
-
return [..._,
|
|
161
|
+
return [..._, ...$()].filter(
|
|
162
162
|
(e) => e.extensions.includes(t)
|
|
163
163
|
);
|
|
164
164
|
}
|
|
@@ -169,19 +169,19 @@ const m = b({
|
|
|
169
169
|
implementationOf: (i) => i.descriptor,
|
|
170
170
|
builtInIds: () => D
|
|
171
171
|
});
|
|
172
|
-
function
|
|
172
|
+
function B(i, t) {
|
|
173
173
|
m.register(i, t);
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function ct() {
|
|
176
176
|
return m.descriptors();
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function ht(i) {
|
|
179
179
|
return m.byId(i);
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function dt() {
|
|
182
182
|
m.clearForTesting();
|
|
183
183
|
}
|
|
184
|
-
const o = 3,
|
|
184
|
+
const o = 3, C = 1024;
|
|
185
185
|
function p(i, t) {
|
|
186
186
|
if (!Number.isInteger(i) || i < 0)
|
|
187
187
|
throw new RangeError(`ElementPositions: ${t} must be a non-negative integer, found ${String(i)}`);
|
|
@@ -195,7 +195,7 @@ class x {
|
|
|
195
195
|
* Allocate the backing array, every row unplaced and unpinned.
|
|
196
196
|
* @param capacity - rows to reserve before the first growth; a non-negative integer
|
|
197
197
|
*/
|
|
198
|
-
constructor(t =
|
|
198
|
+
constructor(t = C) {
|
|
199
199
|
this.components = o, this.rows = 0, p(t, "capacity");
|
|
200
200
|
const e = Math.max(1, t);
|
|
201
201
|
this.array = new Float32Array(o * e), this.array.fill(Number.NaN), this.pins = new Uint8Array(e);
|
|
@@ -445,7 +445,7 @@ class x {
|
|
|
445
445
|
return o * t;
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
|
-
const l =
|
|
448
|
+
const l = new F("layout"), W = Object.freeze([
|
|
449
449
|
"arf",
|
|
450
450
|
"bfs",
|
|
451
451
|
"bipartite",
|
|
@@ -453,21 +453,23 @@ const l = /* @__PURE__ */ new Map(), C = Object.freeze([
|
|
|
453
453
|
"d3",
|
|
454
454
|
"fixed",
|
|
455
455
|
"forceatlas2",
|
|
456
|
+
"grid",
|
|
456
457
|
"kamada-kawai",
|
|
457
458
|
"multipartite",
|
|
458
459
|
"ngraph",
|
|
459
460
|
"planar",
|
|
461
|
+
"radial",
|
|
460
462
|
"random",
|
|
461
463
|
"shell",
|
|
462
464
|
"spectral",
|
|
463
465
|
"spiral",
|
|
464
466
|
"spring",
|
|
465
467
|
"spring-electrical"
|
|
466
|
-
]),
|
|
467
|
-
function
|
|
468
|
+
]), G = v.getLogger(["graphty", "layout"]), P = 1e-6;
|
|
469
|
+
function U(i, t) {
|
|
468
470
|
return JSON.stringify([i, t]);
|
|
469
471
|
}
|
|
470
|
-
const
|
|
472
|
+
const V = 10;
|
|
471
473
|
function A(i) {
|
|
472
474
|
return new g({
|
|
473
475
|
code: "E_DUPLICATE_PLUGIN",
|
|
@@ -500,7 +502,7 @@ const E = class E {
|
|
|
500
502
|
* Take a node out of the layout, before the element disposes the mesh that drew it.
|
|
501
503
|
*
|
|
502
504
|
* Declared here, with a default that does nothing, because it used to be duck-typed by the
|
|
503
|
-
* element's data manager and implemented by none of the
|
|
505
|
+
* element's data manager and implemented by none of the nineteen engines that ship here: an
|
|
504
506
|
* author learned it existed by reading the element's source, and got no worked example. An
|
|
505
507
|
* engine that keeps its own node list must override this, or it holds every removed node --
|
|
506
508
|
* and everything that node references -- for as long as the engine lives.
|
|
@@ -526,7 +528,7 @@ const E = class E {
|
|
|
526
528
|
* @param _nodes - the nodes that have just arrived
|
|
527
529
|
*/
|
|
528
530
|
updatePositions(t) {
|
|
529
|
-
for (let e = 0; e <
|
|
531
|
+
for (let e = 0; e < V; e++) {
|
|
530
532
|
if (this.isSettled)
|
|
531
533
|
return;
|
|
532
534
|
this.step();
|
|
@@ -615,7 +617,7 @@ const E = class E {
|
|
|
615
617
|
* freeze counts as placed, which is what makes a file's own coordinates yield to it.
|
|
616
618
|
*
|
|
617
619
|
* A PINNED ROW REFUSES A LAYOUT STEP. This is the whole of "a pin is meaningful under every
|
|
618
|
-
* arrangement":
|
|
620
|
+
* arrangement": fourteen of the element's nineteen engines implement `pin()` as a no-op and
|
|
619
621
|
* `setNodePosition` as a no-op too, so before this guard a reader who dragged a node under a
|
|
620
622
|
* static layout watched it snap back the next time the layout recomputed. One refusal here
|
|
621
623
|
* covers every engine, including one written by a third party that has never heard of pinning,
|
|
@@ -682,7 +684,7 @@ const E = class E {
|
|
|
682
684
|
for (const a of t) {
|
|
683
685
|
const c = a.index >= 0 && a.index < s.length ? s[a.index] : 1;
|
|
684
686
|
c !== 1 && (n = !0);
|
|
685
|
-
const I =
|
|
687
|
+
const I = U(a.srcId, a.dstId);
|
|
686
688
|
r.set(I, (r.get(I) ?? 0) + c);
|
|
687
689
|
}
|
|
688
690
|
return n ? r : null;
|
|
@@ -703,7 +705,7 @@ const E = class E {
|
|
|
703
705
|
let s = 0;
|
|
704
706
|
for (const r of e.values())
|
|
705
707
|
r < P && s++;
|
|
706
|
-
s > 0 &&
|
|
708
|
+
s > 0 && G.warn("Edge weights at or below zero were clamped before the layout read them", {
|
|
707
709
|
layout: t,
|
|
708
710
|
clamped: s,
|
|
709
711
|
epsilon: P
|
|
@@ -744,7 +746,7 @@ const E = class E {
|
|
|
744
746
|
* offered by a picker, described in a reader's language, or found by `layoutIdForEngine`.
|
|
745
747
|
*
|
|
746
748
|
* A third party's class must declare a `static descriptor` whose `id` equals its
|
|
747
|
-
* `static type`. The element's own
|
|
749
|
+
* `static type`. The element's own nineteen are the one exemption, because their arrangements
|
|
748
750
|
* are authored centrally in the layout catalogue where several engines may sit behind one
|
|
749
751
|
* public name.
|
|
750
752
|
* @param cls - The layout engine class.
|
|
@@ -764,7 +766,7 @@ const E = class E {
|
|
|
764
766
|
});
|
|
765
767
|
if (l.get(s) === t)
|
|
766
768
|
return t;
|
|
767
|
-
const n =
|
|
769
|
+
const n = W.includes(s);
|
|
768
770
|
if (r === void 0) {
|
|
769
771
|
if (!n)
|
|
770
772
|
throw new g({
|
|
@@ -773,7 +775,7 @@ const E = class E {
|
|
|
773
775
|
source: "registry",
|
|
774
776
|
details: { kind: "layout", name: s, field: "descriptor" }
|
|
775
777
|
});
|
|
776
|
-
if (l.
|
|
778
|
+
if (l.hasOwn(s))
|
|
777
779
|
throw A(s);
|
|
778
780
|
return l.set(s, t), t;
|
|
779
781
|
}
|
|
@@ -786,7 +788,7 @@ const E = class E {
|
|
|
786
788
|
source: "registry",
|
|
787
789
|
details: { kind: "layout", name: s, field: "descriptor.id", id: r.id }
|
|
788
790
|
});
|
|
789
|
-
return
|
|
791
|
+
return B({
|
|
790
792
|
descriptor: { ...r, honoursWeights: e.honoursWeights ?? !1 },
|
|
791
793
|
type: s
|
|
792
794
|
}), l.set(s, t), t;
|
|
@@ -851,17 +853,17 @@ const E = class E {
|
|
|
851
853
|
};
|
|
852
854
|
E.honoursWeights = !1;
|
|
853
855
|
let w = E;
|
|
854
|
-
const
|
|
856
|
+
const X = O.looseObject({
|
|
855
857
|
scalingFactor: O.number().default(100)
|
|
856
858
|
});
|
|
857
|
-
class
|
|
859
|
+
class ut extends w {
|
|
858
860
|
/**
|
|
859
861
|
* Create a simple layout engine
|
|
860
862
|
* @param opts - Configuration options including scalingFactor
|
|
861
863
|
*/
|
|
862
864
|
constructor(t = {}) {
|
|
863
865
|
super(), this._nodes = [], this._edges = [], this.stale = !0, this.positions = {}, this.scalingFactor = 100, this.isSettled = !0;
|
|
864
|
-
const e =
|
|
866
|
+
const e = X.parse(t);
|
|
865
867
|
this.scalingFactor = e.scalingFactor;
|
|
866
868
|
}
|
|
867
869
|
/**
|
|
@@ -1050,37 +1052,37 @@ class dt extends w {
|
|
|
1050
1052
|
*/
|
|
1051
1053
|
publishedOr(t, e) {
|
|
1052
1054
|
const s = { x: 0, y: 0, z: 0 };
|
|
1053
|
-
return t !== void 0 && this.readNodePosition(t, s) ? s :
|
|
1055
|
+
return t !== void 0 && this.readNodePosition(t, s) ? s : K(this.positions[e], this.scalingFactor);
|
|
1054
1056
|
}
|
|
1055
1057
|
}
|
|
1056
|
-
function
|
|
1058
|
+
function K(i, t) {
|
|
1057
1059
|
if (!i || i.length === 0)
|
|
1058
1060
|
return { x: 0, y: 0, z: 0 };
|
|
1059
1061
|
const e = i[0] * t, s = i[1] * t, r = (i[2] ?? 0) * t;
|
|
1060
1062
|
return { x: e, y: s, z: r };
|
|
1061
1063
|
}
|
|
1062
|
-
const
|
|
1064
|
+
const H = /^#[0-9a-f]{6}$/i;
|
|
1063
1065
|
function q(i) {
|
|
1064
1066
|
if (typeof i != "string" || i.trim() === "")
|
|
1065
1067
|
return null;
|
|
1066
1068
|
try {
|
|
1067
|
-
const t =
|
|
1069
|
+
const t = L(i.trim());
|
|
1068
1070
|
if (t === void 0)
|
|
1069
1071
|
return null;
|
|
1070
1072
|
const e = t.length === 9 ? t.slice(0, 7) : t;
|
|
1071
|
-
return
|
|
1073
|
+
return H.test(e) ? e.toUpperCase() : null;
|
|
1072
1074
|
} catch {
|
|
1073
1075
|
return null;
|
|
1074
1076
|
}
|
|
1075
1077
|
}
|
|
1076
|
-
function
|
|
1078
|
+
function J(i) {
|
|
1077
1079
|
return JSON.stringify([i.id, i.kind, i.colors, i.capacity, i.colorblindSafe]);
|
|
1078
1080
|
}
|
|
1079
1081
|
const y = b({
|
|
1080
1082
|
kind: "palette",
|
|
1081
1083
|
idOf: (i) => i.id,
|
|
1082
1084
|
descriptorOf: (i) => i,
|
|
1083
|
-
implementationOf:
|
|
1085
|
+
implementationOf: J,
|
|
1084
1086
|
builtInIds: () => k
|
|
1085
1087
|
});
|
|
1086
1088
|
function u(i, t, e) {
|
|
@@ -1091,7 +1093,7 @@ function u(i, t, e) {
|
|
|
1091
1093
|
details: { kind: "palette", name: typeof i == "string" ? i : "", field: t }
|
|
1092
1094
|
});
|
|
1093
1095
|
}
|
|
1094
|
-
function
|
|
1096
|
+
function pt(i, t) {
|
|
1095
1097
|
typeof i != "object" && u("", "descriptor", "registerPalette takes a palette descriptor"), (i.plainName === void 0 || i.plainName === "") && u(i.id, "plainName", `the palette "${String(i.id)}" was registered without a plain name`), i.kind !== "sequential" && i.kind !== "diverging" && i.kind !== "categorical" && u(
|
|
1096
1098
|
i.id,
|
|
1097
1099
|
"kind",
|
|
@@ -1117,13 +1119,13 @@ function ut(i, t) {
|
|
|
1117
1119
|
t
|
|
1118
1120
|
);
|
|
1119
1121
|
}
|
|
1120
|
-
function
|
|
1122
|
+
function gt() {
|
|
1121
1123
|
return y.descriptors();
|
|
1122
1124
|
}
|
|
1123
|
-
function
|
|
1125
|
+
function ft(i) {
|
|
1124
1126
|
return y.byId(i);
|
|
1125
1127
|
}
|
|
1126
|
-
function
|
|
1128
|
+
function mt() {
|
|
1127
1129
|
y.clearForTesting();
|
|
1128
1130
|
}
|
|
1129
1131
|
export {
|
|
@@ -1131,23 +1133,23 @@ export {
|
|
|
1131
1133
|
_ as F,
|
|
1132
1134
|
w as L,
|
|
1133
1135
|
o as P,
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
+
X as S,
|
|
1137
|
+
ot as U,
|
|
1136
1138
|
P as W,
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1139
|
+
ut as a,
|
|
1140
|
+
dt as b,
|
|
1141
|
+
nt as c,
|
|
1142
|
+
mt as d,
|
|
1143
|
+
$ as e,
|
|
1144
|
+
ct as f,
|
|
1145
|
+
gt as g,
|
|
1146
|
+
rt as h,
|
|
1147
|
+
at as i,
|
|
1148
|
+
lt as j,
|
|
1149
|
+
U as k,
|
|
1150
|
+
ht as l,
|
|
1151
|
+
ft as m,
|
|
1150
1152
|
d as n,
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
+
st as p,
|
|
1154
|
+
pt as r
|
|
1153
1155
|
};
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
const N = {
|
|
2
|
+
E_BAD_COMMAND: "E_BAD_COMMAND",
|
|
3
|
+
E_BAD_QUERY: "E_BAD_QUERY",
|
|
4
|
+
E_BAD_LAYER: "E_BAD_LAYER",
|
|
5
|
+
E_BAD_SELECTOR: "E_BAD_SELECTOR",
|
|
6
|
+
E_BAD_FORMULA: "E_BAD_FORMULA",
|
|
7
|
+
E_SELECTOR_EMPTY: "E_SELECTOR_EMPTY",
|
|
8
|
+
E_UNSCOPED_RUN_ENCODING: "E_UNSCOPED_RUN_ENCODING",
|
|
9
|
+
E_UNKNOWN_SCALE: "E_UNKNOWN_SCALE",
|
|
10
|
+
E_UNKNOWN_CHANNEL: "E_UNKNOWN_CHANNEL",
|
|
11
|
+
E_UNKNOWN_OPTION: "E_UNKNOWN_OPTION",
|
|
12
|
+
E_OPTION_RANGE: "E_OPTION_RANGE",
|
|
13
|
+
E_UNKNOWN_ATTRIBUTE: "E_UNKNOWN_ATTRIBUTE",
|
|
14
|
+
E_UNKNOWN_ALGORITHM: "E_UNKNOWN_ALGORITHM",
|
|
15
|
+
E_UNKNOWN_LAYOUT: "E_UNKNOWN_LAYOUT",
|
|
16
|
+
E_UNKNOWN_FORMAT: "E_UNKNOWN_FORMAT",
|
|
17
|
+
E_UNKNOWN_PALETTE: "E_UNKNOWN_PALETTE",
|
|
18
|
+
E_UNKNOWN_CAMERA: "E_UNKNOWN_CAMERA",
|
|
19
|
+
E_UNKNOWN_SINK: "E_UNKNOWN_SINK",
|
|
20
|
+
E_UNKNOWN_RUN: "E_UNKNOWN_RUN",
|
|
21
|
+
E_UNSTABLE_RUN_ID: "E_UNSTABLE_RUN_ID",
|
|
22
|
+
E_DUPLICATE_ID: "E_DUPLICATE_ID",
|
|
23
|
+
E_DUPLICATE_EDGE: "E_DUPLICATE_EDGE",
|
|
24
|
+
E_DUPLICATE_PLUGIN: "E_DUPLICATE_PLUGIN",
|
|
25
|
+
E_PROTECTED: "E_PROTECTED",
|
|
26
|
+
E_FETCH_FAILED: "E_FETCH_FAILED",
|
|
27
|
+
E_PARSE_FAILED: "E_PARSE_FAILED",
|
|
28
|
+
E_EDGE_ENDPOINTS_UNRESOLVED: "E_EDGE_ENDPOINTS_UNRESOLVED",
|
|
29
|
+
E_ID_MISSING: "E_ID_MISSING",
|
|
30
|
+
E_EMPTY_LOAD: "E_EMPTY_LOAD",
|
|
31
|
+
E_SUPERSEDED: "E_SUPERSEDED",
|
|
32
|
+
E_TOO_LARGE: "E_TOO_LARGE",
|
|
33
|
+
E_OUT_OF_MEMORY: "E_OUT_OF_MEMORY",
|
|
34
|
+
E_CAP_EXCEEDED: "E_CAP_EXCEEDED",
|
|
35
|
+
E_SCOPE_EMPTY: "E_SCOPE_EMPTY",
|
|
36
|
+
E_NOT_CONVERGED: "E_NOT_CONVERGED",
|
|
37
|
+
E_NO_ACCELERATOR: "E_NO_ACCELERATOR",
|
|
38
|
+
E_NO_WEBGPU: "E_NO_WEBGPU",
|
|
39
|
+
E_NO_ADAPTER: "E_NO_ADAPTER",
|
|
40
|
+
E_SOFTWARE_ONLY: "E_SOFTWARE_ONLY",
|
|
41
|
+
E_DEVICE_INCORRECT: "E_DEVICE_INCORRECT",
|
|
42
|
+
E_DEVICE_LOST: "E_DEVICE_LOST",
|
|
43
|
+
E_NO_WEBGL: "E_NO_WEBGL",
|
|
44
|
+
E_UNSUPPORTED: "E_UNSUPPORTED",
|
|
45
|
+
E_READONLY: "E_READONLY",
|
|
46
|
+
E_DISPOSED: "E_DISPOSED",
|
|
47
|
+
E_INTERNAL: "E_INTERNAL"
|
|
48
|
+
}, T = Object.freeze(Object.values(N)), D = Object.freeze([
|
|
49
|
+
N.E_NO_WEBGPU,
|
|
50
|
+
N.E_NO_ADAPTER,
|
|
51
|
+
N.E_SOFTWARE_ONLY,
|
|
52
|
+
N.E_DEVICE_INCORRECT,
|
|
53
|
+
N.E_DEVICE_LOST,
|
|
54
|
+
N.E_TOO_LARGE
|
|
55
|
+
]);
|
|
56
|
+
function i(e) {
|
|
57
|
+
return typeof e == "string" && Object.hasOwn(N, e);
|
|
58
|
+
}
|
|
59
|
+
const d = Object.freeze({});
|
|
60
|
+
function A(e) {
|
|
61
|
+
if (typeof e != "object" || e === null || !("code" in e))
|
|
62
|
+
return;
|
|
63
|
+
const { code: E } = e;
|
|
64
|
+
return i(E) ? E : void 0;
|
|
65
|
+
}
|
|
66
|
+
function c(e) {
|
|
67
|
+
if (typeof e != "object" || e === null || !("code" in e))
|
|
68
|
+
return;
|
|
69
|
+
const { code: E } = e;
|
|
70
|
+
return typeof E == "string" && !i(E) ? E : void 0;
|
|
71
|
+
}
|
|
72
|
+
class O extends Error {
|
|
73
|
+
/**
|
|
74
|
+
* Builds an error.
|
|
75
|
+
* @param init - The code, the message, the failing area and anything else known about the
|
|
76
|
+
* failure.
|
|
77
|
+
*/
|
|
78
|
+
constructor(E) {
|
|
79
|
+
super(E.message, E.cause === void 0 ? void 0 : { cause: E.cause }), this.name = "GraphtyError", Object.setPrototypeOf(this, new.target.prototype), this.code = E.code, this.source = E.source, this.recoverable = E.recoverable ?? !1, this.details = E.details === void 0 ? d : Object.freeze({ ...E.details }), E.target !== void 0 && (this.target = E.target);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Re-reports a failure from somewhere else as a `GraphtyError`.
|
|
83
|
+
*
|
|
84
|
+
* A sibling package -- graph-io, graph-format, the WebGPU peer -- throws its own class. The
|
|
85
|
+
* class does not cross the boundary, so the element carries the code instead: when the
|
|
86
|
+
* original's `code` is one the element knows, that code wins; when it is a string the
|
|
87
|
+
* element does not know, it is kept in `details.sourceCode` and the caller's code is used.
|
|
88
|
+
* A value that is already a `GraphtyError` is returned untouched, so the most specific code
|
|
89
|
+
* survives.
|
|
90
|
+
* @param cause - The thrown value being wrapped.
|
|
91
|
+
* @param init - The code, area and facts to use when the original supplies none.
|
|
92
|
+
* @returns The error to throw.
|
|
93
|
+
*/
|
|
94
|
+
static wrap(E, _) {
|
|
95
|
+
if (E instanceof O)
|
|
96
|
+
return E;
|
|
97
|
+
const r = A(E), s = c(E), n = _.message ?? (E instanceof Error ? E.message : String(E)), t = s === void 0 ? _.details : { ..._.details, sourceCode: s };
|
|
98
|
+
return new O({
|
|
99
|
+
..._,
|
|
100
|
+
code: r ?? _.code,
|
|
101
|
+
message: n,
|
|
102
|
+
details: t,
|
|
103
|
+
cause: E
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Renders the error as plain JSON.
|
|
108
|
+
*
|
|
109
|
+
* Called by `JSON.stringify`, and used wherever an error has to survive a boundary a class
|
|
110
|
+
* cannot cross: a log line, a worker message, a bug report.
|
|
111
|
+
* @returns The serialisable form.
|
|
112
|
+
*/
|
|
113
|
+
toJSON() {
|
|
114
|
+
const E = {
|
|
115
|
+
name: this.name,
|
|
116
|
+
code: this.code,
|
|
117
|
+
message: this.message,
|
|
118
|
+
source: this.source,
|
|
119
|
+
recoverable: this.recoverable,
|
|
120
|
+
details: this.details
|
|
121
|
+
};
|
|
122
|
+
return this.target !== void 0 && (E.target = this.target), this.cause instanceof Error && (E.causeMessage = this.cause.message), E;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function R(e) {
|
|
126
|
+
return e instanceof O;
|
|
127
|
+
}
|
|
128
|
+
function a(e, E) {
|
|
129
|
+
const _ = globalThis, r = /* @__PURE__ */ Symbol.for(`graphty.registry.v1.${e}`);
|
|
130
|
+
return _[r] ??= E(), _[r];
|
|
131
|
+
}
|
|
132
|
+
class U {
|
|
133
|
+
#E = /* @__PURE__ */ new Map();
|
|
134
|
+
#e;
|
|
135
|
+
/**
|
|
136
|
+
* Join the page's shared map for this extension point, creating it if this copy is first.
|
|
137
|
+
* @param kind - Which extension point, which names the page's shared map.
|
|
138
|
+
*/
|
|
139
|
+
constructor(E) {
|
|
140
|
+
this.#e = a(`${E}-implementations`, () => /* @__PURE__ */ new Map());
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* File an implementation for this copy and for every other copy on the page.
|
|
144
|
+
* @param name - The name it is filed under.
|
|
145
|
+
* @param value - The implementation.
|
|
146
|
+
*/
|
|
147
|
+
set(E, _) {
|
|
148
|
+
this.#E.set(E, _), this.#e.set(E, _);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* This copy's implementation, or else the one another copy filed.
|
|
152
|
+
* @param name - The name.
|
|
153
|
+
* @returns The implementation, or undefined when no copy filed one.
|
|
154
|
+
*/
|
|
155
|
+
get(E) {
|
|
156
|
+
return this.#E.get(E) ?? this.#e.get(E);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Whether THIS copy filed the name, which is what a built-in duplicate check asks: another
|
|
160
|
+
* copy registering its own built-ins is not a collision.
|
|
161
|
+
* @param name - The name.
|
|
162
|
+
* @returns True when this copy filed it.
|
|
163
|
+
*/
|
|
164
|
+
hasOwn(E) {
|
|
165
|
+
return this.#E.has(E);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Every name any copy filed.
|
|
169
|
+
* @returns The names, this copy's first.
|
|
170
|
+
*/
|
|
171
|
+
keys() {
|
|
172
|
+
return (/* @__PURE__ */ new Set([...this.#E.keys(), ...this.#e.keys()])).values();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function C(e) {
|
|
176
|
+
const E = a(e.kind, () => ({
|
|
177
|
+
entries: /* @__PURE__ */ new Map(),
|
|
178
|
+
warned: /* @__PURE__ */ new Set(),
|
|
179
|
+
cached: null
|
|
180
|
+
})), { entries: _, warned: r } = E;
|
|
181
|
+
return {
|
|
182
|
+
register(s, n) {
|
|
183
|
+
const t = e.idOf(s);
|
|
184
|
+
if (typeof t != "string" || t === "")
|
|
185
|
+
throw new O({
|
|
186
|
+
code: "E_BAD_COMMAND",
|
|
187
|
+
message: `a ${e.kind} registration needs an id`,
|
|
188
|
+
source: "registry",
|
|
189
|
+
details: { kind: e.kind, field: "id" }
|
|
190
|
+
});
|
|
191
|
+
if (e.builtInIds().includes(t))
|
|
192
|
+
throw new O({
|
|
193
|
+
code: "E_DUPLICATE_PLUGIN",
|
|
194
|
+
message: `"${t}" is the id of a ${e.kind} the element ships, and a built-in id may not be taken: a saved document that named it yesterday has to mean the same thing today`,
|
|
195
|
+
source: "registry",
|
|
196
|
+
details: { kind: e.kind, name: t, builtIn: !0 }
|
|
197
|
+
});
|
|
198
|
+
const o = _.get(t);
|
|
199
|
+
if (o !== void 0) {
|
|
200
|
+
if (e.implementationOf(o) === e.implementationOf(s))
|
|
201
|
+
return;
|
|
202
|
+
if (n?.strict === !0)
|
|
203
|
+
throw new O({
|
|
204
|
+
code: "E_DUPLICATE_PLUGIN",
|
|
205
|
+
message: `a ${e.kind} named "${t}" is already registered`,
|
|
206
|
+
source: "registry",
|
|
207
|
+
details: { kind: e.kind, name: t }
|
|
208
|
+
});
|
|
209
|
+
r.has(t) || (r.add(t), console.warn(
|
|
210
|
+
`graphty: a second ${e.kind} named "${t}" replaced the first. Register one implementation per name, or pass { strict: true } to make this throw.`
|
|
211
|
+
));
|
|
212
|
+
}
|
|
213
|
+
_.set(t, s), E.cached = null;
|
|
214
|
+
},
|
|
215
|
+
entries() {
|
|
216
|
+
return Object.freeze([..._.values()]);
|
|
217
|
+
},
|
|
218
|
+
descriptors() {
|
|
219
|
+
return E.cached ??= Object.freeze([..._.values()].map((s) => e.descriptorOf(s))), E.cached;
|
|
220
|
+
},
|
|
221
|
+
byId(s) {
|
|
222
|
+
return _.get(s);
|
|
223
|
+
},
|
|
224
|
+
clearForTesting() {
|
|
225
|
+
_.clear(), r.clear(), E.cached = null;
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
export {
|
|
230
|
+
D as A,
|
|
231
|
+
O as G,
|
|
232
|
+
U as S,
|
|
233
|
+
T as a,
|
|
234
|
+
i as b,
|
|
235
|
+
C as c,
|
|
236
|
+
R as i,
|
|
237
|
+
a as s
|
|
238
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as a } from "./
|
|
2
|
-
class
|
|
1
|
+
import { s as n, G as a } from "./pluginRegistry-MaTIDh6l.js";
|
|
2
|
+
class c {
|
|
3
3
|
#e = /* @__PURE__ */ new Map();
|
|
4
4
|
#t = /* @__PURE__ */ new Set();
|
|
5
5
|
#a = /* @__PURE__ */ new Set();
|
|
@@ -102,12 +102,12 @@ class n {
|
|
|
102
102
|
e();
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
const
|
|
106
|
-
function
|
|
107
|
-
|
|
105
|
+
const o = n("accelerator", () => new c());
|
|
106
|
+
function h(r, e) {
|
|
107
|
+
o.register(r, e);
|
|
108
108
|
}
|
|
109
109
|
export {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
c as A,
|
|
111
|
+
o as a,
|
|
112
|
+
h as r
|
|
113
113
|
};
|