@graphty/graph-io 0.3.38 → 0.3.40

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 (152) hide show
  1. package/dist/chunks/{choose-CsO24U-5.js → choose-CS3fvGT1.js} +2 -2
  2. package/dist/chunks/{choose-CsO24U-5.js.map → choose-CS3fvGT1.js.map} +1 -1
  3. package/dist/chunks/{constants-BPRiVyBu.js → constants-DqKZT6cH.js} +2 -2
  4. package/dist/chunks/{constants-BPRiVyBu.js.map → constants-DqKZT6cH.js.map} +1 -1
  5. package/dist/chunks/{escape-BRcyzD77.js → escape-BJRLd3vJ.js} +4 -3
  6. package/dist/chunks/escape-BJRLd3vJ.js.map +1 -0
  7. package/dist/chunks/{export-CTUlibzr.js → export-B-aVCwyG.js} +103 -92
  8. package/dist/chunks/export-B-aVCwyG.js.map +1 -0
  9. package/dist/chunks/{exporter-Bf5tZA0X.js → exporter-6ocL_9x_.js} +6 -5
  10. package/dist/chunks/exporter-6ocL_9x_.js.map +1 -0
  11. package/dist/chunks/{exporter-Bn4jdYfd.js → exporter-BVXnV9-9.js} +43 -30
  12. package/dist/chunks/exporter-BVXnV9-9.js.map +1 -0
  13. package/dist/chunks/{exporter-D-qQuRcG.js → exporter-Bcp-l4Bo.js} +6 -6
  14. package/dist/chunks/exporter-Bcp-l4Bo.js.map +1 -0
  15. package/dist/chunks/{exporter-F0vT919P.js → exporter-SFYkDzD0.js} +5 -4
  16. package/dist/chunks/exporter-SFYkDzD0.js.map +1 -0
  17. package/dist/chunks/{importer-Bgb9sgZZ.js → importer-AjwOJrn2.js} +6 -8
  18. package/dist/chunks/importer-AjwOJrn2.js.map +1 -0
  19. package/dist/chunks/{importer-BuzbaFFY.js → importer-BJlGAOht.js} +28 -13
  20. package/dist/chunks/importer-BJlGAOht.js.map +1 -0
  21. package/dist/chunks/{importer-DqMtyYLX.js → importer-BpuS3J8C.js} +12 -14
  22. package/dist/chunks/importer-BpuS3J8C.js.map +1 -0
  23. package/dist/chunks/{importer-CEuUmyPe.js → importer-CPqnIY8m.js} +6 -6
  24. package/dist/chunks/{importer-CEuUmyPe.js.map → importer-CPqnIY8m.js.map} +1 -1
  25. package/dist/chunks/{importer-yWUPR_nU.js → importer-DEp_fYjf.js} +30 -12
  26. package/dist/chunks/importer-DEp_fYjf.js.map +1 -0
  27. package/dist/chunks/{importer-CNMQnHDd.js → importer-D_srHyj6.js} +112 -62
  28. package/dist/chunks/importer-D_srHyj6.js.map +1 -0
  29. package/dist/chunks/{importer-oIUx9u_g.js → importer-DcKB97kW.js} +40 -18
  30. package/dist/chunks/importer-DcKB97kW.js.map +1 -0
  31. package/dist/chunks/{json-elements-AkglPS3m.js → json-elements-DpO6AXIc.js} +7 -5
  32. package/dist/chunks/{json-elements-AkglPS3m.js.map → json-elements-DpO6AXIc.js.map} +1 -1
  33. package/dist/chunks/{ontology-export-DDoG3egY.js → ontology-export-50L9DOV4.js} +2 -2
  34. package/dist/chunks/{ontology-export-DDoG3egY.js.map → ontology-export-50L9DOV4.js.map} +1 -1
  35. package/dist/chunks/{records-ChmWZGuz.js → records-r3SFHz11.js} +137 -96
  36. package/dist/chunks/records-r3SFHz11.js.map +1 -0
  37. package/dist/chunks/{text-Btw3sBe_.js → text-Bjfa1xYL.js} +2 -2
  38. package/dist/chunks/{text-Btw3sBe_.js.map → text-Bjfa1xYL.js.map} +1 -1
  39. package/dist/csv.js +4 -4
  40. package/dist/cx.js +1 -1
  41. package/dist/cx2.js +2 -2
  42. package/dist/cys.js +1 -1
  43. package/dist/dot.js +1 -1
  44. package/dist/gexf.js +6 -4
  45. package/dist/gexf.js.map +1 -1
  46. package/dist/gml.js +8 -6
  47. package/dist/gml.js.map +1 -1
  48. package/dist/graph-io.js +26 -26
  49. package/dist/graphml.js +2 -2
  50. package/dist/json.js +1 -1
  51. package/dist/neo4j.js +3 -3
  52. package/dist/obo.js +1 -1
  53. package/dist/pajek.js +1 -1
  54. package/dist/src/common/direction.js +1 -1
  55. package/dist/src/common/direction.js.map +1 -1
  56. package/dist/src/common/export.d.ts.map +1 -1
  57. package/dist/src/common/export.js +136 -71
  58. package/dist/src/common/export.js.map +1 -1
  59. package/dist/src/common/input.js +1 -1
  60. package/dist/src/common/input.js.map +1 -1
  61. package/dist/src/common/json-elements.d.ts.map +1 -1
  62. package/dist/src/common/json-elements.js +4 -2
  63. package/dist/src/common/json-elements.js.map +1 -1
  64. package/dist/src/common/xml.d.ts.map +1 -1
  65. package/dist/src/common/xml.js +2 -1
  66. package/dist/src/common/xml.js.map +1 -1
  67. package/dist/src/formats/csv/records.d.ts.map +1 -1
  68. package/dist/src/formats/csv/records.js +138 -100
  69. package/dist/src/formats/csv/records.js.map +1 -1
  70. package/dist/src/formats/cx/importer.d.ts.map +1 -1
  71. package/dist/src/formats/cx/importer.js +108 -53
  72. package/dist/src/formats/cx/importer.js.map +1 -1
  73. package/dist/src/formats/cx2/exporter.d.ts.map +1 -1
  74. package/dist/src/formats/cx2/exporter.js +2 -1
  75. package/dist/src/formats/cx2/exporter.js.map +1 -1
  76. package/dist/src/formats/cx2/importer.d.ts.map +1 -1
  77. package/dist/src/formats/cx2/importer.js +28 -6
  78. package/dist/src/formats/cx2/importer.js.map +1 -1
  79. package/dist/src/formats/dot/importer.d.ts +6 -0
  80. package/dist/src/formats/dot/importer.d.ts.map +1 -1
  81. package/dist/src/formats/dot/importer.js +11 -6
  82. package/dist/src/formats/dot/importer.js.map +1 -1
  83. package/dist/src/formats/dot/names.d.ts +5 -0
  84. package/dist/src/formats/dot/names.d.ts.map +1 -1
  85. package/dist/src/formats/dot/names.js +5 -0
  86. package/dist/src/formats/dot/names.js.map +1 -1
  87. package/dist/src/formats/dot/tokenizer.js +9 -9
  88. package/dist/src/formats/dot/tokenizer.js.map +1 -1
  89. package/dist/src/formats/gexf/exporter.d.ts.map +1 -1
  90. package/dist/src/formats/gexf/exporter.js +4 -2
  91. package/dist/src/formats/gexf/exporter.js.map +1 -1
  92. package/dist/src/formats/gml/importer.d.ts +6 -0
  93. package/dist/src/formats/gml/importer.d.ts.map +1 -1
  94. package/dist/src/formats/gml/importer.js +6 -3
  95. package/dist/src/formats/gml/importer.js.map +1 -1
  96. package/dist/src/formats/graphml/exporter.d.ts.map +1 -1
  97. package/dist/src/formats/graphml/exporter.js +2 -1
  98. package/dist/src/formats/graphml/exporter.js.map +1 -1
  99. package/dist/src/formats/graphml/importer.d.ts.map +1 -1
  100. package/dist/src/formats/graphml/importer.js +5 -6
  101. package/dist/src/formats/graphml/importer.js.map +1 -1
  102. package/dist/src/formats/obo/importer.d.ts.map +1 -1
  103. package/dist/src/formats/obo/importer.js +2 -1
  104. package/dist/src/formats/obo/importer.js.map +1 -1
  105. package/dist/src/formats/pajek/exporter.d.ts.map +1 -1
  106. package/dist/src/formats/pajek/exporter.js +4 -5
  107. package/dist/src/formats/pajek/exporter.js.map +1 -1
  108. package/dist/src/formats/xgmml/emit.d.ts +6 -0
  109. package/dist/src/formats/xgmml/emit.d.ts.map +1 -1
  110. package/dist/src/formats/xgmml/emit.js +33 -10
  111. package/dist/src/formats/xgmml/emit.js.map +1 -1
  112. package/dist/src/formats/xgmml/exporter.d.ts.map +1 -1
  113. package/dist/src/formats/xgmml/exporter.js +54 -22
  114. package/dist/src/formats/xgmml/exporter.js.map +1 -1
  115. package/dist/src/sniff.js +1 -1
  116. package/dist/src/sniff.js.map +1 -1
  117. package/dist/xgmml.js +2 -2
  118. package/package.json +2 -2
  119. package/src/common/direction.ts +1 -1
  120. package/src/common/export.ts +190 -97
  121. package/src/common/input.ts +1 -1
  122. package/src/common/json-elements.ts +4 -2
  123. package/src/common/xml.ts +2 -1
  124. package/src/formats/csv/records.ts +143 -99
  125. package/src/formats/cx/importer.ts +140 -58
  126. package/src/formats/cx2/exporter.ts +2 -1
  127. package/src/formats/cx2/importer.ts +34 -10
  128. package/src/formats/dot/importer.ts +35 -4
  129. package/src/formats/dot/names.ts +6 -0
  130. package/src/formats/dot/tokenizer.ts +9 -9
  131. package/src/formats/gexf/exporter.ts +4 -2
  132. package/src/formats/gml/importer.ts +14 -3
  133. package/src/formats/graphml/exporter.ts +2 -3
  134. package/src/formats/graphml/importer.ts +5 -6
  135. package/src/formats/obo/importer.ts +2 -1
  136. package/src/formats/pajek/exporter.ts +6 -4
  137. package/src/formats/xgmml/emit.ts +34 -10
  138. package/src/formats/xgmml/exporter.ts +63 -23
  139. package/src/sniff.ts +1 -1
  140. package/dist/chunks/escape-BRcyzD77.js.map +0 -1
  141. package/dist/chunks/export-CTUlibzr.js.map +0 -1
  142. package/dist/chunks/exporter-Bf5tZA0X.js.map +0 -1
  143. package/dist/chunks/exporter-Bn4jdYfd.js.map +0 -1
  144. package/dist/chunks/exporter-D-qQuRcG.js.map +0 -1
  145. package/dist/chunks/exporter-F0vT919P.js.map +0 -1
  146. package/dist/chunks/importer-Bgb9sgZZ.js.map +0 -1
  147. package/dist/chunks/importer-BuzbaFFY.js.map +0 -1
  148. package/dist/chunks/importer-CNMQnHDd.js.map +0 -1
  149. package/dist/chunks/importer-DqMtyYLX.js.map +0 -1
  150. package/dist/chunks/importer-oIUx9u_g.js.map +0 -1
  151. package/dist/chunks/importer-yWUPR_nU.js.map +0 -1
  152. package/dist/chunks/records-ChmWZGuz.js.map +0 -1
