@cardenelabs/cdl 0.60.0 → 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/dist/react.d.cts CHANGED
@@ -1,2 +1,2 @@
1
1
  import 'react';
2
- export { r as CdlDiagramView, n as CdlDiagramViewProps } from './render-MbIjRWdX.cjs';
2
+ export { s as CdlDiagramView, o as CdlDiagramViewProps } from './render-Dk8_6ua6.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-MbIjRWdX.js';
2
+ export { s as CdlDiagramView, o as CdlDiagramViewProps } from './render-Dk8_6ua6.js';
package/dist/react.js CHANGED
@@ -3816,6 +3816,34 @@ function evaluateOne(entry, values) {
3816
3816
  }
3817
3817
  }
3818
3818
 
3819
+ // src/input-option.ts
3820
+ function \u9078\u629E\u80A2\u306E\u5024(option) {
3821
+ return typeof option === "string" ? option : option.value;
3822
+ }
3823
+ function \u9078\u629E\u80A2\u306E\u540D\u524D(option) {
3824
+ return typeof option === "string" || option.label === "" ? \u9078\u629E\u80A2\u306E\u5024(option) : option.label;
3825
+ }
3826
+ function \u5024\u306E\u540D\u524D\u306E\u8868\u3092\u4F5C\u308B(inputs) {
3827
+ const \u8868 = /* @__PURE__ */ new Map();
3828
+ for (const input of inputs ?? []) {
3829
+ const \u540D\u524D = /* @__PURE__ */ new Map();
3830
+ if (input.kind === "dropdown" || input.kind === "radio" || input.kind === "tabs" || input.kind === "multi-select") {
3831
+ for (const option of input.options) {
3832
+ if (typeof option !== "string" && option.label !== "") \u540D\u524D.set(option.value, option.label);
3833
+ }
3834
+ } else if (input.kind === "toggle") {
3835
+ if (input.onLabel) \u540D\u524D.set("true", input.onLabel);
3836
+ if (input.offLabel) \u540D\u524D.set("false", input.offLabel);
3837
+ }
3838
+ if (\u540D\u524D.size > 0) \u8868.set(input.id, { \u540D\u524D, \u8907\u6570: input.kind === "multi-select" });
3839
+ }
3840
+ return \u8868;
3841
+ }
3842
+ function \u5024\u3092\u540D\u524D\u3067\u8AAD\u3080(\u5165\u529B\u6B04, \u5024) {
3843
+ if (!\u5165\u529B\u6B04.\u8907\u6570) return \u5165\u529B\u6B04.\u540D\u524D.get(\u5024) ?? \u5024;
3844
+ return \u5024.split(",").map((v) => \u5165\u529B\u6B04.\u540D\u524D.get(v) ?? v).join(",");
3845
+ }
3846
+
3819
3847
  // src/render/utils.ts
3820
3848
  var TEMPLATE_REF_RE = new RegExp(TEMPLATE_REF_SRC, "g");
3821
3849
  var TEMPLATE_LEFTOVER_TEST_RE = new RegExp(TEMPLATE_LEFTOVER_SRC);
@@ -3864,11 +3892,14 @@ function mergeStateValues(base, overrides) {
3864
3892
  }
3865
3893
  return merged;
3866
3894
  }
