@diagrammo/dgmo 0.75.0 → 0.77.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 (120) hide show
  1. package/dist/advanced.d.ts +181 -12
  2. package/dist/advanced.js +267 -60
  3. package/dist/block.css +20 -3
  4. package/dist/block.d.ts +12 -4
  5. package/dist/block.js +35 -18
  6. package/dist/{chart-meta-lP8Rl19E.d.ts → chart-meta-Cf_jkApJ.d.ts} +2 -2
  7. package/dist/chart-meta.d.ts +3 -3
  8. package/dist/chart-meta.js +6 -6
  9. package/dist/{charts-d3-SQEVMIAM.js → charts-d3-HMEMHSSW.js} +5 -5
  10. package/dist/{chunk-E3BJVEMZ.js → chunk-2MTM4E6M.js} +2 -2
  11. package/dist/{chunk-UBW53CNS.js → chunk-3E4YB6TY.js} +2 -2
  12. package/dist/{chunk-IFC3JXCT.js → chunk-3O7ZYVJV.js} +2 -2
  13. package/dist/{chunk-Q6BAFS7I.js → chunk-43AJKH2U.js} +3 -3
  14. package/dist/{chunk-2NRIGEHZ.js → chunk-46KVXDUJ.js} +10 -3
  15. package/dist/chunk-53SEVJQM.js +9 -0
  16. package/dist/{chunk-UTTRJ6KN.js → chunk-5ZD4DDG7.js} +4 -4
  17. package/dist/{chunk-AFR6GWXD.js → chunk-6BVAW7KI.js} +4 -4
  18. package/dist/{chunk-CLQJAGWL.js → chunk-6IN4F4RH.js} +4 -4
  19. package/dist/{chunk-76IBFEYW.js → chunk-6ZZKEYBS.js} +4 -4
  20. package/dist/{chunk-QUYYL3LP.js → chunk-7CXW6EGX.js} +5 -5
  21. package/dist/chunk-7IATMZSA.js +72 -0
  22. package/dist/{chunk-HOIAQ3P2.js → chunk-B52RL5VV.js} +2 -2
  23. package/dist/{chunk-IGQW7TKM.js → chunk-BH3BQICT.js} +5 -5
  24. package/dist/{chunk-3LJNQ6LR.js → chunk-CF3I5SOG.js} +5 -5
  25. package/dist/{chunk-ZMKCG3FT.js → chunk-CHOK7NCJ.js} +6 -6
  26. package/dist/{chunk-U74EGVOA.js → chunk-CIWFL2LM.js} +4 -4
  27. package/dist/{chunk-OUJG73YJ.js → chunk-CYMYZYLI.js} +5 -5
  28. package/dist/{chunk-BCB24FG7.js → chunk-D3B6YEZK.js} +3 -3
  29. package/dist/{chunk-XHROEQ23.js → chunk-DSXWJAOA.js} +4 -4
  30. package/dist/{chunk-RT7ACF77.js → chunk-EGY3TS62.js} +6 -6
  31. package/dist/{chunk-CQKD6GOC.js → chunk-EUVUOPRC.js} +4 -4
  32. package/dist/{chunk-TDHD3HNO.js → chunk-F4X5NVKY.js} +37 -16
  33. package/dist/{chunk-7G4XMHDB.js → chunk-FF7LRT5L.js} +4 -4
  34. package/dist/{chunk-6DYZ2JM6.js → chunk-FR5EVD2X.js} +206 -32
  35. package/dist/{chunk-R5JPMW2F.js → chunk-FTTB64OJ.js} +5 -5
  36. package/dist/{chunk-U7AO6FRL.js → chunk-H7BYMIVK.js} +312 -118
  37. package/dist/{chunk-M3IVOGZE.js → chunk-HDLRRY3N.js} +61 -55
  38. package/dist/{chunk-F4CPZRG2.js → chunk-J76YDS4V.js} +2 -2
  39. package/dist/{chunk-SUA56ZSB.js → chunk-LTTZX6RD.js} +6 -2
  40. package/dist/{chunk-7EZ5AKBK.js → chunk-LYJ53DBK.js} +8 -6
  41. package/dist/{chunk-JQ575OAK.js → chunk-MZEGUDTA.js} +2 -2
  42. package/dist/{chunk-IHUOYDLN.js → chunk-N5NQIZ56.js} +5 -5
  43. package/dist/{chunk-GE5RO4BS.js → chunk-N6MZSBOL.js} +5 -1
  44. package/dist/{chunk-DU3OIBQE.js → chunk-NWNSXHA5.js} +6 -2
  45. package/dist/{chunk-32MOGTKT.js → chunk-OO2L2LWV.js} +4 -4
  46. package/dist/{chunk-XCAEHWQB.js → chunk-OZOHREFQ.js} +3 -3
  47. package/dist/{chunk-DSH7NJ2G.js → chunk-QBM5BURJ.js} +4 -4
  48. package/dist/{chunk-YVDBBWEP.js → chunk-QXMHBIQG.js} +4 -4
  49. package/dist/{chunk-UWYZIGCB.js → chunk-RGW26UAR.js} +2 -2
  50. package/dist/{chunk-QI4Q5ZZH.js → chunk-RV5A3EGI.js} +4 -4
  51. package/dist/{chunk-HGFKDSKZ.js → chunk-SI3PYDL4.js} +4 -4
  52. package/dist/{chunk-CAPR5DET.js → chunk-SSEAULA5.js} +2 -2
  53. package/dist/{chunk-AYM472K3.js → chunk-SWUQJ5VR.js} +3 -3
  54. package/dist/{chunk-HFCKU73Y.js → chunk-TI4YUUW6.js} +3 -3
  55. package/dist/{chunk-LYLRNAX2.js → chunk-TKIPK5P6.js} +3 -3
  56. package/dist/{chunk-QT5UMFPE.js → chunk-U4DS2ODO.js} +3 -3
  57. package/dist/{chunk-XFLLYY3V.js → chunk-UBDVAHGK.js} +36 -52
  58. package/dist/{chunk-JL7BDLC6.js → chunk-UH5YTZN7.js} +4 -4
  59. package/dist/{chunk-GEURKGZS.js → chunk-V4NHFY22.js} +4 -4
  60. package/dist/{chunk-4SXHMFFP.js → chunk-VRPV6QXR.js} +23 -12
  61. package/dist/{chunk-BFTRW24X.js → chunk-WHWUVDYK.js} +65 -24
  62. package/dist/{chunk-U5B3TUEW.js → chunk-XCFIAGT7.js} +2 -2
  63. package/dist/{chunk-COCMMQXW.js → chunk-XFXJXLK7.js} +2 -2
  64. package/dist/{chunk-YDA46XHI.js → chunk-XPBJVSRY.js} +2 -2
  65. package/dist/{chunk-VV6HZQ5K.js → chunk-YM5RMLFO.js} +2 -2
  66. package/dist/{d3--y67plmW.d.ts → d3-BiaJtaSw.d.ts} +1 -1
  67. package/dist/{dgmo-router-KYNLRE7S.js → dgmo-router-A3LIHT6H.js} +7 -7
  68. package/dist/{dgmo-router-CY5j16Pl.d.ts → dgmo-router-BwXHZ_P3.d.ts} +1 -1
  69. package/dist/{dimensions-NLQ64ED5.js → dimensions-OFF4GRFL.js} +4 -4
  70. package/dist/{flowchart-parser-LY5GGQL2.js → flowchart-parser-NVBP3C5D.js} +2 -2
  71. package/dist/{flowchart-renderer-RIJ5FZKO.js → flowchart-renderer-BBJUPORB.js} +6 -6
  72. package/dist/index.d.ts +7 -7
  73. package/dist/index.js +14 -14
  74. package/dist/{layout-UJ62RQQ3.js → layout-2OJ25STS.js} +2 -2
  75. package/dist/{layout-DAYQ46PS.js → layout-Y2V3LYV7.js} +3 -3
  76. package/dist/{parser-LUOINP6H.js → parser-QYAIFXLP.js} +3 -3
  77. package/dist/{parser-L7RXUKYN.js → parser-WVE6SKB7.js} +2 -2
  78. package/dist/{parser-JYIZEKAS.js → parser-ZYAFHXKQ.js} +2 -2
  79. package/dist/{renderer-FUJNSC5X.js → renderer-2ANDPQWC.js} +3 -3
  80. package/dist/{renderer-UYZSP7MF.js → renderer-2LDT4TUX.js} +5 -5
  81. package/dist/{renderer-4EWGZLJ6.js → renderer-2NYQDW37.js} +3 -3
  82. package/dist/{renderer-LBNVKVO3.js → renderer-2RIIIO34.js} +5 -5
  83. package/dist/{renderer-PKRKLOYR.js → renderer-3HFU3DTO.js} +5 -5
  84. package/dist/{renderer-UUP6OX6F.js → renderer-4BF6ILP6.js} +5 -5
  85. package/dist/{renderer-MUW4G2N6.js → renderer-5E2AH5TO.js} +7 -7
  86. package/dist/{renderer-DKW273R7.js → renderer-62SLWRYF.js} +6 -5
  87. package/dist/{renderer-WDSBFDQ2.js → renderer-ANJUDBOS.js} +6 -6
  88. package/dist/{renderer-OTHBTGBN.js → renderer-CVWQD442.js} +3 -3
  89. package/dist/{renderer-GJDVPXI3.js → renderer-D6GJ6EVK.js} +6 -6
  90. package/dist/{renderer-KMOGGMM7.js → renderer-DNFV2IQI.js} +5 -5
  91. package/dist/{renderer-UYYBJ7OB.js → renderer-EDVCGIQO.js} +10 -10
  92. package/dist/{renderer-73QHYZ2Q.js → renderer-EFQSMHID.js} +6 -6
  93. package/dist/{renderer-EP4GRCDX.js → renderer-FTX67CYZ.js} +3 -3
  94. package/dist/{renderer-GF6S5ZX6.js → renderer-G2DPKJAN.js} +5 -5
  95. package/dist/{renderer-QAMOXOZ2.js → renderer-GHBF5PRH.js} +3 -3
  96. package/dist/{renderer-5W3HWIUL.js → renderer-GZLRX764.js} +5 -5
  97. package/dist/{renderer-CO5O5VR5.js → renderer-H2HYLFN3.js} +3 -3
  98. package/dist/{renderer-JMJ7Q5OC.js → renderer-IR5655M7.js} +5 -5
  99. package/dist/{renderer-4PNVGHVA.js → renderer-L237AOOZ.js} +3 -3
  100. package/dist/{renderer-A2YWSBPY.js → renderer-LSJWYGOL.js} +7 -7
  101. package/dist/{renderer-PR3KLNST.js → renderer-LWXDMZOV.js} +5 -5
  102. package/dist/{renderer-3FB56573.js → renderer-MYSVPERC.js} +5 -5
  103. package/dist/{renderer-FGGDZZFQ.js → renderer-OL5QSZPC.js} +6 -6
  104. package/dist/{renderer-XBL6CLN2.js → renderer-P26HH3NA.js} +5 -5
  105. package/dist/{renderer-D7N7PPB7.js → renderer-R5HIRN2M.js} +3 -3
  106. package/dist/{renderer-BUEFD2IF.js → renderer-RNFECJ5D.js} +5 -5
  107. package/dist/{renderer-F24V3RD3.js → renderer-RPZVNCTF.js} +5 -5
  108. package/dist/{renderer-PIEPRK6M.js → renderer-SDNWZDUY.js} +5 -5
  109. package/dist/{renderer-RUHC6D3B.js → renderer-UKHH4UWV.js} +5 -5
  110. package/dist/{renderer-CGOPX4HW.js → renderer-VF7X66SL.js} +5 -5
  111. package/dist/{renderer-ZAJ5353N.js → renderer-Y3Y7PEUS.js} +3 -3
  112. package/dist/{renderer-radial-MZP3SVTZ.js → renderer-radial-QNGCGKZP.js} +5 -5
  113. package/dist/{state-renderer-454ADT7E.js → state-renderer-ELWDRXD6.js} +7 -7
  114. package/dist/{tag-groups-DrHT2tEc.d.ts → tag-groups-BAtkq0b_.d.ts} +39 -1
  115. package/dist/{themes-GWhsabnx.d.ts → themes-DpsyRSO7.d.ts} +2 -2
  116. package/docs/language-reference.md +3 -3
  117. package/gallery/fixtures/sketch.dgmo +1 -1
  118. package/package.json +5 -4
  119. package/dist/chunk-PDKUANDZ.js +0 -35
  120. package/dist/chunk-UTCPNJND.js +0 -7
