@graphty/graphty-element 2.6.1 → 3.0.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.
Files changed (163) hide show
  1. package/dist/ai.js +3 -3
  2. package/dist/catalog.js +53 -54
  3. package/dist/chunks/{AiManager-4iQpsJW1.js → AiManager-Bhh0rR_p.js} +706 -655
  4. package/dist/chunks/GraphSession-DPoTaT3b.js +21175 -0
  5. package/dist/chunks/{GraphtyLogger-B_O67a6c.js → GraphtyLogger-BtcBJQPL.js} +1 -1
  6. package/dist/chunks/{VoiceInputAdapter-Cc6mHXTI.js → VoiceInputAdapter-CdLsJ_nG.js} +1 -1
  7. package/dist/chunks/{XRPivotCameraController-BLa89LXn.js → XRPivotCameraController-CiLJ9Gz6.js} +2 -2
  8. package/dist/chunks/algorithms-qij74zEN.js +6811 -0
  9. package/dist/chunks/{capability-check-Am2zliFj.js → capability-check-BbgTejS3.js} +1 -1
  10. package/dist/chunks/definePalette-BYt2Llxs.js +1333 -0
  11. package/dist/chunks/fields-5uVC1Pll.js +4999 -0
  12. package/dist/chunks/{format-detection-BHwrAVzW.js → format-detection-FKaDMshR.js} +1 -1
  13. package/dist/chunks/{index-BkBLbvui.js → index-Cc_6D9hV.js} +6034 -7127
  14. package/dist/chunks/interpolation-Dk206AhZ.js +105 -0
  15. package/dist/chunks/paletteRegistry-De3CGdst.js +357 -0
  16. package/dist/chunks/parse-SVp77JbE.js +669 -0
  17. package/dist/chunks/{pluginRegistry-Bs8bEkz9.js → pluginRegistry-Ddfl6Mv2.js} +27 -24
  18. package/dist/chunks/{registry-BdGvyZou.js → registry-CgMqldp4.js} +1 -1
  19. package/dist/chunks/{DataSource-BL2UzPff.js → sources-BbAJCDIH.js} +279 -108
  20. package/dist/commands.d.ts +128 -19
  21. package/dist/commands.js +49 -1
  22. package/dist/custom-elements.json +1 -1
  23. package/dist/extend.d.ts +10 -2
  24. package/dist/extend.js +64 -57
  25. package/dist/graphty-catalog.json +6 -3
  26. package/dist/graphty.bundle.js +267177 -240648
  27. package/dist/graphty.js +84 -78
  28. package/dist/index.d.ts +4 -0
  29. package/dist/logging.js +2 -2
  30. package/dist/schema.js +70 -71
  31. package/dist/session.d.ts +5 -6
  32. package/dist/session.js +40 -86
  33. package/dist/src/Edge.d.ts +31 -67
  34. package/dist/src/Graph.d.ts +335 -77
  35. package/dist/src/Node.d.ts +36 -3
  36. package/dist/src/NodeBehavior.d.ts +28 -0
  37. package/dist/src/Styles.d.ts +15 -4
  38. package/dist/src/acceleration/AccelerationController.d.ts +8 -0
  39. package/dist/src/acceleration/narrow.d.ts +9 -1
  40. package/dist/src/acceleration/types.d.ts +10 -0
  41. package/dist/src/ai/AiController.d.ts +12 -0
  42. package/dist/src/ai/AiManager.d.ts +7 -0
  43. package/dist/src/ai/commands/AlgorithmCommands.d.ts +1 -1
  44. package/dist/src/ai/commands/LayoutCommands.d.ts +1 -1
  45. package/dist/src/ai/commands/StyleCommands.d.ts +1 -1
  46. package/dist/src/ai/commands/types.d.ts +20 -1
  47. package/dist/src/algorithms/Algorithm.d.ts +21 -4
  48. package/dist/src/algorithms/BFSAlgorithm.d.ts +0 -9
  49. package/dist/src/algorithms/BellmanFordAlgorithm.d.ts +0 -14
  50. package/dist/src/algorithms/DFSAlgorithm.d.ts +1 -1
  51. package/dist/src/algorithms/FloydWarshallAlgorithm.d.ts +5 -0
  52. package/dist/src/algorithms/GirvanNewmanAlgorithm.d.ts +5 -0
  53. package/dist/src/algorithms/LeidenAlgorithm.d.ts +5 -0
  54. package/dist/src/algorithms/PageRankAlgorithm.d.ts +1 -1
  55. package/dist/src/algorithms/StronglyConnectedComponentsAlgorithm.d.ts +1 -1
  56. package/dist/src/algorithms/metrics/fields.d.ts +23 -1
  57. package/dist/src/algorithms/utils/graphUtils.d.ts +13 -1
  58. package/dist/src/catalog/paletteRegistry.d.ts +4 -4
  59. package/dist/src/catalog/registry.d.ts +3 -2
  60. package/dist/src/catalog/types.d.ts +18 -1
  61. package/dist/src/config/GraphStyle.d.ts +1 -1
  62. package/dist/src/config/StyleTemplate.d.ts +2 -2
  63. package/dist/src/config/xr-config-schema.d.ts +4 -4
  64. package/dist/src/data/CSVDataSource.d.ts +77 -22
  65. package/dist/src/data/ErrorAggregator.d.ts +5 -0
  66. package/dist/src/data/GEXFDataSource.d.ts +12 -61
  67. package/dist/src/data/GraphMLDataSource.d.ts +3 -44
  68. package/dist/src/data/GraphStore.d.ts +322 -15
  69. package/dist/src/data/JsonDataSource.d.ts +43 -1
  70. package/dist/src/data/graph-io-import.d.ts +89 -0
  71. package/dist/src/data/graph-io-records.d.ts +64 -0
  72. package/dist/src/data/lane.d.ts +23 -0
  73. package/dist/src/data/positions.d.ts +13 -0
  74. package/dist/src/data/seedPosition.d.ts +16 -0
  75. package/dist/src/errors/GraphtyError.d.ts +3 -1
  76. package/dist/src/errors/codes.d.ts +23 -0
  77. package/dist/src/events.d.ts +12 -0
  78. package/dist/src/graphty-element.d.ts +149 -54
  79. package/dist/src/input/types.d.ts +2 -0
  80. package/dist/src/layout/D3GraphLayoutEngine.d.ts +17 -3
  81. package/dist/src/layout/FixedLayoutEngine.d.ts +20 -4
  82. package/dist/src/layout/KamadaKawaiLayoutEngine.d.ts +6 -0
  83. package/dist/src/layout/LayoutEngine.d.ts +214 -116
  84. package/dist/src/layout/NGraphLayoutEngine.d.ts +10 -3
  85. package/dist/src/layout/SimulationLayoutEngine.d.ts +8 -3
  86. package/dist/src/managers/AlgorithmManager.d.ts +24 -5
  87. package/dist/src/managers/DataManager.d.ts +258 -181
  88. package/dist/src/managers/EventManager.d.ts +5 -2
  89. package/dist/src/managers/GraphContext.d.ts +7 -0
  90. package/dist/src/managers/InputManager.d.ts +11 -0
  91. package/dist/src/managers/LayoutManager.d.ts +129 -50
  92. package/dist/src/managers/RenderManager.d.ts +14 -1
  93. package/dist/src/managers/UpdateManager.d.ts +20 -0
  94. package/dist/src/screenshot/ScreenshotCapture.d.ts +1 -1
  95. package/dist/src/session/GraphSession.d.ts +83 -6
  96. package/dist/src/session/commands/algo.d.ts +169 -0
  97. package/dist/src/session/commands/config.d.ts +45 -0
  98. package/dist/src/session/commands/data.d.ts +178 -0
  99. package/dist/src/session/commands/doors.d.ts +93 -0
  100. package/dist/src/session/commands/index.d.ts +20 -0
  101. package/dist/src/session/commands/layout.d.ts +104 -0
  102. package/dist/src/session/commands/positions.d.ts +30 -0
  103. package/dist/src/session/commands/sets.d.ts +113 -0
  104. package/dist/src/session/commands/style.d.ts +92 -0
  105. package/dist/src/session/commands/view.d.ts +57 -0
  106. package/dist/src/session/commands/visibility.d.ts +41 -0
  107. package/dist/src/session/data.d.ts +131 -4
  108. package/dist/src/session/index.d.ts +1 -1
  109. package/dist/src/session/planning.d.ts +25 -8
  110. package/dist/src/session/project/Dispatcher.d.ts +905 -0
  111. package/dist/src/session/project/History.d.ts +382 -0
  112. package/dist/src/session/project/arrangement.d.ts +247 -0
  113. package/dist/src/session/project/derive.d.ts +132 -0
  114. package/dist/src/session/project/digest.d.ts +33 -0
  115. package/dist/src/session/project/draft.d.ts +194 -0
  116. package/dist/src/session/project/graphOps.d.ts +304 -0
  117. package/dist/src/session/project/ingest.d.ts +364 -0
  118. package/dist/src/session/project/state.d.ts +145 -0
  119. package/dist/src/session/project/strict.d.ts +68 -0
  120. package/dist/src/session/results/RunResult.d.ts +48 -0
  121. package/dist/src/session/results/statistics.d.ts +20 -0
  122. package/dist/src/session/runs/Run.d.ts +80 -4
  123. package/dist/src/session/runs/RunsApi.d.ts +23 -6
  124. package/dist/src/session/runs/types.d.ts +25 -6
  125. package/dist/src/session/scope/ElementMask.d.ts +14 -0
  126. package/dist/src/session/scope/ScopeApi.d.ts +3 -22
  127. package/dist/src/session/scope/spaces.d.ts +29 -0
  128. package/dist/src/session/sealed.d.ts +22 -0
  129. package/dist/src/session/selection/SelectionApi.d.ts +14 -4
  130. package/dist/src/session/sets/SetsApi.d.ts +13 -5
  131. package/dist/src/session/sets/store.d.ts +54 -53
  132. package/dist/src/session/sets/types.d.ts +5 -2
  133. package/dist/src/session/styles/Layer.d.ts +5 -0
  134. package/dist/src/session/styles/StylesApi.d.ts +68 -17
  135. package/dist/src/session/styles/autoApply.d.ts +64 -53
  136. package/dist/src/session/styles/index.d.ts +3 -3
  137. package/dist/src/session/styles/predicate.d.ts +7 -0
  138. package/dist/src/session/styles/repaint.d.ts +16 -1
  139. package/dist/src/session/styles/sources.d.ts +1 -1
  140. package/dist/src/session/types.d.ts +625 -54
  141. package/dist/src/session/visibility/VisibilityApi.d.ts +38 -18
  142. package/dist/src/session/visibility/filter.d.ts +10 -0
  143. package/dist/src/simple/defineAlgorithm.d.ts +28 -0
  144. package/dist/src/simple/defineLayout.d.ts +35 -0
  145. package/dist/src/simple/defineLogDestination.d.ts +31 -0
  146. package/dist/src/simple/definePalette.d.ts +26 -0
  147. package/dist/src/simple/definition.d.ts +106 -0
  148. package/dist/src/simple/options.d.ts +33 -0
  149. package/dist/src/simple/source.d.ts +49 -0
  150. package/dist/src/simple/types.d.ts +366 -0
  151. package/dist/src/simple/view.d.ts +107 -0
  152. package/dist/webgpu.js +2 -2
  153. package/package.json +10 -12
  154. package/dist/chunks/GraphSession-BhuHSXIo.js +0 -12819
  155. package/dist/chunks/GraphStyle-Cwr55SAE.js +0 -65
  156. package/dist/chunks/algorithms-BJ6DQMOe.js +0 -3777
  157. package/dist/chunks/detect-fyuVnlCT.js +0 -88
  158. package/dist/chunks/interpolation-DY-PNpqX.js +0 -43
  159. package/dist/chunks/optionsFromZod-CKMYSwTz.js +0 -3636
  160. package/dist/chunks/paletteRegistry-BCFSwJGK.js +0 -1196
  161. package/dist/chunks/parse-BMTqt4SS.js +0 -3658
  162. package/dist/src/data/csv-variant-detection.d.ts +0 -29
  163. package/dist/src/data/ingest.d.ts +0 -104