@@ -1,8 +1,8 @@
1
1
  import { GraphFormatError, INVALID_INDEX } from "@graphty/graph-format";
2
2
  import { c as childrenCsr } from "./children-CL3Cy0ez.js";
3
- import { s as stringify, f as aspectBlock, d as directionNotes, p as planNodeIds, b as planEdgeIds, O as ORIGINAL_ID_ATTRIBUTE, h as nextNodeId, i as noteList, g as declaredType, z as zAsOption } from "./importer-BuzbaFFY.js";
4
- import { c as capabilities, L as LOSS, r as resolveExportOptions, p as pairFolding, a as checkCapabilities, e as explicitWeights, b as plural, ad as TOO_LARGE_CODE, S as SINK_OPTION_CODE, O as OPTION_IGNORED_CODE, D as DIRECTION_FORCED_CODE, d as DIRECTION_REFUSED_CODE, R as ROLE_TAKEN_CODE, C as COLUMN_RENAMED_CODE, N as NO_GRAPH_CODE, ae as AMBIGUOUS_GRAPH_NAME_CODE, af as GRAPH_NOT_FOUND_CODE, l as MULTIPLE_GRAPHS_CODE, I as ID_MERGED_CODE, P as PRECISION_CODE, J as ID_TEXT_TYPE_CODE, a2 as JSON_NONSTANDARD_NUMBER_CODE, ag as SINGLE_OBJECT_ASPECT_CODE, W as MULTI_ASPECT_FRAGMENT_CODE, g as UNKNOWN_ELEMENT_CODE, m as DUPLICATE_EDGE_ID_CODE, n as DUPLICATE_NODE_CODE, s as MISSING_ENDPOINT_CODE, t as MISSING_ID_CODE, ah as STYLES_NOT_IMPORTED_CODE, ai as PARENT_CYCLE_CODE, q as UNKNOWN_PARENT_CODE, o as DUPLICATE_ATTRIBUTE_CODE, i as DANGLING_REFERENCE_CODE, U as UNKNOWN_ATTR_TYPE_CODE, aj as WIDENED_CODE, a3 as BAD_VALUE_CODE, j as COUNT_MISMATCH_CODE, Y as ASPECT_ORDER_CODE, V as BAD_ASPECT_BLOCK_CODE, _ as STATUS_WARNING_CODE, Z as STATUS_FAILED_CODE, w as UNKNOWN_ENCODING_CODE, x as ENCODING_FALLBACK_CODE, y as INVALID_ENCODING_CODE, z as INVALID_UTF8_CODE, ak as SYNTAX_CODE, E as EMPTY_INPUT_CODE, F as ELEMENT_ISSUE, G as INPUT_ISSUE, al as resolveImportOptions, a8 as ImportReportBuilder, a4 as textChunks, am as throwIfAborted, an as reportUnusedOptions, ao as reportSinkOptions, a7 as chooseGraph, ap as graphChosen, aq as DirectionResolver, ar as IdCoercer, $ as agree, a1 as declareResolved, a0 as uniqueColumnName, as as weightFromValue } from "./export-CTUlibzr.js";
5
- import { i as isRecord, P as POSITION_COLUMN, h as headText, s as scanAspects, r as reportTooDeep, a as reportSharedBlock, C as CxStructure, J as JsonScanError, E as ExactInteger, c as cxId, p as plainJson, f as flipY, z as zDecl, b as positionDecl, d as declareFresh, e as inexactLiteral, k as keptPrecision } from "./json-elements-AkglPS3m.js";
3
+ import { s as stringify, f as aspectBlock, d as directionNotes, p as planNodeIds, b as planEdgeIds, O as ORIGINAL_ID_ATTRIBUTE, h as nextNodeId, i as noteList, g as declaredType, z as zAsOption } from "./importer-BJlGAOht.js";
4
+ import { c as capabilities, L as LOSS, r as resolveExportOptions, p as pairFolding, a as checkCapabilities, e as explicitWeights, b as plural, ad as TOO_LARGE_CODE, S as SINK_OPTION_CODE, O as OPTION_IGNORED_CODE, D as DIRECTION_FORCED_CODE, d as DIRECTION_REFUSED_CODE, R as ROLE_TAKEN_CODE, C as COLUMN_RENAMED_CODE, N as NO_GRAPH_CODE, ae as AMBIGUOUS_GRAPH_NAME_CODE, af as GRAPH_NOT_FOUND_CODE, l as MULTIPLE_GRAPHS_CODE, I as ID_MERGED_CODE, P as PRECISION_CODE, J as ID_TEXT_TYPE_CODE, a2 as JSON_NONSTANDARD_NUMBER_CODE, ag as SINGLE_OBJECT_ASPECT_CODE, W as MULTI_ASPECT_FRAGMENT_CODE, g as UNKNOWN_ELEMENT_CODE, m as DUPLICATE_EDGE_ID_CODE, n as DUPLICATE_NODE_CODE, s as MISSING_ENDPOINT_CODE, t as MISSING_ID_CODE, ah as STYLES_NOT_IMPORTED_CODE, ai as PARENT_CYCLE_CODE, q as UNKNOWN_PARENT_CODE, o as DUPLICATE_ATTRIBUTE_CODE, i as DANGLING_REFERENCE_CODE, U as UNKNOWN_ATTR_TYPE_CODE, aj as WIDENED_CODE, a3 as BAD_VALUE_CODE, j as COUNT_MISMATCH_CODE, Y as ASPECT_ORDER_CODE, V as BAD_ASPECT_BLOCK_CODE, _ as STATUS_WARNING_CODE, Z as STATUS_FAILED_CODE, w as UNKNOWN_ENCODING_CODE, x as ENCODING_FALLBACK_CODE, y as INVALID_ENCODING_CODE, z as INVALID_UTF8_CODE, ak as SYNTAX_CODE, E as EMPTY_INPUT_CODE, F as ELEMENT_ISSUE, G as INPUT_ISSUE, al as resolveImportOptions, a8 as ImportReportBuilder, a4 as textChunks, am as throwIfAborted, an as reportUnusedOptions, ao as reportSinkOptions, a7 as chooseGraph, ap as graphChosen, aq as DirectionResolver, ar as IdCoercer, $ as agree, a1 as declareResolved, a0 as uniqueColumnName, as as weightFromValue } from "./export-B-aVCwyG.js";
5
+ import { i as isRecord, P as POSITION_COLUMN, h as headText, s as scanAspects, r as reportTooDeep, a as reportSharedBlock, C as CxStructure, J as JsonScanError, E as ExactInteger, c as cxId, p as plainJson, f as flipY, z as zDecl, b as positionDecl, d as declareFresh, e as inexactLiteral, k as keptPrecision } from "./json-elements-DpO6AXIc.js";
6
6
  import { j as joinText, e as encodeChunks } from "./writer-DxjgHwSe.js";
