@cardenelabs/dragon 0.45.3 → 0.46.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/cli.cjs +97 -104
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +97 -104
- package/dist/cli.js.map +1 -1
- package/dist/export.cjs +91 -104
- package/dist/export.cjs.map +1 -1
- package/dist/export.js +91 -104
- package/dist/export.js.map +1 -1
- package/dist/index.cjs +55 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +55 -62
- package/dist/index.js.map +1 -1
- package/dist/light/chunk-CLS6JVKK.cjs.map +1 -1
- package/dist/light/{chunk-EHTQUCW4.js → chunk-DVGDEPCV.js} +6 -2
- package/dist/light/chunk-DVGDEPCV.js.map +1 -0
- package/dist/light/{chunk-5OQV42W3.cjs → chunk-SUL4AJLI.cjs} +6 -2
- package/dist/light/chunk-SUL4AJLI.cjs.map +1 -0
- package/dist/light/{chunk-JCEKXALJ.cjs → chunk-V34DCH34.cjs} +90 -87
- package/dist/light/chunk-V34DCH34.cjs.map +1 -0
- package/dist/light/{chunk-YEQSLVIN.js → chunk-YO3UBEC3.js} +12 -9
- package/dist/light/chunk-YO3UBEC3.js.map +1 -0
- package/dist/light/{git-K3KAAAWW.cjs → git-WBGFDRBD.cjs} +59 -59
- package/dist/light/git-WBGFDRBD.cjs.map +1 -0
- package/dist/light/{git-GESUYKGR.js → git-WEJL6VAY.js} +3 -3
- package/dist/light/index.cjs +358 -372
- package/dist/light/index.cjs.map +1 -1
- package/dist/light/index.js +43 -57
- package/dist/light/index.js.map +1 -1
- package/dist/light/{lineup-2V2U7HZH.js → lineup-6LN6Z5T2.js} +3 -3
- package/dist/light/{lineup-623J25LU.cjs → lineup-WLGNGTFX.cjs} +40 -40
- package/dist/light/lineup-WLGNGTFX.cjs.map +1 -0
- package/dist/light/{state-T4OTVING.js → state-DFYTMQI7.js} +2 -2
- package/dist/light/{state-OZVCHX7H.cjs → state-JVAH4TSM.cjs} +41 -41
- package/dist/light/state-JVAH4TSM.cjs.map +1 -0
- package/dist/light/{time-PQCPVQOE.cjs → time-EXRPI34B.cjs} +90 -88
- package/dist/light/time-EXRPI34B.cjs.map +1 -0
- package/dist/light/{time-6WEMD4FQ.js → time-M3EGEFDU.js} +10 -8
- package/dist/light/{time-6WEMD4FQ.js.map → time-M3EGEFDU.js.map} +1 -1
- package/dist/light/{tree-6D7KI57H.cjs → tree-DECHTXFU.cjs} +62 -62
- package/dist/light/tree-DECHTXFU.cjs.map +1 -0
- package/dist/light/{tree-ZJZQI5QT.js → tree-MFU54QKY.js} +3 -3
- package/dist/node.cjs +27 -48
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +27 -48
- package/dist/node.js.map +1 -1
- package/dist/player.global.js +3 -3
- package/package.json +1 -1
- package/src/look/values.ts +5 -1
- package/src/messages.ts +4 -1
- package/src/parser.ts +4 -2
- package/src/render/draw.ts +2 -1
- package/src/render/parts.ts +28 -7
- package/src/render/time.ts +13 -6
- package/src/schema.ts +6 -0
- package/src/schemas/diagram.schema.json +3 -2
- package/src/schemas/validate-diagram.js +1 -1
- package/dist/light/chunk-5OQV42W3.cjs.map +0 -1
- package/dist/light/chunk-EHTQUCW4.js.map +0 -1
- package/dist/light/chunk-JCEKXALJ.cjs.map +0 -1
- package/dist/light/chunk-YEQSLVIN.js.map +0 -1
- package/dist/light/git-K3KAAAWW.cjs.map +0 -1
- package/dist/light/lineup-623J25LU.cjs.map +0 -1
- package/dist/light/state-OZVCHX7H.cjs.map +0 -1
- package/dist/light/time-PQCPVQOE.cjs.map +0 -1
- package/dist/light/tree-6D7KI57H.cjs.map +0 -1
- /package/dist/light/{git-GESUYKGR.js.map → git-WEJL6VAY.js.map} +0 -0
- /package/dist/light/{lineup-2V2U7HZH.js.map → lineup-6LN6Z5T2.js.map} +0 -0
- /package/dist/light/{state-T4OTVING.js.map → state-DFYTMQI7.js.map} +0 -0
- /package/dist/light/{tree-ZJZQI5QT.js.map → tree-MFU54QKY.js.map} +0 -0
package/package.json
CHANGED
package/src/look/values.ts
CHANGED
|
@@ -149,7 +149,11 @@ export const LOOK = {
|
|
|
149
149
|
gap: 10,
|
|
150
150
|
/** 図の外周の余白 */
|
|
151
151
|
margin: 14,
|
|
152
|
-
|
|
152
|
+
/**
|
|
153
|
+
* 箱。`iconY` と `nameY` と `subY` は箱の真ん中から絵柄の真ん中と名前と下の字の基準線まで。
|
|
154
|
+
* `nameMid` と `subMid` はアイコンも置き場の枠も持つ箱が無い図の名前と下の字の基準線で、名前を箱の真ん中に置き、下の字を名前から `subY - nameY` と同じ間で置く (#3307、#3309)
|
|
155
|
+
*/
|
|
156
|
+
box: { h: 72, minW: 92, padX: 12, radius: 12, icon: 24, iconRadius: 7, iconY: -16, iconScale: 0.74, nameY: 12, nameMid: 5, subY: 27, subMid: 20 },
|
|
153
157
|
region: { pad: 18, gap: 10, radius: 14, inset: 14, icon: 24, iconRadius: 7, iconScale: 0.68, nameY: 58, line: 16, minH: 108 },
|
|
154
158
|
architecture: { columns: 4, columnGap: 56, maxColumnGap: 160, rowGap: 44, labelRoom: 16 },
|
|
155
159
|
/**
|
package/src/messages.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* 記法の語は英語だけで file から言葉が決まらないため、誤りの文は呼ぶ側が渡した言葉
|
|
5
5
|
* (渡さなければ日本語) で出す。文の中の記法の語は語の表から引き、表と文で語が食い違わないようにする。
|
|
6
6
|
*/
|
|
7
|
-
import { COLORS } from "./schema";
|
|
7
|
+
import { COLORS, ICON_NAMES } from "./schema";
|
|
8
8
|
import { CARRIES, DURATION_UNITS, HEADS, KINDS, type NotationLang, SIDES, SPAN_SHAPES, VIEWS } from "./words";
|
|
9
9
|
|
|
10
10
|
/** 新しい形のどの行の書き方を示すか。前の形の行に当たった時に、誤りの文が書き方を示す */
|
|
@@ -57,6 +57,7 @@ export interface Messages {
|
|
|
57
57
|
attrTwice: (key: string) => string;
|
|
58
58
|
badAttr: (key: string, allowed: readonly string[]) => string;
|
|
59
59
|
badColor: string;
|
|
60
|
+
badIcon: string;
|
|
60
61
|
badView: string;
|
|
61
62
|
badCarry: string;
|
|
62
63
|
badSide: string;
|
|
@@ -223,6 +224,7 @@ const ja = (): Messages => {
|
|
|
223
224
|
attrTwice: (key) => `${key} は 1 つの行に 1 つまで`,
|
|
224
225
|
badAttr: (key, allowed) => `${key} はこの行に書けない属性。書けるのは ${list(allowed)}`,
|
|
225
226
|
badColor: `color は ${list(COLORS)} のどれか`,
|
|
227
|
+
badIcon: `icon は ${list(ICON_NAMES)} のどれか`,
|
|
226
228
|
badView: `view は ${list(VIEWS)} のどれか`,
|
|
227
229
|
badCarry: `carry は ${list(CARRIES)} のどれか。札は tag: <値> で書く`,
|
|
228
230
|
badSide: `side は ${list(SIDES)} のどれか`,
|
|
@@ -362,6 +364,7 @@ const en = (): Messages => {
|
|
|
362
364
|
attrTwice: (key) => `Write ${key} only once on a line`,
|
|
363
365
|
badAttr: (key, allowed) => `${key} cannot be written on this line. Write ${list(allowed)}`,
|
|
364
366
|
badColor: `color is one of ${list(COLORS)}`,
|
|
367
|
+
badIcon: `icon is one of ${list(ICON_NAMES)}`,
|
|
365
368
|
badView: `view is one of ${list(VIEWS)}`,
|
|
366
369
|
badCarry: `carry is one of ${list(CARRIES)}. Write a tag as tag: <value>`,
|
|
367
370
|
badSide: `side is one of ${list(SIDES)}`,
|
package/src/parser.ts
CHANGED
|
@@ -73,6 +73,7 @@ import {
|
|
|
73
73
|
type DiagramEvent,
|
|
74
74
|
type GitBranch,
|
|
75
75
|
type GitCommit,
|
|
76
|
+
ICON_NAMES,
|
|
76
77
|
type LabelSide,
|
|
77
78
|
type LineupItem,
|
|
78
79
|
type Region,
|
|
@@ -324,12 +325,13 @@ function readDeclared(source: SourceLine, word: string, allowed: readonly string
|
|
|
324
325
|
function lookOf(source: SourceLine, attrs: Map<string, Attr>, m: Messages): { note?: string; color?: Color; icon?: string } {
|
|
325
326
|
const color = attrs.get("color");
|
|
326
327
|
if (color && !isOneOf(COLORS, color.value)) throw fail(source, color.at, m.badColor);
|
|
328
|
+
const icon = attrs.get("icon");
|
|
329
|
+
if (icon && !ICON_NAMES.includes(icon.value)) throw fail(source, icon.at, m.badIcon);
|
|
327
330
|
const note = attrs.get("note")?.value;
|
|
328
|
-
const icon = attrs.get("icon")?.value;
|
|
329
331
|
return {
|
|
330
332
|
...(note !== undefined ? { note } : {}),
|
|
331
333
|
...(color ? { color: color.value as Color } : {}),
|
|
332
|
-
...(icon
|
|
334
|
+
...(icon ? { icon: icon.value } : {}),
|
|
333
335
|
};
|
|
334
336
|
}
|
|
335
337
|
|
package/src/render/draw.ts
CHANGED
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
action,
|
|
28
28
|
badge,
|
|
29
29
|
band,
|
|
30
|
+
boxTextY,
|
|
30
31
|
card,
|
|
31
32
|
carrier,
|
|
32
33
|
type Ctx,
|
|
@@ -371,7 +372,7 @@ export function drawSvg(diagram: Diagram, layout: Layout, timeline: Timeline, pa
|
|
|
371
372
|
const vars = paletteVars(palette, theme);
|
|
372
373
|
const id = nameOf(`${JSON.stringify(diagram)}|${vars}|${follow ? `${follow.width}|${follow.lang}` : ""}`);
|
|
373
374
|
const m = new Motion(`dg${id}`, timeline.total, timeline.last);
|
|
374
|
-
const ctx: Ctx = { m, t: timeline, id, sh: `filter="url(#dg-sh-${id})"`, end: (timeline.steps[timeline.steps.length - 1] as Span).end, ink, traces };
|
|
375
|
+
const ctx: Ctx = { m, t: timeline, id, sh: `filter="url(#dg-sh-${id})"`, end: (timeline.steps[timeline.steps.length - 1] as Span).end, ink, traces, boxText: boxTextY(layout.boxes) };
|
|
375
376
|
const on = involved(diagram);
|
|
376
377
|
// 時系列図の処理は生存線の上の札に出し、他の図の種類は箱の下の字に出す
|
|
377
378
|
const subs = subChanges(diagram, timeline, layout.kind !== "sequence");
|
package/src/render/parts.ts
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
markText,
|
|
12
12
|
type Point,
|
|
13
13
|
pathLength,
|
|
14
|
+
type Rect,
|
|
14
15
|
type SceneAction,
|
|
15
16
|
type SceneBadge,
|
|
16
17
|
type SceneBox,
|
|
@@ -38,7 +39,7 @@ const r1 =(v: number): number => Math.round(v * 100) / 100;
|
|
|
38
39
|
export const cs = (k: ColorKey): string => (k === "coin" ? "--c:var(--coin);--ct:var(--coint)" : `--c:var(--c-${k});--ct:var(--t-${k})`);
|
|
39
40
|
|
|
40
41
|
export function glyph(name: string | undefined, x: number, y: number, scale: number, cls = "dg-gl"): string {
|
|
41
|
-
const d = name
|
|
42
|
+
const d = name !== undefined && drawsIcon(name) ? ICONS[name] : undefined;
|
|
42
43
|
return d ? `<path class="${cls}" transform="translate(${r1(x)} ${r1(y)}) scale(${scale})" d="${d}"/>` : "";
|
|
43
44
|
}
|
|
44
45
|
|
|
@@ -97,8 +98,28 @@ export interface Ctx {
|
|
|
97
98
|
ink: Ink[];
|
|
98
99
|
/** 描いた線の記録 (#3175)。札を持たない字を横切る線を数える */
|
|
99
100
|
traces: Trace[];
|
|
101
|
+
/** 箱の名前と下の字の基準線を、箱の真ん中からどれだけ下げるか (`boxTextY`) */
|
|
102
|
+
boxText: BoxTextY;
|
|
100
103
|
}
|
|
101
104
|
|
|
105
|
+
/** 箱の名前 (`name`) と下の字 (`sub`) の基準線の、箱の真ん中からの下がり */
|
|
106
|
+
export interface BoxTextY {
|
|
107
|
+
name: number;
|
|
108
|
+
sub: number;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** 絵柄を描ける名前か。`ICONS` の継いだ鍵 (`constructor` など) は描けない名前に数える */
|
|
112
|
+
export const drawsIcon = (name: string | undefined): boolean => name !== undefined && Object.hasOwn(ICONS, name);
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* 図の箱の名前と下の字の基準線を、箱の真ん中からどれだけ下げるか (#3307)。
|
|
116
|
+
* 名前の上の段 (アイコンか置き場の枠) を使う箱が 1 つでもある図は、その段の下に名前を置く高さで全ての箱の名前を揃える。
|
|
117
|
+
* 1 つも無い図は名前を箱の真ん中に置く。置き場の枠はアイコンの無い箱にも同じ段に出るので、真ん中に寄せると名前が枠に重なる。
|
|
118
|
+
* 下の字は名前から同じ間を空けて置き、名前を真ん中に上げた図で下の字だけが下の縁に残らないようにする (#3309)
|
|
119
|
+
*/
|
|
120
|
+
export const boxTextY = (boxes: readonly { icon?: string; slot?: Rect }[]): BoxTextY =>
|
|
121
|
+
boxes.some((b) => drawsIcon(b.icon) || b.slot !== undefined) ? { name: LOOK.box.nameY, sub: LOOK.box.subY } : { name: LOOK.box.nameMid, sub: LOOK.box.subMid };
|
|
122
|
+
|
|
102
123
|
/** 和文を含む字の、和文の字で描く時の字の形 */
|
|
103
124
|
export const sansOf = (t: TextStyle): TextStyle => ({ ...t, family: "sans" });
|
|
104
125
|
|
|
@@ -136,7 +157,7 @@ export function band(region: SceneRegion, ink: Ink[]): string {
|
|
|
136
157
|
const { x, y } = region.header;
|
|
137
158
|
const lines = region.lines.map((t, k) => write(ink, "dg-bz", x, region.y + nameY + k * line, t, TYPE.regionName)).join("");
|
|
138
159
|
const note = region.note ? write(ink, "dg-bx", x, region.y + nameY + region.lines.length * line + 1, region.note, TYPE.regionNote) : "";
|
|
139
|
-
const mark = region.icon
|
|
160
|
+
const mark = drawsIcon(region.icon) ? `<rect class="dg-bi" x="${r1(x)}" y="${r1(y)}" width="${icon}" height="${icon}" rx="${iconRadius}"/>${glyph(region.icon, x + icon / 2, y + icon / 2, iconScale)}` : "";
|
|
140
161
|
return `<g style="${cs(region.color)}"><rect class="dg-band" x="${r1(region.x + 0.5)}" y="${r1(region.y + 0.5)}" width="${r1(region.w - 1)}" height="${r1(region.h - 1)}" rx="${radius}"/>${mark}${lines}${note}</g>`;
|
|
141
162
|
}
|
|
142
163
|
|
|
@@ -173,21 +194,21 @@ function cardFrame(box: SceneBox, ctx: Ctx, act: string | undefined, y: number,
|
|
|
173
194
|
* `lit` を渡すと、動く段ではなくその間だけ光らせる (状態遷移図の、運ぶ物が乗っている状態)。
|
|
174
195
|
*/
|
|
175
196
|
export function card(box: SceneBox, ctx: Ctx, on: number[], changes: SubChange[], lit?: Span[]): string {
|
|
176
|
-
const { icon, iconRadius, iconScale, iconY
|
|
177
|
-
const subs = subLines(box, ctx.m, changes, box.cy +
|
|
197
|
+
const { icon, iconRadius, iconScale, iconY } = LOOK.box;
|
|
198
|
+
const subs = subLines(box, ctx.m, changes, box.cy + ctx.boxText.sub, ctx.ink);
|
|
178
199
|
const act = lit ? (lit.length > 0 ? rangeKf(ctx.m, lit.map((s) => [s.start, s.end])) : undefined) : on.length > 0 ? activeKf(ctx, on) : undefined;
|
|
179
200
|
// 置き場を持つ箱は絵柄を左へ寄せ、右に点線の枠を初めから見せる (#3176)
|
|
180
201
|
const ix = box.iconX ?? box.cx;
|
|
181
202
|
const slot = box.slot ? `<rect class="dg-slot" x="${r1(box.slot.x)}" y="${r1(box.slot.y)}" width="${r1(box.slot.w)}" height="${r1(box.slot.h)}" rx="${LOOK.slot.radius}"/>` : "";
|
|
182
203
|
let mark = "";
|
|
183
|
-
if (box.icon
|
|
204
|
+
if (drawsIcon(box.icon)) {
|
|
184
205
|
const rect = { x: ix - icon / 2, y: box.cy + iconY - icon / 2, w: icon, h: icon };
|
|
185
206
|
ctx.ink.push({ text: `${box.name} の絵柄`, rect, shown: ALWAYS, boxed: true, part: { kind: "icon", box: box.name } });
|
|
186
207
|
mark = `<rect class="dg-ic" x="${r1(rect.x)}" y="${r1(rect.y)}" width="${icon}" height="${icon}" rx="${iconRadius}"/>${glyph(box.icon, ix, box.cy + iconY, iconScale)}`;
|
|
187
208
|
}
|
|
188
209
|
return (
|
|
189
210
|
`<g style="${cs(box.color)}">${cardFrame(box, ctx, act, box.y, box.h)}` +
|
|
190
|
-
`${slot}${mark}${write(ctx.ink, "dg-sn", box.cx, box.cy +
|
|
211
|
+
`${slot}${mark}${write(ctx.ink, "dg-sn", box.cx, box.cy + ctx.boxText.name, box.name, TYPE.boxName, ALWAYS, "middle")}${subs}</g>`
|
|
191
212
|
);
|
|
192
213
|
}
|
|
193
214
|
|
|
@@ -208,7 +229,7 @@ export function ghostCard(box: SceneBox, ink: Ink[]): string {
|
|
|
208
229
|
const G = LOOK.state.ghost;
|
|
209
230
|
const ix = box.x + G.pad + icon / 2;
|
|
210
231
|
const tx = box.x + G.pad + icon + G.gap;
|
|
211
|
-
const mark = box.icon
|
|
232
|
+
const mark = drawsIcon(box.icon) ? `<rect class="dg-ic" x="${r1(ix - icon / 2)}" y="${r1(box.cy - icon / 2)}" width="${icon}" height="${icon}" rx="${iconRadius}"/>${glyph(box.icon, ix, box.cy, iconScale)}` : "";
|
|
212
233
|
const nameY = box.sub ? G.nameY : LOOK.baseline.mark;
|
|
213
234
|
const sub = box.sub ? write(ink, "dg-ss", tx, box.cy + G.subY, box.sub, TYPE.boxSub, ALWAYS, "start") : "";
|
|
214
235
|
return (
|
package/src/render/time.ts
CHANGED
|
@@ -266,17 +266,24 @@ export function meterField(field: { x: number; y: number; meter: { line: number;
|
|
|
266
266
|
);
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
-
/**
|
|
269
|
+
/**
|
|
270
|
+
* 時間軸の図で、寄って追う窓が段の終わりに見せる所。印の列を必ず入れ、段の番号と段で動く物を窓に収まる間だけ足す。
|
|
271
|
+
* 針を動かす段は針も必ず入れる。針を動かさない段は段の番号の丸を起点にする。針の所に窓が残ると、離れた節目で起きたことが読めないため (#3284)
|
|
272
|
+
*/
|
|
270
273
|
export function timeFocus(layout: TimeLayout, timeline: Timeline, step: number, parts: { x: number; y: number; w: number; h: number }[], vw: number, vh: number): { x: number; y: number; w: number; h: number } {
|
|
271
274
|
const span = timeline.steps[step] as Span;
|
|
272
275
|
const position = valueAt(timeline.needle ?? [], span.end - MOTION.still);
|
|
273
|
-
const
|
|
276
|
+
const badge = layout.badges.find((b) => b.step === step);
|
|
277
|
+
// 値の表の中の丸は窓の外に出すので、起点にしない
|
|
278
|
+
const anchored = badge && valueAt(timeline.needle ?? [], span.start) === position && !(layout.strip && badge.y >= layout.strip.y);
|
|
279
|
+
const ax = anchored ? badge.x : layout.axis.x + position * layout.axis.unit;
|
|
274
280
|
const top = Math.min(...layout.rows.map((r) => r.y));
|
|
275
281
|
const bottom = Math.max(...layout.rows.map((r) => r.y + r.h));
|
|
276
|
-
let held = { x:
|
|
277
|
-
const
|
|
278
|
-
|
|
279
|
-
const
|
|
282
|
+
let held = { x: ax - 1, y: top, w: 2, h: bottom - top };
|
|
283
|
+
const near = (p: { x: number; y: number; w: number; h: number }): number => Math.hypot(Math.max(0, p.x - ax, ax - p.x - p.w), Math.max(0, p.y - top, top - p.y - p.h));
|
|
284
|
+
// 札が変わる節目も段で動く物に数える。節目は頭の箱でないので、図全体の動く物の一覧に入っていない
|
|
285
|
+
const changed = layout.points.filter((point) => point.changes.some((change) => change.step === step)).map((point) => ({ x: point.cx - point.r, y: point.cy - point.r, w: point.text.x + point.text.w - point.cx + point.r, h: point.r * 2 }));
|
|
286
|
+
const extra = [...(badge ? [{ x: badge.x - LOOK.badge.r, y: badge.y - LOOK.badge.r, w: LOOK.badge.r * 2, h: LOOK.badge.r * 2 }] : []), ...[...parts, ...changed].sort((a, b) => near(a) - near(b))];
|
|
280
287
|
for (const p of extra) {
|
|
281
288
|
const x = Math.min(held.x, p.x);
|
|
282
289
|
const y = Math.min(held.y, p.y);
|
package/src/schema.ts
CHANGED
|
@@ -11,12 +11,18 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import type { ErrorObject } from "ajv";
|
|
13
13
|
import { type Allowed, FIELD_MESSAGES, type FieldMessages, type Forbidden } from "./field-messages";
|
|
14
|
+
import { ICONS } from "./render/icons";
|
|
14
15
|
import validate from "./schemas/validate-diagram.js";
|
|
15
16
|
import { type NotationLang, STATE_ENDS } from "./words";
|
|
16
17
|
|
|
17
18
|
export type Color = "blue" | "amber" | "green" | "violet" | "rose" | "slate" | "coin";
|
|
18
19
|
/** 色の役の一覧。記法の `color:` に書ける値と、誤りの文に並べる値 */
|
|
19
20
|
export const COLORS: readonly Color[] = ["blue", "amber", "green", "violet", "rose", "slate", "coin"];
|
|
21
|
+
/**
|
|
22
|
+
* アイコン名の一覧。記法の `icon:` に書ける値と、誤りの文に並べる値 (#3311)。
|
|
23
|
+
* 描く部品のアイコンの表から引く。書き間違えた名前は何も描かれず、名前の高さ (#3307) まで変わるため、読む所で断る
|
|
24
|
+
*/
|
|
25
|
+
export const ICON_NAMES: readonly string[] = Object.keys(ICONS);
|
|
20
26
|
|
|
21
27
|
export interface Region {
|
|
22
28
|
id: string;
|
|
@@ -220,6 +220,7 @@
|
|
|
220
220
|
},
|
|
221
221
|
"id": { "type": "string", "pattern": "^[^\\s\\[\\]「」=:]+$" },
|
|
222
222
|
"color": { "enum": ["blue", "amber", "green", "violet", "rose", "slate", "coin"] },
|
|
223
|
+
"icon": { "description": "箱と区画のアイコン名。描く部品のアイコンの表 (ICONS) に在る名前だけ", "enum": ["app", "router", "on", "off", "pool", "db", "exe", "idx", "sign", "env", "lock", "check", "flag", "x", "chain", "net", "user", "server", "key", "shield", "globe", "bolt", "doc", "box", "truck", "card", "cart", "clock", "branch", "cloud", "refresh", "undo", "yen", "layers", "code", "paint", "tree", "block"] },
|
|
223
224
|
"region": {
|
|
224
225
|
"type": "object",
|
|
225
226
|
"additionalProperties": false,
|
|
@@ -229,7 +230,7 @@
|
|
|
229
230
|
"name": { "$ref": "#/definitions/text" },
|
|
230
231
|
"note": { "$ref": "#/definitions/text" },
|
|
231
232
|
"color": { "$ref": "#/definitions/color" },
|
|
232
|
-
"icon": { "$ref": "#/definitions/
|
|
233
|
+
"icon": { "$ref": "#/definitions/icon" }
|
|
233
234
|
}
|
|
234
235
|
},
|
|
235
236
|
"box": {
|
|
@@ -241,7 +242,7 @@
|
|
|
241
242
|
"name": { "$ref": "#/definitions/text" },
|
|
242
243
|
"sub": { "$ref": "#/definitions/text" },
|
|
243
244
|
"color": { "$ref": "#/definitions/color" },
|
|
244
|
-
"icon": { "$ref": "#/definitions/
|
|
245
|
+
"icon": { "$ref": "#/definitions/icon" },
|
|
245
246
|
"region": { "$ref": "#/definitions/id" },
|
|
246
247
|
"link": { "description": "飛び先。描いた図ではこの箱がここへの link になる", "$ref": "#/definitions/url" }
|
|
247
248
|
}
|