@graphty/graph-io 0.3.35 → 0.3.37

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 (172) hide show
  1. package/dist/chunks/{choose-494CpuXQ.js → choose-CsO24U-5.js} +2 -2
  2. package/dist/chunks/{choose-494CpuXQ.js.map → choose-CsO24U-5.js.map} +1 -1
  3. package/dist/chunks/{constants-BBK4rsQZ.js → constants-BPRiVyBu.js} +2 -2
  4. package/dist/chunks/{constants-BBK4rsQZ.js.map → constants-BPRiVyBu.js.map} +1 -1
  5. package/dist/chunks/{escape-wVIEtLv6.js → escape-BRcyzD77.js} +4 -4
  6. package/dist/chunks/{escape-wVIEtLv6.js.map → escape-BRcyzD77.js.map} +1 -1
  7. package/dist/chunks/{export-Cbt4h_0n.js → export-CTUlibzr.js} +4 -4
  8. package/dist/chunks/export-CTUlibzr.js.map +1 -0
  9. package/dist/chunks/{exporter-CkPnJCXU.js → exporter-2UNIxzcu.js} +3 -3
  10. package/dist/chunks/{exporter-CkPnJCXU.js.map → exporter-2UNIxzcu.js.map} +1 -1
  11. package/dist/chunks/{exporter-LZTIAzkS.js → exporter-B_YFZ4ix.js} +8 -8
  12. package/dist/chunks/exporter-B_YFZ4ix.js.map +1 -0
  13. package/dist/chunks/{exporter-CqnmKk-f.js → exporter-Bn4jdYfd.js} +5 -5
  14. package/dist/chunks/{exporter-CqnmKk-f.js.map → exporter-Bn4jdYfd.js.map} +1 -1
  15. package/dist/chunks/{exporter-DMxRy-0l.js → exporter-flsHFoER.js} +4 -4
  16. package/dist/chunks/{exporter-DMxRy-0l.js.map → exporter-flsHFoER.js.map} +1 -1
  17. package/dist/chunks/{importer-C1VMuEBQ.js → importer-BD3mi2QH.js} +10 -10
  18. package/dist/chunks/importer-BD3mi2QH.js.map +1 -0
  19. package/dist/chunks/{importer-DvPvd4Yy.js → importer-Bgb9sgZZ.js} +9 -9
  20. package/dist/chunks/importer-Bgb9sgZZ.js.map +1 -0
  21. package/dist/chunks/{importer-CSmH218L.js → importer-CEuUmyPe.js} +10 -10
  22. package/dist/chunks/importer-CEuUmyPe.js.map +1 -0
  23. package/dist/chunks/{importer-DMgcD1wI.js → importer-DqMtyYLX.js} +11 -11
  24. package/dist/chunks/importer-DqMtyYLX.js.map +1 -0
  25. package/dist/chunks/{importer-BTSvNJUB.js → importer-Dwqepe_B.js} +3 -3
  26. package/dist/chunks/{importer-BTSvNJUB.js.map → importer-Dwqepe_B.js.map} +1 -1
  27. package/dist/chunks/{importer-BTbjwN10.js → importer-oIUx9u_g.js} +9 -9
  28. package/dist/chunks/importer-oIUx9u_g.js.map +1 -0
  29. package/dist/chunks/{importer-DtKPzhVp.js → importer-yWUPR_nU.js} +13 -13
  30. package/dist/chunks/importer-yWUPR_nU.js.map +1 -0
  31. package/dist/chunks/{json-elements-CxJF-Szz.js → json-elements-AkglPS3m.js} +4 -4
  32. package/dist/chunks/json-elements-AkglPS3m.js.map +1 -0
  33. package/dist/chunks/{ontology-export-p1PsPenq.js → ontology-export-DDoG3egY.js} +2 -2
  34. package/dist/chunks/{ontology-export-p1PsPenq.js.map → ontology-export-DDoG3egY.js.map} +1 -1
  35. package/dist/chunks/{records-BrfHycmg.js → records-ChmWZGuz.js} +2 -2
  36. package/dist/chunks/{records-BrfHycmg.js.map → records-ChmWZGuz.js.map} +1 -1
  37. package/dist/chunks/{text-BD-TzLNm.js → text-Btw3sBe_.js} +2 -2
  38. package/dist/chunks/{text-BD-TzLNm.js.map → text-Btw3sBe_.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 +30 -30
  45. package/dist/gexf.js.map +1 -1
  46. package/dist/gml.js +8 -8
  47. package/dist/gml.js.map +1 -1
  48. package/dist/graph-io.js +28 -28
  49. package/dist/graph-io.js.map +1 -1
  50. package/dist/graphml.js +2 -2
  51. package/dist/json.js +1 -1
  52. package/dist/neo4j.js +6 -6
  53. package/dist/neo4j.js.map +1 -1
  54. package/dist/obo.js +1 -1
  55. package/dist/pajek.js +1 -1
  56. package/dist/src/common/attributes.d.ts +1 -2
  57. package/dist/src/common/attributes.d.ts.map +1 -1
  58. package/dist/src/common/attributes.js +2 -2
  59. package/dist/src/common/attributes.js.map +1 -1
  60. package/dist/src/common/direction.d.ts +1 -2
  61. package/dist/src/common/direction.d.ts.map +1 -1
  62. package/dist/src/common/direction.js +2 -2
  63. package/dist/src/common/direction.js.map +1 -1
  64. package/dist/src/common/escape.js +1 -1
  65. package/dist/src/common/escape.js.map +1 -1
  66. package/dist/src/common/export.js +1 -1
  67. package/dist/src/common/export.js.map +1 -1
  68. package/dist/src/common/ids.d.ts +1 -2
  69. package/dist/src/common/ids.d.ts.map +1 -1
  70. package/dist/src/common/ids.js +1 -2
  71. package/dist/src/common/ids.js.map +1 -1
  72. package/dist/src/common/input.d.ts +1 -2
  73. package/dist/src/common/input.d.ts.map +1 -1
  74. package/dist/src/common/input.js +2 -2
  75. package/dist/src/common/input.js.map +1 -1
  76. package/dist/src/common/json-elements.js +1 -1
  77. package/dist/src/common/json-elements.js.map +1 -1
  78. package/dist/src/common/options.d.ts +1 -2
  79. package/dist/src/common/options.d.ts.map +1 -1
  80. package/dist/src/common/options.js +1 -1
  81. package/dist/src/common/options.js.map +1 -1
  82. package/dist/src/common/xml.js +1 -1
  83. package/dist/src/common/xml.js.map +1 -1
  84. package/dist/src/formats/cx/importer.js +6 -6
  85. package/dist/src/formats/cx/importer.js.map +1 -1
  86. package/dist/src/formats/cys/importer.js +3 -3
  87. package/dist/src/formats/cys/importer.js.map +1 -1
  88. package/dist/src/formats/cys/tables.js +1 -1
  89. package/dist/src/formats/cys/tables.js.map +1 -1
  90. package/dist/src/formats/dot/exporter.js +3 -3
  91. package/dist/src/formats/dot/exporter.js.map +1 -1
  92. package/dist/src/formats/dot/importer.js +1 -1
  93. package/dist/src/formats/dot/importer.js.map +1 -1
  94. package/dist/src/formats/gexf/exporter.d.ts.map +1 -1
  95. package/dist/src/formats/gexf/exporter.js +24 -27
  96. package/dist/src/formats/gexf/exporter.js.map +1 -1
  97. package/dist/src/formats/gexf/importer.d.ts +1 -2
  98. package/dist/src/formats/gexf/importer.d.ts.map +1 -1
  99. package/dist/src/formats/gexf/importer.js +5 -5
  100. package/dist/src/formats/gexf/importer.js.map +1 -1
  101. package/dist/src/formats/gml/exporter.js +4 -4
  102. package/dist/src/formats/gml/exporter.js.map +1 -1
  103. package/dist/src/formats/gml/syntax.js +1 -1
  104. package/dist/src/formats/gml/syntax.js.map +1 -1
  105. package/dist/src/formats/graphml/exporter.js +3 -3
  106. package/dist/src/formats/graphml/exporter.js.map +1 -1
  107. package/dist/src/formats/graphml/importer.js +2 -2
  108. package/dist/src/formats/graphml/importer.js.map +1 -1
  109. package/dist/src/formats/graphml/tree.js +2 -2
  110. package/dist/src/formats/graphml/tree.js.map +1 -1
  111. package/dist/src/formats/json/exporter.js +1 -1
  112. package/dist/src/formats/json/exporter.js.map +1 -1
  113. package/dist/src/formats/json/importer.js +1 -1
  114. package/dist/src/formats/json/importer.js.map +1 -1
  115. package/dist/src/formats/neo4j/exporter.js +3 -3
  116. package/dist/src/formats/neo4j/exporter.js.map +1 -1
  117. package/dist/src/formats/pajek/exporter.js +4 -4
  118. package/dist/src/formats/pajek/exporter.js.map +1 -1
  119. package/dist/src/formats/xgmml/document.js +6 -6
  120. package/dist/src/formats/xgmml/document.js.map +1 -1
  121. package/dist/src/formats/xgmml/emit.js +2 -2
  122. package/dist/src/formats/xgmml/emit.js.map +1 -1
  123. package/dist/src/formats/xgmml/exporter.js +1 -1
  124. package/dist/src/formats/xgmml/exporter.js.map +1 -1
  125. package/dist/src/formats/xgmml/importer.js +1 -1
  126. package/dist/src/formats/xgmml/importer.js.map +1 -1
  127. package/dist/src/registry.js +2 -2
  128. package/dist/src/registry.js.map +1 -1
  129. package/dist/src/sniff.js +1 -1
  130. package/dist/src/sniff.js.map +1 -1
  131. package/dist/xgmml.js +2 -2
  132. package/package.json +2 -2
  133. package/src/common/attributes.ts +1 -2
  134. package/src/common/direction.ts +2 -2
  135. package/src/common/escape.ts +1 -1
  136. package/src/common/export.ts +1 -1
  137. package/src/common/ids.ts +1 -3
  138. package/src/common/input.ts +2 -2
  139. package/src/common/json-elements.ts +1 -1
  140. package/src/common/options.ts +1 -1
  141. package/src/common/xml.ts +1 -1
  142. package/src/formats/cx/importer.ts +6 -6
  143. package/src/formats/cys/importer.ts +3 -3
  144. package/src/formats/cys/tables.ts +1 -1
  145. package/src/formats/dot/exporter.ts +3 -3
  146. package/src/formats/dot/importer.ts +1 -1
  147. package/src/formats/gexf/exporter.ts +24 -28
  148. package/src/formats/gexf/importer.ts +5 -5
  149. package/src/formats/gml/exporter.ts +4 -4
  150. package/src/formats/gml/syntax.ts +1 -1
  151. package/src/formats/graphml/exporter.ts +3 -3
  152. package/src/formats/graphml/importer.ts +2 -2
  153. package/src/formats/graphml/tree.ts +2 -2
  154. package/src/formats/json/exporter.ts +1 -1
  155. package/src/formats/json/importer.ts +1 -1
  156. package/src/formats/neo4j/exporter.ts +3 -3
  157. package/src/formats/pajek/exporter.ts +4 -4
  158. package/src/formats/xgmml/document.ts +6 -6
  159. package/src/formats/xgmml/emit.ts +2 -2
  160. package/src/formats/xgmml/exporter.ts +1 -1
  161. package/src/formats/xgmml/importer.ts +1 -1
  162. package/src/registry.ts +2 -2
  163. package/src/sniff.ts +1 -1
  164. package/dist/chunks/export-Cbt4h_0n.js.map +0 -1
  165. package/dist/chunks/exporter-LZTIAzkS.js.map +0 -1
  166. package/dist/chunks/importer-BTbjwN10.js.map +0 -1
  167. package/dist/chunks/importer-C1VMuEBQ.js.map +0 -1
  168. package/dist/chunks/importer-CSmH218L.js.map +0 -1
  169. package/dist/chunks/importer-DMgcD1wI.js.map +0 -1
  170. package/dist/chunks/importer-DtKPzhVp.js.map +0 -1
  171. package/dist/chunks/importer-DvPvd4Yy.js.map +0 -1
  172. package/dist/chunks/json-elements-CxJF-Szz.js.map +0 -1
package/dist/gexf.js CHANGED
@@ -1,6 +1,6 @@
1
- import { bF as TIME_TEXT_ROLE, bG as TIME_TEXT_SUFFIX, al as resolveImportOptions, a8 as ImportReportBuilder, ao as reportSinkOptions, an as reportUnusedOptions, a4 as textChunks, E as EMPTY_INPUT_CODE, X as XML_SYNTAX_CODE, am as throwIfAborted, ar as IdCoercer, aq as DirectionResolver, f as STRAY_TEXT_CODE, N as NO_GRAPH_CODE, h as UNKNOWN_XML_ATTRIBUTE_CODE, l as MULTIPLE_GRAPHS_CODE, j as COUNT_MISMATCH_CODE, k as COUNT_HINT_CODE, o as DUPLICATE_ATTRIBUTE_CODE, aJ as isWeightField, bH as declareAttribute, a1 as declareResolved, t as MISSING_ID_CODE, n as DUPLICATE_NODE_CODE, q as UNKNOWN_PARENT_CODE, ai as PARENT_CYCLE_CODE, s as MISSING_ENDPOINT_CODE, m as DUPLICATE_EDGE_ID_CODE, aK as parseWeightText, bI as overflowsToInfinity, P as PRECISION_CODE, bJ as parseDeclaredTemporal, br as declareCompanion, bK as parseDeclaredValue, bL as losesPrecision, bM as parseTimeText, a3 as BAD_VALUE_CODE, bN as splitListText, g as UNKNOWN_ELEMENT_CODE, I as ID_MERGED_CODE, bO as timeTextCompanion, bP as parseDecimalText, c as capabilities, L as LOSS, aE as sanitizeIds, p as pairFolding, e as explicitWeights, r as resolveExportOptions, a as checkCapabilities, bQ as formatTimeValue, aa as formatF32, ab as formatF64, bR as mapDeclaredType, bS as joinListText, bT as formatTemporal, aG as formatInteger, b as plural, $ as agree, bx as isCanonicalIntegerText, M as MIXED_DIRECTION_CODE, D as DIRECTION_FORCED_CODE, d as DIRECTION_REFUSED_CODE, S as SINK_OPTION_CODE, O as OPTION_IGNORED_CODE, R as ROLE_TAKEN_CODE, C as COLUMN_RENAMED_CODE, aZ as BAD_OPTIONS_CODE, B as BAD_DEFAULT_CODE, U as UNKNOWN_ATTR_TYPE_CODE, v as ENCODING_CONFLICT_CODE, w as UNKNOWN_ENCODING_CODE, x as ENCODING_FALLBACK_CODE, y as INVALID_ENCODING_CODE, z as INVALID_UTF8_CODE, A as COLUMN_TYPE_CODE, F as ELEMENT_ISSUE, G as INPUT_ISSUE } from "./chunks/export-Cbt4h_0n.js";
1
+ import { bF as TIME_TEXT_ROLE, bG as TIME_TEXT_SUFFIX, al as resolveImportOptions, a8 as ImportReportBuilder, ao as reportSinkOptions, an as reportUnusedOptions, a4 as textChunks, E as EMPTY_INPUT_CODE, X as XML_SYNTAX_CODE, am as throwIfAborted, ar as IdCoercer, aq as DirectionResolver, f as STRAY_TEXT_CODE, N as NO_GRAPH_CODE, h as UNKNOWN_XML_ATTRIBUTE_CODE, l as MULTIPLE_GRAPHS_CODE, j as COUNT_MISMATCH_CODE, k as COUNT_HINT_CODE, o as DUPLICATE_ATTRIBUTE_CODE, aJ as isWeightField, bH as declareAttribute, a1 as declareResolved, t as MISSING_ID_CODE, n as DUPLICATE_NODE_CODE, q as UNKNOWN_PARENT_CODE, ai as PARENT_CYCLE_CODE, s as MISSING_ENDPOINT_CODE, m as DUPLICATE_EDGE_ID_CODE, aK as parseWeightText, bI as overflowsToInfinity, P as PRECISION_CODE, bJ as parseDeclaredTemporal, br as declareCompanion, bK as parseDeclaredValue, bL as losesPrecision, bM as parseTimeText, a3 as BAD_VALUE_CODE, bN as splitListText, g as UNKNOWN_ELEMENT_CODE, I as ID_MERGED_CODE, bO as timeTextCompanion, bP as parseDecimalText, c as capabilities, L as LOSS, aE as sanitizeIds, p as pairFolding, e as explicitWeights, r as resolveExportOptions, a as checkCapabilities, bQ as formatTimeValue, aa as formatF32, ab as formatF64, bR as mapDeclaredType, bS as joinListText, bT as formatTemporal, aG as formatInteger, b as plural, $ as agree, bx as isCanonicalIntegerText, M as MIXED_DIRECTION_CODE, D as DIRECTION_FORCED_CODE, d as DIRECTION_REFUSED_CODE, S as SINK_OPTION_CODE, O as OPTION_IGNORED_CODE, R as ROLE_TAKEN_CODE, C as COLUMN_RENAMED_CODE, aZ as BAD_OPTIONS_CODE, B as BAD_DEFAULT_CODE, U as UNKNOWN_ATTR_TYPE_CODE, v as ENCODING_CONFLICT_CODE, w as UNKNOWN_ENCODING_CODE, x as ENCODING_FALLBACK_CODE, y as INVALID_ENCODING_CODE, z as INVALID_UTF8_CODE, A as COLUMN_TYPE_CODE, F as ELEMENT_ISSUE, G as INPUT_ISSUE } from "./chunks/export-CTUlibzr.js";
2
2
  import { GraphFormatError, INVALID_INDEX, MAX_COUNT } from "@graphty/graph-format";
3
- import { t as tokenizeXml, f as xmlDeclaredEncoding, g as XmlEmptyInputError, X as XmlSyntaxError, s as sniffXmlText, l as localName, j as isWhitespace, x as xmlIllegalTextNotes, a as escapeXmlText, e as escapeXmlAttribute } from "./chunks/escape-wVIEtLv6.js";
3
+ import { t as tokenizeXml, f as xmlDeclaredEncoding, g as XmlEmptyInputError, X as XmlSyntaxError, s as sniffXmlText, l as localName, j as isWhitespace, x as xmlIllegalTextNotes, a as escapeXmlText, e as escapeXmlAttribute } from "./chunks/escape-BRcyzD77.js";
4
4
  import { j as joinText, e as encodeChunks } from "./chunks/writer-DxjgHwSe.js";
5
5
  const GEXF_FORMAT = "gexf";
6
6
  const GEXF_NAMESPACES = {
@@ -546,7 +546,7 @@ class GexfReader {
546
546
  }
547
547
  // ---------------------------------------------------------------- events
548
548
  start(name, attrs, line, ns = "") {
549
- const parent = this.ctx.length === 0 ? null : this.ctx[this.ctx.length - 1];
549
+ const parent = this.ctx.at(-1) ?? null;
550
550
  const local = localName(name);
551
551
  if (ns === null && parent !== null && parent !== 14 && parent !== 2 && parent !== 6 && !name.startsWith("viz:")) {
552
552
  this.unknownElement(name, line);
@@ -672,7 +672,7 @@ class GexfReader {
672
672
  * @param line - the line
673
673
  */
674
674
  text(text, line) {
675
- const ctx = this.ctx.length === 0 ? null : this.ctx[this.ctx.length - 1];
675
+ const ctx = this.ctx.at(-1) ?? null;
676
676
  switch (ctx) {
677
677
  case 2:
678
678
  this.metaText += text;
@@ -1056,7 +1056,7 @@ class GexfReader {
1056
1056
  }
1057
1057
  this.checkAttributes("attribute", attrs, line);
1058
1058
  const group = this.attributeGroup;
1059
- if (group === null || group.domain === null) {
1059
+ if (!group?.domain) {
1060
1060
  this.ctx.push(
1061
1061
  14
1062
1062
  /* Skip */
@@ -1253,7 +1253,7 @@ class GexfReader {
1253
1253
  beginNode(attrs, line) {
1254
1254
  const { report, sink } = this;
1255
1255
  this.checkAbort();
1256
- const enclosing = this.nodeStack.length === 0 ? INVALID_INDEX : this.nodeStack[this.nodeStack.length - 1].index;
1256
+ const enclosing = this.nodeStack.at(-1)?.index ?? INVALID_INDEX;
1257
1257
  const idText = attrs.get("id");
1258
1258
  const where = { line, element: idText ?? attrs.get("label") ?? null };
1259
1259
  this.countInSection("node");
@@ -2941,7 +2941,7 @@ function collectTemporalTables(snapshot, version, note) {
2941
2941
  const start = table.get(TEMPORAL_COLUMNS.start);
2942
2942
  const end = table.get(TEMPORAL_COLUMNS.end);
2943
2943
  const value = table.get(TEMPORAL_COLUMNS.value);
2944
- if (element === null || element.dtype !== "u32" || start === null || !isNumericScalar(start) || end === null || !isNumericScalar(end) || value === null) {
2944
+ if (element?.dtype !== "u32" || start === null || !isNumericScalar(start) || end === null || !isNumericScalar(end) || value === null) {
2945
2945
  note(
2946
2946
  GEXF_LOSS.TEMPORAL_TABLE_SHAPE,
2947
2947
  `extension table "${name}" lacks the element / start / end / value columns and cannot be written`,
@@ -3334,7 +3334,7 @@ function uniqueId(preferred, name, used) {
3334
3334
  }
3335
3335
  }
3336
3336
  function timeText(column, companion, row, timeFormat) {
3337
- if (companion !== null && companion.isSet(row)) {
3337
+ if (companion?.isSet(row)) {
3338
3338
  return companion.value(row);
3339
3339
  }
3340
3340
  return formatTimeValue(column.value(row), timeFormat);
@@ -3343,11 +3343,11 @@ function lifetimeAttrs(roles, row, plan) {
3343
3343
  let out = "";
3344
3344
  const { timeFormat, version } = plan;
3345
3345
  let bits = 0;
3346
- if (version === "1.2" && roles.open !== null && roles.open.isSet(row)) {
3346
+ if (version === "1.2" && roles.open?.isSet(row)) {
3347
3347
  bits = roles.open.value(row);
3348
3348
  }
3349
3349
  const write = (name, column, open) => {
3350
- if (column === null || !column.isSet(row)) {
3350
+ if (!column?.isSet(row)) {
3351
3351
  return;
3352
3352
  }
3353
3353
  const value = column.value(row);
@@ -3357,7 +3357,7 @@ function lifetimeAttrs(roles, row, plan) {
3357
3357
  const text = timeText(column, roles.companions.get(column.meta.name) ?? null, row, timeFormat);
3358
3358
  out += ` ${open ? `${name}open` : name}="${escapeXmlAttribute(text)}"`;
3359
3359
  };
3360
- if (roles.timestamp !== null && roles.timestamp.isSet(row)) {
3360
+ if (roles.timestamp?.isSet(row)) {
3361
3361
  if (version === "1.3" && plan.timeRepresentation === "timestamp") {
3362
3362
  write("timestamp", roles.timestamp, false);
3363
3363
  } else {
@@ -3368,7 +3368,7 @@ function lifetimeAttrs(roles, row, plan) {
3368
3368
  write("start", roles.start, (bits & OPEN_START) !== 0);
3369
3369
  write("end", roles.end, (bits & OPEN_END) !== 0);
3370
3370
  }
3371
- if (version === "1.3" && roles.timestamps !== null && roles.timestamps.isSet(row)) {
3371
+ if (version === "1.3" && roles.timestamps?.isSet(row)) {
3372
3372
  const items = listItems(roles.timestamps, row).map((t) => formatTimeValue(t, timeFormat));
3373
3373
  out += ` timestamps="${escapeXmlAttribute(`<[${items.join(", ")}]>`)}"`;
3374
3374
  }
@@ -3376,14 +3376,14 @@ function lifetimeAttrs(roles, row, plan) {
3376
3376
  }
3377
3377
  function spellsElement(roles, row, plan, indent) {
3378
3378
  const pairs = [];
3379
- if (roles.spells !== null && roles.spells.isSet(row)) {
3380
- const open = plan.version === "1.2" && roles.spellsOpen !== null && roles.spellsOpen.isSet(row) ? listItems(roles.spellsOpen, row) : [];
3379
+ if (roles.spells?.isSet(row)) {
3380
+ const open = plan.version === "1.2" && roles.spellsOpen?.isSet(row) ? listItems(roles.spellsOpen, row) : [];
3381
3381
  listItems(roles.spells, row).forEach((pair, i) => {
3382
3382
  const [s, e] = Array.from(pair);
3383
3383
  pairs.push([s, e, open[i] ?? 0]);
3384
3384
  });
3385
3385
  }
3386
- if (plan.version === "1.2" && roles.timestamps !== null && roles.timestamps.isSet(row)) {
3386
+ if (plan.version === "1.2" && roles.timestamps?.isSet(row)) {
3387
3387
  for (const t of listItems(roles.timestamps, row)) {
3388
3388
  pairs.push([t, t, 0]);
3389
3389
  }
@@ -3413,9 +3413,9 @@ function attvaluesElement(attrs, row, plan, indent) {
3413
3413
  let out = "";
3414
3414
  for (const spec of attrs) {
3415
3415
  const { column } = spec;
3416
- if (column !== null && column.isSet(row)) {
3416
+ if (column?.isSet(row)) {
3417
3417
  let text;
3418
- if (spec.companion !== null && spec.companion.isSet(row)) {
3418
+ if (spec.companion?.isSet(row)) {
3419
3419
  text = spec.companion.value(row);
3420
3420
  } else {
3421
3421
  text = spec.format(cellValue(column, row));
@@ -3438,7 +3438,7 @@ function attvaluesElement(attrs, row, plan, indent) {
3438
3438
  continue;
3439
3439
  }
3440
3440
  let text;
3441
- if (table.valueText !== null && table.valueText.isSet(r)) {
3441
+ if (table.valueText?.isSet(r)) {
3442
3442
  text = table.valueText.value(r);
3443
3443
  } else {
3444
3444
  text = table.format(cellValue(table.value, r));
@@ -3462,7 +3462,7 @@ function timedAttrs(table, r, plan) {
3462
3462
  return ` timestamp="${escapeXmlAttribute(timeText(table.start, table.startText, r, plan.timeFormat))}"`;
3463
3463
  }
3464
3464
  let bits = 0;
3465
- if (plan.version === "1.2" && table.open !== null && table.open.isSet(r)) {
3465
+ if (plan.version === "1.2" && table.open?.isSet(r)) {
3466
3466
  bits = table.open.value(r);
3467
3467
  }
3468
3468
  if (Number.isFinite(start)) {
@@ -3520,7 +3520,7 @@ function listItems(column, row) {
3520
3520
  function vizElements(roles, row, indent, writeZ) {
3521
3521
  let out = "";
3522
3522
  const { color } = roles;
3523
- if (color !== null && color.isSet(row)) {
3523
+ if (color?.isSet(row)) {
3524
3524
  const lanes = Array.from(color.value(row));
3525
3525
  const scale = color.dtype === "u8" ? 1 : 255;
3526
3526
  const channel = (v) => String(Math.max(0, Math.min(255, Math.round(v * scale))));
@@ -3535,7 +3535,7 @@ function vizElements(roles, row, indent, writeZ) {
3535
3535
  `;
3536
3536
  }
3537
3537
  const { position } = roles;
3538
- if (position !== null && position.isSet(row)) {
3538
+ if (position?.isSet(row)) {
3539
3539
  const lanes = Array.from(position.value(row));
3540
3540
  const fmt = position.dtype === "f32" ? formatF32 : formatF64;
3541
3541
  let attrs = ` x="${fmt(lanes[0])}" y="${fmt(lanes[1])}"`;
@@ -3549,7 +3549,7 @@ function vizElements(roles, row, indent, writeZ) {
3549
3549
  ["size", roles.size],
3550
3550
  ["thickness", roles.thickness]
3551
3551
  ]) {
3552
- if (column !== null && column.isSet(row)) {
3552
+ if (column?.isSet(row)) {
3553
3553
  const value = column.value(row);
3554
3554
  const text = column.dtype === "f32" ? formatF32(value) : formatF64(value);
3555
3555
  out += `${indent}<viz:${name} value="${escapeXmlAttribute(text)}"/>
@@ -3557,9 +3557,9 @@ function vizElements(roles, row, indent, writeZ) {
3557
3557
  }
3558
3558
  }
3559
3559
  const { shape } = roles;
3560
- if (shape !== null && shape.isSet(row)) {
3560
+ if (shape?.isSet(row)) {
3561
3561
  let attrs = ` value="${escapeXmlAttribute(String(shape.value(row)))}"`;
3562
- if (roles.shapeUri !== null && roles.shapeUri.isSet(row)) {
3562
+ if (roles.shapeUri?.isSet(row)) {
3563
3563
  attrs += ` uri="${escapeXmlAttribute(roles.shapeUri.value(row))}"`;
3564
3564
  }
3565
3565
  out += `${indent}<viz:shape${attrs}/>
@@ -3636,15 +3636,15 @@ function* writeGexf(snapshot, options) {
3636
3636
  `;
3637
3637
  for (let i = 0; i < snapshot.nodeCount; i++) {
3638
3638
  let attrs = ` id="${idText(i)}"`;
3639
- if (nodeRoles.label !== null && nodeRoles.label.isSet(i)) {
3639
+ if (nodeRoles.label?.isSet(i)) {
3640
3640
  attrs += ` label="${escapeXmlAttribute(String(nodeRoles.label.value(i)))}"`;
3641
3641
  }
3642
- if (nodeRoles.parent !== null && nodeRoles.parent.isSet(i)) {
3642
+ if (nodeRoles.parent?.isSet(i)) {
3643
3643
  attrs += ` pid="${idText(nodeRoles.parent.value(i))}"`;
3644
3644
  }
3645
3645
  attrs += lifetimeAttrs(nodeRoles, i, plan);
3646
3646
  let body = attvaluesElement(plan.nodeAttrs, i, plan, " ");
3647
- if (nodeRoles.parents !== null && nodeRoles.parents.isSet(i)) {
3647
+ if (nodeRoles.parents?.isSet(i)) {
3648
3648
  const parents = listItems(nodeRoles.parents, i);
3649
3649
  if (parents.length > 0) {
3650
3650
  body += " <parents>\n";
@@ -3682,7 +3682,7 @@ ${body} </node>
3682
3682
  continue;
3683
3683
  }
3684
3684
  let attrs = "";
3685
- if (edgeRoles.id !== null && edgeRoles.id.isSet(e)) {
3685
+ if (edgeRoles.id?.isSet(e)) {
3686
3686
  attrs += ` id="${escapeXmlAttribute(String(edgeRoles.id.value(e)))}"`;
3687
3687
  } else if (version === "1.2") {
3688
3688
  attrs += ` id="e${e}"`;
@@ -3695,10 +3695,10 @@ ${body} </node>
3695
3695
  if (weight !== null) {
3696
3696
  attrs += ` weight="${weight}"`;
3697
3697
  }
3698
- if (edgeRoles.label !== null && edgeRoles.label.isSet(e)) {
3698
+ if (edgeRoles.label?.isSet(e)) {
3699
3699
  attrs += ` label="${escapeXmlAttribute(String(edgeRoles.label.value(e)))}"`;
3700
3700
  }
3701
- if (version === "1.3" && edgeRoles.kind !== null && edgeRoles.kind.isSet(e)) {
3701
+ if (version === "1.3" && edgeRoles.kind?.isSet(e)) {
3702
3702
  attrs += ` kind="${escapeXmlAttribute(String(edgeRoles.kind.value(e)))}"`;
3703
3703
  }
3704
3704
  attrs += lifetimeAttrs(edgeRoles, e, plan);