3867
- function interpolate(template, values) {
3895
+ function interpolate(template, values, \u540D\u524D\u306E\u8868) {
3868
3896
  return template.replace(TEMPLATE_REF_RE, (_, id, accessor) => {
3869
3897
  const raw = Object.hasOwn(values, id) ? values[id] : void 0;
3870
3898
  if (raw === void 0) return `{${id}${accessor ?? ""}}`;
3871
- if (!accessor) return raw;
3899
+ if (!accessor) {
3900
+ const \u5165\u529B\u6B04 = \u540D\u524D\u306E\u8868?.get(id);
3901
+ return \u5165\u529B\u6B04 ? \u5024\u3092\u540D\u524D\u3067\u8AAD\u3080(\u5165\u529B\u6B04, raw) : raw;
3902
+ }
3872
3903
  const arr = parseArraySignal(raw);
3873
3904
  if (!arr) return `{${id}${accessor}}`;
3874
3905
  if (accessor === ".length") return String(arr.length);
@@ -12053,7 +12084,8 @@ function GenericNode({
12053
12084
  node,
12054
12085
  active,
12055
12086
  value,
12056
- stateValues
12087
+ stateValues,
12088
+ \u5024\u306E\u540D\u524D
12057
12089
  }) {
12058
12090
  const base = STYLES[node.kind] ?? FALLBACK;
12059
12091
  const toned = toneColor3(node.tone);
@@ -12139,7 +12171,7 @@ function GenericNode({
12139
12171
  style.look === "ledger" && /* @__PURE__ */ jsx("line", { x1: 1, y1: h - 7, x2: w - 1, y2: h - 7, stroke: paint.stroke, strokeWidth: 1 })
12140
12172
  ] });
12141
12173
  })();
12142
- const resolvedValue = value !== void 0 ? interpolate(value, stateValues) : void 0;
12174
+ const resolvedValue = value !== void 0 ? interpolate(value, stateValues, \u5024\u306E\u540D\u524D) : void 0;
12143
12175
  const hasRows = (node.rows?.length ?? 0) > 0;
12144
12176
  const centered = genericTextCentered(node.kind, hasRows);
12145
12177
  const textAnchor = centered ? "middle" : "start";
@@ -12189,7 +12221,7 @@ function GenericNode({
12189
12221
  }
12190
12222
  ),
12191
12223
  node.rows && node.rows.length > 0 && (() => {
12192
- const resolved = node.rows.map((row) => interpolate(row, stateValues));
12224
+ const resolved = node.rows.map((row) => interpolate(row, stateValues, \u5024\u306E\u540D\u524D));
12193
12225
  const splits = resolved.map(splitRow);
12194
12226
  const leftMaxWidth = splits.reduce(
12195
12227
  (m, s) => Math.max(m, rowColumnWidth(s.left, GENERIC_ROW_LEFT_SIZE_PX, false)),
@@ -18854,10 +18886,11 @@ function CdlNodeView({
18854
18886
  currentPhaseId,
18855
18887
  chartLineScale,
18856
18888
  \u95A2\u4FC2\u306E\u53D7\u3051\u53E3,
18857
- lang
18889
+ lang,
18890
+ \u5024\u306E\u540D\u524D
18858
18891
  }) {
18859
- const value = node.value ? interpolate(node.value, stateValues) : void 0;
18860
- const rows = (node.rows ?? []).map((r) => interpolate(r, stateValues));
18892
+ const value = node.value ? interpolate(node.value, stateValues, \u5024\u306E\u540D\u524D) : void 0;
18893
+ const rows = (node.rows ?? []).map((r) => interpolate(r, stateValues, \u5024\u306E\u540D\u524D));
18861
18894
  const boundW = node.wBind ? resolveNumericAttr(node.wBind, stateValues, node.w) : node.w;
18862
18895
  const boundH = node.hBind ? resolveNumericAttr(node.hBind, stateValues, node.h) : node.h;
18863
18896
  const boundOpacity = node.opacity !== void 0 ? Math.min(1, Math.max(0, resolveNumericAttr(node.opacity, stateValues, 1))) : void 0;
@@ -18871,9 +18904,9 @@ function CdlNodeView({
18871
18904
  }
18872
18905
  const resolvedNode = {
18873
18906
  ...node,
18874
- title: interpolate(node.title, stateValues),
18875
- subtitle: node.subtitle ? interpolate(node.subtitle, stateValues) : node.subtitle,
18876
- eyebrow: node.eyebrow ? interpolate(node.eyebrow, stateValues) : node.eyebrow,
18907
+ title: interpolate(node.title, stateValues, \u5024\u306E\u540D\u524D),
18908
+ subtitle: node.subtitle ? interpolate(node.subtitle, stateValues, \u5024\u306E\u540D\u524D) : node.subtitle,
18909
+ eyebrow: node.eyebrow ? interpolate(node.eyebrow, stateValues, \u5024\u306E\u540D\u524D) : node.eyebrow,
18877
18910
  w: boundW,
18878
18911
  h: boundH
18879
18912
  };
@@ -19154,7 +19187,7 @@ function CdlNodeView({
19154
19187
  case "mark-end":
19155
19188
  return /* @__PURE__ */ jsx(MarkEndNode, { node: resolvedNode, active });
19156
19189
  default:
19157
- return /* @__PURE__ */ jsx(GenericNode, { node: resolvedNode, active, value: node.value, stateValues });
19190
+ return /* @__PURE__ */ jsx(GenericNode, { node: resolvedNode, active, value: node.value, stateValues, \u5024\u306E\u540D\u524D });
19158
19191
  }
19159
19192
  })();
19160
19193
  const offsetX = node.renderOffsetX !== void 0 ? resolveNumericAttr(node.renderOffsetX, stateValues, 0) : 0;
@@ -19236,7 +19269,8 @@ function CdlStage({
19236
19269
  stateValues,
19237
19270
  debug,
19238
19271
  compact = false,
19239
- svgRef
19272
+ svgRef,
19273
+ \u5024\u306E\u540D\u524D
19240
19274
  }) {
19241
19275
  const [\u7126\u70B9, set\u7126\u70B9] = useState(null);
19242
19276
  const \u95A2\u4FC2\u3092\u5149\u3089\u305B\u308B = (laid.relationFocus ?? RELATION_FOCUS_DEFAULT) === "hover";
@@ -19516,6 +19550,7 @@ function CdlStage({
19516
19550
  drawing: \u63CF\u304F,
19517
19551
  progress: \u63CF\u304F ? \u63CF\u304F\u9032\u307F : progress,
19518
19552
  stateValues,
19553
+ \u5024\u306E\u540D\u524D,
19519
19554
  currentPhaseId: currentPhase?.id,
19520
19555
  chartLineScale: chartLineScales.get(node.id)
19521
19556
  }
@@ -20684,7 +20719,7 @@ function InputWidget({
20684
20719
  },
20685
20720
  "data-cdl-input": input.id,
20686
20721
  className: "cdl-ip-dropdown-select",
20687
- children: input.options.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt))
20722
+ children: input.options.map((opt) => /* @__PURE__ */ jsx("option", { value: \u9078\u629E\u80A2\u306E\u5024(opt), children: \u9078\u629E\u80A2\u306E\u540D\u524D(opt) }, \u9078\u629E\u80A2\u306E\u5024(opt)))
20688
20723
  }
20689
20724
  )
20690
20725
  ] });
@@ -20701,17 +20736,17 @@ function InputWidget({
20701
20736
  {
20702
20737
  type: "radio",
20703
20738
  name: input.id,
20704
- value: opt,
20705
- checked: value === opt,
20739
+ value: \u9078\u629E\u80A2\u306E\u5024(opt),
20740
+ checked: value === \u9078\u629E\u80A2\u306E\u5024(opt),
20706
20741
  onChange: () => {
20707
- signal2.value = opt;
20742
+ signal2.value = \u9078\u629E\u80A2\u306E\u5024(opt);
20708
20743
  },
20709
20744
  "data-cdl-input": input.id,
20710
20745
  className: "cdl-ip-radio-input"
20711
20746
  }
20712
20747
  ),
20713
- /* @__PURE__ */ jsx("span", { className: "cdl-ip-radio-label", children: opt })
20714
- ] }, opt)) })
20748
+ /* @__PURE__ */ jsx("span", { className: "cdl-ip-radio-label", children: \u9078\u629E\u80A2\u306E\u540D\u524D(opt) })
20749
+ ] }, \u9078\u629E\u80A2\u306E\u5024(opt))) })
20715
20750
  ] });