@@ -11,7 +11,7 @@ import {
11
11
  import {
12
12
  extractExportSvg,
13
13
  runInExportContainer
14
- } from "./chunk-VV6HZQ5K.js";
14
+ } from "./chunk-YM5RMLFO.js";
15
15
  import {
16
16
  EDGE_STROKE_WIDTH,
17
17
  NODE_STROKE_WIDTH
@@ -29,13 +29,13 @@ import {
29
29
  } from "./chunk-DEW62ON3.js";
30
30
  import {
31
31
  renderIntegratedLegend
32
- } from "./chunk-QT5UMFPE.js";
32
+ } from "./chunk-U4DS2ODO.js";
33
33
  import {
34
34
  getLegendExtent
35
- } from "./chunk-4SXHMFFP.js";
35
+ } from "./chunk-VRPV6QXR.js";
36
36
  import {
37
37
  FONT_FAMILY
38
- } from "./chunk-UTCPNJND.js";
38
+ } from "./chunk-53SEVJQM.js";
39
39
  import {
40
40
  LEGEND_HEIGHT
41
41
  } from "./chunk-YT5ICQ4R.js";
@@ -44,7 +44,7 @@ import {
44
44
  } from "./chunk-MTGGOCND.js";
45
45
  import {
46
46
  parseClassDiagram
47
- } from "./chunk-SUA56ZSB.js";
47
+ } from "./chunk-LTTZX6RD.js";
48
48
  import {
49
49
  fillModeFromOptions,
50
50
  legendInlineRequested,
@@ -448,4 +448,4 @@ export {
448
448
  renderClassDiagram,
449
449
  renderClassDiagramForExport
450
450
  };
451
- //# sourceMappingURL=chunk-ZMKCG3FT.js.map
451
+ //# sourceMappingURL=chunk-CHOK7NCJ.js.map
@@ -9,13 +9,13 @@ import {
9
9
  } from "./chunk-C2WH3BMS.js";
10
10
  import {
11
11
  renderIntegratedLegend
12
- } from "./chunk-QT5UMFPE.js";
12
+ } from "./chunk-U4DS2ODO.js";
13
13
  import {
14
14
  getMaxLegendReservedHeight
15
- } from "./chunk-4SXHMFFP.js";
15
+ } from "./chunk-VRPV6QXR.js";
16
16
  import {
17
17
  FONT_FAMILY
18
- } from "./chunk-UTCPNJND.js";
18
+ } from "./chunk-53SEVJQM.js";
19
19
  import {
20
20
  LEGEND_GROUP_GAP
21
21
  } from "./chunk-YT5ICQ4R.js";
