@graphty/graphty-element 2.4.1 → 2.5.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.
Files changed (40) hide show
  1. package/dist/ai.js +3 -3
  2. package/dist/catalog.js +6 -6
  3. package/dist/chunks/{AiManager-DNJCoeTO.js → AiManager-CrbvKdEK.js} +5 -5
  4. package/dist/chunks/{DataSource-xL3Yn0Pa.js → DataSource-qU-nLhXN.js} +3 -3
  5. package/dist/chunks/{GraphSession-PFm2tJ_j.js → GraphSession-DuAhRgCd.js} +863 -856
  6. package/dist/chunks/{GraphtyLogger-kbOx2zq3.js → GraphtyLogger-DOTwCiMR.js} +1 -1
  7. package/dist/chunks/{VoiceInputAdapter-CDNKQgUK.js → VoiceInputAdapter-D4NrRL_1.js} +1 -1
  8. package/dist/chunks/{XRPivotCameraController-JdlLBcD7.js → XRPivotCameraController-Uqa47vmo.js} +2 -2
  9. package/dist/chunks/{algorithms-B87OPYw4.js → algorithms-D-ab-Auu.js} +2 -2
  10. package/dist/chunks/{capability-check-B2oYf_30.js → capability-check-Vw3IcqiE.js} +1 -1
  11. package/dist/chunks/detect-B4Qrw976.js +88 -0
  12. package/dist/chunks/{format-detection-BG6CMwPO.js → format-detection-r2IfNFXO.js} +1 -1
  13. package/dist/chunks/{index-6GDfNfwJ.js → index-J9MgLio9.js} +104 -83
  14. package/dist/chunks/{optionsFromZod-DHLLiX_8.js → optionsFromZod-B9RncoTX.js} +183 -178
  15. package/dist/chunks/{paletteRegistry-jg9uS7wo.js → paletteRegistry-Kt-6CeoN.js} +19 -13
  16. package/dist/chunks/{pluginRegistry-MaTIDh6l.js → pluginRegistry-Bs8bEkz9.js} +3 -2
  17. package/dist/chunks/{registry-DQeq4B2K.js → registry-BdGvyZou.js} +1 -1
  18. package/dist/chunks/{scales-BXHmwPXC.js → scales-CJCRwi2J.js} +4 -4
  19. package/dist/custom-elements.json +1 -1
  20. package/dist/extend.js +7 -7
  21. package/dist/graphty-catalog.json +4 -3
  22. package/dist/graphty.bundle.js +15837 -15793
  23. package/dist/graphty.js +6 -6
  24. package/dist/index.d.ts +1 -1
  25. package/dist/logging.js +2 -2
  26. package/dist/session.js +5 -5
  27. package/dist/src/Graph.d.ts +3 -3
  28. package/dist/src/catalog/formats.d.ts +5 -1
  29. package/dist/src/catalog/types.d.ts +13 -2
  30. package/dist/src/errors/codes.d.ts +7 -0
  31. package/dist/src/events.d.ts +35 -2
  32. package/dist/src/managers/EventManager.d.ts +4 -0
  33. package/dist/src/managers/LayoutManager.d.ts +7 -0
  34. package/dist/src/session/results/types.d.ts +26 -0
  35. package/dist/src/session/styles/StylesApi.d.ts +6 -5
  36. package/dist/src/session/styles/explain.d.ts +3 -3
  37. package/dist/src/session/types.d.ts +12 -1
  38. package/dist/webgpu.js +2 -2
  39. package/package.json +7 -7
  40. package/dist/chunks/detect-tuYQLJbT.js +0 -88
