@cardenelabs/cdl 0.59.0 → 0.59.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/CHANGELOG.md CHANGED
@@ -5,6 +5,24 @@ CDL (Chainome Diagram Language) の主要変更履歴。
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.59.1] - 2026-09-13
9
+
10
+ ### Fixed
11
+
12
+ - **読み出しが長い字を字数で省いていたため、和文が枠からはみ出していたのを直した** (#851)
13
+
14
+ 12 種の読み出し (かんばんの札の題、縦の時の流れの題と説明、段の進みの名前、在席と小さな組織図と稼働の一覧の
15
+ 名前、置き場のファイルの名前、ログの流れと知らせの帯の文、料金表の機能、記事の札の題と抜粋、目次の項目の題) は、
16
+ 上限の字数を越えると `…` を付けて省く。 上限は英字の幅で決めてあり、和文は 1 字が英字のおよそ 2 倍の幅なので、
17
+ 上限に届く前に枠からはみ出していた (実測 = かんばんの札は使える幅 114 に対し、和文 17 字で 187)。
18
+
19
+ 上限を半角の桁数と読み替えて省く (ASCII の字を 1 桁、それ以外を 2 桁)。 英字だけの字は変更前と同じ所で省き、
20
+ 和文は上限の半分の字数で省く。 2 桁の字が境目をまたぐ時は、その字を含めない。
21
+
22
+ 記事の札の抜粋は、28 字を越えると 1 行目を 27 字と `…` で切り、2 行目を 29 字目から描いていたので、28 字目が
23
+ どちらの行にも出ず、1 行目の途中に `…` が入っていた。 1 行目に収まるだけの字を置いて残りを 2 行目に続け、
24
+ 2 行目に収まらない時だけ `…` を付ける。 英字の抜粋も、29 字以上の時の描き方が変わる。
25
+
8
26
  ## [0.59.0] - 2026-09-13
9
27
 
10
28
  ### Added
@@ -2582,7 +2600,8 @@ Initial OSS release.
2582
2600
  使わない = annotated tag を push しても GitHub Release は作られず、 Release を作っていない版で
2583
2601
  行き止まりになる。
2584
2602
 
2585
- [Unreleased]: https://github.com/cardene777/cdl/compare/v0.59.0...HEAD
2603
+ [Unreleased]: https://github.com/cardene777/cdl/compare/v0.59.1...HEAD
2604
+ [0.59.1]: https://github.com/cardene777/cdl/compare/v0.59.0...v0.59.1
2586
2605
  [0.59.0]: https://github.com/cardene777/cdl/compare/v0.58.0...v0.59.0
2587
2606
  [0.58.0]: https://github.com/cardene777/cdl/compare/v0.57.1...v0.58.0
2588
2607
  [0.57.1]: https://github.com/cardene777/cdl/compare/v0.57.0...v0.57.1
package/dist/index.cjs CHANGED
@@ -1591,6 +1591,66 @@ function textWidth(s, size, \u5B57\u9001\u308A = 0) {
1591
1591
  }
1592
1592
  return \u5E45 * size + \u5B57\u9001\u308A * \u5B57\u6570;
1593
1593
  }
