@cardenelabs/cdl 0.11.0 → 0.12.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 +65 -1
- package/SPEC.md +12 -2
- package/dist/index.cjs +361 -177
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +361 -177
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +361 -177
- 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 +361 -177
- package/dist/react.js.map +1 -1
- package/dist/{render-DwH8v5Mb.d.cts → render-C7FKvMqq.d.cts} +5 -0
- package/dist/{render-DwH8v5Mb.d.ts → render-C7FKvMqq.d.ts} +5 -0
- package/package.json +1 -1
- package/src/kinds/box-lines.ts +12 -2
- package/src/kinds/chart-bar.tsx +3 -7
- package/src/kinds/chart-line.tsx +4 -10
- package/src/kinds/chart-pie.tsx +3 -7
- package/src/kinds/draw-progress.ts +100 -0
- package/src/kinds/funnel.tsx +101 -58
- package/src/kinds/gantt.tsx +25 -1
- package/src/kinds/mind-map.tsx +70 -16
- package/src/kinds/tree.tsx +57 -7
- package/src/kinds/user-journey.tsx +29 -1
- package/src/render/nodes.tsx +45 -5
- package/src/types.ts +5 -0
- package/src/validate.ts +15 -1
package/dist/react.js
CHANGED
|
@@ -4884,7 +4884,16 @@ function nodeTemplateTexts(node) {
|
|
|
4884
4884
|
|
|
4885
4885
|
// src/validate.ts
|
|
4886
4886
|
var TONES2 = new Set(TONES);
|
|
4887
|
-
var DRAW_KINDS = /* @__PURE__ */ new Set([
|
|
4887
|
+
var DRAW_KINDS = /* @__PURE__ */ new Set([
|
|
4888
|
+
"chart-line",
|
|
4889
|
+
"chart-bar",
|
|
4890
|
+
"chart-pie",
|
|
4891
|
+
"journey-map",
|
|
4892
|
+
"mind-map",
|
|
4893
|
+
"tree-hierarchy",
|
|
4894
|
+
"gantt-timeline",
|
|
4895
|
+
"funnel-stages"
|
|
4896
|
+
]);
|
|
4888
4897
|
var KINDS = new Set(NODE_KINDS);
|
|
4889
4898
|
var ENG_BANNED = /\b(FUNCTION|STORAGE|EVENT LOG|BALANCES MAPPING|READ|WRITE|EMIT|CALL)\b/;
|
|
4890
4899
|
function validate(diag) {
|
|
@@ -6582,6 +6591,44 @@ function resolveMindData(data, values) {
|
|
|
6582
6591
|
const \u89E3\u6C7A\u5F8C = { ...data, rootTitle: root.value, branches };
|
|
6583
6592
|
return root.ok ? \u89E3\u6C7A\u5F8C : { ...\u89E3\u6C7A\u5F8C, unresolved: true };
|
|
6584
6593
|
}
|
|
6594
|
+
|
|
6595
|
+
// src/kinds/draw-progress.ts
|
|
6596
|
+
function \u9032\u307F\u3092\u7573\u3080(drawing, progress) {
|
|
6597
|
+
if (!drawing) return 1;
|
|
6598
|
+
return Math.min(1, Math.max(0, Number.isFinite(progress) ? progress : 1));
|
|
6599
|
+
}
|
|
6600
|
+
function \u4F38\u3070\u3059dash(drawing, \u4F38\u3073) {
|
|
6601
|
+
if (!drawing) return {};
|
|
6602
|
+
return { pathLength: 1, strokeDasharray: 1, strokeDashoffset: 1 - \u4F38\u3073 };
|
|
6603
|
+
}
|
|
6604
|
+
function \u6BB5\u306E\u4F38\u3073(\u4F38\u3073, \u6DF1\u3055, \u6700\u5927\u6DF1\u3055) {
|
|
6605
|
+
if (\u6700\u5927\u6DF1\u3055 <= 0 || \u6DF1\u3055 <= 0) return 1;
|
|
6606
|
+
const \u5E45 = 1 / \u6700\u5927\u6DF1\u3055;
|
|
6607
|
+
const \u59CB\u307E\u308A = (\u6DF1\u3055 - 1) * \u5E45;
|
|
6608
|
+
return Math.min(1, Math.max(0, (\u4F38\u3073 - \u59CB\u307E\u308A) / \u5E45));
|
|
6609
|
+
}
|
|
6610
|
+
function \u30D9\u30B8\u30A8\u306E\u7D2F\u7A4D\u5272\u5408(\u70B9, \u5236\u5FA1\u70B9, \u5206\u5272\u6570 = 16) {
|
|
6611
|
+
if (\u70B9.length <= 1) return \u70B9.map(() => 0);
|
|
6612
|
+
const \u9577\u3055 = [0];
|
|
6613
|
+
let \u5408\u8A08 = 0;
|
|
6614
|
+
for (let i = 1; i < \u70B9.length; i++) {
|
|
6615
|
+
const p0 = \u70B9[i - 1];
|
|
6616
|
+
const p3 = \u70B9[i];
|
|
6617
|
+
const [p1, p2] = \u5236\u5FA1\u70B9(p0, p3);
|
|
6618
|
+
let \u524D = p0;
|
|
6619
|
+
for (let s = 1; s <= \u5206\u5272\u6570; s++) {
|
|
6620
|
+
const t = s / \u5206\u5272\u6570;
|
|
6621
|
+
const u = 1 - t;
|
|
6622
|
+
const x = u * u * u * p0.x + 3 * u * u * t * p1.x + 3 * u * t * t * p2.x + t * t * t * p3.x;
|
|
6623
|
+
const y = u * u * u * p0.y + 3 * u * u * t * p1.y + 3 * u * t * t * p2.y + t * t * t * p3.y;
|
|
6624
|
+
\u5408\u8A08 += Math.hypot(x - \u524D.x, y - \u524D.y);
|
|
6625
|
+
\u524D = { x, y };
|
|
6626
|
+
}
|
|
6627
|
+
\u9577\u3055.push(\u5408\u8A08);
|
|
6628
|
+
}
|
|
6629
|
+
if (\u5408\u8A08 === 0) return \u70B9.map(() => 0);
|
|
6630
|
+
return \u9577\u3055.map((l) => l / \u5408\u8A08);
|
|
6631
|
+
}
|
|
6585
6632
|
function ChartLineNode({
|
|
6586
6633
|
node,
|
|
6587
6634
|
active,
|
|
@@ -6619,7 +6666,7 @@ function ChartLineNode({
|
|
|
6619
6666
|
\u70B9\u307E\u3067\u306E\u9577\u3055.push(\u7DDA\u306E\u5168\u9577);
|
|
6620
6667
|
\u524D\u306E\u70B9 = \u4ECA\u306E\u70B9;
|
|
6621
6668
|
}
|
|
6622
|
-
const \u4F38\u3073 = drawing
|
|
6669
|
+
const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
6623
6670
|
const \u7DDA\u306E\u5148\u304C\u5C4A\u3044\u305F = (idx) => {
|
|
6624
6671
|
if (!drawing) return true;
|
|
6625
6672
|
if (data.length <= 1) return true;
|
|
@@ -6704,7 +6751,7 @@ function ChartLineNode({
|
|
|
6704
6751
|
strokeWidth: 2.5,
|
|
6705
6752
|
strokeLinejoin: "round",
|
|
6706
6753
|
strokeLinecap: "round",
|
|
6707
|
-
|
|
6754
|
+
...\u4F38\u3070\u3059dash(drawing, \u4F38\u3073)
|
|
6708
6755
|
}
|
|
6709
6756
|
),
|
|
6710
6757
|
data.map((d, idx) => {
|
|
@@ -6804,7 +6851,7 @@ function ChartPieNode({
|
|
|
6804
6851
|
const path = `M ${cx} ${cy} L ${x1} ${y1} A ${radius} ${radius} 0 ${large} 1 ${x2} ${y2} Z`;
|
|
6805
6852
|
return { d, frac, path, startFrac };
|
|
6806
6853
|
});
|
|
6807
|
-
const \u958B\u304D = drawing
|
|
6854
|
+
const \u958B\u304D = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
6808
6855
|
const \u5207\u308A\u629C\u304Did = `cdl-pie-draw-${instanceId}`;
|
|
6809
6856
|
const \u958B\u304D\u59CB\u3081\u305F = (startFrac) => !drawing || \u958B\u304D > startFrac;
|
|
6810
6857
|
const legendX = pieAreaW + 8;
|
|
@@ -6919,7 +6966,7 @@ function ChartBarNode({
|
|
|
6919
6966
|
const v = vMax * i / gridCount;
|
|
6920
6967
|
return { y: yAt(v), value: v };
|
|
6921
6968
|
});
|
|
6922
|
-
const \u4F38\u3073 = drawing
|
|
6969
|
+
const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
6923
6970
|
const \u6A2A\u8EF8\u306Ey = PAD_TOP + canvasH;
|
|
6924
6971
|
return /* @__PURE__ */ jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
6925
6972
|
/* @__PURE__ */ jsx(
|
|
@@ -7023,7 +7070,9 @@ function ChartBarNode({
|
|
|
7023
7070
|
function GanttNode({
|
|
7024
7071
|
node,
|
|
7025
7072
|
active,
|
|
7026
|
-
stateValues = {}
|
|
7073
|
+
stateValues = {},
|
|
7074
|
+
drawing = false,
|
|
7075
|
+
progress = 1
|
|
7027
7076
|
}) {
|
|
7028
7077
|
const x0 = node.cx - node.w / 2;
|
|
7029
7078
|
const y0 = node.cy - node.h / 2;
|
|
@@ -7082,6 +7131,7 @@ function GanttNode({
|
|
|
7082
7131
|
const \u5E2F\u306E\u4F59\u767D = Math.min(6, cellW / 2);
|
|
7083
7132
|
const \u5E2F\u306E\u5DE6 = (idx) => xAt(idx) + \u5E2F\u306E\u4F59\u767D / 2;
|
|
7084
7133
|
const \u5E2F\u306E\u53F3 = (idx) => xAt(idx) + cellW - \u5E2F\u306E\u4F59\u767D / 2;
|
|
7134
|
+
const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
7085
7135
|
const taskById = new Map(\u6574\u3048\u305F.map((t) => [t.id, t]));
|
|
7086
7136
|
const rowOf = new Map(\u6574\u3048\u305F.map((t, i) => [t.id, i]));
|
|
7087
7137
|
return /* @__PURE__ */ jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
@@ -7156,34 +7206,41 @@ function GanttNode({
|
|
|
7156
7206
|
const bx = \u5E2F\u306E\u5DE6(t.startIdx);
|
|
7157
7207
|
const by = yAt(row);
|
|
7158
7208
|
const bw = Math.max(0, \u5E2F\u306E\u53F3(t.endIdx) - bx);
|
|
7159
|
-
return /* @__PURE__ */ jsxs(
|
|
7160
|
-
|
|
7161
|
-
|
|
7162
|
-
{
|
|
7163
|
-
|
|
7164
|
-
|
|
7165
|
-
|
|
7166
|
-
|
|
7167
|
-
|
|
7168
|
-
|
|
7169
|
-
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
|
|
7186
|
-
|
|
7209
|
+
return /* @__PURE__ */ jsxs(
|
|
7210
|
+
"g",
|
|
7211
|
+
{
|
|
7212
|
+
...drawing ? { transform: `translate(${bx} 0) scale(${\u4F38\u3073} 1) translate(${-bx} 0)` } : {},
|
|
7213
|
+
children: [
|
|
7214
|
+
/* @__PURE__ */ jsx(
|
|
7215
|
+
"rect",
|
|
7216
|
+
{
|
|
7217
|
+
"data-cdl-role": "gantt-bar",
|
|
7218
|
+
"data-cdl-unresolved": t.unresolved ? "true" : void 0,
|
|
7219
|
+
"data-cdl-clipped": "clipped" in t && t.clipped ? "true" : void 0,
|
|
7220
|
+
x: bx,
|
|
7221
|
+
y: by,
|
|
7222
|
+
width: bw,
|
|
7223
|
+
height: rowH,
|
|
7224
|
+
rx: 4,
|
|
7225
|
+
fill: toneColor3(t.tone),
|
|
7226
|
+
fillOpacity: 0.9
|
|
7227
|
+
}
|
|
7228
|
+
),
|
|
7229
|
+
t.owner && rowH >= 22 && /* @__PURE__ */ jsx(
|
|
7230
|
+
"text",
|
|
7231
|
+
{
|
|
7232
|
+
x: bx + 8,
|
|
7233
|
+
y: by + rowH / 2 + 4,
|
|
7234
|
+
fontSize: 11,
|
|
7235
|
+
fill: "var(--cdl-node-fill, #ffffff)",
|
|
7236
|
+
fontWeight: 600,
|
|
7237
|
+
children: t.owner
|
|
7238
|
+
}
|
|
7239
|
+
)
|
|
7240
|
+
]
|
|
7241
|
+
},
|
|
7242
|
+
`bar-${t.id}`
|
|
7243
|
+
);
|
|
7187
7244
|
}),
|
|
7188
7245
|
\u6574\u3048\u305F.filter((t) => t.dependsOn && taskById.has(t.dependsOn)).map((t) => {
|
|
7189
7246
|
const parent = taskById.get(t.dependsOn);
|
|
@@ -7203,29 +7260,33 @@ function GanttNode({
|
|
|
7203
7260
|
const hasRoom = enterX - startX >= elbowGap;
|
|
7204
7261
|
const path = hasRoom ? `M ${startX} ${parentMidY} L ${enterX} ${parentMidY} L ${enterX} ${tipY} L ${tipX} ${tipY}` : `M ${startX} ${parentMidY} L ${startX + elbowGap} ${parentMidY} L ${startX + elbowGap} ${(parentMidY + tipY) / 2} L ${enterX} ${(parentMidY + tipY) / 2} L ${enterX} ${tipY} L ${tipX} ${tipY}`;
|
|
7205
7262
|
const arrowHeadPath = `M ${tipX + arrowHeadSize} ${tipY} L ${tipX} ${tipY - arrowHeadSize / 2} L ${tipX} ${tipY + arrowHeadSize / 2} Z`;
|
|
7206
|
-
return
|
|
7207
|
-
|
|
7208
|
-
|
|
7209
|
-
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
|
|
7213
|
-
|
|
7214
|
-
|
|
7215
|
-
|
|
7216
|
-
|
|
7217
|
-
|
|
7218
|
-
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
7263
|
+
return (
|
|
7264
|
+
// 矢印は両端の帯が出てから描く。 帯が無い場所へ矢印だけが伸びると、
|
|
7265
|
+
// 指す先の無い線になる (cdl#521)
|
|
7266
|
+
drawing && \u4F38\u3073 < 1 ? null : /* @__PURE__ */ jsxs("g", { "data-cdl-role": "gantt-arrow", children: [
|
|
7267
|
+
/* @__PURE__ */ jsx(
|
|
7268
|
+
"path",
|
|
7269
|
+
{
|
|
7270
|
+
d: path,
|
|
7271
|
+
fill: "none",
|
|
7272
|
+
stroke: "var(--cdl-text-mute, #8a8678)",
|
|
7273
|
+
strokeWidth: 1.75,
|
|
7274
|
+
strokeLinejoin: "round",
|
|
7275
|
+
strokeLinecap: "round"
|
|
7276
|
+
}
|
|
7277
|
+
),
|
|
7278
|
+
/* @__PURE__ */ jsx(
|
|
7279
|
+
"path",
|
|
7280
|
+
{
|
|
7281
|
+
d: arrowHeadPath,
|
|
7282
|
+
fill: "var(--cdl-text-mute, #8a8678)",
|
|
7283
|
+
stroke: "var(--cdl-text-mute, #8a8678)",
|
|
7284
|
+
strokeWidth: 0.5,
|
|
7285
|
+
strokeLinejoin: "round"
|
|
7286
|
+
}
|
|
7287
|
+
)
|
|
7288
|
+
] }, `dep-${parent.id}-${t.id}`)
|
|
7289
|
+
);
|
|
7229
7290
|
})
|
|
7230
7291
|
] });
|
|
7231
7292
|
}
|
|
@@ -7239,17 +7300,20 @@ var \u884C\u9001\u308A\u306E\u6BD4 = 1.15;
|
|
|
7239
7300
|
var \u5B57\u306E\u9AD8\u3055\u306E\u6BD4 = 0.72;
|
|
7240
7301
|
var \u4E0A\u4E0B\u306E\u4F59\u767D = 2;
|
|
7241
7302
|
var \u5DE6\u53F3\u306E\u4F59\u767D = 8;
|
|
7242
|
-
function \
|
|
7243
|
-
|
|
7244
|
-
|
|
7303
|
+
function \u4F7F\u3048\u308B\u5E45(\u7BB1\u306E\u5E45) {
|
|
7304
|
+
return \u7BB1\u306E\u5E45 - \u5DE6\u53F3\u306E\u4F59\u767D * 2;
|
|
7305
|
+
}
|
|
7306
|
+
function \u5E45\u3067\u5207\u308B(text, fontSize, \u4F7F\u3048\u308B\u5E452, \u6E2C\u308B = textWidth) {
|
|
7307
|
+
if (\u4F7F\u3048\u308B\u5E452 <= 0) return "";
|
|
7308
|
+
if (\u6E2C\u308B(text, fontSize) <= \u4F7F\u3048\u308B\u5E452) return text;
|
|
7245
7309
|
const \u7701\u7565 = "\u2026";
|
|
7246
7310
|
const \u7701\u7565\u306E\u5E45 = \u6E2C\u308B(\u7701\u7565, fontSize);
|
|
7247
|
-
if (\u7701\u7565\u306E\u5E45 > \u4F7F\u3048\u308B\
|
|
7311
|
+
if (\u7701\u7565\u306E\u5E45 > \u4F7F\u3048\u308B\u5E452) return "";
|
|
7248
7312
|
let \u51FA = "";
|
|
7249
7313
|
let \u5E45 = 0;
|
|
7250
7314
|
for (const c of \u66F8\u8A18\u7D20\u306B\u5206\u3051\u308B(text)) {
|
|
7251
7315
|
const \u5B57\u306E\u5E452 = \u6E2C\u308B(c, fontSize);
|
|
7252
|
-
if (\u5E45 + \u5B57\u306E\u5E452 + \u7701\u7565\u306E\u5E45 > \u4F7F\u3048\u308B\
|
|
7316
|
+
if (\u5E45 + \u5B57\u306E\u5E452 + \u7701\u7565\u306E\u5E45 > \u4F7F\u3048\u308B\u5E452) break;
|
|
7253
7317
|
\u5E45 += \u5B57\u306E\u5E452;
|
|
7254
7318
|
\u51FA += c;
|
|
7255
7319
|
}
|
|
@@ -7267,13 +7331,13 @@ function \u7BB1\u306B\u7A4D\u3080(\u884C, \u7BB1\u306E\u5E45, \u7BB1\u306E\u9AD8
|
|
|
7267
7331
|
const \u9AD8\u3055 = (rs) => rs.reduce((a, r) => a + r.fontSize * \u884C\u9001\u308A\u306E\u6BD4, 0);
|
|
7268
7332
|
const \u6B8B\u3059 = [...\u5019\u88DC];
|
|
7269
7333
|
while (\u6B8B\u3059.length > 1 && \u9AD8\u3055(\u6B8B\u3059) > \u4F7F\u3048\u308B\u9AD8\u3055) \u6B8B\u3059.pop();
|
|
7270
|
-
const \u4F7F\u3048\u308B\u5E45
|
|
7334
|
+
const \u5E45 = \u4F7F\u3048\u308B\u5E45(\u7BB1\u306E\u5E45);
|
|
7271
7335
|
const \u7DCF\u9AD8 = \u9AD8\u3055(\u6B8B\u3059);
|
|
7272
7336
|
let \u7A4D\u307F = -\u7DCF\u9AD8 / 2;
|
|
7273
7337
|
return \u6B8B\u3059.map((r) => {
|
|
7274
7338
|
const dy = \u7A4D\u307F + (\u884C\u9001\u308A\u306E\u6BD4 + \u5B57\u306E\u9AD8\u3055\u306E\u6BD4) / 2 * r.fontSize;
|
|
7275
7339
|
\u7A4D\u307F += r.fontSize * \u884C\u9001\u308A\u306E\u6BD4;
|
|
7276
|
-
return { ...r, text: \u5E45\u3067\u5207\u308B(r.text, r.fontSize, \
|
|
7340
|
+
return { ...r, text: \u5E45\u3067\u5207\u308B(r.text, r.fontSize, \u5E45), dy };
|
|
7277
7341
|
});
|
|
7278
7342
|
}
|
|
7279
7343
|
var MIND_TONES = ["accent", "teal", "success", "warning", "info", "error"];
|
|
@@ -7281,7 +7345,9 @@ var MIND_BOX_GAP = 24;
|
|
|
7281
7345
|
function MindMapNode({
|
|
7282
7346
|
node,
|
|
7283
7347
|
active,
|
|
7284
|
-
stateValues = {}
|
|
7348
|
+
stateValues = {},
|
|
7349
|
+
drawing = false,
|
|
7350
|
+
progress = 1
|
|
7285
7351
|
}) {
|
|
7286
7352
|
const x0 = node.cx - node.w / 2;
|
|
7287
7353
|
const y0 = node.cy - node.h / 2;
|
|
@@ -7293,6 +7359,9 @@ function MindMapNode({
|
|
|
7293
7359
|
const canvasW = node.w - PAD * 2;
|
|
7294
7360
|
const canvasH = node.h - PAD * 2;
|
|
7295
7361
|
const layout2 = computeMindMapLayout(mindData, canvasCx, canvasCy, canvasW, canvasH);
|
|
7362
|
+
const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
7363
|
+
const \u6700\u5927\u6DF1\u3055 = layout2.nodes.reduce((m, n) => Math.max(m, n.depth), 0);
|
|
7364
|
+
const \u7BB1\u304C\u51FA\u308B = (\u6DF1\u3055) => !drawing || \u6BB5\u306E\u4F38\u3073(\u4F38\u3073, \u6DF1\u3055, \u6700\u5927\u6DF1\u3055) >= 1;
|
|
7296
7365
|
return /* @__PURE__ */ jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
7297
7366
|
/* @__PURE__ */ jsx(
|
|
7298
7367
|
"rect",
|
|
@@ -7308,20 +7377,25 @@ function MindMapNode({
|
|
|
7308
7377
|
strokeWidth: active ? 3 : 1.25
|
|
7309
7378
|
}
|
|
7310
7379
|
),
|
|
7311
|
-
layout2.edges.map((e, i) =>
|
|
7312
|
-
|
|
7313
|
-
|
|
7314
|
-
"
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7380
|
+
layout2.edges.map((e, i) => {
|
|
7381
|
+
const \u679D\u306E\u4F38\u3073 = e.deferUntilComplete ? \u4F38\u3073 >= 1 ? 1 : 0 : \u6BB5\u306E\u4F38\u3073(\u4F38\u3073, e.depth, \u6700\u5927\u6DF1\u3055);
|
|
7382
|
+
return /* @__PURE__ */ jsx(
|
|
7383
|
+
"path",
|
|
7384
|
+
{
|
|
7385
|
+
"data-cdl-role": "mind-edge",
|
|
7386
|
+
d: e.d,
|
|
7387
|
+
fill: "none",
|
|
7388
|
+
stroke: toneColor4(e.tone),
|
|
7389
|
+
strokeWidth: 2.5,
|
|
7390
|
+
strokeOpacity: 0.55,
|
|
7391
|
+
strokeLinecap: "round",
|
|
7392
|
+
...\u4F38\u3070\u3059dash(drawing, \u679D\u306E\u4F38\u3073)
|
|
7393
|
+
},
|
|
7394
|
+
`edge-${i}`
|
|
7395
|
+
);
|
|
7396
|
+
}),
|
|
7324
7397
|
layout2.nodes.map((n) => {
|
|
7398
|
+
if (!\u7BB1\u304C\u51FA\u308B(n.depth)) return null;
|
|
7325
7399
|
const \u884C = \u7BB1\u306B\u7A4D\u3080(
|
|
7326
7400
|
[
|
|
7327
7401
|
{ \u5F79\u5272: "title", text: n.title, fontSize: n.isRoot ? 15 : 13 },
|
|
@@ -7360,17 +7434,22 @@ function MindMapNode({
|
|
|
7360
7434
|
children: r.text
|
|
7361
7435
|
},
|
|
7362
7436
|
r.\u5F79\u5272
|
|
7363
|
-
)) :
|
|
7364
|
-
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
|
|
7437
|
+
)) : (
|
|
7438
|
+
// 補足が無くても **幅に収める** (#526)。 `箱に積む` を通らないこの経路だけが
|
|
7439
|
+
// 幅を見ておらず、長い名前がそのまま箱の外へ出て枝の線と重なっていた
|
|
7440
|
+
// (実測 = 中心の箱で文字 163px に対し箱 120px)
|
|
7441
|
+
/* @__PURE__ */ jsx(
|
|
7442
|
+
"text",
|
|
7443
|
+
{
|
|
7444
|
+
x: n.x,
|
|
7445
|
+
y: n.y + 5,
|
|
7446
|
+
fontSize: n.isRoot ? 15 : 13,
|
|
7447
|
+
fontWeight: n.isRoot ? 700 : 600,
|
|
7448
|
+
textAnchor: "middle",
|
|
7449
|
+
fill: \u6587\u5B57\u306E\u8272,
|
|
7450
|
+
children: \u5E45\u3067\u5207\u308B(n.title, n.isRoot ? 15 : 13, \u4F7F\u3048\u308B\u5E45(n.w))
|
|
7451
|
+
}
|
|
7452
|
+
)
|
|
7374
7453
|
)
|
|
7375
7454
|
] }, `n-${n.id}`);
|
|
7376
7455
|
})
|
|
@@ -7389,6 +7468,8 @@ function computeMindMapLayout(mindData, cx, cy, canvasW, canvasH) {
|
|
|
7389
7468
|
w: rootW,
|
|
7390
7469
|
h: rootH,
|
|
7391
7470
|
isRoot: true,
|
|
7471
|
+
// 中心は起点なので段数 0 (cdl#520)
|
|
7472
|
+
depth: 0,
|
|
7392
7473
|
...mindData.unresolved ? { unresolved: true } : {}
|
|
7393
7474
|
});
|
|
7394
7475
|
const childrenOf = /* @__PURE__ */ new Map();
|
|
@@ -7500,6 +7581,8 @@ function computeMindMapLayout(mindData, cx, cy, canvasW, canvasH) {
|
|
|
7500
7581
|
y,
|
|
7501
7582
|
w,
|
|
7502
7583
|
h,
|
|
7584
|
+
// 第 1 階層が段数 1 (`subDepth` は 0 始まり、 cdl#520)
|
|
7585
|
+
depth: subDepth + 1,
|
|
7503
7586
|
tone: myTone,
|
|
7504
7587
|
isRoot: false,
|
|
7505
7588
|
...node.unresolved ? { unresolved: true } : {}
|
|
@@ -7541,23 +7624,36 @@ function computeMindMapLayout(mindData, cx, cy, canvasW, canvasH) {
|
|
|
7541
7624
|
}
|
|
7542
7625
|
}
|
|
7543
7626
|
}
|
|
7627
|
+
const \u6BB5\u6570 = new Map(nodes.map((n) => [n.id, n.depth]));
|
|
7544
7628
|
for (const br of mindData.branches) {
|
|
7545
7629
|
const childPos = nodePos.get(br.id);
|
|
7546
7630
|
if (!childPos) continue;
|
|
7547
7631
|
const isLeft = nodeSide.get(br.id) === "left";
|
|
7548
7632
|
const childHalfW = nodeHalfW.get(br.id) ?? subBranchW / 2;
|
|
7549
7633
|
const tone = nodeTone.get(br.id);
|
|
7634
|
+
const childDepth = \u6BB5\u6570.get(br.id) ?? 1;
|
|
7635
|
+
const parentDepth = \u6BB5\u6570.get(br.parent) ?? 0;
|
|
7550
7636
|
if (br.parent === mindData.rootId) {
|
|
7551
7637
|
const startX = rootEdgeXFor(isLeft);
|
|
7552
7638
|
const endX = childPos.x + (isLeft ? childHalfW : -childHalfW);
|
|
7553
|
-
edges.push({
|
|
7639
|
+
edges.push({
|
|
7640
|
+
d: makeCurve(startX, cy, endX, childPos.y),
|
|
7641
|
+
tone,
|
|
7642
|
+
depth: childDepth,
|
|
7643
|
+
deferUntilComplete: false
|
|
7644
|
+
});
|
|
7554
7645
|
} else {
|
|
7555
7646
|
const parentPos = nodePos.get(br.parent);
|
|
7556
7647
|
if (!parentPos) continue;
|
|
7557
7648
|
const parentHalfW = nodeHalfW.get(br.parent) ?? branchW / 2;
|
|
7558
7649
|
const startX = parentPos.x + (isLeft ? -parentHalfW : parentHalfW);
|
|
7559
7650
|
const endX = childPos.x + (isLeft ? childHalfW : -childHalfW);
|
|
7560
|
-
edges.push({
|
|
7651
|
+
edges.push({
|
|
7652
|
+
d: makeCurve(startX, parentPos.y, endX, childPos.y),
|
|
7653
|
+
tone,
|
|
7654
|
+
depth: Math.max(parentDepth, childDepth),
|
|
7655
|
+
deferUntilComplete: parentDepth >= childDepth
|
|
7656
|
+
});
|
|
7561
7657
|
}
|
|
7562
7658
|
}
|
|
7563
7659
|
return { nodes, edges };
|
|
@@ -7577,7 +7673,9 @@ function toneColor4(tone, alpha = 1) {
|
|
|
7577
7673
|
function FunnelNode({
|
|
7578
7674
|
node,
|
|
7579
7675
|
active,
|
|
7580
|
-
stateValues = {}
|
|
7676
|
+
stateValues = {},
|
|
7677
|
+
drawing = false,
|
|
7678
|
+
progress = 1
|
|
7581
7679
|
}) {
|
|
7582
7680
|
const x0 = node.cx - node.w / 2;
|
|
7583
7681
|
const y0 = node.cy - node.h / 2;
|
|
@@ -7592,12 +7690,79 @@ function FunnelNode({
|
|
|
7592
7690
|
const stageCount = stages.length || 1;
|
|
7593
7691
|
const gap = 4;
|
|
7594
7692
|
const stageH = (canvasH - gap * (stageCount - 1)) / stageCount;
|
|
7693
|
+
const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
7694
|
+
const \u5207\u308A\u629C\u304Did = `cdl-funnel-draw-${useId().replace(/[^A-Za-z0-9_-]/g, "")}`;
|
|
7695
|
+
const \u6BB5\u306E\u4E0B\u7AEF\u306E\u5272\u5408 = (idx) => {
|
|
7696
|
+
if (canvasH <= 0) return 0;
|
|
7697
|
+
return ((idx + 1) * stageH + idx * gap) / canvasH;
|
|
7698
|
+
};
|
|
7699
|
+
const \u6BB5\u304C\u51FA\u5207\u3063\u305F = (idx) => !drawing || \u4F38\u3073 >= \u6BB5\u306E\u4E0B\u7AEF\u306E\u5272\u5408(idx);
|
|
7595
7700
|
const widthAtStep = (step) => {
|
|
7596
7701
|
const topRatio = 1;
|
|
7597
7702
|
const bottomRatio = 0.35;
|
|
7598
7703
|
const t = step / stageCount;
|
|
7599
7704
|
return canvasW * (topRatio + (bottomRatio - topRatio) * t);
|
|
7600
7705
|
};
|
|
7706
|
+
const \u6BB5 = stages.map((s, idx) => {
|
|
7707
|
+
const prev = idx > 0 ? stages[idx - 1] : null;
|
|
7708
|
+
const dropRate = prev && prev.count > 0 ? (prev.count - s.count) / prev.count * 100 : 0;
|
|
7709
|
+
const y = PAD_TOP + idx * (stageH + gap);
|
|
7710
|
+
const topW = widthAtStep(idx);
|
|
7711
|
+
const bottomW = widthAtStep(idx + 1);
|
|
7712
|
+
const cx = PAD_LEFT + canvasW / 2;
|
|
7713
|
+
const topX = cx - topW / 2;
|
|
7714
|
+
const bottomX = cx - bottomW / 2;
|
|
7715
|
+
const points = `${topX},${y} ${topX + topW},${y} ${bottomX + bottomW},${y + stageH} ${bottomX},${y + stageH}`;
|
|
7716
|
+
const tone = toneByIndex(idx);
|
|
7717
|
+
const legendX = PAD_LEFT + canvasW + 24;
|
|
7718
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
7719
|
+
/* @__PURE__ */ jsx(
|
|
7720
|
+
"polygon",
|
|
7721
|
+
{
|
|
7722
|
+
"data-cdl-role": "funnel-stage",
|
|
7723
|
+
"data-cdl-unresolved": s.unresolved ? "true" : void 0,
|
|
7724
|
+
points,
|
|
7725
|
+
fill: tone,
|
|
7726
|
+
fillOpacity: 0.9,
|
|
7727
|
+
stroke: tone,
|
|
7728
|
+
strokeWidth: 0
|
|
7729
|
+
}
|
|
7730
|
+
),
|
|
7731
|
+
/* @__PURE__ */ jsx(
|
|
7732
|
+
"text",
|
|
7733
|
+
{
|
|
7734
|
+
x: cx,
|
|
7735
|
+
y: y + stageH / 2 + 5,
|
|
7736
|
+
fontSize: 14,
|
|
7737
|
+
fontWeight: 700,
|
|
7738
|
+
textAnchor: "middle",
|
|
7739
|
+
fill: "var(--cdl-node-fill, #ffffff)",
|
|
7740
|
+
children: s.title
|
|
7741
|
+
}
|
|
7742
|
+
),
|
|
7743
|
+
\u6BB5\u304C\u51FA\u5207\u3063\u305F(idx) && /* @__PURE__ */ jsx(
|
|
7744
|
+
"text",
|
|
7745
|
+
{
|
|
7746
|
+
x: legendX,
|
|
7747
|
+
y: y + stageH / 2 - 2,
|
|
7748
|
+
fontSize: 13,
|
|
7749
|
+
fontWeight: 700,
|
|
7750
|
+
fill: "var(--cdl-text, #1a1f2a)",
|
|
7751
|
+
children: s.count.toLocaleString()
|
|
7752
|
+
}
|
|
7753
|
+
),
|
|
7754
|
+
\u6BB5\u304C\u51FA\u5207\u3063\u305F(idx) && prev && /* @__PURE__ */ jsx(
|
|
7755
|
+
"text",
|
|
7756
|
+
{
|
|
7757
|
+
x: legendX,
|
|
7758
|
+
y: y + stageH / 2 + 14,
|
|
7759
|
+
fontSize: 11,
|
|
7760
|
+
fill: dropRate > 0 ? "var(--cdl-text-dim, #5a6270)" : "var(--cdl-text-mute, #8a8678)",
|
|
7761
|
+
children: dropRate > 0 ? `\u2193 ${dropRate.toFixed(1)}%` : "\xB10%"
|
|
7762
|
+
}
|
|
7763
|
+
)
|
|
7764
|
+
] }, `stage-${s.id}`);
|
|
7765
|
+
});
|
|
7601
7766
|
return /* @__PURE__ */ jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
7602
7767
|
/* @__PURE__ */ jsx(
|
|
7603
7768
|
"rect",
|
|
@@ -7613,66 +7778,8 @@ function FunnelNode({
|
|
|
7613
7778
|
strokeWidth: active ? 3 : 1.25
|
|
7614
7779
|
}
|
|
7615
7780
|
),
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
const dropRate = prev && prev.count > 0 ? (prev.count - s.count) / prev.count * 100 : 0;
|
|
7619
|
-
const y = PAD_TOP + idx * (stageH + gap);
|
|
7620
|
-
const topW = widthAtStep(idx);
|
|
7621
|
-
const bottomW = widthAtStep(idx + 1);
|
|
7622
|
-
const cx = PAD_LEFT + canvasW / 2;
|
|
7623
|
-
const topX = cx - topW / 2;
|
|
7624
|
-
const bottomX = cx - bottomW / 2;
|
|
7625
|
-
const points = `${topX},${y} ${topX + topW},${y} ${bottomX + bottomW},${y + stageH} ${bottomX},${y + stageH}`;
|
|
7626
|
-
const tone = toneByIndex(idx);
|
|
7627
|
-
const legendX = PAD_LEFT + canvasW + 24;
|
|
7628
|
-
return /* @__PURE__ */ jsxs("g", { children: [
|
|
7629
|
-
/* @__PURE__ */ jsx(
|
|
7630
|
-
"polygon",
|
|
7631
|
-
{
|
|
7632
|
-
"data-cdl-role": "funnel-stage",
|
|
7633
|
-
"data-cdl-unresolved": s.unresolved ? "true" : void 0,
|
|
7634
|
-
points,
|
|
7635
|
-
fill: tone,
|
|
7636
|
-
fillOpacity: 0.9,
|
|
7637
|
-
stroke: tone,
|
|
7638
|
-
strokeWidth: 0
|
|
7639
|
-
}
|
|
7640
|
-
),
|
|
7641
|
-
/* @__PURE__ */ jsx(
|
|
7642
|
-
"text",
|
|
7643
|
-
{
|
|
7644
|
-
x: cx,
|
|
7645
|
-
y: y + stageH / 2 + 5,
|
|
7646
|
-
fontSize: 14,
|
|
7647
|
-
fontWeight: 700,
|
|
7648
|
-
textAnchor: "middle",
|
|
7649
|
-
fill: "var(--cdl-node-fill, #ffffff)",
|
|
7650
|
-
children: s.title
|
|
7651
|
-
}
|
|
7652
|
-
),
|
|
7653
|
-
/* @__PURE__ */ jsx(
|
|
7654
|
-
"text",
|
|
7655
|
-
{
|
|
7656
|
-
x: legendX,
|
|
7657
|
-
y: y + stageH / 2 - 2,
|
|
7658
|
-
fontSize: 13,
|
|
7659
|
-
fontWeight: 700,
|
|
7660
|
-
fill: "var(--cdl-text, #1a1f2a)",
|
|
7661
|
-
children: s.count.toLocaleString()
|
|
7662
|
-
}
|
|
7663
|
-
),
|
|
7664
|
-
prev && /* @__PURE__ */ jsx(
|
|
7665
|
-
"text",
|
|
7666
|
-
{
|
|
7667
|
-
x: legendX,
|
|
7668
|
-
y: y + stageH / 2 + 14,
|
|
7669
|
-
fontSize: 11,
|
|
7670
|
-
fill: dropRate > 0 ? "var(--cdl-text-dim, #5a6270)" : "var(--cdl-text-mute, #8a8678)",
|
|
7671
|
-
children: dropRate > 0 ? `\u2193 ${dropRate.toFixed(1)}%` : "\xB10%"
|
|
7672
|
-
}
|
|
7673
|
-
)
|
|
7674
|
-
] }, `stage-${s.id}`);
|
|
7675
|
-
})
|
|
7781
|
+
drawing && /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: \u5207\u308A\u629C\u304Did, children: /* @__PURE__ */ jsx("rect", { x: 0, y: 0, width: node.w, height: PAD_TOP + canvasH * \u4F38\u3073 }) }) }),
|
|
7782
|
+
drawing ? /* @__PURE__ */ jsx("g", { clipPath: `url(#${\u5207\u308A\u629C\u304Did})`, children: \u6BB5 }) : \u6BB5
|
|
7676
7783
|
] });
|
|
7677
7784
|
}
|
|
7678
7785
|
var TONE_ORDER = [
|
|
@@ -7858,7 +7965,9 @@ function \u7BB1\u306E\u6587\u5B57({
|
|
|
7858
7965
|
function TreeNode({
|
|
7859
7966
|
node,
|
|
7860
7967
|
active,
|
|
7861
|
-
stateValues = {}
|
|
7968
|
+
stateValues = {},
|
|
7969
|
+
drawing = false,
|
|
7970
|
+
progress = 1
|
|
7862
7971
|
}) {
|
|
7863
7972
|
const x0 = node.cx - node.w / 2;
|
|
7864
7973
|
const y0 = node.cy - node.h / 2;
|
|
@@ -7871,6 +7980,9 @@ function TreeNode({
|
|
|
7871
7980
|
const canvasW = node.w - PAD_LEFT - PAD_RIGHT;
|
|
7872
7981
|
const canvasH = node.h - PAD_TOP - PAD_BOTTOM;
|
|
7873
7982
|
const layout2 = computeTreeLayout(treeNodes, canvasW, canvasH);
|
|
7983
|
+
const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
7984
|
+
const \u6700\u5927\u6DF1\u3055 = layout2.nodes.reduce((m, n) => Math.max(m, n.depth), 0);
|
|
7985
|
+
const \u7BB1\u304C\u51FA\u308B = (\u6DF1\u3055) => !drawing || \u6BB5\u306E\u4F38\u3073(\u4F38\u3073, \u6DF1\u3055, \u6700\u5927\u6DF1\u3055) >= 1;
|
|
7874
7986
|
const depthColors = [TONE.accent, TONE.teal, TONE.success, TONE.warning, TONE.info];
|
|
7875
7987
|
return /* @__PURE__ */ jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
7876
7988
|
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: gradientId, x1: "0%", y1: "0%", x2: "0%", y2: "100%", children: [
|
|
@@ -7898,6 +8010,7 @@ function TreeNode({
|
|
|
7898
8010
|
const y2 = PAD_TOP + e.y2;
|
|
7899
8011
|
const midY = (y1 + y2) / 2;
|
|
7900
8012
|
const path = `M ${x1} ${y1} L ${x1} ${midY} L ${x2} ${midY} L ${x2} ${y2}`;
|
|
8013
|
+
const \u679D\u306E\u4F38\u3073 = e.deferUntilComplete ? \u4F38\u3073 >= 1 ? 1 : 0 : \u6BB5\u306E\u4F38\u3073(\u4F38\u3073, e.depth, \u6700\u5927\u6DF1\u3055);
|
|
7901
8014
|
return /* @__PURE__ */ jsxs("g", { children: [
|
|
7902
8015
|
/* @__PURE__ */ jsx(
|
|
7903
8016
|
"path",
|
|
@@ -7908,13 +8021,15 @@ function TreeNode({
|
|
|
7908
8021
|
stroke: TONE.accent,
|
|
7909
8022
|
strokeOpacity: 0.55,
|
|
7910
8023
|
strokeWidth: 1.5,
|
|
7911
|
-
strokeLinejoin: "round"
|
|
8024
|
+
strokeLinejoin: "round",
|
|
8025
|
+
...\u4F38\u3070\u3059dash(drawing, \u679D\u306E\u4F38\u3073)
|
|
7912
8026
|
}
|
|
7913
8027
|
),
|
|
7914
|
-
/* @__PURE__ */ jsx("circle", { cx: x1, cy: midY, r: 2.5, fill: TONE.accent, fillOpacity: 0.75 })
|
|
8028
|
+
(!drawing || \u679D\u306E\u4F38\u3073 >= 1) && /* @__PURE__ */ jsx("circle", { cx: x1, cy: midY, r: 2.5, fill: TONE.accent, fillOpacity: 0.75 })
|
|
7915
8029
|
] }, `edge-${i}`);
|
|
7916
8030
|
}),
|
|
7917
8031
|
layout2.nodes.map((n) => {
|
|
8032
|
+
if (!\u7BB1\u304C\u51FA\u308B(n.depth)) return null;
|
|
7918
8033
|
const accent = depthColors[Math.min(n.depth, depthColors.length - 1)] ?? depthColors[0];
|
|
7919
8034
|
const isRoot = n.depth === 0;
|
|
7920
8035
|
const \u884C = \u7BB1\u306B\u7A4D\u3080(
|
|
@@ -7950,17 +8065,21 @@ function TreeNode({
|
|
|
7950
8065
|
\u7BB1\u306E\u9AD8\u3055: n.h,
|
|
7951
8066
|
fill: "var(--cdl-text-on-tone, #ffffff)",
|
|
7952
8067
|
\u540D\u524D\u306E\u592A\u3055: 700
|
|
7953
|
-
}) :
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
|
|
8068
|
+
}) : (
|
|
8069
|
+
// 補足が無くても幅に収める (#526)。 `箱の文字` を通らないこの経路だけが
|
|
8070
|
+
// 幅を見ておらず、長い名前が箱の外へ出ていた
|
|
8071
|
+
/* @__PURE__ */ jsx(
|
|
8072
|
+
"text",
|
|
8073
|
+
{
|
|
8074
|
+
x: n.w / 2,
|
|
8075
|
+
y: n.h / 2 + 5,
|
|
8076
|
+
fontSize: 13,
|
|
8077
|
+
fontWeight: 700,
|
|
8078
|
+
textAnchor: "middle",
|
|
8079
|
+
fill: "var(--cdl-text-on-tone, #ffffff)",
|
|
8080
|
+
children: \u5E45\u3067\u5207\u308B(n.title, 13, \u4F7F\u3048\u308B\u5E45(n.w))
|
|
8081
|
+
}
|
|
8082
|
+
)
|
|
7964
8083
|
)
|
|
7965
8084
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7966
8085
|
/* @__PURE__ */ jsx(
|
|
@@ -7993,7 +8112,7 @@ function TreeNode({
|
|
|
7993
8112
|
fontWeight: 600,
|
|
7994
8113
|
textAnchor: "middle",
|
|
7995
8114
|
fill: "var(--cdl-chip-text, #1a1f2a)",
|
|
7996
|
-
children: n.title
|
|
8115
|
+
children: \u5E45\u3067\u5207\u308B(n.title, 12, \u4F7F\u3048\u308B\u5E45(n.w))
|
|
7997
8116
|
}
|
|
7998
8117
|
)
|
|
7999
8118
|
] })
|
|
@@ -8095,6 +8214,7 @@ function computeTreeLayout(treeNodes, canvasW, canvasH) {
|
|
|
8095
8214
|
}
|
|
8096
8215
|
}
|
|
8097
8216
|
const hById = new Map(nodes.map((n) => [n.id, n.h]));
|
|
8217
|
+
const \u6BB5\u6570 = new Map(nodes.map((n) => [n.id, n.depth]));
|
|
8098
8218
|
const edges = [];
|
|
8099
8219
|
for (const n of treeNodes) {
|
|
8100
8220
|
if (!n.parent) continue;
|
|
@@ -8103,14 +8223,25 @@ function computeTreeLayout(treeNodes, canvasW, canvasH) {
|
|
|
8103
8223
|
if (!parent || !child) continue;
|
|
8104
8224
|
const parentH = hById.get(n.parent) ?? nodeH;
|
|
8105
8225
|
const childH = hById.get(n.id) ?? nodeH;
|
|
8106
|
-
|
|
8226
|
+
const parentDepth = \u6BB5\u6570.get(n.parent) ?? 0;
|
|
8227
|
+
const childDepth = \u6BB5\u6570.get(n.id) ?? 1;
|
|
8228
|
+
edges.push({
|
|
8229
|
+
x1: parent.x,
|
|
8230
|
+
y1: parent.y + parentH / 2,
|
|
8231
|
+
x2: child.x,
|
|
8232
|
+
y2: child.y - childH / 2,
|
|
8233
|
+
depth: Math.max(parentDepth, childDepth),
|
|
8234
|
+
deferUntilComplete: parentDepth >= childDepth
|
|
8235
|
+
});
|
|
8107
8236
|
}
|
|
8108
8237
|
return { nodes, edges };
|
|
8109
8238
|
}
|
|
8110
8239
|
function UserJourneyNode({
|
|
8111
8240
|
node,
|
|
8112
8241
|
active,
|
|
8113
|
-
stateValues = {}
|
|
8242
|
+
stateValues = {},
|
|
8243
|
+
drawing = false,
|
|
8244
|
+
progress = 1
|
|
8114
8245
|
}) {
|
|
8115
8246
|
const x0 = node.cx - node.w / 2;
|
|
8116
8247
|
const y0 = node.cy - node.h / 2;
|
|
@@ -8148,6 +8279,12 @@ function UserJourneyNode({
|
|
|
8148
8279
|
const xAt = (idx) => PAD_LEFT + (steps.length <= 1 ? canvasW / 2 : colW / 2 + colW * idx);
|
|
8149
8280
|
const yAt = (emotion) => PAD_TOP + rowH / 2 + (4 - emotionScore[emotion]) * rowH;
|
|
8150
8281
|
const pts = steps.map((s, i) => ({ x: xAt(i), y: yAt(s.emotion) }));
|
|
8282
|
+
const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
8283
|
+
const \u6BB5\u307E\u3067\u306E\u5272\u5408 = \u30D9\u30B8\u30A8\u306E\u7D2F\u7A4D\u5272\u5408(pts, (\u524D, \u5F8C) => {
|
|
8284
|
+
const midX = (\u524D.x + \u5F8C.x) / 2;
|
|
8285
|
+
return [{ x: midX, y: \u524D.y }, { x: midX, y: \u5F8C.y }];
|
|
8286
|
+
});
|
|
8287
|
+
const \u7DDA\u306E\u5148\u304C\u5C4A\u3044\u305F = (idx) => !drawing || \u4F38\u3073 >= (\u6BB5\u307E\u3067\u306E\u5272\u5408[idx] ?? 0);
|
|
8151
8288
|
const smoothPath = pts.length > 1 ? pts.reduce((acc, p, i) => {
|
|
8152
8289
|
if (i === 0) return `M ${p.x} ${p.y}`;
|
|
8153
8290
|
const prev = pts[i - 1];
|
|
@@ -8228,7 +8365,8 @@ function UserJourneyNode({
|
|
|
8228
8365
|
stroke: "var(--cdl-tone-accent, #2d6a8f)",
|
|
8229
8366
|
strokeOpacity: 0.18,
|
|
8230
8367
|
strokeWidth: 10,
|
|
8231
|
-
strokeLinecap: "round"
|
|
8368
|
+
strokeLinecap: "round",
|
|
8369
|
+
...\u4F38\u3070\u3059dash(drawing, \u4F38\u3073)
|
|
8232
8370
|
}
|
|
8233
8371
|
),
|
|
8234
8372
|
/* @__PURE__ */ jsx(
|
|
@@ -8240,11 +8378,12 @@ function UserJourneyNode({
|
|
|
8240
8378
|
stroke: "var(--cdl-tone-accent, #2d6a8f)",
|
|
8241
8379
|
strokeWidth: 2.75,
|
|
8242
8380
|
strokeLinejoin: "round",
|
|
8243
|
-
strokeLinecap: "round"
|
|
8381
|
+
strokeLinecap: "round",
|
|
8382
|
+
...\u4F38\u3070\u3059dash(drawing, \u4F38\u3073)
|
|
8244
8383
|
}
|
|
8245
8384
|
)
|
|
8246
8385
|
] }),
|
|
8247
|
-
steps.map((s, idx) => /* @__PURE__ */ jsxs(
|
|
8386
|
+
steps.map((s, idx) => !\u7DDA\u306E\u5148\u304C\u5C4A\u3044\u305F(idx) ? null : /* @__PURE__ */ jsxs(
|
|
8248
8387
|
"g",
|
|
8249
8388
|
{
|
|
8250
8389
|
"data-cdl-role": "journey-step",
|
|
@@ -12335,17 +12474,62 @@ function CdlNodeView({
|
|
|
12335
12474
|
}
|
|
12336
12475
|
);
|
|
12337
12476
|
case "gantt-timeline":
|
|
12338
|
-
return /* @__PURE__ */ jsx(
|
|
12477
|
+
return /* @__PURE__ */ jsx(
|
|
12478
|
+
GanttNode,
|
|
12479
|
+
{
|
|
12480
|
+
node: resolvedNode,
|
|
12481
|
+
active,
|
|
12482
|
+
stateValues,
|
|
12483
|
+
drawing,
|
|
12484
|
+
progress
|
|
12485
|
+
}
|
|
12486
|
+
);
|
|
12339
12487
|
case "mind-map":
|
|
12340
|
-
return /* @__PURE__ */ jsx(
|
|
12488
|
+
return /* @__PURE__ */ jsx(
|
|
12489
|
+
MindMapNode,
|
|
12490
|
+
{
|
|
12491
|
+
node: resolvedNode,
|
|
12492
|
+
active,
|
|
12493
|
+
stateValues,
|
|
12494
|
+
drawing,
|
|
12495
|
+
progress
|
|
12496
|
+
}
|
|
12497
|
+
);
|
|
12341
12498
|
case "funnel-stages":
|
|
12342
|
-
return /* @__PURE__ */ jsx(
|
|
12499
|
+
return /* @__PURE__ */ jsx(
|
|
12500
|
+
FunnelNode,
|
|
12501
|
+
{
|
|
12502
|
+
node: resolvedNode,
|
|
12503
|
+
active,
|
|
12504
|
+
stateValues,
|
|
12505
|
+
drawing,
|
|
12506
|
+
progress
|
|
12507
|
+
}
|
|
12508
|
+
);
|
|
12343
12509
|
case "quadrant-matrix":
|
|
12344
12510
|
return /* @__PURE__ */ jsx(QuadrantNode, { node: resolvedNode, active, stateValues });
|
|
12345
12511
|
case "tree-hierarchy":
|
|
12346
|
-
return /* @__PURE__ */ jsx(
|
|
12512
|
+
return /* @__PURE__ */ jsx(
|
|
12513
|
+
TreeNode,
|
|
12514
|
+
{
|
|
12515
|
+
node: resolvedNode,
|
|
12516
|
+
active,
|
|
12517
|
+
stateValues,
|
|
12518
|
+
drawing,
|
|
12519
|
+
progress
|
|
12520
|
+
}
|
|
12521
|
+
);
|
|
12347
12522
|
case "journey-map":
|
|
12348
|
-
return /* @__PURE__ */ jsx(
|
|
12523
|
+
return /* @__PURE__ */ jsx(
|
|
12524
|
+
UserJourneyNode,
|
|
12525
|
+
{
|
|
12526
|
+
node: resolvedNode,
|
|
12527
|
+
active,
|
|
12528
|
+
stateValues,
|
|
12529
|
+
drawing,
|
|
12530
|
+
progress
|
|
12531
|
+
}
|
|
12532
|
+
);
|
|
12349
12533
|
case "shape-file":
|
|
12350
12534
|
return /* @__PURE__ */ jsx(ShapeFileNode, { node: resolvedNode, active });
|
|
12351
12535
|
case "shape-folder":
|