20716
20751
  case "color":
20717
20752
  return /* @__PURE__ */ jsxs("label", { className: "cdl-ip-item cdl-ip-color", "data-cdl-input-kind": "color", children: [
@@ -20761,14 +20796,14 @@ function InputWidget({
20761
20796
  {
20762
20797
  type: "button",
20763
20798
  role: "tab",
20764
- className: `cdl-ip-tabs-btn ${value === opt ? "cdl-ip-tabs-active" : ""}`,
20799
+ className: `cdl-ip-tabs-btn ${value === \u9078\u629E\u80A2\u306E\u5024(opt) ? "cdl-ip-tabs-active" : ""}`,
20765
20800
  onClick: () => {
20766
- signal2.value = opt;
20801
+ signal2.value = \u9078\u629E\u80A2\u306E\u5024(opt);
20767
20802
  },
20768
20803
  "data-cdl-input": input.id,
20769
- children: opt
20804
+ children: \u9078\u629E\u80A2\u306E\u540D\u524D(opt)
20770
20805
  },
20771
- opt
20806
+ \u9078\u629E\u80A2\u306E\u5024(opt)
20772
20807
  )) })
20773
20808
  ] });
20774
20809
  case "datetime":
@@ -22823,13 +22858,13 @@ function MultiSelectWidget({
22823
22858
  "button",
22824
22859
  {
22825
22860
  type: "button",
22826
- className: `cdl-ip-multi-select-chip ${selected.has(opt) ? "cdl-ip-multi-select-active" : ""}`,
22827
- onClick: () => toggle(opt),
22861
+ className: `cdl-ip-multi-select-chip ${selected.has(\u9078\u629E\u80A2\u306E\u5024(opt)) ? "cdl-ip-multi-select-active" : ""}`,
22862
+ onClick: () => toggle(\u9078\u629E\u80A2\u306E\u5024(opt)),
22828
22863
  "data-cdl-input": input.id,
22829
- "data-cdl-multi-value": opt,
22830
- children: opt
22864
+ "data-cdl-multi-value": \u9078\u629E\u80A2\u306E\u5024(opt),
22865
+ children: \u9078\u629E\u80A2\u306E\u540D\u524D(opt)
22831
22866
  },
22832
- opt
22867
+ \u9078\u629E\u80A2\u306E\u5024(opt)
22833
22868
  )) })
