@cardenelabs/cdl 0.59.0 → 0.60.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,49 @@ CDL (Chainome Diagram Language) の主要変更履歴。
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.60.0] - 2026-09-13
9
+
10
+ ### Added
11
+
12
+ - **操作部の式の行を、書き手が付けた名札で描けるようにした** (#853)
13
+
14
+ 操作部は図の式を 1 行ずつ並べ、名前に式の id、中身に式の文字列をそのまま描いていた (`total1` /
15
+ `= baseFee + priority`)。 式には名札を書く口が無く、日本語の図に置くとそこだけ英字の識別子が残っていた。
16
+
17
+ `.formula(id, expression, { label })` と `.deriveChain(baseId, count, exprFn, { label: (i) => 名札 })` で
18
+ 名札を付けられるようにした。 名札を持つ式の行は、名前に名札を描き、中身の名前のうち名札を持つ入力欄と式の
19
+ id を名札に置き換えて描く (`= baseFee + priority` → `= 基準手数料 (gwei) + 優先手数料`)。
20
+ 置き換えは式の字句の位置で行い、`Math.min` などの関数の名前と数には当てない。 表示だけの置き換えで、
21
+ 計算は書いた式を読む。
22
+
23
+ 名札を持たない式は、入力欄に名札があっても、名前も中身も変更前と同じ字で描く。 目印 (`data-cdl-formula`)
24
+ は名札の有無によらず id のまま。
25
+
26
+ ### Fixed
27
+
28
+ - **巻き取りの進みの行が、`label` を渡しても id を描いていたのを直した** (#853)
29
+
30
+ `.animation.scroll(id, { label })` の名札は図に残っていたが、操作部の行は読んでいなかった。
31
+ 名札があれば名札を描く。 目印 (`data-cdl-scroll`) は id のまま。
32
+
33
+ ## [0.59.1] - 2026-09-13
34
+
35
+ ### Fixed
36
+
37
+ - **読み出しが長い字を字数で省いていたため、和文が枠からはみ出していたのを直した** (#851)
38
+
39
+ 12 種の読み出し (かんばんの札の題、縦の時の流れの題と説明、段の進みの名前、在席と小さな組織図と稼働の一覧の
40
+ 名前、置き場のファイルの名前、ログの流れと知らせの帯の文、料金表の機能、記事の札の題と抜粋、目次の項目の題) は、
41
+ 上限の字数を越えると `…` を付けて省く。 上限は英字の幅で決めてあり、和文は 1 字が英字のおよそ 2 倍の幅なので、
42
+ 上限に届く前に枠からはみ出していた (実測 = かんばんの札は使える幅 114 に対し、和文 17 字で 187)。
43
+
44
+ 上限を半角の桁数と読み替えて省く (ASCII の字を 1 桁、それ以外を 2 桁)。 英字だけの字は変更前と同じ所で省き、
45
+ 和文は上限の半分の字数で省く。 2 桁の字が境目をまたぐ時は、その字を含めない。
46
+
47
+ 記事の札の抜粋は、28 字を越えると 1 行目を 27 字と `…` で切り、2 行目を 29 字目から描いていたので、28 字目が
48
+ どちらの行にも出ず、1 行目の途中に `…` が入っていた。 1 行目に収まるだけの字を置いて残りを 2 行目に続け、
49
+ 2 行目に収まらない時だけ `…` を付ける。 英字の抜粋も、29 字以上の時の描き方が変わる。
50
+
8
51
  ## [0.59.0] - 2026-09-13
9
52
 
10
53
  ### Added
@@ -2582,7 +2625,9 @@ Initial OSS release.
2582
2625
  使わない = annotated tag を push しても GitHub Release は作られず、 Release を作っていない版で
2583
2626
  行き止まりになる。
2584
2627
 
2585
- [Unreleased]: https://github.com/cardene777/cdl/compare/v0.59.0...HEAD
2628
+ [Unreleased]: https://github.com/cardene777/cdl/compare/v0.60.0...HEAD
2629
+ [0.60.0]: https://github.com/cardene777/cdl/compare/v0.59.1...v0.60.0
2630
+ [0.59.1]: https://github.com/cardene777/cdl/compare/v0.59.0...v0.59.1
2586
2631
  [0.59.0]: https://github.com/cardene777/cdl/compare/v0.58.0...v0.59.0
2587
2632
  [0.58.0]: https://github.com/cardene777/cdl/compare/v0.57.1...v0.58.0
2588
2633
  [0.57.1]: https://github.com/cardene777/cdl/compare/v0.57.0...v0.57.1
package/dist/index.cjs CHANGED
@@ -755,7 +755,7 @@ function tokenize(src) {
755
755
  `invalid name "{${name}}" at position ${start} (\u7A7A\u767D / { } / . / [ ] \u306F\u540D\u524D\u306B\u4F7F\u3048\u306A\u3044)`
756
756
  );
757
757
  }
758
- tokens.push({ kind: "id", name, pos: start });
758
+ tokens.push({ kind: "id", name, pos: start, end: close + 1 });
759
759
  i = close + 1;
760
760
  continue;
761
761
  }
@@ -804,7 +804,7 @@ function tokenize(src) {
804
804
  `property access "${name}.${src[i + 1] ?? ""}..." at position ${start} is not allowed (only Math.* namespace is accessible)`
805
805
  );
806
806
  }
