@cardenelabs/cdl 0.59.1 → 0.61.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 +48 -1
- package/dist/index.cjs +108 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -10
- package/dist/index.d.ts +32 -10
- package/dist/index.js +108 -46
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +94 -36
- 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 +94 -36
- package/dist/react.js.map +1 -1
- package/dist/{render-DpwY2hzM.d.cts → render-Dk8_6ua6.d.cts} +28 -6
- package/dist/{render-DpwY2hzM.d.ts → render-Dk8_6ua6.d.ts} +28 -6
- package/package.json +1 -1
- package/src/builder.ts +30 -16
- package/src/formula/parser.ts +32 -3
- package/src/index.ts +1 -1
- package/src/input-option.ts +62 -0
- package/src/kinds/generic.tsx +6 -2
- package/src/render/interactive-panel.tsx +36 -21
- package/src/render/nodes.tsx +13 -6
- package/src/render/stage.tsx +5 -0
- package/src/render/utils.ts +14 -2
- package/src/render.tsx +6 -1
- package/src/types.ts +25 -5
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,51 @@ CDL (Chainome Diagram Language) の主要変更履歴。
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [0.61.0] - 2026-09-13
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **選択肢と切り替えの値に見せる名前を書いて、操作部と箱の字をその名前で描けるようにした** (#855)
|
|
13
|
+
|
|
14
|
+
選択肢を持つ入力欄 (`dropdown` / `radio` / `tabs` / `multi-select`) は選択肢を文字列で受け、1 つの文字列が
|
|
15
|
+
値と見せる字を兼ねていた。 値を日本語にすると綴りで読む読み出し (信号の灯り等) が読めなくなるので、日本語の
|
|
16
|
+
図でも選択肢と箱の差し込み (`状態: {status}`) に `red` のような英字が残っていた。
|
|
17
|
+
|
|
18
|
+
選択肢を `{ value, label }` の組でも書けるようにした (文字列と混ぜて書ける。 型は `CdlInputOption`)。
|
|
19
|
+
操作部の選択肢は名前を描き、`value` 属性・選んだ時に入る値・`data-cdl-multi-value` は綴りのまま。
|
|
20
|
+
切り替えは `.input.toggle(id, { onLabel, offLabel })` で入と切の名前を書ける。
|
|
21
|
+
|
|
22
|
+
箱の題・副題・見出し・値・行の差し込み (`{id}`) は、値が名前を持てば名前を差し込む。 `multi-select` は
|
|
23
|
+
選んだ値ごとに名前へ置き換える。 状態の値そのものは綴りのまま残すので、表示の出し分け (`visibleIf`)・
|
|
24
|
+
数の差し込み・読み出しは名前に影響されない。 組み立ての既定値の検査は値で比べ、名前を渡すと拒む。
|
|
25
|
+
|
|
26
|
+
名前を書かない図は、操作部も箱も変更前と同じ markup を描く。
|
|
27
|
+
|
|
28
|
+
## [0.60.0] - 2026-09-13
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
|
|
32
|
+
- **操作部の式の行を、書き手が付けた名札で描けるようにした** (#853)
|
|
33
|
+
|
|
34
|
+
操作部は図の式を 1 行ずつ並べ、名前に式の id、中身に式の文字列をそのまま描いていた (`total1` /
|
|
35
|
+
`= baseFee + priority`)。 式には名札を書く口が無く、日本語の図に置くとそこだけ英字の識別子が残っていた。
|
|
36
|
+
|
|
37
|
+
`.formula(id, expression, { label })` と `.deriveChain(baseId, count, exprFn, { label: (i) => 名札 })` で
|
|
38
|
+
名札を付けられるようにした。 名札を持つ式の行は、名前に名札を描き、中身の名前のうち名札を持つ入力欄と式の
|
|
39
|
+
id を名札に置き換えて描く (`= baseFee + priority` → `= 基準手数料 (gwei) + 優先手数料`)。
|
|
40
|
+
置き換えは式の字句の位置で行い、`Math.min` などの関数の名前と数には当てない。 表示だけの置き換えで、
|
|
41
|
+
計算は書いた式を読む。
|
|
42
|
+
|
|
43
|
+
名札を持たない式は、入力欄に名札があっても、名前も中身も変更前と同じ字で描く。 目印 (`data-cdl-formula`)
|
|
44
|
+
は名札の有無によらず id のまま。
|
|
45
|
+
|
|
46
|
+
### Fixed
|
|
47
|
+
|
|
48
|
+
- **巻き取りの進みの行が、`label` を渡しても id を描いていたのを直した** (#853)
|
|
49
|
+
|
|
50
|
+
`.animation.scroll(id, { label })` の名札は図に残っていたが、操作部の行は読んでいなかった。
|
|
51
|
+
名札があれば名札を描く。 目印 (`data-cdl-scroll`) は id のまま。
|
|
52
|
+
|
|
8
53
|
## [0.59.1] - 2026-09-13
|
|
9
54
|
|
|
10
55
|
### Fixed
|
|
@@ -2600,7 +2645,9 @@ Initial OSS release.
|
|
|
2600
2645
|
使わない = annotated tag を push しても GitHub Release は作られず、 Release を作っていない版で
|
|
2601
2646
|
行き止まりになる。
|
|
2602
2647
|
|
|
2603
|
-
[Unreleased]: https://github.com/cardene777/cdl/compare/v0.
|
|
2648
|
+
[Unreleased]: https://github.com/cardene777/cdl/compare/v0.61.0...HEAD
|
|
2649
|
+
[0.61.0]: https://github.com/cardene777/cdl/compare/v0.60.0...v0.61.0
|
|
2650
|
+
[0.60.0]: https://github.com/cardene777/cdl/compare/v0.59.1...v0.60.0
|
|
2604
2651
|
[0.59.1]: https://github.com/cardene777/cdl/compare/v0.59.0...v0.59.1
|
|
2605
2652
|
[0.59.0]: https://github.com/cardene777/cdl/compare/v0.58.0...v0.59.0
|
|
2606
2653
|
[0.58.0]: https://github.com/cardene777/cdl/compare/v0.57.1...v0.58.0
|
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":
|
|
@@ -1573,6 +1591,34 @@ function warn(message) {
|
|
|
1573
1591
|
}
|
|
1574
1592
|
}
|
|
1575
1593
|
|
|
1594
|
+
// src/input-option.ts
|
|
1595
|
+
function \u9078\u629E\u80A2\u306E\u5024(option) {
|
|
1596
|
+
return typeof option === "string" ? option : option.value;
|
|
1597
|
+
}
|
|
1598
|
+
function \u9078\u629E\u80A2\u306E\u540D\u524D(option) {
|
|
1599
|
+
return typeof option === "string" || option.label === "" ? \u9078\u629E\u80A2\u306E\u5024(option) : option.label;
|
|
1600
|
+
}
|
|
1601
|
+
function \u5024\u306E\u540D\u524D\u306E\u8868\u3092\u4F5C\u308B(inputs) {
|
|
1602
|
+
const \u8868 = /* @__PURE__ */ new Map();
|
|
1603
|
+
for (const input of inputs ?? []) {
|
|
1604
|
+
const \u540D\u524D = /* @__PURE__ */ new Map();
|
|
1605
|
+
if (input.kind === "dropdown" || input.kind === "radio" || input.kind === "tabs" || input.kind === "multi-select") {
|
|
1606
|
+
for (const option of input.options) {
|
|
1607
|
+
if (typeof option !== "string" && option.label !== "") \u540D\u524D.set(option.value, option.label);
|
|
1608
|
+
}
|
|
1609
|
+
} else if (input.kind === "toggle") {
|
|
1610
|
+
if (input.onLabel) \u540D\u524D.set("true", input.onLabel);
|
|
1611
|
+
if (input.offLabel) \u540D\u524D.set("false", input.offLabel);
|
|
1612
|
+
}
|
|
1613
|
+
if (\u540D\u524D.size > 0) \u8868.set(input.id, { \u540D\u524D, \u8907\u6570: input.kind === "multi-select" });
|
|
1614
|
+
}
|
|
1615
|
+
return \u8868;
|
|
1616
|
+
}
|
|
1617
|
+
function \u5024\u3092\u540D\u524D\u3067\u8AAD\u3080(\u5165\u529B\u6B04, \u5024) {
|
|
1618
|
+
if (!\u5165\u529B\u6B04.\u8907\u6570) return \u5165\u529B\u6B04.\u540D\u524D.get(\u5024) ?? \u5024;
|
|
1619
|
+
return \u5024.split(",").map((v) => \u5165\u529B\u6B04.\u540D\u524D.get(v) ?? v).join(",");
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1576
1622
|
// src/kinds/text-width.ts
|
|
1577
1623
|
var WIDE_RATIO = 1.04;
|
|
1578
1624
|
var NARROW_RATIO = 0.37;
|
|
@@ -1982,6 +2028,8 @@ function useInteractiveIntegration(diagram2, options = {}) {
|
|
|
1982
2028
|
const readouts = diagram2.readouts ?? [];
|
|
1983
2029
|
if (inputs.length === 0 && scrolls.length === 0 && formulasList.length === 0 && readouts.length === 0)
|
|
1984
2030
|
return null;
|
|
2031
|
+
const \u540D\u672D = /* @__PURE__ */ new Map();
|
|
2032
|
+
for (const x of [...inputs, ...formulasList]) if (x.label) \u540D\u672D.set(x.id, x.label);
|
|
1985
2033
|
return (
|
|
1986
2034
|
// 操作部の中の読み出しと入力欄へ、図の言語を届ける (#849)。 型の外の値は英語に落ちる
|
|
1987
2035
|
/* @__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: [
|
|
@@ -1990,12 +2038,13 @@ function useInteractiveIntegration(diagram2, options = {}) {
|
|
|
1990
2038
|
FormulaReadout,
|
|
1991
2039
|
{
|
|
1992
2040
|
id: f.id,
|
|
1993
|
-
|
|
2041
|
+
name: f.label || f.id,
|
|
2042
|
+
expression: f.label ? \u5F0F\u3092\u540D\u672D\u3067\u8AAD\u3080(f.expression, \u540D\u672D) : f.expression,
|
|
1994
2043
|
value: stateOverrides[f.id]
|
|
1995
2044
|
},
|
|
1996
2045
|
f.id
|
|
1997
2046
|
)) }),
|
|
1998
|
-
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)) }),
|
|
2047
|
+
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)) }),
|
|
1999
2048
|
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)) })
|
|
2000
2049
|
] }) })
|
|
2001
2050
|
);
|
|
@@ -2078,7 +2127,7 @@ function InputWidget({
|
|
|
2078
2127
|
},
|
|
2079
2128
|
"data-cdl-input": input.id,
|
|
2080
2129
|
className: "cdl-ip-dropdown-select",
|
|
2081
|
-
children: input.options.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt, children: opt }, opt))
|
|
2130
|
+
children: input.options.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: \u9078\u629E\u80A2\u306E\u5024(opt), children: \u9078\u629E\u80A2\u306E\u540D\u524D(opt) }, \u9078\u629E\u80A2\u306E\u5024(opt)))
|
|
2082
2131
|
}
|
|
2083
2132
|
)
|
|
2084
2133
|
] });
|
|
@@ -2095,17 +2144,17 @@ function InputWidget({
|
|
|
2095
2144
|
{
|
|
2096
2145
|
type: "radio",
|
|
2097
2146
|
name: input.id,
|
|
2098
|
-
value: opt,
|
|
2099
|
-
checked: value === opt,
|
|
2147
|
+
value: \u9078\u629E\u80A2\u306E\u5024(opt),
|
|
2148
|
+
checked: value === \u9078\u629E\u80A2\u306E\u5024(opt),
|
|
2100
2149
|
onChange: () => {
|
|
2101
|
-
signal2.value = opt;
|
|
2150
|
+
signal2.value = \u9078\u629E\u80A2\u306E\u5024(opt);
|
|
2102
2151
|
},
|
|
2103
2152
|
"data-cdl-input": input.id,
|
|
2104
2153
|
className: "cdl-ip-radio-input"
|
|
2105
2154
|
}
|
|
2106
2155
|
),
|
|
2107
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdl-ip-radio-label", children: opt })
|
|
2108
|
-
] }, opt)) })
|
|
2156
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdl-ip-radio-label", children: \u9078\u629E\u80A2\u306E\u540D\u524D(opt) })
|
|
2157
|
+
] }, \u9078\u629E\u80A2\u306E\u5024(opt))) })
|
|
2109
2158
|
] });
|
|
2110
2159
|
case "color":
|
|
2111
2160
|
return /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "cdl-ip-item cdl-ip-color", "data-cdl-input-kind": "color", children: [
|
|
@@ -2155,14 +2204,14 @@ function InputWidget({
|
|
|
2155
2204
|
{
|
|
2156
2205
|
type: "button",
|
|
2157
2206
|
role: "tab",
|
|
2158
|
-
className: `cdl-ip-tabs-btn ${value === opt ? "cdl-ip-tabs-active" : ""}`,
|
|
2207
|
+
className: `cdl-ip-tabs-btn ${value === \u9078\u629E\u80A2\u306E\u5024(opt) ? "cdl-ip-tabs-active" : ""}`,
|
|
2159
2208
|
onClick: () => {
|
|
2160
|
-
signal2.value = opt;
|
|
2209
|
+
signal2.value = \u9078\u629E\u80A2\u306E\u5024(opt);
|
|
2161
2210
|
},
|
|
2162
2211
|
"data-cdl-input": input.id,
|
|
2163
|
-
children: opt
|
|
2212
|
+
children: \u9078\u629E\u80A2\u306E\u540D\u524D(opt)
|
|
2164
2213
|
},
|
|
2165
|
-
opt
|
|
2214
|
+
\u9078\u629E\u80A2\u306E\u5024(opt)
|
|
2166
2215
|
)) })
|
|
2167
2216
|
] });
|
|
2168
2217
|
case "datetime":
|
|
@@ -2252,11 +2301,12 @@ function NumberInputWidget({
|
|
|
2252
2301
|
}
|
|
2253
2302
|
function FormulaReadout({
|
|
2254
2303
|
id,
|
|
2304
|
+
name,
|
|
2255
2305
|
expression,
|
|
2256
2306
|
value
|
|
2257
2307
|
}) {
|
|
2258
2308
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cdl-ip-item cdl-ip-formula", "data-cdl-formula": id, children: [
|
|
2259
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdl-ip-label", children:
|
|
2309
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdl-ip-label", children: name }),
|
|
2260
2310
|
/* @__PURE__ */ jsxRuntime.jsxs("code", { className: "cdl-ip-formula-expr", children: [
|
|
2261
2311
|
"= ",
|
|
2262
2312
|
expression
|
|
@@ -2264,11 +2314,11 @@ function FormulaReadout({
|
|
|
2264
2314
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdl-ip-formula-value", children: String(value ?? "") })
|
|
2265
2315
|
] });
|
|
2266
2316
|
}
|
|
2267
|
-
function ScrollReadout({ id, progress }) {
|
|
2317
|
+
function ScrollReadout({ id, name, progress }) {
|
|
2268
2318
|
const p = typeof progress === "number" ? progress : 0;
|
|
2269
2319
|
const pct = Math.round(p * 100);
|
|
2270
2320
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cdl-ip-item cdl-ip-scroll", "data-cdl-scroll": id, children: [
|
|
2271
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdl-ip-label", children:
|
|
2321
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdl-ip-label", children: name }),
|
|
2272
2322
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "cdl-ip-scroll-track", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cdl-ip-scroll-fill", style: { width: `${pct}%` } }) }),
|
|
2273
2323
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "cdl-ip-scroll-value", children: [
|
|
2274
2324
|
pct,
|
|
@@ -4216,13 +4266,13 @@ function MultiSelectWidget({
|
|
|
4216
4266
|
"button",
|
|
4217
4267
|
{
|
|
4218
4268
|
type: "button",
|
|
4219
|
-
className: `cdl-ip-multi-select-chip ${selected.has(opt) ? "cdl-ip-multi-select-active" : ""}`,
|
|
4220
|
-
onClick: () => toggle(opt),
|
|
4269
|
+
className: `cdl-ip-multi-select-chip ${selected.has(\u9078\u629E\u80A2\u306E\u5024(opt)) ? "cdl-ip-multi-select-active" : ""}`,
|
|
4270
|
+
onClick: () => toggle(\u9078\u629E\u80A2\u306E\u5024(opt)),
|
|
4221
4271
|
"data-cdl-input": input.id,
|
|
4222
|
-
"data-cdl-multi-value": opt,
|
|
4223
|
-
children: opt
|
|
4272
|
+
"data-cdl-multi-value": \u9078\u629E\u80A2\u306E\u5024(opt),
|
|
4273
|
+
children: \u9078\u629E\u80A2\u306E\u540D\u524D(opt)
|
|
4224
4274
|
},
|
|
4225
|
-
opt
|
|
4275
|
+
\u9078\u629E\u80A2\u306E\u5024(opt)
|
|
4226
4276
|
)) })
|
|
4227
4277
|
] });
|
|
4228
4278
|
}
|
|
@@ -10108,9 +10158,9 @@ function diagram(id, options) {
|
|
|
10108
10158
|
if (opts.options.length === 0) {
|
|
10109
10159
|
throw new Error(`input.dropdown '${inputId}' \u306E options \u304C\u7A7A\u3067\u3059 (\u6700\u4F4E 1 \u4EF6\u5FC5\u8981)`);
|
|
10110
10160
|
}
|
|
10111
|
-
if (!opts.options.
|
|
10161
|
+
if (!opts.options.some((o) => \u9078\u629E\u80A2\u306E\u5024(o) === opts.defaultValue)) {
|
|
10112
10162
|
throw new Error(
|
|
10113
|
-
`input.dropdown '${inputId}' \u306E defaultValue '${opts.defaultValue}' \u304C options \u306B\u542B\u307E\u308C\u307E\u305B\u3093 (options: ${opts.options.join(", ")})`
|
|
10163
|
+
`input.dropdown '${inputId}' \u306E defaultValue '${opts.defaultValue}' \u304C options \u306E\u5024\u306B\u542B\u307E\u308C\u307E\u305B\u3093 (options: ${opts.options.map(\u9078\u629E\u80A2\u306E\u5024).join(", ")})`
|
|
10114
10164
|
);
|
|
10115
10165
|
}
|
|
10116
10166
|
inputs.push({
|
|
@@ -10128,6 +10178,9 @@ function diagram(id, options) {
|
|
|
10128
10178
|
id: inputId,
|
|
10129
10179
|
kind: "toggle",
|
|
10130
10180
|
defaultValue: opts.defaultValue,
|
|
10181
|
+
// 名前を渡さない切り替えは変更前と同じ形に保つ (空の名前も渡さないのと同じ)
|
|
10182
|
+
...opts.onLabel ? { onLabel: opts.onLabel } : {},
|
|
10183
|
+
...opts.offLabel ? { offLabel: opts.offLabel } : {},
|
|
10131
10184
|
label: opts.label
|
|
10132
10185
|
});
|
|
10133
10186
|
return api;
|
|
@@ -10195,9 +10248,9 @@ function diagram(id, options) {
|
|
|
10195
10248
|
if (opts.options.length === 0) {
|
|
10196
10249
|
throw new Error(`input.radio '${inputId}' \u306E options \u304C\u7A7A\u3067\u3059`);
|
|
10197
10250
|
}
|
|
10198
|
-
if (!opts.options.
|
|
10251
|
+
if (!opts.options.some((o) => \u9078\u629E\u80A2\u306E\u5024(o) === opts.defaultValue)) {
|
|
10199
10252
|
throw new Error(
|
|
10200
|
-
`input.radio '${inputId}' \u306E defaultValue '${opts.defaultValue}' \u304C options \u306B\u542B\u307E\u308C\u307E\u305B\u3093`
|
|
10253
|
+
`input.radio '${inputId}' \u306E defaultValue '${opts.defaultValue}' \u304C options \u306E\u5024\u306B\u542B\u307E\u308C\u307E\u305B\u3093`
|
|
10201
10254
|
);
|
|
10202
10255
|
}
|
|
10203
10256
|
inputs.push({
|
|
@@ -10282,8 +10335,8 @@ function diagram(id, options) {
|
|
|
10282
10335
|
if (opts.options.length === 0) {
|
|
10283
10336
|
throw new Error(`input.tabs '${inputId}' \u306E options \u304C\u7A7A\u3067\u3059`);
|
|
10284
10337
|
}
|
|
10285
|
-
if (!opts.options.
|
|
10286
|
-
throw new Error(`input.tabs '${inputId}' \u306E defaultValue \u304C options \u306B\u542B\u307E\u308C\u307E\u305B\u3093`);
|
|
10338
|
+
if (!opts.options.some((o) => \u9078\u629E\u80A2\u306E\u5024(o) === opts.defaultValue)) {
|
|
10339
|
+
throw new Error(`input.tabs '${inputId}' \u306E defaultValue \u304C options \u306E\u5024\u306B\u542B\u307E\u308C\u307E\u305B\u3093`);
|
|
10287
10340
|
}
|
|
10288
10341
|
inputs.push({
|
|
10289
10342
|
id: inputId,
|
|
@@ -10317,7 +10370,7 @@ function diagram(id, options) {
|
|
|
10317
10370
|
return api;
|
|
10318
10371
|
}
|
|
10319
10372
|
},
|
|
10320
|
-
formula(formulaId, expression) {
|
|
10373
|
+
formula(formulaId, expression, opts) {
|
|
10321
10374
|
assertUniqueFormulaId(formulaId);
|
|
10322
10375
|
try {
|
|
10323
10376
|
parseFormula(expression);
|
|
@@ -10325,10 +10378,10 @@ function diagram(id, options) {
|
|
|
10325
10378
|
const msg = e instanceof Error ? e.message : String(e);
|
|
10326
10379
|
throw new Error(`formula '${formulaId}' \u306E expression syntax error: ${msg}`);
|
|
10327
10380
|
}
|
|
10328
|
-
formulas.push({ id: formulaId, expression });
|
|
10381
|
+
formulas.push({ id: formulaId, expression, ...opts?.label ? { label: opts.label } : {} });
|
|
10329
10382
|
return api;
|
|
10330
10383
|
},
|
|
10331
|
-
deriveChain(baseId, count, exprFn) {
|
|
10384
|
+
deriveChain(baseId, count, exprFn, opts) {
|
|
10332
10385
|
if (!Number.isInteger(count) || count < 1 || count > 100) {
|
|
10333
10386
|
throw new Error(`deriveChain: count (${count}) \u306F 1..100 \u306E\u6574\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`);
|
|
10334
10387
|
}
|
|
@@ -10344,7 +10397,8 @@ function diagram(id, options) {
|
|
|
10344
10397
|
const msg = e instanceof Error ? e.message : String(e);
|
|
10345
10398
|
throw new Error(`deriveChain '${id2}' \u306E expression syntax error: ${msg}`);
|
|
10346
10399
|
}
|
|
10347
|
-
|
|
10400
|
+
const label = opts?.label?.(i);
|
|
10401
|
+
formulas.push({ id: id2, expression: expr, ...label ? { label } : {} });
|
|
10348
10402
|
prev = id2;
|
|
10349
10403
|
}
|
|
10350
10404
|
return api;
|
|
@@ -14913,11 +14967,14 @@ function mergeStateValues(base, overrides) {
|
|
|
14913
14967
|
}
|
|
14914
14968
|
return merged;
|
|
14915
14969
|
}
|
|
14916
|
-
function interpolate(template, values) {
|
|
14970
|
+
function interpolate(template, values, \u540D\u524D\u306E\u8868) {
|
|
14917
14971
|
return template.replace(TEMPLATE_REF_RE, (_, id, accessor) => {
|
|
14918
14972
|
const raw = Object.hasOwn(values, id) ? values[id] : void 0;
|
|
14919
14973
|
if (raw === void 0) return `{${id}${accessor ?? ""}}`;
|
|
14920
|
-
if (!accessor)
|
|
14974
|
+
if (!accessor) {
|
|
14975
|
+
const \u5165\u529B\u6B04 = \u540D\u524D\u306E\u8868?.get(id);
|
|
14976
|
+
return \u5165\u529B\u6B04 ? \u5024\u3092\u540D\u524D\u3067\u8AAD\u3080(\u5165\u529B\u6B04, raw) : raw;
|
|
14977
|
+
}
|
|
14921
14978
|
const arr = parseArraySignal(raw);
|
|
14922
14979
|
if (!arr) return `{${id}${accessor}}`;
|
|
14923
14980
|
if (accessor === ".length") return String(arr.length);
|
|
@@ -24561,7 +24618,8 @@ function GenericNode({
|
|
|
24561
24618
|
node,
|
|
24562
24619
|
active,
|
|
24563
24620
|
value,
|
|
24564
|
-
stateValues
|
|
24621
|
+
stateValues,
|
|
24622
|
+
\u5024\u306E\u540D\u524D
|
|
24565
24623
|
}) {
|
|
24566
24624
|
const base = STYLES[node.kind] ?? FALLBACK;
|
|
24567
24625
|
const toned = toneColor3(node.tone);
|
|
@@ -24647,7 +24705,7 @@ function GenericNode({
|
|
|
24647
24705
|
style.look === "ledger" && /* @__PURE__ */ jsxRuntime.jsx("line", { x1: 1, y1: h - 7, x2: w - 1, y2: h - 7, stroke: paint.stroke, strokeWidth: 1 })
|
|
24648
24706
|
] });
|
|
24649
24707
|
})();
|
|
24650
|
-
const resolvedValue = value !== void 0 ? interpolate(value, stateValues) : void 0;
|
|
24708
|
+
const resolvedValue = value !== void 0 ? interpolate(value, stateValues, \u5024\u306E\u540D\u524D) : void 0;
|
|
24651
24709
|
const hasRows = (node.rows?.length ?? 0) > 0;
|
|
24652
24710
|
const centered = genericTextCentered(node.kind, hasRows);
|
|
24653
24711
|
const textAnchor = centered ? "middle" : "start";
|
|
@@ -24697,7 +24755,7 @@ function GenericNode({
|
|
|
24697
24755
|
}
|
|
24698
24756
|
),
|
|
24699
24757
|
node.rows && node.rows.length > 0 && (() => {
|
|
24700
|
-
const resolved = node.rows.map((row) => interpolate(row, stateValues));
|
|
24758
|
+
const resolved = node.rows.map((row) => interpolate(row, stateValues, \u5024\u306E\u540D\u524D));
|
|
24701
24759
|
const splits = resolved.map(splitRow);
|
|
24702
24760
|
const leftMaxWidth = splits.reduce(
|
|
24703
24761
|
(m, s) => Math.max(m, rowColumnWidth(s.left, GENERIC_ROW_LEFT_SIZE_PX, false)),
|
|
@@ -31362,10 +31420,11 @@ function CdlNodeView({
|
|
|
31362
31420
|
currentPhaseId,
|
|
31363
31421
|
chartLineScale,
|
|
31364
31422
|
\u95A2\u4FC2\u306E\u53D7\u3051\u53E3,
|
|
31365
|
-
lang
|
|
31423
|
+
lang,
|
|
31424
|
+
\u5024\u306E\u540D\u524D
|
|
31366
31425
|
}) {
|
|
31367
|
-
const value = node.value ? interpolate(node.value, stateValues) : void 0;
|
|
31368
|
-
const rows = (node.rows ?? []).map((r) => interpolate(r, stateValues));
|
|
31426
|
+
const value = node.value ? interpolate(node.value, stateValues, \u5024\u306E\u540D\u524D) : void 0;
|
|
31427
|
+
const rows = (node.rows ?? []).map((r) => interpolate(r, stateValues, \u5024\u306E\u540D\u524D));
|
|
31369
31428
|
const boundW = node.wBind ? resolveNumericAttr(node.wBind, stateValues, node.w) : node.w;
|
|
31370
31429
|
const boundH = node.hBind ? resolveNumericAttr(node.hBind, stateValues, node.h) : node.h;
|
|
31371
31430
|
const boundOpacity = node.opacity !== void 0 ? Math.min(1, Math.max(0, resolveNumericAttr(node.opacity, stateValues, 1))) : void 0;
|
|
@@ -31379,9 +31438,9 @@ function CdlNodeView({
|
|
|
31379
31438
|
}
|
|
31380
31439
|
const resolvedNode = {
|
|
31381
31440
|
...node,
|
|
31382
|
-
title: interpolate(node.title, stateValues),
|
|
31383
|
-
subtitle: node.subtitle ? interpolate(node.subtitle, stateValues) : node.subtitle,
|
|
31384
|
-
eyebrow: node.eyebrow ? interpolate(node.eyebrow, stateValues) : node.eyebrow,
|
|
31441
|
+
title: interpolate(node.title, stateValues, \u5024\u306E\u540D\u524D),
|
|
31442
|
+
subtitle: node.subtitle ? interpolate(node.subtitle, stateValues, \u5024\u306E\u540D\u524D) : node.subtitle,
|
|
31443
|
+
eyebrow: node.eyebrow ? interpolate(node.eyebrow, stateValues, \u5024\u306E\u540D\u524D) : node.eyebrow,
|
|
31385
31444
|
w: boundW,
|
|
31386
31445
|
h: boundH
|
|
31387
31446
|
};
|
|
@@ -31662,7 +31721,7 @@ function CdlNodeView({
|
|
|
31662
31721
|
case "mark-end":
|
|
31663
31722
|
return /* @__PURE__ */ jsxRuntime.jsx(MarkEndNode, { node: resolvedNode, active });
|
|
31664
31723
|
default:
|
|
31665
|
-
return /* @__PURE__ */ jsxRuntime.jsx(GenericNode, { node: resolvedNode, active, value: node.value, stateValues });
|
|
31724
|
+
return /* @__PURE__ */ jsxRuntime.jsx(GenericNode, { node: resolvedNode, active, value: node.value, stateValues, \u5024\u306E\u540D\u524D });
|
|
31666
31725
|
}
|
|
31667
31726
|
})();
|
|
31668
31727
|
const offsetX = node.renderOffsetX !== void 0 ? resolveNumericAttr(node.renderOffsetX, stateValues, 0) : 0;
|
|
@@ -31744,7 +31803,8 @@ function CdlStage({
|
|
|
31744
31803
|
stateValues,
|
|
31745
31804
|
debug,
|
|
31746
31805
|
compact = false,
|
|
31747
|
-
svgRef
|
|
31806
|
+
svgRef,
|
|
31807
|
+
\u5024\u306E\u540D\u524D
|
|
31748
31808
|
}) {
|
|
31749
31809
|
const [\u7126\u70B9, set\u7126\u70B9] = react.useState(null);
|
|
31750
31810
|
const \u95A2\u4FC2\u3092\u5149\u3089\u305B\u308B = (laid.relationFocus ?? RELATION_FOCUS_DEFAULT) === "hover";
|
|
@@ -32024,6 +32084,7 @@ function CdlStage({
|
|
|
32024
32084
|
drawing: \u63CF\u304F,
|
|
32025
32085
|
progress: \u63CF\u304F ? \u63CF\u304F\u9032\u307F : progress,
|
|
32026
32086
|
stateValues,
|
|
32087
|
+
\u5024\u306E\u540D\u524D,
|
|
32027
32088
|
currentPhaseId: currentPhase?.id,
|
|
32028
32089
|
chartLineScale: chartLineScales.get(node.id)
|
|
32029
32090
|
}
|
|
@@ -32265,6 +32326,7 @@ function CdlDiagramView({ diagram: diagram2, laid: laidProp, hideHeader = false,
|
|
|
32265
32326
|
if (!isInteractive) return baseStateValues;
|
|
32266
32327
|
return mergeStateValues(baseStateValues, interactive.stateOverrides);
|
|
32267
32328
|
}, [isInteractive, baseStateValues, interactive.stateOverrides]);
|
|
32329
|
+
const \u5024\u306E\u540D\u524D = react.useMemo(() => \u5024\u306E\u540D\u524D\u306E\u8868\u3092\u4F5C\u308B(diagram2.inputs), [diagram2.inputs]);
|
|
32268
32330
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
32269
32331
|
"div",
|
|
32270
32332
|
{
|
|
@@ -32293,7 +32355,7 @@ function CdlDiagramView({ diagram: diagram2, laid: laidProp, hideHeader = false,
|
|
|
32293
32355
|
}
|
|
32294
32356
|
),
|
|
32295
32357
|
isInteractive && interactive.panel,
|
|
32296
|
-
/* @__PURE__ */ jsxRuntime.jsx(CdlStage, { laid, currentPhase, progress, drawProgress, stateValues, debug, compact: hideHeader, svgRef: isInteractive ? interactive.svgRef : void 0 }),
|
|
32358
|
+
/* @__PURE__ */ jsxRuntime.jsx(CdlStage, { laid, currentPhase, progress, drawProgress, stateValues, \u5024\u306E\u540D\u524D, debug, compact: hideHeader, svgRef: isInteractive ? interactive.svgRef : void 0 }),
|
|
32297
32359
|
hideHeader && !hideMiniPhaseIndicator && currentPhase && laid.phases.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-3 border-t border-[var(--cdl-divider,#d4d4d8)]/40 bg-[var(--cdl-stage-bg,#f1f5f9)]/50 px-3 py-2 text-xs", children: [
|
|
32298
32360
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
32299
32361
|
laid.phases.map((p, i) => /* @__PURE__ */ jsxRuntime.jsx(
|