@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/dist/index.js CHANGED
@@ -1589,6 +1589,66 @@ function textWidth(s, size, \u5B57\u9001\u308A = 0) {
1589
1589
  }
1590
1590
  return \u5E45 * size + \u5B57\u9001\u308A * \u5B57\u6570;
1591
1591
  }
1592
+
1593
+ // src/kinds/row-align.ts
1594
+ var GENERIC_ROW_LEFT_SIZE_PX = 18;
1595
+ var GENERIC_ROW_RIGHT_SIZE_PX = 21;
1596
+ var MONO_ADVANCE_RATIO = 0.6;
1597
+ var STORAGE_CHAR_ADVANCE_PX = 26 * MONO_ADVANCE_RATIO;
1598
+ var ROW_PAD_X_PX = 26;
1599
+ var ROW_COL_GAP_PX = 16;
1600
+ var STORAGE_COL_GAP_PX = 32;
1601
+ var ROW_RIGHT_PAD_PX = 26;
1602
+ var DELIMITERS = [" -> ", " \u2192 ", " = ", ": ", ":"];
1603
+ function splitRow(row) {
1604
+ for (const d of DELIMITERS) {
1605
+ const idx = row.indexOf(d);
1606
+ if (idx > 0) {
1607
+ return {
1608
+ left: row.slice(0, idx).trim(),
1609
+ right: row.slice(idx + d.length).trim(),
1610
+ split: true
1611
+ };
1612
+ }
1613
+ }
1614
+ return { left: row.trim(), right: "", split: false };
1615
+ }
1616
+ function rowColumnWidth(text, size, mono) {
1617
+ return mono ? displayWidth(text) * size * MONO_ADVANCE_RATIO : textWidth(text, size);
1618
+ }
1619
+ function displayWidth(text) {
1620
+ let w = 0;
1621
+ for (const ch of text) {
1622
+ const code = ch.codePointAt(0) ?? 0;
1623
+ w += code >= 32 && code <= 126 ? 1 : 2;
1624
+ }
1625
+ return w;
1626
+ }
1627
+ function \u6841\u3067\u5272\u308B(text, \u6841) {
1628
+ let w = 0;
1629
+ let \u53D6\u3063\u305F = "";
1630
+ for (const ch of text) {
1631
+ const code = ch.codePointAt(0) ?? 0;
1632
+ const \u5B57\u306E\u6841 = code >= 32 && code <= 126 ? 1 : 2;
1633
+ if (w + \u5B57\u306E\u6841 > \u6841) break;
1634
+ w += \u5B57\u306E\u6841;
1635
+ \u53D6\u3063\u305F += ch;
1636
+ }
1637
+ return [\u53D6\u3063\u305F, text.slice(\u53D6\u3063\u305F.length)];
1638
+ }
1639
+ function \u6841\u3067\u7701\u304F(text, \u4E0A\u9650) {
1640
+ if (displayWidth(text) <= \u4E0A\u9650) return text;
1641
+ return `${\u6841\u3067\u5272\u308B(text, \u4E0A\u9650 - 1)[0]}\u2026`;
1642
+ }
1643
+ function requiredRowsWidth(rows, kind) {
1644
+ if (!rows || rows.length === 0) return 0;
1645
+ const splits = rows.map(splitRow);
1646
+ const \u4E00\u756A\u5E83\u3044 = (\u53D6\u308B) => splits.reduce((m, s) => Math.max(m, \u53D6\u308B(s)), 0);
1647
+ 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;
1648
+ 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;
1649
+ if (kind === void 0) return Math.ceil(Math.max(storage, generic));
1650
+ return Math.ceil(kind === "storage" ? storage : generic);
1651
+ }
1592
1652
  var \u64CD\u4F5C\u90E8\u306E\u8A00\u8A9E = createContext("en");
