@cardenelabs/cdl 0.60.0 → 0.62.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
@@ -563,6 +563,18 @@ var en = {
563
563
  "readout.kanban.inprogress": "In Progress",
564
564
  /** `kanban-board` の列の見出し (値は `done` で読む) */
565
565
  "readout.kanban.done": "Done",
566
+ /** `status-timeline` の区間の字 (値は `active` で読む) */
567
+ "readout.statusTimeline.active": "ACTIVE",
568
+ /** `status-timeline` の区間の字 (値は `idle` で読む) */
569
+ "readout.statusTimeline.idle": "IDLE",
570
+ /** `status-timeline` の区間の字 (値は `error` で読む) */
571
+ "readout.statusTimeline.error": "ERROR",
572
+ /** `user-presence` の状態の字 (値は `online` で読む) */
573
+ "readout.presence.online": "online",
574
+ /** `user-presence` の状態の字 (値は `away` で読む) */
575
+ "readout.presence.away": "away",
576
+ /** `user-presence` の状態の字 (値は `offline` で読む) */
577
+ "readout.presence.offline": "offline",
566
578
  /** `traffic-light` の赤の灯の見出し (値は `red` で読む) */
567
579
  "readout.trafficLight.red": "red",
568
580
  /** `traffic-light` の黄の灯の見出し (値は `yellow` / `amber` で読む) */
@@ -671,6 +683,12 @@ var ja = {
671
683
  "readout.kanban.todo": "\u672A\u7740\u624B",
672
684
  "readout.kanban.inprogress": "\u9032\u884C\u4E2D",
673
685
  "readout.kanban.done": "\u5B8C\u4E86",
686
+ "readout.statusTimeline.active": "\u7A3C\u50CD",
687
+ "readout.statusTimeline.idle": "\u5F85\u6A5F",
688
+ "readout.statusTimeline.error": "\u7570\u5E38",
689
+ "readout.presence.online": "\u30AA\u30F3\u30E9\u30A4\u30F3",
690
+ "readout.presence.away": "\u96E2\u5E2D",
691
+ "readout.presence.offline": "\u30AA\u30D5\u30E9\u30A4\u30F3",
674
692
  "readout.trafficLight.red": "\u8D64",
675
693
  "readout.trafficLight.yellow": "\u9EC4",
676
694
  "readout.trafficLight.green": "\u7DD1"
@@ -3816,6 +3834,34 @@ function evaluateOne(entry, values) {
3816
3834
  }
3817
3835
  }
3818
3836
 
3837
+ // src/input-option.ts
3838
+ function \u9078\u629E\u80A2\u306E\u5024(option) {
3839
+ return typeof option === "string" ? option : option.value;
3840
+ }
3841
+ function \u9078\u629E\u80A2\u306E\u540D\u524D(option) {
3842
+ return typeof option === "string" || option.label === "" ? \u9078\u629E\u80A2\u306E\u5024(option) : option.label;
3843
+ }
3844
+ function \u5024\u306E\u540D\u524D\u306E\u8868\u3092\u4F5C\u308B(inputs) {
3845
+ const \u8868 = /* @__PURE__ */ new Map();
3846
+ for (const input of inputs ?? []) {
3847
+ const \u540D\u524D = /* @__PURE__ */ new Map();
3848
+ if (input.kind === "dropdown" || input.kind === "radio" || input.kind === "tabs" || input.kind === "multi-select") {
3849
+ for (const option of input.options) {
3850
+ if (typeof option !== "string" && option.label !== "") \u540D\u524D.set(option.value, option.label);
3851
+ }
3852
+ } else if (input.kind === "toggle") {
3853
+ if (input.onLabel) \u540D\u524D.set("true", input.onLabel);
3854
+ if (input.offLabel) \u540D\u524D.set("false", input.offLabel);
3855
+ }
3856
+ if (\u540D\u524D.size > 0) \u8868.set(input.id, { \u540D\u524D, \u8907\u6570: input.kind === "multi-select" });
3857
+ }
3858
+ return \u8868;
3859
+ }
3860
+ function \u5024\u3092\u540D\u524D\u3067\u8AAD\u3080(\u5165\u529B\u6B04, \u5024) {
3861
+ if (!\u5165\u529B\u6B04.\u8907\u6570) return \u5165\u529B\u6B04.\u540D\u524D.get(\u5024) ?? \u5024;
3862
+ return \u5024.split(",").map((v) => \u5165\u529B\u6B04.\u540D\u524D.get(v) ?? v).join(",");
3863
+ }
3864
+
3819
3865
  // src/render/utils.ts
3820
3866
  var TEMPLATE_REF_RE = new RegExp(TEMPLATE_REF_SRC, "g");
3821
3867
  var TEMPLATE_LEFTOVER_TEST_RE = new RegExp(TEMPLATE_LEFTOVER_SRC);
@@ -3864,11 +3910,14 @@ function mergeStateValues(base, overrides) {
3864
3910
  }
3865
3911
  return merged;
3866
3912
  }
