@graphty/graphty-element 2.4.0 → 2.5.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/ai.js +3 -3
- package/dist/catalog.js +6 -6
- package/dist/chunks/{AiManager-BD9XK30e.js → AiManager-DNJCoeTO.js} +5 -5
- package/dist/chunks/{DataSource-B8vf2uhW.js → DataSource-xL3Yn0Pa.js} +72 -61
- package/dist/chunks/{GraphSession-dcwOjGJh.js → GraphSession-PFm2tJ_j.js} +1483 -1441
- package/dist/chunks/{GraphtyLogger-CqOVV13Y.js → GraphtyLogger-kbOx2zq3.js} +169 -221
- package/dist/chunks/{VoiceInputAdapter-D0tHHi9G.js → VoiceInputAdapter-CDNKQgUK.js} +1 -1
- package/dist/chunks/{XRPivotCameraController-DTfhvhHz.js → XRPivotCameraController-JdlLBcD7.js} +146 -134
- package/dist/chunks/{algorithms-BF0X6RPw.js → algorithms-B87OPYw4.js} +2 -2
- package/dist/chunks/{capability-check-BJzlK4oL.js → capability-check-B2oYf_30.js} +1 -1
- package/dist/chunks/{detect-vJxK7n0D.js → detect-tuYQLJbT.js} +2 -2
- package/dist/chunks/{format-detection-C80TLQ2e.js → format-detection-BG6CMwPO.js} +1 -1
- package/dist/chunks/{index-2xkq7wyD.js → index-6GDfNfwJ.js} +2928 -2856
- package/dist/chunks/{optionsFromZod-BuTOFgVM.js → optionsFromZod-DHLLiX_8.js} +237 -236
- package/dist/chunks/{paletteRegistry-A63C71Gn.js → paletteRegistry-jg9uS7wo.js} +66 -66
- package/dist/chunks/pluginRegistry-MaTIDh6l.js +238 -0
- package/dist/chunks/{registry-jB46Gmeb.js → registry-DQeq4B2K.js} +8 -8
- package/dist/chunks/{scales-B2d-7Bf0.js → scales-BXHmwPXC.js} +4 -4
- package/dist/extend.js +7 -7
- package/dist/graphty-catalog.json +1 -1
- package/dist/graphty.bundle.js +25128 -24837
- package/dist/graphty.js +67 -63
- package/dist/index.d.ts +3 -0
- package/dist/logging.js +2 -2
- package/dist/session.js +5 -5
- package/dist/src/Edge.d.ts +4 -4
- package/dist/src/acceleration/AccelerationController.d.ts +6 -0
- package/dist/src/acceleration/registry.d.ts +3 -0
- package/dist/src/acceleration/types.d.ts +7 -0
- package/dist/src/algorithms/Algorithm.d.ts +13 -0
- package/dist/src/cameras/InputUtils.d.ts +67 -0
- package/dist/src/cameras/XRInputHandler.d.ts +0 -8
- package/dist/src/catalog/pluginRegistry.d.ts +62 -0
- package/dist/src/catalog/registry.d.ts +7 -0
- package/dist/src/data/DataSource.d.ts +1 -1
- package/dist/src/errors/codes.d.ts +2 -1
- 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/PatternedLineRenderer.d.ts +5 -37
- package/dist/src/meshes/PerSceneMaterials.d.ts +49 -0
- 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 +5 -5
- package/dist/chunks/GraphtyError-B93WRH3e.js +0 -134
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "@babylonjs/core/Meshes/instancedMesh";
|
|
2
|
+
import { type AbstractMesh, InstancedMesh, Mesh, Scene, ShaderMaterial, Vector3 } from "@babylonjs/core";
|
|
2
3
|
export interface FilledArrowOptions {
|
|
3
4
|
size: number;
|
|
4
5
|
color: string;
|
|
@@ -18,16 +19,23 @@ export interface FilledArrowOptions {
|
|
|
18
19
|
*/
|
|
19
20
|
export declare class FilledArrowRenderer {
|
|
20
21
|
private static shadersRegistered;
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Every billboarding material, grouped by scene, each scene's group given that scene's
|
|
24
|
+
* camera position once per frame. See {@link PerSceneMaterials} for the defect (issue #45).
|
|
25
|
+
*/
|
|
26
|
+
private static readonly cameraTracked;
|
|
27
|
+
/**
|
|
28
|
+
* The arrowhead batches: per scene, one hidden source mesh per batch key. See
|
|
29
|
+
* {@link FilledArrowRenderer.instanceOf}.
|
|
30
|
+
*/
|
|
31
|
+
private static readonly batches;
|
|
23
32
|
/**
|
|
24
33
|
* Unregister a shader material so the per-frame camera-uniform walk stops visiting it.
|
|
25
34
|
*
|
|
26
35
|
* WHY THIS EXISTS -- the defect it repairs:
|
|
27
36
|
* {@link FilledArrowRenderer.applyShader} builds a fresh `ShaderMaterial` per mesh and
|
|
28
|
-
* adds it to
|
|
29
|
-
*
|
|
30
|
-
* path but cannot fire: `ShaderMaterial.setVector3` does not throw on a disposed
|
|
37
|
+
* adds it to the per-frame camera walk. Nothing used to remove entries. A `catch` inside
|
|
38
|
+
* that walk read as an eviction path but could not fire: `ShaderMaterial.setVector3` does not throw on a disposed
|
|
31
39
|
* material, it just records the value into a dead material's uniform cache. So every
|
|
32
40
|
* arrowhead and every pattern element ever built stayed in the walk for the lifetime of
|
|
33
41
|
* the page, and since both are rebuilt wholesale on every style change the walk grew
|
|
@@ -48,21 +56,15 @@ export declare class FilledArrowRenderer {
|
|
|
48
56
|
* Exists so the leak described on {@link FilledArrowRenderer.releaseMaterial} is
|
|
49
57
|
* OBSERVABLE from a test; it has no visible symptom until the frame rate has already
|
|
50
58
|
* collapsed, and asserting on frame time instead would be flaky.
|
|
59
|
+
* @param scene - Count only this scene's materials; omit for every scene
|
|
51
60
|
* @returns Count of tracked materials
|
|
52
61
|
* @public
|
|
53
62
|
*/
|
|
54
|
-
static getActiveMaterialCount(): number;
|
|
63
|
+
static getActiveMaterialCount(scene?: Scene): number;
|
|
55
64
|
/**
|
|
56
65
|
* Register filled arrow shaders
|
|
57
66
|
*/
|
|
58
67
|
static registerShaders(): void;
|
|
59
|
-
/**
|
|
60
|
-
* Register the shared camera position update callback
|
|
61
|
-
* This callback updates ALL arrow materials at once, instead of having one callback per material.
|
|
62
|
-
* This dramatically improves performance when rendering many arrows.
|
|
63
|
-
* @param scene - The Babylon.js scene to register the callback on
|
|
64
|
-
*/
|
|
65
|
-
private static registerCameraCallback;
|
|
66
68
|
/**
|
|
67
69
|
* Create a filled triangle arrow mesh
|
|
68
70
|
*
|
|
@@ -191,13 +193,11 @@ export declare class FilledArrowRenderer {
|
|
|
191
193
|
*
|
|
192
194
|
* This line used to read `mesh.alwaysSelectAsActiveMesh = true`, with a comment
|
|
193
195
|
* explaining that thin instances needed it because their base mesh was parked at
|
|
194
|
-
* y = -10000. Both halves of that comment are now false.
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
* the `MeshCache` template that genuinely does sit at y = -10000 holds NODE meshes, uses
|
|
200
|
-
* `InstancedMesh`, and never reaches this function. The flag's effect today is simply that
|
|
196
|
+
* y = -10000. Both halves of that comment are now false. This function is reached from
|
|
197
|
+
* `applyShader` (pattern elements, one mesh each) and from `createArrowInstance`, which
|
|
198
|
+
* calls it on each arrowhead INSTANCE -- positioned at the real arrow location by `Edge` --
|
|
199
|
+
* never on a parked template; and the `MeshCache` template that genuinely does sit at
|
|
200
|
+
* y = -10000 holds NODE meshes and never reaches this function. The flag's effect was that
|
|
201
201
|
* every mesh carrying this shader is submitted every frame regardless of where the camera
|
|
202
202
|
* is pointing -- which, at the mesh counts a dotted line used to reach, was thousands of
|
|
203
203
|
* pointless draw calls per frame.
|
|
@@ -230,10 +230,48 @@ export declare class FilledArrowRenderer {
|
|
|
230
230
|
/**
|
|
231
231
|
* Set the line direction for a filled arrow mesh
|
|
232
232
|
* This should be called every frame when the edge updates
|
|
233
|
-
* @param mesh - Filled arrow mesh
|
|
233
|
+
* @param mesh - Filled arrow mesh, or an arrowhead instance from {@link FilledArrowRenderer.createArrowInstance}
|
|
234
234
|
* @param direction - Line direction vector (normalized)
|
|
235
235
|
*/
|
|
236
|
-
static setLineDirection(mesh:
|
|
236
|
+
static setLineDirection(mesh: AbstractMesh, direction: Vector3): void;
|
|
237
|
+
/**
|
|
238
|
+
* Draw one arrowhead as an instance of its scene's batch for `key`, building the batch's
|
|
239
|
+
* hidden source mesh with `build` the first time the scene needs it.
|
|
240
|
+
*
|
|
241
|
+
* WHY -- issue #25: every arrowhead used to be its own `Mesh` with its own material, so N
|
|
242
|
+
* arrowheaded edges cost N draw calls a frame (and, through issue #27, O(N^2) to load). A
|
|
243
|
+
* batch is drawn in one call however many edges use it. Each instance keeps its own
|
|
244
|
+
* transform, and Babylon refills the per-instance buffers once per frame in one pass, so this
|
|
245
|
+
* does not bring back the per-edge buffer writes that made thin instances 35x slower.
|
|
246
|
+
*
|
|
247
|
+
* The source mesh goes when its last instance does, so a cleared graph leaves nothing in the
|
|
248
|
+
* scene, and the batches of one scene are never seen by another.
|
|
249
|
+
* @param scene - The scene the arrowhead is drawn in
|
|
250
|
+
* @param key - What the batch's heads have in common: shape, and whatever else lives on the material
|
|
251
|
+
* @param build - Builds the source mesh (with its material) for a new batch
|
|
252
|
+
* @returns The arrowhead: an instance of the batch's source mesh
|
|
253
|
+
*/
|
|
254
|
+
static instanceOf(scene: Scene, key: string, build: () => Mesh): InstancedMesh;
|
|
255
|
+
/**
|
|
256
|
+
* Draw one billboarded 3D arrowhead as an instance of its scene's batch for that shape and
|
|
257
|
+
* opacity. The direction, size and colour are the instance's own attributes, so edges of
|
|
258
|
+
* every colour and size share one draw call.
|
|
259
|
+
* @param shape - The arrow type, which names the batch's geometry
|
|
260
|
+
* @param createShape - Builds that geometry, for a new batch
|
|
261
|
+
* @param options - The head's size (world-space length), colour and opacity
|
|
262
|
+
* @param scene - Babylon.js scene
|
|
263
|
+
* @returns The arrowhead instance; point it with {@link FilledArrowRenderer.setLineDirection}
|
|
264
|
+
*/
|
|
265
|
+
static createArrowInstance(shape: string, createShape: () => Mesh, options: FilledArrowOptions, scene: Scene): InstancedMesh;
|
|
266
|
+
/**
|
|
267
|
+
* Give a batch's source mesh the billboard shader, reading direction, size and colour from
|
|
268
|
+
* instance attributes instead of uniforms.
|
|
269
|
+
* @param mesh - The batch's source mesh
|
|
270
|
+
* @param opacity - The opacity every head in the batch is drawn at
|
|
271
|
+
* @param scene - Babylon.js scene
|
|
272
|
+
* @returns The same mesh
|
|
273
|
+
*/
|
|
274
|
+
private static applyInstancedShader;
|
|
237
275
|
/**
|
|
238
276
|
* Create a 2D arrow mesh with flat StandardMaterial
|
|
239
277
|
*
|
|
@@ -45,42 +45,16 @@ export declare const PATTERN_DEFINITIONS: Record<PatternType, PatternDefinition>
|
|
|
45
45
|
* Static utility class for creating mesh-based pattern geometries for line visualization
|
|
46
46
|
*/
|
|
47
47
|
export declare class PatternedLineRenderer {
|
|
48
|
-
private static activeMaterials;
|
|
49
|
-
private static cameraCallbackRegistered;
|
|
50
48
|
/**
|
|
51
|
-
*
|
|
49
|
+
* Stop a pattern material receiving per-frame camera updates.
|
|
52
50
|
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* `
|
|
57
|
-
* are iterated once per frame to push the camera position uniform. Nothing ever removed
|
|
58
|
-
* an entry: `PatternedLineMesh.dispose` disposed the mesh with Babylon's default
|
|
59
|
-
* arguments, which leaves the material alive, and the `catch` inside each per-frame walk
|
|
60
|
-
* that looks like an eviction path cannot fire, because `ShaderMaterial.setVector3` does
|
|
61
|
-
* not throw on a disposed material. The result was a per-frame loop that grew
|
|
62
|
-
* monotonically for the lifetime of the page: every change of line style, width or colour
|
|
63
|
-
* rebuilt every edge's meshes and left the previous generation's materials in the walk
|
|
64
|
-
* forever. That is a second, slower-burning half of the same halt the product owner
|
|
65
|
-
* reported ("I changed line style to dot and width to 1 and everything crawled to a halt").
|
|
66
|
-
*
|
|
67
|
-
* Removal must reach BOTH sets, which is why this delegates to
|
|
68
|
-
* {@link FilledArrowRenderer.releaseMaterial} as well as clearing its own.
|
|
51
|
+
* Every pattern element owns its own `ShaderMaterial`, built by
|
|
52
|
+
* `FilledArrowRenderer.applyShader`, which registers it in that renderer's per-scene camera
|
|
53
|
+
* walk (see `PerSceneMaterials`). Disposing the material ends the registration on its own;
|
|
54
|
+
* `PatternedLineMesh` calls this as well, eagerly, before it disposes one.
|
|
69
55
|
* @param material - The ShaderMaterial to stop tracking; passing an untracked material is a no-op
|
|
70
|
-
* @public
|
|
71
56
|
*/
|
|
72
57
|
static releaseMaterial(material: ShaderMaterial): void;
|
|
73
|
-
/**
|
|
74
|
-
* Number of pattern materials currently receiving per-frame camera updates.
|
|
75
|
-
*
|
|
76
|
-
* Exists so the material leak described on {@link PatternedLineRenderer.releaseMaterial}
|
|
77
|
-
* is OBSERVABLE from a test. The leak has no visible symptom until the frame rate has
|
|
78
|
-
* already collapsed, and the count is the only direct evidence that a disposed pattern
|
|
79
|
-
* line truly stopped costing anything; asserting on frame time instead would be flaky.
|
|
80
|
-
* @returns Count of tracked materials
|
|
81
|
-
* @public
|
|
82
|
-
*/
|
|
83
|
-
static getActiveMaterialCount(): number;
|
|
84
58
|
/**
|
|
85
59
|
* Create a PatternedLineMesh instance
|
|
86
60
|
* Note: start/end are already adjusted by Edge.transformArrowCap() for node surfaces and arrows
|
|
@@ -233,11 +207,5 @@ export declare class PatternedLineRenderer {
|
|
|
233
207
|
* @returns The default shape type for the pattern
|
|
234
208
|
*/
|
|
235
209
|
private static getDefaultShapeType;
|
|
236
|
-
/**
|
|
237
|
-
* Register camera position update callback
|
|
238
|
-
* Updates all pattern materials in one batch per frame
|
|
239
|
-
* @param scene - Babylon.js scene
|
|
240
|
-
*/
|
|
241
|
-
private static registerCameraCallback;
|
|
242
210
|
}
|
|
243
211
|
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Scene, ShaderMaterial } from "@babylonjs/core";
|
|
2
|
+
/**
|
|
3
|
+
* Called once per frame for one scene, with the shader materials that scene draws.
|
|
4
|
+
*/
|
|
5
|
+
type RefreshFn = (scene: Scene, materials: Iterable<ShaderMaterial>) => void;
|
|
6
|
+
/**
|
|
7
|
+
* Shader materials grouped by the scene that draws them, each group refreshed by an observer on
|
|
8
|
+
* its OWN scene, just before that scene renders.
|
|
9
|
+
*
|
|
10
|
+
* WHY THIS EXISTS -- the defect it repairs (issue #45): the line, arrowhead and pattern renderers
|
|
11
|
+
* push per-frame uniforms (the render resolution, the camera position) into their shader
|
|
12
|
+
* materials. Each kept those materials in one static set shared by every `<graphty-element>` on
|
|
13
|
+
* the page, and registered its per-frame observer either once per page (on whichever scene came
|
|
14
|
+
* first) or once per scene switch. So a second element's arrowheads billboarded towards the
|
|
15
|
+
* FIRST element's camera, an element created after the first was disposed got no camera
|
|
16
|
+
* position at all, and each scene's observer walked every other scene's materials.
|
|
17
|
+
*
|
|
18
|
+
* Here each scene gets its own set and its own observer, which reads that scene's own engine and
|
|
19
|
+
* camera. A material leaves its set when it is disposed, and a scene's set and observer go when
|
|
20
|
+
* the scene is disposed, so nothing outlives the element that drew it.
|
|
21
|
+
*/
|
|
22
|
+
export declare class PerSceneMaterials {
|
|
23
|
+
private readonly refresh;
|
|
24
|
+
private readonly scenes;
|
|
25
|
+
/**
|
|
26
|
+
* Track materials whose uniforms `refresh` writes once per frame.
|
|
27
|
+
* @param refresh - Writes the per-frame uniforms of one scene's materials
|
|
28
|
+
*/
|
|
29
|
+
constructor(refresh: RefreshFn);
|
|
30
|
+
/**
|
|
31
|
+
* Track a material under its own scene and give it its uniforms now, so it draws correctly
|
|
32
|
+
* even on the first frame.
|
|
33
|
+
* @param material - The shader material to keep refreshed
|
|
34
|
+
*/
|
|
35
|
+
add(material: ShaderMaterial): void;
|
|
36
|
+
/**
|
|
37
|
+
* Stop refreshing a material. Disposing the material does this on its own.
|
|
38
|
+
* @param material - The material to forget; an untracked material is a no-op
|
|
39
|
+
*/
|
|
40
|
+
delete(material: ShaderMaterial): void;
|
|
41
|
+
/**
|
|
42
|
+
* Number of tracked materials.
|
|
43
|
+
* @param scene - Count only this scene's materials; omit for every scene
|
|
44
|
+
* @returns How many materials are refreshed each frame
|
|
45
|
+
*/
|
|
46
|
+
count(scene?: Scene): number;
|
|
47
|
+
private materialsOf;
|
|
48
|
+
}
|
|
49
|
+
export {};
|
|
@@ -11,7 +11,7 @@ interface XRSessionConfig {
|
|
|
11
11
|
referenceSpaceType: XRReferenceSpaceType;
|
|
12
12
|
optionalFeatures?: string[];
|
|
13
13
|
};
|
|
14
|
-
/** Whether XR sessions track hands (`xr.input.handTracking`).
|
|
14
|
+
/** Whether XR sessions track hands (`xr.input.handTracking`). Defaults to true. */
|
|
15
15
|
handTracking?: boolean;
|
|
16
16
|
}
|
|
17
17
|
/**
|
package/dist/webgpu.d.ts
CHANGED
|
@@ -46,6 +46,14 @@
|
|
|
46
46
|
* republishes rather than finishing that work anywhere else. Recorded in
|
|
47
47
|
* `docs/decisions/device-computes-incorrectly.md`.
|
|
48
48
|
*
|
|
49
|
+
* That the ELEMENT reports `E_DEVICE_INCORRECT` on the Windows WARP renderer is inference, by
|
|
50
|
+
* decision, not a test: no lane runs graphty-element on WARP. The host matrix (`hosts.yml`) runs
|
|
51
|
+
* only webgpu-graph-algorithms there, whose own tests show the multi-block scan failing. This
|
|
52
|
+
* file's side -- a failed check becomes `E_DEVICE_INCORRECT`, and the controller refuses the
|
|
53
|
+
* device at attach -- is pinned against a stubbed peer and a deliberately wrong fake. Adding an
|
|
54
|
+
* element job to the Windows lane is a CI cost that can be taken on later if the two halves ever
|
|
55
|
+
* disagree.
|
|
56
|
+
*
|
|
49
57
|
* ## Detection is not a fallback
|
|
50
58
|
*
|
|
51
59
|
* Finding out, before anything runs, that this host has no WebGPU and letting the element take
|
package/dist/webgpu.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EXACT_MAX_NODES as n, createAccelerator as p, verifyDevice as u } from "@graphty/webgpu-graph-algorithms";
|
|
2
2
|
import { probeBrowserWebGpu as l, requestGpuContext as d } from "@graphty/webgpu-graph-algorithms/browser";
|
|
3
|
-
import { r as h } from "./chunks/registry-
|
|
4
|
-
import { G as s } from "./chunks/
|
|
3
|
+
import { r as h } from "./chunks/registry-DQeq4B2K.js";
|
|
4
|
+
import { G as s } from "./chunks/pluginRegistry-MaTIDh6l.js";
|
|
5
5
|
const a = "webgpu-graph-algorithms", w = /* @__PURE__ */ new Set(["kind", "ctx", "options", "dispose", "verify"]);
|
|
6
6
|
function b(o, e) {
|
|
7
7
|
for (const [r, t] of Object.entries(o))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphty/graphty-element",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "A Web Component library for 3D/2D graph visualization built with Lit and Babylon.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"customElements": "./dist/custom-elements.json",
|
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
"vitepress": "^1.6.3",
|
|
135
135
|
"vitest": "^3.2.4",
|
|
136
136
|
"@graphty/remote-logger": "^1.3.7",
|
|
137
|
-
"@graphty/webgpu-graph-algorithms": "^0.6.
|
|
137
|
+
"@graphty/webgpu-graph-algorithms": "^0.6.7"
|
|
138
138
|
},
|
|
139
139
|
"peerDependencies": {
|
|
140
140
|
"@ai-sdk/anthropic": "^2.0.50",
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
"ai": "^5.0.104",
|
|
147
147
|
"encrypt-storage": "^2.14.7",
|
|
148
148
|
"lit": "^3.0.0",
|
|
149
|
-
"@graphty/webgpu-graph-algorithms": "^0.6.
|
|
149
|
+
"@graphty/webgpu-graph-algorithms": "^0.6.7"
|
|
150
150
|
},
|
|
151
151
|
"peerDependenciesMeta": {
|
|
152
152
|
"@ai-sdk/anthropic": {
|
|
@@ -184,9 +184,9 @@
|
|
|
184
184
|
"papaparse": "^5.5.3",
|
|
185
185
|
"toposort": "^2.0.2",
|
|
186
186
|
"zod": "^3.25.28",
|
|
187
|
-
"@graphty/layout": "^1.10.0",
|
|
188
187
|
"@graphty/algorithms": "^2.0.4",
|
|
189
|
-
"@graphty/graph-format": "^1.0.5"
|
|
188
|
+
"@graphty/graph-format": "^1.0.5",
|
|
189
|
+
"@graphty/layout": "^1.10.0"
|
|
190
190
|
},
|
|
191
191
|
"overrides": {
|
|
192
192
|
"storybook": "$storybook"
|
|
@@ -1,134 +0,0 @@
|
|
|
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
|
-
}, U = Object.freeze(Object.values(N)), C = 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 s(_) {
|
|
57
|
-
return typeof _ == "string" && Object.hasOwn(N, _);
|
|
58
|
-
}
|
|
59
|
-
const o = Object.freeze({});
|
|
60
|
-
function r(_) {
|
|
61
|
-
if (typeof _ != "object" || _ === null || !("code" in _))
|
|
62
|
-
return;
|
|
63
|
-
const { code: E } = _;
|
|
64
|
-
return s(E) ? E : void 0;
|
|
65
|
-
}
|
|
66
|
-
function R(_) {
|
|
67
|
-
if (typeof _ != "object" || _ === null || !("code" in _))
|
|
68
|
-
return;
|
|
69
|
-
const { code: E } = _;
|
|
70
|
-
return typeof E == "string" && !s(E) ? E : void 0;
|
|
71
|
-
}
|
|
72
|
-
class e 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 ? o : 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, O) {
|
|
95
|
-
if (E instanceof e)
|
|
96
|
-
return E;
|
|
97
|
-
const A = r(E), t = R(E), T = O.message ?? (E instanceof Error ? E.message : String(E)), D = t === void 0 ? O.details : { ...O.details, sourceCode: t };
|
|
98
|
-
return new e({
|
|
99
|
-
...O,
|
|
100
|
-
code: A ?? O.code,
|
|
101
|
-
message: T,
|
|
102
|
-
details: D,
|
|
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 L(_) {
|
|
126
|
-
return _ instanceof e;
|
|
127
|
-
}
|
|
128
|
-
export {
|
|
129
|
-
C as A,
|
|
130
|
-
e as G,
|
|
131
|
-
U as a,
|
|
132
|
-
s as b,
|
|
133
|
-
L as i
|
|
134
|
-
};
|