@@ -423,4 +423,4 @@ export {
423
423
  renderTreemapRadialForExport,
424
424
  renderTreemapRadial
425
425
  };
426
- //# sourceMappingURL=chunk-U74EGVOA.js.map
426
+ //# sourceMappingURL=chunk-CIWFL2LM.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  extractExportSvg,
3
3
  runInExportContainer
4
- } from "./chunk-VV6HZQ5K.js";
4
+ } from "./chunk-YM5RMLFO.js";
5
5
  import {
6
6
  layoutOrg
7
7
  } from "./chunk-NHQ7HUAS.js";
@@ -35,13 +35,13 @@ import {
35
35
  } from "./chunk-DEW62ON3.js";
36
36
  import {
37
37
  renderIntegratedLegend
38
- } from "./chunk-QT5UMFPE.js";
38
+ } from "./chunk-U4DS2ODO.js";
39
39
  import {
40
40
  getMaxLegendReservedHeight
41
- } from "./chunk-4SXHMFFP.js";
41
+ } from "./chunk-VRPV6QXR.js";
42
42
  import {
43
43
  FONT_FAMILY
44
- } from "./chunk-UTCPNJND.js";
44
+ } from "./chunk-53SEVJQM.js";
45
45
  import {
46
46
  EYE_CLOSED_PATH,
47
47
  EYE_OPEN_PATH,
@@ -493,4 +493,4 @@ export {
493
493
  renderOrg,
494
494
  renderOrgForExport
495
495
  };
496
- //# sourceMappingURL=chunk-OUJG73YJ.js.map
496
+ //# sourceMappingURL=chunk-CYMYZYLI.js.map
@@ -14,10 +14,10 @@ import {
14
14
  } from "./chunk-DEW62ON3.js";
15
15
  import {
16
16
  renderIntegratedLegend
17
- } from "./chunk-QT5UMFPE.js";
17
+ } from "./chunk-U4DS2ODO.js";
18
18
  import {
19
19
  FONT_FAMILY
20
- } from "./chunk-UTCPNJND.js";
20
+ } from "./chunk-53SEVJQM.js";
21
21
  import {
22
22
  LEGEND_HEIGHT
23
23
  } from "./chunk-YT5ICQ4R.js";