package/dist/graphty.js CHANGED
@@ -1,10 +1,10 @@
1
- import { A as s, a as r, b as E, D as O, E as o, d as S, G as R, e as t, I as L, L as _, N as C, O as A, R as N, S as g, f as i, g as n, h as I, U as T, i as p } from "./chunks/index-6GDfNfwJ.js";
2
- import { L as d, S as G, a as f, r as y } from "./chunks/paletteRegistry-jg9uS7wo.js";
3
- import { D as M, E as P } from "./chunks/DataSource-xL3Yn0Pa.js";
4
- import { I as m, J as U, p as c, q as x, A as u, C as B, x as V, r as H } from "./chunks/optionsFromZod-DHLLiX_8.js";
5
- import { r as Y } from "./chunks/GraphtyLogger-kbOx2zq3.js";
1
+ import { A as s, a as r, b as E, D as O, E as o, d as S, G as R, e as t, I as L, L as _, N as C, O as A, R as N, S as g, f as i, g as n, h as I, U as T, i as p } from "./chunks/index-J9MgLio9.js";
2
+ import { L as d, S as G, a as f, r as y } from "./chunks/paletteRegistry-Kt-6CeoN.js";
3
+ import { D as M, E as P } from "./chunks/DataSource-qU-nLhXN.js";
4
+ import { I as m, J as U, p as c, q as x, A as u, C as B, x as V, r as H } from "./chunks/optionsFromZod-B9RncoTX.js";
5
+ import { r as Y } from "./chunks/GraphtyLogger-DOTwCiMR.js";
6
6
  import { g as W, b as k, N as w, c as K, P as q, R as v, S as J, d as Q, e as X, f as j } from "./chunks/NodeStyle-CtmA7dXi.js";
7
- import { A as Z, a as $, G as aa, i as ea, b as sa } from "./chunks/pluginRegistry-MaTIDh6l.js";
7
+ import { A as Z, a as $, G as aa, i as ea, b as sa } from "./chunks/pluginRegistry-Bs8bEkz9.js";
8
8
  import { B as Ea, a as Oa, b as oa, C as Sa, G as Ra, c as ta, I as La, O as _a, d as Ca, e as Aa, f as Na, P as ga, g as ia, h as na, R as Ia, T as Ta, i as pa, V as la, Y as da } from "./chunks/sequential-Zym81qm7.js";
9
9
  import { a as fa, G as ya, V as Da, i as Ma } from "./chunks/GraphStyle-Cwr55SAE.js";
10
10
  import { c as ha } from "./chunks/common-DWNKjpH_.js";
package/dist/index.d.ts CHANGED
@@ -57,7 +57,7 @@ export { Algorithm } from "./src/algorithms/Algorithm";
57
57
  export { registerCameraView } from "./src/catalog/cameraRegistry";
58
58
  export { registerLogSink } from "./src/catalog/logSinkRegistry";
59
59
  export { registerPalette } from "./src/catalog/paletteRegistry";
60
- export type { CameraStateChangedEvent, DataLoadingCompleteEvent, DataLoadingErrorEvent, DataLoadingErrorSummaryEvent, DataLoadingProgressEvent, EdgeAddEvent, EdgeEvent, EdgeEventType, EdgeGenericEvent, EventCallbackType, EventType, GraphDataAddedEvent, GraphDataLoadedEvent, GraphErrorEvent, GraphEvent, GraphEventType, GraphGenericEvent, GraphLayoutInitializedEvent, GraphSettledEvent, NodeAddEvent, NodeClickEvent, NodeDragEndEvent, NodeDragStartEvent, NodeEvent, NodeEventDetail, NodeEventType, NodeGenericEvent, NodeHoverEvent, } from "./src/events";
60
+ export type { CameraStateChangedEvent, DataLoadingCompleteEvent, DataLoadingErrorEvent, DataLoadingErrorSummaryEvent, DataLoadingProgressEvent, EdgeAddEvent, EdgeEvent, EdgeEventType, EdgeGenericEvent, EventCallbackType, EventType, GraphDataAddedEvent, GraphDataClearedEvent, GraphDataLoadedEvent, GraphErrorEvent, GraphEvent, GraphEventType, GraphGenericEvent, GraphLayoutInitializedEvent, GraphSettledEvent, NodeAddEvent, NodeClickEvent, NodeDragEndEvent, NodeDragStartEvent, NodeEvent, NodeEventDetail, NodeEventType, NodeGenericEvent, NodeHoverEvent, StyleChangedEvent, } from "./src/events";
61
61
  export type { Manager, ManagerConfig, ManagerContext, QueueableManager } from "./src/managers/index";
62
62
  export { AlgorithmManager, DataManager, EventManager, InputManager, LayoutManager, OperationQueueManager, RenderManager, SelectionManager, StatsManager, UpdateManager, } from "./src/managers/index";
63
63
  export type { GraphContext, GraphContextConfig } from "./src/managers/index";