1593
1653
  function use\u5B57\u5F15() {
1594
1654
  const lang = useContext(\u64CD\u4F5C\u90E8\u306E\u8A00\u8A9E);
@@ -7532,7 +7592,7 @@ function KanbanBoardReadout({
7532
7592
  style: { userSelect: "none" },
7533
7593
  children: [
7534
7594
  /* @__PURE__ */ jsx("title", { children: task.title }),
7535
- task.title.length > 18 ? `${task.title.slice(0, 17)}\u2026` : task.title
7595
+ \u6841\u3067\u7701\u304F(task.title, 18)
7536
7596
  ]
7537
7597
  }
7538
7598
  )
@@ -7669,7 +7729,7 @@ function TimelineVerticalReadout({
7669
7729
  style: { userSelect: "none" },
7670
7730
  children: [
7671
7731
  /* @__PURE__ */ jsx("title", { children: ev.title }),
7672
- ev.title.length > 38 ? `${ev.title.slice(0, 37)}\u2026` : ev.title
7732
+ \u6841\u3067\u7701\u304F(ev.title, 38)
7673
7733
  ]
7674
7734
  }
7675
7735
  ),
@@ -7683,7 +7743,7 @@ function TimelineVerticalReadout({
7683
7743
  style: { userSelect: "none" },
7684
7744
  children: [
7685
7745
  /* @__PURE__ */ jsx("title", { children: ev.description }),
7686
- ev.description.length > 44 ? `${ev.description.slice(0, 43)}\u2026` : ev.description
7746
+ \u6841\u3067\u7701\u304F(ev.description, 44)
7687
7747
  ]
7688
7748
  }
7689
7749
  ) : null
@@ -8026,7 +8086,7 @@ function StepProgressReadout({
8026
8086
  style: { userSelect: "none" },
8027
8087
  children: [
8028
8088
  /* @__PURE__ */ jsx("title", { children: s }),
8029
- s.length > 10 ? `${s.slice(0, 9)}\u2026` : s
8089
+ \u6841\u3067\u7701\u304F(s, 10)
8030
8090
  ]
8031
8091
  }
8032
8092
  )
@@ -8087,7 +8147,7 @@ function UserPresenceReadout({
8087
8147
  fontWeight: 500,
8088
8148
  fill: "#0f172a",
8089
8149
  style: { userSelect: "none" },
8090
- children: u.name.length > 24 ? `${u.name.slice(0, 23)}\u2026` : u.name
8150
+ children: \u6841\u3067\u7701\u304F(u.name, 24)
8091
8151
  }
8092
8152
  ),
8093
8153
  /* @__PURE__ */ jsx(
@@ -8249,7 +8309,7 @@ function OrgChartMiniReadout({
8249
8309
  style: { userSelect: "none" },
8250
8310
  children: [
8251
8311
  /* @__PURE__ */ jsx("title", { children: n.name }),
8252
- n.name.length > 10 ? `${n.name.slice(0, 9)}\u2026` : n.name
8312
+ \u6841\u3067\u7701\u304F(n.name, 10)
8253
8313
  ]
8254
8314
  }
8255
8315
  ),
@@ -8829,7 +8889,7 @@ function FileDropzoneReadout({
8829
8889
  ),
8830
8890
  /* @__PURE__ */ jsxs("text", { x: 54, y: 34, fontSize: 12, fontWeight: 600, fill: "#0f172a", style: { userSelect: "none" }, children: [
8831
8891
  /* @__PURE__ */ jsx("title", { children: filename }),
8832
- filename.length > 26 ? `${filename.slice(0, 25)}\u2026` : filename
8892
+ \u6841\u3067\u7701\u304F(filename, 26)
8833
8893
  ] }),
8834
8894
  /* @__PURE__ */ jsx("text", { x: 54, y: 50, fontSize: 10, fill: "#64748b", style: { userSelect: "none" }, children: /* @__PURE__ */ jsx(\u5B57, { k: "readout.dropzone.uploaded" }) })
8835
8895
  ] }) : /* @__PURE__ */ jsxs("g", { "data-cdl-dropzone-empty": "1", children: [
@@ -8908,7 +8968,7 @@ function LogStreamReadout({
8908
8968
  /* @__PURE__ */ jsx("rect", { x: 0, y: 0, width, height, fill: "#0f172a", rx: 4 }),
8909
8969
  shown.map((r, i) => {
8910
8970
  const y = 4 + i * rowH;
8911
- const displayMsg = r.msg.length > 24 ? `${r.msg.slice(0, 23)}\u2026` : r.msg;
8971
+ const displayMsg = \u6841\u3067\u7701\u304F(r.msg, 24);
8912
8972
  return /* @__PURE__ */ jsxs("g", { "data-cdl-log-row": i, children: [
8913
8973
  /* @__PURE__ */ jsx("text", { x: 6, y: y + 12, fontSize: 9, fill: "#94a3b8", fontFamily: "monospace", style: { userSelect: "none" }, children: r.ts }),
8914
8974
  /* @__PURE__ */ jsx("rect", { x: 62, y: y + 3, width: 26, height: 12, fill: levelColors[r.level] ?? "#94a3b8", rx: 2 }),
@@ -9008,7 +9068,7 @@ function AlertBannerReadout({
9008
9068
  style: { userSelect: "none" },
9009
9069
  children: [
9010
9070
  /* @__PURE__ */ jsx("title", { children: message }),
9011
- message.length > 32 ? `${message.slice(0, 31)}\u2026` : message
9071
+ \u6841\u3067\u7701\u304F(message, 32)
9012
9072
  ]
9013
9073
  }
9014
9074
  )
@@ -9078,7 +9138,7 @@ function ServiceHealthReadout({
9078
9138
  style: { userSelect: "none" },
9079
9139
  children: [
9080
9140
  /* @__PURE__ */ jsx("title", { children: s.name }),
9081
- s.name.length > 10 ? `${s.name.slice(0, 9)}\u2026` : s.name
9141
+ \u6841\u3067\u7701\u304F(s.name, 10)
9082
9142
  ]
9083
9143
  }
9084
9144
  )
@@ -9257,7 +9317,7 @@ function PricingTierReadout({
9257
9317
  ),
9258
9318
  features.slice(0, 3).map((f, i) => {
9259
9319
  const y = 96 + i * 18;
9260
- const displayF = f.length > 24 ? `${f.slice(0, 23)}\u2026` : f;
9320
+ const displayF = \u6841\u3067\u7701\u304F(f, 24);
9261
9321
  return /* @__PURE__ */ jsxs("g", { "data-cdl-tier-feature": i, children: [
9262
9322
  /* @__PURE__ */ jsx("text", { x: 16, y, fontSize: 11, fill: colorAccent, style: { userSelect: "none" }, children: "\u2713" }),
9263
9323
  /* @__PURE__ */ jsxs("text", { x: 30, y, fontSize: 11, fill: "#0f172a", style: { userSelect: "none" }, children: [
@@ -9408,6 +9468,7 @@ function ArticlePreviewReadout({
9408
9468
  const width = 300;
9409
9469
  const height = 116;
9410
9470
  const thumbW = 80;
9471
+ const [\u629C\u7C8B\u306E\u4E00\u884C\u76EE, \u629C\u7C8B\u306E\u6B8B\u308A] = \u6841\u3067\u5272\u308B(excerpt, 28);
9411
9472
  return /* @__PURE__ */ jsxs("div", { className: "cdl-ip-item cdl-ip-readout-article-preview", "data-cdl-readout": id, children: [
9412
9473
  /* @__PURE__ */ jsx("span", { className: "cdl-ip-label", children: label }),
9413
9474
  /* @__PURE__ */ jsxs(
@@ -9444,15 +9505,15 @@ function ArticlePreviewReadout({
9444
9505
  style: { userSelect: "none" },
9445
9506
  children: [
9446
9507
  /* @__PURE__ */ jsx("title", { children: title }),
9447
- title.length > 26 ? `${title.slice(0, 25)}\u2026` : title
9508
+ \u6841\u3067\u7701\u304F(title, 26)
9448
9509
  ]
9449
9510
  }
9450
9511
  ),
9451
9512
  /* @__PURE__ */ jsxs("text", { x: thumbW + 20, y: 44, fontSize: 10, fill: "#334155", style: { userSelect: "none" }, children: [
9452
9513
  /* @__PURE__ */ jsx("title", { children: excerpt }),
9453
- excerpt.length > 28 ? `${excerpt.slice(0, 27)}\u2026` : excerpt
9514
+ \u629C\u7C8B\u306E\u4E00\u884C\u76EE
9454
9515
  ] }),
9455
- /* @__PURE__ */ 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) }),
9516
+ /* @__PURE__ */ 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) }),
9456
9517
  /* @__PURE__ */ jsx("text", { x: thumbW + 20, y: height - 14, fontSize: 10, fontWeight: 600, fill: "#64748b", style: { userSelect: "none" }, children: /* @__PURE__ */ jsx(\u5B57, { k: "readout.article.by", v: { author } }) }),
9457
9518
  /* @__PURE__ */ jsx("text", { x: width - 8, y: height - 14, fontSize: 10, textAnchor: "end", fill: "#94a3b8", style: { userSelect: "none" }, children: timeAgo })
9458
9519
  ]
@@ -9504,7 +9565,7 @@ function TocNavReadout({
9504
9565
  shown.map((it, i) => {
9505
9566
  const y = 4 + i * rowH;
9506
9567
  const indent = 12 + it.level * 16;
9507
- const displayT = it.title.length > 30 ? `${it.title.slice(0, 29)}\u2026` : it.title;
9568
+ const displayT = \u6841\u3067\u7701\u304F(it.title, 30);
9508
9569
  return /* @__PURE__ */ jsxs("g", { "data-cdl-toc-item": i, children: [
9509
9570
  it.active ? /* @__PURE__ */ jsx("rect", { x: 4, y, width: 3, height: rowH - 4, fill: colorActive, rx: 1 }) : null,
9510
9571
  /* @__PURE__ */ jsxs(
@@ -20813,50 +20874,6 @@ function recomputeContainedLanes(lanes, nodes) {
20813
20874
  });
20814
20875
  }
20815
20876
 
20816
- // src/kinds/row-align.ts
20817
- var GENERIC_ROW_LEFT_SIZE_PX = 18;
20818
- var GENERIC_ROW_RIGHT_SIZE_PX = 21;
20819
- var MONO_ADVANCE_RATIO = 0.6;
20820
- var STORAGE_CHAR_ADVANCE_PX = 26 * MONO_ADVANCE_RATIO;
20821
- var ROW_PAD_X_PX = 26;
20822
- var ROW_COL_GAP_PX = 16;
20823
- var STORAGE_COL_GAP_PX = 32;
20824
- var ROW_RIGHT_PAD_PX = 26;
20825
- var DELIMITERS = [" -> ", " \u2192 ", " = ", ": ", ":"];
20826
- function splitRow(row) {
20827
- for (const d of DELIMITERS) {
20828
- const idx = row.indexOf(d);
20829
- if (idx > 0) {
20830
- return {
20831
- left: row.slice(0, idx).trim(),
20832
- right: row.slice(idx + d.length).trim(),
20833
- split: true
20834
- };
20835
- }
20836
- }
20837
- return { left: row.trim(), right: "", split: false };
20838
- }
20839
- function rowColumnWidth(text, size, mono) {
20840
- return mono ? displayWidth(text) * size * MONO_ADVANCE_RATIO : textWidth(text, size);
20841
- }
20842
- function displayWidth(text) {
20843
- let w = 0;
20844
- for (const ch of text) {
20845
- const code = ch.codePointAt(0) ?? 0;
20846
- w += code >= 32 && code <= 126 ? 1 : 2;
20847
- }
20848
- return w;
20849
- }
20850
- function requiredRowsWidth(rows, kind) {
20851
- if (!rows || rows.length === 0) return 0;
20852
- const splits = rows.map(splitRow);
20853
- const \u4E00\u756A\u5E83\u3044 = (\u53D6\u308B) => splits.reduce((m, s) => Math.max(m, \u53D6\u308B(s)), 0);
20854
- 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;
20855
- 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;
20856
- if (kind === void 0) return Math.ceil(Math.max(storage, generic));
20857
- return Math.ceil(kind === "storage" ? storage : generic);
20858
- }
20859
-
20860
20877
  // src/layout/head-label.ts
20861
20878
  var \u7AEF\u306E\u5B57\u3092\u623B\u3059\u8DDD\u96E2 = 22;
20862
20879
  var \u7AEF\u306E\u5B57\u3068\u7DDA\u306E\u9699\u9593 = 8;