22834
22869
  ] });
22835
22870
  }
@@ -28361,6 +28396,7 @@ function CdlDiagramView({ diagram, laid: laidProp, hideHeader = false, hideMiniP
28361
28396
  if (!isInteractive) return baseStateValues;
28362
28397
  return mergeStateValues(baseStateValues, interactive.stateOverrides);
28363
28398
  }, [isInteractive, baseStateValues, interactive.stateOverrides]);
28399
+ const \u5024\u306E\u540D\u524D = useMemo(() => \u5024\u306E\u540D\u524D\u306E\u8868\u3092\u4F5C\u308B(diagram.inputs), [diagram.inputs]);
28364
28400
  return /* @__PURE__ */ jsxs(
28365
28401
  "div",
28366
28402
  {
@@ -28389,7 +28425,7 @@ function CdlDiagramView({ diagram, laid: laidProp, hideHeader = false, hideMiniP
28389
28425
  }
28390
28426
  ),
28391
28427
  isInteractive && interactive.panel,
28392
- /* @__PURE__ */ jsx(CdlStage, { laid, currentPhase, progress, drawProgress, stateValues, debug, compact: hideHeader, svgRef: isInteractive ? interactive.svgRef : void 0 }),
28428
+ /* @__PURE__ */ jsx(CdlStage, { laid, currentPhase, progress, drawProgress, stateValues, \u5024\u306E\u540D\u524D, debug, compact: hideHeader, svgRef: isInteractive ? interactive.svgRef : void 0 }),
28393
28429
  hideHeader && !hideMiniPhaseIndicator && currentPhase && laid.phases.length > 1 && /* @__PURE__ */ 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: [
28394
28430
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
28395
28431
  laid.phases.map((p, i) => /* @__PURE__ */ jsx(