@cardenelabs/dragon 0.45.5 → 0.46.1
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/README.ja.md +331 -0
- package/README.md +200 -188
- package/dist/cli.cjs +148 -111
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +148 -111
- package/dist/cli.js.map +1 -1
- package/dist/export.cjs +139 -109
- package/dist/export.cjs.map +1 -1
- package/dist/export.js +139 -109
- package/dist/export.js.map +1 -1
- package/dist/index.cjs +99 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +99 -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 +407 -375
- package/dist/light/index.cjs.map +1 -1
- package/dist/light/index.js +92 -60
- 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-KVMZIKYF.cjs → time-EXRPI34B.cjs} +84 -84
- package/dist/light/time-EXRPI34B.cjs.map +1 -0
- package/dist/light/{time-O4CMTUV5.js → time-M3EGEFDU.js} +3 -3
- 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 +115 -49
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +115 -49
- package/dist/node.js.map +1 -1
- package/dist/player.global.js +3 -3
- package/package.json +1 -1
- package/src/field-messages.ts +4 -0
- package/src/look/values.ts +5 -1
- package/src/messages.ts +11 -1
- package/src/nearest.ts +37 -0
- package/src/parser.ts +4 -2
- package/src/render/draw.ts +2 -1
- package/src/render/parts.ts +28 -7
- package/src/schema.ts +27 -3
- 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-KVMZIKYF.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/{time-O4CMTUV5.js.map → time-M3EGEFDU.js.map} +0 -0
- /package/dist/light/{tree-ZJZQI5QT.js.map → tree-MFU54QKY.js.map} +0 -0
package/dist/cli.cjs
CHANGED
|
@@ -325,7 +325,11 @@ var LOOK = {
|
|
|
325
325
|
gap: 10,
|
|
326
326
|
/** 図の外周の余白 */
|
|
327
327
|
margin: 14,
|
|
328
|
-
|
|
328
|
+
/**
|
|
329
|
+
* 箱。`iconY` と `nameY` と `subY` は箱の真ん中から絵柄の真ん中と名前と下の字の基準線まで。
|
|
330
|
+
* `nameMid` と `subMid` はアイコンも置き場の枠も持つ箱が無い図の名前と下の字の基準線で、名前を箱の真ん中に置き、下の字を名前から `subY - nameY` と同じ間で置く (#3307、#3309)
|
|
331
|
+
*/
|
|
332
|
+
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 },
|
|
329
333
|
region: { pad: 18, gap: 10, radius: 14, inset: 14, icon: 24, iconRadius: 7, iconScale: 0.68, nameY: 58, line: 16, minH: 108 },
|
|
330
334
|
architecture: { columns: 4, columnGap: 56, maxColumnGap: 160, rowGap: 44, labelRoom: 16 },
|
|
331
335
|
/**
|
|
@@ -837,8 +841,8 @@ function longest(points) {
|
|
|
837
841
|
}
|
|
838
842
|
return { a: best.a, b: best.b, vertical: Math.abs(best.b[0] - best.a[0]) < Math.abs(best.b[1] - best.a[1]) };
|
|
839
843
|
}
|
|
840
|
-
function along(points,
|
|
841
|
-
let left =
|
|
844
|
+
function along(points, distance2) {
|
|
845
|
+
let left = distance2;
|
|
842
846
|
for (let i = 1; i < points.length; i++) {
|
|
843
847
|
const a = points[i - 1];
|
|
844
848
|
const b = points[i];
|
|
@@ -1671,6 +1675,7 @@ var ja = {
|
|
|
1671
1675
|
additionalProperties: (key) => `${key} \u3068\u3044\u3046\u6B04\u306F\u66F8\u3051\u306A\u3044`,
|
|
1672
1676
|
required: (key) => `${key} \u306E\u6B04\u304C\u8981\u308B`,
|
|
1673
1677
|
enum: (values) => `${values.join(" / ")} \u306E\u3069\u308C\u304B\u306B\u3059\u308B`,
|
|
1678
|
+
unknownIcon: (value, near) => `${value} \u3068\u3044\u3046 icon \u306F\u7121\u3044\u3002\u8FD1\u3044\u540D\u524D\u306F ${near}`,
|
|
1674
1679
|
type: (type) => TYPES_JA[type] ?? `${type} \u306B\u3059\u308B`,
|
|
1675
1680
|
minLength: (limit) => `${limit} \u5B57\u4EE5\u4E0A\u66F8\u304F`,
|
|
1676
1681
|
maxLength: (limit) => `${limit} \u5B57\u307E\u3067\u306B\u3059\u308B`,
|
|
@@ -1695,6 +1700,7 @@ var en = {
|
|
|
1695
1700
|
additionalProperties: (key) => `The ${key} field is not allowed`,
|
|
1696
1701
|
required: (key) => `The ${key} field is required`,
|
|
1697
1702
|
enum: (values) => `Use one of ${values.join(" / ")}`,
|
|
1703
|
+
unknownIcon: (value, near) => `There is no icon named ${value}. The closest is ${near}`,
|
|
1698
1704
|
type: (type) => TYPES_EN[type] ?? `Use ${type}`,
|
|
1699
1705
|
minLength: (limit) => `Write at least ${plural(limit, "character")}`,
|
|
1700
1706
|
maxLength: (limit) => `Write at most ${plural(limit, "character")}`,
|
|
@@ -1717,6 +1723,75 @@ var en = {
|
|
|
1717
1723
|
};
|
|
1718
1724
|
var FIELD_MESSAGES = { ja, en };
|
|
1719
1725
|
|
|
1726
|
+
// src/nearest.ts
|
|
1727
|
+
var MAX_DISTANCE = 2;
|
|
1728
|
+
function nearest(word, candidates) {
|
|
1729
|
+
const written = [...word.toLowerCase()];
|
|
1730
|
+
let limit = Math.min(MAX_DISTANCE, written.length - 1);
|
|
1731
|
+
let best;
|
|
1732
|
+
for (const candidate of candidates) {
|
|
1733
|
+
const d = distance(written, [...candidate.toLowerCase()]);
|
|
1734
|
+
if (d > limit) continue;
|
|
1735
|
+
best = candidate;
|
|
1736
|
+
limit = d - 1;
|
|
1737
|
+
}
|
|
1738
|
+
return best;
|
|
1739
|
+
}
|
|
1740
|
+
function distance(a, b) {
|
|
1741
|
+
let previous = Array.from({ length: b.length + 1 }, (_, j) => j);
|
|
1742
|
+
for (let i = 1; i <= a.length; i++) {
|
|
1743
|
+
const current = [i];
|
|
1744
|
+
for (let j = 1; j <= b.length; j++) {
|
|
1745
|
+
const replace = previous[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1);
|
|
1746
|
+
current.push(Math.min(previous[j] + 1, current[j - 1] + 1, replace));
|
|
1747
|
+
}
|
|
1748
|
+
previous = current;
|
|
1749
|
+
}
|
|
1750
|
+
return previous[b.length];
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
// src/render/icons.ts
|
|
1754
|
+
var ICONS = {
|
|
1755
|
+
app: "M -9 -7 h18 a2 2 0 0 1 2 2 v10 a2 2 0 0 1 -2 2 h-18 a2 2 0 0 1 -2 -2 v-10 a2 2 0 0 1 2 -2 z M -11 -2 h22",
|
|
1756
|
+
router: "M -9 -4 h16 M 3 -8 l4 4 l-4 4 M 9 5 h-16 M -3 1 l-4 4 l4 4",
|
|
1757
|
+
on: "M -7 7 L 7 -7 M -1 -7 h8 v8",
|
|
1758
|
+
off: "M -7 -7 L 7 7 M 7 -1 v8 h-8",
|
|
1759
|
+
pool: "M -9 -5 a9 3.5 0 1 0 18 0 a9 3.5 0 1 0 -18 0 M -9 -5 v10 a9 3.5 0 0 0 18 0 v-10 M -9 0 a9 3.5 0 0 0 18 0",
|
|
1760
|
+
db: "M -9 -5 a9 3.5 0 1 0 18 0 a9 3.5 0 1 0 -18 0 M -9 -5 v10 a9 3.5 0 0 0 18 0 v-10 M -9 0 a9 3.5 0 0 0 18 0",
|
|
1761
|
+
exe: "M -5 -8 L 7 0 L -5 8 Z",
|
|
1762
|
+
idx: "M -9 -7 h18 M -9 -2 h18 M -9 3 h18 M -9 8 h11",
|
|
1763
|
+
sign: "M -9 4 c 3 -9 5 -9 6 0 s 3 7 6 -2 s 3 -6 6 0",
|
|
1764
|
+
env: "M -8 -5.5 h16 v11 h-16 z M -8 -5.5 l8 6 l8 -6",
|
|
1765
|
+
lock: "M -5.5 -1 h11 v8 h-11 z M -3.5 -1 v-3 a3.5 3.5 0 0 1 7 0 v3",
|
|
1766
|
+
check: "M -5 0 l3.5 3.5 l6.5 -7",
|
|
1767
|
+
flag: "M -4 8 V -8 M -4 -7 H 6 L 3.5 -3.5 L 6 0 H -4",
|
|
1768
|
+
x: "M -5 -5 l10 10 M 5 -5 l-10 10",
|
|
1769
|
+
chain: "M -1.5 4.5 l-2 2 a3.5 3.5 0 0 1 -5 -5 l3 -3 a3.5 3.5 0 0 1 5 0 M 1.5 -4.5 l2 -2 a3.5 3.5 0 0 1 5 5 l-3 3 a3.5 3.5 0 0 1 -5 0 M -2.5 2.5 l5 -5",
|
|
1770
|
+
net: "M -1.3 -4.6 L -5.8 3 M 1.3 -4.6 L 5.8 3 M -4.3 5.5 H 4.3 M -2.2 -7 a 2.2 2.2 0 1 0 4.4 0 a 2.2 2.2 0 1 0 -4.4 0 M -9.2 5.5 a 2.2 2.2 0 1 0 4.4 0 a 2.2 2.2 0 1 0 -4.4 0 M 4.8 5.5 a 2.2 2.2 0 1 0 4.4 0 a 2.2 2.2 0 1 0 -4.4 0",
|
|
1771
|
+
user: "M -4 -4.5 a4 4 0 1 0 8 0 a4 4 0 1 0 -8 0 M -8 9 c0 -5 3.6 -7.5 8 -7.5 s8 2.5 8 7.5",
|
|
1772
|
+
server: "M -9 -8 h18 v7 h-18 z M -9 1 h18 v7 h-18 z M -5 -4.5 h0.01 M -5 4.5 h0.01",
|
|
1773
|
+
key: "M -9 0 a3.5 3.5 0 1 0 7 0 a3.5 3.5 0 1 0 -7 0 M -2 0 h10 M 5 0 v3.5 M 8 0 v2.5",
|
|
1774
|
+
shield: "M 0 -9 l8 3 v5 c0 5 -3.5 8 -8 10 c-4.5 -2 -8 -5 -8 -10 v-5 z",
|
|
1775
|
+
globe: "M -9 0 a9 9 0 1 0 18 0 a9 9 0 1 0 -18 0 M -9 0 h18 M 0 -9 c-4.5 4 -4.5 14 0 18 M 0 -9 c4.5 4 4.5 14 0 18",
|
|
1776
|
+
bolt: "M 2 -9 L -5 1 h5 l-2 8 l7 -10 h-5 z",
|
|
1777
|
+
doc: "M -6 -9 h8 l5 5 v13 h-13 z M 2 -9 v5 h5 M -3 1 h7 M -3 5 h5",
|
|
1778
|
+
box: "M -9 -4.5 l9 -4.5 l9 4.5 v9 l-9 4.5 l-9 -4.5 z M -9 -4.5 l9 4.5 l9 -4.5 M 0 0 v9",
|
|
1779
|
+
truck: "M -10 -6 h11 v10 h-11 z M 1 -2 h5 l3.5 3.5 v2.5 h-8.5 M -7.5 6.5 a1.8 1.8 0 1 0 3.6 0 a1.8 1.8 0 1 0 -3.6 0 M 3 6.5 a1.8 1.8 0 1 0 3.6 0 a1.8 1.8 0 1 0 -3.6 0",
|
|
1780
|
+
card: "M -9 -6.5 h18 a2 2 0 0 1 2 2 v9 a2 2 0 0 1 -2 2 h-18 a2 2 0 0 1 -2 -2 v-9 a2 2 0 0 1 2 -2 z M -11 -2 h22 M -7 3 h5",
|
|
1781
|
+
cart: "M -10 -8 h3 l3 11 h11 l2.5 -8 h-15.5 M -4.5 7.5 a1.5 1.5 0 1 0 3 0 a1.5 1.5 0 1 0 -3 0 M 5 7.5 a1.5 1.5 0 1 0 3 0 a1.5 1.5 0 1 0 -3 0",
|
|
1782
|
+
clock: "M -9 0 a9 9 0 1 0 18 0 a9 9 0 1 0 -18 0 M 0 -5 v5 l3.5 2.5",
|
|
1783
|
+
branch: "M -4 -4.5 v9 M 5 0.5 c0 4 -9 3 -9 6.5 M -6.2 -7 a2.2 2.2 0 1 0 4.4 0 a2.2 2.2 0 1 0 -4.4 0 M -6.2 7 a2.2 2.2 0 1 0 4.4 0 a2.2 2.2 0 1 0 -4.4 0 M 2.8 -2 a2.2 2.2 0 1 0 4.4 0 a2.2 2.2 0 1 0 -4.4 0",
|
|
1784
|
+
cloud: "M -7 6 h13 a4.5 4.5 0 0 0 0.5 -9 a6 6 0 0 0 -11.5 -1 a4.5 4.5 0 0 0 -2 10 z",
|
|
1785
|
+
refresh: "M 7 -3 a7.5 7.5 0 1 0 0.5 5 M 7.5 -8 v5 h-5",
|
|
1786
|
+
undo: "M -7 -2 h10 a5 5 0 0 1 0 10 h-6 M -3 -6 l-4 4 l4 4",
|
|
1787
|
+
yen: "M -6 -8 l6 7 l6 -7 M 0 -1 v9 M -5 1.5 h10 M -5 5 h10",
|
|
1788
|
+
layers: "M 0 -8 l9 4.5 l-9 4.5 l-9 -4.5 z M -9 2.5 l9 4.5 l9 -4.5",
|
|
1789
|
+
code: "M -4 -6 l-5 6 l5 6 M 4 -6 l5 6 l-5 6",
|
|
1790
|
+
paint: "M -8 8 c 0 -3 2 -5 4.5 -5 l 9 -9 l 3.5 3.5 l -9 9 c 0 2.5 -2 4.5 -5 4.5 z",
|
|
1791
|
+
tree: "M 0 -5 v4 M -6 -1 h12 M -6 -1 v3 M 6 -1 v3 M -9 2 h6 v6 h-6 z M 3 2 h6 v6 h-6 z M -3 -10 h6 v5 h-6 z",
|
|
1792
|
+
block: "M -9 -7 h18 a2 2 0 0 1 2 2 v10 a2 2 0 0 1 -2 2 h-18 a2 2 0 0 1 -2 -2 v-10 a2 2 0 0 1 2 -2 z M -11 -2.5 h22 M -6 2.5 h8"
|
|
1793
|
+
};
|
|
1794
|
+
|
|
1720
1795
|
// src/schemas/validate-diagram.js
|
|
1721
1796
|
function ucs2length(str) {
|
|
1722
1797
|
let length = 0;
|
|
@@ -2675,6 +2750,7 @@ function validate25(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2675
2750
|
return errors === 0;
|
|
2676
2751
|
}
|
|
2677
2752
|
var schema79 = { "enum": ["blue", "amber", "green", "violet", "rose", "slate", "coin"] };
|
|
2753
|
+
var schema80 = { "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"] };
|
|
2678
2754
|
var pattern0 = new RegExp("^[^\\s\\[\\]\u300C\u300D=:]+$", "u");
|
|
2679
2755
|
var func3 = ucs2length;
|
|
2680
2756
|
function validate30(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
@@ -2790,32 +2866,22 @@ function validate30(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2790
2866
|
}
|
|
2791
2867
|
if (data.icon !== void 0) {
|
|
2792
2868
|
let data4 = data.icon;
|
|
2793
|
-
if (
|
|
2794
|
-
|
|
2795
|
-
const err10 = { instancePath: instancePath + "/icon", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
2796
|
-
if (vErrors === null) {
|
|
2797
|
-
vErrors = [err10];
|
|
2798
|
-
} else {
|
|
2799
|
-
vErrors.push(err10);
|
|
2800
|
-
}
|
|
2801
|
-
errors++;
|
|
2802
|
-
}
|
|
2803
|
-
} else {
|
|
2804
|
-
const err11 = { instancePath: instancePath + "/icon", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
2869
|
+
if (!(data4 === "app" || data4 === "router" || data4 === "on" || data4 === "off" || data4 === "pool" || data4 === "db" || data4 === "exe" || data4 === "idx" || data4 === "sign" || data4 === "env" || data4 === "lock" || data4 === "check" || data4 === "flag" || data4 === "x" || data4 === "chain" || data4 === "net" || data4 === "user" || data4 === "server" || data4 === "key" || data4 === "shield" || data4 === "globe" || data4 === "bolt" || data4 === "doc" || data4 === "box" || data4 === "truck" || data4 === "card" || data4 === "cart" || data4 === "clock" || data4 === "branch" || data4 === "cloud" || data4 === "refresh" || data4 === "undo" || data4 === "yen" || data4 === "layers" || data4 === "code" || data4 === "paint" || data4 === "tree" || data4 === "block")) {
|
|
2870
|
+
const err10 = { instancePath: instancePath + "/icon", schemaPath: "#/definitions/icon/enum", keyword: "enum", params: { allowedValues: schema80.enum }, message: "must be equal to one of the allowed values" };
|
|
2805
2871
|
if (vErrors === null) {
|
|
2806
|
-
vErrors = [
|
|
2872
|
+
vErrors = [err10];
|
|
2807
2873
|
} else {
|
|
2808
|
-
vErrors.push(
|
|
2874
|
+
vErrors.push(err10);
|
|
2809
2875
|
}
|
|
2810
2876
|
errors++;
|
|
2811
2877
|
}
|
|
2812
2878
|
}
|
|
2813
2879
|
} else {
|
|
2814
|
-
const
|
|
2880
|
+
const err11 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
2815
2881
|
if (vErrors === null) {
|
|
2816
|
-
vErrors = [
|
|
2882
|
+
vErrors = [err11];
|
|
2817
2883
|
} else {
|
|
2818
|
-
vErrors.push(
|
|
2884
|
+
vErrors.push(err11);
|
|
2819
2885
|
}
|
|
2820
2886
|
errors++;
|
|
2821
2887
|
}
|
|
@@ -2936,22 +3002,12 @@ function validate32(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2936
3002
|
}
|
|
2937
3003
|
if (data.icon !== void 0) {
|
|
2938
3004
|
let data4 = data.icon;
|
|
2939
|
-
if (
|
|
2940
|
-
|
|
2941
|
-
const err10 = { instancePath: instancePath + "/icon", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
2942
|
-
if (vErrors === null) {
|
|
2943
|
-
vErrors = [err10];
|
|
2944
|
-
} else {
|
|
2945
|
-
vErrors.push(err10);
|
|
2946
|
-
}
|
|
2947
|
-
errors++;
|
|
2948
|
-
}
|
|
2949
|
-
} else {
|
|
2950
|
-
const err11 = { instancePath: instancePath + "/icon", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3005
|
+
if (!(data4 === "app" || data4 === "router" || data4 === "on" || data4 === "off" || data4 === "pool" || data4 === "db" || data4 === "exe" || data4 === "idx" || data4 === "sign" || data4 === "env" || data4 === "lock" || data4 === "check" || data4 === "flag" || data4 === "x" || data4 === "chain" || data4 === "net" || data4 === "user" || data4 === "server" || data4 === "key" || data4 === "shield" || data4 === "globe" || data4 === "bolt" || data4 === "doc" || data4 === "box" || data4 === "truck" || data4 === "card" || data4 === "cart" || data4 === "clock" || data4 === "branch" || data4 === "cloud" || data4 === "refresh" || data4 === "undo" || data4 === "yen" || data4 === "layers" || data4 === "code" || data4 === "paint" || data4 === "tree" || data4 === "block")) {
|
|
3006
|
+
const err10 = { instancePath: instancePath + "/icon", schemaPath: "#/definitions/icon/enum", keyword: "enum", params: { allowedValues: schema80.enum }, message: "must be equal to one of the allowed values" };
|
|
2951
3007
|
if (vErrors === null) {
|
|
2952
|
-
vErrors = [
|
|
3008
|
+
vErrors = [err10];
|
|
2953
3009
|
} else {
|
|
2954
|
-
vErrors.push(
|
|
3010
|
+
vErrors.push(err10);
|
|
2955
3011
|
}
|
|
2956
3012
|
errors++;
|
|
2957
3013
|
}
|
|
@@ -2960,20 +3016,20 @@ function validate32(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2960
3016
|
let data5 = data.region;
|
|
2961
3017
|
if (typeof data5 === "string") {
|
|
2962
3018
|
if (!pattern0.test(data5)) {
|
|
2963
|
-
const
|
|
3019
|
+
const err11 = { instancePath: instancePath + "/region", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
2964
3020
|
if (vErrors === null) {
|
|
2965
|
-
vErrors = [
|
|
3021
|
+
vErrors = [err11];
|
|
2966
3022
|
} else {
|
|
2967
|
-
vErrors.push(
|
|
3023
|
+
vErrors.push(err11);
|
|
2968
3024
|
}
|
|
2969
3025
|
errors++;
|
|
2970
3026
|
}
|
|
2971
3027
|
} else {
|
|
2972
|
-
const
|
|
3028
|
+
const err12 = { instancePath: instancePath + "/region", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
2973
3029
|
if (vErrors === null) {
|
|
2974
|
-
vErrors = [
|
|
3030
|
+
vErrors = [err12];
|
|
2975
3031
|
} else {
|
|
2976
|
-
vErrors.push(
|
|
3032
|
+
vErrors.push(err12);
|
|
2977
3033
|
}
|
|
2978
3034
|
errors++;
|
|
2979
3035
|
}
|
|
@@ -2982,30 +3038,30 @@ function validate32(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2982
3038
|
let data6 = data.link;
|
|
2983
3039
|
if (typeof data6 === "string") {
|
|
2984
3040
|
if (!pattern3.test(data6)) {
|
|
2985
|
-
const
|
|
3041
|
+
const err13 = { instancePath: instancePath + "/link", schemaPath: "#/definitions/url/pattern", keyword: "pattern", params: { pattern: "^(/|https?://)" }, message: 'must match pattern "^(/|https?://)"' };
|
|
2986
3042
|
if (vErrors === null) {
|
|
2987
|
-
vErrors = [
|
|
3043
|
+
vErrors = [err13];
|
|
2988
3044
|
} else {
|
|
2989
|
-
vErrors.push(
|
|
3045
|
+
vErrors.push(err13);
|
|
2990
3046
|
}
|
|
2991
3047
|
errors++;
|
|
2992
3048
|
}
|
|
2993
3049
|
} else {
|
|
2994
|
-
const
|
|
3050
|
+
const err14 = { instancePath: instancePath + "/link", schemaPath: "#/definitions/url/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
2995
3051
|
if (vErrors === null) {
|
|
2996
|
-
vErrors = [
|
|
3052
|
+
vErrors = [err14];
|
|
2997
3053
|
} else {
|
|
2998
|
-
vErrors.push(
|
|
3054
|
+
vErrors.push(err14);
|
|
2999
3055
|
}
|
|
3000
3056
|
errors++;
|
|
3001
3057
|
}
|
|
3002
3058
|
}
|
|
3003
3059
|
} else {
|
|
3004
|
-
const
|
|
3060
|
+
const err15 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
3005
3061
|
if (vErrors === null) {
|
|
3006
|
-
vErrors = [
|
|
3062
|
+
vErrors = [err15];
|
|
3007
3063
|
} else {
|
|
3008
|
-
vErrors.push(
|
|
3064
|
+
vErrors.push(err15);
|
|
3009
3065
|
}
|
|
3010
3066
|
errors++;
|
|
3011
3067
|
}
|
|
@@ -8112,6 +8168,7 @@ var OLD_HEADS = {
|
|
|
8112
8168
|
|
|
8113
8169
|
// src/schema.ts
|
|
8114
8170
|
var COLORS = ["blue", "amber", "green", "violet", "rose", "slate", "coin"];
|
|
8171
|
+
var ICON_NAMES = Object.keys(ICONS);
|
|
8115
8172
|
var EVENT_TYPES = ["edge", "action", "swap", "strip", "commit", "branch", "now", "mark", "span", "leaf", "node", "line", "seal", "open", "pick", "stamp"];
|
|
8116
8173
|
var ABSENT = "#/definitions/absent/not";
|
|
8117
8174
|
var ABSENT_KINDS = {
|
|
@@ -8141,7 +8198,16 @@ var WIRED_EVENTS = ["edge", "action"];
|
|
|
8141
8198
|
var DURATION = /^\^\[0-9\]\+\(\\\.\[0-9\]\+\)\?\(([a-z|]+)\)\$$/u;
|
|
8142
8199
|
var RATIO = /%\)\$$/u;
|
|
8143
8200
|
var escape = (key) => key.replaceAll("~", "~0").replaceAll("/", "~1");
|
|
8201
|
+
function valueAt(input, pointer) {
|
|
8202
|
+
let value = input;
|
|
8203
|
+
for (const raw of pointer.split("/").slice(1)) {
|
|
8204
|
+
if (typeof value !== "object" || value === null) return void 0;
|
|
8205
|
+
value = value[raw.replaceAll("~1", "/").replaceAll("~0", "~")];
|
|
8206
|
+
}
|
|
8207
|
+
return value;
|
|
8208
|
+
}
|
|
8144
8209
|
var URL_RULE = "#/definitions/url/pattern";
|
|
8210
|
+
var ICON_RULE = "#/definitions/icon/enum";
|
|
8145
8211
|
var HEX = /^\^\[0-9a-f\]\{(\d+),(\d+)\}\$$/u;
|
|
8146
8212
|
function forbiddenOf(pattern) {
|
|
8147
8213
|
const inside = /^\^\[\^(.+)\]\+\$$/u.exec(pattern)?.[1];
|
|
@@ -8152,7 +8218,7 @@ function forbiddenOf(pattern) {
|
|
|
8152
8218
|
var branchesOf = (anyOf, errors) => errors.filter(
|
|
8153
8219
|
(error) => error !== anyOf && error.schemaPath.startsWith(`${anyOf.schemaPath}/`) && (error.instancePath === anyOf.instancePath || error.instancePath.startsWith(`${anyOf.instancePath}/`))
|
|
8154
8220
|
);
|
|
8155
|
-
function toFieldError(error, errors, m) {
|
|
8221
|
+
function toFieldError(error, errors, m, input) {
|
|
8156
8222
|
const params = error.params;
|
|
8157
8223
|
const at2 = error.instancePath;
|
|
8158
8224
|
switch (error.keyword) {
|
|
@@ -8185,8 +8251,12 @@ function toFieldError(error, errors, m) {
|
|
|
8185
8251
|
const tag = String(params.tag);
|
|
8186
8252
|
return { pointer: `${at2}/${escape(tag)}`, message: m.discriminator(tag, EVENT_TYPES) };
|
|
8187
8253
|
}
|
|
8188
|
-
case "enum":
|
|
8254
|
+
case "enum": {
|
|
8255
|
+
const written = error.schemaPath === ICON_RULE ? valueAt(input, at2) : void 0;
|
|
8256
|
+
const near = typeof written === "string" ? nearest(written, ICON_NAMES) : void 0;
|
|
8257
|
+
if (typeof written === "string" && near !== void 0) return { pointer: at2, message: m.unknownIcon(written, near) };
|
|
8189
8258
|
return { pointer: at2, message: m.enum(params.allowedValues.map(String)) };
|
|
8259
|
+
}
|
|
8190
8260
|
case "type":
|
|
8191
8261
|
return { pointer: at2, message: m.type(String(params.type)) };
|
|
8192
8262
|
case "minLength":
|
|
@@ -8222,7 +8292,7 @@ function validateDiagram(input, options = {}) {
|
|
|
8222
8292
|
const all = validate_diagram_default.errors ?? [];
|
|
8223
8293
|
const inBranch = new Set(all.filter((error) => error.keyword === "anyOf").flatMap((anyOf) => branchesOf(anyOf, all)));
|
|
8224
8294
|
const m = FIELD_MESSAGES[options.lang ?? "ja"];
|
|
8225
|
-
const errors = all.filter((error) => error.keyword !== "if" && !inBranch.has(error)).map((error) => toFieldError(error, all, m));
|
|
8295
|
+
const errors = all.filter((error) => error.keyword !== "if" && !inBranch.has(error)).map((error) => toFieldError(error, all, m, input));
|
|
8226
8296
|
return { ok: false, errors };
|
|
8227
8297
|
}
|
|
8228
8298
|
|
|
@@ -8485,48 +8555,6 @@ function stateTimes(diagram, edges, last) {
|
|
|
8485
8555
|
return [...times.values()];
|
|
8486
8556
|
}
|
|
8487
8557
|
|
|
8488
|
-
// src/render/icons.ts
|
|
8489
|
-
var ICONS = {
|
|
8490
|
-
app: "M -9 -7 h18 a2 2 0 0 1 2 2 v10 a2 2 0 0 1 -2 2 h-18 a2 2 0 0 1 -2 -2 v-10 a2 2 0 0 1 2 -2 z M -11 -2 h22",
|
|
8491
|
-
router: "M -9 -4 h16 M 3 -8 l4 4 l-4 4 M 9 5 h-16 M -3 1 l-4 4 l4 4",
|
|
8492
|
-
on: "M -7 7 L 7 -7 M -1 -7 h8 v8",
|
|
8493
|
-
off: "M -7 -7 L 7 7 M 7 -1 v8 h-8",
|
|
8494
|
-
pool: "M -9 -5 a9 3.5 0 1 0 18 0 a9 3.5 0 1 0 -18 0 M -9 -5 v10 a9 3.5 0 0 0 18 0 v-10 M -9 0 a9 3.5 0 0 0 18 0",
|
|
8495
|
-
db: "M -9 -5 a9 3.5 0 1 0 18 0 a9 3.5 0 1 0 -18 0 M -9 -5 v10 a9 3.5 0 0 0 18 0 v-10 M -9 0 a9 3.5 0 0 0 18 0",
|
|
8496
|
-
exe: "M -5 -8 L 7 0 L -5 8 Z",
|
|
8497
|
-
idx: "M -9 -7 h18 M -9 -2 h18 M -9 3 h18 M -9 8 h11",
|
|
8498
|
-
sign: "M -9 4 c 3 -9 5 -9 6 0 s 3 7 6 -2 s 3 -6 6 0",
|
|
8499
|
-
env: "M -8 -5.5 h16 v11 h-16 z M -8 -5.5 l8 6 l8 -6",
|
|
8500
|
-
lock: "M -5.5 -1 h11 v8 h-11 z M -3.5 -1 v-3 a3.5 3.5 0 0 1 7 0 v3",
|
|
8501
|
-
check: "M -5 0 l3.5 3.5 l6.5 -7",
|
|
8502
|
-
flag: "M -4 8 V -8 M -4 -7 H 6 L 3.5 -3.5 L 6 0 H -4",
|
|
8503
|
-
x: "M -5 -5 l10 10 M 5 -5 l-10 10",
|
|
8504
|
-
chain: "M -1.5 4.5 l-2 2 a3.5 3.5 0 0 1 -5 -5 l3 -3 a3.5 3.5 0 0 1 5 0 M 1.5 -4.5 l2 -2 a3.5 3.5 0 0 1 5 5 l-3 3 a3.5 3.5 0 0 1 -5 0 M -2.5 2.5 l5 -5",
|
|
8505
|
-
net: "M -1.3 -4.6 L -5.8 3 M 1.3 -4.6 L 5.8 3 M -4.3 5.5 H 4.3 M -2.2 -7 a 2.2 2.2 0 1 0 4.4 0 a 2.2 2.2 0 1 0 -4.4 0 M -9.2 5.5 a 2.2 2.2 0 1 0 4.4 0 a 2.2 2.2 0 1 0 -4.4 0 M 4.8 5.5 a 2.2 2.2 0 1 0 4.4 0 a 2.2 2.2 0 1 0 -4.4 0",
|
|
8506
|
-
user: "M -4 -4.5 a4 4 0 1 0 8 0 a4 4 0 1 0 -8 0 M -8 9 c0 -5 3.6 -7.5 8 -7.5 s8 2.5 8 7.5",
|
|
8507
|
-
server: "M -9 -8 h18 v7 h-18 z M -9 1 h18 v7 h-18 z M -5 -4.5 h0.01 M -5 4.5 h0.01",
|
|
8508
|
-
key: "M -9 0 a3.5 3.5 0 1 0 7 0 a3.5 3.5 0 1 0 -7 0 M -2 0 h10 M 5 0 v3.5 M 8 0 v2.5",
|
|
8509
|
-
shield: "M 0 -9 l8 3 v5 c0 5 -3.5 8 -8 10 c-4.5 -2 -8 -5 -8 -10 v-5 z",
|
|
8510
|
-
globe: "M -9 0 a9 9 0 1 0 18 0 a9 9 0 1 0 -18 0 M -9 0 h18 M 0 -9 c-4.5 4 -4.5 14 0 18 M 0 -9 c4.5 4 4.5 14 0 18",
|
|
8511
|
-
bolt: "M 2 -9 L -5 1 h5 l-2 8 l7 -10 h-5 z",
|
|
8512
|
-
doc: "M -6 -9 h8 l5 5 v13 h-13 z M 2 -9 v5 h5 M -3 1 h7 M -3 5 h5",
|
|
8513
|
-
box: "M -9 -4.5 l9 -4.5 l9 4.5 v9 l-9 4.5 l-9 -4.5 z M -9 -4.5 l9 4.5 l9 -4.5 M 0 0 v9",
|
|
8514
|
-
truck: "M -10 -6 h11 v10 h-11 z M 1 -2 h5 l3.5 3.5 v2.5 h-8.5 M -7.5 6.5 a1.8 1.8 0 1 0 3.6 0 a1.8 1.8 0 1 0 -3.6 0 M 3 6.5 a1.8 1.8 0 1 0 3.6 0 a1.8 1.8 0 1 0 -3.6 0",
|
|
8515
|
-
card: "M -9 -6.5 h18 a2 2 0 0 1 2 2 v9 a2 2 0 0 1 -2 2 h-18 a2 2 0 0 1 -2 -2 v-9 a2 2 0 0 1 2 -2 z M -11 -2 h22 M -7 3 h5",
|
|
8516
|
-
cart: "M -10 -8 h3 l3 11 h11 l2.5 -8 h-15.5 M -4.5 7.5 a1.5 1.5 0 1 0 3 0 a1.5 1.5 0 1 0 -3 0 M 5 7.5 a1.5 1.5 0 1 0 3 0 a1.5 1.5 0 1 0 -3 0",
|
|
8517
|
-
clock: "M -9 0 a9 9 0 1 0 18 0 a9 9 0 1 0 -18 0 M 0 -5 v5 l3.5 2.5",
|
|
8518
|
-
branch: "M -4 -4.5 v9 M 5 0.5 c0 4 -9 3 -9 6.5 M -6.2 -7 a2.2 2.2 0 1 0 4.4 0 a2.2 2.2 0 1 0 -4.4 0 M -6.2 7 a2.2 2.2 0 1 0 4.4 0 a2.2 2.2 0 1 0 -4.4 0 M 2.8 -2 a2.2 2.2 0 1 0 4.4 0 a2.2 2.2 0 1 0 -4.4 0",
|
|
8519
|
-
cloud: "M -7 6 h13 a4.5 4.5 0 0 0 0.5 -9 a6 6 0 0 0 -11.5 -1 a4.5 4.5 0 0 0 -2 10 z",
|
|
8520
|
-
refresh: "M 7 -3 a7.5 7.5 0 1 0 0.5 5 M 7.5 -8 v5 h-5",
|
|
8521
|
-
undo: "M -7 -2 h10 a5 5 0 0 1 0 10 h-6 M -3 -6 l-4 4 l4 4",
|
|
8522
|
-
yen: "M -6 -8 l6 7 l6 -7 M 0 -1 v9 M -5 1.5 h10 M -5 5 h10",
|
|
8523
|
-
layers: "M 0 -8 l9 4.5 l-9 4.5 l-9 -4.5 z M -9 2.5 l9 4.5 l9 -4.5",
|
|
8524
|
-
code: "M -4 -6 l-5 6 l5 6 M 4 -6 l5 6 l-5 6",
|
|
8525
|
-
paint: "M -8 8 c 0 -3 2 -5 4.5 -5 l 9 -9 l 3.5 3.5 l -9 9 c 0 2.5 -2 4.5 -5 4.5 z",
|
|
8526
|
-
tree: "M 0 -5 v4 M -6 -1 h12 M -6 -1 v3 M 6 -1 v3 M -9 2 h6 v6 h-6 z M 3 2 h6 v6 h-6 z M -3 -10 h6 v5 h-6 z",
|
|
8527
|
-
block: "M -9 -7 h18 a2 2 0 0 1 2 2 v10 a2 2 0 0 1 -2 2 h-18 a2 2 0 0 1 -2 -2 v-10 a2 2 0 0 1 2 -2 z M -11 -2.5 h22 M -6 2.5 h8"
|
|
8528
|
-
};
|
|
8529
|
-
|
|
8530
8558
|
// src/render/ink.ts
|
|
8531
8559
|
var ALWAYS = [[0, Number.POSITIVE_INFINITY]];
|
|
8532
8560
|
var BITE = 0.5;
|
|
@@ -8565,7 +8593,7 @@ var linkTo = (link, markup) => link === void 0 ? markup : `<a href="${esc(link)}
|
|
|
8565
8593
|
var r1 = (v) => Math.round(v * 100) / 100;
|
|
8566
8594
|
var cs = (k) => k === "coin" ? "--c:var(--coin);--ct:var(--coint)" : `--c:var(--c-${k});--ct:var(--t-${k})`;
|
|
8567
8595
|
function glyph(name, x, y, scale, cls = "dg-gl") {
|
|
8568
|
-
const d = name
|
|
8596
|
+
const d = name !== void 0 && drawsIcon(name) ? ICONS[name] : void 0;
|
|
8569
8597
|
return d ? `<path class="${cls}" transform="translate(${r1(x)} ${r1(y)}) scale(${scale})" d="${d}"/>` : "";
|
|
8570
8598
|
}
|
|
8571
8599
|
function pathOf(points) {
|
|
@@ -8596,6 +8624,8 @@ function arrowHead(points) {
|
|
|
8596
8624
|
const { arrow: a, arrowHalf: h } = LOOK.edge;
|
|
8597
8625
|
return `M ${r1(ex - dx * a - dy * h)} ${r1(ey - dy * a + dx * h)} L ${r1(ex)} ${r1(ey)} L ${r1(ex - dx * a + dy * h)} ${r1(ey - dy * a - dx * h)}`;
|
|
8598
8626
|
}
|
|
8627
|
+
var drawsIcon = (name) => name !== void 0 && Object.hasOwn(ICONS, name);
|
|
8628
|
+
var boxTextY = (boxes) => boxes.some((b) => drawsIcon(b.icon) || b.slot !== void 0) ? { name: LOOK.box.nameY, sub: LOOK.box.subY } : { name: LOOK.box.nameMid, sub: LOOK.box.subMid };
|
|
8599
8629
|
var sansOf = (t) => ({ ...t, family: "sans" });
|
|
8600
8630
|
function write(ink, cls, x, y, text2, style, shown = ALWAYS, anchor) {
|
|
8601
8631
|
ink?.push({ text: text2, rect: textBox(text2, x, y, style, anchor), shown });
|
|
@@ -8622,7 +8652,7 @@ function band(region, ink) {
|
|
|
8622
8652
|
const { x, y } = region.header;
|
|
8623
8653
|
const lines = region.lines.map((t, k) => write(ink, "dg-bz", x, region.y + nameY + k * line, t, TYPE.regionName)).join("");
|
|
8624
8654
|
const note = region.note ? write(ink, "dg-bx", x, region.y + nameY + region.lines.length * line + 1, region.note, TYPE.regionNote) : "";
|
|
8625
|
-
const mark = region.icon
|
|
8655
|
+
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)}` : "";
|
|
8626
8656
|
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>`;
|
|
8627
8657
|
}
|
|
8628
8658
|
function subLines(box, m, changes, y, ink, right) {
|
|
@@ -8642,18 +8672,18 @@ function cardFrame(box, ctx, act, y, h) {
|
|
|
8642
8672
|
return `${act ? `<g class="dg-a" style="${act}">${rect("dg-halo")}</g>` : ""}${rect("dg-st", ` ${ctx.sh}`)}${act ? `<g class="dg-a" style="${act}">${rect("dg-on")}</g>` : ""}`;
|
|
8643
8673
|
}
|
|
8644
8674
|
function card(box, ctx, on, changes, lit) {
|
|
8645
|
-
const { icon, iconRadius, iconScale, iconY
|
|
8646
|
-
const subs = subLines(box, ctx.m, changes, box.cy +
|
|
8675
|
+
const { icon, iconRadius, iconScale, iconY } = LOOK.box;
|
|
8676
|
+
const subs = subLines(box, ctx.m, changes, box.cy + ctx.boxText.sub, ctx.ink);
|
|
8647
8677
|
const act = lit ? lit.length > 0 ? rangeKf(ctx.m, lit.map((s) => [s.start, s.end])) : void 0 : on.length > 0 ? activeKf(ctx, on) : void 0;
|
|
8648
8678
|
const ix = box.iconX ?? box.cx;
|
|
8649
8679
|
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}"/>` : "";
|
|
8650
8680
|
let mark = "";
|
|
8651
|
-
if (box.icon
|
|
8681
|
+
if (drawsIcon(box.icon)) {
|
|
8652
8682
|
const rect = { x: ix - icon / 2, y: box.cy + iconY - icon / 2, w: icon, h: icon };
|
|
8653
8683
|
ctx.ink.push({ text: `${box.name} \u306E\u7D75\u67C4`, rect, shown: ALWAYS, boxed: true, part: { kind: "icon", box: box.name } });
|
|
8654
8684
|
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)}`;
|
|
8655
8685
|
}
|
|
8656
|
-
return `<g style="${cs(box.color)}">${cardFrame(box, ctx, act, box.y, box.h)}${slot}${mark}${write(ctx.ink, "dg-sn", box.cx, box.cy +
|
|
8686
|
+
return `<g style="${cs(box.color)}">${cardFrame(box, ctx, act, box.y, box.h)}${slot}${mark}${write(ctx.ink, "dg-sn", box.cx, box.cy + ctx.boxText.name, box.name, TYPE.boxName, ALWAYS, "middle")}${subs}</g>`;
|
|
8657
8687
|
}
|
|
8658
8688
|
function headCard(box, ctx, on, changes) {
|
|
8659
8689
|
const { pad: pad2, h, nameY, subY } = LOOK.follow.head;
|
|
@@ -8666,7 +8696,7 @@ function ghostCard(box, ink) {
|
|
|
8666
8696
|
const G = LOOK.state.ghost;
|
|
8667
8697
|
const ix = box.x + G.pad + icon / 2;
|
|
8668
8698
|
const tx = box.x + G.pad + icon + G.gap;
|
|
8669
|
-
const mark = box.icon
|
|
8699
|
+
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)}` : "";
|
|
8670
8700
|
const nameY = box.sub ? G.nameY : LOOK.baseline.mark;
|
|
8671
8701
|
const sub = box.sub ? write(ink, "dg-ss", tx, box.cy + G.subY, box.sub, TYPE.boxSub, ALWAYS, "start") : "";
|
|
8672
8702
|
return `<g data-ghost="${esc(box.id)}" style="${cs(box.color)}"><rect class="dg-ghost" x="${r1(box.x)}" y="${r1(box.y)}" width="${r1(box.w)}" height="${box.h}" rx="${radius}"/>${mark}${write(ink, "dg-sn", tx, box.cy + nameY, box.name, TYPE.boxName, ALWAYS, "start")}${sub}</g>`;
|
|
@@ -9263,7 +9293,7 @@ function drawSvg(diagram, layout, timeline, palette, theme, follow, ink = [], tr
|
|
|
9263
9293
|
const vars = paletteVars(palette, theme);
|
|
9264
9294
|
const id = nameOf(`${JSON.stringify(diagram)}|${vars}|${follow ? `${follow.width}|${follow.lang}` : ""}`);
|
|
9265
9295
|
const m = new Motion(`dg${id}`, timeline.total, timeline.last);
|
|
9266
|
-
const ctx = { m, t: timeline, id, sh: `filter="url(#dg-sh-${id})"`, end: timeline.steps[timeline.steps.length - 1].end, ink, traces };
|
|
9296
|
+
const ctx = { m, t: timeline, id, sh: `filter="url(#dg-sh-${id})"`, end: timeline.steps[timeline.steps.length - 1].end, ink, traces, boxText: boxTextY(layout.boxes) };
|
|
9267
9297
|
const on = involved(diagram);
|
|
9268
9298
|
const subs = subChanges(diagram, timeline, layout.kind !== "sequence");
|
|
9269
9299
|
const L = { band: [], base: [], lit: [], node: [], badge: [], top: [] };
|
|
@@ -11194,7 +11224,7 @@ function simplify(keys2) {
|
|
|
11194
11224
|
}
|
|
11195
11225
|
return out;
|
|
11196
11226
|
}
|
|
11197
|
-
function
|
|
11227
|
+
function valueAt2(keys2, t) {
|
|
11198
11228
|
const first = keys2[0];
|
|
11199
11229
|
if (!first) return 0;
|
|
11200
11230
|
if (t <= first[0]) return first[1];
|
|
@@ -11376,7 +11406,7 @@ function meterField(field, keys2, ctx) {
|
|
|
11376
11406
|
const y = field.y + M.y;
|
|
11377
11407
|
const kf = m.kf([
|
|
11378
11408
|
...simplify(keys2).map(([t, v]) => [t, { transform: `scaleX(${r14(v * 1e3) / 1e3})` }]),
|
|
11379
|
-
[m.last, { transform: `scaleX(${r14(
|
|
11409
|
+
[m.last, { transform: `scaleX(${r14(valueAt2(keys2, m.last) * 1e3) / 1e3})` }, EASE.inOut],
|
|
11380
11410
|
[m.total, { transform: "scaleX(0)" }]
|
|
11381
11411
|
]);
|
|
11382
11412
|
const lx = x + w * line;
|
|
@@ -11384,9 +11414,9 @@ function meterField(field, keys2, ctx) {
|
|
|
11384
11414
|
}
|
|
11385
11415
|
function timeFocus(layout, timeline, step, parts, vw, vh) {
|
|
11386
11416
|
const span = timeline.steps[step];
|
|
11387
|
-
const position =
|
|
11417
|
+
const position = valueAt2(timeline.needle ?? [], span.end - MOTION.still);
|
|
11388
11418
|
const badge2 = layout.badges.find((b) => b.step === step);
|
|
11389
|
-
const anchored = badge2 &&
|
|
11419
|
+
const anchored = badge2 && valueAt2(timeline.needle ?? [], span.start) === position && !(layout.strip && badge2.y >= layout.strip.y);
|
|
11390
11420
|
const ax = anchored ? badge2.x : layout.axis.x + position * layout.axis.unit;
|
|
11391
11421
|
const top = Math.min(...layout.rows.map((r) => r.y));
|
|
11392
11422
|
const bottom = Math.max(...layout.rows.map((r) => r.y + r.h));
|
|
@@ -11968,16 +11998,16 @@ async function film(stage2, plan2) {
|
|
|
11968
11998
|
const delay = gifEvery / fps * 1e3;
|
|
11969
11999
|
const sampled = [];
|
|
11970
12000
|
let colors = [];
|
|
11971
|
-
const
|
|
12001
|
+
const nearest2 = /* @__PURE__ */ new Map();
|
|
11972
12002
|
const toIndex = (data) => {
|
|
11973
12003
|
const index = new Uint8Array(data.length / 4);
|
|
11974
12004
|
for (let p = 0; p < index.length; p++) {
|
|
11975
12005
|
const i = p * 4;
|
|
11976
12006
|
const key = data[i] << 16 | data[i + 1] << 8 | data[i + 2];
|
|
11977
|
-
let k =
|
|
12007
|
+
let k = nearest2.get(key);
|
|
11978
12008
|
if (k === void 0) {
|
|
11979
12009
|
k = gif.nearestColorIndex(colors, [data[i], data[i + 1], data[i + 2]]);
|
|
11980
|
-
|
|
12010
|
+
nearest2.set(key, k);
|
|
11981
12011
|
}
|
|
11982
12012
|
index[p] = k;
|
|
11983
12013
|
}
|
|
@@ -12210,6 +12240,10 @@ function writeOutputs(outDir, name, outputs) {
|
|
|
12210
12240
|
|
|
12211
12241
|
// src/messages.ts
|
|
12212
12242
|
var list = (words) => words.join(" / ");
|
|
12243
|
+
var withNear = (value, near, none) => {
|
|
12244
|
+
const name = nearest(value, ICON_NAMES);
|
|
12245
|
+
return name === void 0 ? none : near(name);
|
|
12246
|
+
};
|
|
12213
12247
|
var ja3 = () => {
|
|
12214
12248
|
const shapes = {
|
|
12215
12249
|
sequence: "sequence <\u984C>",
|
|
@@ -12270,6 +12304,7 @@ var ja3 = () => {
|
|
|
12270
12304
|
attrTwice: (key) => `${key} \u306F 1 \u3064\u306E\u884C\u306B 1 \u3064\u307E\u3067`,
|
|
12271
12305
|
badAttr: (key, allowed) => `${key} \u306F\u3053\u306E\u884C\u306B\u66F8\u3051\u306A\u3044\u5C5E\u6027\u3002\u66F8\u3051\u308B\u306E\u306F ${list(allowed)}`,
|
|
12272
12306
|
badColor: `color \u306F ${list(COLORS)} \u306E\u3069\u308C\u304B`,
|
|
12307
|
+
badIcon: (value) => withNear(value, (near) => `${value} \u3068\u3044\u3046 icon \u306F\u7121\u3044\u3002\u8FD1\u3044\u540D\u524D\u306F ${near}`, `icon \u306F ${list(ICON_NAMES)} \u306E\u3069\u308C\u304B`),
|
|
12273
12308
|
badView: `view \u306F ${list(VIEWS)} \u306E\u3069\u308C\u304B`,
|
|
12274
12309
|
badCarry: `carry \u306F ${list(CARRIES)} \u306E\u3069\u308C\u304B\u3002\u672D\u306F tag: <\u5024> \u3067\u66F8\u304F`,
|
|
12275
12310
|
badSide: `side \u306F ${list(SIDES)} \u306E\u3069\u308C\u304B`,
|
|
@@ -12408,6 +12443,7 @@ var en2 = () => {
|
|
|
12408
12443
|
attrTwice: (key) => `Write ${key} only once on a line`,
|
|
12409
12444
|
badAttr: (key, allowed) => `${key} cannot be written on this line. Write ${list(allowed)}`,
|
|
12410
12445
|
badColor: `color is one of ${list(COLORS)}`,
|
|
12446
|
+
badIcon: (value) => withNear(value, (near) => `There is no icon named ${value}. The closest is ${near}`, `icon is one of ${list(ICON_NAMES)}`),
|
|
12411
12447
|
badView: `view is one of ${list(VIEWS)}`,
|
|
12412
12448
|
badCarry: `carry is one of ${list(CARRIES)}. Write a tag as tag: <value>`,
|
|
12413
12449
|
badSide: `side is one of ${list(SIDES)}`,
|
|
@@ -12648,12 +12684,13 @@ function readDeclared(source, word, allowed, m) {
|
|
|
12648
12684
|
function lookOf(source, attrs, m) {
|
|
12649
12685
|
const color = attrs.get("color");
|
|
12650
12686
|
if (color && !isOneOf(COLORS, color.value)) throw fail(source, color.at, m.badColor);
|
|
12687
|
+
const icon = attrs.get("icon");
|
|
12688
|
+
if (icon && !ICON_NAMES.includes(icon.value)) throw fail(source, icon.at, m.badIcon(icon.value));
|
|
12651
12689
|
const note = attrs.get("note")?.value;
|
|
12652
|
-
const icon = attrs.get("icon")?.value;
|
|
12653
12690
|
return {
|
|
12654
12691
|
...note !== void 0 ? { note } : {},
|
|
12655
12692
|
...color ? { color: color.value } : {},
|
|
12656
|
-
...icon
|
|
12693
|
+
...icon ? { icon: icon.value } : {}
|
|
12657
12694
|
};
|
|
12658
12695
|
}
|
|
12659
12696
|
function oldForm(text2, inStep) {
|