@@ -985,4 +985,4 @@ export {
985
985
  renderCycle,
986
986
  renderCycleForExport
987
987
  };
988
- //# sourceMappingURL=chunk-BCB24FG7.js.map
988
+ //# sourceMappingURL=chunk-D3B6YEZK.js.map
@@ -17,14 +17,14 @@ import {
17
17
  } from "./chunk-DEW62ON3.js";
18
18
  import {
19
19
  renderIntegratedLegend
20
- } from "./chunk-QT5UMFPE.js";
20
+ } from "./chunk-U4DS2ODO.js";
21
21
  import {
22
22
  getLegendExtent,
23
23
  getMaxLegendReservedHeight
24
- } from "./chunk-4SXHMFFP.js";
24
+ } from "./chunk-VRPV6QXR.js";
25
25
  import {
26
26
  FONT_FAMILY
27
- } from "./chunk-UTCPNJND.js";
27
+ } from "./chunk-53SEVJQM.js";
28
28
  import {
29
29
  LEGEND_GROUP_GAP
30
30
  } from "./chunk-YT5ICQ4R.js";
@@ -439,4 +439,4 @@ export {
439
439
  renderTreemapForExport,
440
440
  renderTreemap
441
441
  };
442
- //# sourceMappingURL=chunk-XHROEQ23.js.map
442
+ //# sourceMappingURL=chunk-DSXWJAOA.js.map
@@ -1,6 +1,6 @@
1
1
  // src/sketch/diagnostics.ts
