@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.
Files changed (69) hide show
  1. package/dist/cli.cjs +97 -104
  2. package/dist/cli.cjs.map +1 -1
  3. package/dist/cli.js +97 -104
  4. package/dist/cli.js.map +1 -1
  5. package/dist/export.cjs +91 -104
  6. package/dist/export.cjs.map +1 -1
  7. package/dist/export.js +91 -104
  8. package/dist/export.js.map +1 -1
  9. package/dist/index.cjs +55 -62
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.js +55 -62
  12. package/dist/index.js.map +1 -1
  13. package/dist/light/chunk-CLS6JVKK.cjs.map +1 -1
  14. package/dist/light/{chunk-EHTQUCW4.js → chunk-DVGDEPCV.js} +6 -2
  15. package/dist/light/chunk-DVGDEPCV.js.map +1 -0
  16. package/dist/light/{chunk-5OQV42W3.cjs → chunk-SUL4AJLI.cjs} +6 -2
  17. package/dist/light/chunk-SUL4AJLI.cjs.map +1 -0
  18. package/dist/light/{chunk-JCEKXALJ.cjs → chunk-V34DCH34.cjs} +90 -87
  19. package/dist/light/chunk-V34DCH34.cjs.map +1 -0
  20. package/dist/light/{chunk-YEQSLVIN.js → chunk-YO3UBEC3.js} +12 -9
  21. package/dist/light/chunk-YO3UBEC3.js.map +1 -0
  22. package/dist/light/{git-K3KAAAWW.cjs → git-WBGFDRBD.cjs} +59 -59
  23. package/dist/light/git-WBGFDRBD.cjs.map +1 -0
  24. package/dist/light/{git-GESUYKGR.js → git-WEJL6VAY.js} +3 -3
  25. package/dist/light/index.cjs +358 -372
  26. package/dist/light/index.cjs.map +1 -1
  27. package/dist/light/index.js +43 -57
  28. package/dist/light/index.js.map +1 -1
  29. package/dist/light/{lineup-2V2U7HZH.js → lineup-6LN6Z5T2.js} +3 -3
  30. package/dist/light/{lineup-623J25LU.cjs → lineup-WLGNGTFX.cjs} +40 -40
  31. package/dist/light/lineup-WLGNGTFX.cjs.map +1 -0
  32. package/dist/light/{state-T4OTVING.js → state-DFYTMQI7.js} +2 -2
  33. package/dist/light/{state-OZVCHX7H.cjs → state-JVAH4TSM.cjs} +41 -41
  34. package/dist/light/state-JVAH4TSM.cjs.map +1 -0
  35. package/dist/light/{time-PQCPVQOE.cjs → time-EXRPI34B.cjs} +90 -88
  36. package/dist/light/time-EXRPI34B.cjs.map +1 -0
  37. package/dist/light/{time-6WEMD4FQ.js → time-M3EGEFDU.js} +10 -8
  38. package/dist/light/{time-6WEMD4FQ.js.map → time-M3EGEFDU.js.map} +1 -1
  39. package/dist/light/{tree-6D7KI57H.cjs → tree-DECHTXFU.cjs} +62 -62
  40. package/dist/light/tree-DECHTXFU.cjs.map +1 -0
  41. package/dist/light/{tree-ZJZQI5QT.js → tree-MFU54QKY.js} +3 -3
  42. package/dist/node.cjs +27 -48
  43. package/dist/node.cjs.map +1 -1
  44. package/dist/node.js +27 -48
  45. package/dist/node.js.map +1 -1
  46. package/dist/player.global.js +3 -3
  47. package/package.json +1 -1
  48. package/src/look/values.ts +5 -1
  49. package/src/messages.ts +4 -1
  50. package/src/parser.ts +4 -2
  51. package/src/render/draw.ts +2 -1
  52. package/src/render/parts.ts +28 -7
  53. package/src/render/time.ts +13 -6
  54. package/src/schema.ts +6 -0
  55. package/src/schemas/diagram.schema.json +3 -2
  56. package/src/schemas/validate-diagram.js +1 -1
  57. package/dist/light/chunk-5OQV42W3.cjs.map +0 -1
  58. package/dist/light/chunk-EHTQUCW4.js.map +0 -1
  59. package/dist/light/chunk-JCEKXALJ.cjs.map +0 -1
  60. package/dist/light/chunk-YEQSLVIN.js.map +0 -1
  61. package/dist/light/git-K3KAAAWW.cjs.map +0 -1
  62. package/dist/light/lineup-623J25LU.cjs.map +0 -1
  63. package/dist/light/state-OZVCHX7H.cjs.map +0 -1
  64. package/dist/light/time-PQCPVQOE.cjs.map +0 -1
  65. package/dist/light/tree-6D7KI57H.cjs.map +0 -1
  66. /package/dist/light/{git-GESUYKGR.js.map → git-WEJL6VAY.js.map} +0 -0
  67. /package/dist/light/{lineup-2V2U7HZH.js.map → lineup-6LN6Z5T2.js.map} +0 -0
  68. /package/dist/light/{state-T4OTVING.js.map → state-DFYTMQI7.js.map} +0 -0
  69. /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
