@cardenelabs/cdl 0.12.0 → 0.13.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/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 CdlState, f as CdlEventTarget, g as Computed, h as CdlDerivedValue, i as CdlScrollTrigger, L as LaidDiagram, j as CdlDiagramViewProps, k as LaidEdge, l as LaidNode, m as CdlEdge, B as BBox, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-C7FKvMqq.cjs';
2
- export { n as CdlDiagramView, o as CdlEventBinding, p as CdlEventKind, q as CdlFormula, r as CdlPhase, I as InteractiveHandlerMap, s as InteractiveSignalsAccessor, t as LaidLane, u as NODE_KINDS, v as ScrollProgressHandle, w as TONES, x as computeEventBindingKey, y as computeFormulaKey, z as computeInputSignalKey, A as computeScrollTriggerKey, D as computed, F as createInteractiveSignalsAccessor, G as createScrollProgressHandle, H as createScrollProgressSignals, K as hasInteractivePrimitives, M as signal } from './render-C7FKvMqq.cjs';
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 CdlState, f as CdlEventTarget, g as Computed, h as CdlDerivedValue, i as CdlScrollTrigger, L as LaidDiagram, j as CdlDiagramViewProps, k as LaidEdge, l as LaidNode, m as CdlEdge, B as BBox, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-B5JHcUrb.cjs';
2
+ export { n as CdlDiagramView, o as CdlEventBinding, p as CdlEventKind, q as CdlFormula, r as CdlPhase, I as InteractiveHandlerMap, s as InteractiveSignalsAccessor, t as LaidLane, u as NODE_KINDS, v as ScrollProgressHandle, w as TONES, x as computeEventBindingKey, y as computeFormulaKey, z as computeInputSignalKey, A as computeScrollTriggerKey, D as computed, F as createInteractiveSignalsAccessor, G as createScrollProgressHandle, H as createScrollProgressSignals, K as hasInteractivePrimitives, M as signal } from './render-B5JHcUrb.cjs';
3
3
  import { JSX } from 'react';
4
4
 
5
5
  declare function effect(fn: () => void | (() => void)): () => void;
@@ -3137,6 +3137,8 @@ type MindMapPreset = {
3137
3137
  /** 中心 topic ID + label */
3138
3138
  rootId: string;
3139
3139
  rootTitle: string;
3140
+ /** 中心の箱の 2 行目に出す補足 (#530)。 枝の `subtitle` と同じ扱い */
3141
+ rootSubtitle?: string;
3140
3142
  branchWidth?: number;
3141
3143
  defaultTone?: Tone;
3142
3144
  };
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 CdlState, f as CdlEventTarget, g as Computed, h as CdlDerivedValue, i as CdlScrollTrigger, L as LaidDiagram, j as CdlDiagramViewProps, k as LaidEdge, l as LaidNode, m as CdlEdge, B as BBox, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-C7FKvMqq.js';
2
- export { n as CdlDiagramView, o as CdlEventBinding, p as CdlEventKind, q as CdlFormula, r as CdlPhase, I as InteractiveHandlerMap, s as InteractiveSignalsAccessor, t as LaidLane, u as NODE_KINDS, v as ScrollProgressHandle, w as TONES, x as computeEventBindingKey, y as computeFormulaKey, z as computeInputSignalKey, A as computeScrollTriggerKey, D as computed, F as createInteractiveSignalsAccessor, G as createScrollProgressHandle, H as createScrollProgressSignals, K as hasInteractivePrimitives, M as signal } from './render-C7FKvMqq.js';
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 CdlState, f as CdlEventTarget, g as Computed, h as CdlDerivedValue, i as CdlScrollTrigger, L as LaidDiagram, j as CdlDiagramViewProps, k as LaidEdge, l as LaidNode, m as CdlEdge, B as BBox, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-B5JHcUrb.js';
2
+ export { n as CdlDiagramView, o as CdlEventBinding, p as CdlEventKind, q as CdlFormula, r as CdlPhase, I as InteractiveHandlerMap, s as InteractiveSignalsAccessor, t as LaidLane, u as NODE_KINDS, v as ScrollProgressHandle, w as TONES, x as computeEventBindingKey, y as computeFormulaKey, z as computeInputSignalKey, A as computeScrollTriggerKey, D as computed, F as createInteractiveSignalsAccessor, G as createScrollProgressHandle, H as createScrollProgressSignals, K as hasInteractivePrimitives, M as signal } from './render-B5JHcUrb.js';
3
3
  import { JSX } from 'react';