package/dist/logging.js CHANGED
@@ -1,5 +1,5 @@
1
- import { d as c, p } from "./chunks/GraphtyLogger-kbOx2zq3.js";
2
- import { G, e as C, f as M, g as w, h as N, i as V, j as I, k as P, m as U, n as T, o as x } from "./chunks/GraphtyLogger-kbOx2zq3.js";
1
+ import { d as c, p } from "./chunks/GraphtyLogger-DOTwCiMR.js";
2
+ import { G, e as C, f as M, g as w, h as N, i as V, j as I, k as P, m as U, n as T, o as x } from "./chunks/GraphtyLogger-DOTwCiMR.js";
3
3
  const g = "graphty-element-logging-config";
4
4
  function O(t) {
5
5
  try {
package/dist/session.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { R, e as _ } from "./chunks/types-C_c53VgR.js";
2
- import { A as c, a as C, G as p, i as m, b as L } from "./chunks/pluginRegistry-MaTIDh6l.js";
3
- import { p as O, q as U, R as I, t as P, u as y, w as N, x as D, y as w, z as v } from "./chunks/optionsFromZod-DHLLiX_8.js";
4
- import { D as h } from "./chunks/GraphSession-PFm2tJ_j.js";
5
- import { a as b, b as x, c as F, d as z, Q as M, R as k, e as H, f as Y, S as j, T as q, g as Q, i as X, h as B, j as J, k as K } from "./chunks/GraphSession-PFm2tJ_j.js";
6
- import { L as s } from "./chunks/scales-BXHmwPXC.js";
2
+ import { A as c, a as C, G as p, i as m, b as L } from "./chunks/pluginRegistry-Bs8bEkz9.js";
3
+ import { p as O, q as U, R as I, t as P, u as y, w as N, x as D, y as w, z as v } from "./chunks/optionsFromZod-B9RncoTX.js";
4
+ import { D as h } from "./chunks/GraphSession-DuAhRgCd.js";
5
+ import { a as b, b as x, c as F, d as z, Q as M, R as k, e as H, f as Y, S as j, T as q, g as Q, i as X, h as B, j as J, k as K } from "./chunks/GraphSession-DuAhRgCd.js";
6
+ import { L as s } from "./chunks/scales-CJCRwi2J.js";
7
7
  const u = [
8
8
  {
9
9
  id: "fixed",
@@ -12,7 +12,7 @@ import { type CameraController, type CameraKey, CameraManager } from "./cameras/
12
12
  import type { AlgorithmKey, Scope } from "./catalog/types";
13
13
  import { AdHocData, FetchEdgesFn, FetchNodesFn, type GraphBackgroundConfig, type GraphBehaviorConfig, type GraphSelectionStyleInput, type ViewMode, type XRConfig } from "./config";
14
14
  import { type PartialXRConfig } from "./config/xr-config-schema";
15
- import { EventCallbackType, EventType } from "./events";
15
+ import { EventOfType, EventType } from "./events";
16
16
  import { type AddEdgesOptions, DataManager, EventManager, type GraphContext, type GraphContextConfig, InputManager, LayoutManager, OperationQueueManager, type RecordedInputEvent, SelectionManager, StatsManager, StylePainter, UpdateManager } from "./managers";
17
17
  import { MeshCache } from "./meshes/MeshCache";
18
18
  import { Node } from "./Node";
@@ -694,7 +694,7 @@ export declare class Graph implements GraphContext {
694
694
  * stop();
695
695
  * ```
696
696
  */
697
- on(type: EventType, cb: EventCallbackType): () => void;
697
+ on<K extends EventType>(type: K, cb: (evt: EventOfType<K>) => void): () => void;
698
698
  /**
699
699
  * Add an event listener for graph events.
700
700
  * @param type - Event type to listen for
@@ -702,7 +702,7 @@ export declare class Graph implements GraphContext {
702
702
  * @returns The listener's id, which `removeListener` takes. It used to be dropped here, so
703
703
  * nothing a consumer could reach was able to undo an `addListener`.
704
704
  */
705
- addListener(type: EventType, cb: EventCallbackType): symbol;
705
+ addListener<K extends EventType>(type: K, cb: (evt: EventOfType<K>) => void): symbol;
706
706
  /**
707
707
  * Stop listening, given the id `addListener` handed back.
708
708
  * @param id - The id to remove.
@@ -20,7 +20,11 @@ export interface UnservedFormat {
20
20
  export declare const FORMAT_DESCRIPTORS: readonly FormatDescriptor[];
21
21
  /**
22
22
  * The built-in format names no registered data source reads. Listed rather than omitted, so a
23
- * consumer learns the gap from the catalogue instead of from a failed load.
23
+ * consumer learns the gap from the catalogue instead of from a failed load, and a load that names
24
+ * one fails with the reason given here.
25
+ *
26
+ * Both entries are deprecated: "sif" (issue #306) and "cx2" (issue #307) are removed from
27
+ * `FormatId` at the next major release unless graph-io gains a reader for them first.
24
28
  */
25
29
  export declare const UNSERVED_FORMAT_IDS: readonly UnservedFormat[];
26
30
  /**
@@ -85,9 +85,20 @@ export type AlgorithmKey = KnownAlgorithm | (string & {});
85
85
  export declare const KNOWN_LAYOUT_IDS: readonly ["force", "force-2d", "circular", "radial", "hierarchical", "grid", "shell", "spectral", "bipartite", "layers", "fixed", "random"];
86
86
  /** A layout id: a built-in name, or a plugin's. */
87
87
  export type LayoutId = (typeof KNOWN_LAYOUT_IDS)[number] | (string & {});
88
- /** The built-in file formats. */
88
+ /**
89
+ * The built-in file formats.
90
+ *
91
+ * "sif" and "cx2" are deprecated: no data source reads them (see `UNSERVED_FORMAT_IDS`, and issues
92
+ * #306 and #307). A load that names either fails with that reason. Both are removed at the next
93
+ * major release unless a reader lands first.
94
+ */
89
95
  export declare const KNOWN_FORMAT_IDS: readonly ["json", "csv", "graphml", "gexf", "gml", "dot", "pajek", "sif", "cx2"];
90
- /** A format id: a built-in name, or a plugin's. */
96
+ /**
97
+ * A format id: a built-in name, or a plugin's.
98
+ *
99
+ * The built-in names "sif" and "cx2" are deprecated and unserved (issues #306 and #307); they are
100
+ * removed at the next major release unless a reader lands first.
101
+ */
91
102
  export type FormatId = (typeof KNOWN_FORMAT_IDS)[number] | (string & {});
92
103
  /**
93
104
  * The built-in palettes: seven sequential ramps, five categorical sets, three diverging ramps and
@@ -130,6 +130,13 @@ export type GraphtyErrorCode =
130
130
  * rebinds the artifact.
131
131
  */
132
132
  | "E_UNKNOWN_RUN"
133
+ /**
134
+ * A styles call names a layer id the stack does not hold -- usually one removed a moment
135
+ * earlier, so the caller's layer list is stale. The call itself is well formed, which is why
136
+ * this is not `E_BAD_COMMAND`. `details.known` lists the ids the stack does hold. The caller
137
+ * refreshes its layer list.
138
+ */
139
+ | "E_UNKNOWN_LAYER"
133
140
  /**
134
141
  * A document being serialised refers to a run whose id was derived rather than author
135
142
  * assigned, so the reference would resolve differently on reload. The caller re-runs with an
@@ -7,13 +7,21 @@ import type { ImportReport } from "./data/report";
7
7
  import type { Edge } from "./Edge";
8
8
  import type { Graph } from "./Graph";
9
9
  import type { Node } from "./Node";
10
+ import type { StyleChange } from "./session/styles/StylesApi";
10
11
  export type EventType = GraphEventType | NodeEventType | EdgeEventType | AiEventType;
11
12
  export type EventCallbackType = (evt: GraphEvent | NodeEvent | EdgeEvent | AiEvent) => void;
13
+ type AnyEvent = GraphEvent | NodeEvent | EdgeEvent | AiEvent;
14
+ /**
15
+ * The event a listener for `K` receives: every member of the event unions whose `type` admits `K`.
16
+ * Not `Extract<AnyEvent, { type: K }>`, which drops a member whose `type` is itself a union --
17
+ * the generic events -- and would hand their listeners `never`.
18
+ */
19
+ export type EventOfType<K extends EventType> = AnyEvent extends infer E ? E extends AnyEvent ? K extends E["type"] ? E : never : never : never;
12
20
  export type GraphEventType = GraphEvent["type"];
13
21
  export type NodeEventType = NodeEvent["type"];
14
22
  export type EdgeEventType = EdgeEvent["type"];
15
23
  type AiEventType = AiEvent["type"];
16
- export type GraphEvent = GraphSettledEvent | GraphErrorEvent | GraphDataLoadedEvent | GraphDataAddedEvent | GraphSnapshotReplacedEvent | GraphSnapshotDroppedEvent | GraphLayoutInitializedEvent | CameraStateChangedEvent | GraphGenericEvent | DataLoadingProgressEvent | DataLoadingErrorEvent | DataLoadingErrorSummaryEvent | DataLoadingCompleteEvent | ElementsRemovedEvent | SelectionChangedEvent;
24
+ export type GraphEvent = GraphSettledEvent | GraphErrorEvent | GraphDataLoadedEvent | GraphDataAddedEvent | GraphSnapshotReplacedEvent | GraphSnapshotDroppedEvent | GraphDataClearedEvent | GraphLayoutInitializedEvent | CameraStateChangedEvent | GraphGenericEvent | DataLoadingProgressEvent | DataLoadingErrorEvent | DataLoadingErrorSummaryEvent | DataLoadingCompleteEvent | ElementsRemovedEvent | StyleChangedEvent | SelectionChangedEvent;
17
25
  /**
18
26
  * The graph event types that stay INSIDE the element: emitted on the internal graph observable so
19
27
  * the element's own managers can react, and never re-dispatched to the DOM.
@@ -103,6 +111,14 @@ export interface GraphSnapshotReplacedEvent {
103
111
  export interface GraphSnapshotDroppedEvent {
104
112
  type: "snapshot-dropped";
105
113
  }
114
+ /**
115
+ * Emitted once every time the graph's data is cleared -- by `clearData()`, and by a load that
116
+ * replaces the dataset -- after every node and edge is gone. It carries nothing, so it survives
117
+ * structured cloning; a consumer that wants the new counts reads them.
118
+ */
119
+ export interface GraphDataClearedEvent {
120
+ type: "data-cleared";
121
+ }
106
122
  export interface GraphLayoutInitializedEvent {
107
123
  type: "layout-initialized";
108
124
  layoutType: string;
@@ -130,9 +146,26 @@ export interface CameraStateChangedEvent {
130
146
  };
131
147
  }
132
148
  export interface GraphGenericEvent {
133
- type: "render-initialized" | "manager-initialized" | "lifecycle-initialized" | "lifecycle-disposed" | "skybox-loaded" | "operation-queue-active" | "operation-queue-idle" | "operation-batch-complete" | "operation-start" | "operation-complete" | "operation-progress" | "operation-obsoleted" | "animation-progress" | "animation-cancelled" | "screenshot-enhancing" | "screenshot-ready" | "style-changed" | "zoom-to-fit-complete" | "graph-frame-stable";
149
+ type: "render-initialized" | "manager-initialized" | "lifecycle-initialized" | "lifecycle-disposed" | "skybox-loaded" | "operation-queue-active" | "operation-queue-idle" | "operation-batch-complete" | "operation-start" | "operation-complete" | "operation-progress" | "operation-obsoleted" | "animation-progress" | "animation-cancelled" | "screenshot-enhancing" | "screenshot-ready" | "zoom-to-fit-complete" | "graph-frame-stable";
134
150
  [key: string]: unknown;
135
151
  }
152
+ /**
153
+ * Emitted after the style stack changed and the graph was repainted for it.
154
+ *
155
+ * The detail is counts and words, never layers, so it survives structured cloning; a consumer
156
+ * that wants the stack itself reads `session.styles.list()`.
157
+ */
158
+ export interface StyleChangedEvent {
159
+ type: "style-changed";
160
+ /** Which style verb produced the change. */
161
+ reason: StyleChange["reason"];
162
+ /** How many layers the change touched. */
163
+ layers: number;
164
+ /** How much was repainted, or null when no renderer is bound. */
165
+ painted: StyleChange["painted"];
166
+ /** The paths the changed layers read that nothing in the session answers yet. */
167
+ unresolvedPaths: string[];
168
+ }
136
169
  export interface DataLoadingProgressEvent {
137
170
  type: "data-loading-progress";
138
171
  format: string;
@@ -103,6 +103,10 @@ export declare class EventManager implements Manager {
103
103
  * store is still alive, so a listener releasing a snapshot can still derive from it.
104
104
  */
105
105
  emitSnapshotDropped(): void;
106
+ /**
107
+ * Emits the public announcement that the graph's data was cleared.
108
+ */
109
+ emitDataCleared(): void;
106
110
  /**
107
111
  * Emits a layout initialized event when a layout is ready
108
112
  * @param layoutType - Type of layout that was initialized
@@ -130,6 +130,13 @@ export declare class LayoutManager implements Manager {
130
130
  * @param event - The freeze, carrying the snapshot every consumer must switch to.
131
131
  */
132
132
  private onSnapshotReplaced;
133
+ /**
134
+ * Forget the cleared graph: stop the engine and build a fresh one of the same type with the
135
+ * consumer's own options, so the next load lays out from scratch instead of inheriting the old
136
+ * engine's bodies and its settled state. A failure is already reported on the error channel
137
+ * by `_setLayoutInternal`, which also leaves the old engine in place.
138
+ */
139
+ private reset;
133
140
  /**
134
141
  * Report a failure that happened to a layout already running, on the element's error channel.
135
142
  * @param error - Whatever was thrown.
@@ -52,6 +52,27 @@ export declare const RESULT_PATH_RUN_PLACEHOLDER = "$";
52
52
  * @returns The path, such as "results.louvain.group".
53
53
  */
54
54
  export declare function resultPath(runId: RunId, field?: string): Path;
55
+ /**
56
+ * The name a grouping result gives one of its groups, from its place in the size order.
57
+ *
58
+ * The summary and the legend both print this, so one group is called the same thing in the list
59
+ * of groups and in the key to the colours -- rather than "Group 1" in one and its raw id "0" in the
60
+ * other.
61
+ * @param rank - The group's 1-based place, largest group first.
62
+ * @returns The name, such as "Group 1".
63
+ */
64
+ export declare function groupName(rank: number): string;
65
+ /**
66
+ * Order two keys of equally large groups, so they come back in the same order every time.
67
+ *
68
+ * Keys that are both numbers, or the canonical spelling of one, compare as numbers, so group 2
69
+ * comes before group 10 whether the key arrived as a number or as the string a category column
70
+ * turns it into. Anything else compares as text.
71
+ * @param left - One key.
72
+ * @param right - The other.
73
+ * @returns The usual negative, zero or positive ordering.
74
+ */
75
+ export declare function compareGroupKeys(left: string | number, right: string | number): number;
55
76
  /**
56
77
  * Replace the run-id placeholder in a catalogue descriptor's static path with a real run id.
57
78
  * @param path - The path as a descriptor declares it, such as "results.$.value".
@@ -586,6 +607,11 @@ export interface SummaryGroup {
586
607
  readonly group: string | number;
587
608
  /** How many elements are in it. */
588
609
  readonly size: number;
610
+ /**
611
+ * What to call it, such as "Group 1", for a result that partitions into groups. The legend
612
+ * of a colour encoding over the same groups labels its swatches with the same names.
613
+ */
614
+ readonly name?: string;
589
615
  }
590
616
  /**
591
617
  * A result, small enough to hand to anything.
@@ -176,7 +176,8 @@ export interface StylesApi {
176
176
  * @param patch - What to change about it.
177
177
  * @param options - A signal to cancel with, and a progress handler.
178
178
  * @returns A run that resolves with the layer as it now stands, and rejects with
179
- * `E_PROTECTED` for an element-owned layer.
179
+ * `E_PROTECTED` for an element-owned layer and `E_UNKNOWN_LAYER` for an id the stack
180
+ * does not hold.
180
181
  */
181
182
  update(id: LayerId, patch: Partial<LayerSpec>, options?: RunOptions): Run<Layer>;
182
183
  /**
@@ -184,7 +185,7 @@ export interface StylesApi {
184
185
  * @param id - The layer to remove.
185
186
  * @param options - A signal to cancel with, and a progress handler.
186
187
  * @returns A run that resolves when the layer is gone, and rejects with `E_PROTECTED` for an
187
- * element-owned layer.
188
+ * element-owned layer and `E_UNKNOWN_LAYER` for an id the stack does not hold.
188
189
  */
189
190
  remove(id: LayerId, options?: RunOptions): Run<void>;
190
191
  /**
@@ -197,7 +198,7 @@ export interface StylesApi {
197
198
  * @param before - The layer to sit below, or null for the top of the stack.
198
199
  * @param options - A signal to cancel with, and a progress handler.
199
200
  * @returns A run that resolves when the layer has moved, and rejects with `E_PROTECTED` for
200
- * an element-owned layer.
201
+ * an element-owned layer and `E_UNKNOWN_LAYER` when either id is not in the stack.
201
202
  */
202
203
  move(id: LayerId, before: LayerId | null, options?: RunOptions): Run<void>;
203
204
  /**
@@ -310,8 +311,8 @@ export interface StylesApi {
310
311
  * value out of this picture rather than an invented one.
311
312
  * @param options - A signal to cancel with, and a progress handler.
312
313
  * @returns A run that resolves with the layer as it now stands, and rejects with `E_PROTECTED`
313
- * for an element-owned layer and `E_BAD_COMMAND` when that layer works the channel out
314
- * from nothing.
314
+ * for an element-owned layer, `E_UNKNOWN_LAYER` for an id the stack does not hold, and
315
+ * `E_BAD_COMMAND` when that layer works the channel out from nothing.
315
316
  */
316
317
  resolveToStatic(id: LayerId, channel: Channel, at?: ExplainTarget, options?: RunOptions): Run<Layer>;
317
318
  /**
@@ -174,8 +174,8 @@ export declare function unboundLayers(sources: ExplainSources): readonly Unbound
174
174
  * @param at - The element whose painted value to fix on. Absent, the rule is asked about the
175
175
  * largest group it found, or the middle of the extent it measured.
176
176
  * @returns The fixed value and the patch that writes it.
177
- * @throws A `GraphtyError`: `E_PROTECTED` for an element-owned layer, and `E_BAD_COMMAND` when
178
- * the stack holds no such layer, when that layer works the channel out from nothing, or when
179
- * the rule paints nothing at the value it was asked about.
177
+ * @throws A `GraphtyError`: `E_PROTECTED` for an element-owned layer, `E_UNKNOWN_LAYER` when the
178
+ * stack holds no such layer, and `E_BAD_COMMAND` when that layer works the channel out from
179
+ * nothing or when the rule paints nothing at the value it was asked about.
180
180
  */
181
181
  export declare function resolveToStatic(layerId: LayerId, channel: Channel, sources: ExplainSources, at?: ExplainTarget): StaticResolution;
@@ -276,7 +276,18 @@ export interface SessionRecordSource {
276
276
  * Every verb here is synchronous, because every verb here is either an O(1) lookup or a walk
277
277
  * whose answer is cached against the snapshot it was computed from. The verbs that must walk the
278
278
  * graph on every call -- id listings over a scope, neighbour pages, search -- are asynchronous by
279
- * construction and are not part of this surface yet.
279
+ * construction and are not part of this surface.
280
+ *
281
+ * To list every record, resolve a scope for the ids and read each one here:
282
+ *
283
+ * ```ts
284
+ * const { nodes, edges } = await session.scope.resolve("graph");
285
+ * const nodeRecords = [...nodes].map((id) => session.data.node(id));
286
+ * const edgeRecords = [...edges].map((id) => session.data.edge(id));
287
+ * ```
288
+ *
289
+ * Every record carries the id the element stores it under, written after the record's own keys,
290
+ * so a file row with its own `id` column cannot replace it.
280
291
  */
281
292
  export interface SessionDataApi {
282
293
  /** The store this session reads, whether it built it or was handed one. */
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-DQeq4B2K.js";
4
- import { G as s } from "./chunks/pluginRegistry-MaTIDh6l.js";
3
+ import { r as h } from "./chunks/registry-BdGvyZou.js";
4
+ import { G as s } from "./chunks/pluginRegistry-Bs8bEkz9.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.4.1",
3
+ "version": "2.5.1",
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",
@@ -133,8 +133,8 @@
133
133
  "vite-plugin-eslint": "^1.8.1",
134
134
  "vitepress": "^1.6.3",
135
135
  "vitest": "^3.2.4",
136
- "@graphty/webgpu-graph-algorithms": "^0.6.7",
137
- "@graphty/remote-logger": "^1.3.7"
136
+ "@graphty/remote-logger": "^1.3.7",
137
+ "@graphty/webgpu-graph-algorithms": "^0.6.8"
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.7"
149
+ "@graphty/webgpu-graph-algorithms": "^0.6.8"
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/algorithms": "^2.0.4",
188
- "@graphty/graph-format": "^1.0.5",
189
- "@graphty/layout": "^1.10.0"
187
+ "@graphty/algorithms": "^2.0.5",
188
+ "@graphty/graph-format": "^1.0.6",
189
+ "@graphty/layout": "^1.10.1"
190
190
  },
191
191
  "overrides": {
192
192
  "storybook": "$storybook"
@@ -1,88 +0,0 @@
1
- import { F as u, h as p } from "./paletteRegistry-jg9uS7wo.js";
2
- import { G as h } from "./pluginRegistry-MaTIDh6l.js";
3
- function f(e) {
4
- return e.startsWith("<");
5
- }
6
- const m = [
7
- { id: "graphml", detect: (e) => e.includes('xmlns="http://graphml.graphdrawing.org') },
8
- { id: "gexf", detect: (e) => e.includes('xmlns="http://gexf.net') },
9
- { id: "json", detect: (e) => e.startsWith("{") || e.startsWith("[") },
10
- { id: "gml", detect: (e) => !f(e) && /graph\s*\[/i.test(e) },
11
- { id: "pajek", detect: (e) => /^\*vertices/i.test(e) },
12
- { id: "dot", detect: (e) => /^\s*(strict\s+)?(di)?graph\s+/i.test(e) },
13
- { id: "csv", detect: (e) => !f(e) && /^[\w-]+[ \t]*[,\t;|][ \t]*[\w-]+/m.test(e) }
14
- ];
15
- function d(e, r) {
16
- try {
17
- return e(r);
18
- } catch {
19
- return !1;
20
- }
21
- }
22
- function O(e) {
23
- return /\.[^.]+$/.exec(e.toLowerCase())?.[0] ?? null;
24
- }
25
- function w(e) {
26
- const r = e.sample?.trim() ?? "", s = p(), o = e.filename === void 0 ? null : O(e.filename);
27
- if (o !== null) {
28
- const t = [
29
- ...u.filter((i) => i.extensions.includes(o)).map(
30
- (i) => i.id
31
- ),
32
- ...s.filter((i) => i.descriptor.extensions.includes(o)).map((i) => i.descriptor.id)
33
- ];
34
- if (t.length > 1 && r !== "") {
35
- const i = new Map([
36
- ...m.map((n) => [n.id, n.detect]),
37
- ...s.filter((n) => n.detect !== void 0).map((n) => [n.descriptor.id, n.detect])
38
- ]), c = t.filter((n) => {
39
- const l = i.get(n);
40
- return l !== void 0 && d(l, r);
41
- });
42
- if (c.length > 0)
43
- return Object.freeze([...c, ...t.filter((n) => !c.includes(n))]);
44
- }
45
- if (t.length > 0)
46
- return Object.freeze(t);
47
- }
48
- if (r === "")
49
- return Object.freeze([]);
50
- const a = m.filter((t) => d(t.detect, r)).map(
51
- (t) => t.id
52
- );
53
- for (const t of s) {
54
- const { detect: i } = t;
55
- i !== void 0 && d(i, r) && !a.includes(t.descriptor.id) && a.push(t.descriptor.id);
56
- }
57
- return Object.freeze(a);
58
- }
59
- function F(e) {
60
- return w(e)[0] ?? null;
61
- }
62
- function g() {
63
- return [...u.map((e) => e.id), ...p().map((e) => e.descriptor.id)];
64
- }
65
- function b(e) {
66
- const r = g();
67
- return new h({
68
- code: "E_UNKNOWN_FORMAT",
69
- message: `no format is named "${e}". The formats this element can read are: ${r.join(", ")}. A format of your own is registered with \`DataSource.register\`.`,
70
- source: "data",
71
- details: { format: e, available: [...r] }
72
- });
73
- }
74
- function T(e, r) {
75
- const s = g();
76
- return new h({
77
- code: "E_UNKNOWN_FORMAT",
78
- message: `nothing recognised the format of "${e}". The formats this element can read are: ${s.join(", ")}. Name one explicitly: ${r}`,
79
- source: "data",
80
- details: { source: e, available: [...s] }
81
- });
82
- }
83
- export {
84
- w as a,
85
- T as b,
86
- F as d,
87
- b as u
88
- };