- box: { h: 72, minW: 92, padX: 12, radius: 12, icon: 24, iconRadius: 7, iconY: -16, iconScale: 0.74, nameY: 12, subY: 27 },
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
  /**
@@ -1717,6 +1721,48 @@ var en = {
1717
1721
  };
1718
1722
  var FIELD_MESSAGES = { ja, en };
1719
1723
 
1724
+ // src/render/icons.ts
1725
+ var ICONS = {
1726
+ 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",
1727
+ 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",
1728
+ on: "M -7 7 L 7 -7 M -1 -7 h8 v8",
1729
+ off: "M -7 -7 L 7 7 M 7 -1 v8 h-8",
1730
+ 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",
1731
+ 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",
1732
+ exe: "M -5 -8 L 7 0 L -5 8 Z",
1733
+ idx: "M -9 -7 h18 M -9 -2 h18 M -9 3 h18 M -9 8 h11",
1734
+ sign: "M -9 4 c 3 -9 5 -9 6 0 s 3 7 6 -2 s 3 -6 6 0",
1735
+ env: "M -8 -5.5 h16 v11 h-16 z M -8 -5.5 l8 6 l8 -6",
1736
+ 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",
1737
+ check: "M -5 0 l3.5 3.5 l6.5 -7",
1738
+ flag: "M -4 8 V -8 M -4 -7 H 6 L 3.5 -3.5 L 6 0 H -4",
1739
+ x: "M -5 -5 l10 10 M 5 -5 l-10 10",
1740
+ 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",
1741
+ 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",
1742
+ 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",
1743
+ 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",
1744
+ 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",
1745
+ 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",
1746
+ 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",
1747
+ bolt: "M 2 -9 L -5 1 h5 l-2 8 l7 -10 h-5 z",
1748
+ doc: "M -6 -9 h8 l5 5 v13 h-13 z M 2 -9 v5 h5 M -3 1 h7 M -3 5 h5",
1749
+ 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",
1750
+ 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",
1751
+ 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",
1752
+ 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",
1753
+ 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",
1754
+ 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",
1755
+ 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",
1756
+ refresh: "M 7 -3 a7.5 7.5 0 1 0 0.5 5 M 7.5 -8 v5 h-5",
1757
+ undo: "M -7 -2 h10 a5 5 0 0 1 0 10 h-6 M -3 -6 l-4 4 l4 4",
1758
+ yen: "M -6 -8 l6 7 l6 -7 M 0 -1 v9 M -5 1.5 h10 M -5 5 h10",
1759
+ 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",
1760
+ code: "M -4 -6 l-5 6 l5 6 M 4 -6 l5 6 l-5 6",
1761
+ 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",
1762
+ 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",
1763
+ 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"
1764
+ };
1765
+
1720
1766
  // src/schemas/validate-diagram.js
1721
1767
  function ucs2length(str) {
1722
1768
  let length = 0;
@@ -2675,6 +2721,7 @@ function validate25(data, { instancePath = "", parentData, parentDataProperty, r
2675
2721
  return errors === 0;
2676
2722
  }
2677
2723
  var schema79 = { "enum": ["blue", "amber", "green", "violet", "rose", "slate", "coin"] };
2724
+ 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
2725
  var pattern0 = new RegExp("^[^\\s\\[\\]\u300C\u300D=:]+$", "u");
2679
2726
  var func3 = ucs2length;
2680
2727
  function validate30(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
@@ -2790,32 +2837,22 @@ function validate30(data, { instancePath = "", parentData, parentDataProperty, r
2790
2837
  }
2791
2838
  if (data.icon !== void 0) {
2792
2839
  let data4 = data.icon;
2793
- if (typeof data4 === "string") {
2794
- if (func3(data4) < 1) {
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" };
2840
+ 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")) {
2841
+ 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
2842
  if (vErrors === null) {
2806
- vErrors = [err11];
2843
+ vErrors = [err10];
2807
2844
  } else {
2808
- vErrors.push(err11);
2845
+ vErrors.push(err10);
2809
2846
  }
2810
2847
  errors++;
2811
2848
  }
2812
2849
  }
2813
2850
  } else {
2814
- const err12 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2851
+ const err11 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2815
2852
  if (vErrors === null) {
2816
- vErrors = [err12];
2853
+ vErrors = [err11];
2817
2854
  } else {
2818
- vErrors.push(err12);
2855
+ vErrors.push(err11);
2819
2856
  }
2820
2857
  errors++;
2821
2858
  }
@@ -2936,22 +2973,12 @@ function validate32(data, { instancePath = "", parentData, parentDataProperty, r
2936
2973
  }
2937
2974
  if (data.icon !== void 0) {
2938
2975
  let data4 = data.icon;
2939
- if (typeof data4 === "string") {
2940
- if (func3(data4) < 1) {
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" };
2976
+ 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")) {
2977
+ 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
2978
  if (vErrors === null) {
2952
- vErrors = [err11];
2979
+ vErrors = [err10];
2953
2980
  } else {
2954
- vErrors.push(err11);
2981
+ vErrors.push(err10);
2955
2982
  }
2956
2983
  errors++;
2957
2984
  }
@@ -2960,20 +2987,20 @@ function validate32(data, { instancePath = "", parentData, parentDataProperty, r
2960
2987
  let data5 = data.region;
2961
2988
  if (typeof data5 === "string") {
2962
2989
  if (!pattern0.test(data5)) {
2963
- const err12 = { instancePath: instancePath + "/region", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
2990
+ const err11 = { instancePath: instancePath + "/region", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
2964
2991
  if (vErrors === null) {
2965
- vErrors = [err12];
2992
+ vErrors = [err11];
2966
2993
  } else {
2967
- vErrors.push(err12);
2994
+ vErrors.push(err11);
2968
2995
  }
2969
2996
  errors++;
2970
2997
  }
2971
2998
  } else {
2972
- const err13 = { instancePath: instancePath + "/region", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2999
+ const err12 = { instancePath: instancePath + "/region", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2973
3000
  if (vErrors === null) {
2974
- vErrors = [err13];
3001
+ vErrors = [err12];
2975
3002
  } else {
2976
- vErrors.push(err13);
3003
+ vErrors.push(err12);
2977
3004
  }
2978
3005
  errors++;
2979
3006
  }
@@ -2982,30 +3009,30 @@ function validate32(data, { instancePath = "", parentData, parentDataProperty, r
2982
3009
  let data6 = data.link;
2983
3010
  if (typeof data6 === "string") {
2984
3011
  if (!pattern3.test(data6)) {
2985
- const err14 = { instancePath: instancePath + "/link", schemaPath: "#/definitions/url/pattern", keyword: "pattern", params: { pattern: "^(/|https?://)" }, message: 'must match pattern "^(/|https?://)"' };
3012
+ const err13 = { instancePath: instancePath + "/link", schemaPath: "#/definitions/url/pattern", keyword: "pattern", params: { pattern: "^(/|https?://)" }, message: 'must match pattern "^(/|https?://)"' };
2986
3013
  if (vErrors === null) {
2987
- vErrors = [err14];
3014
+ vErrors = [err13];
2988
3015
  } else {
2989
- vErrors.push(err14);
3016
+ vErrors.push(err13);
2990
3017
  }
2991
3018
  errors++;
2992
3019
  }
2993
3020
  } else {
2994
- const err15 = { instancePath: instancePath + "/link", schemaPath: "#/definitions/url/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3021
+ const err14 = { instancePath: instancePath + "/link", schemaPath: "#/definitions/url/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2995
3022
  if (vErrors === null) {
2996
- vErrors = [err15];
3023
+ vErrors = [err14];
2997
3024
  } else {
2998
- vErrors.push(err15);
3025
+ vErrors.push(err14);
2999
3026
  }
3000
3027
  errors++;
3001
3028
  }
3002
3029
  }
3003
3030
  } else {
3004
- const err16 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
3031
+ const err15 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
3005
3032
  if (vErrors === null) {
3006
- vErrors = [err16];
3033
+ vErrors = [err15];
3007
3034
  } else {
3008
- vErrors.push(err16);
3035
+ vErrors.push(err15);
3009
3036
  }
3010
3037
  errors++;
3011
3038
  }
@@ -8112,6 +8139,7 @@ var OLD_HEADS = {
8112
8139
 
8113
8140
  // src/schema.ts
8114
8141
  var COLORS = ["blue", "amber", "green", "violet", "rose", "slate", "coin"];
8142
+ var ICON_NAMES = Object.keys(ICONS);
8115
8143
  var EVENT_TYPES = ["edge", "action", "swap", "strip", "commit", "branch", "now", "mark", "span", "leaf", "node", "line", "seal", "open", "pick", "stamp"];
8116
8144
  var ABSENT = "#/definitions/absent/not";
8117
8145
  var ABSENT_KINDS = {
@@ -8485,48 +8513,6 @@ function stateTimes(diagram, edges, last) {
8485
8513
  return [...times.values()];
8486
8514
  }
8487
8515
 
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
8516
  // src/render/ink.ts
8531
8517
  var ALWAYS = [[0, Number.POSITIVE_INFINITY]];
8532
8518
  var BITE = 0.5;
@@ -8565,7 +8551,7 @@ var linkTo = (link, markup) => link === void 0 ? markup : `<a href="${esc(link)}
8565
8551
  var r1 = (v) => Math.round(v * 100) / 100;
8566
8552
  var cs = (k) => k === "coin" ? "--c:var(--coin);--ct:var(--coint)" : `--c:var(--c-${k});--ct:var(--t-${k})`;
8567
8553
  function glyph(name, x, y, scale, cls = "dg-gl") {
8568
- const d = name === void 0 ? void 0 : ICONS[name];
8554
+ const d = name !== void 0 && drawsIcon(name) ? ICONS[name] : void 0;
8569
8555
  return d ? `<path class="${cls}" transform="translate(${r1(x)} ${r1(y)}) scale(${scale})" d="${d}"/>` : "";
8570
8556
  }
8571
8557
  function pathOf(points) {
@@ -8596,6 +8582,8 @@ function arrowHead(points) {
8596
8582
  const { arrow: a, arrowHalf: h } = LOOK.edge;
8597
8583
  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
8584
  }
8585
+ var drawsIcon = (name) => name !== void 0 && Object.hasOwn(ICONS, name);
8586
+ 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
8587
  var sansOf = (t) => ({ ...t, family: "sans" });
8600
8588
  function write(ink, cls, x, y, text2, style, shown = ALWAYS, anchor) {
8601
8589
  ink?.push({ text: text2, rect: textBox(text2, x, y, style, anchor), shown });
@@ -8622,7 +8610,7 @@ function band(region, ink) {
8622
8610
  const { x, y } = region.header;
8623
8611
  const lines = region.lines.map((t, k) => write(ink, "dg-bz", x, region.y + nameY + k * line, t, TYPE.regionName)).join("");
8624
8612
  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 && ICONS[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)}` : "";
8613
+ 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
8614
  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
8615
  }
8628
8616
  function subLines(box, m, changes, y, ink, right) {
@@ -8642,18 +8630,18 @@ function cardFrame(box, ctx, act, y, h) {
8642
8630
  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
8631
  }
8644
8632
  function card(box, ctx, on, changes, lit) {
8645
- const { icon, iconRadius, iconScale, iconY, nameY, subY } = LOOK.box;
8646
- const subs = subLines(box, ctx.m, changes, box.cy + subY, ctx.ink);
8633
+ const { icon, iconRadius, iconScale, iconY } = LOOK.box;
8634
+ const subs = subLines(box, ctx.m, changes, box.cy + ctx.boxText.sub, ctx.ink);
8647
8635
  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
8636
  const ix = box.iconX ?? box.cx;
8649
8637
  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
8638
  let mark = "";
8651
- if (box.icon && ICONS[box.icon]) {
8639
+ if (drawsIcon(box.icon)) {
8652
8640
  const rect = { x: ix - icon / 2, y: box.cy + iconY - icon / 2, w: icon, h: icon };
8653
8641
  ctx.ink.push({ text: `${box.name} \u306E\u7D75\u67C4`, rect, shown: ALWAYS, boxed: true, part: { kind: "icon", box: box.name } });
8654
8642
  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
8643
  }
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 + nameY, box.name, TYPE.boxName, ALWAYS, "middle")}${subs}</g>`;
8644
+ 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
8645
  }
8658
8646
  function headCard(box, ctx, on, changes) {
8659
8647
  const { pad: pad2, h, nameY, subY } = LOOK.follow.head;
@@ -8666,7 +8654,7 @@ function ghostCard(box, ink) {
8666
8654
  const G = LOOK.state.ghost;
8667
8655
  const ix = box.x + G.pad + icon / 2;
8668
8656
  const tx = box.x + G.pad + icon + G.gap;
8669
- const mark = box.icon && ICONS[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)}` : "";
8657
+ 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
8658
  const nameY = box.sub ? G.nameY : LOOK.baseline.mark;
8671
8659
  const sub = box.sub ? write(ink, "dg-ss", tx, box.cy + G.subY, box.sub, TYPE.boxSub, ALWAYS, "start") : "";
8672
8660
  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 +9251,7 @@ function drawSvg(diagram, layout, timeline, palette, theme, follow, ink = [], tr
9263
9251
  const vars = paletteVars(palette, theme);
9264
9252
  const id = nameOf(`${JSON.stringify(diagram)}|${vars}|${follow ? `${follow.width}|${follow.lang}` : ""}`);
9265
9253
  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 };
9254
+ 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
9255
  const on = involved(diagram);
9268
9256
  const subs = subChanges(diagram, timeline, layout.kind !== "sequence");
9269
9257
  const L = { band: [], base: [], lit: [], node: [], badge: [], top: [] };
@@ -11385,13 +11373,15 @@ function meterField(field, keys2, ctx) {
11385
11373
  function timeFocus(layout, timeline, step, parts, vw, vh) {
11386
11374
  const span = timeline.steps[step];
11387
11375
  const position = valueAt(timeline.needle ?? [], span.end - MOTION.still);
11388
- const nx = layout.axis.x + position * layout.axis.unit;
11376
+ const badge2 = layout.badges.find((b) => b.step === step);
11377
+ const anchored = badge2 && valueAt(timeline.needle ?? [], span.start) === position && !(layout.strip && badge2.y >= layout.strip.y);
11378
+ const ax = anchored ? badge2.x : layout.axis.x + position * layout.axis.unit;
11389
11379
  const top = Math.min(...layout.rows.map((r) => r.y));
11390
11380
  const bottom = Math.max(...layout.rows.map((r) => r.y + r.h));
11391
- let held = { x: nx - 1, y: top, w: 2, h: bottom - top };
11392
- const badge2 = layout.badges.find((b) => b.step === step);
11393
- const near = (p) => Math.hypot(Math.max(0, p.x - nx, nx - p.x - p.w), Math.max(0, p.y - top, top - p.y - p.h));
11394
- const extra = [...badge2 ? [{ x: badge2.x - LOOK.badge.r, y: badge2.y - LOOK.badge.r, w: LOOK.badge.r * 2, h: LOOK.badge.r * 2 }] : [], ...[...parts].sort((a, b) => near(a) - near(b))];
11381
+ let held = { x: ax - 1, y: top, w: 2, h: bottom - top };
11382
+ const near = (p) => Math.hypot(Math.max(0, p.x - ax, ax - p.x - p.w), Math.max(0, p.y - top, top - p.y - p.h));
11383
+ 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 }));
11384
+ const extra = [...badge2 ? [{ x: badge2.x - LOOK.badge.r, y: badge2.y - LOOK.badge.r, w: LOOK.badge.r * 2, h: LOOK.badge.r * 2 }] : [], ...[...parts, ...changed].sort((a, b) => near(a) - near(b))];
11395
11385
  for (const p of extra) {
11396
11386
  const x = Math.min(held.x, p.x);
11397
11387
  const y = Math.min(held.y, p.y);
@@ -12268,6 +12258,7 @@ var ja3 = () => {
12268
12258
  attrTwice: (key) => `${key} \u306F 1 \u3064\u306E\u884C\u306B 1 \u3064\u307E\u3067`,
12269
12259
  badAttr: (key, allowed) => `${key} \u306F\u3053\u306E\u884C\u306B\u66F8\u3051\u306A\u3044\u5C5E\u6027\u3002\u66F8\u3051\u308B\u306E\u306F ${list(allowed)}`,
12270
12260
  badColor: `color \u306F ${list(COLORS)} \u306E\u3069\u308C\u304B`,
12261
+ badIcon: `icon \u306F ${list(ICON_NAMES)} \u306E\u3069\u308C\u304B`,
12271
12262
  badView: `view \u306F ${list(VIEWS)} \u306E\u3069\u308C\u304B`,
12272
12263
  badCarry: `carry \u306F ${list(CARRIES)} \u306E\u3069\u308C\u304B\u3002\u672D\u306F tag: <\u5024> \u3067\u66F8\u304F`,
12273
12264
  badSide: `side \u306F ${list(SIDES)} \u306E\u3069\u308C\u304B`,
@@ -12406,6 +12397,7 @@ var en2 = () => {
12406
12397
  attrTwice: (key) => `Write ${key} only once on a line`,
12407
12398
  badAttr: (key, allowed) => `${key} cannot be written on this line. Write ${list(allowed)}`,
12408
12399
  badColor: `color is one of ${list(COLORS)}`,
12400
+ badIcon: `icon is one of ${list(ICON_NAMES)}`,
12409
12401
  badView: `view is one of ${list(VIEWS)}`,
12410
12402
  badCarry: `carry is one of ${list(CARRIES)}. Write a tag as tag: <value>`,
12411
12403
  badSide: `side is one of ${list(SIDES)}`,
@@ -12646,12 +12638,13 @@ function readDeclared(source, word, allowed, m) {
12646
12638
  function lookOf(source, attrs, m) {
12647
12639
  const color = attrs.get("color");
12648
12640
  if (color && !isOneOf(COLORS, color.value)) throw fail(source, color.at, m.badColor);
12641
+ const icon = attrs.get("icon");
12642
+ if (icon && !ICON_NAMES.includes(icon.value)) throw fail(source, icon.at, m.badIcon);
12649
12643
  const note = attrs.get("note")?.value;
12650
- const icon = attrs.get("icon")?.value;
12651
12644
  return {
12652
12645
  ...note !== void 0 ? { note } : {},
12653
12646
  ...color ? { color: color.value } : {},
12654
- ...icon !== void 0 ? { icon } : {}
12647
+ ...icon ? { icon: icon.value } : {}
12655
12648
  };
12656
12649
  }
12657
12650
  function oldForm(text2, inStep) {