2
2
  var SKETCH_DIAGNOSTIC_CODES = {
3
- NESTED_BOX: "E_SKETCH_NESTED_BOX",
3
+ BOX_DEPTH: "E_SKETCH_BOX_DEPTH",
4
4
  AMBIGUOUS_TARGET: "E_SKETCH_AMBIGUOUS_TARGET",
5
5
  UNKNOWN_SHAPE: "W_SKETCH_UNKNOWN_SHAPE",
6
6
  OVERLAP_RESOLVED: "W_SKETCH_OVERLAP_RESOLVED",
@@ -8,12 +8,12 @@ var SKETCH_DIAGNOSTIC_CODES = {
8
8
  };
9
9
  var SKETCH_DIAGNOSTICS = [
10
10
  {
11
- code: SKETCH_DIAGNOSTIC_CODES.NESTED_BOX,
11
+ code: SKETCH_DIAGNOSTIC_CODES.BOX_DEPTH,
12
12
  severity: "error",
13
13
  chartType: "sketch",
14
- title: "Nested box",
15
- message: (p) => `Box "${String(p.label ?? "?")}" is nested inside another box \u2014 sketch boxes are one level only; its shapes join the outer box`,
16
- hint: "Move the inner [Box] to the top level.",
14
+ title: "Box nested too deep",
15
+ message: (p) => `Box "${String(p.label ?? "?")}" is nested ${String(p.depth ?? "?")} levels deep \u2014 sketch boxes nest to depth ${String(p.max ?? "?")} (decision #58); its shapes join the box above it`,
16
+ hint: "Move the inner [Box] up a level \u2014 two levels of bracket is the bound.",
17
17
  example: "sketch\n[Outer]\n [Inner]\n Shape"
18
18
  },
19
19
  {
@@ -58,4 +58,4 @@ export {
58
58
  SKETCH_DIAGNOSTIC_CODES,
59
59
  SKETCH_DIAGNOSTICS
60
60
  };
61
- //# sourceMappingURL=chunk-RT7ACF77.js.map
61
+ //# sourceMappingURL=chunk-EGY3TS62.js.map
@@ -7,13 +7,13 @@ import {
7
7
  } from "./chunk-24YPR5EH.js";
8
8
  import {
9
9
  renderIntegratedLegend
10
- } from "./chunk-QT5UMFPE.js";
10
+ } from "./chunk-U4DS2ODO.js";
11
11
  import {
12
12
  getMaxLegendReservedHeight
13
- } from "./chunk-4SXHMFFP.js";
13
+ } from "./chunk-VRPV6QXR.js";
14
14
  import {
15
15
  FONT_FAMILY
16
- } from "./chunk-UTCPNJND.js";
16
+ } from "./chunk-53SEVJQM.js";
17
17
  import {
18
18
  measureText,
19
19
  truncateText,
@@ -1603,4 +1603,4 @@ export {
1603
1603
  renderTechRadar,
1604
1604
  renderTechRadarForExport
1605
1605
  };
1606
- //# sourceMappingURL=chunk-CQKD6GOC.js.map
1606
+ //# sourceMappingURL=chunk-EUVUOPRC.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SKETCH_DIAGNOSTIC_CODES
3
- } from "./chunk-RT7ACF77.js";
3
+ } from "./chunk-EGY3TS62.js";
4
4
  import {
5
5
  parseInArrowLabel
6
6
  } from "./chunk-IHOFUR74.js";
