@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.js
CHANGED
|
@@ -319,7 +319,11 @@ var LOOK = {
|
|
|
319
319
|
gap: 10,
|
|
320
320
|
/** 図の外周の余白 */
|
|
321
321
|
margin: 14,
|
|
322
|
-
|
|
322
|
+
/**
|
|
323
|
+
* 箱。`iconY` と `nameY` と `subY` は箱の真ん中から絵柄の真ん中と名前と下の字の基準線まで。
|
|
324
|
+
* `nameMid` と `subMid` はアイコンも置き場の枠も持つ箱が無い図の名前と下の字の基準線で、名前を箱の真ん中に置き、下の字を名前から `subY - nameY` と同じ間で置く (#3307、#3309)
|
|
325
|
+
*/
|
|
326
|
+
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 },
|
|
323
327
|
region: { pad: 18, gap: 10, radius: 14, inset: 14, icon: 24, iconRadius: 7, iconScale: 0.68, nameY: 58, line: 16, minH: 108 },
|
|
324
328
|
architecture: { columns: 4, columnGap: 56, maxColumnGap: 160, rowGap: 44, labelRoom: 16 },
|
|
325
329
|
/**
|
|
@@ -831,8 +835,8 @@ function longest(points) {
|
|
|
831
835
|
}
|
|
832
836
|
return { a: best.a, b: best.b, vertical: Math.abs(best.b[0] - best.a[0]) < Math.abs(best.b[1] - best.a[1]) };
|
|
833
837
|
}
|
|
834
|
-
function along(points,
|
|
835
|
-
let left =
|
|
838
|
+
function along(points, distance2) {
|
|
839
|
+
let left = distance2;
|
|
836
840
|
for (let i = 1; i < points.length; i++) {
|
|
837
841
|
const a = points[i - 1];
|
|
838
842
|
const b = points[i];
|
|
@@ -1665,6 +1669,7 @@ var ja = {
|
|
|
1665
1669
|
additionalProperties: (key) => `${key} \u3068\u3044\u3046\u6B04\u306F\u66F8\u3051\u306A\u3044`,
|
|
1666
1670
|
required: (key) => `${key} \u306E\u6B04\u304C\u8981\u308B`,
|
|
1667
1671
|
enum: (values) => `${values.join(" / ")} \u306E\u3069\u308C\u304B\u306B\u3059\u308B`,
|
|
1672
|
+
unknownIcon: (value, near) => `${value} \u3068\u3044\u3046 icon \u306F\u7121\u3044\u3002\u8FD1\u3044\u540D\u524D\u306F ${near}`,
|
|
1668
1673
|
type: (type) => TYPES_JA[type] ?? `${type} \u306B\u3059\u308B`,
|
|
1669
1674
|
minLength: (limit) => `${limit} \u5B57\u4EE5\u4E0A\u66F8\u304F`,
|
|
1670
1675
|
maxLength: (limit) => `${limit} \u5B57\u307E\u3067\u306B\u3059\u308B`,
|
|
@@ -1689,6 +1694,7 @@ var en = {
|
|
|
1689
1694
|
additionalProperties: (key) => `The ${key} field is not allowed`,
|
|
1690
1695
|
required: (key) => `The ${key} field is required`,
|
|
1691
1696
|
enum: (values) => `Use one of ${values.join(" / ")}`,
|
|
1697
|
+
unknownIcon: (value, near) => `There is no icon named ${value}. The closest is ${near}`,
|
|
1692
1698
|
type: (type) => TYPES_EN[type] ?? `Use ${type}`,
|
|
1693
1699
|
minLength: (limit) => `Write at least ${plural(limit, "character")}`,
|
|
1694
1700
|
maxLength: (limit) => `Write at most ${plural(limit, "character")}`,
|
|
@@ -1711,6 +1717,75 @@ var en = {
|
|
|
1711
1717
|
};
|
|
1712
1718
|
var FIELD_MESSAGES = { ja, en };
|
|
1713
1719
|
|
|
1720
|
+
// src/nearest.ts
|
|
1721
|
+
var MAX_DISTANCE = 2;
|
|
1722
|
+
function nearest(word, candidates) {
|
|
1723
|
+
const written = [...word.toLowerCase()];
|
|
1724
|
+
let limit = Math.min(MAX_DISTANCE, written.length - 1);
|
|
1725
|
+
let best;
|
|
1726
|
+
for (const candidate of candidates) {
|
|
1727
|
+
const d = distance(written, [...candidate.toLowerCase()]);
|
|
1728
|
+
if (d > limit) continue;
|
|
1729
|
+
best = candidate;
|
|
1730
|
+
limit = d - 1;
|
|
1731
|
+
}
|
|
1732
|
+
return best;
|
|
1733
|
+
}
|
|
1734
|
+
function distance(a, b) {
|
|
1735
|
+
let previous = Array.from({ length: b.length + 1 }, (_, j) => j);
|
|
1736
|
+
for (let i = 1; i <= a.length; i++) {
|
|
1737
|
+
const current = [i];
|
|
1738
|
+
for (let j = 1; j <= b.length; j++) {
|
|
1739
|
+
const replace = previous[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1);
|
|
1740
|
+
current.push(Math.min(previous[j] + 1, current[j - 1] + 1, replace));
|
|
1741
|
+
}
|
|
1742
|
+
previous = current;
|
|
1743
|
+
}
|
|
1744
|
+
return previous[b.length];
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
// src/render/icons.ts
|
|
1748
|
+
var ICONS = {
|
|
1749
|
+
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",
|
|
1750
|
+
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",
|
|
1751
|
+
on: "M -7 7 L 7 -7 M -1 -7 h8 v8",
|
|
1752
|
+
off: "M -7 -7 L 7 7 M 7 -1 v8 h-8",
|
|
1753
|
+
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",
|
|
1754
|
+
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",
|
|
1755
|
+
exe: "M -5 -8 L 7 0 L -5 8 Z",
|
|
1756
|
+
idx: "M -9 -7 h18 M -9 -2 h18 M -9 3 h18 M -9 8 h11",
|
|
1757
|
+
sign: "M -9 4 c 3 -9 5 -9 6 0 s 3 7 6 -2 s 3 -6 6 0",
|
|
1758
|
+
env: "M -8 -5.5 h16 v11 h-16 z M -8 -5.5 l8 6 l8 -6",
|
|
1759
|
+
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",
|
|
1760
|
+
check: "M -5 0 l3.5 3.5 l6.5 -7",
|
|
1761
|
+
flag: "M -4 8 V -8 M -4 -7 H 6 L 3.5 -3.5 L 6 0 H -4",
|
|
1762
|
+
x: "M -5 -5 l10 10 M 5 -5 l-10 10",
|
|
1763
|
+
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",
|
|
1764
|
+
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",
|
|
1765
|
+
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",
|
|
1766
|
+
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",
|
|
1767
|
+
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",
|
|
1768
|
+
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",
|
|
1769
|
+
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",
|
|
1770
|
+
bolt: "M 2 -9 L -5 1 h5 l-2 8 l7 -10 h-5 z",
|
|
1771
|
+
doc: "M -6 -9 h8 l5 5 v13 h-13 z M 2 -9 v5 h5 M -3 1 h7 M -3 5 h5",
|
|
1772
|
+
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",
|
|
1773
|
+
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",
|
|
1774
|
+
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",
|
|
1775
|
+
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",
|
|
1776
|
+
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",
|
|
1777
|
+
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",
|
|
1778
|
+
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",
|
|
1779
|
+
refresh: "M 7 -3 a7.5 7.5 0 1 0 0.5 5 M 7.5 -8 v5 h-5",
|
|
1780
|
+
undo: "M -7 -2 h10 a5 5 0 0 1 0 10 h-6 M -3 -6 l-4 4 l4 4",
|
|
1781
|
+
yen: "M -6 -8 l6 7 l6 -7 M 0 -1 v9 M -5 1.5 h10 M -5 5 h10",
|
|
1782
|
+
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",
|
|
1783
|
+
code: "M -4 -6 l-5 6 l5 6 M 4 -6 l5 6 l-5 6",
|
|
1784
|
+
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",
|
|
1785
|
+
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",
|
|
1786
|
+
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"
|
|
1787
|
+
};
|
|
1788
|
+
|
|
1714
1789
|
// src/schemas/validate-diagram.js
|
|
1715
1790
|
function ucs2length(str) {
|
|
1716
1791
|
let length = 0;
|
|
@@ -2669,6 +2744,7 @@ function validate25(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2669
2744
|
return errors === 0;
|
|
2670
2745
|
}
|
|
2671
2746
|
var schema79 = { "enum": ["blue", "amber", "green", "violet", "rose", "slate", "coin"] };
|
|
2747
|
+
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"] };
|
|
2672
2748
|
var pattern0 = new RegExp("^[^\\s\\[\\]\u300C\u300D=:]+$", "u");
|
|
2673
2749
|
var func3 = ucs2length;
|
|
2674
2750
|
function validate30(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
@@ -2784,32 +2860,22 @@ function validate30(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2784
2860
|
}
|
|
2785
2861
|
if (data.icon !== void 0) {
|
|
2786
2862
|
let data4 = data.icon;
|
|
2787
|
-
if (
|
|
2788
|
-
|
|
2789
|
-
const err10 = { instancePath: instancePath + "/icon", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
2790
|
-
if (vErrors === null) {
|
|
2791
|
-
vErrors = [err10];
|
|
2792
|
-
} else {
|
|
2793
|
-
vErrors.push(err10);
|
|
2794
|
-
}
|
|
2795
|
-
errors++;
|
|
2796
|
-
}
|
|
2797
|
-
} else {
|
|
2798
|
-
const err11 = { instancePath: instancePath + "/icon", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
2863
|
+
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")) {
|
|
2864
|
+
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" };
|
|
2799
2865
|
if (vErrors === null) {
|
|
2800
|
-
vErrors = [
|
|
2866
|
+
vErrors = [err10];
|
|
2801
2867
|
} else {
|
|
2802
|
-
vErrors.push(
|
|
2868
|
+
vErrors.push(err10);
|
|
2803
2869
|
}
|
|
2804
2870
|
errors++;
|
|
2805
2871
|
}
|
|
2806
2872
|
}
|
|
2807
2873
|
} else {
|
|
2808
|
-
const
|
|
2874
|
+
const err11 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
2809
2875
|
if (vErrors === null) {
|
|
2810
|
-
vErrors = [
|
|
2876
|
+
vErrors = [err11];
|
|
2811
2877
|
} else {
|
|
2812
|
-
vErrors.push(
|
|
2878
|
+
vErrors.push(err11);
|
|
2813
2879
|
}
|
|
2814
2880
|
errors++;
|
|
2815
2881
|
}
|
|
@@ -2930,22 +2996,12 @@ function validate32(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2930
2996
|
}
|
|
2931
2997
|
if (data.icon !== void 0) {
|
|
2932
2998
|
let data4 = data.icon;
|
|
2933
|
-
if (
|
|
2934
|
-
|
|
2935
|
-
const err10 = { instancePath: instancePath + "/icon", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
2936
|
-
if (vErrors === null) {
|
|
2937
|
-
vErrors = [err10];
|
|
2938
|
-
} else {
|
|
2939
|
-
vErrors.push(err10);
|
|
2940
|
-
}
|
|
2941
|
-
errors++;
|
|
2942
|
-
}
|
|
2943
|
-
} else {
|
|
2944
|
-
const err11 = { instancePath: instancePath + "/icon", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
2999
|
+
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")) {
|
|
3000
|
+
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" };
|
|
2945
3001
|
if (vErrors === null) {
|
|
2946
|
-
vErrors = [
|
|
3002
|
+
vErrors = [err10];
|
|
2947
3003
|
} else {
|
|
2948
|
-
vErrors.push(
|
|
3004
|
+
vErrors.push(err10);
|
|
2949
3005
|
}
|
|
2950
3006
|
errors++;
|
|
2951
3007
|
}
|
|
@@ -2954,20 +3010,20 @@ function validate32(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2954
3010
|
let data5 = data.region;
|
|
2955
3011
|
if (typeof data5 === "string") {
|
|
2956
3012
|
if (!pattern0.test(data5)) {
|
|
2957
|
-
const
|
|
3013
|
+
const err11 = { instancePath: instancePath + "/region", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
2958
3014
|
if (vErrors === null) {
|
|
2959
|
-
vErrors = [
|
|
3015
|
+
vErrors = [err11];
|
|
2960
3016
|
} else {
|
|
2961
|
-
vErrors.push(
|
|
3017
|
+
vErrors.push(err11);
|
|
2962
3018
|
}
|
|
2963
3019
|
errors++;
|
|
2964
3020
|
}
|
|
2965
3021
|
} else {
|
|
2966
|
-
const
|
|
3022
|
+
const err12 = { instancePath: instancePath + "/region", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
2967
3023
|
if (vErrors === null) {
|
|
2968
|
-
vErrors = [
|
|
3024
|
+
vErrors = [err12];
|
|
2969
3025
|
} else {
|
|
2970
|
-
vErrors.push(
|
|
3026
|
+
vErrors.push(err12);
|
|
2971
3027
|
}
|
|
2972
3028
|
errors++;
|
|
2973
3029
|
}
|
|
@@ -2976,30 +3032,30 @@ function validate32(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2976
3032
|
let data6 = data.link;
|
|
2977
3033
|
if (typeof data6 === "string") {
|
|
2978
3034
|
if (!pattern3.test(data6)) {
|
|
2979
|
-
const
|
|
3035
|
+
const err13 = { instancePath: instancePath + "/link", schemaPath: "#/definitions/url/pattern", keyword: "pattern", params: { pattern: "^(/|https?://)" }, message: 'must match pattern "^(/|https?://)"' };
|
|
2980
3036
|
if (vErrors === null) {
|
|
2981
|
-
vErrors = [
|
|
3037
|
+
vErrors = [err13];
|
|
2982
3038
|
} else {
|
|
2983
|
-
vErrors.push(
|
|
3039
|
+
vErrors.push(err13);
|
|
2984
3040
|
}
|
|
2985
3041
|
errors++;
|
|
2986
3042
|
}
|
|
2987
3043
|
} else {
|
|
2988
|
-
const
|
|
3044
|
+
const err14 = { instancePath: instancePath + "/link", schemaPath: "#/definitions/url/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
2989
3045
|
if (vErrors === null) {
|
|
2990
|
-
vErrors = [
|
|
3046
|
+
vErrors = [err14];
|
|
2991
3047
|
} else {
|
|
2992
|
-
vErrors.push(
|
|
3048
|
+
vErrors.push(err14);
|
|
2993
3049
|
}
|
|
2994
3050
|
errors++;
|
|
2995
3051
|
}
|
|
2996
3052
|
}
|
|
2997
3053
|
} else {
|
|
2998
|
-
const
|
|
3054
|
+
const err15 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
2999
3055
|
if (vErrors === null) {
|
|
3000
|
-
vErrors = [
|
|
3056
|
+
vErrors = [err15];
|
|
3001
3057
|
} else {
|
|
3002
|
-
vErrors.push(
|
|
3058
|
+
vErrors.push(err15);
|
|
3003
3059
|
}
|
|
3004
3060
|
errors++;
|
|
3005
3061
|
}
|
|
@@ -8106,6 +8162,7 @@ var OLD_HEADS = {
|
|
|
8106
8162
|
|
|
8107
8163
|
// src/schema.ts
|
|
8108
8164
|
var COLORS = ["blue", "amber", "green", "violet", "rose", "slate", "coin"];
|
|
8165
|
+
var ICON_NAMES = Object.keys(ICONS);
|
|
8109
8166
|
var EVENT_TYPES = ["edge", "action", "swap", "strip", "commit", "branch", "now", "mark", "span", "leaf", "node", "line", "seal", "open", "pick", "stamp"];
|
|
8110
8167
|
var ABSENT = "#/definitions/absent/not";
|
|
8111
8168
|
var ABSENT_KINDS = {
|
|
@@ -8135,7 +8192,16 @@ var WIRED_EVENTS = ["edge", "action"];
|
|
|
8135
8192
|
var DURATION = /^\^\[0-9\]\+\(\\\.\[0-9\]\+\)\?\(([a-z|]+)\)\$$/u;
|
|
8136
8193
|
var RATIO = /%\)\$$/u;
|
|
8137
8194
|
var escape = (key) => key.replaceAll("~", "~0").replaceAll("/", "~1");
|
|
8195
|
+
function valueAt(input, pointer) {
|
|
8196
|
+
let value = input;
|
|
8197
|
+
for (const raw of pointer.split("/").slice(1)) {
|
|
8198
|
+
if (typeof value !== "object" || value === null) return void 0;
|
|
8199
|
+
value = value[raw.replaceAll("~1", "/").replaceAll("~0", "~")];
|
|
8200
|
+
}
|
|
8201
|
+
return value;
|
|
8202
|
+
}
|
|
8138
8203
|
var URL_RULE = "#/definitions/url/pattern";
|
|
8204
|
+
var ICON_RULE = "#/definitions/icon/enum";
|
|
8139
8205
|
var HEX = /^\^\[0-9a-f\]\{(\d+),(\d+)\}\$$/u;
|
|
8140
8206
|
function forbiddenOf(pattern) {
|
|
8141
8207
|
const inside = /^\^\[\^(.+)\]\+\$$/u.exec(pattern)?.[1];
|
|
@@ -8146,7 +8212,7 @@ function forbiddenOf(pattern) {
|
|
|
8146
8212
|
var branchesOf = (anyOf, errors) => errors.filter(
|
|
8147
8213
|
(error) => error !== anyOf && error.schemaPath.startsWith(`${anyOf.schemaPath}/`) && (error.instancePath === anyOf.instancePath || error.instancePath.startsWith(`${anyOf.instancePath}/`))
|
|
8148
8214
|
);
|
|
8149
|
-
function toFieldError(error, errors, m) {
|
|
8215
|
+
function toFieldError(error, errors, m, input) {
|
|
8150
8216
|
const params = error.params;
|
|
8151
8217
|
const at2 = error.instancePath;
|
|
8152
8218
|
switch (error.keyword) {
|
|
@@ -8179,8 +8245,12 @@ function toFieldError(error, errors, m) {
|
|
|
8179
8245
|
const tag = String(params.tag);
|
|
8180
8246
|
return { pointer: `${at2}/${escape(tag)}`, message: m.discriminator(tag, EVENT_TYPES) };
|
|
8181
8247
|
}
|
|
8182
|
-
case "enum":
|
|
8248
|
+
case "enum": {
|
|
8249
|
+
const written = error.schemaPath === ICON_RULE ? valueAt(input, at2) : void 0;
|
|
8250
|
+
const near = typeof written === "string" ? nearest(written, ICON_NAMES) : void 0;
|
|
8251
|
+
if (typeof written === "string" && near !== void 0) return { pointer: at2, message: m.unknownIcon(written, near) };
|
|
8183
8252
|
return { pointer: at2, message: m.enum(params.allowedValues.map(String)) };
|
|
8253
|
+
}
|
|
8184
8254
|
case "type":
|
|
8185
8255
|
return { pointer: at2, message: m.type(String(params.type)) };
|
|
8186
8256
|
case "minLength":
|
|
@@ -8216,7 +8286,7 @@ function validateDiagram(input, options = {}) {
|
|
|
8216
8286
|
const all = validate_diagram_default.errors ?? [];
|
|
8217
8287
|
const inBranch = new Set(all.filter((error) => error.keyword === "anyOf").flatMap((anyOf) => branchesOf(anyOf, all)));
|
|
8218
8288
|
const m = FIELD_MESSAGES[options.lang ?? "ja"];
|
|
8219
|
-
const errors = all.filter((error) => error.keyword !== "if" && !inBranch.has(error)).map((error) => toFieldError(error, all, m));
|
|
8289
|
+
const errors = all.filter((error) => error.keyword !== "if" && !inBranch.has(error)).map((error) => toFieldError(error, all, m, input));
|
|
8220
8290
|
return { ok: false, errors };
|
|
8221
8291
|
}
|
|
8222
8292
|
|
|
@@ -8479,48 +8549,6 @@ function stateTimes(diagram, edges, last) {
|
|
|
8479
8549
|
return [...times.values()];
|
|
8480
8550
|
}
|
|
8481
8551
|
|
|
8482
|
-
// src/render/icons.ts
|
|
8483
|
-
var ICONS = {
|
|
8484
|
-
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",
|
|
8485
|
-
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",
|
|
8486
|
-
on: "M -7 7 L 7 -7 M -1 -7 h8 v8",
|
|
8487
|
-
off: "M -7 -7 L 7 7 M 7 -1 v8 h-8",
|
|
8488
|
-
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",
|
|
8489
|
-
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",
|
|
8490
|
-
exe: "M -5 -8 L 7 0 L -5 8 Z",
|
|
8491
|
-
idx: "M -9 -7 h18 M -9 -2 h18 M -9 3 h18 M -9 8 h11",
|
|
8492
|
-
sign: "M -9 4 c 3 -9 5 -9 6 0 s 3 7 6 -2 s 3 -6 6 0",
|
|
8493
|
-
env: "M -8 -5.5 h16 v11 h-16 z M -8 -5.5 l8 6 l8 -6",
|
|
8494
|
-
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",
|
|
8495
|
-
check: "M -5 0 l3.5 3.5 l6.5 -7",
|
|
8496
|
-
flag: "M -4 8 V -8 M -4 -7 H 6 L 3.5 -3.5 L 6 0 H -4",
|
|
8497
|
-
x: "M -5 -5 l10 10 M 5 -5 l-10 10",
|
|
8498
|
-
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",
|
|
8499
|
-
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",
|
|
8500
|
-
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",
|
|
8501
|
-
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",
|
|
8502
|
-
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",
|
|
8503
|
-
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",
|
|
8504
|
-
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",
|
|
8505
|
-
bolt: "M 2 -9 L -5 1 h5 l-2 8 l7 -10 h-5 z",
|
|
8506
|
-
doc: "M -6 -9 h8 l5 5 v13 h-13 z M 2 -9 v5 h5 M -3 1 h7 M -3 5 h5",
|
|
8507
|
-
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",
|
|
8508
|
-
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",
|
|
8509
|
-
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",
|
|
8510
|
-
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",
|
|
8511
|
-
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",
|
|
8512
|
-
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",
|
|
8513
|
-
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",
|
|
8514
|
-
refresh: "M 7 -3 a7.5 7.5 0 1 0 0.5 5 M 7.5 -8 v5 h-5",
|
|
8515
|
-
undo: "M -7 -2 h10 a5 5 0 0 1 0 10 h-6 M -3 -6 l-4 4 l4 4",
|
|
8516
|
-
yen: "M -6 -8 l6 7 l6 -7 M 0 -1 v9 M -5 1.5 h10 M -5 5 h10",
|
|
8517
|
-
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",
|
|
8518
|
-
code: "M -4 -6 l-5 6 l5 6 M 4 -6 l5 6 l-5 6",
|
|
8519
|
-
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",
|
|
8520
|
-
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",
|
|
8521
|
-
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"
|
|
8522
|
-
};
|
|
8523
|
-
|
|
8524
8552
|
// src/render/ink.ts
|
|
8525
8553
|
var ALWAYS = [[0, Number.POSITIVE_INFINITY]];
|
|
8526
8554
|
var BITE = 0.5;
|
|
@@ -8559,7 +8587,7 @@ var linkTo = (link, markup) => link === void 0 ? markup : `<a href="${esc(link)}
|
|
|
8559
8587
|
var r1 = (v) => Math.round(v * 100) / 100;
|
|
8560
8588
|
var cs = (k) => k === "coin" ? "--c:var(--coin);--ct:var(--coint)" : `--c:var(--c-${k});--ct:var(--t-${k})`;
|
|
8561
8589
|
function glyph(name, x, y, scale, cls = "dg-gl") {
|
|
8562
|
-
const d = name
|
|
8590
|
+
const d = name !== void 0 && drawsIcon(name) ? ICONS[name] : void 0;
|
|
8563
8591
|
return d ? `<path class="${cls}" transform="translate(${r1(x)} ${r1(y)}) scale(${scale})" d="${d}"/>` : "";
|
|
8564
8592
|
}
|
|
8565
8593
|
function pathOf(points) {
|
|
@@ -8590,6 +8618,8 @@ function arrowHead(points) {
|
|
|
8590
8618
|
const { arrow: a, arrowHalf: h } = LOOK.edge;
|
|
8591
8619
|
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)}`;
|
|
8592
8620
|
}
|
|
8621
|
+
var drawsIcon = (name) => name !== void 0 && Object.hasOwn(ICONS, name);
|
|
8622
|
+
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 };
|
|
8593
8623
|
var sansOf = (t) => ({ ...t, family: "sans" });
|
|
8594
8624
|
function write(ink, cls, x, y, text2, style, shown = ALWAYS, anchor) {
|
|
8595
8625
|
ink?.push({ text: text2, rect: textBox(text2, x, y, style, anchor), shown });
|
|
@@ -8616,7 +8646,7 @@ function band(region, ink) {
|
|
|
8616
8646
|
const { x, y } = region.header;
|
|
8617
8647
|
const lines = region.lines.map((t, k) => write(ink, "dg-bz", x, region.y + nameY + k * line, t, TYPE.regionName)).join("");
|
|
8618
8648
|
const note = region.note ? write(ink, "dg-bx", x, region.y + nameY + region.lines.length * line + 1, region.note, TYPE.regionNote) : "";
|
|
8619
|
-
const mark = region.icon
|
|
8649
|
+
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)}` : "";
|
|
8620
8650
|
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>`;
|
|
8621
8651
|
}
|
|
8622
8652
|
function subLines(box, m, changes, y, ink, right) {
|
|
@@ -8636,18 +8666,18 @@ function cardFrame(box, ctx, act, y, h) {
|
|
|
8636
8666
|
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>` : ""}`;
|
|
8637
8667
|
}
|
|
8638
8668
|
function card(box, ctx, on, changes, lit) {
|
|
8639
|
-
const { icon, iconRadius, iconScale, iconY
|
|
8640
|
-
const subs = subLines(box, ctx.m, changes, box.cy +
|
|
8669
|
+
const { icon, iconRadius, iconScale, iconY } = LOOK.box;
|
|
8670
|
+
const subs = subLines(box, ctx.m, changes, box.cy + ctx.boxText.sub, ctx.ink);
|
|
8641
8671
|
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;
|
|
8642
8672
|
const ix = box.iconX ?? box.cx;
|
|
8643
8673
|
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}"/>` : "";
|
|
8644
8674
|
let mark = "";
|
|
8645
|
-
if (box.icon
|
|
8675
|
+
if (drawsIcon(box.icon)) {
|
|
8646
8676
|
const rect = { x: ix - icon / 2, y: box.cy + iconY - icon / 2, w: icon, h: icon };
|
|
8647
8677
|
ctx.ink.push({ text: `${box.name} \u306E\u7D75\u67C4`, rect, shown: ALWAYS, boxed: true, part: { kind: "icon", box: box.name } });
|
|
8648
8678
|
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)}`;
|
|
8649
8679
|
}
|
|
8650
|
-
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 +
|
|
8680
|
+
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>`;
|
|
8651
8681
|
}
|
|
8652
8682
|
function headCard(box, ctx, on, changes) {
|
|
8653
8683
|
const { pad: pad2, h, nameY, subY } = LOOK.follow.head;
|
|
@@ -8660,7 +8690,7 @@ function ghostCard(box, ink) {
|
|
|
8660
8690
|
const G = LOOK.state.ghost;
|
|
8661
8691
|
const ix = box.x + G.pad + icon / 2;
|
|
8662
8692
|
const tx = box.x + G.pad + icon + G.gap;
|
|
8663
|
-
const mark = box.icon
|
|
8693
|
+
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)}` : "";
|
|
8664
8694
|
const nameY = box.sub ? G.nameY : LOOK.baseline.mark;
|
|
8665
8695
|
const sub = box.sub ? write(ink, "dg-ss", tx, box.cy + G.subY, box.sub, TYPE.boxSub, ALWAYS, "start") : "";
|
|
8666
8696
|
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>`;
|
|
@@ -9257,7 +9287,7 @@ function drawSvg(diagram, layout, timeline, palette, theme, follow, ink = [], tr
|
|
|
9257
9287
|
const vars = paletteVars(palette, theme);
|
|
9258
9288
|
const id = nameOf(`${JSON.stringify(diagram)}|${vars}|${follow ? `${follow.width}|${follow.lang}` : ""}`);
|
|
9259
9289
|
const m = new Motion(`dg${id}`, timeline.total, timeline.last);
|
|
9260
|
-
const ctx = { m, t: timeline, id, sh: `filter="url(#dg-sh-${id})"`, end: timeline.steps[timeline.steps.length - 1].end, ink, traces };
|
|
9290
|
+
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) };
|
|
9261
9291
|
const on = involved(diagram);
|
|
9262
9292
|
const subs = subChanges(diagram, timeline, layout.kind !== "sequence");
|
|
9263
9293
|
const L = { band: [], base: [], lit: [], node: [], badge: [], top: [] };
|
|
@@ -11188,7 +11218,7 @@ function simplify(keys2) {
|
|
|
11188
11218
|
}
|
|
11189
11219
|
return out;
|
|
11190
11220
|
}
|
|
11191
|
-
function
|
|
11221
|
+
function valueAt2(keys2, t) {
|
|
11192
11222
|
const first = keys2[0];
|
|
11193
11223
|
if (!first) return 0;
|
|
11194
11224
|
if (t <= first[0]) return first[1];
|
|
@@ -11370,7 +11400,7 @@ function meterField(field, keys2, ctx) {
|
|
|
11370
11400
|
const y = field.y + M.y;
|
|
11371
11401
|
const kf = m.kf([
|
|
11372
11402
|
...simplify(keys2).map(([t, v]) => [t, { transform: `scaleX(${r14(v * 1e3) / 1e3})` }]),
|
|
11373
|
-
[m.last, { transform: `scaleX(${r14(
|
|
11403
|
+
[m.last, { transform: `scaleX(${r14(valueAt2(keys2, m.last) * 1e3) / 1e3})` }, EASE.inOut],
|
|
11374
11404
|
[m.total, { transform: "scaleX(0)" }]
|
|
11375
11405
|
]);
|
|
11376
11406
|
const lx = x + w * line;
|
|
@@ -11378,9 +11408,9 @@ function meterField(field, keys2, ctx) {
|
|
|
11378
11408
|
}
|
|
11379
11409
|
function timeFocus(layout, timeline, step, parts, vw, vh) {
|
|
11380
11410
|
const span = timeline.steps[step];
|
|
11381
|
-
const position =
|
|
11411
|
+
const position = valueAt2(timeline.needle ?? [], span.end - MOTION.still);
|
|
11382
11412
|
const badge2 = layout.badges.find((b) => b.step === step);
|
|
11383
|
-
const anchored = badge2 &&
|
|
11413
|
+
const anchored = badge2 && valueAt2(timeline.needle ?? [], span.start) === position && !(layout.strip && badge2.y >= layout.strip.y);
|
|
11384
11414
|
const ax = anchored ? badge2.x : layout.axis.x + position * layout.axis.unit;
|
|
11385
11415
|
const top = Math.min(...layout.rows.map((r) => r.y));
|
|
11386
11416
|
const bottom = Math.max(...layout.rows.map((r) => r.y + r.h));
|
|
@@ -11962,16 +11992,16 @@ async function film(stage2, plan2) {
|
|
|
11962
11992
|
const delay = gifEvery / fps * 1e3;
|
|
11963
11993
|
const sampled = [];
|
|
11964
11994
|
let colors = [];
|
|
11965
|
-
const
|
|
11995
|
+
const nearest2 = /* @__PURE__ */ new Map();
|
|
11966
11996
|
const toIndex = (data) => {
|
|
11967
11997
|
const index = new Uint8Array(data.length / 4);
|
|
11968
11998
|
for (let p = 0; p < index.length; p++) {
|
|
11969
11999
|
const i = p * 4;
|
|
11970
12000
|
const key = data[i] << 16 | data[i + 1] << 8 | data[i + 2];
|
|
11971
|
-
let k =
|
|
12001
|
+
let k = nearest2.get(key);
|
|
11972
12002
|
if (k === void 0) {
|
|
11973
12003
|
k = gif.nearestColorIndex(colors, [data[i], data[i + 1], data[i + 2]]);
|
|
11974
|
-
|
|
12004
|
+
nearest2.set(key, k);
|
|
11975
12005
|
}
|
|
11976
12006
|
index[p] = k;
|
|
11977
12007
|
}
|
|
@@ -12204,6 +12234,10 @@ function writeOutputs(outDir, name, outputs) {
|
|
|
12204
12234
|
|
|
12205
12235
|
// src/messages.ts
|
|
12206
12236
|
var list = (words) => words.join(" / ");
|
|
12237
|
+
var withNear = (value, near, none) => {
|
|
12238
|
+
const name = nearest(value, ICON_NAMES);
|
|
12239
|
+
return name === void 0 ? none : near(name);
|
|
12240
|
+
};
|
|
12207
12241
|
var ja3 = () => {
|
|
12208
12242
|
const shapes = {
|
|
12209
12243
|
sequence: "sequence <\u984C>",
|
|
@@ -12264,6 +12298,7 @@ var ja3 = () => {
|
|
|
12264
12298
|
attrTwice: (key) => `${key} \u306F 1 \u3064\u306E\u884C\u306B 1 \u3064\u307E\u3067`,
|
|
12265
12299
|
badAttr: (key, allowed) => `${key} \u306F\u3053\u306E\u884C\u306B\u66F8\u3051\u306A\u3044\u5C5E\u6027\u3002\u66F8\u3051\u308B\u306E\u306F ${list(allowed)}`,
|
|
12266
12300
|
badColor: `color \u306F ${list(COLORS)} \u306E\u3069\u308C\u304B`,
|
|
12301
|
+
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`),
|
|
12267
12302
|
badView: `view \u306F ${list(VIEWS)} \u306E\u3069\u308C\u304B`,
|
|
12268
12303
|
badCarry: `carry \u306F ${list(CARRIES)} \u306E\u3069\u308C\u304B\u3002\u672D\u306F tag: <\u5024> \u3067\u66F8\u304F`,
|
|
12269
12304
|
badSide: `side \u306F ${list(SIDES)} \u306E\u3069\u308C\u304B`,
|
|
@@ -12402,6 +12437,7 @@ var en2 = () => {
|
|
|
12402
12437
|
attrTwice: (key) => `Write ${key} only once on a line`,
|
|
12403
12438
|
badAttr: (key, allowed) => `${key} cannot be written on this line. Write ${list(allowed)}`,
|
|
12404
12439
|
badColor: `color is one of ${list(COLORS)}`,
|
|
12440
|
+
badIcon: (value) => withNear(value, (near) => `There is no icon named ${value}. The closest is ${near}`, `icon is one of ${list(ICON_NAMES)}`),
|
|
12405
12441
|
badView: `view is one of ${list(VIEWS)}`,
|
|
12406
12442
|
badCarry: `carry is one of ${list(CARRIES)}. Write a tag as tag: <value>`,
|
|
12407
12443
|
badSide: `side is one of ${list(SIDES)}`,
|
|
@@ -12642,12 +12678,13 @@ function readDeclared(source, word, allowed, m) {
|
|
|
12642
12678
|
function lookOf(source, attrs, m) {
|
|
12643
12679
|
const color = attrs.get("color");
|
|
12644
12680
|
if (color && !isOneOf(COLORS, color.value)) throw fail(source, color.at, m.badColor);
|
|
12681
|
+
const icon = attrs.get("icon");
|
|
12682
|
+
if (icon && !ICON_NAMES.includes(icon.value)) throw fail(source, icon.at, m.badIcon(icon.value));
|
|
12645
12683
|
const note = attrs.get("note")?.value;
|
|
12646
|
-
const icon = attrs.get("icon")?.value;
|
|
12647
12684
|
return {
|
|
12648
12685
|
...note !== void 0 ? { note } : {},
|
|
12649
12686
|
...color ? { color: color.value } : {},
|
|
12650
|
-
...icon
|
|
12687
|
+
...icon ? { icon: icon.value } : {}
|
|
12651
12688
|
};
|
|
12652
12689
|
}
|
|
12653
12690
|
function oldForm(text2, inStep) {
|