3867
- function interpolate(template, values) {
3913
+ function interpolate(template, values, \u540D\u524D\u306E\u8868) {
3868
3914
  return template.replace(TEMPLATE_REF_RE, (_, id, accessor) => {
3869
3915
  const raw = Object.hasOwn(values, id) ? values[id] : void 0;
3870
3916
  if (raw === void 0) return `{${id}${accessor ?? ""}}`;
3871
- if (!accessor) return raw;
3917
+ if (!accessor) {
3918
+ const \u5165\u529B\u6B04 = \u540D\u524D\u306E\u8868?.get(id);
3919
+ return \u5165\u529B\u6B04 ? \u5024\u3092\u540D\u524D\u3067\u8AAD\u3080(\u5165\u529B\u6B04, raw) : raw;
3920
+ }
3872
3921
  const arr = parseArraySignal(raw);
3873
3922
  if (!arr) return `{${id}${accessor}}`;
3874
3923
  if (accessor === ".length") return String(arr.length);
@@ -12053,7 +12102,8 @@ function GenericNode({
12053
12102
  node,
12054
12103
  active,
12055
12104
  value,
12056
- stateValues
12105
+ stateValues,
12106
+ \u5024\u306E\u540D\u524D
12057
12107
  }) {
12058
12108
  const base = STYLES[node.kind] ?? FALLBACK;
12059
12109
  const toned = toneColor3(node.tone);
@@ -12139,7 +12189,7 @@ function GenericNode({
12139
12189
  style.look === "ledger" && /* @__PURE__ */ jsx("line", { x1: 1, y1: h - 7, x2: w - 1, y2: h - 7, stroke: paint.stroke, strokeWidth: 1 })
12140
12190
  ] });
12141
12191
  })();
12142
- const resolvedValue = value !== void 0 ? interpolate(value, stateValues) : void 0;
12192
+ const resolvedValue = value !== void 0 ? interpolate(value, stateValues, \u5024\u306E\u540D\u524D) : void 0;
12143
12193
  const hasRows = (node.rows?.length ?? 0) > 0;
12144
12194
  const centered = genericTextCentered(node.kind, hasRows);
12145
12195
  const textAnchor = centered ? "middle" : "start";
@@ -12189,7 +12239,7 @@ function GenericNode({
12189
12239
  }
12190
12240
  ),
12191
12241
  node.rows && node.rows.length > 0 && (() => {
12192
- const resolved = node.rows.map((row) => interpolate(row, stateValues));
12242
+ const resolved = node.rows.map((row) => interpolate(row, stateValues, \u5024\u306E\u540D\u524D));
12193
12243
  const splits = resolved.map(splitRow);
12194
12244
  const leftMaxWidth = splits.reduce(
12195
12245
  (m, s) => Math.max(m, rowColumnWidth(s.left, GENERIC_ROW_LEFT_SIZE_PX, false)),
@@ -18854,10 +18904,11 @@ function CdlNodeView({
18854
18904
  currentPhaseId,
18855
18905
  chartLineScale,
18856
18906
  \u95A2\u4FC2\u306E\u53D7\u3051\u53E3,
18857
- lang
18907
+ lang,
18908
+ \u5024\u306E\u540D\u524D
18858
18909
  }) {
18859
- const value = node.value ? interpolate(node.value, stateValues) : void 0;
18860
- const rows = (node.rows ?? []).map((r) => interpolate(r, stateValues));
18910
+ const value = node.value ? interpolate(node.value, stateValues, \u5024\u306E\u540D\u524D) : void 0;
18911
+ const rows = (node.rows ?? []).map((r) => interpolate(r, stateValues, \u5024\u306E\u540D\u524D));
18861
18912
  const boundW = node.wBind ? resolveNumericAttr(node.wBind, stateValues, node.w) : node.w;
18862
18913
  const boundH = node.hBind ? resolveNumericAttr(node.hBind, stateValues, node.h) : node.h;
18863
18914
  const boundOpacity = node.opacity !== void 0 ? Math.min(1, Math.max(0, resolveNumericAttr(node.opacity, stateValues, 1))) : void 0;
@@ -18871,9 +18922,9 @@ function CdlNodeView({
18871
18922
  }
18872
18923
  const resolvedNode = {
18873
18924
  ...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,
18925
+ title: interpolate(node.title, stateValues, \u5024\u306E\u540D\u524D),
18926
+ subtitle: node.subtitle ? interpolate(node.subtitle, stateValues, \u5024\u306E\u540D\u524D) : node.subtitle,
18927
+ eyebrow: node.eyebrow ? interpolate(node.eyebrow, stateValues, \u5024\u306E\u540D\u524D) : node.eyebrow,
18877
18928
  w: boundW,
18878
18929
  h: boundH
18879
18930
  };
@@ -19154,7 +19205,7 @@ function CdlNodeView({
19154
19205
  case "mark-end":
19155
19206
  return /* @__PURE__ */ jsx(MarkEndNode, { node: resolvedNode, active });
19156
19207
  default:
19157
- return /* @__PURE__ */ jsx(GenericNode, { node: resolvedNode, active, value: node.value, stateValues });
19208
+ return /* @__PURE__ */ jsx(GenericNode, { node: resolvedNode, active, value: node.value, stateValues, \u5024\u306E\u540D\u524D });
19158
19209
  }
19159
19210
  })();
19160
19211
  const offsetX = node.renderOffsetX !== void 0 ? resolveNumericAttr(node.renderOffsetX, stateValues, 0) : 0;
@@ -19236,7 +19287,8 @@ function CdlStage({
19236
19287
  stateValues,
19237
19288
  debug,
19238
19289
  compact = false,
19239
- svgRef
19290
+ svgRef,
19291
+ \u5024\u306E\u540D\u524D
19240
19292
  }) {
19241
19293
  const [\u7126\u70B9, set\u7126\u70B9] = useState(null);
19242
19294
  const \u95A2\u4FC2\u3092\u5149\u3089\u305B\u308B = (laid.relationFocus ?? RELATION_FOCUS_DEFAULT) === "hover";
@@ -19516,6 +19568,7 @@ function CdlStage({
19516
19568
  drawing: \u63CF\u304F,
19517
19569
  progress: \u63CF\u304F ? \u63CF\u304F\u9032\u307F : progress,
19518
19570
  stateValues,
19571
+ \u5024\u306E\u540D\u524D,
19519
19572
  currentPhaseId: currentPhase?.id,
19520
19573
  chartLineScale: chartLineScales.get(node.id)
19521
19574
  }
@@ -20684,7 +20737,7 @@ function InputWidget({
20684
20737
  },
20685
20738
  "data-cdl-input": input.id,
20686
20739
  className: "cdl-ip-dropdown-select",
20687
- children: input.options.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt))
20740
+ 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
20741
  }
20689
20742
  )
20690
20743
  ] });
@@ -20701,17 +20754,17 @@ function InputWidget({
20701
20754
  {
20702
20755
  type: "radio",
20703
20756
  name: input.id,
20704
- value: opt,
20705
- checked: value === opt,
20757
+ value: \u9078\u629E\u80A2\u306E\u5024(opt),
20758
+ checked: value === \u9078\u629E\u80A2\u306E\u5024(opt),
20706
20759
  onChange: () => {
20707
- signal2.value = opt;
20760
+ signal2.value = \u9078\u629E\u80A2\u306E\u5024(opt);
20708
20761
  },
20709
20762
  "data-cdl-input": input.id,
20710
20763
  className: "cdl-ip-radio-input"
20711
20764
  }
20712
20765
  ),
20713
- /* @__PURE__ */ jsx("span", { className: "cdl-ip-radio-label", children: opt })
20714
- ] }, opt)) })
20766
+ /* @__PURE__ */ jsx("span", { className: "cdl-ip-radio-label", children: \u9078\u629E\u80A2\u306E\u540D\u524D(opt) })
20767
+ ] }, \u9078\u629E\u80A2\u306E\u5024(opt))) })
20715
20768
  ] });
