@diagrammo/dgmo 0.46.0 → 0.47.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.
- package/dist/advanced.d.cts +3 -855
- package/dist/advanced.d.ts +3 -855
- package/dist/advanced.js +541 -70107
- package/dist/analyzer-UYKBXAKR.js +15 -0
- package/dist/auto.cjs +1 -1
- package/dist/auto.js +1 -1
- package/dist/auto.mjs +1 -1
- package/dist/block.js +83 -69417
- package/dist/calculator-LDYQCDDY.js +11 -0
- package/dist/charts-d3-QOZHKTCT.js +25 -0
- package/dist/chunk-2DXMZRWJ.js +800 -0
- package/dist/chunk-2LACINWN.js +786 -0
- package/dist/chunk-33LCUH4H.js +893 -0
- package/dist/chunk-3CIOJ5YJ.js +35 -0
- package/dist/chunk-3HDBAXF5.js +86 -0
- package/dist/chunk-3JLKYGBQ.js +290 -0
- package/dist/chunk-3MQQNXPD.js +415 -0
- package/dist/chunk-3R5POCTZ.js +967 -0
- package/dist/chunk-3SMGIJDD.js +112 -0
- package/dist/chunk-44CM72SQ.js +409 -0
- package/dist/chunk-4GRI7MEB.js +1604 -0
- package/dist/chunk-4OHACBGX.js +606 -0
- package/dist/chunk-5DH3KYFH.js +21 -0
- package/dist/chunk-5MLYVTYM.js +76 -0
- package/dist/chunk-5QXL4NYS.js +553 -0
- package/dist/chunk-5WRI5ZAA.js +31 -0
- package/dist/chunk-6EK55ART.js +117 -0
- package/dist/chunk-6FZYCKXB.js +2065 -0
- package/dist/chunk-6HO5ZTXK.js +277 -0
- package/dist/chunk-6KFWC4CO.js +7 -0
- package/dist/chunk-6MTWIQVO.js +121 -0
- package/dist/chunk-6NYWYNBI.js +329 -0
- package/dist/chunk-6SM5NJQH.js +620 -0
- package/dist/chunk-725LDASD.js +422 -0
- package/dist/chunk-76OWZ3BA.js +130 -0
- package/dist/chunk-7JEGTRLD.js +338 -0
- package/dist/chunk-A44USUV7.js +923 -0
- package/dist/chunk-A4GOY3PE.js +25 -0
- package/dist/chunk-A4VFQH5G.js +251 -0
- package/dist/chunk-AELOBFW5.js +375 -0
- package/dist/chunk-AN2MOO5T.js +522 -0
- package/dist/chunk-BMR4CIEO.js +41 -0
- package/dist/chunk-BS7SV7C3.js +51 -0
- package/dist/chunk-BUPDIHML.js +613 -0
- package/dist/chunk-BUVJFRPY.js +887 -0
- package/dist/chunk-C3Z4DX3V.js +112 -0
- package/dist/chunk-CI2G3OEB.js +1818 -0
- package/dist/chunk-CKNVO24D.js +54 -0
- package/dist/chunk-CUVHQHZ7.js +391 -0
- package/dist/chunk-CXK4DZH3.js +114 -0
- package/dist/chunk-DKEPS5LH.js +315 -0
- package/dist/chunk-DU7W62N5.js +487 -0
- package/dist/chunk-DZAQBW35.js +751 -0
- package/dist/chunk-EB6FPQUP.js +316 -0
- package/dist/chunk-EMS2SK26.js +376 -0
- package/dist/chunk-ERLBPDGU.js +510 -0
- package/dist/chunk-EVCVDTXE.js +732 -0
- package/dist/chunk-FCIIHT24.js +384 -0
- package/dist/chunk-FFUN5D66.js +97 -0
- package/dist/chunk-FITOLXSX.js +714 -0
- package/dist/chunk-FMDSF3OV.js +68 -0
- package/dist/chunk-FNB3PNGF.js +410 -0
- package/dist/chunk-G2H74XJZ.js +2104 -0
- package/dist/chunk-GMR5MFHJ.js +339 -0
- package/dist/chunk-H6PI3KJT.js +305 -0
- package/dist/chunk-I46X5VUA.js +59 -0
- package/dist/chunk-I5IGB56C.js +255 -0
- package/dist/chunk-IH6ZMVQ5.js +3950 -0
- package/dist/chunk-IJZFN3HM.js +463 -0
- package/dist/chunk-IPWPWM6R.js +3079 -0
- package/dist/chunk-IYULMRBE.js +23 -0
- package/dist/chunk-IZMRON6C.js +167 -0
- package/dist/chunk-J5FIXQRT.js +813 -0
- package/dist/chunk-JED6ZDEE.js +73 -0
- package/dist/chunk-JEUJOX5X.js +136 -0
- package/dist/chunk-JM4LEPY3.js +436 -0
- package/dist/chunk-L3UHP6TD.js +101 -0
- package/dist/chunk-L66GEFB6.js +524 -0
- package/dist/chunk-LIOHW36Z.js +469 -0
- package/dist/chunk-LP7EC4MI.js +16 -0
- package/dist/chunk-MITI6NOL.js +548 -0
- package/dist/chunk-MO5YHHMQ.js +168 -0
- package/dist/chunk-MZSBFAPJ.js +885 -0
- package/dist/chunk-NNAAJVBU.js +9 -0
- package/dist/chunk-NOTA6TEI.js +47 -0
- package/dist/chunk-NURGB5Z4.js +335 -0
- package/dist/chunk-NX4EQS3U.js +1062 -0
- package/dist/chunk-NXMESY4J.js +1 -0
- package/dist/chunk-OJR3MQYV.js +1458 -0
- package/dist/chunk-OURHMODR.js +454 -0
- package/dist/chunk-P235SVAH.js +1057 -0
- package/dist/chunk-P4RH4OSP.js +1038 -0
- package/dist/chunk-P6T66CCZ.js +226 -0
- package/dist/chunk-PBAHEPLQ.js +223 -0
- package/dist/chunk-PBHE5UG6.js +1530 -0
- package/dist/chunk-PDKUANDZ.js +35 -0
- package/dist/chunk-PWIHZ6NJ.js +296 -0
- package/dist/chunk-QEBUY5NY.js +1685 -0
- package/dist/chunk-QLCCJEJI.js +253 -0
- package/dist/chunk-QOOUC2J5.js +52 -0
- package/dist/chunk-QYTPPDAO.js +402 -0
- package/dist/chunk-R3XI2VC7.js +801 -0
- package/dist/chunk-RCERWOJR.js +154 -0
- package/dist/chunk-RJE5JTVK.js +362 -0
- package/dist/chunk-RTLBSQ3G.js +1155 -0
- package/dist/chunk-RUNNI6VE.js +448 -0
- package/dist/chunk-RVMRZAPB.js +354 -0
- package/dist/chunk-RYEGFMUO.js +955 -0
- package/dist/chunk-RZCF2VVM.js +528 -0
- package/dist/chunk-SML67VPV.js +1025 -0
- package/dist/chunk-SQ7IY53Q.js +44 -0
- package/dist/chunk-SQAG3UXH.js +161 -0
- package/dist/chunk-SRTU6HMQ.js +1851 -0
- package/dist/chunk-T2OE3YQB.js +550 -0
- package/dist/chunk-T3UBLACL.js +299 -0
- package/dist/chunk-TLVIHFRO.js +296 -0
- package/dist/chunk-TYS6CSS5.js +52 -0
- package/dist/chunk-U6EQI3U6.js +130 -0
- package/dist/chunk-UJ4FJLBF.js +86 -0
- package/dist/chunk-ULOEATBZ.js +347 -0
- package/dist/chunk-UNCCZ3NU.js +127 -0
- package/dist/chunk-USZW2HHU.js +197 -0
- package/dist/chunk-UWN33VNX.js +1610 -0
- package/dist/chunk-UZ7EZW3B.js +40 -0
- package/dist/chunk-VOKGH627.js +37 -0
- package/dist/chunk-WBRZJOEC.js +204 -0
- package/dist/chunk-WCSOJFU3.js +380 -0
- package/dist/chunk-WCT3NYCV.js +160 -0
- package/dist/chunk-WVAJFAIA.js +529 -0
- package/dist/chunk-X5LCYCL5.js +394 -0
- package/dist/chunk-XAKEUMEJ.js +1256 -0
- package/dist/chunk-Y2ZE3MSG.js +590 -0
- package/dist/chunk-Y3J7VR52.js +646 -0
- package/dist/chunk-Y5QGVTVC.js +33 -0
- package/dist/chunk-YAA6IID3.js +548 -0
- package/dist/chunk-YGJTDXVR.js +692 -0
- package/dist/chunk-YRYKTYMQ.js +186 -0
- package/dist/chunk-YYVTBZZC.js +61 -0
- package/dist/chunk-Z5CGSFJB.js +647 -0
- package/dist/chunk-Z72XRXD4.js +787 -0
- package/dist/chunk-ZGR7ULFJ.js +978 -0
- package/dist/chunk-ZJEL4H2R.js +851 -0
- package/dist/chunk-ZO27FGJS.js +554 -0
- package/dist/collapse-CLPJD2RL.js +11 -0
- package/dist/collapse-SLINJQW6.js +9 -0
- package/dist/collapse-ZWUFFCK2.js +9 -0
- package/dist/compute-G55RG53N.js +8 -0
- package/dist/dgmo-router-DZCIDUO5.js +73 -0
- package/dist/dimensions-J3FHIMJ6.js +22 -0
- package/dist/element.cjs +1 -1
- package/dist/element.js +1 -1
- package/dist/element.mjs +1 -1
- package/dist/flowchart-parser-ZNSKIBVR.js +21 -0
- package/dist/flowchart-renderer-ZAEOL4DX.js +35 -0
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +3 -469
- package/dist/index.d.ts +3 -469
- package/dist/index.js +137 -69685
- package/dist/layout-46N4JJYK.js +17 -0
- package/dist/layout-5RA6QWR6.js +26 -0
- package/dist/layout-5T6RH5M6.js +14 -0
- package/dist/layout-7QXCNOVS.js +13 -0
- package/dist/layout-EE6GE46Y.js +17 -0
- package/dist/layout-G23F7LDH.js +9 -0
- package/dist/layout-HRBZPFCN.js +23 -0
- package/dist/layout-HWDSRX5E.js +20 -0
- package/dist/layout-HYZPWAK5.js +18 -0
- package/dist/layout-N76NR4ZO.js +19 -0
- package/dist/layout-OB3RI63S.js +14 -0
- package/dist/layout-S2QBYSK2.js +15 -0
- package/dist/layout-UM5F4DJB.js +15 -0
- package/dist/layout-search-OYV77HHS.js +1655 -0
- package/dist/load-data-EHDDZ5ZS.js +8 -0
- package/dist/palettes-PRJ2RI6D.js +56 -0
- package/dist/parser-2MFP2H2E.js +11 -0
- package/dist/parser-3STE62GB.js +21 -0
- package/dist/parser-4FL2CMDG.js +18 -0
- package/dist/parser-4OGOBJJ4.js +13 -0
- package/dist/parser-6BTRLKRZ.js +15 -0
- package/dist/parser-AQETEVRW.js +21 -0
- package/dist/parser-CFZD5IBL.js +12 -0
- package/dist/parser-FUSKFGZN.js +16 -0
- package/dist/parser-I6KXEYFK.js +13 -0
- package/dist/parser-IXSZZQHY.js +18 -0
- package/dist/parser-JAL2HD4I.js +13 -0
- package/dist/parser-KNSQSKQO.js +20 -0
- package/dist/parser-N5O4IHUN.js +13 -0
- package/dist/parser-NGU3ETO6.js +16 -0
- package/dist/parser-NRAI6O25.js +19 -0
- package/dist/parser-O5J4VBII.js +11 -0
- package/dist/parser-OV7NOBW6.js +21 -0
- package/dist/parser-PQ3POX45.js +23 -0
- package/dist/parser-TFZFBVWN.js +11 -0
- package/dist/parser-TRTHDFPP.js +18 -0
- package/dist/parser-VQP2UJ6W.js +11 -0
- package/dist/parser-XDVELHRK.js +13 -0
- package/dist/parser-XKRP7QKP.js +11 -0
- package/dist/parser-Y6WTBU76.js +14 -0
- package/dist/parser-ZSDPZYQP.js +12 -0
- package/dist/renderer-2XQQQ6QR.js +28 -0
- package/dist/renderer-5NDVNDAZ.js +26 -0
- package/dist/renderer-6EEZHMH4.js +26 -0
- package/dist/renderer-6W5462RB.js +43 -0
- package/dist/renderer-7MVLWWQD.js +22 -0
- package/dist/renderer-AWWAF6XD.js +33 -0
- package/dist/renderer-BYCNMBF7.js +34 -0
- package/dist/renderer-CLJHQPBJ.js +29 -0
- package/dist/renderer-GHPZMFU2.js +15 -0
- package/dist/renderer-JGBKUCZD.js +16 -0
- package/dist/renderer-KQB7UGDS.js +19 -0
- package/dist/renderer-PGX2TKVS.js +24 -0
- package/dist/renderer-QIWVHWZO.js +15 -0
- package/dist/renderer-RPOA5YPZ.js +35 -0
- package/dist/renderer-SMIBCRVB.js +24 -0
- package/dist/renderer-T7YKC5VP.js +28 -0
- package/dist/renderer-TOCOVLHS.js +37 -0
- package/dist/renderer-UWA5XS74.js +39 -0
- package/dist/renderer-VACVQYML.js +25 -0
- package/dist/renderer-W4M6QLIJ.js +37 -0
- package/dist/renderer-WZRREQ2P.js +23 -0
- package/dist/renderer-YY2OSF6E.js +27 -0
- package/dist/renderer-Z7I3W2PP.js +24 -0
- package/dist/renderer-ZGNTUWC4.js +22 -0
- package/dist/renderer-ZTR3DER3.js +19 -0
- package/dist/renderer-radial-C32GPJQ7.js +21 -0
- package/dist/resolver-NOAA7ID7.js +13 -0
- package/dist/state-collapse-HCGD6IVJ.js +8 -0
- package/dist/state-parser-Z2V23ATR.js +18 -0
- package/dist/state-renderer-RFYHSP4K.js +34 -0
- package/dist/themes-1-CuKpeH.d.cts +908 -0
- package/dist/themes-1-CuKpeH.d.ts +908 -0
- package/package.json +1 -1
|
@@ -0,0 +1,732 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AUTO_TAG_COLOR_SENTINEL,
|
|
3
|
+
finalizeAutoTagColors,
|
|
4
|
+
isTagBlockHeading,
|
|
5
|
+
matchTagBlockHeading,
|
|
6
|
+
stripDefaultModifier,
|
|
7
|
+
validateTagGroupNames
|
|
8
|
+
} from "./chunk-QLCCJEJI.js";
|
|
9
|
+
import {
|
|
10
|
+
OPTION_NOCOLON_RE,
|
|
11
|
+
extractColor,
|
|
12
|
+
measureIndent,
|
|
13
|
+
parseFirstLine,
|
|
14
|
+
tryParseSharedOption
|
|
15
|
+
} from "./chunk-Y3J7VR52.js";
|
|
16
|
+
import {
|
|
17
|
+
formatDgmoError,
|
|
18
|
+
makeDgmoError
|
|
19
|
+
} from "./chunk-CXK4DZH3.js";
|
|
20
|
+
|
|
21
|
+
// src/wireframe/parser.ts
|
|
22
|
+
var KNOWN_OPTIONS = /* @__PURE__ */ new Set(["palette", "theme", "active-tag"]);
|
|
23
|
+
var GROUP_ONLY_METADATA = /* @__PURE__ */ new Set([
|
|
24
|
+
"horizontal",
|
|
25
|
+
"scrollable",
|
|
26
|
+
"collapsed"
|
|
27
|
+
]);
|
|
28
|
+
var STATE_KEYWORDS = /* @__PURE__ */ new Set([
|
|
29
|
+
"disabled",
|
|
30
|
+
"active",
|
|
31
|
+
"selected",
|
|
32
|
+
"empty",
|
|
33
|
+
"ghost",
|
|
34
|
+
"destructive",
|
|
35
|
+
"success",
|
|
36
|
+
"warning",
|
|
37
|
+
"info",
|
|
38
|
+
"scrollable",
|
|
39
|
+
"collapsed",
|
|
40
|
+
"toggle",
|
|
41
|
+
"password",
|
|
42
|
+
"textarea",
|
|
43
|
+
"horizontal",
|
|
44
|
+
"primary"
|
|
45
|
+
]);
|
|
46
|
+
var ELEMENT_KEYWORDS = {
|
|
47
|
+
nav: { block: true },
|
|
48
|
+
tabs: { block: true },
|
|
49
|
+
table: { block: true },
|
|
50
|
+
image: { block: false, params: /* @__PURE__ */ new Set(["round", "wide"]) },
|
|
51
|
+
modal: { block: true },
|
|
52
|
+
skeleton: { block: true },
|
|
53
|
+
alert: { block: true },
|
|
54
|
+
progress: { block: false },
|
|
55
|
+
chart: { block: false, params: /* @__PURE__ */ new Set(["line", "bar", "pie"]) }
|
|
56
|
+
};
|
|
57
|
+
var BRACKET_RE = /^\[([^\]]*)\](.*)$/;
|
|
58
|
+
var BUTTON_RE = /^\(([^)]+)\)(.*)$/;
|
|
59
|
+
var DROPDOWN_RE = /^\{([^}]+)\}(.*)$/;
|
|
60
|
+
var CHECKBOX_CHECKED_RE = /^<\s*x\s*>$/i;
|
|
61
|
+
var CHECKBOX_UNCHECKED_RE = /^<\s*>$/;
|
|
62
|
+
var RADIO_SELECTED_RE = /^\(\*\)\s+(.+)$/;
|
|
63
|
+
var RADIO_UNSELECTED_RE = /^\(\s*\)\s+(.+)$/;
|
|
64
|
+
var HEADING_RE = /^(#{1,2})\s+(.+)$/;
|
|
65
|
+
var DIVIDER_RE = /^-{3,}$/;
|
|
66
|
+
var LIST_ITEM_RE = /^-\s+(.+)$/;
|
|
67
|
+
var TABLE_SKELETON_RE = /^table\s+(\d+)x(\d+)$/i;
|
|
68
|
+
function genId(lineNumber, indent, suffix = "") {
|
|
69
|
+
return `wf-${lineNumber}-${indent}${suffix ? "-" + suffix : ""}`;
|
|
70
|
+
}
|
|
71
|
+
function resetWireframeIds() {
|
|
72
|
+
}
|
|
73
|
+
function makeElement(type, label, lineNumber, indent) {
|
|
74
|
+
return {
|
|
75
|
+
id: genId(lineNumber, indent),
|
|
76
|
+
type,
|
|
77
|
+
label,
|
|
78
|
+
children: [],
|
|
79
|
+
metadata: {},
|
|
80
|
+
states: [],
|
|
81
|
+
annotations: [],
|
|
82
|
+
lineNumber,
|
|
83
|
+
indent,
|
|
84
|
+
isContainer: false,
|
|
85
|
+
orientation: "vertical",
|
|
86
|
+
isSkeleton: false
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function peelTrailingFlags(label) {
|
|
90
|
+
const tokens = label.split(/\s+/).filter(Boolean);
|
|
91
|
+
const states = [];
|
|
92
|
+
while (tokens.length > 0) {
|
|
93
|
+
const last = tokens[tokens.length - 1];
|
|
94
|
+
if (last !== last.toLowerCase()) break;
|
|
95
|
+
if (!STATE_KEYWORDS.has(last)) break;
|
|
96
|
+
states.unshift(last);
|
|
97
|
+
tokens.pop();
|
|
98
|
+
}
|
|
99
|
+
return { label: tokens.join(" "), states };
|
|
100
|
+
}
|
|
101
|
+
function parseWireframeMetadata(raw) {
|
|
102
|
+
const states = [];
|
|
103
|
+
const annotations = [];
|
|
104
|
+
const metadata = {};
|
|
105
|
+
const parts = raw.split(",").map((s) => s.trim()).filter(Boolean);
|
|
106
|
+
for (const part of parts) {
|
|
107
|
+
const lower = part.toLowerCase();
|
|
108
|
+
if (STATE_KEYWORDS.has(lower)) {
|
|
109
|
+
states.push(lower);
|
|
110
|
+
} else if (part.includes(":")) {
|
|
111
|
+
const [key, ...rest] = part.split(":");
|
|
112
|
+
metadata[key.trim()] = rest.join(":").trim();
|
|
113
|
+
} else {
|
|
114
|
+
annotations.push(part);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return { states, annotations, metadata };
|
|
118
|
+
}
|
|
119
|
+
function applyTrailingMeta(el, rawTail) {
|
|
120
|
+
if (!rawTail) return;
|
|
121
|
+
const trimmed = rawTail.trim();
|
|
122
|
+
if (!trimmed) return;
|
|
123
|
+
if (trimmed.startsWith("|")) {
|
|
124
|
+
applyMetadata(el, trimmed.substring(1).trim());
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const tokens = trimmed.split(/\s+/);
|
|
128
|
+
if (tokens.every((t) => t === t.toLowerCase() && STATE_KEYWORDS.has(t))) {
|
|
129
|
+
applyMetadata(el, tokens.join(", "));
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
applyMetadata(el, trimmed);
|
|
133
|
+
}
|
|
134
|
+
function applyMetadata(el, metaStr) {
|
|
135
|
+
if (!metaStr) return;
|
|
136
|
+
const { states, annotations, metadata } = parseWireframeMetadata(metaStr);
|
|
137
|
+
el.states.push(...states);
|
|
138
|
+
el.annotations.push(...annotations);
|
|
139
|
+
Object.assign(el.metadata, metadata);
|
|
140
|
+
if (el.type === "textInput") {
|
|
141
|
+
if (states.includes("password")) el.fieldVariant = "password";
|
|
142
|
+
if (states.includes("textarea")) el.fieldVariant = "textarea";
|
|
143
|
+
}
|
|
144
|
+
for (const s of states) {
|
|
145
|
+
if (GROUP_ONLY_METADATA.has(s)) {
|
|
146
|
+
el.isContainer = true;
|
|
147
|
+
if (s === "horizontal") el.orientation = "horizontal";
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
function matchKeyword(segment) {
|
|
152
|
+
const words = segment.split(/\s+/);
|
|
153
|
+
const first = words[0].toLowerCase();
|
|
154
|
+
const kw = ELEMENT_KEYWORDS[first];
|
|
155
|
+
if (!kw) return null;
|
|
156
|
+
if (words.length === 1) {
|
|
157
|
+
return { keyword: first, type: first };
|
|
158
|
+
}
|
|
159
|
+
const rest = words.slice(1).join(" ");
|
|
160
|
+
if (first === "modal") {
|
|
161
|
+
return { keyword: first, type: "modal", param: rest };
|
|
162
|
+
}
|
|
163
|
+
if (first === "progress") {
|
|
164
|
+
const num = parseInt(rest, 10);
|
|
165
|
+
if (!isNaN(num)) {
|
|
166
|
+
return { keyword: first, type: "progress", param: rest };
|
|
167
|
+
}
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
if (first === "table") {
|
|
171
|
+
if (TABLE_SKELETON_RE.test(segment)) {
|
|
172
|
+
return { keyword: first, type: "table", param: rest };
|
|
173
|
+
}
|
|
174
|
+
return { keyword: first, type: "table" };
|
|
175
|
+
}
|
|
176
|
+
if (kw.params) {
|
|
177
|
+
if (kw.params.has(rest.toLowerCase())) {
|
|
178
|
+
return {
|
|
179
|
+
keyword: first,
|
|
180
|
+
type: first,
|
|
181
|
+
param: rest.toLowerCase()
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
function parseSegment(segment, lineNumber, indent, diagnostics) {
|
|
189
|
+
const trimmed = segment.trim();
|
|
190
|
+
if (!trimmed) return null;
|
|
191
|
+
const headingMatch = trimmed.match(HEADING_RE);
|
|
192
|
+
if (headingMatch) {
|
|
193
|
+
const level = headingMatch[1].length;
|
|
194
|
+
const el = makeElement(
|
|
195
|
+
"heading",
|
|
196
|
+
headingMatch[2].trim(),
|
|
197
|
+
lineNumber,
|
|
198
|
+
indent
|
|
199
|
+
);
|
|
200
|
+
el.headingLevel = level;
|
|
201
|
+
return el;
|
|
202
|
+
}
|
|
203
|
+
if (DIVIDER_RE.test(trimmed)) {
|
|
204
|
+
return makeElement("divider", "", lineNumber, indent);
|
|
205
|
+
}
|
|
206
|
+
if (CHECKBOX_CHECKED_RE.test(trimmed)) {
|
|
207
|
+
const el = makeElement("checkbox", "", lineNumber, indent);
|
|
208
|
+
el.checked = true;
|
|
209
|
+
return el;
|
|
210
|
+
}
|
|
211
|
+
if (CHECKBOX_UNCHECKED_RE.test(trimmed)) {
|
|
212
|
+
const el = makeElement("checkbox", "", lineNumber, indent);
|
|
213
|
+
el.checked = false;
|
|
214
|
+
return el;
|
|
215
|
+
}
|
|
216
|
+
const radioSelMatch = trimmed.match(RADIO_SELECTED_RE);
|
|
217
|
+
if (radioSelMatch) {
|
|
218
|
+
const el = makeElement(
|
|
219
|
+
"radio",
|
|
220
|
+
// In-bounds: regex has one capture group; matched group is defined.
|
|
221
|
+
radioSelMatch[1].trim(),
|
|
222
|
+
lineNumber,
|
|
223
|
+
indent
|
|
224
|
+
);
|
|
225
|
+
el.selected = true;
|
|
226
|
+
return el;
|
|
227
|
+
}
|
|
228
|
+
const radioUnselMatch = trimmed.match(RADIO_UNSELECTED_RE);
|
|
229
|
+
if (radioUnselMatch) {
|
|
230
|
+
const el = makeElement(
|
|
231
|
+
"radio",
|
|
232
|
+
// In-bounds: regex has one capture group; matched group is defined.
|
|
233
|
+
radioUnselMatch[1].trim(),
|
|
234
|
+
lineNumber,
|
|
235
|
+
indent
|
|
236
|
+
);
|
|
237
|
+
el.selected = false;
|
|
238
|
+
return el;
|
|
239
|
+
}
|
|
240
|
+
const checkLabelMatch = trimmed.match(/^(<\s*x?\s*>)\s+(.+)$/i);
|
|
241
|
+
if (checkLabelMatch) {
|
|
242
|
+
const isChecked = /x/i.test(checkLabelMatch[1]);
|
|
243
|
+
const labelPart = checkLabelMatch[2];
|
|
244
|
+
const pipeSplit = labelPart.split(/\s*\|\s*/);
|
|
245
|
+
const baseLabel = pipeSplit[0].trim();
|
|
246
|
+
const peeled = peelTrailingFlags(baseLabel);
|
|
247
|
+
const el = makeElement("checkbox", peeled.label, lineNumber, indent);
|
|
248
|
+
el.checked = isChecked;
|
|
249
|
+
if (peeled.states.length > 0) {
|
|
250
|
+
applyMetadata(el, peeled.states.join(", "));
|
|
251
|
+
}
|
|
252
|
+
if (pipeSplit.length > 1) {
|
|
253
|
+
applyMetadata(el, pipeSplit.slice(1).join(", "));
|
|
254
|
+
}
|
|
255
|
+
return el;
|
|
256
|
+
}
|
|
257
|
+
const dropdownMatch = trimmed.match(DROPDOWN_RE);
|
|
258
|
+
if (dropdownMatch) {
|
|
259
|
+
const options = dropdownMatch[1].split("|").map((s) => s.trim()).filter(Boolean);
|
|
260
|
+
const el = makeElement("dropdown", options[0] || "", lineNumber, indent);
|
|
261
|
+
el.options = options;
|
|
262
|
+
applyTrailingMeta(el, dropdownMatch[2]);
|
|
263
|
+
return el;
|
|
264
|
+
}
|
|
265
|
+
const parenPipeMatch = trimmed.match(/^\(([^)]*\|[^)]*)\)\s*$/);
|
|
266
|
+
if (parenPipeMatch) {
|
|
267
|
+
diagnostics.push(
|
|
268
|
+
makeDgmoError(
|
|
269
|
+
lineNumber,
|
|
270
|
+
// In-bounds: regex has one capture group; matched group is defined.
|
|
271
|
+
`Did you mean a dropdown? Use braces: {${parenPipeMatch[1]}} instead of (${parenPipeMatch[1]})`,
|
|
272
|
+
"warning"
|
|
273
|
+
)
|
|
274
|
+
);
|
|
275
|
+
const options = parenPipeMatch[1].split("|").map((s) => s.trim()).filter(Boolean);
|
|
276
|
+
const el = makeElement("dropdown", options[0] || "", lineNumber, indent);
|
|
277
|
+
el.options = options;
|
|
278
|
+
return el;
|
|
279
|
+
}
|
|
280
|
+
const buttonMatch = trimmed.match(BUTTON_RE);
|
|
281
|
+
if (buttonMatch) {
|
|
282
|
+
const el = makeElement(
|
|
283
|
+
"button",
|
|
284
|
+
buttonMatch[1].trim(),
|
|
285
|
+
lineNumber,
|
|
286
|
+
indent
|
|
287
|
+
);
|
|
288
|
+
applyTrailingMeta(el, buttonMatch[2]);
|
|
289
|
+
return el;
|
|
290
|
+
}
|
|
291
|
+
const bracketMatch = trimmed.match(BRACKET_RE);
|
|
292
|
+
if (bracketMatch) {
|
|
293
|
+
const el = makeElement(
|
|
294
|
+
"group",
|
|
295
|
+
bracketMatch[1].trim(),
|
|
296
|
+
lineNumber,
|
|
297
|
+
indent
|
|
298
|
+
);
|
|
299
|
+
applyTrailingMeta(el, bracketMatch[2]);
|
|
300
|
+
if (!el.isContainer) {
|
|
301
|
+
el.type = "textInput";
|
|
302
|
+
if (el.states.includes("password")) el.fieldVariant = "password";
|
|
303
|
+
if (el.states.includes("textarea")) el.fieldVariant = "textarea";
|
|
304
|
+
}
|
|
305
|
+
return el;
|
|
306
|
+
}
|
|
307
|
+
const listMatch = trimmed.match(LIST_ITEM_RE);
|
|
308
|
+
if (listMatch) {
|
|
309
|
+
return makeElement("listItem", listMatch[1].trim(), lineNumber, indent);
|
|
310
|
+
}
|
|
311
|
+
const kwMatch = matchKeyword(trimmed);
|
|
312
|
+
if (kwMatch) {
|
|
313
|
+
const el = makeElement(
|
|
314
|
+
kwMatch.type,
|
|
315
|
+
kwMatch.param || "",
|
|
316
|
+
lineNumber,
|
|
317
|
+
indent
|
|
318
|
+
);
|
|
319
|
+
if (kwMatch.type === "image") {
|
|
320
|
+
el.imageHint = kwMatch.param || "default";
|
|
321
|
+
} else if (kwMatch.type === "progress") {
|
|
322
|
+
const val = parseInt(kwMatch.param || "0", 10);
|
|
323
|
+
el.progressValue = Math.max(0, Math.min(100, isNaN(val) ? 0 : val));
|
|
324
|
+
} else if (kwMatch.type === "chart") {
|
|
325
|
+
el.chartHint = kwMatch.param || "line";
|
|
326
|
+
} else if (kwMatch.type === "table") {
|
|
327
|
+
const skelMatch = `table ${kwMatch.param || ""}`.match(TABLE_SKELETON_RE);
|
|
328
|
+
if (skelMatch) {
|
|
329
|
+
el.tableRows = parseInt(skelMatch[1], 10);
|
|
330
|
+
el.tableCols = parseInt(skelMatch[2], 10);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
if (ELEMENT_KEYWORDS[kwMatch.keyword]?.block) {
|
|
334
|
+
el.isContainer = true;
|
|
335
|
+
}
|
|
336
|
+
return el;
|
|
337
|
+
}
|
|
338
|
+
if (/^\[[^\]]*$/.test(trimmed)) {
|
|
339
|
+
diagnostics.push(
|
|
340
|
+
makeDgmoError(
|
|
341
|
+
lineNumber,
|
|
342
|
+
`Unmatched '[' \u2014 auto-closing bracket`,
|
|
343
|
+
"warning"
|
|
344
|
+
)
|
|
345
|
+
);
|
|
346
|
+
const label = trimmed.substring(1).trim();
|
|
347
|
+
return makeElement("textInput", label, lineNumber, indent);
|
|
348
|
+
}
|
|
349
|
+
if (/^\([^)]*$/.test(trimmed) && !trimmed.match(/^\(\s*\*?\s*\)/)) {
|
|
350
|
+
diagnostics.push(
|
|
351
|
+
makeDgmoError(
|
|
352
|
+
lineNumber,
|
|
353
|
+
`Unmatched '(' \u2014 auto-closing bracket`,
|
|
354
|
+
"warning"
|
|
355
|
+
)
|
|
356
|
+
);
|
|
357
|
+
const label = trimmed.substring(1).trim();
|
|
358
|
+
return makeElement("button", label, lineNumber, indent);
|
|
359
|
+
}
|
|
360
|
+
if (/^\{[^}]*$/.test(trimmed)) {
|
|
361
|
+
diagnostics.push(
|
|
362
|
+
makeDgmoError(
|
|
363
|
+
lineNumber,
|
|
364
|
+
`Unmatched '{' \u2014 auto-closing bracket`,
|
|
365
|
+
"warning"
|
|
366
|
+
)
|
|
367
|
+
);
|
|
368
|
+
const rawContent = trimmed.substring(1).trim();
|
|
369
|
+
const options = rawContent.split("|").map((s) => s.trim()).filter(Boolean);
|
|
370
|
+
const el = makeElement("dropdown", options[0] || "", lineNumber, indent);
|
|
371
|
+
el.options = options;
|
|
372
|
+
return el;
|
|
373
|
+
}
|
|
374
|
+
const pipeParts = trimmed.split(/\s*\|\s*/);
|
|
375
|
+
let textContent;
|
|
376
|
+
let states;
|
|
377
|
+
let metaStr;
|
|
378
|
+
if (pipeParts.length > 1) {
|
|
379
|
+
textContent = pipeParts[0].trim();
|
|
380
|
+
metaStr = pipeParts.slice(1).join(", ");
|
|
381
|
+
states = parseWireframeMetadata(metaStr).states;
|
|
382
|
+
} else {
|
|
383
|
+
const peeled = peelTrailingFlags(trimmed);
|
|
384
|
+
textContent = peeled.label;
|
|
385
|
+
states = peeled.states;
|
|
386
|
+
metaStr = states.length > 0 ? states.join(", ") : void 0;
|
|
387
|
+
}
|
|
388
|
+
const semanticStates = ["warning", "destructive", "success", "info"];
|
|
389
|
+
const hasSemantic = states.some((s) => semanticStates.includes(s));
|
|
390
|
+
if (hasSemantic) {
|
|
391
|
+
const el = makeElement("alert", textContent, lineNumber, indent);
|
|
392
|
+
el.states = states;
|
|
393
|
+
return el;
|
|
394
|
+
}
|
|
395
|
+
if (metaStr) {
|
|
396
|
+
const el = makeElement("text", textContent, lineNumber, indent);
|
|
397
|
+
applyMetadata(el, metaStr);
|
|
398
|
+
return el;
|
|
399
|
+
}
|
|
400
|
+
return makeElement("text", trimmed, lineNumber, indent);
|
|
401
|
+
}
|
|
402
|
+
function splitLineSegments(line) {
|
|
403
|
+
return line.split(/\s{2,}/).filter(Boolean);
|
|
404
|
+
}
|
|
405
|
+
function parseWireframe(content) {
|
|
406
|
+
resetWireframeIds();
|
|
407
|
+
const diagnostics = [];
|
|
408
|
+
const lines = content.split("\n");
|
|
409
|
+
let title = null;
|
|
410
|
+
let titleLineNumber = null;
|
|
411
|
+
let formFactor = "desktop";
|
|
412
|
+
const roots = [];
|
|
413
|
+
const modals = [];
|
|
414
|
+
const tagGroups = [];
|
|
415
|
+
const options = {};
|
|
416
|
+
let phase = "header";
|
|
417
|
+
let currentTagGroup = null;
|
|
418
|
+
function pushWarning(line, msg) {
|
|
419
|
+
diagnostics.push(makeDgmoError(line, msg, "warning"));
|
|
420
|
+
}
|
|
421
|
+
function makeTagGroup(trimmed, lineNumber) {
|
|
422
|
+
const match = matchTagBlockHeading(trimmed);
|
|
423
|
+
if (!match) return null;
|
|
424
|
+
return {
|
|
425
|
+
name: match.name,
|
|
426
|
+
...match.alias !== void 0 && { alias: match.alias },
|
|
427
|
+
entries: [],
|
|
428
|
+
lineNumber
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
const indentStack = [];
|
|
432
|
+
function findParent(indent) {
|
|
433
|
+
while (indentStack.length > 0 && // In-bounds by length-check guard above.
|
|
434
|
+
indentStack[indentStack.length - 1].indent >= indent) {
|
|
435
|
+
const popped = indentStack.pop();
|
|
436
|
+
if (popped.node.children.length > 0 && !popped.node.isContainer) {
|
|
437
|
+
popped.node.isContainer = true;
|
|
438
|
+
if (popped.node.type === "textInput") {
|
|
439
|
+
popped.node.type = "group";
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
return indentStack.length > 0 ? (
|
|
444
|
+
// In-bounds by length-check.
|
|
445
|
+
indentStack[indentStack.length - 1].node
|
|
446
|
+
) : null;
|
|
447
|
+
}
|
|
448
|
+
function pushElement(el) {
|
|
449
|
+
if (el.type === "modal") {
|
|
450
|
+
modals.push(el);
|
|
451
|
+
indentStack.push({ node: el, indent: el.indent });
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
findParent(el.indent);
|
|
455
|
+
if (indentStack.length === 0) {
|
|
456
|
+
roots.push(el);
|
|
457
|
+
} else {
|
|
458
|
+
const parent = indentStack[indentStack.length - 1].node;
|
|
459
|
+
parent.children.push(el);
|
|
460
|
+
if (parent.type === "skeleton" || parent.isSkeleton) {
|
|
461
|
+
el.isSkeleton = true;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
if (el.isContainer || el.type === "group" || el.type === "textInput" || // might become group if children follow
|
|
465
|
+
el.type === "nav" || el.type === "tabs" || el.type === "table" || el.type === "skeleton" || el.type === "alert") {
|
|
466
|
+
indentStack.push({ node: el, indent: el.indent });
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
function pushInlineRow(segments, lineNumber, indent, diags) {
|
|
470
|
+
const children = [];
|
|
471
|
+
let lastEl = null;
|
|
472
|
+
for (const seg of segments) {
|
|
473
|
+
if (seg.startsWith("|") && lastEl) {
|
|
474
|
+
applyMetadata(lastEl, seg.substring(1).trim());
|
|
475
|
+
continue;
|
|
476
|
+
}
|
|
477
|
+
const el = parseSegment(seg, lineNumber, indent, diags);
|
|
478
|
+
if (el) {
|
|
479
|
+
children.push(el);
|
|
480
|
+
lastEl = el;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
if (children.length === 0) return;
|
|
484
|
+
if (children.length === 1) {
|
|
485
|
+
pushElement(children[0]);
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
const wrapper = makeElement("group", "", lineNumber, indent);
|
|
489
|
+
wrapper.id = genId(lineNumber, indent, "row");
|
|
490
|
+
wrapper.isContainer = true;
|
|
491
|
+
wrapper.orientation = "horizontal";
|
|
492
|
+
wrapper.children = children;
|
|
493
|
+
const wrapperMetadata = { _inlineRow: "true" };
|
|
494
|
+
wrapper.metadata = wrapperMetadata;
|
|
495
|
+
pushElement(wrapper);
|
|
496
|
+
}
|
|
497
|
+
for (let i = 0; i < lines.length; i++) {
|
|
498
|
+
const line = lines[i];
|
|
499
|
+
const lineNumber = i + 1;
|
|
500
|
+
const trimmed = line.trim();
|
|
501
|
+
if (!trimmed || trimmed.startsWith("//")) continue;
|
|
502
|
+
const indent = measureIndent(line);
|
|
503
|
+
if (phase === "header") {
|
|
504
|
+
const firstLineResult = parseFirstLine(trimmed);
|
|
505
|
+
if (firstLineResult?.chartType === "wireframe") {
|
|
506
|
+
title = firstLineResult.title || null;
|
|
507
|
+
titleLineNumber = lineNumber;
|
|
508
|
+
continue;
|
|
509
|
+
}
|
|
510
|
+
if (trimmed === "mobile") {
|
|
511
|
+
formFactor = "mobile";
|
|
512
|
+
continue;
|
|
513
|
+
}
|
|
514
|
+
if (tryParseSharedOption(trimmed, options)) {
|
|
515
|
+
continue;
|
|
516
|
+
}
|
|
517
|
+
const optMatch = trimmed.match(OPTION_NOCOLON_RE);
|
|
518
|
+
if (optMatch && KNOWN_OPTIONS.has(optMatch[1].toLowerCase())) {
|
|
519
|
+
options[optMatch[1]] = optMatch[2] || "";
|
|
520
|
+
continue;
|
|
521
|
+
}
|
|
522
|
+
if (isTagBlockHeading(trimmed)) {
|
|
523
|
+
const tg = makeTagGroup(trimmed, lineNumber);
|
|
524
|
+
if (tg) {
|
|
525
|
+
currentTagGroup = tg;
|
|
526
|
+
tagGroups.push(tg);
|
|
527
|
+
phase = "tags";
|
|
528
|
+
continue;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
phase = "content";
|
|
532
|
+
}
|
|
533
|
+
if (phase === "tags") {
|
|
534
|
+
if (isTagBlockHeading(trimmed)) {
|
|
535
|
+
const tg = makeTagGroup(trimmed, lineNumber);
|
|
536
|
+
if (tg) {
|
|
537
|
+
currentTagGroup = tg;
|
|
538
|
+
tagGroups.push(tg);
|
|
539
|
+
continue;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
if (indent > 0 && currentTagGroup) {
|
|
543
|
+
const { text: cleanEntry, isDefault } = stripDefaultModifier(trimmed);
|
|
544
|
+
const { label, color } = extractColor(
|
|
545
|
+
cleanEntry,
|
|
546
|
+
void 0,
|
|
547
|
+
diagnostics,
|
|
548
|
+
lineNumber
|
|
549
|
+
);
|
|
550
|
+
currentTagGroup.entries.push({
|
|
551
|
+
value: label,
|
|
552
|
+
color: color ?? AUTO_TAG_COLOR_SENTINEL,
|
|
553
|
+
lineNumber
|
|
554
|
+
});
|
|
555
|
+
if (isDefault) {
|
|
556
|
+
currentTagGroup.defaultValue = label;
|
|
557
|
+
} else if (currentTagGroup.entries.length === 1) {
|
|
558
|
+
currentTagGroup.defaultValue = label;
|
|
559
|
+
}
|
|
560
|
+
continue;
|
|
561
|
+
}
|
|
562
|
+
phase = "content";
|
|
563
|
+
currentTagGroup = null;
|
|
564
|
+
}
|
|
565
|
+
if (phase !== "content") {
|
|
566
|
+
phase = "content";
|
|
567
|
+
}
|
|
568
|
+
if (indent === 0 && trimmed === "mobile") {
|
|
569
|
+
formFactor = "mobile";
|
|
570
|
+
continue;
|
|
571
|
+
}
|
|
572
|
+
if (indent === 0) {
|
|
573
|
+
const optMatch = trimmed.match(OPTION_NOCOLON_RE);
|
|
574
|
+
if (optMatch && !trimmed.startsWith("#") && !trimmed.startsWith("[") && !trimmed.startsWith("(")) {
|
|
575
|
+
const key = optMatch[1];
|
|
576
|
+
if (["palette", "theme", "active-tag"].includes(key)) {
|
|
577
|
+
options[key] = optMatch[2] || "";
|
|
578
|
+
continue;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
if (isTagBlockHeading(trimmed)) {
|
|
583
|
+
const tg = makeTagGroup(trimmed, lineNumber);
|
|
584
|
+
if (tg) {
|
|
585
|
+
currentTagGroup = tg;
|
|
586
|
+
tagGroups.push(tg);
|
|
587
|
+
phase = "tags";
|
|
588
|
+
continue;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
if (indentStack.length > 0) {
|
|
592
|
+
const topNode = indentStack[indentStack.length - 1].node;
|
|
593
|
+
if (topNode.type === "table" && indent > topNode.indent) {
|
|
594
|
+
const cells = parseTableRow(trimmed);
|
|
595
|
+
if (!topNode.tableHeaders) {
|
|
596
|
+
if (trimmed.includes(",")) {
|
|
597
|
+
topNode.tableHeaders = cells;
|
|
598
|
+
} else {
|
|
599
|
+
topNode.tableHeaders = cells;
|
|
600
|
+
}
|
|
601
|
+
} else {
|
|
602
|
+
if (!topNode.tableData) topNode.tableData = [];
|
|
603
|
+
topNode.tableData.push(cells);
|
|
604
|
+
}
|
|
605
|
+
continue;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
const segments = splitLineSegments(trimmed);
|
|
609
|
+
if (segments.length === 1) {
|
|
610
|
+
const el = parseSegment(segments[0], lineNumber, indent, diagnostics);
|
|
611
|
+
if (el) pushElement(el);
|
|
612
|
+
} else if (segments.length === 2) {
|
|
613
|
+
if (segments[1].startsWith("|")) {
|
|
614
|
+
const el = parseSegment(segments[0], lineNumber, indent, diagnostics);
|
|
615
|
+
if (el) {
|
|
616
|
+
applyMetadata(el, segments[1].substring(1).trim());
|
|
617
|
+
pushElement(el);
|
|
618
|
+
}
|
|
619
|
+
} else {
|
|
620
|
+
const firstIsBare = isBareText(segments[0]);
|
|
621
|
+
const secondIsElement = hasBracketMnemonic(segments[1]);
|
|
622
|
+
if (firstIsBare && secondIsElement) {
|
|
623
|
+
const fieldEl = parseSegment(
|
|
624
|
+
segments[1],
|
|
625
|
+
lineNumber,
|
|
626
|
+
indent,
|
|
627
|
+
diagnostics
|
|
628
|
+
);
|
|
629
|
+
if (fieldEl) {
|
|
630
|
+
const labelEl = makeElement(
|
|
631
|
+
"text",
|
|
632
|
+
segments[0].trim(),
|
|
633
|
+
lineNumber,
|
|
634
|
+
indent
|
|
635
|
+
);
|
|
636
|
+
labelEl.id = genId(lineNumber, indent, "lbl");
|
|
637
|
+
labelEl.labelFor = fieldEl;
|
|
638
|
+
const wrapper = makeElement("group", "", lineNumber, indent);
|
|
639
|
+
wrapper.id = genId(lineNumber, indent, "lf");
|
|
640
|
+
wrapper.isContainer = true;
|
|
641
|
+
wrapper.orientation = "horizontal";
|
|
642
|
+
wrapper.children.push(labelEl, fieldEl);
|
|
643
|
+
const wrapperMetadata = {
|
|
644
|
+
_labelField: "true"
|
|
645
|
+
};
|
|
646
|
+
wrapper.metadata = wrapperMetadata;
|
|
647
|
+
pushElement(wrapper);
|
|
648
|
+
}
|
|
649
|
+
} else {
|
|
650
|
+
pushInlineRow(segments, lineNumber, indent, diagnostics);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
} else {
|
|
654
|
+
pushInlineRow(segments, lineNumber, indent, diagnostics);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
while (indentStack.length > 0) {
|
|
658
|
+
const popped = indentStack.pop();
|
|
659
|
+
if (popped.node.children.length > 0 && !popped.node.isContainer) {
|
|
660
|
+
popped.node.isContainer = true;
|
|
661
|
+
if (popped.node.type === "textInput") {
|
|
662
|
+
popped.node.type = "group";
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
finalizeAutoTagColors(tagGroups);
|
|
667
|
+
validateTagGroupNames(tagGroups, pushWarning, (line, msg) => {
|
|
668
|
+
diagnostics.push(makeDgmoError(line, msg));
|
|
669
|
+
});
|
|
670
|
+
const error = diagnostics.find((d) => d.severity === "error") ? formatDgmoError(diagnostics.find((d) => d.severity === "error")) : null;
|
|
671
|
+
return {
|
|
672
|
+
title,
|
|
673
|
+
titleLineNumber,
|
|
674
|
+
formFactor,
|
|
675
|
+
roots,
|
|
676
|
+
modals,
|
|
677
|
+
tagGroups,
|
|
678
|
+
options,
|
|
679
|
+
diagnostics,
|
|
680
|
+
error
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
function parseTableRow(line) {
|
|
684
|
+
const cells = [];
|
|
685
|
+
let current = "";
|
|
686
|
+
let depth = 0;
|
|
687
|
+
let escaped = false;
|
|
688
|
+
for (let i = 0; i < line.length; i++) {
|
|
689
|
+
const ch = line[i];
|
|
690
|
+
if (escaped) {
|
|
691
|
+
current += ch;
|
|
692
|
+
escaped = false;
|
|
693
|
+
continue;
|
|
694
|
+
}
|
|
695
|
+
if (ch === "\\") {
|
|
696
|
+
escaped = true;
|
|
697
|
+
continue;
|
|
698
|
+
}
|
|
699
|
+
if (ch === "[" || ch === "{" || ch === "(" || ch === "<") depth++;
|
|
700
|
+
if (ch === "]" || ch === "}" || ch === ")" || ch === ">")
|
|
701
|
+
depth = Math.max(0, depth - 1);
|
|
702
|
+
if (ch === "," && depth === 0) {
|
|
703
|
+
cells.push(current.trim());
|
|
704
|
+
current = "";
|
|
705
|
+
continue;
|
|
706
|
+
}
|
|
707
|
+
current += ch;
|
|
708
|
+
}
|
|
709
|
+
if (current.trim()) {
|
|
710
|
+
cells.push(current.trim());
|
|
711
|
+
}
|
|
712
|
+
return cells;
|
|
713
|
+
}
|
|
714
|
+
function isBareText(segment) {
|
|
715
|
+
const s = segment.trim();
|
|
716
|
+
if (!s) return false;
|
|
717
|
+
if (/^[[\]({<#-]/.test(s)) return false;
|
|
718
|
+
if (matchKeyword(s)) return false;
|
|
719
|
+
return true;
|
|
720
|
+
}
|
|
721
|
+
function hasBracketMnemonic(segment) {
|
|
722
|
+
const s = segment.trim();
|
|
723
|
+
return /^\[/.test(s) || /^\(/.test(s) || /^\{/.test(s) || /^<\s*x?\s*>/i.test(s);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
export {
|
|
727
|
+
GROUP_ONLY_METADATA,
|
|
728
|
+
STATE_KEYWORDS,
|
|
729
|
+
resetWireframeIds,
|
|
730
|
+
parseWireframe
|
|
731
|
+
};
|
|
732
|
+
//# sourceMappingURL=chunk-EVCVDTXE.js.map
|