@graphty/graph-io 0.3.19 → 0.3.21

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 (201) hide show
  1. package/README.md +49 -4
  2. package/dist/chunks/{escape-CWExcecC.js → escape-B-tkk_Cl.js} +74 -16
  3. package/dist/chunks/escape-B-tkk_Cl.js.map +1 -0
  4. package/dist/chunks/{writer-DQiKgQJc.js → export-Bh60Dv-n.js} +5 -79
  5. package/dist/chunks/export-Bh60Dv-n.js.map +1 -0
  6. package/dist/chunks/{exporter-CbMZyVt-.js → exporter-BGrsWamJ.js} +7 -6
  7. package/dist/chunks/{exporter-CbMZyVt-.js.map → exporter-BGrsWamJ.js.map} +1 -1
  8. package/dist/chunks/exporter-DIeGJXAZ.js +834 -0
  9. package/dist/chunks/exporter-DIeGJXAZ.js.map +1 -0
  10. package/dist/chunks/{importer-BNFuV1-K.js → importer-BWY2FFc5.js} +28 -7
  11. package/dist/chunks/importer-BWY2FFc5.js.map +1 -0
  12. package/dist/chunks/importer-DD-xv9_Y.js +1471 -0
  13. package/dist/chunks/importer-DD-xv9_Y.js.map +1 -0
  14. package/dist/chunks/{importer-BAP4PrxR.js → importer-DET1tg6s.js} +30 -20
  15. package/dist/chunks/importer-DET1tg6s.js.map +1 -0
  16. package/dist/chunks/{importer-ByPGO-09.js → importer-DEcKhsmQ.js} +2 -2
  17. package/dist/chunks/{importer-ByPGO-09.js.map → importer-DEcKhsmQ.js.map} +1 -1
  18. package/dist/chunks/{importer-BW-Ft2ps.js → importer-DIrbbnAf.js} +6 -5
  19. package/dist/chunks/{importer-BW-Ft2ps.js.map → importer-DIrbbnAf.js.map} +1 -1
  20. package/dist/chunks/importer-D_e7e7LX.js +3055 -0
  21. package/dist/chunks/importer-D_e7e7LX.js.map +1 -0
  22. package/dist/chunks/{importer-Bm1_5vPS.js → importer-eUREhBGj.js} +11 -8
  23. package/dist/chunks/importer-eUREhBGj.js.map +1 -0
  24. package/dist/chunks/{importer-DOepkgnG.js → importer-vi3bSdtw.js} +4 -4
  25. package/dist/chunks/{importer-DOepkgnG.js.map → importer-vi3bSdtw.js.map} +1 -1
  26. package/dist/chunks/{importer-BVGtU1NA.js → importer-zGLo8Dg_.js} +6 -5
  27. package/dist/chunks/{importer-BVGtU1NA.js.map → importer-zGLo8Dg_.js.map} +1 -1
  28. package/dist/chunks/{json-elements-CZY1wiZh.js → json-elements-DDS8N2Dd.js} +2 -2
  29. package/dist/chunks/{json-elements-CZY1wiZh.js.map → json-elements-DDS8N2Dd.js.map} +1 -1
  30. package/dist/chunks/{records-BzNicMsf.js → records-dbRkxwaq.js} +2 -2
  31. package/dist/chunks/{records-BzNicMsf.js.map → records-dbRkxwaq.js.map} +1 -1
  32. package/dist/chunks/{report-BcWboivV.js → report-B1z4WT9e.js} +143 -111
  33. package/dist/chunks/{report-BcWboivV.js.map → report-B1z4WT9e.js.map} +1 -1
  34. package/dist/chunks/{weights-CwISIpCP.js → weights-Dzba96G3.js} +5 -5
  35. package/dist/chunks/{weights-CwISIpCP.js.map → weights-Dzba96G3.js.map} +1 -1
  36. package/dist/chunks/writer-C7flM-Ih.js +77 -0
  37. package/dist/chunks/writer-C7flM-Ih.js.map +1 -0
  38. package/dist/csv.js +6 -5
  39. package/dist/csv.js.map +1 -1
  40. package/dist/cx.js +1 -1
  41. package/dist/cx2.js +2 -2
  42. package/dist/cys.d.ts +1 -0
  43. package/dist/cys.js +6 -0
  44. package/dist/cys.js.map +1 -0
  45. package/dist/dot.js +1 -1
  46. package/dist/gexf.js +5 -4
  47. package/dist/gexf.js.map +1 -1
  48. package/dist/gml.js +12 -14
  49. package/dist/gml.js.map +1 -1
  50. package/dist/graph-io.js +288 -141
  51. package/dist/graph-io.js.map +1 -1
  52. package/dist/graphml.js +1 -1
  53. package/dist/json.js +1 -1
  54. package/dist/neo4j.js +6 -5
  55. package/dist/neo4j.js.map +1 -1
  56. package/dist/obo.js +1 -1
  57. package/dist/pajek.js +1 -1
  58. package/dist/src/common/cell-budget.d.ts +84 -0
  59. package/dist/src/common/cell-budget.d.ts.map +1 -0
  60. package/dist/src/common/cell-budget.js +138 -0
  61. package/dist/src/common/cell-budget.js.map +1 -0
  62. package/dist/src/common/input.d.ts +10 -0
  63. package/dist/src/common/input.d.ts.map +1 -1
  64. package/dist/src/common/input.js +39 -0
  65. package/dist/src/common/input.js.map +1 -1
  66. package/dist/src/common/options.d.ts +6 -0
  67. package/dist/src/common/options.d.ts.map +1 -1
  68. package/dist/src/common/options.js +1 -1
  69. package/dist/src/common/options.js.map +1 -1
  70. package/dist/src/common/xml.d.ts +37 -3
  71. package/dist/src/common/xml.d.ts.map +1 -1
  72. package/dist/src/common/xml.js +86 -6
  73. package/dist/src/common/xml.js.map +1 -1
  74. package/dist/src/common/zip.d.ts +92 -0
  75. package/dist/src/common/zip.d.ts.map +1 -0
  76. package/dist/src/common/zip.js +399 -0
  77. package/dist/src/common/zip.js.map +1 -0
  78. package/dist/src/formats/cx/importer.d.ts.map +1 -1
  79. package/dist/src/formats/cx/importer.js +26 -17
  80. package/dist/src/formats/cx/importer.js.map +1 -1
  81. package/dist/src/formats/cys/constants.d.ts +68 -0
  82. package/dist/src/formats/cys/constants.d.ts.map +1 -0
  83. package/dist/src/formats/cys/constants.js +76 -0
  84. package/dist/src/formats/cys/constants.js.map +1 -0
  85. package/dist/src/formats/cys/importer.d.ts +38 -0
  86. package/dist/src/formats/cys/importer.d.ts.map +1 -0
  87. package/dist/src/formats/cys/importer.js +830 -0
  88. package/dist/src/formats/cys/importer.js.map +1 -0
  89. package/dist/src/formats/cys/index.d.ts +7 -0
  90. package/dist/src/formats/cys/index.d.ts.map +1 -0
  91. package/dist/src/formats/cys/index.js +7 -0
  92. package/dist/src/formats/cys/index.js.map +1 -0
  93. package/dist/src/formats/cys/session.d.ts +132 -0
  94. package/dist/src/formats/cys/session.d.ts.map +1 -0
  95. package/dist/src/formats/cys/session.js +315 -0
  96. package/dist/src/formats/cys/session.js.map +1 -0
  97. package/dist/src/formats/cys/tables.d.ts +90 -0
  98. package/dist/src/formats/cys/tables.d.ts.map +1 -0
  99. package/dist/src/formats/cys/tables.js +293 -0
  100. package/dist/src/formats/cys/tables.js.map +1 -0
  101. package/dist/src/formats/dot/exporter.d.ts +2 -0
  102. package/dist/src/formats/dot/exporter.d.ts.map +1 -1
  103. package/dist/src/formats/dot/exporter.js +12 -0
  104. package/dist/src/formats/dot/exporter.js.map +1 -1
  105. package/dist/src/formats/dot/importer.js +6 -2
  106. package/dist/src/formats/dot/importer.js.map +1 -1
  107. package/dist/src/formats/gexf/importer.d.ts +2 -2
  108. package/dist/src/formats/gexf/importer.d.ts.map +1 -1
  109. package/dist/src/formats/gexf/importer.js +1 -1
  110. package/dist/src/formats/gexf/importer.js.map +1 -1
  111. package/dist/src/formats/gml/exporter.d.ts +0 -8
  112. package/dist/src/formats/gml/exporter.d.ts.map +1 -1
  113. package/dist/src/formats/gml/exporter.js +7 -17
  114. package/dist/src/formats/gml/exporter.js.map +1 -1
  115. package/dist/src/formats/json/exporter.d.ts.map +1 -1
  116. package/dist/src/formats/json/exporter.js +3 -1
  117. package/dist/src/formats/json/exporter.js.map +1 -1
  118. package/dist/src/formats/json/importer.d.ts.map +1 -1
  119. package/dist/src/formats/json/importer.js +3 -2
  120. package/dist/src/formats/json/importer.js.map +1 -1
  121. package/dist/src/formats/xgmml/columns.d.ts +152 -0
  122. package/dist/src/formats/xgmml/columns.d.ts.map +1 -0
  123. package/dist/src/formats/xgmml/columns.js +593 -0
  124. package/dist/src/formats/xgmml/columns.js.map +1 -0
  125. package/dist/src/formats/xgmml/constants.d.ts +196 -0
  126. package/dist/src/formats/xgmml/constants.d.ts.map +1 -0
  127. package/dist/src/formats/xgmml/constants.js +197 -0
  128. package/dist/src/formats/xgmml/constants.js.map +1 -0
  129. package/dist/src/formats/xgmml/document.d.ts +361 -0
  130. package/dist/src/formats/xgmml/document.d.ts.map +1 -0
  131. package/dist/src/formats/xgmml/document.js +695 -0
  132. package/dist/src/formats/xgmml/document.js.map +1 -0
  133. package/dist/src/formats/xgmml/emit.d.ts +341 -0
  134. package/dist/src/formats/xgmml/emit.d.ts.map +1 -0
  135. package/dist/src/formats/xgmml/emit.js +1275 -0
  136. package/dist/src/formats/xgmml/emit.js.map +1 -0
  137. package/dist/src/formats/xgmml/exporter.d.ts +24 -0
  138. package/dist/src/formats/xgmml/exporter.d.ts.map +1 -0
  139. package/dist/src/formats/xgmml/exporter.js +999 -0
  140. package/dist/src/formats/xgmml/exporter.js.map +1 -0
  141. package/dist/src/formats/xgmml/importer.d.ts +58 -0
  142. package/dist/src/formats/xgmml/importer.d.ts.map +1 -0
  143. package/dist/src/formats/xgmml/importer.js +360 -0
  144. package/dist/src/formats/xgmml/importer.js.map +1 -0
  145. package/dist/src/formats/xgmml/index.d.ts +8 -0
  146. package/dist/src/formats/xgmml/index.d.ts.map +1 -0
  147. package/dist/src/formats/xgmml/index.js +8 -0
  148. package/dist/src/formats/xgmml/index.js.map +1 -0
  149. package/dist/src/formats/xgmml/values.d.ts +60 -0
  150. package/dist/src/formats/xgmml/values.d.ts.map +1 -0
  151. package/dist/src/formats/xgmml/values.js +148 -0
  152. package/dist/src/formats/xgmml/values.js.map +1 -0
  153. package/dist/src/index.d.ts +2 -0
  154. package/dist/src/index.d.ts.map +1 -1
  155. package/dist/src/index.js +2 -0
  156. package/dist/src/index.js.map +1 -1
  157. package/dist/src/registry.d.ts +7 -0
  158. package/dist/src/registry.d.ts.map +1 -1
  159. package/dist/src/registry.js +25 -10
  160. package/dist/src/registry.js.map +1 -1
  161. package/dist/src/sniff.d.ts +1 -1
  162. package/dist/src/sniff.d.ts.map +1 -1
  163. package/dist/src/sniff.js +2 -0
  164. package/dist/src/sniff.js.map +1 -1
  165. package/dist/xgmml.d.ts +1 -0
  166. package/dist/xgmml.js +9 -0
  167. package/dist/xgmml.js.map +1 -0
  168. package/package.json +15 -2
  169. package/src/common/cell-budget.ts +170 -0
  170. package/src/common/input.ts +40 -0
  171. package/src/common/options.ts +1 -1
  172. package/src/common/xml.ts +127 -6
  173. package/src/common/zip.ts +472 -0
  174. package/src/formats/cx/importer.ts +27 -19
  175. package/src/formats/cys/constants.ts +99 -0
  176. package/src/formats/cys/importer.ts +1100 -0
  177. package/src/formats/cys/index.ts +7 -0
  178. package/src/formats/cys/session.ts +428 -0
  179. package/src/formats/cys/tables.ts +400 -0
  180. package/src/formats/dot/exporter.ts +17 -0
  181. package/src/formats/dot/importer.ts +6 -2
  182. package/src/formats/gexf/importer.ts +0 -1
  183. package/src/formats/gml/exporter.ts +7 -18
  184. package/src/formats/json/exporter.ts +3 -1
  185. package/src/formats/json/importer.ts +3 -2
  186. package/src/formats/xgmml/columns.ts +747 -0
  187. package/src/formats/xgmml/constants.ts +265 -0
  188. package/src/formats/xgmml/document.ts +975 -0
  189. package/src/formats/xgmml/emit.ts +1563 -0
  190. package/src/formats/xgmml/exporter.ts +1215 -0
  191. package/src/formats/xgmml/importer.ts +491 -0
  192. package/src/formats/xgmml/index.ts +8 -0
  193. package/src/formats/xgmml/values.ts +183 -0
  194. package/src/index.ts +9 -0
  195. package/src/registry.ts +41 -15
  196. package/src/sniff.ts +5 -1
  197. package/dist/chunks/escape-CWExcecC.js.map +0 -1
  198. package/dist/chunks/importer-BAP4PrxR.js.map +0 -1
  199. package/dist/chunks/importer-BNFuV1-K.js.map +0 -1
  200. package/dist/chunks/importer-Bm1_5vPS.js.map +0 -1
  201. package/dist/chunks/writer-DQiKgQJc.js.map +0 -1