1594
+
1595
+ // src/kinds/row-align.ts
1596
+ var GENERIC_ROW_LEFT_SIZE_PX = 18;
1597
+ var GENERIC_ROW_RIGHT_SIZE_PX = 21;
1598
+ var MONO_ADVANCE_RATIO = 0.6;
1599
+ var STORAGE_CHAR_ADVANCE_PX = 26 * MONO_ADVANCE_RATIO;
1600
+ var ROW_PAD_X_PX = 26;
1601
+ var ROW_COL_GAP_PX = 16;
1602
+ var STORAGE_COL_GAP_PX = 32;
1603
+ var ROW_RIGHT_PAD_PX = 26;
1604
+ var DELIMITERS = [" -> ", " \u2192 ", " = ", ": ", ":"];
1605
+ function splitRow(row) {
1606
+ for (const d of DELIMITERS) {
1607
+ const idx = row.indexOf(d);
1608
+ if (idx > 0) {
1609
+ return {
1610
+ left: row.slice(0, idx).trim(),
1611
+ right: row.slice(idx + d.length).trim(),
1612
+ split: true
1613
+ };
1614
+ }
1615
+ }
1616
+ return { left: row.trim(), right: "", split: false };
1617
+ }
1618
+ function rowColumnWidth(text, size, mono) {
1619
+ return mono ? displayWidth(text) * size * MONO_ADVANCE_RATIO : textWidth(text, size);
1620
+ }
1621
+ function displayWidth(text) {
1622
+ let w = 0;
1623
+ for (const ch of text) {
1624
+ const code = ch.codePointAt(0) ?? 0;
1625
+ w += code >= 32 && code <= 126 ? 1 : 2;
1626
+ }
1627
+ return w;
1628
+ }
1629
+ function \u6841\u3067\u5272\u308B(text, \u6841) {
1630
+ let w = 0;
1631
+ let \u53D6\u3063\u305F = "";
1632
+ for (const ch of text) {
1633
+ const code = ch.codePointAt(0) ?? 0;
1634
+ const \u5B57\u306E\u6841 = code >= 32 && code <= 126 ? 1 : 2;
1635
+ if (w + \u5B57\u306E\u6841 > \u6841) break;
1636
+ w += \u5B57\u306E\u6841;
1637
+ \u53D6\u3063\u305F += ch;
1638
+ }
1639
+ return [\u53D6\u3063\u305F, text.slice(\u53D6\u3063\u305F.length)];
1640
+ }
1641
+ function \u6841\u3067\u7701\u304F(text, \u4E0A\u9650) {
1642
+ if (displayWidth(text) <= \u4E0A\u9650) return text;
1643
+ return `${\u6841\u3067\u5272\u308B(text, \u4E0A\u9650 - 1)[0]}\u2026`;
1644
+ }
1645
+ function requiredRowsWidth(rows, kind) {
1646
+ if (!rows || rows.length === 0) return 0;
1647
+ const splits = rows.map(splitRow);
1648
+ const \u4E00\u756A\u5E83\u3044 = (\u53D6\u308B) => splits.reduce((m, s) => Math.max(m, \u53D6\u308B(s)), 0);
1649
+ 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;
1650
+ 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;
1651
+ if (kind === void 0) return Math.ceil(Math.max(storage, generic));
1652
+ return Math.ceil(kind === "storage" ? storage : generic);
1653
+ }
1594
1654
  var \u64CD\u4F5C\u90E8\u306E\u8A00\u8A9E = react.createContext("en");