20716
20769
  case "color":
20717
20770
  return /* @__PURE__ */ jsxs("label", { className: "cdl-ip-item cdl-ip-color", "data-cdl-input-kind": "color", children: [
@@ -20761,14 +20814,14 @@ function InputWidget({
20761
20814
  {
20762
20815
  type: "button",
20763
20816
  role: "tab",
20764
- className: `cdl-ip-tabs-btn ${value === opt ? "cdl-ip-tabs-active" : ""}`,
20817
+ className: `cdl-ip-tabs-btn ${value === \u9078\u629E\u80A2\u306E\u5024(opt) ? "cdl-ip-tabs-active" : ""}`,
20765
20818
  onClick: () => {
20766
- signal2.value = opt;
20819
+ signal2.value = \u9078\u629E\u80A2\u306E\u5024(opt);
20767
20820
  },
20768
20821
  "data-cdl-input": input.id,
20769
- children: opt
20822
+ children: \u9078\u629E\u80A2\u306E\u540D\u524D(opt)
20770
20823
  },
20771
- opt
20824
+ \u9078\u629E\u80A2\u306E\u5024(opt)
20772
20825
  )) })
20773
20826
  ] });
20774
20827
  case "datetime":
@@ -22823,13 +22876,13 @@ function MultiSelectWidget({
22823
22876
  "button",
22824
22877
  {
22825
22878
  type: "button",
22826
- className: `cdl-ip-multi-select-chip ${selected.has(opt) ? "cdl-ip-multi-select-active" : ""}`,
22827
- onClick: () => toggle(opt),
22879
+ className: `cdl-ip-multi-select-chip ${selected.has(\u9078\u629E\u80A2\u306E\u5024(opt)) ? "cdl-ip-multi-select-active" : ""}`,
22880
+ onClick: () => toggle(\u9078\u629E\u80A2\u306E\u5024(opt)),
22828
22881
  "data-cdl-input": input.id,
22829
- "data-cdl-multi-value": opt,
22830
- children: opt
22882
+ "data-cdl-multi-value": \u9078\u629E\u80A2\u306E\u5024(opt),
22883
+ children: \u9078\u629E\u80A2\u306E\u540D\u524D(opt)
22831
22884
  },
22832
- opt
22885
+ \u9078\u629E\u80A2\u306E\u5024(opt)
22833
22886
  )) })