@@ -0,0 +1,361 @@
1
+ /**
2
+ * The XGMML document model: one pass of the shared XML tokenizer turns an XGMML document into
3
+ * plain records (graphs, nodes, edges, atts, graphics) that keep everything the file says, with
4
+ * forward references (`xlink:href`, an edge before its nodes) left as ids. The importer
5
+ * (importer.ts) resolves the records into a sink once the outermost `</graph>` has closed, as
6
+ * Cytoscape does, and the `.cys` importer reuses the same records for the network and view files
7
+ * of a session.
8
+ *
9
+ * It recognises the five shapes of `research-xgmml.md` section 2: the 1.0 draft, the Cytoscape
10
+ * 2.x export and session, the 3.x export, the 3.x session network file (root `cy:registered="0"`)
11
+ * and the 3.x session view file (root `cy:view="1"`).
12
+ */
13
+ import { type ImportReportBuilder } from "../../common/report.js";
14
+ import { type XmlHandler } from "../../common/xml.js";
15
+ /** One `<att>` and what it holds. */
16
+ export interface AttRec {
17
+ /** The `name` (else `label`) attribute, or null. */
18
+ name: string | null;
19
+ /** The XGMML `type` as written, or null. */
20
+ readonly type: string | null;
21
+ /** Cytoscape's `cy:type`, or null. */
22
+ readonly cyType: string | null;
23
+ /** Cytoscape's `cy:elementType` of a list, or null. */
24
+ readonly elementType: string | null;
25
+ /** The `value` attribute, or null when absent. */
26
+ readonly value: string | null;
27
+ /** `cy:hidden` is 1, true or yes. */
28
+ readonly hidden: boolean;
29
+ /** `cy:equation` is 1, true or yes: the value is a formula. */
30
+ readonly equation: boolean;
31
+ /** The child atts (list items, record fields, graphics properties). */
32
+ readonly children: AttRec[];
33
+ /** The XML attributes besides the ones above (a 2.x bend handle's `x` and `y`). */
34
+ readonly extra: Record<string, string>;
35
+ /** Foreign XML inside the att (RDF), serialized, or null. */
36
+ xml: string | null;
37
+ /** Whether the att held a `<graph>`. */
38
+ hasGraph: boolean;
39
+ /** Non-whitespace character data inside the att. */
40
+ text: string;
41
+ /** The line of the `<att`. */
42
+ readonly line: number;
43
+ /** The table namespace of a `.cys` column, or null for an att of the document. */
44
+ readonly namespace?: string | null | undefined;
45
+ }
46
+ /** A `<node>`. */
47
+ export interface NodeRec {
48
+ readonly kind: "node";
49
+ /** The id (the label when the id is missing), or null for an `xlink:href` reference. */
50
+ readonly id: string | null;
51
+ /** The `xlink:href` of a reference to a node declared elsewhere, or null. */
52
+ readonly href: string | null;
53
+ /** The `label` attribute (else `name`), or null. */
54
+ readonly label: string | null;
55
+ /** The `name` attribute when a label is also given, or null. */
56
+ readonly name: string | null;
57
+ /** The other XML attributes, as written. */
58
+ readonly xmlAttrs: [string, string][];
59
+ /** The atts, in document order. */
60
+ readonly atts: AttRec[];
61
+ /** The graphics values besides x, y and z, or null without `<graphics>`. */
62
+ graphics: Record<string, unknown> | null;
63
+ /** The x, y and z texts of the graphics (or its `<center>`), or null. */
64
+ x: string | null;
65
+ y: string | null;
66
+ z: string | null;
67
+ /** The graphs nested in the node's atts. */
68
+ readonly nested: GraphRec[];
69
+ /** The graph that declares (or references) the node. */
70
+ readonly graph: GraphRec;
71
+ /** The line of the `<node`. */
72
+ readonly line: number;
73
+ /** A session view's `cy:nodeId`, or null. */
74
+ readonly viewId: string | null;
75
+ }
76
+ /** An `<edge>`. */
77
+ export interface EdgeRec {
78
+ readonly kind: "edge";
79
+ /** The id attribute, or null. */
80
+ readonly id: string | null;
81
+ /** The `xlink:href` of a reference to an edge declared elsewhere, or null. */
82
+ readonly href: string | null;
83
+ /** The source and target texts, or null when missing. */
84
+ readonly source: string | null;
85
+ readonly target: string | null;
86
+ /** The label attribute, or null. */
87
+ readonly label: string | null;
88
+ /** The `name` attribute, or null. */
89
+ readonly name: string | null;
90
+ /** The `weight` attribute, or null. */
91
+ readonly weight: string | null;
92
+ /** The `cy:directed` attribute, or null. */
93
+ readonly directed: string | null;
94
+ /** The other XML attributes, as written. */
95
+ readonly xmlAttrs: [string, string][];
96
+ /** The atts, in document order. */
97
+ readonly atts: AttRec[];
98
+ /** The graphics values, or null. */
99
+ graphics: Record<string, unknown> | null;
100
+ /** The graph that declares (or references) the edge. */
101
+ readonly graph: GraphRec;
102
+ /** The line of the `<edge`. */
103
+ readonly line: number;
104
+ /** A session view's `cy:edgeId`, or null. */
105
+ readonly viewId: string | null;
106
+ }
107
+ /** A `<graph>`: the root, a subnetwork, a group or a nested-network pointer. */
108
+ export interface GraphRec {
109
+ /** The id attribute, or null. */
110
+ readonly id: string | null;
111
+ /** The label attribute, or null. */
112
+ readonly label: string | null;
113
+ /** The `xlink:href` of a pointer to a graph written elsewhere, or null. */
114
+ readonly href: string | null;
115
+ /** `cy:registered` as written, or null. */
116
+ readonly registered: string | null;
117
+ /** Every XML attribute, as written. */
118
+ readonly attrs: ReadonlyMap<string, string>;
119
+ /** The graph-level atts. */
120
+ readonly atts: AttRec[];
121
+ /** The graph's `<graphics>` values, or null. */
122
+ graphics: Record<string, unknown> | null;
123
+ /** The node whose att holds this graph, or null. */
124
+ readonly owner: NodeRec | null;
125
+ /** The graph this one is nested in, or null for the root. */
126
+ readonly parent: GraphRec | null;
127
+ /** The nodes and edges directly in this graph (declared or referenced), in document order. */
128
+ readonly members: (NodeRec | EdgeRec)[];
129
+ /** The graphs held by this graph's own atts (subnetworks of the root). */
130
+ readonly subgraphs: GraphRec[];
131
+ /** The line of the `<graph`. */
132
+ readonly line: number;
133
+ }
134
+ /** A parsed document. */
135
+ export interface XgmmlDocument {
136
+ /** The root graph. */
137
+ readonly root: GraphRec;
138
+ /** Every declared node (not references), in document order. */
139
+ readonly nodes: NodeRec[];
140
+ /** Every declared edge, in document order. */
141
+ readonly edges: EdgeRec[];
142
+ /** Every graph, root first. */
143
+ readonly graphs: GraphRec[];
144
+ /** The `cy` prefix is bound, or a `cy:` attribute is used: Cytoscape wrote the file. */
145
+ readonly cytoscape: boolean;
146
+ /** The root is in the XGMML namespace (default or prefixed). */
147
+ readonly xgmmlNamespace: boolean;
148
+ /** The RDF network metadata fields (`dc:title`, ...) by local name. */
149
+ readonly rdf: Record<string, string>;
150
+ /** The serialized `networkMetadata` RDF, or null. */
151
+ readonly rdfXml: string | null;
152
+ }
153
+ /**
154
+ * Whether a Cytoscape flag text is true.
155
+ * @param text - the text, or undefined
156
+ * @returns true for 1, true or yes in any case
157
+ */
158
+ export declare function isCyTrue(text: string | null | undefined): boolean;
159
+ /**
160
+ * The tokenizer handler that builds an XgmmlDocument.
161
+ */
162
+ export declare class XgmmlParser implements XmlHandler {
163
+ private readonly report;
164
+ private readonly frames;
165
+ private readonly xlinkPrefixes;
166
+ private rootGraph;
167
+ private readonly nodes;
168
+ private readonly edges;
169
+ private readonly graphs;
170
+ private cytoscape;
171
+ private xgmmlNamespace;
172
+ /** The prefix of the root element (`xgmml` in `<xgmml:graph>`), or null when it has none. */
173
+ private rootPrefix;
174
+ private readonly rdf;
175
+ private rdfXml;
176
+ /**
177
+ * Create a parser.
178
+ * @param report - the report issues are recorded in
179
+ */
180
+ constructor(report: ImportReportBuilder);
181
+ /**
182
+ * The parsed document.
183
+ * @returns the document; E_NO_GRAPH (fatal) when no root graph was read
184
+ */
185
+ document(): XgmmlDocument;
186
+ /**
187
+ * An element starts.
188
+ * @param rawName - the element name as written
189
+ * @param rawAttrs - its attributes
190
+ * @param line - the line
191
+ */
192
+ start(rawName: string, rawAttrs: ReadonlyMap<string, string>, line: number): void;
193
+ /**
194
+ * An element ends.
195
+ * @param name - the element name
196
+ * @param _line - the line
197
+ */
198
+ end(name: string, _line: number): void;
199
+ /**
200
+ * Character data.
201
+ * @param text - the text
202
+ * @param line - the line
203
+ */
204
+ text(text: string, line: number): void;
205
+ /**
206
+ * The XML attribute map with every XLink prefix written `xlink:`.
207
+ * @param attrs - the attributes as written
208
+ * @returns the normalised map
209
+ */
210
+ private normalise;
211
+ /**
212
+ * The root element: a `<graph>`, else the document is not XGMML.
213
+ * @param rawName - the name as written
214
+ * @param rawAttrs - its attributes
215
+ * @param line - the line
216
+ */
217
+ private startRoot;
218
+ /**
219
+ * A graph record, registered in the document.
220
+ * @param attrs - its attributes
221
+ * @param line - the line
222
+ * @param owner - the node whose att holds it, or null
223
+ * @param parent - the graph it is nested in, or null
224
+ * @returns the record
225
+ */
226
+ private newGraph;
227
+ /**
228
+ * A child of `<graph>`.
229
+ * @param graph - the graph
230
+ * @param rawName - the name as written
231
+ * @param name - its local name
232
+ * @param attrs - its attributes
233
+ * @param line - the line
234
+ */
235
+ private startInGraph;
236
+ /**
237
+ * A child of `<node>` or `<edge>`.
238
+ * @param element - the node or edge
239
+ * @param rawName - the name as written
240
+ * @param name - its local name
241
+ * @param attrs - its attributes
242
+ * @param line - the line
243
+ */
244
+ private startInElement;
245
+ /**
246
+ * A child of `<att>`: a child att, a nested graph, or foreign XML.
247
+ * @param frame - the att frame
248
+ * @param rawName - the name as written
249
+ * @param name - its local name
250
+ * @param attrs - its attributes
251
+ * @param line - the line
252
+ */
253
+ private startInAtt;
254
+ /**
255
+ * Whether an element name inside an att is XGMML's own (unprefixed, or with the root's prefix,
256
+ * as in a document whose root is `<xgmml:graph>`) rather than foreign XML such as `rdf:RDF`.
257
+ * @param rawName - the name as written
258
+ * @returns true for an XGMML element name
259
+ */
260
+ private isXgmmlName;
261
+ /**
262
+ * A `<graph>` inside an `<att>`: a subnetwork of the root, a group or nested-network pointer
263
+ * of a node, or (in an edge) a graph with no model.
264
+ * @param frame - the att frame
265
+ * @param attrs - the graph's attributes
266
+ * @param line - the line
267
+ */
268
+ private beginNestedGraph;
269
+ /**
270
+ * The innermost node, edge or graph frame below the open atts.
271
+ * @returns the frame, or null
272
+ */
273
+ private attHolder;
274
+ /**
275
+ * Report an element XGMML does not define here and skip its subtree.
276
+ * @param rawName - the name as written
277
+ * @param line - the line
278
+ */
279
+ private unknownElement;
280
+ /**
281
+ * Open a `<node>`.
282
+ * @param graph - the graph it is in
283
+ * @param attrs - its attributes
284
+ * @param line - the line
285
+ */
286
+ private beginNode;
287
+ /**
288
+ * Open an `<edge>`.
289
+ * @param graph - the graph it is in
290
+ * @param attrs - its attributes
291
+ * @param line - the line
292
+ */
293
+ private beginEdge;
294
+ /**
295
+ * An att record from its XML attributes.
296
+ * @param attrs - the attributes
297
+ * @param line - the line
298
+ * @returns the record
299
+ */
300
+ private newAtt;
301
+ /**
302
+ * Open an `<att>`.
303
+ * @param att - the record
304
+ * @param _attrs - its attributes
305
+ * @param owner - what holds it
306
+ */
307
+ private beginAtt;
308
+ /**
309
+ * Serialize one start tag of foreign XML into the capturing att.
310
+ * @param frame - the capture frame
311
+ * @param rawName - the name as written
312
+ * @param attrs - its attributes
313
+ */
314
+ private capture;
315
+ /** The local name of the RDF element whose text is being read, or null. */
316
+ private rdfElement;
317
+ /**
318
+ * Keep the text of an RDF metadata field.
319
+ * @param text - the text
320
+ */
321
+ private captureRdfText;
322
+ /**
323
+ * Open a `<graphics>`: x, y and z (draft and Cytoscape) are read as coordinates; every other
324
+ * attribute is kept as written, merged key by key with an earlier `<graphics>`.
325
+ * @param target - the node, edge or graph
326
+ * @param attrs - its attributes
327
+ */
328
+ private beginGraphics;
329
+ /**
330
+ * A child of `<graphics>`: a visual-property att, a `<center>` or a `<Line>`.
331
+ * @param target - the graphics target
332
+ * @param rawName - the name as written
333
+ * @param name - its local name
334
+ * @param attrs - its attributes
335
+ * @param line - the line
336
+ */
337
+ private startInGraphics;
338
+ /**
339
+ * Keep a visual-property att of a `<graphics>` in its record, as written. A session view's
340
+ * `<att name="z">` repeats z and is read as z when the attributes gave none.
341
+ * @param target - the graphics target
342
+ * @param att - the att
343
+ */
344
+ private graphicsAtt;
345
+ }
346
+ /**
347
+ * Whether an att's children are list items rather than named fields: they have no names, repeat
348
+ * the parent's name (Cytoscape 3 lists), or are several that share one name (2.x bend handles).
349
+ * @param att - the att
350
+ * @returns true for a list
351
+ */
352
+ export declare function isListLike(att: AttRec): boolean;
353
+ /**
354
+ * A graphics att as plain data, values as written: an att with children is an array when they
355
+ * are list items (isListLike), else a record by name; a childless att is its value,
356
+ * else its other XML attributes (a 2.x bend handle's x and y), else null.
357
+ * @param att - the att
358
+ * @returns the value
359
+ */
360
+ export declare function attJson(att: AttRec): unknown;
361
+ //# sourceMappingURL=document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../../src/formats/xgmml/document.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAA2B,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAG/E,qCAAqC;AACrC,MAAM,WAAW,MAAM;IACnB,oDAAoD;IACpD,IAAI,E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