7
7
  const CX_FORMAT$1 = "cx";
8
8
  const CX_LOSS = Object.freeze({
@@ -1401,10 +1401,11 @@ function checkNumberVerification(value, count, report, line) {
1401
1401
  const raw = isRecord(value) ? value.longNumber : void 0;
1402
1402
  const digits = raw instanceof ExactInteger ? raw.digits : String(raw);
1403
1403
  if (count > 1 || !NUMBER_VERIFICATION_VALUES.has(digits)) {
1404
+ const held = raw === void 0 ? null : digits;
1404
1405
  report.warning(
1405
1406
  "validation-error",
1406
1407
  CX_ISSUE.NUMBER_VERIFICATION,
1407
- count > 1 ? "a second numberVerification element; ignored" : `numberVerification holds ${shown(raw === void 0 ? null : digits)}, not 281474976710655`,
1408
+ count > 1 ? "a second numberVerification element; ignored" : `numberVerification holds ${shown(held)}, not 281474976710655`,
1408
1409
  { line, element: "numberVerification" }
1409
1410
  );
1410
1411
  }
@@ -1557,10 +1558,11 @@ async function readDocument(input, report, options) {
1557
1558
  break;
1558
1559
  }
1559
1560
  countMember(event.block, null);
1561
+ const what = keys.length > 1 ? `an object with ${keys.length} keys (${keys.join(", ")})` : shown(value);
1560
1562
  report.error(
1561
1563
  "parse-error",
1562
1564
  BAD_ASPECT_BLOCK_CODE,
1563
- `a member of the document is ${keys.length > 1 ? `an object with ${keys.length} keys (${keys.join(", ")})` : shown(value)}, not a one-key aspect fragment; skipped`,
1565
+ `a member of the document is ${what}, not a one-key aspect fragment; skipped`,
1564
1566
  { line: event.line, element: keys[0] ?? null }
1565
1567
  );
1566
1568
  break;
@@ -1809,6 +1811,9 @@ function layoutViews(doc) {
1809
1811
  function memberCount(members, total) {
1810
1812
  return members === null ? total : members.size;
1811
1813
  }
1814
+ function visualText(raw) {
1815
+ return typeof raw === "string" ? raw : JSON.stringify(raw);
1816
+ }
1812
1817
  class CxReader {
1813
1818
  /**
1814
1819
  * Create the reader.
@@ -3148,55 +3153,85 @@ class CxReader {
3148
3153
  * applied.
3149
3154
  */
3150
3155
  readVisualProperties() {
3151
- const entries = aspect(this.doc, "cyVisualProperties");
3152
3156
  const tableStyles = TABLE_STYLE_ASPECTS.reduce((n, name) => n + (this.doc.kept.get(name)?.length ?? 0), 0);
3153
3157
  const views = new Set(this.plan.views.slice(0, 1));
3154
- const columns = { node: /* @__PURE__ */ new Map(), edge: /* @__PURE__ */ new Map() };
3155
- const network = /* @__PURE__ */ new Map();
3156
- let defaults = 0;
3157
- let mappings = 0;
3158
- let dependencies = 0;
3159
- for (const { value } of entries) {
3160
- if (!isRecord(value)) {
3161
- continue;
3162
- }
3163
- const view = value.view === void 0 || value.view === null ? null : refId(value.view);
3164
- if (view !== null && views.size > 0 && !views.has(view)) {
3165
- continue;
3158
+ const visual = {
3159
+ columns: { node: /* @__PURE__ */ new Map(), edge: /* @__PURE__ */ new Map() },
3160
+ network: /* @__PURE__ */ new Map(),
3161
+ defaults: 0,
3162
+ mappings: 0,
3163
+ dependencies: 0
3164
+ };
3165
+ for (const { value } of aspect(this.doc, "cyVisualProperties")) {
3166
+ if (isRecord(value)) {
3167
+ this.collectVisualEntry(value, views, visual);
3166
3168
  }
3167
- const properties = isRecord(value.properties) ? value.properties : {};
3168
- mappings += isRecord(value.mappings) ? Object.keys(value.mappings).length : 0;
3169
- dependencies += isRecord(value.dependencies) ? Object.keys(value.dependencies).length : 0;
3170
- switch (value.properties_of) {
3171
- case "nodes":
3172
- case "edges": {
3173
- const domain = value.properties_of === "nodes" ? "node" : "edge";
3174
- const target = refId(value.applies_to);
3175
- const rows = domain === "node" ? this.nodeRows : this.edgeRows;
3176
- const row = target === null ? void 0 : rows.get(target);
3177
- if (row === void 0) {
3178
- if (target === null || !(domain === "node" ? this.rootNodes : this.rootEdges).has(target)) {
3179
- this.dangle(`${domain} visual property entry`);
3180
- }
3181
- continue;
3182
- }
3183
- for (const [property, raw] of Object.entries(properties)) {
3184
- const list = columns[domain].get(property) ?? [];
3185
- list.push([row, typeof raw === "string" ? raw : JSON.stringify(raw)]);
3186
- columns[domain].set(property, list);
3187
- }
3188
- break;
3169
+ }
3170
+ this.writeBypassColumns(visual.columns);
3171
+ this.writeBypassNetwork(visual.network);
3172
+ this.reportStyleRules(visual, tableStyles);
3173
+ }
3174
+ /**
3175
+ * File one cyVisualProperties element of this graph's view into the collection: per-element and
3176
+ * network values by property, defaults, mappings and dependencies counted.
3177
+ * @param value - the element
3178
+ * @param views - the views read (empty: every view)
3179
+ * @param visual - the collection to add to
3180
+ */
3181
+ collectVisualEntry(value, views, visual) {
3182
+ const view = value.view === void 0 || value.view === null ? null : refId(value.view);
3183
+ if (view !== null && views.size > 0 && !views.has(view)) {
3184
+ return;
3185
+ }
3186
+ const properties = isRecord(value.properties) ? value.properties : {};
3187
+ visual.mappings += isRecord(value.mappings) ? Object.keys(value.mappings).length : 0;
3188
+ visual.dependencies += isRecord(value.dependencies) ? Object.keys(value.dependencies).length : 0;
3189
+ switch (value.properties_of) {
3190
+ case "nodes":
3191
+ this.collectElementProperties("node", value.applies_to, properties, visual.columns);
3192
+ break;
3193
+ case "edges":
3194
+ this.collectElementProperties("edge", value.applies_to, properties, visual.columns);
3195
+ break;
3196
+ case "network":
3197
+ for (const [property, raw] of Object.entries(properties)) {
3198
+ visual.network.set(property, visualText(raw));
3189
3199
  }
3190
- case "network":
3191
- for (const [property, raw] of Object.entries(properties)) {
3192
- network.set(property, typeof raw === "string" ? raw : JSON.stringify(raw));
3193
- }
3194
- break;
3195
- default:
3196
- defaults += Object.keys(properties).length;
3197
- break;
3200
+ break;
3201
+ default:
3202
+ visual.defaults += Object.keys(properties).length;
3203
+ break;
3204
+ }
3205
+ }
3206
+ /**
3207
+ * File the visual values of one node or edge under its row; an element not in this graph is
3208
+ * skipped, and reported dangling when it is in no graph of the file.
3209
+ * @param domain - node or edge
3210
+ * @param appliesTo - the element's applies_to
3211
+ * @param properties - its visual properties
3212
+ * @param columns - the per-property cells to add to
3213
+ */
3214
+ collectElementProperties(domain, appliesTo, properties, columns) {
3215
+ const target = refId(appliesTo);
3216
+ const rows = domain === "node" ? this.nodeRows : this.edgeRows;
3217
+ const row = target === null ? void 0 : rows.get(target);
3218
+ if (row === void 0) {
3219
+ if (target === null || !(domain === "node" ? this.rootNodes : this.rootEdges).has(target)) {
3220
+ this.dangle(`${domain} visual property entry`);
3198
3221
  }
3222
+ return;
3223
+ }
3224
+ for (const [property, raw] of Object.entries(properties)) {
3225
+ const list = columns[domain].get(property) ?? [];
3226
+ list.push([row, visualText(raw)]);
3227
+ columns[domain].set(property, list);
3199
3228
  }
3229
+ }
3230
+ /**
3231
+ * Write the collected per-element visual values as string columns in the cx.bypass namespace.
3232
+ * @param columns - the per-property cells of each domain
3233
+ */
3234
+ writeBypassColumns(columns) {
3200
3235
  for (const domain of ["node", "edge"]) {
3201
3236
  for (const [property, cells] of columns[domain]) {
3202
3237
  const handle = declareFresh(
@@ -3219,6 +3254,12 @@ class CxReader {
3219
3254
  }
3220
3255
  }
3221
3256
  }
3257
+ }
3258
+ /**
3259
+ * Write the network visual values as graph values in the cx.bypass namespace.
3260
+ * @param network - the value of each property
3261
+ */
3262
+ writeBypassNetwork(network) {
3222
3263
  for (const [property, text] of network) {
3223
3264
  try {
3224
3265
  this.sink.setGraphValue(property, text, {
@@ -3229,20 +3270,29 @@ class CxReader {
3229
3270
  this.report.recordError(err, { element: property });
3230
3271
  }
3231
3272
  }
3232
- if (defaults + mappings + dependencies + tableStyles > 0) {
3233
- const parts = [
3234
- `cyVisualProperties: ${defaults} default${plural(defaults)}, ${mappings} mapping${plural(mappings)}, ${dependencies} dependenc(ies)`
3235
- ];
3236
- if (tableStyles > 0) {
3237
- parts.push(`${tableStyles} table style element${plural(tableStyles)}`);
3238
- }
3239
- this.report.warning(
3240
- "unsupported",
3241
- STYLES_NOT_IMPORTED_CODE,
3242
- `the file's style rules are not applied (${parts.join("; ")}); they are kept in meta.extra.cx`,
3243
- { element: "cyVisualProperties" }
3244
- );
3273
+ }
3274
+ /**
3275
+ * Warn that the style rules (defaults, mappings, dependencies, table styles) are kept, not applied.
3276
+ * @param visual - the counted rules
3277
+ * @param tableStyles - the number of table style elements
3278
+ */
3279
+ reportStyleRules(visual, tableStyles) {
3280
+ const { defaults, mappings, dependencies } = visual;
3281
+ if (defaults + mappings + dependencies + tableStyles === 0) {
3282
+ return;
3245
3283
  }
3284
+ const parts = [
3285
+ `cyVisualProperties: ${defaults} default${plural(defaults)}, ${mappings} mapping${plural(mappings)}, ${dependencies} dependenc(ies)`
3286
+ ];
3287
+ if (tableStyles > 0) {
3288
+ parts.push(`${tableStyles} table style element${plural(tableStyles)}`);
3289
+ }
3290
+ this.report.warning(
3291
+ "unsupported",
3292
+ STYLES_NOT_IMPORTED_CODE,
3293
+ `the file's style rules are not applied (${parts.join("; ")}); they are kept in meta.extra.cx`,
3294
+ { element: "cyVisualProperties" }
3295
+ );
3246
3296
  }
3247
3297
  /**
3248
3298
  * Read the provenance aspects: citations and supports as extension tables cx:citations and
@@ -3578,4 +3628,4 @@ export {
3578
3628
  cxExporter as c,
3579
3629
  cxImporter as d
3580
3630
  };
3581
- //# sourceMappingURL=importer-CNMQnHDd.js.map
3631
+ //# sourceMappingURL=importer-D_srHyj6.js.map