4
4
 
5
5
  declare function effect(fn: () => void | (() => void)): () => void;
@@ -3137,6 +3137,8 @@ type MindMapPreset = {
3137
3137
  /** 中心 topic ID + label */
3138
3138
  rootId: string;
3139
3139
  rootTitle: string;
3140
+ /** 中心の箱の 2 行目に出す補足 (#530)。 枝の `subtitle` と同じ扱い */
3141
+ rootSubtitle?: string;
3140
3142
  branchWidth?: number;
3141
3143
  defaultTone?: Tone;
3142
3144
  };
package/dist/index.js CHANGED
@@ -15835,6 +15835,7 @@ function payloadTexts(node) {
15835
15835
  }
15836
15836
  if (node.mindData) {
15837
15837
  \u8DB3\u3059(node.mindData.rootTitle);
15838
+ \u8DB3\u3059(node.mindData.rootSubtitle);
15838
15839
  for (const b of node.mindData.branches) {
15839
15840
  \u8DB3\u3059(b.title);
15840
15841
  \u8DB3\u3059(b.subtitle);
@@ -21273,9 +21274,10 @@ function resolveTreeData(nodes, values) {
21273
21274
  });
21274
21275
  }
21275
21276
  function resolveMindData(data, values) {
21276
- const \u8AAD\u3080 = data.rootTitle.includes("{") || data.branches.some((b) => b.title.includes("{") || (b.subtitle?.includes("{") ?? false));
21277
+ const \u8AAD\u3080 = data.rootTitle.includes("{") || (data.rootSubtitle?.includes("{") ?? false) || data.branches.some((b) => b.title.includes("{") || (b.subtitle?.includes("{") ?? false));
21277
21278
  if (!\u8AAD\u3080) return data;
21278
21279
  const root = resolveBoundText(data.rootTitle, values);
21280
+ const rootSubtitle = data.rootSubtitle === void 0 ? void 0 : resolveBoundText(data.rootSubtitle, values);
21279
21281
  const branches = data.branches.map((b) => {
21280
21282
  const title = resolveBoundText(b.title, values);
21281
21283
  const subtitle = b.subtitle === void 0 ? void 0 : resolveBoundText(b.subtitle, values);
@@ -21286,8 +21288,13 @@ function resolveMindData(data, values) {
21286
21288
  };
21287
21289
  return title.ok && (subtitle?.ok ?? true) ? \u89E3\u6C7A\u5F8C2 : { ...\u89E3\u6C7A\u5F8C2, unresolved: true };
21288
21290
  });
21289
- const \u89E3\u6C7A\u5F8C = { ...data, rootTitle: root.value, branches };
21290
- return root.ok ? \u89E3\u6C7A\u5F8C : { ...\u89E3\u6C7A\u5F8C, unresolved: true };
21291
+ const \u89E3\u6C7A\u5F8C = {
21292
+ ...data,
21293
+ rootTitle: root.value,
21294
+ ...rootSubtitle ? { rootSubtitle: rootSubtitle.value } : {},
21295
+ branches
21296
+ };
21297
+ return root.ok && (rootSubtitle?.ok ?? true) ? \u89E3\u6C7A\u5F8C : { ...\u89E3\u6C7A\u5F8C, unresolved: true };
21291
21298
  }
21292
21299
 
21293
21300
  // src/kinds/draw-progress.ts
@@ -21998,17 +22005,20 @@ var \u884C\u9001\u308A\u306E\u6BD4 = 1.15;
21998
22005
  var \u5B57\u306E\u9AD8\u3055\u306E\u6BD4 = 0.72;
21999
22006
  var \u4E0A\u4E0B\u306E\u4F59\u767D = 2;
22000
22007
  var \u5DE6\u53F3\u306E\u4F59\u767D = 8;
