@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.js CHANGED
@@ -319,7 +319,11 @@ var LOOK = {
319
319
  gap: 10,
320
320
  /** 図の外周の余白 */
321
321
  margin: 14,
322
- box: { h: 72, minW: 92, padX: 12, radius: 12, icon: 24, iconRadius: 7, iconY: -16, iconScale: 0.74, nameY: 12, subY: 27 },
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
  /**
@@ -1711,6 +1715,48 @@ var en = {
1711
1715
  };
1712
1716
  var FIELD_MESSAGES = { ja, en };
1713
1717
 
1718
+ // src/render/icons.ts
1719
+ var ICONS = {
1720
+ 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",
1721
+ 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",
1722
+ on: "M -7 7 L 7 -7 M -1 -7 h8 v8",
1723
+ off: "M -7 -7 L 7 7 M 7 -1 v8 h-8",
1724
+ 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",
1725
+ 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",
1726
+ exe: "M -5 -8 L 7 0 L -5 8 Z",
1727
+ idx: "M -9 -7 h18 M -9 -2 h18 M -9 3 h18 M -9 8 h11",
1728
+ sign: "M -9 4 c 3 -9 5 -9 6 0 s 3 7 6 -2 s 3 -6 6 0",
1729
+ env: "M -8 -5.5 h16 v11 h-16 z M -8 -5.5 l8 6 l8 -6",
1730
+ 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",
1731
+ check: "M -5 0 l3.5 3.5 l6.5 -7",
1732
+ flag: "M -4 8 V -8 M -4 -7 H 6 L 3.5 -3.5 L 6 0 H -4",
1733
+ x: "M -5 -5 l10 10 M 5 -5 l-10 10",
1734
+ 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",
1735
+ 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",
1736
+ 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",
1737
+ 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",
1738
+ 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",
1739
+ 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",
1740
+ 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",
1741
+ bolt: "M 2 -9 L -5 1 h5 l-2 8 l7 -10 h-5 z",
1742
+ doc: "M -6 -9 h8 l5 5 v13 h-13 z M 2 -9 v5 h5 M -3 1 h7 M -3 5 h5",
1743
+ 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",
1744
+ 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",
1745
+ 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",
1746
+ 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",
1747
+ 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",
1748
+ 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",
1749
+ 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",
1750
+ refresh: "M 7 -3 a7.5 7.5 0 1 0 0.5 5 M 7.5 -8 v5 h-5",
1751
+ undo: "M -7 -2 h10 a5 5 0 0 1 0 10 h-6 M -3 -6 l-4 4 l4 4",
1752
+ yen: "M -6 -8 l6 7 l6 -7 M 0 -1 v9 M -5 1.5 h10 M -5 5 h10",
1753
+ 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",
1754
+ code: "M -4 -6 l-5 6 l5 6 M 4 -6 l5 6 l-5 6",
1755
+ 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",
1756
+ 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",
1757
+ 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"
1758
+ };
1759
+
1714
1760
  // src/schemas/validate-diagram.js
1715
1761
  function ucs2length(str) {
1716
1762
  let length = 0;
@@ -2669,6 +2715,7 @@ function validate25(data, { instancePath = "", parentData, parentDataProperty, r
2669
2715
  return errors === 0;
2670
2716
  }
2671
2717
  var schema79 = { "enum": ["blue", "amber", "green", "violet", "rose", "slate", "coin"] };
2718
+ 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
2719
  var pattern0 = new RegExp("^[^\\s\\[\\]\u300C\u300D=:]+$", "u");
2673
2720
  var func3 = ucs2length;
2674
2721
  function validate30(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
@@ -2784,32 +2831,22 @@ function validate30(data, { instancePath = "", parentData, parentDataProperty, r
2784
2831
  }
2785
2832
  if (data.icon !== void 0) {
2786
2833
  let data4 = data.icon;
2787
- if (typeof data4 === "string") {
2788
- if (func3(data4) < 1) {
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" };
2834
+ 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")) {
2835
+ 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
2836
  if (vErrors === null) {
2800
- vErrors = [err11];
2837
+ vErrors = [err10];
2801
2838
  } else {
2802
- vErrors.push(err11);
2839
+ vErrors.push(err10);
2803
2840
  }
2804
2841
  errors++;
2805
2842
  }
2806
2843
  }
2807
2844
  } else {
2808
- const err12 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2845
+ const err11 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2809
2846
  if (vErrors === null) {
2810
- vErrors = [err12];
2847
+ vErrors = [err11];
2811
2848
  } else {
2812
- vErrors.push(err12);
2849
+ vErrors.push(err11);
2813
2850
  }
2814
2851
  errors++;
2815
2852
  }
@@ -2930,22 +2967,12 @@ function validate32(data, { instancePath = "", parentData, parentDataProperty, r
2930
2967
  }
2931
2968
  if (data.icon !== void 0) {
2932
2969
  let data4 = data.icon;
2933
- if (typeof data4 === "string") {
2934
- if (func3(data4) < 1) {
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" };
2970
+ 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")) {
2971
+ 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
2972
  if (vErrors === null) {
2946
- vErrors = [err11];
2973
+ vErrors = [err10];
2947
2974
  } else {
2948
- vErrors.push(err11);
2975
+ vErrors.push(err10);
2949
2976
  }
2950
2977
  errors++;
2951
2978
  }
@@ -2954,20 +2981,20 @@ function validate32(data, { instancePath = "", parentData, parentDataProperty, r
2954
2981
  let data5 = data.region;
2955
2982
  if (typeof data5 === "string") {
2956
2983
  if (!pattern0.test(data5)) {
2957
- const err12 = { instancePath: instancePath + "/region", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
2984
+ const err11 = { instancePath: instancePath + "/region", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
2958
2985
  if (vErrors === null) {
2959
- vErrors = [err12];
2986
+ vErrors = [err11];
2960
2987
  } else {
2961
- vErrors.push(err12);
2988
+ vErrors.push(err11);
2962
2989
  }
2963
2990
  errors++;
2964
2991
  }
2965
2992
  } else {
2966
- const err13 = { instancePath: instancePath + "/region", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2993
+ const err12 = { instancePath: instancePath + "/region", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2967
2994
  if (vErrors === null) {
2968
- vErrors = [err13];
2995
+ vErrors = [err12];
2969
2996
  } else {
2970
- vErrors.push(err13);
2997
+ vErrors.push(err12);
2971
2998
  }
2972
2999
  errors++;
2973
3000
  }
@@ -2976,30 +3003,30 @@ function validate32(data, { instancePath = "", parentData, parentDataProperty, r
2976
3003
  let data6 = data.link;
2977
3004
  if (typeof data6 === "string") {
2978
3005
  if (!pattern3.test(data6)) {
2979
- const err14 = { instancePath: instancePath + "/link", schemaPath: "#/definitions/url/pattern", keyword: "pattern", params: { pattern: "^(/|https?://)" }, message: 'must match pattern "^(/|https?://)"' };
3006
+ const err13 = { instancePath: instancePath + "/link", schemaPath: "#/definitions/url/pattern", keyword: "pattern", params: { pattern: "^(/|https?://)" }, message: 'must match pattern "^(/|https?://)"' };
2980
3007
  if (vErrors === null) {
2981
- vErrors = [err14];
3008
+ vErrors = [err13];
2982
3009
  } else {
2983
- vErrors.push(err14);
3010
+ vErrors.push(err13);
2984
3011
  }
2985
3012
  errors++;
2986
3013
  }
2987
3014
  } else {
2988
- const err15 = { instancePath: instancePath + "/link", schemaPath: "#/definitions/url/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3015
+ const err14 = { instancePath: instancePath + "/link", schemaPath: "#/definitions/url/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2989
3016
  if (vErrors === null) {
2990
- vErrors = [err15];
3017
+ vErrors = [err14];
2991
3018
  } else {
2992
- vErrors.push(err15);
3019
+ vErrors.push(err14);
2993
3020
  }
2994
3021
  errors++;
2995
3022
  }
2996
3023
  }
2997
3024
  } else {
2998
- const err16 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
3025
+ const err15 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2999
3026
  if (vErrors === null) {
3000
- vErrors = [err16];
3027
+ vErrors = [err15];
3001
3028
  } else {
3002
- vErrors.push(err16);
3029
+ vErrors.push(err15);
3003
3030
  }
3004
3031
  errors++;
3005
3032
  }
@@ -8106,6 +8133,7 @@ var OLD_HEADS = {
8106
8133
 
8107
8134
  // src/schema.ts
8108
8135
  var COLORS = ["blue", "amber", "green", "violet", "rose", "slate", "coin"];
8136
+ var ICON_NAMES = Object.keys(ICONS);
8109
8137
  var EVENT_TYPES = ["edge", "action", "swap", "strip", "commit", "branch", "now", "mark", "span", "leaf", "node", "line", "seal", "open", "pick", "stamp"];
8110
8138
  var ABSENT = "#/definitions/absent/not";
8111
8139
  var ABSENT_KINDS = {
@@ -8479,48 +8507,6 @@ function stateTimes(diagram, edges, last) {
8479
8507
  return [...times.values()];
8480
8508
  }
8481
8509
 
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
8510
  // src/render/ink.ts
8525
8511
  var ALWAYS = [[0, Number.POSITIVE_INFINITY]];
8526
8512
  var BITE = 0.5;
@@ -8559,7 +8545,7 @@ var linkTo = (link, markup) => link === void 0 ? markup : `<a href="${esc(link)}
8559
8545
  var r1 = (v) => Math.round(v * 100) / 100;
8560
8546
  var cs = (k) => k === "coin" ? "--c:var(--coin);--ct:var(--coint)" : `--c:var(--c-${k});--ct:var(--t-${k})`;
8561
8547
  function glyph(name, x, y, scale, cls = "dg-gl") {
8562
- const d = name === void 0 ? void 0 : ICONS[name];
8548
+ const d = name !== void 0 && drawsIcon(name) ? ICONS[name] : void 0;
8563
8549
  return d ? `<path class="${cls}" transform="translate(${r1(x)} ${r1(y)}) scale(${scale})" d="${d}"/>` : "";
8564
8550
  }
8565
8551
  function pathOf(points) {
@@ -8590,6 +8576,8 @@ function arrowHead(points) {
8590
8576
  const { arrow: a, arrowHalf: h } = LOOK.edge;
8591
8577
  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
8578
  }
8579
+ var drawsIcon = (name) => name !== void 0 && Object.hasOwn(ICONS, name);
8580
+ 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
8581
  var sansOf = (t) => ({ ...t, family: "sans" });
8594
8582
  function write(ink, cls, x, y, text2, style, shown = ALWAYS, anchor) {
8595
8583
  ink?.push({ text: text2, rect: textBox(text2, x, y, style, anchor), shown });
@@ -8616,7 +8604,7 @@ function band(region, ink) {
8616
8604
  const { x, y } = region.header;
8617
8605
  const lines = region.lines.map((t, k) => write(ink, "dg-bz", x, region.y + nameY + k * line, t, TYPE.regionName)).join("");
8618
8606
  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 && 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)}` : "";
8607
+ 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
8608
  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
8609
  }
8622
8610
  function subLines(box, m, changes, y, ink, right) {
@@ -8636,18 +8624,18 @@ function cardFrame(box, ctx, act, y, h) {
8636
8624
  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
8625
  }
8638
8626
  function card(box, ctx, on, changes, lit) {
8639
- const { icon, iconRadius, iconScale, iconY, nameY, subY } = LOOK.box;
8640
- const subs = subLines(box, ctx.m, changes, box.cy + subY, ctx.ink);
8627
+ const { icon, iconRadius, iconScale, iconY } = LOOK.box;
8628
+ const subs = subLines(box, ctx.m, changes, box.cy + ctx.boxText.sub, ctx.ink);
8641
8629
  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
8630
  const ix = box.iconX ?? box.cx;
8643
8631
  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
8632
  let mark = "";
8645
- if (box.icon && ICONS[box.icon]) {
8633
+ if (drawsIcon(box.icon)) {
8646
8634
  const rect = { x: ix - icon / 2, y: box.cy + iconY - icon / 2, w: icon, h: icon };
8647
8635
  ctx.ink.push({ text: `${box.name} \u306E\u7D75\u67C4`, rect, shown: ALWAYS, boxed: true, part: { kind: "icon", box: box.name } });
8648
8636
  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
8637
  }
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 + nameY, box.name, TYPE.boxName, ALWAYS, "middle")}${subs}</g>`;
8638
+ 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
8639
  }
8652
8640
  function headCard(box, ctx, on, changes) {
8653
8641
  const { pad: pad2, h, nameY, subY } = LOOK.follow.head;
@@ -8660,7 +8648,7 @@ function ghostCard(box, ink) {
8660
8648
  const G = LOOK.state.ghost;
8661
8649
  const ix = box.x + G.pad + icon / 2;
8662
8650
  const tx = box.x + G.pad + icon + G.gap;
8663
- 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)}` : "";
8651
+ 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
8652
  const nameY = box.sub ? G.nameY : LOOK.baseline.mark;
8665
8653
  const sub = box.sub ? write(ink, "dg-ss", tx, box.cy + G.subY, box.sub, TYPE.boxSub, ALWAYS, "start") : "";
8666
8654
  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 +9245,7 @@ function drawSvg(diagram, layout, timeline, palette, theme, follow, ink = [], tr
9257
9245
  const vars = paletteVars(palette, theme);
9258
9246
  const id = nameOf(`${JSON.stringify(diagram)}|${vars}|${follow ? `${follow.width}|${follow.lang}` : ""}`);
9259
9247
  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 };
9248
+ 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
9249
  const on = involved(diagram);
9262
9250
  const subs = subChanges(diagram, timeline, layout.kind !== "sequence");
9263
9251
  const L = { band: [], base: [], lit: [], node: [], badge: [], top: [] };
@@ -11379,13 +11367,15 @@ function meterField(field, keys2, ctx) {
11379
11367
  function timeFocus(layout, timeline, step, parts, vw, vh) {
11380
11368
  const span = timeline.steps[step];
11381
11369
  const position = valueAt(timeline.needle ?? [], span.end - MOTION.still);
11382
- const nx = layout.axis.x + position * layout.axis.unit;
11370
+ const badge2 = layout.badges.find((b) => b.step === step);
11371
+ const anchored = badge2 && valueAt(timeline.needle ?? [], span.start) === position && !(layout.strip && badge2.y >= layout.strip.y);
11372
+ const ax = anchored ? badge2.x : layout.axis.x + position * layout.axis.unit;
11383
11373
  const top = Math.min(...layout.rows.map((r) => r.y));
11384
11374
  const bottom = Math.max(...layout.rows.map((r) => r.y + r.h));
11385
- let held = { x: nx - 1, y: top, w: 2, h: bottom - top };
11386
- const badge2 = layout.badges.find((b) => b.step === step);
11387
- 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));
11388
- 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))];
11375
+ let held = { x: ax - 1, y: top, w: 2, h: bottom - top };
11376
+ 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));
11377
+ 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 }));
11378
+ 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))];
11389
11379
  for (const p of extra) {
11390
11380
  const x = Math.min(held.x, p.x);
11391
11381
  const y = Math.min(held.y, p.y);
@@ -12262,6 +12252,7 @@ var ja3 = () => {
12262
12252
  attrTwice: (key) => `${key} \u306F 1 \u3064\u306E\u884C\u306B 1 \u3064\u307E\u3067`,
12263
12253
  badAttr: (key, allowed) => `${key} \u306F\u3053\u306E\u884C\u306B\u66F8\u3051\u306A\u3044\u5C5E\u6027\u3002\u66F8\u3051\u308B\u306E\u306F ${list(allowed)}`,
12264
12254
  badColor: `color \u306F ${list(COLORS)} \u306E\u3069\u308C\u304B`,
12255
+ badIcon: `icon \u306F ${list(ICON_NAMES)} \u306E\u3069\u308C\u304B`,
12265
12256
  badView: `view \u306F ${list(VIEWS)} \u306E\u3069\u308C\u304B`,
12266
12257
  badCarry: `carry \u306F ${list(CARRIES)} \u306E\u3069\u308C\u304B\u3002\u672D\u306F tag: <\u5024> \u3067\u66F8\u304F`,
12267
12258
  badSide: `side \u306F ${list(SIDES)} \u306E\u3069\u308C\u304B`,
@@ -12400,6 +12391,7 @@ var en2 = () => {
12400
12391
  attrTwice: (key) => `Write ${key} only once on a line`,
12401
12392
  badAttr: (key, allowed) => `${key} cannot be written on this line. Write ${list(allowed)}`,
12402
12393
  badColor: `color is one of ${list(COLORS)}`,
12394
+ badIcon: `icon is one of ${list(ICON_NAMES)}`,
12403
12395
  badView: `view is one of ${list(VIEWS)}`,
12404
12396
  badCarry: `carry is one of ${list(CARRIES)}. Write a tag as tag: <value>`,
12405
12397
  badSide: `side is one of ${list(SIDES)}`,
@@ -12640,12 +12632,13 @@ function readDeclared(source, word, allowed, m) {
12640
12632
  function lookOf(source, attrs, m) {
12641
12633
  const color = attrs.get("color");
12642
12634
  if (color && !isOneOf(COLORS, color.value)) throw fail(source, color.at, m.badColor);
12635
+ const icon = attrs.get("icon");
12636
+ if (icon && !ICON_NAMES.includes(icon.value)) throw fail(source, icon.at, m.badIcon);
12643
12637
  const note = attrs.get("note")?.value;
12644
- const icon = attrs.get("icon")?.value;
12645
12638
  return {
12646
12639
  ...note !== void 0 ? { note } : {},
12647
12640
  ...color ? { color: color.value } : {},
12648
- ...icon !== void 0 ? { icon } : {}
12641
+ ...icon ? { icon: icon.value } : {}
12649
12642
  };
12650
12643
  }
12651
12644
  function oldForm(text2, inStep) {