@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/react.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import 'react';
|
|
2
|
-
export { r as CdlDiagramView, n as CdlDiagramViewProps } from './render-
|
|
2
|
+
export { r as CdlDiagramView, n as CdlDiagramViewProps } from './render-MbIjRWdX.cjs';
|
package/dist/react.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import 'react';
|
|
2
|
-
export { r as CdlDiagramView, n as CdlDiagramViewProps } from './render-
|
|
2
|
+
export { r as CdlDiagramView, n as CdlDiagramViewProps } from './render-MbIjRWdX.js';
|
package/dist/react.js
CHANGED
|
@@ -3360,7 +3360,7 @@ function tokenize(src) {
|
|
|
3360
3360
|
`invalid name "{${name}}" at position ${start} (\u7A7A\u767D / { } / . / [ ] \u306F\u540D\u524D\u306B\u4F7F\u3048\u306A\u3044)`
|
|
3361
3361
|
);
|
|
3362
3362
|
}
|
|
3363
|
-
tokens.push({ kind: "id", name, pos: start });
|
|
3363
|
+
tokens.push({ kind: "id", name, pos: start, end: close + 1 });
|
|
3364
3364
|
i = close + 1;
|
|
3365
3365
|
continue;
|
|
3366
3366
|
}
|
|
@@ -3409,7 +3409,7 @@ function tokenize(src) {
|
|
|
3409
3409
|
`property access "${name}.${src[i + 1] ?? ""}..." at position ${start} is not allowed (only Math.* namespace is accessible)`
|
|
3410
3410
|
);
|
|
3411
3411
|
}
|
|
3412
|
-
tokens.push({ kind: "id", name, pos: start });
|
|
3412
|
+
tokens.push({ kind: "id", name, pos: start, end: i });
|
|
3413
3413
|
continue;
|
|
3414
3414
|
}
|
|
3415
3415
|
if (c === "+") {
|
|
@@ -3634,6 +3634,24 @@ function parseFormula(expression) {
|
|
|
3634
3634
|
}
|
|
3635
3635
|
return new Parser(tokens).parse();
|
|
3636
3636
|
}
|
|
3637
|
+
function \u5F0F\u3092\u540D\u672D\u3067\u8AAD\u3080(expression, \u540D\u672D) {
|
|
3638
|
+
let tokens;
|
|
3639
|
+
try {
|
|
3640
|
+
tokens = tokenize(expression);
|
|
3641
|
+
} catch {
|
|
3642
|
+
return expression;
|
|
3643
|
+
}
|
|
3644
|
+
let \u8AAD\u307F = "";
|
|
3645
|
+
let \u524D = 0;
|
|
3646
|
+
for (const t of tokens) {
|
|
3647
|
+
if (t.kind !== "id") continue;
|
|
3648
|
+
const \u672D = \u540D\u672D.get(t.name);
|
|
3649
|
+
if (\u672D === void 0 || \u672D === "") continue;
|
|
3650
|
+
\u8AAD\u307F += expression.slice(\u524D, t.pos) + \u672D;
|
|
3651
|
+
\u524D = t.end;
|
|
3652
|
+
}
|
|
3653
|
+
return \u8AAD\u307F + expression.slice(\u524D);
|
|
3654
|
+
}
|
|
3637
3655
|
function extractIdentifiers(ast, out = /* @__PURE__ */ new Set()) {
|
|
3638
3656
|
switch (ast.type) {
|
|
3639
3657
|
case "number":
|
|
@@ -9542,6 +9560,22 @@ function displayWidth(text) {
|
|
|
9542
9560
|
}
|
|
9543
9561
|
return w;
|
|
9544
9562
|
}
|
|
9563
|
+
function \u6841\u3067\u5272\u308B(text, \u6841) {
|
|
9564
|
+
let w = 0;
|
|
9565
|
+
let \u53D6\u3063\u305F = "";
|
|
9566
|
+
for (const ch of text) {
|
|
9567
|
+
const code = ch.codePointAt(0) ?? 0;
|
|
9568
|
+
const \u5B57\u306E\u6841 = code >= 32 && code <= 126 ? 1 : 2;
|
|
9569
|
+
if (w + \u5B57\u306E\u6841 > \u6841) break;
|
|
9570
|
+
w += \u5B57\u306E\u6841;
|
|
9571
|
+
\u53D6\u3063\u305F += ch;
|
|
9572
|
+
}
|
|
9573
|
+
return [\u53D6\u3063\u305F, text.slice(\u53D6\u3063\u305F.length)];
|
|
9574
|
+
}
|
|
9575
|
+
function \u6841\u3067\u7701\u304F(text, \u4E0A\u9650) {
|
|
9576
|
+
if (displayWidth(text) <= \u4E0A\u9650) return text;
|
|
9577
|
+
return `${\u6841\u3067\u5272\u308B(text, \u4E0A\u9650 - 1)[0]}\u2026`;
|
|
9578
|
+
}
|
|
9545
9579
|
function requiredRowsWidth(rows, kind) {
|
|
9546
9580
|
if (!rows || rows.length === 0) return 0;
|
|
9547
9581
|
const splits = rows.map(splitRow);
|
|
@@ -20551,6 +20585,8 @@ function useInteractiveIntegration(diagram, options = {}) {
|
|
|
20551
20585
|
const readouts = diagram.readouts ?? [];
|
|
20552
20586
|
if (inputs.length === 0 && scrolls.length === 0 && formulasList.length === 0 && readouts.length === 0)
|
|
20553
20587
|
return null;
|
|
20588
|
+
const \u540D\u672D = /* @__PURE__ */ new Map();
|
|
20589
|
+
for (const x of [...inputs, ...formulasList]) if (x.label) \u540D\u672D.set(x.id, x.label);
|
|
20554
20590
|
return (
|
|
20555
20591
|
// 操作部の中の読み出しと入力欄へ、図の言語を届ける (#849)。 型の外の値は英語に落ちる
|
|
20556
20592
|
/* @__PURE__ */ jsx(\u64CD\u4F5C\u90E8\u306E\u8A00\u8A9E.Provider, { value: resolveLang(diagram.lang), children: /* @__PURE__ */ jsxs("div", { className: "cdl-ip-root", "data-cdl-interactive-panel": "true", children: [
|
|
@@ -20559,12 +20595,13 @@ function useInteractiveIntegration(diagram, options = {}) {
|
|
|
20559
20595
|
FormulaReadout,
|
|
20560
20596
|
{
|
|
20561
20597
|
id: f.id,
|
|
20562
|
-
|
|
20598
|
+
name: f.label || f.id,
|
|
20599
|
+
expression: f.label ? \u5F0F\u3092\u540D\u672D\u3067\u8AAD\u3080(f.expression, \u540D\u672D) : f.expression,
|
|
20563
20600
|
value: stateOverrides[f.id]
|
|
20564
20601
|
},
|
|
20565
20602
|
f.id
|
|
20566
20603
|
)) }),
|
|
20567
|
-
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)) }),
|
|
20604
|
+
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)) }),
|
|
20568
20605
|
readouts.length > 0 && /* @__PURE__ */ jsx("div", { className: "cdl-ip-group", children: readouts.map((r) => /* @__PURE__ */ jsx(ReadoutWidget, { readout: r, stateOverrides: mergedStateValues }, r.id)) })
|
|
20569
20606
|
] }) })
|
|
20570
20607
|
);
|
|
@@ -20821,11 +20858,12 @@ function NumberInputWidget({
|
|
|
20821
20858
|
}
|
|
20822
20859
|
function FormulaReadout({
|
|
20823
20860
|
id,
|
|
20861
|
+
name,
|
|
20824
20862
|
expression,
|
|
20825
20863
|
value
|
|
20826
20864
|
}) {
|
|
20827
20865
|
return /* @__PURE__ */ jsxs("div", { className: "cdl-ip-item cdl-ip-formula", "data-cdl-formula": id, children: [
|
|
20828
|
-
/* @__PURE__ */ jsx("span", { className: "cdl-ip-label", children:
|
|
20866
|
+
/* @__PURE__ */ jsx("span", { className: "cdl-ip-label", children: name }),
|
|
20829
20867
|
/* @__PURE__ */ jsxs("code", { className: "cdl-ip-formula-expr", children: [
|
|
20830
20868
|
"= ",
|
|
20831
20869
|
expression
|
|
@@ -20833,11 +20871,11 @@ function FormulaReadout({
|
|
|
20833
20871
|
/* @__PURE__ */ jsx("span", { className: "cdl-ip-formula-value", children: String(value ?? "") })
|
|
20834
20872
|
] });
|
|
20835
20873
|
}
|
|
20836
|
-
function ScrollReadout({ id, progress }) {
|
|
20874
|
+
function ScrollReadout({ id, name, progress }) {
|
|
20837
20875
|
const p = typeof progress === "number" ? progress : 0;
|
|
20838
20876
|
const pct = Math.round(p * 100);
|
|
20839
20877
|
return /* @__PURE__ */ jsxs("div", { className: "cdl-ip-item cdl-ip-scroll", "data-cdl-scroll": id, children: [
|
|
20840
|
-
/* @__PURE__ */ jsx("span", { className: "cdl-ip-label", children:
|
|
20878
|
+
/* @__PURE__ */ jsx("span", { className: "cdl-ip-label", children: name }),
|
|
20841
20879
|
/* @__PURE__ */ jsx("div", { className: "cdl-ip-scroll-track", children: /* @__PURE__ */ jsx("div", { className: "cdl-ip-scroll-fill", style: { width: `${pct}%` } }) }),
|
|
20842
20880
|
/* @__PURE__ */ jsxs("span", { className: "cdl-ip-scroll-value", children: [
|
|
20843
20881
|
pct,
|
|
@@ -26163,7 +26201,7 @@ function KanbanBoardReadout({
|
|
|
26163
26201
|
style: { userSelect: "none" },
|
|
26164
26202
|
children: [
|
|
26165
26203
|
/* @__PURE__ */ jsx("title", { children: task.title }),
|
|
26166
|
-
task.title
|
|
26204
|
+
\u6841\u3067\u7701\u304F(task.title, 18)
|
|
26167
26205
|
]
|
|
26168
26206
|
}
|
|
26169
26207
|
)
|
|
@@ -26300,7 +26338,7 @@ function TimelineVerticalReadout({
|
|
|
26300
26338
|
style: { userSelect: "none" },
|
|
26301
26339
|
children: [
|
|
26302
26340
|
/* @__PURE__ */ jsx("title", { children: ev.title }),
|
|
26303
|
-
ev.title
|
|
26341
|
+
\u6841\u3067\u7701\u304F(ev.title, 38)
|
|
26304
26342
|
]
|
|
26305
26343
|
}
|
|
26306
26344
|
),
|
|
@@ -26314,7 +26352,7 @@ function TimelineVerticalReadout({
|
|
|
26314
26352
|
style: { userSelect: "none" },
|
|
26315
26353
|
children: [
|
|
26316
26354
|
/* @__PURE__ */ jsx("title", { children: ev.description }),
|
|
26317
|
-
ev.description
|
|
26355
|
+
\u6841\u3067\u7701\u304F(ev.description, 44)
|
|
26318
26356
|
]
|
|
26319
26357
|
}
|
|
26320
26358
|
) : null
|
|
@@ -26657,7 +26695,7 @@ function StepProgressReadout({
|
|
|
26657
26695
|
style: { userSelect: "none" },
|
|
26658
26696
|
children: [
|
|
26659
26697
|
/* @__PURE__ */ jsx("title", { children: s }),
|
|
26660
|
-
s
|
|
26698
|
+
\u6841\u3067\u7701\u304F(s, 10)
|
|
26661
26699
|
]
|
|
26662
26700
|
}
|
|
26663
26701
|
)
|
|
@@ -26718,7 +26756,7 @@ function UserPresenceReadout({
|
|
|
26718
26756
|
fontWeight: 500,
|
|
26719
26757
|
fill: "#0f172a",
|
|
26720
26758
|
style: { userSelect: "none" },
|
|
26721
|
-
children: u.name
|
|
26759
|
+
children: \u6841\u3067\u7701\u304F(u.name, 24)
|
|
26722
26760
|
}
|
|
26723
26761
|
),
|
|
26724
26762
|
/* @__PURE__ */ jsx(
|
|
@@ -26880,7 +26918,7 @@ function OrgChartMiniReadout({
|
|
|
26880
26918
|
style: { userSelect: "none" },
|
|
26881
26919
|
children: [
|
|
26882
26920
|
/* @__PURE__ */ jsx("title", { children: n.name }),
|
|
26883
|
-
n.name
|
|
26921
|
+
\u6841\u3067\u7701\u304F(n.name, 10)
|
|
26884
26922
|
]
|
|
26885
26923
|
}
|
|
26886
26924
|
),
|
|
@@ -27460,7 +27498,7 @@ function FileDropzoneReadout({
|
|
|
27460
27498
|
),
|
|
27461
27499
|
/* @__PURE__ */ jsxs("text", { x: 54, y: 34, fontSize: 12, fontWeight: 600, fill: "#0f172a", style: { userSelect: "none" }, children: [
|
|
27462
27500
|
/* @__PURE__ */ jsx("title", { children: filename }),
|
|
27463
|
-
filename
|
|
27501
|
+
\u6841\u3067\u7701\u304F(filename, 26)
|
|
27464
27502
|
] }),
|
|
27465
27503
|
/* @__PURE__ */ jsx("text", { x: 54, y: 50, fontSize: 10, fill: "#64748b", style: { userSelect: "none" }, children: /* @__PURE__ */ jsx(\u5B57, { k: "readout.dropzone.uploaded" }) })
|
|
27466
27504
|
] }) : /* @__PURE__ */ jsxs("g", { "data-cdl-dropzone-empty": "1", children: [
|
|
@@ -27539,7 +27577,7 @@ function LogStreamReadout({
|
|
|
27539
27577
|
/* @__PURE__ */ jsx("rect", { x: 0, y: 0, width, height, fill: "#0f172a", rx: 4 }),
|
|
27540
27578
|
shown.map((r, i) => {
|
|
27541
27579
|
const y = 4 + i * rowH;
|
|
27542
|
-
const displayMsg = r.msg
|
|
27580
|
+
const displayMsg = \u6841\u3067\u7701\u304F(r.msg, 24);
|
|
27543
27581
|
return /* @__PURE__ */ jsxs("g", { "data-cdl-log-row": i, children: [
|
|
27544
27582
|
/* @__PURE__ */ jsx("text", { x: 6, y: y + 12, fontSize: 9, fill: "#94a3b8", fontFamily: "monospace", style: { userSelect: "none" }, children: r.ts }),
|
|
27545
27583
|
/* @__PURE__ */ jsx("rect", { x: 62, y: y + 3, width: 26, height: 12, fill: levelColors[r.level] ?? "#94a3b8", rx: 2 }),
|
|
@@ -27639,7 +27677,7 @@ function AlertBannerReadout({
|
|
|
27639
27677
|
style: { userSelect: "none" },
|
|
27640
27678
|
children: [
|
|
27641
27679
|
/* @__PURE__ */ jsx("title", { children: message }),
|
|
27642
|
-
message
|
|
27680
|
+
\u6841\u3067\u7701\u304F(message, 32)
|
|
27643
27681
|
]
|
|
27644
27682
|
}
|
|
27645
27683
|
)
|
|
@@ -27709,7 +27747,7 @@ function ServiceHealthReadout({
|
|
|
27709
27747
|
style: { userSelect: "none" },
|
|
27710
27748
|
children: [
|
|
27711
27749
|
/* @__PURE__ */ jsx("title", { children: s.name }),
|
|
27712
|
-
s.name
|
|
27750
|
+
\u6841\u3067\u7701\u304F(s.name, 10)
|
|
27713
27751
|
]
|
|
27714
27752
|
}
|
|
27715
27753
|
)
|
|
@@ -27888,7 +27926,7 @@ function PricingTierReadout({
|
|
|
27888
27926
|
),
|
|
27889
27927
|
features.slice(0, 3).map((f, i) => {
|
|
27890
27928
|
const y = 96 + i * 18;
|
|
27891
|
-
const displayF = f
|
|
27929
|
+
const displayF = \u6841\u3067\u7701\u304F(f, 24);
|
|
27892
27930
|
return /* @__PURE__ */ jsxs("g", { "data-cdl-tier-feature": i, children: [
|
|
27893
27931
|
/* @__PURE__ */ jsx("text", { x: 16, y, fontSize: 11, fill: colorAccent, style: { userSelect: "none" }, children: "\u2713" }),
|
|
27894
27932
|
/* @__PURE__ */ jsxs("text", { x: 30, y, fontSize: 11, fill: "#0f172a", style: { userSelect: "none" }, children: [
|
|
@@ -28039,6 +28077,7 @@ function ArticlePreviewReadout({
|
|
|
28039
28077
|
const width = 300;
|
|
28040
28078
|
const height = 116;
|
|
28041
28079
|
const thumbW = 80;
|
|
28080
|
+
const [\u629C\u7C8B\u306E\u4E00\u884C\u76EE, \u629C\u7C8B\u306E\u6B8B\u308A] = \u6841\u3067\u5272\u308B(excerpt, 28);
|
|
28042
28081
|
return /* @__PURE__ */ jsxs("div", { className: "cdl-ip-item cdl-ip-readout-article-preview", "data-cdl-readout": id, children: [
|
|
28043
28082
|
/* @__PURE__ */ jsx("span", { className: "cdl-ip-label", children: label }),
|
|
28044
28083
|
/* @__PURE__ */ jsxs(
|
|
@@ -28075,15 +28114,15 @@ function ArticlePreviewReadout({
|
|
|
28075
28114
|
style: { userSelect: "none" },
|
|
28076
28115
|
children: [
|
|
28077
28116
|
/* @__PURE__ */ jsx("title", { children: title }),
|
|
28078
|
-
title
|
|
28117
|
+
\u6841\u3067\u7701\u304F(title, 26)
|
|
28079
28118
|
]
|
|
28080
28119
|
}
|
|
28081
28120
|
),
|
|
28082
28121
|
/* @__PURE__ */ jsxs("text", { x: thumbW + 20, y: 44, fontSize: 10, fill: "#334155", style: { userSelect: "none" }, children: [
|
|
28083
28122
|
/* @__PURE__ */ jsx("title", { children: excerpt }),
|
|
28084
|
-
|
|
28123
|
+
\u629C\u7C8B\u306E\u4E00\u884C\u76EE
|
|
28085
28124
|
] }),
|
|
28086
|
-
/* @__PURE__ */ jsx("text", { x: thumbW + 20, y: 60, fontSize: 10, fill: "#334155", style: { userSelect: "none" }, children:
|
|
28125
|
+
/* @__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) }),
|
|
28087
28126
|
/* @__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 } }) }),
|
|
28088
28127
|
/* @__PURE__ */ jsx("text", { x: width - 8, y: height - 14, fontSize: 10, textAnchor: "end", fill: "#94a3b8", style: { userSelect: "none" }, children: timeAgo })
|
|
28089
28128
|
]
|
|
@@ -28135,7 +28174,7 @@ function TocNavReadout({
|
|
|
28135
28174
|
shown.map((it, i) => {
|
|
28136
28175
|
const y = 4 + i * rowH;
|
|
28137
28176
|
const indent = 12 + it.level * 16;
|
|
28138
|
-
const displayT = it.title
|
|
28177
|
+
const displayT = \u6841\u3067\u7701\u304F(it.title, 30);
|
|
28139
28178
|
return /* @__PURE__ */ jsxs("g", { "data-cdl-toc-item": i, children: [
|
|
28140
28179
|
it.active ? /* @__PURE__ */ jsx("rect", { x: 4, y, width: 3, height: rowH - 4, fill: colorActive, rx: 1 }) : null,
|
|
28141
28180
|
/* @__PURE__ */ jsxs(
|