@cardenelabs/dragon 0.10.0 → 0.12.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/index.cjs +67 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +67 -21
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/compile.ts +23 -15
- package/src/index.ts +1 -1
- package/src/v05/parser.ts +79 -20
package/dist/index.cjs
CHANGED
|
@@ -1335,22 +1335,49 @@ function writtenScaleFields(inner) {
|
|
|
1335
1335
|
return out;
|
|
1336
1336
|
}
|
|
1337
1337
|
function splitInlineFields(inner) {
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1338
|
+
const \u5F15\u7528\u7B26\u3092\u898B\u3066\u5272\u308B = (\u898B\u308B) => {
|
|
1339
|
+
let depth = 0;
|
|
1340
|
+
let \u5F15\u7528\u7B26 = null;
|
|
1341
|
+
let \u76F4\u524D = null;
|
|
1342
|
+
let buf = "";
|
|
1343
|
+
const parts = [];
|
|
1344
|
+
for (let i = 0; i < inner.length; i += 1) {
|
|
1345
|
+
const c = inner[i];
|
|
1346
|
+
if (\u898B\u308B) {
|
|
1347
|
+
if (\u5F15\u7528\u7B26 !== null) {
|
|
1348
|
+
if (\u5F15\u7528\u7B26 === '"' && c === "\\" && i + 1 < inner.length) {
|
|
1349
|
+
buf += c;
|
|
1350
|
+
i += 1;
|
|
1351
|
+
buf += inner[i];
|
|
1352
|
+
continue;
|
|
1353
|
+
}
|
|
1354
|
+
if (c === \u5F15\u7528\u7B26) \u5F15\u7528\u7B26 = null;
|
|
1355
|
+
buf += c;
|
|
1356
|
+
continue;
|
|
1357
|
+
}
|
|
1358
|
+
if ((c === '"' || c === "'") && (\u76F4\u524D === null || ":,{[".includes(\u76F4\u524D))) {
|
|
1359
|
+
\u5F15\u7528\u7B26 = c;
|
|
1360
|
+
\u76F4\u524D = c;
|
|
1361
|
+
buf += c;
|
|
1362
|
+
continue;
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
if (c === "[" || c === "{") depth += 1;
|
|
1366
|
+
else if (c === "]" || c === "}") depth -= 1;
|
|
1367
|
+
if (c === "," && depth === 0) {
|
|
1368
|
+
parts.push(buf);
|
|
1369
|
+
buf = "";
|
|
1370
|
+
\u76F4\u524D = c;
|
|
1371
|
+
continue;
|
|
1372
|
+
}
|
|
1373
|
+
buf += c;
|
|
1374
|
+
if (c !== " " && c !== " ") \u76F4\u524D = c;
|
|
1349
1375
|
}
|
|
1350
|
-
buf
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1376
|
+
if (buf.trim()) parts.push(buf);
|
|
1377
|
+
return { parts, \u9589\u3058\u305F: \u5F15\u7528\u7B26 === null };
|
|
1378
|
+
};
|
|
1379
|
+
const \u898B\u305F = \u5F15\u7528\u7B26\u3092\u898B\u3066\u5272\u308B(true);
|
|
1380
|
+
return \u898B\u305F.\u9589\u3058\u305F ? \u898B\u305F.parts : \u5F15\u7528\u7B26\u3092\u898B\u3066\u5272\u308B(false).parts;
|
|
1354
1381
|
}
|
|
1355
1382
|
function collectIndentedList(lines, start, parentIndent) {
|
|
1356
1383
|
const items = [];
|
|
@@ -2088,6 +2115,9 @@ function ensureAnimate(a, lineNo) {
|
|
|
2088
2115
|
if (a) return a;
|
|
2089
2116
|
return { states: [], phases: [], pos: { line: lineNo } };
|
|
2090
2117
|
}
|
|
2118
|
+
var PHASE_ITEM_WORDS = ["focus", "badge", "body", "description", "tween", "set", "draw"];
|
|
2119
|
+
var \u6BB5\u306E\u9805\u76EE\u306E\u82F1\u8A9E = PHASE_ITEM_WORDS;
|
|
2120
|
+
var \u6BB5\u306E\u9805\u76EE\u306E\u96C6\u5408 = new Set(PHASE_ITEM_WORDS);
|
|
2091
2121
|
function parsePhase(block, errors) {
|
|
2092
2122
|
const head = block[0];
|
|
2093
2123
|
const m = head.trimmed.match(/^step\s*:\s*(.+)$/);
|
|
@@ -2128,6 +2158,15 @@ function parsePhase(block, errors) {
|
|
|
2128
2158
|
}
|
|
2129
2159
|
const key = (propMatch[1] ?? "").toLowerCase();
|
|
2130
2160
|
const value = (propMatch[2] ?? "").trim();
|
|
2161
|
+
if (!\u6BB5\u306E\u9805\u76EE\u306E\u96C6\u5408.has(key)) {
|
|
2162
|
+
errors.push({
|
|
2163
|
+
line: ln.no,
|
|
2164
|
+
message: `\u6BB5\u306E\u9805\u76EE\u540D\u304C\u8AAD\u3081\u307E\u305B\u3093: "${propMatch[1] ?? ""}"`,
|
|
2165
|
+
hint: \u6BB5\u306E\u9805\u76EE\u306E\u30D2\u30F3\u30C8(propMatch[1] ?? "")
|
|
2166
|
+
});
|
|
2167
|
+
i += 1;
|
|
2168
|
+
continue;
|
|
2169
|
+
}
|
|
2131
2170
|
if (key === "focus") {
|
|
2132
2171
|
phase.highlight = parseFocusList(value);
|
|
2133
2172
|
i += 1;
|
|
@@ -2221,7 +2260,6 @@ function \u6BB5\u306E\u9805\u76EE\u306E\u30D2\u30F3\u30C8(\u66F8\u3044\u305F\u54
|
|
|
2221
2260
|
const \u82F1\u8A9E = \u6BB5\u306E\u9805\u76EE\u306E\u65E5\u672C\u8A9E[\u66F8\u3044\u305F\u540D\u524D];
|
|
2222
2261
|
return \u82F1\u8A9E !== void 0 ? `v0.5 \u3067\u306F\u82F1\u8A9E\u3067\u66F8\u304F (\`${\u82F1\u8A9E}\`)` : `\u4F7F\u3048\u308B\u9805\u76EE = ${\u6BB5\u306E\u9805\u76EE\u306E\u82F1\u8A9E.join(", ")}`;
|
|
2223
2262
|
}
|
|
2224
|
-
var \u6BB5\u306E\u9805\u76EE\u306E\u82F1\u8A9E = ["focus", "badge", "body", "description", "tween", "set", "draw"];
|
|
2225
2263
|
var DRAW_TARGETS = /* @__PURE__ */ new Map([
|
|
2226
2264
|
["line", "line"],
|
|
2227
2265
|
["bar", "bar"],
|
|
@@ -4985,7 +5023,7 @@ function compileTree(doc, onNotice) {
|
|
|
4985
5023
|
const data = doc.actors.map((a) => {
|
|
4986
5024
|
const id = slugify(a.name);
|
|
4987
5025
|
const p3 = \u89AA.get(id);
|
|
4988
|
-
return { id,
|
|
5026
|
+
return { id, ...\u653E\u5C04\u306B\u51FA\u3059\u6587\u5B57(a), ...p3 !== void 0 ? { parent: p3 } : {} };
|
|
4989
5027
|
});
|
|
4990
5028
|
b.node(`${slugify(doc.title)}-chart`, {
|
|
4991
5029
|
lane: "chart",
|
|
@@ -5250,7 +5288,7 @@ function \u653E\u5C04\u3067\u63CF\u3051\u306A\u3044\u6B04\u3092\u66F8\u3044\u305
|
|
|
5250
5288
|
}
|
|
5251
5289
|
function \u653E\u5C04\u306B\u51FA\u3059\u6587\u5B57(a) {
|
|
5252
5290
|
const \u7D9A\u304D = [a.subtitle, a.value].map((x) => x?.trim()).filter((x) => !!x);
|
|
5253
|
-
return
|
|
5291
|
+
return { title: a.name, ...\u7D9A\u304D.length > 0 ? { subtitle: \u7D9A\u304D.join(" ") } : {} };
|
|
5254
5292
|
}
|
|
5255
5293
|
function compileMind(doc, onNotice) {
|
|
5256
5294
|
const b = cdl.diagram(slugify(doc.title), { topic: doc.title });
|
|
@@ -5342,7 +5380,7 @@ function compileMind(doc, onNotice) {
|
|
|
5342
5380
|
\u8A18\u9332\u3059\u308B(a);
|
|
5343
5381
|
branches.push({
|
|
5344
5382
|
id,
|
|
5345
|
-
|
|
5383
|
+
...\u653E\u5C04\u306B\u51FA\u3059\u6587\u5B57(a),
|
|
5346
5384
|
parent: \u89AA.get(id) ?? rootId,
|
|
5347
5385
|
...a.tone ? { tone: a.tone } : {}
|
|
5348
5386
|
});
|
|
@@ -5363,7 +5401,15 @@ function compileMind(doc, onNotice) {
|
|
|
5363
5401
|
...\u56F3\u306E\u5C0F\u898B\u51FA\u3057(doc),
|
|
5364
5402
|
w: W,
|
|
5365
5403
|
h: H,
|
|
5366
|
-
mindData:
|
|
5404
|
+
mindData: (() => {
|
|
5405
|
+
const \u4E2D\u5FC3 = \u653E\u5C04\u306B\u51FA\u3059\u6587\u5B57(root);
|
|
5406
|
+
return {
|
|
5407
|
+
rootId,
|
|
5408
|
+
rootTitle: \u4E2D\u5FC3.title,
|
|
5409
|
+
...\u4E2D\u5FC3.subtitle === void 0 ? {} : { rootSubtitle: \u4E2D\u5FC3.subtitle },
|
|
5410
|
+
branches
|
|
5411
|
+
};
|
|
5412
|
+
})()
|
|
5367
5413
|
});
|
|
5368
5414
|
return b.build();
|
|
5369
5415
|
}
|
|
@@ -8127,6 +8173,7 @@ exports.MAX_INPUT_ELEMENTS = MAX_INPUT_ELEMENTS;
|
|
|
8127
8173
|
exports.MAX_PART_SCALE = MAX_PART_SCALE;
|
|
8128
8174
|
exports.NODE_KIND_ALIAS = NODE_KIND_ALIAS;
|
|
8129
8175
|
exports.NODE_KIND_VALID = NODE_KIND_VALID;
|
|
8176
|
+
exports.PHASE_ITEM_WORDS = PHASE_ITEM_WORDS;
|
|
8130
8177
|
exports.PRESET_TYPES = PRESET_TYPES;
|
|
8131
8178
|
exports.RELATIVE_GAP_DEFAULT = RELATIVE_GAP_DEFAULT;
|
|
8132
8179
|
exports.TONE_ALIAS = TONE_ALIAS;
|