807
- tokens.push({ kind: "id", name, pos: start });
807
+ tokens.push({ kind: "id", name, pos: start, end: i });
808
808
  continue;
809
809
  }
810
810
  if (c === "+") {
@@ -1029,6 +1029,24 @@ function parseFormula(expression) {
1029
1029
  }
1030
1030
  return new Parser(tokens).parse();
1031
1031
  }
1032
+ function \u5F0F\u3092\u540D\u672D\u3067\u8AAD\u3080(expression, \u540D\u672D) {
1033
+ let tokens;
1034
+ try {
1035
+ tokens = tokenize(expression);
1036
+ } catch {
1037
+ return expression;
1038
+ }
1039
+ let \u8AAD\u307F = "";
1040
+ let \u524D = 0;
1041
+ for (const t of tokens) {
1042
+ if (t.kind !== "id") continue;
1043
+ const \u672D = \u540D\u672D.get(t.name);
1044
+ if (\u672D === void 0 || \u672D === "") continue;
1045
+ \u8AAD\u307F += expression.slice(\u524D, t.pos) + \u672D;
1046
+ \u524D = t.end;
1047
+ }
1048
+ return \u8AAD\u307F + expression.slice(\u524D);
1049
+ }
1032
1050
  function extractIdentifiers(ast, out = /* @__PURE__ */ new Set()) {
1033
1051
  switch (ast.type) {
1034
1052
  case "number":
@@ -1591,6 +1609,66 @@ function textWidth(s, size, \u5B57\u9001\u308A = 0) {
1591
1609
  }
1592
1610
  return \u5E45 * size + \u5B57\u9001\u308A * \u5B57\u6570;
1593
1611
  }
1612
+
1613
+ // src/kinds/row-align.ts
1614
+ var GENERIC_ROW_LEFT_SIZE_PX = 18;
1615
+ var GENERIC_ROW_RIGHT_SIZE_PX = 21;
1616
+ var MONO_ADVANCE_RATIO = 0.6;
1617
+ var STORAGE_CHAR_ADVANCE_PX = 26 * MONO_ADVANCE_RATIO;
1618
+ var ROW_PAD_X_PX = 26;
1619
+ var ROW_COL_GAP_PX = 16;
1620
+ var STORAGE_COL_GAP_PX = 32;
1621
+ var ROW_RIGHT_PAD_PX = 26;
1622
+ var DELIMITERS = [" -> ", " \u2192 ", " = ", ": ", ":"];
1623
+ function splitRow(row) {
1624
+ for (const d of DELIMITERS) {
1625
+ const idx = row.indexOf(d);
1626
+ if (idx > 0) {
1627
+ return {
1628
+ left: row.slice(0, idx).trim(),
1629
+ right: row.slice(idx + d.length).trim(),
1630
+ split: true
1631
+ };
1632
+ }
1633
+ }
1634
+ return { left: row.trim(), right: "", split: false };
1635
+ }
1636
+ function rowColumnWidth(text, size, mono) {
1637
+ return mono ? displayWidth(text) * size * MONO_ADVANCE_RATIO : textWidth(text, size);
1638
+ }
1639
+ function displayWidth(text) {
1640
+ let w = 0;
1641
+ for (const ch of text) {
1642
+ const code = ch.codePointAt(0) ?? 0;
1643
+ w += code >= 32 && code <= 126 ? 1 : 2;
1644
+ }
1645
+ return w;
1646
+ }
1647
+ function \u6841\u3067\u5272\u308B(text, \u6841) {
1648
+ let w = 0;
1649
+ let \u53D6\u3063\u305F = "";
1650
+ for (const ch of text) {
1651
+ const code = ch.codePointAt(0) ?? 0;
1652
+ const \u5B57\u306E\u6841 = code >= 32 && code <= 126 ? 1 : 2;
1653
+ if (w + \u5B57\u306E\u6841 > \u6841) break;
1654
+ w += \u5B57\u306E\u6841;
1655
+ \u53D6\u3063\u305F += ch;
1656
+ }
1657
+ return [\u53D6\u3063\u305F, text.slice(\u53D6\u3063\u305F.length)];
1658
+ }
1659
+ function \u6841\u3067\u7701\u304F(text, \u4E0A\u9650) {
1660
+ if (displayWidth(text) <= \u4E0A\u9650) return text;
1661
+ return `${\u6841\u3067\u5272\u308B(text, \u4E0A\u9650 - 1)[0]}\u2026`;
1662
+ }
1663
+ function requiredRowsWidth(rows, kind) {
1664
+ if (!rows || rows.length === 0) return 0;
1665
+ const splits = rows.map(splitRow);
1666
+ const \u4E00\u756A\u5E83\u3044 = (\u53D6\u308B) => splits.reduce((m, s) => Math.max(m, \u53D6\u308B(s)), 0);
1667
+ const storage = ROW_PAD_X_PX + \u4E00\u756A\u5E83\u3044((s) => rowColumnWidth(s.left, 26, true)) + STORAGE_COL_GAP_PX + \u4E00\u756A\u5E83\u3044((s) => rowColumnWidth(s.right, 26, true)) + ROW_RIGHT_PAD_PX;
1668
+ const generic = ROW_PAD_X_PX + \u4E00\u756A\u5E83\u3044((s) => rowColumnWidth(s.left, GENERIC_ROW_LEFT_SIZE_PX, false)) + ROW_COL_GAP_PX + \u4E00\u756A\u5E83\u3044((s) => rowColumnWidth(s.right, GENERIC_ROW_RIGHT_SIZE_PX, true)) + ROW_RIGHT_PAD_PX;
1669
+ if (kind === void 0) return Math.ceil(Math.max(storage, generic));
1670
+ return Math.ceil(kind === "storage" ? storage : generic);
1671
+ }
1594
1672
  var \u64CD\u4F5C\u90E8\u306E\u8A00\u8A9E = react.createContext("en");
1595
1673
  function use\u5B57\u5F15() {
1596
1674
  const lang = react.useContext(\u64CD\u4F5C\u90E8\u306E\u8A00\u8A9E);
@@ -1922,6 +2000,8 @@ function useInteractiveIntegration(diagram2, options = {}) {
1922
2000
  const readouts = diagram2.readouts ?? [];
1923
2001
  if (inputs.length === 0 && scrolls.length === 0 && formulasList.length === 0 && readouts.length === 0)
1924
2002
  return null;
2003
+ const \u540D\u672D = /* @__PURE__ */ new Map();
2004
+ for (const x of [...inputs, ...formulasList]) if (x.label) \u540D\u672D.set(x.id, x.label);
1925
2005
  return (
1926
2006
  // 操作部の中の読み出しと入力欄へ、図の言語を届ける (#849)。 型の外の値は英語に落ちる
1927
2007
  /* @__PURE__ */ jsxRuntime.jsx(\u64CD\u4F5C\u90E8\u306E\u8A00\u8A9E.Provider, { value: resolveLang(diagram2.lang), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cdl-ip-root", "data-cdl-interactive-panel": "true", children: [
@@ -1930,12 +2010,13 @@ function useInteractiveIntegration(diagram2, options = {}) {
1930
2010
  FormulaReadout,
1931
2011
  {
1932
2012
  id: f.id,
1933
- expression: f.expression,
2013
+ name: f.label || f.id,
2014
+ expression: f.label ? \u5F0F\u3092\u540D\u672D\u3067\u8AAD\u3080(f.expression, \u540D\u672D) : f.expression,
1934
2015
  value: stateOverrides[f.id]
1935
2016
  },
1936
2017
  f.id
1937
2018
  )) }),
1938
- scrolls.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cdl-ip-group", children: scrolls.map((s) => /* @__PURE__ */ jsxRuntime.jsx(ScrollReadout, { id: s.id, progress: stateOverrides[s.id] }, s.id)) }),
2019
+ scrolls.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cdl-ip-group", children: scrolls.map((s) => /* @__PURE__ */ jsxRuntime.jsx(ScrollReadout, { id: s.id, name: s.label || s.id, progress: stateOverrides[s.id] }, s.id)) }),
1939
2020
  readouts.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cdl-ip-group", children: readouts.map((r) => /* @__PURE__ */ jsxRuntime.jsx(ReadoutWidget, { readout: r, stateOverrides: mergedStateValues }, r.id)) })
1940
2021
  ] }) })
