@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 +46 -1
- package/dist/index.cjs +110 -70
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -4
- package/dist/index.d.ts +12 -4
- package/dist/index.js +110 -70
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +61 -22
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +61 -22
- package/dist/react.js.map +1 -1
- package/dist/{render-DpwY2hzM.d.cts → render-MbIjRWdX.d.cts} +7 -0
- package/dist/{render-DpwY2hzM.d.ts → render-MbIjRWdX.d.ts} +7 -0
- package/package.json +1 -1
- package/src/builder.ts +13 -5
- package/src/formula/parser.ts +32 -3
- package/src/kinds/row-align.ts +30 -0
- package/src/render/interactive-panel.tsx +37 -20
- package/src/types.ts +7 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CdlDiagram, S as Signal, a as CdlInput, b as CdlLane, c as CdlNode, T as Tone, d as Side, E as EdgeStyle, e as EdgeRole, f as EdgeHead, g as EdgeHeadFill, h as CdlState, i as CdlEventTarget, j as CdlLang, k as Computed, l as CdlDerivedValue, m as CdlScrollTrigger, L as LaidDiagram, n as CdlDiagramViewProps, o as LaidEdge, p as LaidNode, q as CdlEdge, B as BBox, R as RowMark, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-
|
|
2
|
-
export { r as CdlDiagramView, s as CdlEventBinding, t as CdlEventKind, u as CdlFormula, v as CdlPhase, w as ChartPieForm, x as ChartSlopeForm, y as EDGE_HEADS, z as EDGE_HEAD_DEFAULT, A as EDGE_HEAD_FILLS, D as EDGE_HEAD_FILL_DEFAULT, F as EDGE_REVEALS, G as EDGE_REVEAL_DEFAULT, H as EDGE_STYLES, I as EdgeReveal, K as InteractiveHandlerMap, M as InteractiveSignalsAccessor, O as LaidLane, P as NODE_KINDS, U as RELATION_FOCUSES, V as RELATION_FOCUS_DEFAULT, W as RelationFocus, X as ScrollProgressHandle, Y as TONES, Z as computeEventBindingKey, _ as computeFormulaKey, $ as computeInputSignalKey, a0 as computeScrollTriggerKey, a1 as computed, a2 as createInteractiveSignalsAccessor, a3 as createScrollProgressHandle, a4 as createScrollProgressSignals, a5 as hasInteractivePrimitives, a6 as resolveLang, a7 as sequenceBoardMetrics, a8 as sequenceStepId, a9 as signal } from './render-
|
|
1
|
+
import { C as CdlDiagram, S as Signal, a as CdlInput, b as CdlLane, c as CdlNode, T as Tone, d as Side, E as EdgeStyle, e as EdgeRole, f as EdgeHead, g as EdgeHeadFill, h as CdlState, i as CdlEventTarget, j as CdlLang, k as Computed, l as CdlDerivedValue, m as CdlScrollTrigger, L as LaidDiagram, n as CdlDiagramViewProps, o as LaidEdge, p as LaidNode, q as CdlEdge, B as BBox, R as RowMark, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-MbIjRWdX.cjs';
|
|
2
|
+
export { r as CdlDiagramView, s as CdlEventBinding, t as CdlEventKind, u as CdlFormula, v as CdlPhase, w as ChartPieForm, x as ChartSlopeForm, y as EDGE_HEADS, z as EDGE_HEAD_DEFAULT, A as EDGE_HEAD_FILLS, D as EDGE_HEAD_FILL_DEFAULT, F as EDGE_REVEALS, G as EDGE_REVEAL_DEFAULT, H as EDGE_STYLES, I as EdgeReveal, K as InteractiveHandlerMap, M as InteractiveSignalsAccessor, O as LaidLane, P as NODE_KINDS, U as RELATION_FOCUSES, V as RELATION_FOCUS_DEFAULT, W as RelationFocus, X as ScrollProgressHandle, Y as TONES, Z as computeEventBindingKey, _ as computeFormulaKey, $ as computeInputSignalKey, a0 as computeScrollTriggerKey, a1 as computed, a2 as createInteractiveSignalsAccessor, a3 as createScrollProgressHandle, a4 as createScrollProgressSignals, a5 as hasInteractivePrimitives, a6 as resolveLang, a7 as sequenceBoardMetrics, a8 as sequenceStepId, a9 as signal } from './render-MbIjRWdX.cjs';
|
|
3
3
|
import { JSX } from 'react';
|
|
4
4
|
|
|
5
5
|
declare function effect(fn: () => void | (() => void)): () => void;
|
|
@@ -1170,8 +1170,12 @@ type DiagramBuilder = {
|
|
|
1170
1170
|
* consumer が createFormulaComputeds() で computed 化して signal と reactive bind する。
|
|
1171
1171
|
* expression syntax error は本 method 内で throw (fail-fast)。
|
|
1172
1172
|
* 例 `.formula("gasFee", "gasBase * (1 + delta/8)")`
|
|
1173
|
+
*
|
|
1174
|
+
* `opts.label` は操作部の式の行に描く名札 (#853)。 例 `.formula("total", "baseFee + tip", { label: "合計" })`
|
|
1173
1175
|
*/
|
|
1174
|
-
formula: (id: string, expression: string
|
|
1176
|
+
formula: (id: string, expression: string, opts?: {
|
|
1177
|
+
label?: string;
|
|
1178
|
+
}) => DiagramBuilder;
|
|
1175
1179
|
/**
|
|
1176
1180
|
* derive chain = 「連鎖形 formula」 を N 個宣言的に生成 (CAR: derive chain)。
|
|
1177
1181
|
* 各 iteration で `{i}` 置換と、 直前 iteration の id (`prev`) を参照可能。
|
|
@@ -1181,8 +1185,12 @@ type DiagramBuilder = {
|
|
|
1181
1185
|
*
|
|
1182
1186
|
* baseId は「gas1 / gas2 / gas3」 のように `gas${i+1}` として使われる、
|
|
1183
1187
|
* expr fn は index (0..count-1) と prev id (前 iteration の完全 id) を受け取る。
|
|
1188
|
+
*
|
|
1189
|
+
* `opts.label` は index を受け取り、その式の名札を返す (#853)。 例 `{ label: (i) => \`${i + 1} 回目\` }`
|
|
1184
1190
|
*/
|
|
1185
|
-
deriveChain: (baseId: string, count: number, exprFn: (i: number, prev: string | null) => string
|
|
1191
|
+
deriveChain: (baseId: string, count: number, exprFn: (i: number, prev: string | null) => string, opts?: {
|
|
1192
|
+
label?: (i: number) => string;
|
|
1193
|
+
}) => DiagramBuilder;
|
|
1186
1194
|
/**
|
|
1187
1195
|
* animation primitive (CAR #245)。 `.animation.scroll(id, opts)` で scroll-driven trigger を追加。
|
|
1188
1196
|
* 将来的に `.animation.time(...)` 等の time-based primitive を追加する余地を残す namespace。
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CdlDiagram, S as Signal, a as CdlInput, b as CdlLane, c as CdlNode, T as Tone, d as Side, E as EdgeStyle, e as EdgeRole, f as EdgeHead, g as EdgeHeadFill, h as CdlState, i as CdlEventTarget, j as CdlLang, k as Computed, l as CdlDerivedValue, m as CdlScrollTrigger, L as LaidDiagram, n as CdlDiagramViewProps, o as LaidEdge, p as LaidNode, q as CdlEdge, B as BBox, R as RowMark, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-
|
|
2
|
-
export { r as CdlDiagramView, s as CdlEventBinding, t as CdlEventKind, u as CdlFormula, v as CdlPhase, w as ChartPieForm, x as ChartSlopeForm, y as EDGE_HEADS, z as EDGE_HEAD_DEFAULT, A as EDGE_HEAD_FILLS, D as EDGE_HEAD_FILL_DEFAULT, F as EDGE_REVEALS, G as EDGE_REVEAL_DEFAULT, H as EDGE_STYLES, I as EdgeReveal, K as InteractiveHandlerMap, M as InteractiveSignalsAccessor, O as LaidLane, P as NODE_KINDS, U as RELATION_FOCUSES, V as RELATION_FOCUS_DEFAULT, W as RelationFocus, X as ScrollProgressHandle, Y as TONES, Z as computeEventBindingKey, _ as computeFormulaKey, $ as computeInputSignalKey, a0 as computeScrollTriggerKey, a1 as computed, a2 as createInteractiveSignalsAccessor, a3 as createScrollProgressHandle, a4 as createScrollProgressSignals, a5 as hasInteractivePrimitives, a6 as resolveLang, a7 as sequenceBoardMetrics, a8 as sequenceStepId, a9 as signal } from './render-
|
|
1
|
+
import { C as CdlDiagram, S as Signal, a as CdlInput, b as CdlLane, c as CdlNode, T as Tone, d as Side, E as EdgeStyle, e as EdgeRole, f as EdgeHead, g as EdgeHeadFill, h as CdlState, i as CdlEventTarget, j as CdlLang, k as Computed, l as CdlDerivedValue, m as CdlScrollTrigger, L as LaidDiagram, n as CdlDiagramViewProps, o as LaidEdge, p as LaidNode, q as CdlEdge, B as BBox, R as RowMark, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-MbIjRWdX.js';
|
|
2
|
+
export { r as CdlDiagramView, s as CdlEventBinding, t as CdlEventKind, u as CdlFormula, v as CdlPhase, w as ChartPieForm, x as ChartSlopeForm, y as EDGE_HEADS, z as EDGE_HEAD_DEFAULT, A as EDGE_HEAD_FILLS, D as EDGE_HEAD_FILL_DEFAULT, F as EDGE_REVEALS, G as EDGE_REVEAL_DEFAULT, H as EDGE_STYLES, I as EdgeReveal, K as InteractiveHandlerMap, M as InteractiveSignalsAccessor, O as LaidLane, P as NODE_KINDS, U as RELATION_FOCUSES, V as RELATION_FOCUS_DEFAULT, W as RelationFocus, X as ScrollProgressHandle, Y as TONES, Z as computeEventBindingKey, _ as computeFormulaKey, $ as computeInputSignalKey, a0 as computeScrollTriggerKey, a1 as computed, a2 as createInteractiveSignalsAccessor, a3 as createScrollProgressHandle, a4 as createScrollProgressSignals, a5 as hasInteractivePrimitives, a6 as resolveLang, a7 as sequenceBoardMetrics, a8 as sequenceStepId, a9 as signal } from './render-MbIjRWdX.js';
|
|
3
3
|
import { JSX } from 'react';
|
|
4
4
|
|
|
5
5
|
declare function effect(fn: () => void | (() => void)): () => void;
|
|
@@ -1170,8 +1170,12 @@ type DiagramBuilder = {
|
|
|
1170
1170
|
* consumer が createFormulaComputeds() で computed 化して signal と reactive bind する。
|
|
1171
1171
|
* expression syntax error は本 method 内で throw (fail-fast)。
|
|
1172
1172
|
* 例 `.formula("gasFee", "gasBase * (1 + delta/8)")`
|
|
1173
|
+
*
|
|
1174
|
+
* `opts.label` は操作部の式の行に描く名札 (#853)。 例 `.formula("total", "baseFee + tip", { label: "合計" })`
|
|
1173
1175
|
*/
|
|
1174
|
-
formula: (id: string, expression: string
|
|
1176
|
+
formula: (id: string, expression: string, opts?: {
|
|
1177
|
+
label?: string;
|
|
1178
|
+
}) => DiagramBuilder;
|
|
1175
1179
|
/**
|
|
1176
1180
|
* derive chain = 「連鎖形 formula」 を N 個宣言的に生成 (CAR: derive chain)。
|
|
1177
1181
|
* 各 iteration で `{i}` 置換と、 直前 iteration の id (`prev`) を参照可能。
|
|
@@ -1181,8 +1185,12 @@ type DiagramBuilder = {
|
|
|
1181
1185
|
*
|
|
1182
1186
|
* baseId は「gas1 / gas2 / gas3」 のように `gas${i+1}` として使われる、
|
|
1183
1187
|
* expr fn は index (0..count-1) と prev id (前 iteration の完全 id) を受け取る。
|
|
1188
|
+
*
|
|
1189
|
+
* `opts.label` は index を受け取り、その式の名札を返す (#853)。 例 `{ label: (i) => \`${i + 1} 回目\` }`
|
|
1184
1190
|
*/
|
|
1185
|
-
deriveChain: (baseId: string, count: number, exprFn: (i: number, prev: string | null) => string
|
|
1191
|
+
deriveChain: (baseId: string, count: number, exprFn: (i: number, prev: string | null) => string, opts?: {
|
|
1192
|
+
label?: (i: number) => string;
|
|
1193
|
+
}) => DiagramBuilder;
|
|
1186
1194
|
/**
|
|
1187
1195
|
* animation primitive (CAR #245)。 `.animation.scroll(id, opts)` で scroll-driven trigger を追加。
|
|
1188
1196
|
* 将来的に `.animation.time(...)` 等の time-based primitive を追加する余地を残す namespace。
|
package/dist/index.js
CHANGED
|
@@ -753,7 +753,7 @@ function tokenize(src) {
|
|
|
753
753
|
`invalid name "{${name}}" at position ${start} (\u7A7A\u767D / { } / . / [ ] \u306F\u540D\u524D\u306B\u4F7F\u3048\u306A\u3044)`
|
|
754
754
|
);
|
|
755
755
|
}
|
|
756
|
-
tokens.push({ kind: "id", name, pos: start });
|
|
756
|
+
tokens.push({ kind: "id", name, pos: start, end: close + 1 });
|
|
757
757
|
i = close + 1;
|
|
758
758
|
continue;
|
|
759
759
|
}
|
|
@@ -802,7 +802,7 @@ function tokenize(src) {
|
|
|
802
802
|
`property access "${name}.${src[i + 1] ?? ""}..." at position ${start} is not allowed (only Math.* namespace is accessible)`
|
|
803
803
|
);
|
|
804
804
|
}
|
|
805
|
-
tokens.push({ kind: "id", name, pos: start });
|
|
805
|
+
tokens.push({ kind: "id", name, pos: start, end: i });
|
|
806
806
|
continue;
|
|
807
807
|
}
|
|
808
808
|
if (c === "+") {
|
|
@@ -1027,6 +1027,24 @@ function parseFormula(expression) {
|
|
|
1027
1027
|
}
|
|
1028
1028
|
return new Parser(tokens).parse();
|
|
1029
1029
|
}
|
|
1030
|
+
function \u5F0F\u3092\u540D\u672D\u3067\u8AAD\u3080(expression, \u540D\u672D) {
|
|
1031
|
+
let tokens;
|
|
1032
|
+
try {
|
|
1033
|
+
tokens = tokenize(expression);
|
|
1034
|
+
} catch {
|
|
1035
|
+
return expression;
|
|
1036
|
+
}
|
|
1037
|
+
let \u8AAD\u307F = "";
|
|
1038
|
+
let \u524D = 0;
|
|
1039
|
+
for (const t of tokens) {
|
|
1040
|
+
if (t.kind !== "id") continue;
|
|
1041
|
+
const \u672D = \u540D\u672D.get(t.name);
|
|
1042
|
+
if (\u672D === void 0 || \u672D === "") continue;
|
|
1043
|
+
\u8AAD\u307F += expression.slice(\u524D, t.pos) + \u672D;
|
|
1044
|
+
\u524D = t.end;
|
|
1045
|
+
}
|
|
1046
|
+
return \u8AAD\u307F + expression.slice(\u524D);
|
|
1047
|
+
}
|
|
1030
1048
|
function extractIdentifiers(ast, out = /* @__PURE__ */ new Set()) {
|
|
1031
1049
|
switch (ast.type) {
|
|
1032
1050
|
case "number":
|
|
@@ -1589,6 +1607,66 @@ function textWidth(s, size, \u5B57\u9001\u308A = 0) {
|
|
|
1589
1607
|
}
|
|
1590
1608
|
return \u5E45 * size + \u5B57\u9001\u308A * \u5B57\u6570;
|
|
1591
1609
|
}
|
|
1610
|
+
|
|
1611
|
+
// src/kinds/row-align.ts
|
|
1612
|
+
var GENERIC_ROW_LEFT_SIZE_PX = 18;
|
|
1613
|
+
var GENERIC_ROW_RIGHT_SIZE_PX = 21;
|
|
1614
|
+
var MONO_ADVANCE_RATIO = 0.6;
|
|
1615
|
+
var STORAGE_CHAR_ADVANCE_PX = 26 * MONO_ADVANCE_RATIO;
|
|
1616
|
+
var ROW_PAD_X_PX = 26;
|
|
1617
|
+
var ROW_COL_GAP_PX = 16;
|
|
1618
|
+
var STORAGE_COL_GAP_PX = 32;
|
|
1619
|
+
var ROW_RIGHT_PAD_PX = 26;
|
|
1620
|
+
var DELIMITERS = [" -> ", " \u2192 ", " = ", ": ", ":"];
|
|
1621
|
+
function splitRow(row) {
|
|
1622
|
+
for (const d of DELIMITERS) {
|
|
1623
|
+
const idx = row.indexOf(d);
|
|
1624
|
+
if (idx > 0) {
|
|
1625
|
+
return {
|
|
1626
|
+
left: row.slice(0, idx).trim(),
|
|
1627
|
+
right: row.slice(idx + d.length).trim(),
|
|
1628
|
+
split: true
|
|
1629
|
+
};
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
return { left: row.trim(), right: "", split: false };
|
|
1633
|
+
}
|
|
1634
|
+
function rowColumnWidth(text, size, mono) {
|
|
1635
|
+
return mono ? displayWidth(text) * size * MONO_ADVANCE_RATIO : textWidth(text, size);
|
|
1636
|
+
}
|
|
1637
|
+
function displayWidth(text) {
|
|
1638
|
+
let w = 0;
|
|
1639
|
+
for (const ch of text) {
|
|
1640
|
+
const code = ch.codePointAt(0) ?? 0;
|
|
1641
|
+
w += code >= 32 && code <= 126 ? 1 : 2;
|
|
1642
|
+
}
|
|
1643
|
+
return w;
|
|
1644
|
+
}
|
|
1645
|
+
function \u6841\u3067\u5272\u308B(text, \u6841) {
|
|
1646
|
+
let w = 0;
|
|
1647
|
+
let \u53D6\u3063\u305F = "";
|
|
1648
|
+
for (const ch of text) {
|
|
1649
|
+
const code = ch.codePointAt(0) ?? 0;
|
|
1650
|
+
const \u5B57\u306E\u6841 = code >= 32 && code <= 126 ? 1 : 2;
|
|
1651
|
+
if (w + \u5B57\u306E\u6841 > \u6841) break;
|
|
1652
|
+
w += \u5B57\u306E\u6841;
|
|
1653
|
+
\u53D6\u3063\u305F += ch;
|
|
1654
|
+
}
|
|
1655
|
+
return [\u53D6\u3063\u305F, text.slice(\u53D6\u3063\u305F.length)];
|
|
1656
|
+
}
|
|
1657
|
+
function \u6841\u3067\u7701\u304F(text, \u4E0A\u9650) {
|
|
1658
|
+
if (displayWidth(text) <= \u4E0A\u9650) return text;
|
|
1659
|
+
return `${\u6841\u3067\u5272\u308B(text, \u4E0A\u9650 - 1)[0]}\u2026`;
|
|
1660
|
+
}
|
|
1661
|
+
function requiredRowsWidth(rows, kind) {
|
|
1662
|
+
if (!rows || rows.length === 0) return 0;
|
|
1663
|
+
const splits = rows.map(splitRow);
|
|
1664
|
+
const \u4E00\u756A\u5E83\u3044 = (\u53D6\u308B) => splits.reduce((m, s) => Math.max(m, \u53D6\u308B(s)), 0);
|
|
1665
|
+
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;
|
|
1666
|
+
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;
|
|
1667
|
+
if (kind === void 0) return Math.ceil(Math.max(storage, generic));
|
|
1668
|
+
return Math.ceil(kind === "storage" ? storage : generic);
|
|
1669
|
+
}
|
|
1592
1670
|
var \u64CD\u4F5C\u90E8\u306E\u8A00\u8A9E = createContext("en");
|
|
1593
1671
|
function use\u5B57\u5F15() {
|
|
1594
1672
|
const lang = useContext(\u64CD\u4F5C\u90E8\u306E\u8A00\u8A9E);
|
|
@@ -1920,6 +1998,8 @@ function useInteractiveIntegration(diagram2, options = {}) {
|
|
|
1920
1998
|
const readouts = diagram2.readouts ?? [];
|
|
1921
1999
|
if (inputs.length === 0 && scrolls.length === 0 && formulasList.length === 0 && readouts.length === 0)
|
|
1922
2000
|
return null;
|
|
2001
|
+
const \u540D\u672D = /* @__PURE__ */ new Map();
|
|
2002
|
+
for (const x of [...inputs, ...formulasList]) if (x.label) \u540D\u672D.set(x.id, x.label);
|
|
1923
2003
|
return (
|
|
1924
2004
|
// 操作部の中の読み出しと入力欄へ、図の言語を届ける (#849)。 型の外の値は英語に落ちる
|
|
1925
2005
|
/* @__PURE__ */ jsx(\u64CD\u4F5C\u90E8\u306E\u8A00\u8A9E.Provider, { value: resolveLang(diagram2.lang), children: /* @__PURE__ */ jsxs("div", { className: "cdl-ip-root", "data-cdl-interactive-panel": "true", children: [
|
|
@@ -1928,12 +2008,13 @@ function useInteractiveIntegration(diagram2, options = {}) {
|
|
|
1928
2008
|
FormulaReadout,
|
|
1929
2009
|
{
|
|
1930
2010
|
id: f.id,
|
|
1931
|
-
|
|
2011
|
+
name: f.label || f.id,
|
|
2012
|
+
expression: f.label ? \u5F0F\u3092\u540D\u672D\u3067\u8AAD\u3080(f.expression, \u540D\u672D) : f.expression,
|
|
1932
2013
|
value: stateOverrides[f.id]
|
|
1933
2014
|
},
|
|
1934
2015
|
f.id
|
|
1935
2016
|
)) }),
|
|
1936
|
-
scrolls.length > 0 && /* @__PURE__ */ jsx("div", { className: "cdl-ip-group", children: scrolls.map((s) => /* @__PURE__ */ jsx(ScrollReadout, { id: s.id, progress: stateOverrides[s.id] }, s.id)) }),
|
|
2017
|
+
scrolls.length > 0 && /* @__PURE__ */ jsx("div", { className: "cdl-ip-group", children: scrolls.map((s) => /* @__PURE__ */ jsx(ScrollReadout, { id: s.id, name: s.label || s.id, progress: stateOverrides[s.id] }, s.id)) }),
|
|
1937
2018
|
readouts.length > 0 && /* @__PURE__ */ jsx("div", { className: "cdl-ip-group", children: readouts.map((r) => /* @__PURE__ */ jsx(ReadoutWidget, { readout: r, stateOverrides: mergedStateValues }, r.id)) })
|
|
1938
2019
|
] }) })
|
|
1939
2020
|
);
|
|
@@ -2190,11 +2271,12 @@ function NumberInputWidget({
|
|
|
2190
2271
|
}
|
|
2191
2272
|
function FormulaReadout({
|
|
2192
2273
|
id,
|
|
2274
|
+
name,
|
|
2193
2275
|
expression,
|
|
2194
2276
|
value
|
|
2195
2277
|
}) {
|
|
2196
2278
|
return /* @__PURE__ */ jsxs("div", { className: "cdl-ip-item cdl-ip-formula", "data-cdl-formula": id, children: [
|
|
2197
|
-
/* @__PURE__ */ jsx("span", { className: "cdl-ip-label", children:
|
|
2279
|
+
/* @__PURE__ */ jsx("span", { className: "cdl-ip-label", children: name }),
|
|
2198
2280
|
/* @__PURE__ */ jsxs("code", { className: "cdl-ip-formula-expr", children: [
|
|
2199
2281
|
"= ",
|
|
2200
2282
|
expression
|
|
@@ -2202,11 +2284,11 @@ function FormulaReadout({
|
|
|
2202
2284
|
/* @__PURE__ */ jsx("span", { className: "cdl-ip-formula-value", children: String(value ?? "") })
|
|
2203
2285
|
] });
|
|
2204
2286
|
}
|
|
2205
|
-
function ScrollReadout({ id, progress }) {
|
|
2287
|
+
function ScrollReadout({ id, name, progress }) {
|
|
2206
2288
|
const p = typeof progress === "number" ? progress : 0;
|
|
2207
2289
|
const pct = Math.round(p * 100);
|
|
2208
2290
|
return /* @__PURE__ */ jsxs("div", { className: "cdl-ip-item cdl-ip-scroll", "data-cdl-scroll": id, children: [
|
|
2209
|
-
/* @__PURE__ */ jsx("span", { className: "cdl-ip-label", children:
|
|
2291
|
+
/* @__PURE__ */ jsx("span", { className: "cdl-ip-label", children: name }),
|
|
2210
2292
|
/* @__PURE__ */ jsx("div", { className: "cdl-ip-scroll-track", children: /* @__PURE__ */ jsx("div", { className: "cdl-ip-scroll-fill", style: { width: `${pct}%` } }) }),
|
|
2211
2293
|
/* @__PURE__ */ jsxs("span", { className: "cdl-ip-scroll-value", children: [
|
|
2212
2294
|
pct,
|
|
@@ -7532,7 +7614,7 @@ function KanbanBoardReadout({
|
|
|
7532
7614
|
style: { userSelect: "none" },
|
|
7533
7615
|
children: [
|
|
7534
7616
|
/* @__PURE__ */ jsx("title", { children: task.title }),
|
|
7535
|
-
task.title
|
|
7617
|
+
\u6841\u3067\u7701\u304F(task.title, 18)
|
|
7536
7618
|
]
|
|
7537
7619
|
}
|
|
7538
7620
|
)
|
|
@@ -7669,7 +7751,7 @@ function TimelineVerticalReadout({
|
|
|
7669
7751
|
style: { userSelect: "none" },
|
|
7670
7752
|
children: [
|
|
7671
7753
|
/* @__PURE__ */ jsx("title", { children: ev.title }),
|
|
7672
|
-
ev.title
|
|
7754
|
+
\u6841\u3067\u7701\u304F(ev.title, 38)
|
|
7673
7755
|
]
|
|
7674
7756
|
}
|
|
7675
7757
|
),
|
|
@@ -7683,7 +7765,7 @@ function TimelineVerticalReadout({
|
|
|
7683
7765
|
style: { userSelect: "none" },
|
|
7684
7766
|
children: [
|
|
7685
7767
|
/* @__PURE__ */ jsx("title", { children: ev.description }),
|
|
7686
|
-
ev.description
|
|
7768
|
+
\u6841\u3067\u7701\u304F(ev.description, 44)
|
|
7687
7769
|
]
|
|
7688
7770
|
}
|
|
7689
7771
|
) : null
|
|
@@ -8026,7 +8108,7 @@ function StepProgressReadout({
|
|
|
8026
8108
|
style: { userSelect: "none" },
|
|
8027
8109
|
children: [
|
|
8028
8110
|
/* @__PURE__ */ jsx("title", { children: s }),
|
|
8029
|
-
s
|
|
8111
|
+
\u6841\u3067\u7701\u304F(s, 10)
|
|
8030
8112
|
]
|
|
8031
8113
|
}
|
|
8032
8114
|
)
|
|
@@ -8087,7 +8169,7 @@ function UserPresenceReadout({
|
|
|
8087
8169
|
fontWeight: 500,
|
|
8088
8170
|
fill: "#0f172a",
|
|
8089
8171
|
style: { userSelect: "none" },
|
|
8090
|
-
children: u.name
|
|
8172
|
+
children: \u6841\u3067\u7701\u304F(u.name, 24)
|
|
8091
8173
|
}
|
|
8092
8174
|
),
|
|
8093
8175
|
/* @__PURE__ */ jsx(
|
|
@@ -8249,7 +8331,7 @@ function OrgChartMiniReadout({
|
|
|
8249
8331
|
style: { userSelect: "none" },
|
|
8250
8332
|
children: [
|
|
8251
8333
|
/* @__PURE__ */ jsx("title", { children: n.name }),
|
|
8252
|
-
n.name
|
|
8334
|
+
\u6841\u3067\u7701\u304F(n.name, 10)
|
|
8253
8335
|
]
|
|
8254
8336
|
}
|
|
8255
8337
|
),
|
|
@@ -8829,7 +8911,7 @@ function FileDropzoneReadout({
|
|
|
8829
8911
|
),
|
|
8830
8912
|
/* @__PURE__ */ jsxs("text", { x: 54, y: 34, fontSize: 12, fontWeight: 600, fill: "#0f172a", style: { userSelect: "none" }, children: [
|
|
8831
8913
|
/* @__PURE__ */ jsx("title", { children: filename }),
|
|
8832
|
-
filename
|
|
8914
|
+
\u6841\u3067\u7701\u304F(filename, 26)
|
|
8833
8915
|
] }),
|
|
8834
8916
|
/* @__PURE__ */ jsx("text", { x: 54, y: 50, fontSize: 10, fill: "#64748b", style: { userSelect: "none" }, children: /* @__PURE__ */ jsx(\u5B57, { k: "readout.dropzone.uploaded" }) })
|
|
8835
8917
|
] }) : /* @__PURE__ */ jsxs("g", { "data-cdl-dropzone-empty": "1", children: [
|
|
@@ -8908,7 +8990,7 @@ function LogStreamReadout({
|
|
|
8908
8990
|
/* @__PURE__ */ jsx("rect", { x: 0, y: 0, width, height, fill: "#0f172a", rx: 4 }),
|
|
8909
8991
|
shown.map((r, i) => {
|
|
8910
8992
|
const y = 4 + i * rowH;
|
|
8911
|
-
const displayMsg = r.msg
|
|
8993
|
+
const displayMsg = \u6841\u3067\u7701\u304F(r.msg, 24);
|
|
8912
8994
|
return /* @__PURE__ */ jsxs("g", { "data-cdl-log-row": i, children: [
|
|
8913
8995
|
/* @__PURE__ */ jsx("text", { x: 6, y: y + 12, fontSize: 9, fill: "#94a3b8", fontFamily: "monospace", style: { userSelect: "none" }, children: r.ts }),
|
|
8914
8996
|
/* @__PURE__ */ jsx("rect", { x: 62, y: y + 3, width: 26, height: 12, fill: levelColors[r.level] ?? "#94a3b8", rx: 2 }),
|
|
@@ -9008,7 +9090,7 @@ function AlertBannerReadout({
|
|
|
9008
9090
|
style: { userSelect: "none" },
|
|
9009
9091
|
children: [
|
|
9010
9092
|
/* @__PURE__ */ jsx("title", { children: message }),
|
|
9011
|
-
message
|
|
9093
|
+
\u6841\u3067\u7701\u304F(message, 32)
|
|
9012
9094
|
]
|
|
9013
9095
|
}
|
|
9014
9096
|
)
|
|
@@ -9078,7 +9160,7 @@ function ServiceHealthReadout({
|
|
|
9078
9160
|
style: { userSelect: "none" },
|
|
9079
9161
|
children: [
|
|
9080
9162
|
/* @__PURE__ */ jsx("title", { children: s.name }),
|
|
9081
|
-
s.name
|
|
9163
|
+
\u6841\u3067\u7701\u304F(s.name, 10)
|
|
9082
9164
|
]
|
|
9083
9165
|
}
|
|
9084
9166
|
)
|
|
@@ -9257,7 +9339,7 @@ function PricingTierReadout({
|
|
|
9257
9339
|
),
|
|
9258
9340
|
features.slice(0, 3).map((f, i) => {
|
|
9259
9341
|
const y = 96 + i * 18;
|
|
9260
|
-
const displayF = f
|
|
9342
|
+
const displayF = \u6841\u3067\u7701\u304F(f, 24);
|
|
9261
9343
|
return /* @__PURE__ */ jsxs("g", { "data-cdl-tier-feature": i, children: [
|
|
9262
9344
|
/* @__PURE__ */ jsx("text", { x: 16, y, fontSize: 11, fill: colorAccent, style: { userSelect: "none" }, children: "\u2713" }),
|
|
9263
9345
|
/* @__PURE__ */ jsxs("text", { x: 30, y, fontSize: 11, fill: "#0f172a", style: { userSelect: "none" }, children: [
|
|
@@ -9408,6 +9490,7 @@ function ArticlePreviewReadout({
|
|
|
9408
9490
|
const width = 300;
|
|
9409
9491
|
const height = 116;
|
|
9410
9492
|
const thumbW = 80;
|
|
9493
|
+
const [\u629C\u7C8B\u306E\u4E00\u884C\u76EE, \u629C\u7C8B\u306E\u6B8B\u308A] = \u6841\u3067\u5272\u308B(excerpt, 28);
|
|
9411
9494
|
return /* @__PURE__ */ jsxs("div", { className: "cdl-ip-item cdl-ip-readout-article-preview", "data-cdl-readout": id, children: [
|
|
9412
9495
|
/* @__PURE__ */ jsx("span", { className: "cdl-ip-label", children: label }),
|
|
9413
9496
|
/* @__PURE__ */ jsxs(
|
|
@@ -9444,15 +9527,15 @@ function ArticlePreviewReadout({
|
|
|
9444
9527
|
style: { userSelect: "none" },
|
|
9445
9528
|
children: [
|
|
9446
9529
|
/* @__PURE__ */ jsx("title", { children: title }),
|
|
9447
|
-
title
|
|
9530
|
+
\u6841\u3067\u7701\u304F(title, 26)
|
|
9448
9531
|
]
|
|
9449
9532
|
}
|
|
9450
9533
|
),
|
|
9451
9534
|
/* @__PURE__ */ jsxs("text", { x: thumbW + 20, y: 44, fontSize: 10, fill: "#334155", style: { userSelect: "none" }, children: [
|
|
9452
9535
|
/* @__PURE__ */ jsx("title", { children: excerpt }),
|
|
9453
|
-
|
|
9536
|
+
\u629C\u7C8B\u306E\u4E00\u884C\u76EE
|
|
9454
9537
|
] }),
|
|
9455
|
-
/* @__PURE__ */ jsx("text", { x: thumbW + 20, y: 60, fontSize: 10, fill: "#334155", style: { userSelect: "none" }, children:
|
|
9538
|
+
/* @__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
9539
|
/* @__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
9540
|
/* @__PURE__ */ jsx("text", { x: width - 8, y: height - 14, fontSize: 10, textAnchor: "end", fill: "#94a3b8", style: { userSelect: "none" }, children: timeAgo })
|
|
9458
9541
|
]
|
|
@@ -9504,7 +9587,7 @@ function TocNavReadout({
|
|
|
9504
9587
|
shown.map((it, i) => {
|
|
9505
9588
|
const y = 4 + i * rowH;
|
|
9506
9589
|
const indent = 12 + it.level * 16;
|
|
9507
|
-
const displayT = it.title
|
|
9590
|
+
const displayT = \u6841\u3067\u7701\u304F(it.title, 30);
|
|
9508
9591
|
return /* @__PURE__ */ jsxs("g", { "data-cdl-toc-item": i, children: [
|
|
9509
9592
|
it.active ? /* @__PURE__ */ jsx("rect", { x: 4, y, width: 3, height: rowH - 4, fill: colorActive, rx: 1 }) : null,
|
|
9510
9593
|
/* @__PURE__ */ jsxs(
|
|
@@ -10254,7 +10337,7 @@ function diagram(id, options) {
|
|
|
10254
10337
|
return api;
|
|
10255
10338
|
}
|
|
10256
10339
|
},
|
|
10257
|
-
formula(formulaId, expression) {
|
|
10340
|
+
formula(formulaId, expression, opts) {
|
|
10258
10341
|
assertUniqueFormulaId(formulaId);
|
|
10259
10342
|
try {
|
|
10260
10343
|
parseFormula(expression);
|
|
@@ -10262,10 +10345,10 @@ function diagram(id, options) {
|
|
|
10262
10345
|
const msg = e instanceof Error ? e.message : String(e);
|
|
10263
10346
|
throw new Error(`formula '${formulaId}' \u306E expression syntax error: ${msg}`);
|
|
10264
10347
|
}
|
|
10265
|
-
formulas.push({ id: formulaId, expression });
|
|
10348
|
+
formulas.push({ id: formulaId, expression, ...opts?.label ? { label: opts.label } : {} });
|
|
10266
10349
|
return api;
|
|
10267
10350
|
},
|
|
10268
|
-
deriveChain(baseId, count, exprFn) {
|
|
10351
|
+
deriveChain(baseId, count, exprFn, opts) {
|
|
10269
10352
|
if (!Number.isInteger(count) || count < 1 || count > 100) {
|
|
10270
10353
|
throw new Error(`deriveChain: count (${count}) \u306F 1..100 \u306E\u6574\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`);
|
|
10271
10354
|
}
|
|
@@ -10281,7 +10364,8 @@ function diagram(id, options) {
|
|
|
10281
10364
|
const msg = e instanceof Error ? e.message : String(e);
|
|
10282
10365
|
throw new Error(`deriveChain '${id2}' \u306E expression syntax error: ${msg}`);
|
|
10283
10366
|
}
|
|
10284
|
-
|
|
10367
|
+
const label = opts?.label?.(i);
|
|
10368
|
+
formulas.push({ id: id2, expression: expr, ...label ? { label } : {} });
|
|
10285
10369
|
prev = id2;
|
|
10286
10370
|
}
|
|
10287
10371
|
return api;
|
|
@@ -20813,50 +20897,6 @@ function recomputeContainedLanes(lanes, nodes) {
|
|
|
20813
20897
|
});
|
|
20814
20898
|
}
|
|
20815
20899
|
|
|
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
20900
|
// src/layout/head-label.ts
|
|
20861
20901
|
var \u7AEF\u306E\u5B57\u3092\u623B\u3059\u8DDD\u96E2 = 22;
|
|
20862
20902
|
var \u7AEF\u306E\u5B57\u3068\u7DDA\u306E\u9699\u9593 = 8;
|