22834
22887
  ] });
22835
22888
  }
@@ -26385,12 +26438,14 @@ function StatusTimelineReadout({
26385
26438
  } catch {
26386
26439
  }
26387
26440
  }
26441
+ const \u5F15\u304F = use\u5B57\u5F15();
26388
26442
  const colorLookup = new Map(colorMap.map((c) => [c.status.toLowerCase(), c.color]));
26389
26443
  const shown = events.slice(0, max);
26390
26444
  const stripHeight = 28;
26391
26445
  const width = 320;
26392
26446
  const cellW = shown.length > 0 ? (width - 20) / shown.length : 0;
26393
26447
  const height = stripHeight + 40;
26448
+ const \u533A\u9593\u306E\u5B57 = (status) => status === "active" || status === "idle" || status === "error" ? \u5F15\u304F(`readout.statusTimeline.${status}`) : status.toUpperCase();
26394
26449
  return /* @__PURE__ */ jsxs("div", { className: "cdl-ip-item cdl-ip-readout-status-timeline", "data-cdl-readout": id, children: [
26395
26450
  /* @__PURE__ */ jsx("span", { className: "cdl-ip-label", children: label }),
26396
26451
  /* @__PURE__ */ jsx(
@@ -26403,9 +26458,11 @@ function StatusTimelineReadout({
26403
26458
  children: shown.map((ev, i) => {
26404
26459
  const x = 10 + i * cellW;
26405
26460
  const c = colorLookup.get(ev.status) ?? "#cbd5e1";
26406
- return /* @__PURE__ */ jsxs("g", { "data-cdl-status-event": i, children: [
26461
+ const \u5B572 = \u533A\u9593\u306E\u5B57(ev.status);
26462
+ const \u63CF\u304F\u5B57 = \u5E45\u3067\u5207\u308B(\u5B572, 10, cellW - 8);
26463
+ return /* @__PURE__ */ jsxs("g", { "data-cdl-status-event": i, "data-cdl-status": ev.status, children: [
26407
26464
  /* @__PURE__ */ jsx("rect", { x, y: 10, width: cellW - 2, height: stripHeight, fill: c, rx: 2 }),
26408
- /* @__PURE__ */ jsx(
26465
+ /* @__PURE__ */ jsxs(
26409
26466
  "text",
26410
26467
  {
26411
26468
  x: x + cellW / 2,
@@ -26415,7 +26472,10 @@ function StatusTimelineReadout({
26415
26472
  fill: "#ffffff",
26416
26473
  fontWeight: 600,
26417
26474
  style: { userSelect: "none" },
26418
- children: ev.status.length > 5 ? ev.status.slice(0, 4).toUpperCase() : ev.status.toUpperCase()
26475
+ children: [
26476
+ \u63CF\u304F\u5B57 !== \u5B572 ? /* @__PURE__ */ jsx("title", { children: \u5B572 }) : null,
26477
+ \u63CF\u304F\u5B57
26478
+ ]
26419
26479
  }
26420
26480
  ),
26421
26481
  /* @__PURE__ */ jsx(
@@ -26733,6 +26793,8 @@ function UserPresenceReadout({
26733
26793
  const width = 260;
26734
26794
  const height = shown.length * rowH + (overflow > 0 ? 20 : 0) + 8;
26735
26795
  const statusColor = (s) => s === "online" ? "#22c55e" : s === "away" ? "#eab308" : "#94a3b8";
26796
+ const \u5F15\u304F = use\u5B57\u5F15();
26797
+ const \u72B6\u614B\u306E\u5B57 = (s) => s === "online" || s === "away" || s === "offline" ? \u5F15\u304F(`readout.presence.${s}`) : s;
26736
26798
  return /* @__PURE__ */ jsxs("div", { className: "cdl-ip-item cdl-ip-readout-user-presence", "data-cdl-readout": id, children: [
26737
26799
  /* @__PURE__ */ jsx("span", { className: "cdl-ip-label", children: label }),
26738
26800
  /* @__PURE__ */ jsxs(
@@ -26745,7 +26807,7 @@ function UserPresenceReadout({
26745
26807
  children: [
26746
26808
  shown.map((u, i) => {
26747
26809
  const y = 4 + i * rowH;
26748
- return /* @__PURE__ */ jsxs("g", { "data-cdl-presence-user": i, children: [
26810
+ return /* @__PURE__ */ jsxs("g", { "data-cdl-presence-user": i, "data-cdl-presence-status": u.status, children: [
26749
26811
  /* @__PURE__ */ jsx("circle", { cx: 12, cy: y + rowH / 2, r: 6, fill: statusColor(u.status) }),
26750
26812
  /* @__PURE__ */ jsx(
26751
26813
  "text",
@@ -26768,7 +26830,7 @@ function UserPresenceReadout({
26768
26830
  textAnchor: "end",
26769
26831
  fill: "#64748b",
26770
26832
  style: { userSelect: "none" },
26771
- children: u.status
26833
+ children: \u72B6\u614B\u306E\u5B57(u.status)
26772
26834
  }
26773
26835
  )
26774
26836
  ] }, i);
@@ -28361,6 +28423,7 @@ function CdlDiagramView({ diagram, laid: laidProp, hideHeader = false, hideMiniP
28361
28423
  if (!isInteractive) return baseStateValues;
28362
28424
  return mergeStateValues(baseStateValues, interactive.stateOverrides);
28363
28425
  }, [isInteractive, baseStateValues, interactive.stateOverrides]);
28426
+ const \u5024\u306E\u540D\u524D = useMemo(() => \u5024\u306E\u540D\u524D\u306E\u8868\u3092\u4F5C\u308B(diagram.inputs), [diagram.inputs]);
28364
28427
  return /* @__PURE__ */ jsxs(
28365
28428
  "div",
28366
28429
  {
@@ -28389,7 +28452,7 @@ function CdlDiagramView({ diagram, laid: laidProp, hideHeader = false, hideMiniP
28389
28452
  }
28390
28453
  ),
28391
28454
  isInteractive && interactive.panel,
28392
- /* @__PURE__ */ jsx(CdlStage, { laid, currentPhase, progress, drawProgress, stateValues, debug, compact: hideHeader, svgRef: isInteractive ? interactive.svgRef : void 0 }),
28455
+ /* @__PURE__ */ jsx(CdlStage, { laid, currentPhase, progress, drawProgress, stateValues, \u5024\u306E\u540D\u524D, debug, compact: hideHeader, svgRef: isInteractive ? interactive.svgRef : void 0 }),
28393
28456
  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
28457
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
28395
28458
  laid.phases.map((p, i) => /* @__PURE__ */ jsx(