1595
1655
  function use\u5B57\u5F15() {
1596
1656
  const lang = react.useContext(\u64CD\u4F5C\u90E8\u306E\u8A00\u8A9E);
@@ -7534,7 +7594,7 @@ function KanbanBoardReadout({
7534
7594
  style: { userSelect: "none" },
7535
7595
  children: [
7536
7596
  /* @__PURE__ */ jsxRuntime.jsx("title", { children: task.title }),
7537
- task.title.length > 18 ? `${task.title.slice(0, 17)}\u2026` : task.title
7597
+ \u6841\u3067\u7701\u304F(task.title, 18)
7538
7598
  ]
7539
7599
  }
7540
7600
  )
@@ -7671,7 +7731,7 @@ function TimelineVerticalReadout({
7671
7731
  style: { userSelect: "none" },
7672
7732
  children: [
7673
7733
  /* @__PURE__ */ jsxRuntime.jsx("title", { children: ev.title }),
7674
- ev.title.length > 38 ? `${ev.title.slice(0, 37)}\u2026` : ev.title
7734
+ \u6841\u3067\u7701\u304F(ev.title, 38)
7675
7735
  ]
7676
7736
  }
7677
7737
  ),
@@ -7685,7 +7745,7 @@ function TimelineVerticalReadout({
7685
7745
  style: { userSelect: "none" },
7686
7746
  children: [
7687
7747
  /* @__PURE__ */ jsxRuntime.jsx("title", { children: ev.description }),
7688
- ev.description.length > 44 ? `${ev.description.slice(0, 43)}\u2026` : ev.description
7748
+ \u6841\u3067\u7701\u304F(ev.description, 44)
7689
7749
  ]
7690
7750
  }
7691
7751
  ) : null
@@ -8028,7 +8088,7 @@ function StepProgressReadout({
8028
8088
  style: { userSelect: "none" },
8029
8089
  children: [
8030
8090
  /* @__PURE__ */ jsxRuntime.jsx("title", { children: s }),
8031
- s.length > 10 ? `${s.slice(0, 9)}\u2026` : s
8091
+ \u6841\u3067\u7701\u304F(s, 10)
8032
8092
  ]
8033
8093
  }
8034
8094
  )
@@ -8089,7 +8149,7 @@ function UserPresenceReadout({
8089
8149
  fontWeight: 500,
8090
8150
  fill: "#0f172a",
8091
8151
  style: { userSelect: "none" },
8092
- children: u.name.length > 24 ? `${u.name.slice(0, 23)}\u2026` : u.name
8152
+ children: \u6841\u3067\u7701\u304F(u.name, 24)
8093
8153
  }
8094
8154
  ),
8095
8155
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -8251,7 +8311,7 @@ function OrgChartMiniReadout({
8251
8311
  style: { userSelect: "none" },
8252
8312
  children: [
8253
8313
  /* @__PURE__ */ jsxRuntime.jsx("title", { children: n.name }),
8254
- n.name.length > 10 ? `${n.name.slice(0, 9)}\u2026` : n.name
8314
+ \u6841\u3067\u7701\u304F(n.name, 10)
8255
8315
  ]
8256
8316
  }
8257
8317
  ),
@@ -8831,7 +8891,7 @@ function FileDropzoneReadout({
8831
8891
  ),
8832
8892
  /* @__PURE__ */ jsxRuntime.jsxs("text", { x: 54, y: 34, fontSize: 12, fontWeight: 600, fill: "#0f172a", style: { userSelect: "none" }, children: [
8833
8893
  /* @__PURE__ */ jsxRuntime.jsx("title", { children: filename }),
8834
- filename.length > 26 ? `${filename.slice(0, 25)}\u2026` : filename
8894
+ \u6841\u3067\u7701\u304F(filename, 26)
8835
8895
  ] }),
8836
8896
  /* @__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
8897
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-dropzone-empty": "1", children: [
@@ -8910,7 +8970,7 @@ function LogStreamReadout({
8910
8970
  /* @__PURE__ */ jsxRuntime.jsx("rect", { x: 0, y: 0, width, height, fill: "#0f172a", rx: 4 }),
8911
8971
  shown.map((r, i) => {
8912
8972
  const y = 4 + i * rowH;
8913
- const displayMsg = r.msg.length > 24 ? `${r.msg.slice(0, 23)}\u2026` : r.msg;
8973
+ const displayMsg = \u6841\u3067\u7701\u304F(r.msg, 24);
8914
8974
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-log-row": i, children: [
8915
8975
  /* @__PURE__ */ jsxRuntime.jsx("text", { x: 6, y: y + 12, fontSize: 9, fill: "#94a3b8", fontFamily: "monospace", style: { userSelect: "none" }, children: r.ts }),
8916
8976
  /* @__PURE__ */ jsxRuntime.jsx("rect", { x: 62, y: y + 3, width: 26, height: 12, fill: levelColors[r.level] ?? "#94a3b8", rx: 2 }),
@@ -9010,7 +9070,7 @@ function AlertBannerReadout({
9010
9070
  style: { userSelect: "none" },
9011
9071
  children: [
9012
9072
  /* @__PURE__ */ jsxRuntime.jsx("title", { children: message }),
9013
- message.length > 32 ? `${message.slice(0, 31)}\u2026` : message
9073
+ \u6841\u3067\u7701\u304F(message, 32)
9014
9074
  ]
9015
9075
  }
9016
9076
  )
@@ -9080,7 +9140,7 @@ function ServiceHealthReadout({
9080
9140
  style: { userSelect: "none" },
9081
9141
  children: [
9082
9142
  /* @__PURE__ */ jsxRuntime.jsx("title", { children: s.name }),
9083
- s.name.length > 10 ? `${s.name.slice(0, 9)}\u2026` : s.name
9143
+ \u6841\u3067\u7701\u304F(s.name, 10)
9084
9144
  ]
9085
9145
  }
9086
9146
  )
@@ -9259,7 +9319,7 @@ function PricingTierReadout({
9259
9319
  ),
9260
9320
  features.slice(0, 3).map((f, i) => {
9261
9321
  const y = 96 + i * 18;
9262
- const displayF = f.length > 24 ? `${f.slice(0, 23)}\u2026` : f;
9322
+ const displayF = \u6841\u3067\u7701\u304F(f, 24);
9263
9323
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-tier-feature": i, children: [
9264
9324
  /* @__PURE__ */ jsxRuntime.jsx("text", { x: 16, y, fontSize: 11, fill: colorAccent, style: { userSelect: "none" }, children: "\u2713" }),
9265
9325
  /* @__PURE__ */ jsxRuntime.jsxs("text", { x: 30, y, fontSize: 11, fill: "#0f172a", style: { userSelect: "none" }, children: [
@@ -9410,6 +9470,7 @@ function ArticlePreviewReadout({
9410
9470
  const width = 300;
9411
9471
  const height = 116;
9412
9472
  const thumbW = 80;
9473
+ const [\u629C\u7C8B\u306E\u4E00\u884C\u76EE, \u629C\u7C8B\u306E\u6B8B\u308A] = \u6841\u3067\u5272\u308B(excerpt, 28);
9413
9474
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cdl-ip-item cdl-ip-readout-article-preview", "data-cdl-readout": id, children: [
9414
9475
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdl-ip-label", children: label }),
9415
9476
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -9446,15 +9507,15 @@ function ArticlePreviewReadout({
9446
9507
  style: { userSelect: "none" },
9447
9508
  children: [
9448
9509
  /* @__PURE__ */ jsxRuntime.jsx("title", { children: title }),
9449
- title.length > 26 ? `${title.slice(0, 25)}\u2026` : title
9510
+ \u6841\u3067\u7701\u304F(title, 26)
9450
9511
  ]
9451
9512
  }
9452
9513
  ),
9453
9514
  /* @__PURE__ */ jsxRuntime.jsxs("text", { x: thumbW + 20, y: 44, fontSize: 10, fill: "#334155", style: { userSelect: "none" }, children: [
9454
9515
  /* @__PURE__ */ jsxRuntime.jsx("title", { children: excerpt }),
9455
- excerpt.length > 28 ? `${excerpt.slice(0, 27)}\u2026` : excerpt
9516
+ \u629C\u7C8B\u306E\u4E00\u884C\u76EE
9456
9517
  ] }),
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) }),
9518
+ /* @__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
9519
  /* @__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
9520
  /* @__PURE__ */ jsxRuntime.jsx("text", { x: width - 8, y: height - 14, fontSize: 10, textAnchor: "end", fill: "#94a3b8", style: { userSelect: "none" }, children: timeAgo })
9460
9521
  ]
@@ -9506,7 +9567,7 @@ function TocNavReadout({
9506
9567
  shown.map((it, i) => {
9507
9568
  const y = 4 + i * rowH;
9508
9569
  const indent = 12 + it.level * 16;
9509
- const displayT = it.title.length > 30 ? `${it.title.slice(0, 29)}\u2026` : it.title;
9570
+ const displayT = \u6841\u3067\u7701\u304F(it.title, 30);
9510
9571
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-toc-item": i, children: [
9511
9572
  it.active ? /* @__PURE__ */ jsxRuntime.jsx("rect", { x: 4, y, width: 3, height: rowH - 4, fill: colorActive, rx: 1 }) : null,
9512
9573
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -20815,50 +20876,6 @@ function recomputeContainedLanes(lanes, nodes) {
20815
20876
  });
20816
20877
  }
20817
20878
 
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
20879
  // src/layout/head-label.ts
20863
20880
  var \u7AEF\u306E\u5B57\u3092\u623B\u3059\u8DDD\u96E2 = 22;
20864
20881
  var \u7AEF\u306E\u5B57\u3068\u7DDA\u306E\u9699\u9593 = 8;