22001
- function \u5E45\u3067\u5207\u308B(text, fontSize, \u4F7F\u3048\u308B\u5E45, \u6E2C\u308B = textWidth) {
22002
- if (\u4F7F\u3048\u308B\u5E45 <= 0) return "";
22003
- if (\u6E2C\u308B(text, fontSize) <= \u4F7F\u3048\u308B\u5E45) return text;
22008
+ function \u4F7F\u3048\u308B\u5E45(\u7BB1\u306E\u5E45) {
22009
+ return \u7BB1\u306E\u5E45 - \u5DE6\u53F3\u306E\u4F59\u767D * 2;
22010
+ }
22011
+ function \u5E45\u3067\u5207\u308B(text, fontSize, \u4F7F\u3048\u308B\u5E452, \u6E2C\u308B = textWidth) {
22012
+ if (\u4F7F\u3048\u308B\u5E452 <= 0) return "";
22013
+ if (\u6E2C\u308B(text, fontSize) <= \u4F7F\u3048\u308B\u5E452) return text;
22004
22014
  const \u7701\u7565 = "\u2026";
22005
22015
  const \u7701\u7565\u306E\u5E45 = \u6E2C\u308B(\u7701\u7565, fontSize);
22006
- if (\u7701\u7565\u306E\u5E45 > \u4F7F\u3048\u308B\u5E45) return "";
22016
+ if (\u7701\u7565\u306E\u5E45 > \u4F7F\u3048\u308B\u5E452) return "";
22007
22017
  let \u51FA = "";
22008
22018
  let \u5E45 = 0;
22009
22019
  for (const c of \u66F8\u8A18\u7D20\u306B\u5206\u3051\u308B(text)) {
22010
22020
  const \u5B57\u306E\u5E452 = \u6E2C\u308B(c, fontSize);
22011
- if (\u5E45 + \u5B57\u306E\u5E452 + \u7701\u7565\u306E\u5E45 > \u4F7F\u3048\u308B\u5E45) break;
22021
+ if (\u5E45 + \u5B57\u306E\u5E452 + \u7701\u7565\u306E\u5E45 > \u4F7F\u3048\u308B\u5E452) break;
22012
22022
  \u5E45 += \u5B57\u306E\u5E452;
22013
22023
  \u51FA += c;
22014
22024
  }
@@ -22026,13 +22036,13 @@ function \u7BB1\u306B\u7A4D\u3080(\u884C, \u7BB1\u306E\u5E45, \u7BB1\u306E\u9AD8
22026
22036
  const \u9AD8\u3055 = (rs) => rs.reduce((a, r) => a + r.fontSize * \u884C\u9001\u308A\u306E\u6BD4, 0);
22027
22037
  const \u6B8B\u3059 = [...\u5019\u88DC];
22028
22038
  while (\u6B8B\u3059.length > 1 && \u9AD8\u3055(\u6B8B\u3059) > \u4F7F\u3048\u308B\u9AD8\u3055) \u6B8B\u3059.pop();
22029
- const \u4F7F\u3048\u308B\u5E45 = \u7BB1\u306E\u5E45 - \u5DE6\u53F3\u306E\u4F59\u767D * 2;
22039
+ const \u5E45 = \u4F7F\u3048\u308B\u5E45(\u7BB1\u306E\u5E45);
22030
22040
  const \u7DCF\u9AD8 = \u9AD8\u3055(\u6B8B\u3059);
22031
22041
  let \u7A4D\u307F = -\u7DCF\u9AD8 / 2;
22032
22042
  return \u6B8B\u3059.map((r) => {
22033
22043
  const dy = \u7A4D\u307F + (\u884C\u9001\u308A\u306E\u6BD4 + \u5B57\u306E\u9AD8\u3055\u306E\u6BD4) / 2 * r.fontSize;
22034
22044
  \u7A4D\u307F += r.fontSize * \u884C\u9001\u308A\u306E\u6BD4;
22035
- return { ...r, text: \u5E45\u3067\u5207\u308B(r.text, r.fontSize, \u4F7F\u3048\u308B\u5E45), dy };
22045
+ return { ...r, text: \u5E45\u3067\u5207\u308B(r.text, r.fontSize, \u5E45), dy };
22036
22046
  });
22037
22047
  }
22038
22048
  var MIND_TONES = ["accent", "teal", "success", "warning", "info", "error"];
@@ -22129,17 +22139,22 @@ function MindMapNode({
22129
22139
  children: r.text
22130
22140
  },
22131
22141
  r.\u5F79\u5272
22132
- )) : /* @__PURE__ */ jsx(
22133
- "text",
22134
- {
22135
- x: n.x,
22136
- y: n.y + 5,
22137
- fontSize: n.isRoot ? 15 : 13,
22138
- fontWeight: n.isRoot ? 700 : 600,
22139
- textAnchor: "middle",
22140
- fill: \u6587\u5B57\u306E\u8272,
22141
- children: n.title
22142
- }
22142
+ )) : (
22143
+ // 補足が無くても **幅に収める** (#526)。 `箱に積む` を通らないこの経路だけが
22144
+ // 幅を見ておらず、長い名前がそのまま箱の外へ出て枝の線と重なっていた
22145
+ // (実測 = 中心の箱で文字 163px に対し箱 120px)
22146
+ /* @__PURE__ */ jsx(
22147
+ "text",
22148
+ {
22149
+ x: n.x,
22150
+ y: n.y + 5,
22151
+ fontSize: n.isRoot ? 15 : 13,
22152
+ fontWeight: n.isRoot ? 700 : 600,
22153
+ textAnchor: "middle",
22154
+ fill: \u6587\u5B57\u306E\u8272,
22155
+ children: \u5E45\u3067\u5207\u308B(n.title, n.isRoot ? 15 : 13, \u4F7F\u3048\u308B\u5E45(n.w))
22156
+ }
22157
+ )
22143
22158
  )