@@ -116,8 +116,8 @@ export declare const GraphStyle: z.ZodObject<{
116
116
  viewMode: z.ZodDefault<z.ZodEnum<{
117
117
  "2d": "2d";
118
118
  "3d": "3d";
119
- vr: "vr";
120
119
  ar: "ar";
120
+ vr: "vr";
121
121
  }>>;
122
122
  /**
123
123
  * @deprecated Use viewMode instead. twoD: true is equivalent to viewMode: "2d"
@@ -28,8 +28,8 @@ declare const StyleTemplateV1: z.ZodObject<{
28
28
  viewMode: z.ZodDefault<z.ZodEnum<{
29
29
  "2d": "2d";
30
30
  "3d": "3d";
31
- vr: "vr";
32
31
  ar: "ar";
32
+ vr: "vr";
33
33
  }>>;
34
34
  twoD: z.ZodDefault<z.ZodBoolean>;
35
35
  }, z.core.$strict>>;
@@ -964,8 +964,8 @@ export declare const StyleTemplate: z.ZodDiscriminatedUnion<[z.ZodObject<{
964
964
  viewMode: z.ZodDefault<z.ZodEnum<{
965
965
  "2d": "2d";
966
966
  "3d": "3d";
967
- vr: "vr";
968
967
  ar: "ar";
968
+ vr: "vr";
969
969
  }>>;
970
970
  twoD: z.ZodDefault<z.ZodBoolean>;
971
971
  }, z.core.$strict>>;
@@ -201,12 +201,12 @@ export declare const xrConfigSchema: z.ZodDefault<z.ZodObject<{
201
201
  enableZAmplificationInDesktop: boolean;
202
202
  };
203
203
  enabled: boolean;
204
- vr: {
204
+ ar: {
205
205
  enabled: boolean;
206
206
  optionalFeatures: string[];
207
207
  referenceSpaceType: "unbounded" | "local" | "local-floor" | "bounded-floor";
208
208
  };
209
- ar: {
209
+ vr: {
210
210
  enabled: boolean;
211
211
  optionalFeatures: string[];
212
212
  referenceSpaceType: "unbounded" | "local" | "local-floor" | "bounded-floor";
@@ -231,12 +231,12 @@ export declare const xrConfigSchema: z.ZodDefault<z.ZodObject<{
231
231
  enableZAmplificationInDesktop?: boolean | undefined;
232
232
  } | undefined;
233
233
  enabled?: boolean | undefined;
234
- vr?: {
234
+ ar?: {
235
235
  enabled?: boolean | undefined;
236
236
  optionalFeatures?: string[] | undefined;
237
237
  referenceSpaceType?: "unbounded" | "local" | "local-floor" | "bounded-floor" | undefined;
238
238
  } | undefined;
239
- ar?: {
239
+ vr?: {
240
240
  enabled?: boolean | undefined;
241
241
  optionalFeatures?: string[] | undefined;
242
242
  referenceSpaceType?: "unbounded" | "local" | "local-floor" | "bounded-floor" | undefined;
@@ -1,7 +1,8 @@
1
- import { type CSVVariant } from "./csv-variant-detection.js";
2
1
  import { BaseDataSourceConfig, DataSource, DataSourceChunk } from "./DataSource.js";
2
+ /** The CSV shapes the reader can be told to read, or recognises when it is not told. */
3
+ export type CSVVariant = "neo4j" | "gephi" | "cytoscape" | "adjacency-list" | "edge-list" | "node-list" | "generic";
3
4
  interface CSVDataSourceConfig extends BaseDataSourceConfig {
4
- /** The column separator. Worked out from the first line (comma, tab, semicolon or pipe) when unset. */
5
+ /** The column separator. Worked out from the first rows (comma, tab, semicolon or pipe) when unset. */
5
6
  delimiter?: string;
6
7
  variant?: CSVVariant;
7
8
  /**
@@ -22,8 +23,9 @@ interface CSVDataSourceConfig extends BaseDataSourceConfig {
22
23
  edgeURL?: string;
23
24
  }
24
25
  /**
25
- * Data source for loading graph data from CSV files.
26
- * Supports edge lists, adjacency lists, and paired node/edge files.
26
+ * Data source for loading graph data from CSV files, read by `@graphty/graph-io`.
27
+ * Supports edge lists (plain, Gephi, Cytoscape), adjacency lists, node lists, Neo4j admin-import
28
+ * files and paired node and edge files.
27
29
  */
28
30
  export declare class CSVDataSource extends DataSource {
29
31
  static readonly type = "csv";
@@ -36,28 +38,81 @@ export declare class CSVDataSource extends DataSource {
36
38
  protected getConfig(): BaseDataSourceConfig;
37
39
  /**
38
40
  * Fetches and parses CSV data into graph chunks.
39
- * Automatically detects CSV variant (edge list, adjacency list, or paired files).
41
+ * Recognises a Neo4j file from its header; every other file is read as the variant asked for,
42
+ * or as whatever table its header describes.
40
43
  * @yields DataSourceChunk objects containing parsed nodes and edges
41
44
  */
42
45
  sourceFetchData(): AsyncGenerator<DataSourceChunk, void, unknown>;
43
46
  /**
44
- * Create an edge from CSV row data
45
- * Returns null if source or target is missing (and logs error)
46
- * @param src - Source node ID (will be converted to string)
47
- * @param dst - Target node ID (will be converted to string)
48
- * @param row - Full row data for additional properties
49
- * @param sourceColName - Name of source column (for error messages)
50
- * @param targetColName - Name of target column (for error messages)
51
- * @param rowIndex - Row index (for error messages)
52
- * @returns Edge data object or null if invalid
53
- */
54
- private createEdge;
55
- private parseEdgeList;
56
- private parseNodeList;
57
- private parseNeo4jFormat;
58
- private parseGephiFormat;
59
- private parseCytoscapeFormat;
60
- private parseAdjacencyList;
47
+ * Read a single table, choosing an edge table's endpoint columns.
48
+ *
49
+ * The endpoint columns are the configured ones, else the variant's, else the first pair of
50
+ * {@link ENDPOINT_PAIRS} the header holds both halves of. A configured column the file does not
51
+ * have is recorded as an error and nothing is read. The import's issues are recorded.
52
+ * @param content - the file's text
53
+ * @param table - the variant's table options
54
+ * @param mayBeNodeList - read a header with no endpoint pair and an `id` column as a node table
55
+ * (a node table's own id column is looked for the same way, and is the row number without one)
56
+ * @returns the records, or null when the header names no endpoint pair (and, where it may be a
57
+ * node list, no id column): the rows are then handed to the element unread
58
+ */
59
+ private readTable;
60
+ /**
61
+ * Read one table with the options every CSV route shares.
62
+ * @param content - the file's text
63
+ * @param table - the variant's table options
64
+ * @param nodes - a node file read before the edges, for a pair of files
65
+ * @returns the records and the report
66
+ */
67
+ private importTable;
68
+ /**
69
+ * Hand the rows of a file whose header names no endpoint column to the element unread.
70
+ *
71
+ * Such a row is not a malformed edge, it is a file whose endpoint columns are named something
72
+ * else entirely -- and the reader has no idea what. Dropping it produced a graph with no edges,
73
+ * a pile of "Missing source" errors and a load that reported success. Handing it over unread
74
+ * lets the ELEMENT refuse the batch and name the columns the file does carry, which is the one
75
+ * message a reader can act on. The rows are read as a node table numbered by row, so no column
76
+ * is taken as an id and every column of every row is kept.
77
+ * @param content - the file's text
78
+ * @yields the rows as edge records, and no nodes
79
+ */
80
+ private passThroughRows;
81
+ /**
82
+ * Read a Neo4j admin-import file: node sections and relationship sections, each under its own
83
+ * header row.
84
+ *
85
+ * The records keep the keys the element's reader always gave them: a node's `:LABEL` cell
86
+ * arrives as `label` (several labels joined by `;`, as the cell wrote them) and a
87
+ * relationship's `:TYPE` as `type`.
88
+ *
89
+ * This importer declares NO direction, deliberately. A Neo4j relationship is directed as a
90
+ * property of the database, not as something the CSV states -- the file carries :START_ID and
91
+ * :END_ID and no field that could say otherwise -- so there is nothing here to read. The
92
+ * element's own configuration stands, and under "auto" that is already directed.
93
+ * @param content - the file's text
94
+ * @yields the nodes and relationships
95
+ */
96
+ private parseNeo4j;
61
97
  private parsePairedFiles;
98
+ /**
99
+ * Declare the direction a Gephi `Type` column states, then yield the records in chunks.
100
+ *
101
+ * The same `Type` column is read on every route -- a single edge file, or the edge file of a
102
+ * pair: an export split into a node file and an edge file is the same export, and must not be
103
+ * read as a different graph because of how it was handed over. It is declared before the first
104
+ * chunk is yielded, and therefore before the first edge reaches the builder.
105
+ * The id and endpoints are written last, so an attribute column that happens to be named
106
+ * `id`, `source` or `target` cannot take their place.
107
+ * @param nodes - the nodes
108
+ * @param edges - the edges
109
+ * @yields the chunks
110
+ */
111
+ private emit;
112
+ /**
113
+ * Record an error, and stop the load at the error limit as every reader does.
114
+ * @param error - the error
115
+ */
116
+ private addError;
62
117
  }
63
118
  export {};
@@ -50,6 +50,11 @@ export declare class ErrorAggregator {
50
50
  * @returns The count of accumulated errors
51
51
  */
52
52
  getErrorCount(): number;
53
+ /**
54
+ * Get the number of errors this aggregator collects before it stops
55
+ * @returns The error limit
56
+ */
57
+ getErrorLimit(): number;
53
58
  /**
54
59
  * Check if error limit has been reached
55
60
  * @returns True if the maximum error count has been reached
@@ -1,16 +1,18 @@
1
1
  import { BaseDataSourceConfig, DataSource, DataSourceChunk } from "./DataSource.js";
2
2
  type GEXFDataSourceConfig = BaseDataSourceConfig;
3
3
  /**
4
- * Data source for loading graph data from GEXF (Graph Exchange XML Format) files.
5
- * Supports node and edge attributes, attribute types, and dynamic graphs.
4
+ * Data source for loading graph data from GEXF (Graph Exchange XML Format) files, read by
5
+ * `@graphty/graph-io`'s GEXF importer. Supports node and edge attributes, attribute types, the viz
6
+ * namespace and dynamic graphs.
6
7
  *
7
8
  * Dynamic graphs keep their time data on each record rather than acting on it:
8
- * - a node's or edge's `start` / `end` / `timestamp` (see {@link readInterval}) go onto its data
9
- * under those names, and its `<spells>` go onto `spells` as a list of the same intervals;
9
+ * - a node's or edge's `start` / `end` / `timestamp` go onto its data under those names, with
10
+ * `startOpen` / `endOpen` set for an open bound, and its `<spells>` go onto `spells` as a list of
11
+ * `{ start, end }` intervals;
10
12
  * - an attribute with time-sliced `attvalue`s becomes a list of `{ value, start, end }` slices
11
13
  * instead of a single value. An attribute with no timed `attvalue` keeps its plain value.
12
14
  *
13
- * Dynamic `viz:*` elements (timed positions, colours or sizes) are not read.
15
+ * An edge that names a node the file never declared is kept, and the node is created for it.
14
16
  */
15
17
  export declare class GEXFDataSource extends DataSource {
16
18
  static readonly type = "gexf";
@@ -27,62 +29,11 @@ export declare class GEXFDataSource extends DataSource {
27
29
  */
28
30
  sourceFetchData(): AsyncGenerator<DataSourceChunk, void, unknown>;
29
31
  /**
30
- * The direction the `<graph>` element declares.
31
- *
32
- * `defaultedgetype` is optional in GEXF and its schema gives it the default `undirected`, so a
33
- * GEXF file that omits it is NOT silent about its direction: it has said undirected, the same
34
- * way it would have by writing the attribute out, and that is how every other GEXF reader
35
- * takes it, NetworkX included.
36
- *
37
- * WHY THE CALLER IS TOLD WHETHER THE ATTRIBUTE WAS WRITTEN. A direction the file's author typed
38
- * out and a direction the schema supplied for them are not equally strong, and the difference
39
- * decides what happens when the edges say something else. An author who wrote
40
- * `defaultedgetype="undirected"` and then marked one edge `type="directed"` described a mixed
41
- * graph, and the graph-level statement is the one to keep. An author who wrote no
42
- * `defaultedgetype` at all and marked every edge `type="directed"` stated direction in exactly
43
- * one place, and reading that file as undirected would invent a reverse path for every edge in
44
- * it. Both cases arrive here as `directed: false`; only `written` separates them.
45
- *
46
- * An unreadable value is reported as unwritten, because a keyword GEXF does not define is not a
47
- * statement the element can act on -- but the text says the attribute was there and could not
48
- * be read, rather than claiming the file omitted it.
49
- * @param graph - the parsed `<graph>` element
50
- * @returns the direction, whether the file actually wrote it, and the text that stated it
32
+ * Import the document through graph-io.
33
+ * @param text - the document
34
+ * @param defaultDirected - the direction an edge without a `type` takes when the graph wrote none
35
+ * @returns the import
51
36
  */
52
- private readDefaultEdgeType;
53
- private parseAttributeDefinitions;
54
- private parseNodes;
55
- /**
56
- * Parse the `<edges>` children, and tally what each one said about its own direction.
57
- *
58
- * A GEXF edge may carry its own `type`, which makes a MIXED graph expressible in the file and
59
- * not in the element: the snapshot holds one direction flag for the whole graph. So the two
60
- * tallies returned here are raw counts rather than a count of disagreements -- which edges
61
- * disagree cannot be known until the graph's direction is settled, and on a file that never
62
- * wrote `defaultedgetype` these tallies are what settles it. {@link resolveDirection} decides.
63
- *
64
- * Nothing is thrown away either way: each edge keeps its own `type` on its record, so a style
65
- * layer can still draw that one edge differently.
66
- * @param edgeData - the parsed `<edge>` elements
67
- * @param attributes - the edge attribute definitions
68
- * @returns the edge records, and how many edges stated each direction
69
- */
70
- private parseEdges;
71
- /**
72
- * Copy a node's or edge's lifetime, spells and attribute values onto its record.
73
- *
74
- * Every `attvalue` for one attribute is kept: if any of them is timed, the attribute becomes
75
- * the list of all its slices, `{ value, start, end }`, in file order; otherwise it keeps its
76
- * plain value, so a static file reads exactly as it always has.
77
- * @param obj - the parsed `<node>` or `<edge>`
78
- * @param obj.attvalues - its `<attvalues>` element, if any
79
- * @param obj.attvalues.attvalue - the `<attvalue>` children
80
- * @param obj.spells - its `<spells>` element, if any
81
- * @param obj.spells.spell - the `<spell>` children
82
- * @param record - the record being built, written in place
83
- * @param attributes - the attribute definitions for this element class
84
- */
85
- private readTimeData;
86
- private parseValue;
37
+ private read;
87
38
  }
88
39
  export {};
@@ -1,8 +1,9 @@
1
1
  import { BaseDataSourceConfig, DataSource, DataSourceChunk } from "./DataSource.js";
2
2
  type GraphMLDataSourceConfig = BaseDataSourceConfig;
3
3
  /**
4
- * Data source for loading graph data from GraphML files.
5
- * Supports GraphML format with yFiles extensions for node shapes and edge styles.
4
+ * Data source for loading graph data from GraphML files, read by `@graphty/graph-io`'s GraphML
5
+ * importer. Supports key definitions and data elements, and the yFiles `ShapeNode` and
6
+ * `PolyLineEdge` graphics (position, size, colours, border, label, shape and arrows).
6
7
  */
7
8
  export declare class GraphMLDataSource extends DataSource {
8
9
  static readonly type = "graphml";
@@ -18,47 +19,5 @@ export declare class GraphMLDataSource extends DataSource {
18
19
  * @yields DataSourceChunk objects containing parsed nodes and edges
19
20
  */
20
21
  sourceFetchData(): AsyncGenerator<DataSourceChunk, void, unknown>;
21
- private parseKeyDefinitions;
22
- private parseNodes;
23
- /**
24
- * Parse the `<edge>` children, and count the ones that contradict the graph's declaration.
25
- *
26
- * A GraphML edge may carry `directed="true|false"` of its own, which overrides `edgedefault`
27
- * for that edge alone and so makes a MIXED graph expressible in the file but not in the
28
- * element, whose snapshot holds one direction flag for the whole graph. `edgedefault` is what
29
- * the element adopts, because it is the file's statement about the graph AS A WHOLE. The
30
- * per-edge value is not discarded: it is kept on the edge record as `directed`, where a style
31
- * layer can still read it, and the count returned here is what the element logs.
32
- * @param edgeData - the parsed `<edge>` elements
33
- * @param keys - the key definitions
34
- * @param declaredDirected - what `edgedefault` declared, or null when it declared nothing
35
- * @returns the edge records, and how many carried a `directed` attribute that disagrees
36
- */
37
- private parseEdges;
38
- private parseValue;
39
- /**
40
- * Maps yFiles shape types to Graphty shape types
41
- * @param yfilesShape - yFiles shape type identifier
42
- * @returns Corresponding Graphty shape type
43
- */
44
- private mapYFilesShape;
45
- /**
46
- * Normalizes color to standard hex format (#RRGGBB)
47
- * @param color - Color value in any format
48
- * @returns Normalized hex color string
49
- */
50
- private normalizeColor;
51
- /**
52
- * Parses yFiles ShapeNode data and extracts visual properties
53
- * @param shapeNode - yFiles ShapeNode data structure
54
- * @returns Object containing extracted node properties
55
- */
56
- private parseYFilesShapeNode;
57
- /**
58
- * Parses yFiles PolyLineEdge data and extracts visual properties
59
- * @param polyLineEdge - yFiles PolyLineEdge data structure
60
- * @returns Object containing extracted edge properties
61
- */
62
- private parseYFilesPolyLineEdge;
63
22
  }
64
23
  export {};