1941
2022
  );
@@ -2192,11 +2273,12 @@ function NumberInputWidget({
2192
2273
  }
2193
2274
  function FormulaReadout({
2194
2275
  id,
2276
+ name,
2195
2277
  expression,
2196
2278
  value
2197
2279
  }) {
2198
2280
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cdl-ip-item cdl-ip-formula", "data-cdl-formula": id, children: [
2199
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdl-ip-label", children: id }),
2281
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdl-ip-label", children: name }),
2200
2282
  /* @__PURE__ */ jsxRuntime.jsxs("code", { className: "cdl-ip-formula-expr", children: [
2201
2283
  "= ",
2202
2284
  expression
@@ -2204,11 +2286,11 @@ function FormulaReadout({
2204
2286
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdl-ip-formula-value", children: String(value ?? "") })
2205
2287
  ] });
2206
2288
  }
2207
- function ScrollReadout({ id, progress }) {
2289
+ function ScrollReadout({ id, name, progress }) {
2208
2290
  const p = typeof progress === "number" ? progress : 0;
2209
2291
  const pct = Math.round(p * 100);
2210
2292
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cdl-ip-item cdl-ip-scroll", "data-cdl-scroll": id, children: [
2211
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdl-ip-label", children: id }),
2293
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdl-ip-label", children: name }),
2212
2294
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cdl-ip-scroll-track", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cdl-ip-scroll-fill", style: { width: `${pct}%` } }) }),
2213
2295
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "cdl-ip-scroll-value", children: [
2214
2296
  pct,
@@ -7534,7 +7616,7 @@ function KanbanBoardReadout({
7534
7616
  style: { userSelect: "none" },
7535
7617
  children: [
7536
7618
  /* @__PURE__ */ jsxRuntime.jsx("title", { children: task.title }),
7537
- task.title.length > 18 ? `${task.title.slice(0, 17)}\u2026` : task.title
7619
+ \u6841\u3067\u7701\u304F(task.title, 18)
7538
7620
  ]
7539
7621
  }
7540
7622
  )
@@ -7671,7 +7753,7 @@ function TimelineVerticalReadout({
7671
7753
  style: { userSelect: "none" },
7672
7754
  children: [
7673
7755
  /* @__PURE__ */ jsxRuntime.jsx("title", { children: ev.title }),
7674
- ev.title.length > 38 ? `${ev.title.slice(0, 37)}\u2026` : ev.title
7756
+ \u6841\u3067\u7701\u304F(ev.title, 38)
7675
7757
  ]
7676
7758
  }
7677
7759
  ),
@@ -7685,7 +7767,7 @@ function TimelineVerticalReadout({
7685
7767
  style: { userSelect: "none" },
7686
7768
  children: [
7687
7769
  /* @__PURE__ */ jsxRuntime.jsx("title", { children: ev.description }),
7688
- ev.description.length > 44 ? `${ev.description.slice(0, 43)}\u2026` : ev.description
7770
+ \u6841\u3067\u7701\u304F(ev.description, 44)
7689
7771
  ]
7690
7772
  }
7691
7773
  ) : null
@@ -8028,7 +8110,7 @@ function StepProgressReadout({
8028
8110
  style: { userSelect: "none" },
8029
8111
  children: [
8030
8112
  /* @__PURE__ */ jsxRuntime.jsx("title", { children: s }),
8031
- s.length > 10 ? `${s.slice(0, 9)}\u2026` : s
8113
+ \u6841\u3067\u7701\u304F(s, 10)
8032
8114
  ]
8033
8115
  }
8034
8116
  )
@@ -8089,7 +8171,7 @@ function UserPresenceReadout({
8089
8171
  fontWeight: 500,
8090
8172
  fill: "#0f172a",
8091
8173
  style: { userSelect: "none" },
8092
- children: u.name.length > 24 ? `${u.name.slice(0, 23)}\u2026` : u.name
8174
+ children: \u6841\u3067\u7701\u304F(u.name, 24)
8093
8175
  }
8094
8176
  ),
8095
8177
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -8251,7 +8333,7 @@ function OrgChartMiniReadout({
8251
8333
  style: { userSelect: "none" },
8252
8334
  children: [
8253
8335
  /* @__PURE__ */ jsxRuntime.jsx("title", { children: n.name }),
8254
- n.name.length > 10 ? `${n.name.slice(0, 9)}\u2026` : n.name
8336
+ \u6841\u3067\u7701\u304F(n.name, 10)
8255
8337
  ]
8256
8338
  }
8257
8339
  ),
@@ -8831,7 +8913,7 @@ function FileDropzoneReadout({
8831
8913
  ),
8832
8914
  /* @__PURE__ */ jsxRuntime.jsxs("text", { x: 54, y: 34, fontSize: 12, fontWeight: 600, fill: "#0f172a", style: { userSelect: "none" }, children: [
8833
8915
  /* @__PURE__ */ jsxRuntime.jsx("title", { children: filename }),
8834
- filename.length > 26 ? `${filename.slice(0, 25)}\u2026` : filename
8916
+ \u6841\u3067\u7701\u304F(filename, 26)
8835
8917
  ] }),
8836
8918
  /* @__PURE__ */ jsxRuntime.jsx("text", { x: 54, y: 50, fontSize: 10, fill: "#64748b", style: { userSelect: "none" }, children: /* @__PURE__ */ jsxRuntime.jsx(\u5B57, { k: "readout.dropzone.uploaded" }) })
8837
8919
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-dropzone-empty": "1", children: [
@@ -8910,7 +8992,7 @@ function LogStreamReadout({
8910
8992
  /* @__PURE__ */ jsxRuntime.jsx("rect", { x: 0, y: 0, width, height, fill: "#0f172a", rx: 4 }),
8911
8993
  shown.map((r, i) => {
8912
8994
  const y = 4 + i * rowH;
8913
- const displayMsg = r.msg.length > 24 ? `${r.msg.slice(0, 23)}\u2026` : r.msg;
8995
+ const displayMsg = \u6841\u3067\u7701\u304F(r.msg, 24);
8914
8996
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-log-row": i, children: [
8915
8997
  /* @__PURE__ */ jsxRuntime.jsx("text", { x: 6, y: y + 12, fontSize: 9, fill: "#94a3b8", fontFamily: "monospace", style: { userSelect: "none" }, children: r.ts }),
8916
8998
  /* @__PURE__ */ jsxRuntime.jsx("rect", { x: 62, y: y + 3, width: 26, height: 12, fill: levelColors[r.level] ?? "#94a3b8", rx: 2 }),
@@ -9010,7 +9092,7 @@ function AlertBannerReadout({
9010
9092
  style: { userSelect: "none" },
9011
9093
  children: [
9012
9094
  /* @__PURE__ */ jsxRuntime.jsx("title", { children: message }),
9013
- message.length > 32 ? `${message.slice(0, 31)}\u2026` : message
9095
+ \u6841\u3067\u7701\u304F(message, 32)
9014
9096
  ]
9015
9097
  }
9016
9098
  )
@@ -9080,7 +9162,7 @@ function ServiceHealthReadout({
9080
9162
  style: { userSelect: "none" },
9081
9163
  children: [
9082
9164
  /* @__PURE__ */ jsxRuntime.jsx("title", { children: s.name }),
9083
- s.name.length > 10 ? `${s.name.slice(0, 9)}\u2026` : s.name
9165
+ \u6841\u3067\u7701\u304F(s.name, 10)
9084
9166
  ]
9085
9167
  }
9086
9168
  )
@@ -9259,7 +9341,7 @@ function PricingTierReadout({
9259
9341
  ),
9260
9342
  features.slice(0, 3).map((f, i) => {
9261
9343
  const y = 96 + i * 18;
9262
- const displayF = f.length > 24 ? `${f.slice(0, 23)}\u2026` : f;
9344
+ const displayF = \u6841\u3067\u7701\u304F(f, 24);
9263
9345
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-tier-feature": i, children: [
9264
9346
  /* @__PURE__ */ jsxRuntime.jsx("text", { x: 16, y, fontSize: 11, fill: colorAccent, style: { userSelect: "none" }, children: "\u2713" }),
9265
9347
  /* @__PURE__ */ jsxRuntime.jsxs("text", { x: 30, y, fontSize: 11, fill: "#0f172a", style: { userSelect: "none" }, children: [
@@ -9410,6 +9492,7 @@ function ArticlePreviewReadout({
9410
9492
  const width = 300;
9411
9493
  const height = 116;
9412
9494
  const thumbW = 80;
9495
+ const [\u629C\u7C8B\u306E\u4E00\u884C\u76EE, \u629C\u7C8B\u306E\u6B8B\u308A] = \u6841\u3067\u5272\u308B(excerpt, 28);
9413
9496
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cdl-ip-item cdl-ip-readout-article-preview", "data-cdl-readout": id, children: [
9414
9497
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdl-ip-label", children: label }),
9415
9498
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -9446,15 +9529,15 @@ function ArticlePreviewReadout({
9446
9529
  style: { userSelect: "none" },
9447
9530
  children: [
9448
9531
  /* @__PURE__ */ jsxRuntime.jsx("title", { children: title }),
9449
- title.length > 26 ? `${title.slice(0, 25)}\u2026` : title
9532
+ \u6841\u3067\u7701\u304F(title, 26)
9450
9533
  ]
9451
9534
  }
9452
9535
  ),
9453
9536
  /* @__PURE__ */ jsxRuntime.jsxs("text", { x: thumbW + 20, y: 44, fontSize: 10, fill: "#334155", style: { userSelect: "none" }, children: [
9454
9537
  /* @__PURE__ */ jsxRuntime.jsx("title", { children: excerpt }),
9455
- excerpt.length > 28 ? `${excerpt.slice(0, 27)}\u2026` : excerpt
9538
+ \u629C\u7C8B\u306E\u4E00\u884C\u76EE
9456
9539
  ] }),
9457
- /* @__PURE__ */ jsxRuntime.jsx("text", { x: thumbW + 20, y: 60, fontSize: 10, fill: "#334155", style: { userSelect: "none" }, children: excerpt.length > 56 ? `${excerpt.slice(28, 55)}\u2026` : excerpt.slice(28, 56) }),
9540
+ /* @__PURE__ */ jsxRuntime.jsx("text", { x: thumbW + 20, y: 60, fontSize: 10, fill: "#334155", style: { userSelect: "none" }, children: \u6841\u3067\u7701\u304F(\u629C\u7C8B\u306E\u6B8B\u308A, 28) }),
9458
9541
  /* @__PURE__ */ jsxRuntime.jsx("text", { x: thumbW + 20, y: height - 14, fontSize: 10, fontWeight: 600, fill: "#64748b", style: { userSelect: "none" }, children: /* @__PURE__ */ jsxRuntime.jsx(\u5B57, { k: "readout.article.by", v: { author } }) }),
9459
9542
  /* @__PURE__ */ jsxRuntime.jsx("text", { x: width - 8, y: height - 14, fontSize: 10, textAnchor: "end", fill: "#94a3b8", style: { userSelect: "none" }, children: timeAgo })
9460
9543
  ]
@@ -9506,7 +9589,7 @@ function TocNavReadout({
9506
9589
  shown.map((it, i) => {
9507
9590
  const y = 4 + i * rowH;
9508
9591
  const indent = 12 + it.level * 16;
9509
- const displayT = it.title.length > 30 ? `${it.title.slice(0, 29)}\u2026` : it.title;
9592
+ const displayT = \u6841\u3067\u7701\u304F(it.title, 30);
9510
9593
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-toc-item": i, children: [
9511
9594
  it.active ? /* @__PURE__ */ jsxRuntime.jsx("rect", { x: 4, y, width: 3, height: rowH - 4, fill: colorActive, rx: 1 }) : null,
9512
9595
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -10256,7 +10339,7 @@ function diagram(id, options) {
10256
10339
  return api;
10257
10340
  }
10258
10341
  },
10259
- formula(formulaId, expression) {
10342
+ formula(formulaId, expression, opts) {
10260
10343
  assertUniqueFormulaId(formulaId);
10261
10344
  try {
10262
10345
  parseFormula(expression);
@@ -10264,10 +10347,10 @@ function diagram(id, options) {
10264
10347
  const msg = e instanceof Error ? e.message : String(e);
10265
10348
  throw new Error(`formula '${formulaId}' \u306E expression syntax error: ${msg}`);
10266
10349
  }
10267
- formulas.push({ id: formulaId, expression });
10350
+ formulas.push({ id: formulaId, expression, ...opts?.label ? { label: opts.label } : {} });
10268
10351
  return api;
10269
10352
  },
10270
- deriveChain(baseId, count, exprFn) {
10353
+ deriveChain(baseId, count, exprFn, opts) {
10271
10354
  if (!Number.isInteger(count) || count < 1 || count > 100) {
10272
10355
  throw new Error(`deriveChain: count (${count}) \u306F 1..100 \u306E\u6574\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`);
10273
10356
  }
@@ -10283,7 +10366,8 @@ function diagram(id, options) {
10283
10366
  const msg = e instanceof Error ? e.message : String(e);
10284
10367
  throw new Error(`deriveChain '${id2}' \u306E expression syntax error: ${msg}`);
10285
10368
  }
10286
- formulas.push({ id: id2, expression: expr });
10369
+ const label = opts?.label?.(i);
10370
+ formulas.push({ id: id2, expression: expr, ...label ? { label } : {} });
10287
10371
  prev = id2;
10288
10372
  }
10289
10373
  return api;
@@ -20815,50 +20899,6 @@ function recomputeContainedLanes(lanes, nodes) {
20815
20899
  });
20816
20900
  }
20817
20901
 
20818
- // src/kinds/row-align.ts
20819
- var GENERIC_ROW_LEFT_SIZE_PX = 18;
20820
- var GENERIC_ROW_RIGHT_SIZE_PX = 21;
20821
- var MONO_ADVANCE_RATIO = 0.6;
20822
- var STORAGE_CHAR_ADVANCE_PX = 26 * MONO_ADVANCE_RATIO;
20823
- var ROW_PAD_X_PX = 26;
20824
- var ROW_COL_GAP_PX = 16;
20825
- var STORAGE_COL_GAP_PX = 32;
20826
- var ROW_RIGHT_PAD_PX = 26;
20827
- var DELIMITERS = [" -> ", " \u2192 ", " = ", ": ", ":"];
20828
- function splitRow(row) {
20829
- for (const d of DELIMITERS) {
20830
- const idx = row.indexOf(d);
20831
- if (idx > 0) {
20832
- return {
20833
- left: row.slice(0, idx).trim(),
20834
- right: row.slice(idx + d.length).trim(),
20835
- split: true
20836
- };
20837
- }
20838
- }
20839
- return { left: row.trim(), right: "", split: false };
20840
- }
20841
- function rowColumnWidth(text, size, mono) {
20842
- return mono ? displayWidth(text) * size * MONO_ADVANCE_RATIO : textWidth(text, size);
20843
- }
20844
- function displayWidth(text) {
20845
- let w = 0;
20846
- for (const ch of text) {
20847
- const code = ch.codePointAt(0) ?? 0;
20848
- w += code >= 32 && code <= 126 ? 1 : 2;
20849
- }
20850
- return w;
20851
- }
20852
- function requiredRowsWidth(rows, kind) {
20853
- if (!rows || rows.length === 0) return 0;
20854
- const splits = rows.map(splitRow);
20855
- const \u4E00\u756A\u5E83\u3044 = (\u53D6\u308B) => splits.reduce((m, s) => Math.max(m, \u53D6\u308B(s)), 0);
20856
- const storage = ROW_PAD_X_PX + \u4E00\u756A\u5E83\u3044((s) => rowColumnWidth(s.left, 26, true)) + STORAGE_COL_GAP_PX + \u4E00\u756A\u5E83\u3044((s) => rowColumnWidth(s.right, 26, true)) + ROW_RIGHT_PAD_PX;
20857
- const generic = ROW_PAD_X_PX + \u4E00\u756A\u5E83\u3044((s) => rowColumnWidth(s.left, GENERIC_ROW_LEFT_SIZE_PX, false)) + ROW_COL_GAP_PX + \u4E00\u756A\u5E83\u3044((s) => rowColumnWidth(s.right, GENERIC_ROW_RIGHT_SIZE_PX, true)) + ROW_RIGHT_PAD_PX;
20858
- if (kind === void 0) return Math.ceil(Math.max(storage, generic));
20859
- return Math.ceil(kind === "storage" ? storage : generic);
20860
- }
20861
-
20862
20902
  // src/layout/head-label.ts
20863
20903
  var \u7AEF\u306E\u5B57\u3092\u623B\u3059\u8DDD\u96E2 = 22;
20864
20904
  var \u7AEF\u306E\u5B57\u3068\u7DDA\u306E\u9699\u9593 = 8;