22144
22159
  ] }, `n-${n.id}`);
22145
22160
  })
@@ -22153,6 +22168,8 @@ function computeMindMapLayout(mindData, cx, cy, canvasW, canvasH) {
22153
22168
  nodes.push({
22154
22169
  id: mindData.rootId,
22155
22170
  title: mindData.rootTitle,
22171
+ // 中心も枝と同じく 2 行に積める (#530)。 高さ 52 に 15px + 9px の 2 行が入る
22172
+ ...mindData.rootSubtitle === void 0 ? {} : { subtitle: mindData.rootSubtitle },
22156
22173
  x: cx,
22157
22174
  y: cy,
22158
22175
  w: rootW,
@@ -22755,17 +22772,21 @@ function TreeNode({
22755
22772
  \u7BB1\u306E\u9AD8\u3055: n.h,
22756
22773
  fill: "var(--cdl-text-on-tone, #ffffff)",
22757
22774
  \u540D\u524D\u306E\u592A\u3055: 700
22758
- }) : /* @__PURE__ */ jsx(
22759
- "text",
22760
- {
22761
- x: n.w / 2,
22762
- y: n.h / 2 + 5,
22763
- fontSize: 13,
22764
- fontWeight: 700,
22765
- textAnchor: "middle",
22766
- fill: "var(--cdl-text-on-tone, #ffffff)",
22767
- children: n.title
22768
- }
22775
+ }) : (
22776
+ // 補足が無くても幅に収める (#526)。 `箱の文字` を通らないこの経路だけが
22777
+ // 幅を見ておらず、長い名前が箱の外へ出ていた
22778
+ /* @__PURE__ */ jsx(
22779
+ "text",
22780
+ {
22781
+ x: n.w / 2,
22782
+ y: n.h / 2 + 5,
22783
+ fontSize: 13,
22784
+ fontWeight: 700,
22785
+ textAnchor: "middle",
22786
+ fill: "var(--cdl-text-on-tone, #ffffff)",
22787
+ children: \u5E45\u3067\u5207\u308B(n.title, 13, \u4F7F\u3048\u308B\u5E45(n.w))
22788
+ }
22789
+ )
22769
22790
  )
22770
22791
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
22771
22792
  /* @__PURE__ */ jsx(
@@ -22798,7 +22819,7 @@ function TreeNode({
22798
22819
  fontWeight: 600,
22799
22820
  textAnchor: "middle",
22800
22821
  fill: "var(--cdl-chip-text, #1a1f2a)",
22801
- children: n.title
22822
+ children: \u5E45\u3067\u5207\u308B(n.title, 12, \u4F7F\u3048\u308B\u5E45(n.w))
22802
22823
  }
22803
22824
  )
22804
22825
  ] })
@@ -28389,6 +28410,7 @@ function mindMap(preset) {
28389
28410
  mindData: {
28390
28411
  rootId: preset.rootId,
28391
28412
  rootTitle: preset.rootTitle,
28413
+ ...preset.rootSubtitle === void 0 ? {} : { rootSubtitle: preset.rootSubtitle },
28392
28414
  branches: branches.map((br) => ({
28393
28415
  id: br.id,
28394
28416
  title: br.title,