@@ -71,6 +71,7 @@ var BOX_RE = /^\[([^\]]*)\]\s*(.*)$/;
71
71
  var BOX_TAIL_ALIAS_RE = /^as\s+([A-Za-z][A-Za-z0-9_]{0,11})(?=\s|,|$)\s*,?\s*/;
72
72
  var AT_VALUE_RE = /^(-?\d+)\s+(-?\d+)$/;
73
73
  var SKETCH_AT_MAX = 2e3;
74
+ var MAX_BOX_DEPTH = 2;
74
75
  function parseSketch(content, palette) {
75
76
  const options = {
76
77
  noLegend: false,
@@ -262,7 +263,7 @@ function parseSketch(content, palette) {
262
263
  }
263
264
  return { ...alias !== void 0 && { alias }, at, collapsed, meta };
264
265
  };
265
- const openBox = (label, tail, lineNumber) => {
266
+ const openBox = (label, tail, lineNumber, parentBoxId) => {
266
267
  const norm = normalizeName(label);
267
268
  const existing = boxByNorm.get(norm);
268
269
  const { alias, at, collapsed, meta } = parseBoxTail(tail, lineNumber);
@@ -281,9 +282,14 @@ function parseSketch(content, palette) {
281
282
  metadata: meta,
282
283
  collapsed,
283
284
  children: [],
285
+ childBoxes: [],
286
+ parentBoxId,
284
287
  lineNumber
285
288
  };
286
289
  boxes.push(box);
290
+ if (parentBoxId !== null) {
291
+ boxByNorm.get(normalizeName(parentBoxId.slice(1, -1)))?.childBoxes.push(box.id);
292
+ }
287
293
  boxByNorm.set(norm, box);
288
294
  if (alias !== void 0) {
289
295
  if (aliasIndex.has(alias)) {
@@ -353,7 +359,13 @@ function parseSketch(content, palette) {
353
359
  let firstLineConsumed = false;
354
360
  let contentStarted = false;
355
361
  let currentTagGroup = null;
356
- let currentBox = null;
362
+ const boxStack = [];
363
+ const boxAt = (indent) => {
364
+ while (boxStack.length > 0 && indent <= boxStack[boxStack.length - 1].indent) {
365
+ boxStack.pop();
366
+ }
367
+ return boxStack[boxStack.length - 1] ?? null;
368
+ };
357
369
  let currentShape = null;
358
370
  for (let i = 0; i < lines.length; i++) {
359
371
  const raw = lines[i];
@@ -492,8 +504,8 @@ ${descLine}`;
492
504
  if (EDGE_START_RE.test(trimmed)) {
493
505
  if (indent > 0 && currentShape && indent > currentShape.indent) {
494
506
  addEdge(trimmed, lineNumber, currentShape.id);
495
- } else if (indent > 0 && currentBox && indent > currentBox.indent) {
496
- addEdge(trimmed, lineNumber, currentBox.box.id);
507
+ } else if (indent > 0 && boxAt(indent)) {
508
+ addEdge(trimmed, lineNumber, boxAt(indent).box.id);
497
509
  } else {
498
510
  warn(
499
511
  lineNumber,
@@ -509,29 +521,38 @@ ${descLine}`;
509
521
  warn(lineNumber, "Box has no label \u2014 ignored");
510
522
  continue;
511
523
  }
512
- if (indent > 0 && currentBox && indent > currentBox.indent) {
524
+ while (boxStack.length > 0 && indent <= boxStack[boxStack.length - 1].indent) {
525
+ boxStack.pop();
526
+ }
527
+ const depth = boxStack.length + 1;
528
+ if (depth > MAX_BOX_DEPTH) {
513
529
  pushError(
514
530
  lineNumber,
515
- `Box "${label}" is nested inside "${currentBox.box.label}" \u2014 sketch boxes are one level only; its shapes join the outer box`,
516
- SKETCH_DIAGNOSTIC_CODES.NESTED_BOX
531
+ `Box "${label}" is nested ${depth} levels deep \u2014 sketch boxes nest to depth ${MAX_BOX_DEPTH} (decision #58); its shapes join the box above it`,
532
+ SKETCH_DIAGNOSTIC_CODES.BOX_DEPTH
517
533
  );
518
534
  continue;
519
535
  }
520
- currentBox = {
521
- box: openBox(label, boxMatch[2] ?? "", lineNumber),
522
- indent
523
- };
536
+ const parent = boxStack[boxStack.length - 1] ?? null;
537
+ const box = openBox(
538
+ label,
539
+ boxMatch[2] ?? "",
540
+ lineNumber,
541
+ parent ? parent.box.id : null
542
+ );
543
+ boxStack.push({ box, indent });
524
544
  currentShape = null;
525
545
  continue;
526
546
  }
527
547
  if (indent === 0) {
528
- currentBox = null;
548
+ boxStack.length = 0;
529
549
  const node2 = addShape(trimmed, lineNumber, null);
530
550
  currentShape = node2 ? { id: node2.id, indent } : null;
531
551
  continue;
532
552
  }
533
- if (currentBox && indent > currentBox.indent) {
534
- const node2 = addShape(trimmed, lineNumber, currentBox.box);
553
+ const owner = boxAt(indent);
554
+ if (owner) {
555
+ const node2 = addShape(trimmed, lineNumber, owner.box);
535
556
  currentShape = node2 ? { id: node2.id, indent } : currentShape;
536
557
  continue;
537
558
  }
@@ -632,4 +653,4 @@ export {
632
653
  isSketchShapeKind,
633
654
  parseSketch
634
655
  };
635
- //# sourceMappingURL=chunk-TDHD3HNO.js.map
656
+ //# sourceMappingURL=chunk-F4X5NVKY.js.map
@@ -35,14 +35,14 @@ import {
35
35
  } from "./chunk-DEW62ON3.js";
36
36
  import {
37
37
  renderIntegratedLegend
38
- } from "./chunk-QT5UMFPE.js";
38
+ } from "./chunk-U4DS2ODO.js";
39
39
  import {
40
40
  getLegendExtent,
41
41
  getMaxLegendReservedHeight
42
- } from "./chunk-4SXHMFFP.js";
42
+ } from "./chunk-VRPV6QXR.js";
43
43
  import {
44
44
  FONT_FAMILY
45
- } from "./chunk-UTCPNJND.js";
45
+ } from "./chunk-53SEVJQM.js";
46
46
  import {
47
47
  EYE_CLOSED_PATH,
48
48
  EYE_OPEN_PATH,
@@ -500,4 +500,4 @@ export {
500
500
  renderSitemap,
501
501
  renderSitemapForExport
502
502
  };
503
- //# sourceMappingURL=chunk-7G4XMHDB.js.map
503
+ //# sourceMappingURL=chunk-FF7LRT5L.js.map