@cardenelabs/dragon 0.10.0 → 0.11.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.d.cts CHANGED
@@ -810,6 +810,14 @@ declare function parseTextDslV05(src: string): V05ParseResult;
810
810
  * 画面側も同じ関数を使う (#1028) = 別々に持つと、片方だけが読める本文ができる。
811
811
  */
812
812
  declare function stripQuotes(s: string): string;
813
+ /**
814
+ * 段に書ける項目の英語名。 `parsePhase` が受け付ける名前の入口でも使う。
815
+ *
816
+ * 誤りの案内で使うほか、**見本が値の名前にこの語を使っていないか** を見るのにも使う
817
+ * (#1330)。 段の項目と値は階層が違うので衝突しないが、同じ語が 2 つの意味で並ぶと
818
+ * 見本を読む人が階層から意味を判断することになる。
819
+ */
820
+ declare const PHASE_ITEM_WORDS: readonly ["focus", "badge", "body", "description", "tween", "set", "draw"];
813
821
  /**
814
822
  * `draw:` に書ける語と、その語が効く図種 (#1312 / #1314)。
815
823
  *
@@ -2024,4 +2032,4 @@ interface CompileOpts {
2024
2032
  */
2025
2033
  declare function textDslToDiagram(src: string, opts?: CompileOpts): CdlDiagram;
2026
2034
 
2027
- export { type AnchorBox, type CompileNotice, type CompileOpts, DIAGRAM_BOUNDARY_PADDING, DRAW_TARGETS, DRAW_WORDS, type DiagramBoundingBox, type DragonJson, type DslActor, type DslAnimate, type DslDocument, type DslError, type DslGroup, type DslLane, type DslPhase, type DslSet, type DslState, type DslStep, type DslTween, type DslValue, type DslViewport, type FocusEntry, type InputSize, JSONを分解する, type JsonActor, type JsonActorNodeOverride, type JsonAxes, type JsonDslError, type JsonPhase, type JsonStep, type LayoutMode, type LayoutPos, type LintIssue, type LintReport, type LintSeverity, MAX_INPUT_BYTES, MAX_INPUT_ELEMENTS, MAX_PART_SCALE, NODE_KIND_ALIAS, NODE_KIND_VALID, PRESET_TYPES, type PresetType, RELATIVE_GAP_DEFAULT, type RelativeDirection, type RelativePos, TONE_ALIAS, TOP_LEVEL_KEYS, autoFix, compileToCdl, computeDiagramBoundingBox, countBytes, countDiagramElements, countDocElements, describeOversize, describeOversizeSource, diagramJsonSchema, isColorValue, jsonToDiagram, lintDiagram, measureActorBoxes, normalizePartScale, orderByDependency, parseFocusEntry, parseRelativePos, parseTextDsl, parseTextDslV05, partBoxInFrame, partDrawsInDiagram, partIsMeasurable, partRenderSize, partScaleFactor, partTargetScale, partTargetSize, partVisualSize, partsGridCenters, pointsOutside, rectsOverlap, resolveRelativePos, stripExternalPaint, stripQuotes, textDslToDiagram, validateDragonJson, writeActorPosition, type トークン, type トークンの種類, 区間に広げる, 記法を分解する };
2035
+ export { type AnchorBox, type CompileNotice, type CompileOpts, DIAGRAM_BOUNDARY_PADDING, DRAW_TARGETS, DRAW_WORDS, type DiagramBoundingBox, type DragonJson, type DslActor, type DslAnimate, type DslDocument, type DslError, type DslGroup, type DslLane, type DslPhase, type DslSet, type DslState, type DslStep, type DslTween, type DslValue, type DslViewport, type FocusEntry, type InputSize, JSONを分解する, type JsonActor, type JsonActorNodeOverride, type JsonAxes, type JsonDslError, type JsonPhase, type JsonStep, type LayoutMode, type LayoutPos, type LintIssue, type LintReport, type LintSeverity, MAX_INPUT_BYTES, MAX_INPUT_ELEMENTS, MAX_PART_SCALE, NODE_KIND_ALIAS, NODE_KIND_VALID, PHASE_ITEM_WORDS, PRESET_TYPES, type PresetType, RELATIVE_GAP_DEFAULT, type RelativeDirection, type RelativePos, TONE_ALIAS, TOP_LEVEL_KEYS, autoFix, compileToCdl, computeDiagramBoundingBox, countBytes, countDiagramElements, countDocElements, describeOversize, describeOversizeSource, diagramJsonSchema, isColorValue, jsonToDiagram, lintDiagram, measureActorBoxes, normalizePartScale, orderByDependency, parseFocusEntry, parseRelativePos, parseTextDsl, parseTextDslV05, partBoxInFrame, partDrawsInDiagram, partIsMeasurable, partRenderSize, partScaleFactor, partTargetScale, partTargetSize, partVisualSize, partsGridCenters, pointsOutside, rectsOverlap, resolveRelativePos, stripExternalPaint, stripQuotes, textDslToDiagram, validateDragonJson, writeActorPosition, type トークン, type トークンの種類, 区間に広げる, 記法を分解する };
package/dist/index.d.ts CHANGED
@@ -810,6 +810,14 @@ declare function parseTextDslV05(src: string): V05ParseResult;
810
810
  * 画面側も同じ関数を使う (#1028) = 別々に持つと、片方だけが読める本文ができる。
811
811
  */
812
812
  declare function stripQuotes(s: string): string;
813
+ /**
814
+ * 段に書ける項目の英語名。 `parsePhase` が受け付ける名前の入口でも使う。
815
+ *
816
+ * 誤りの案内で使うほか、**見本が値の名前にこの語を使っていないか** を見るのにも使う
817
+ * (#1330)。 段の項目と値は階層が違うので衝突しないが、同じ語が 2 つの意味で並ぶと
818
+ * 見本を読む人が階層から意味を判断することになる。
819
+ */
820
+ declare const PHASE_ITEM_WORDS: readonly ["focus", "badge", "body", "description", "tween", "set", "draw"];
813
821
  /**
814
822
  * `draw:` に書ける語と、その語が効く図種 (#1312 / #1314)。
815
823
  *
@@ -2024,4 +2032,4 @@ interface CompileOpts {
2024
2032
  */
2025
2033
  declare function textDslToDiagram(src: string, opts?: CompileOpts): CdlDiagram;
2026
2034
 
2027
- export { type AnchorBox, type CompileNotice, type CompileOpts, DIAGRAM_BOUNDARY_PADDING, DRAW_TARGETS, DRAW_WORDS, type DiagramBoundingBox, type DragonJson, type DslActor, type DslAnimate, type DslDocument, type DslError, type DslGroup, type DslLane, type DslPhase, type DslSet, type DslState, type DslStep, type DslTween, type DslValue, type DslViewport, type FocusEntry, type InputSize, JSONを分解する, type JsonActor, type JsonActorNodeOverride, type JsonAxes, type JsonDslError, type JsonPhase, type JsonStep, type LayoutMode, type LayoutPos, type LintIssue, type LintReport, type LintSeverity, MAX_INPUT_BYTES, MAX_INPUT_ELEMENTS, MAX_PART_SCALE, NODE_KIND_ALIAS, NODE_KIND_VALID, PRESET_TYPES, type PresetType, RELATIVE_GAP_DEFAULT, type RelativeDirection, type RelativePos, TONE_ALIAS, TOP_LEVEL_KEYS, autoFix, compileToCdl, computeDiagramBoundingBox, countBytes, countDiagramElements, countDocElements, describeOversize, describeOversizeSource, diagramJsonSchema, isColorValue, jsonToDiagram, lintDiagram, measureActorBoxes, normalizePartScale, orderByDependency, parseFocusEntry, parseRelativePos, parseTextDsl, parseTextDslV05, partBoxInFrame, partDrawsInDiagram, partIsMeasurable, partRenderSize, partScaleFactor, partTargetScale, partTargetSize, partVisualSize, partsGridCenters, pointsOutside, rectsOverlap, resolveRelativePos, stripExternalPaint, stripQuotes, textDslToDiagram, validateDragonJson, writeActorPosition, type トークン, type トークンの種類, 区間に広げる, 記法を分解する };
2035
+ export { type AnchorBox, type CompileNotice, type CompileOpts, DIAGRAM_BOUNDARY_PADDING, DRAW_TARGETS, DRAW_WORDS, type DiagramBoundingBox, type DragonJson, type DslActor, type DslAnimate, type DslDocument, type DslError, type DslGroup, type DslLane, type DslPhase, type DslSet, type DslState, type DslStep, type DslTween, type DslValue, type DslViewport, type FocusEntry, type InputSize, JSONを分解する, type JsonActor, type JsonActorNodeOverride, type JsonAxes, type JsonDslError, type JsonPhase, type JsonStep, type LayoutMode, type LayoutPos, type LintIssue, type LintReport, type LintSeverity, MAX_INPUT_BYTES, MAX_INPUT_ELEMENTS, MAX_PART_SCALE, NODE_KIND_ALIAS, NODE_KIND_VALID, PHASE_ITEM_WORDS, PRESET_TYPES, type PresetType, RELATIVE_GAP_DEFAULT, type RelativeDirection, type RelativePos, TONE_ALIAS, TOP_LEVEL_KEYS, autoFix, compileToCdl, computeDiagramBoundingBox, countBytes, countDiagramElements, countDocElements, describeOversize, describeOversizeSource, diagramJsonSchema, isColorValue, jsonToDiagram, lintDiagram, measureActorBoxes, normalizePartScale, orderByDependency, parseFocusEntry, parseRelativePos, parseTextDsl, parseTextDslV05, partBoxInFrame, partDrawsInDiagram, partIsMeasurable, partRenderSize, partScaleFactor, partTargetScale, partTargetSize, partVisualSize, partsGridCenters, pointsOutside, rectsOverlap, resolveRelativePos, stripExternalPaint, stripQuotes, textDslToDiagram, validateDragonJson, writeActorPosition, type トークン, type トークンの種類, 区間に広げる, 記法を分解する };
package/dist/index.js CHANGED
@@ -2086,6 +2086,9 @@ function ensureAnimate(a, lineNo) {
2086
2086
  if (a) return a;
2087
2087
  return { states: [], phases: [], pos: { line: lineNo } };
2088
2088
  }
2089
+ var PHASE_ITEM_WORDS = ["focus", "badge", "body", "description", "tween", "set", "draw"];
2090
+ var \u6BB5\u306E\u9805\u76EE\u306E\u82F1\u8A9E = PHASE_ITEM_WORDS;
2091
+ var \u6BB5\u306E\u9805\u76EE\u306E\u96C6\u5408 = new Set(PHASE_ITEM_WORDS);
2089
2092
  function parsePhase(block, errors) {
2090
2093
  const head = block[0];
2091
2094
  const m = head.trimmed.match(/^step\s*:\s*(.+)$/);
@@ -2126,6 +2129,15 @@ function parsePhase(block, errors) {
2126
2129
  }
2127
2130
  const key = (propMatch[1] ?? "").toLowerCase();
2128
2131
  const value = (propMatch[2] ?? "").trim();
2132
+ if (!\u6BB5\u306E\u9805\u76EE\u306E\u96C6\u5408.has(key)) {
2133
+ errors.push({
2134
+ line: ln.no,
2135
+ message: `\u6BB5\u306E\u9805\u76EE\u540D\u304C\u8AAD\u3081\u307E\u305B\u3093: "${propMatch[1] ?? ""}"`,
2136
+ hint: \u6BB5\u306E\u9805\u76EE\u306E\u30D2\u30F3\u30C8(propMatch[1] ?? "")
2137
+ });
2138
+ i += 1;
2139
+ continue;
2140
+ }
2129
2141
  if (key === "focus") {
2130
2142
  phase.highlight = parseFocusList(value);
2131
2143
  i += 1;
@@ -2219,7 +2231,6 @@ function \u6BB5\u306E\u9805\u76EE\u306E\u30D2\u30F3\u30C8(\u66F8\u3044\u305F\u54
2219
2231
  const \u82F1\u8A9E = \u6BB5\u306E\u9805\u76EE\u306E\u65E5\u672C\u8A9E[\u66F8\u3044\u305F\u540D\u524D];
2220
2232
  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(", ")}`;
2221
2233
  }
2222
- var \u6BB5\u306E\u9805\u76EE\u306E\u82F1\u8A9E = ["focus", "badge", "body", "description", "tween", "set", "draw"];
2223
2234
  var DRAW_TARGETS = /* @__PURE__ */ new Map([
2224
2235
  ["line", "line"],
2225
2236
  ["bar", "bar"],
@@ -4983,7 +4994,7 @@ function compileTree(doc, onNotice) {
4983
4994
  const data = doc.actors.map((a) => {
4984
4995
  const id = slugify(a.name);
4985
4996
  const p3 = \u89AA.get(id);
4986
- return { id, title: a.name, ...p3 !== void 0 ? { parent: p3 } : {} };
4997
+ return { id, ...\u653E\u5C04\u306B\u51FA\u3059\u6587\u5B57(a), ...p3 !== void 0 ? { parent: p3 } : {} };
4987
4998
  });
4988
4999
  b.node(`${slugify(doc.title)}-chart`, {
4989
5000
  lane: "chart",
@@ -5248,7 +5259,7 @@ function \u653E\u5C04\u3067\u63CF\u3051\u306A\u3044\u6B04\u3092\u66F8\u3044\u305
5248
5259
  }
5249
5260
  function \u653E\u5C04\u306B\u51FA\u3059\u6587\u5B57(a) {
5250
5261
  const \u7D9A\u304D = [a.subtitle, a.value].map((x) => x?.trim()).filter((x) => !!x);
5251
- return \u7D9A\u304D.length > 0 ? `${a.name} ${\u7D9A\u304D.join(" ")}` : a.name;
5262
+ return { title: a.name, ...\u7D9A\u304D.length > 0 ? { subtitle: \u7D9A\u304D.join(" ") } : {} };
5252
5263
  }
5253
5264
  function compileMind(doc, onNotice) {
5254
5265
  const b = diagram(slugify(doc.title), { topic: doc.title });
@@ -5340,7 +5351,7 @@ function compileMind(doc, onNotice) {
5340
5351
  \u8A18\u9332\u3059\u308B(a);
5341
5352
  branches.push({
5342
5353
  id,
5343
- title: \u653E\u5C04\u306B\u51FA\u3059\u6587\u5B57(a),
5354
+ ...\u653E\u5C04\u306B\u51FA\u3059\u6587\u5B57(a),
5344
5355
  parent: \u89AA.get(id) ?? rootId,
5345
5356
  ...a.tone ? { tone: a.tone } : {}
5346
5357
  });
@@ -5361,7 +5372,15 @@ function compileMind(doc, onNotice) {
5361
5372
  ...\u56F3\u306E\u5C0F\u898B\u51FA\u3057(doc),
5362
5373
  w: W,
5363
5374
  h: H,
5364
- mindData: { rootId, rootTitle: \u653E\u5C04\u306B\u51FA\u3059\u6587\u5B57(root), branches }
5375
+ mindData: (() => {
5376
+ const \u4E2D\u5FC3 = \u653E\u5C04\u306B\u51FA\u3059\u6587\u5B57(root);
5377
+ return {
5378
+ rootId,
5379
+ rootTitle: \u4E2D\u5FC3.title,
5380
+ ...\u4E2D\u5FC3.subtitle === void 0 ? {} : { rootSubtitle: \u4E2D\u5FC3.subtitle },
5381
+ branches
5382
+ };
5383
+ })()
5365
5384
  });
5366
5385
  return b.build();
5367
5386
  }
@@ -8116,6 +8135,6 @@ function isV05Source(src) {
8116
8135
  return true;
8117
8136
  }
8118
8137
 
8119
- export { DIAGRAM_BOUNDARY_PADDING, DRAW_TARGETS, DRAW_WORDS, JSONを分解する, MAX_INPUT_BYTES, MAX_INPUT_ELEMENTS, MAX_PART_SCALE, NODE_KIND_ALIAS, NODE_KIND_VALID, PRESET_TYPES, RELATIVE_GAP_DEFAULT, TONE_ALIAS, TOP_LEVEL_KEYS, autoFix, compileToCdl, computeDiagramBoundingBox, countBytes, countDiagramElements, countDocElements, describeOversize, describeOversizeSource, diagramJsonSchema, isColorValue, jsonToDiagram, lintDiagram, measureActorBoxes, normalizePartScale, orderByDependency, parseFocusEntry, parseRelativePos, parseTextDsl, parseTextDslV05, partBoxInFrame, partDrawsInDiagram, partIsMeasurable, partRenderSize, partScaleFactor, partTargetScale, partTargetSize, partVisualSize, partsGridCenters, pointsOutside, rectsOverlap, resolveRelativePos, stripExternalPaint, stripQuotes, textDslToDiagram, validateDragonJson, writeActorPosition, 区間に広げる, 記法を分解する };
8138
+ export { DIAGRAM_BOUNDARY_PADDING, DRAW_TARGETS, DRAW_WORDS, JSONを分解する, MAX_INPUT_BYTES, MAX_INPUT_ELEMENTS, MAX_PART_SCALE, NODE_KIND_ALIAS, NODE_KIND_VALID, PHASE_ITEM_WORDS, PRESET_TYPES, RELATIVE_GAP_DEFAULT, TONE_ALIAS, TOP_LEVEL_KEYS, autoFix, compileToCdl, computeDiagramBoundingBox, countBytes, countDiagramElements, countDocElements, describeOversize, describeOversizeSource, diagramJsonSchema, isColorValue, jsonToDiagram, lintDiagram, measureActorBoxes, normalizePartScale, orderByDependency, parseFocusEntry, parseRelativePos, parseTextDsl, parseTextDslV05, partBoxInFrame, partDrawsInDiagram, partIsMeasurable, partRenderSize, partScaleFactor, partTargetScale, partTargetSize, partVisualSize, partsGridCenters, pointsOutside, rectsOverlap, resolveRelativePos, stripExternalPaint, stripQuotes, textDslToDiagram, validateDragonJson, writeActorPosition, 区間に広げる, 記法を分解する };
8120
8139
  //# sourceMappingURL=index.js.map
8121
8140
  //# sourceMappingURL=index.js.map