@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.cjs CHANGED
@@ -565,6 +565,18 @@ var en = {
565
565
  "readout.kanban.inprogress": "In Progress",
566
566
  /** `kanban-board` の列の見出し (値は `done` で読む) */
567
567
  "readout.kanban.done": "Done",
568
+ /** `status-timeline` の区間の字 (値は `active` で読む) */
569
+ "readout.statusTimeline.active": "ACTIVE",
570
+ /** `status-timeline` の区間の字 (値は `idle` で読む) */
571
+ "readout.statusTimeline.idle": "IDLE",
572
+ /** `status-timeline` の区間の字 (値は `error` で読む) */
573
+ "readout.statusTimeline.error": "ERROR",
574
+ /** `user-presence` の状態の字 (値は `online` で読む) */
575
+ "readout.presence.online": "online",
576
+ /** `user-presence` の状態の字 (値は `away` で読む) */
577
+ "readout.presence.away": "away",
578
+ /** `user-presence` の状態の字 (値は `offline` で読む) */
579
+ "readout.presence.offline": "offline",
568
580
  /** `traffic-light` の赤の灯の見出し (値は `red` で読む) */
569
581
  "readout.trafficLight.red": "red",
570
582
  /** `traffic-light` の黄の灯の見出し (値は `yellow` / `amber` で読む) */
@@ -673,6 +685,12 @@ var ja = {
673
685
  "readout.kanban.todo": "\u672A\u7740\u624B",
674
686
  "readout.kanban.inprogress": "\u9032\u884C\u4E2D",
675
687
  "readout.kanban.done": "\u5B8C\u4E86",
688
+ "readout.statusTimeline.active": "\u7A3C\u50CD",
689
+ "readout.statusTimeline.idle": "\u5F85\u6A5F",
690
+ "readout.statusTimeline.error": "\u7570\u5E38",
691
+ "readout.presence.online": "\u30AA\u30F3\u30E9\u30A4\u30F3",
692
+ "readout.presence.away": "\u96E2\u5E2D",
693
+ "readout.presence.offline": "\u30AA\u30D5\u30E9\u30A4\u30F3",
676
694
  "readout.trafficLight.red": "\u8D64",
677
695
  "readout.trafficLight.yellow": "\u9EC4",
678
696
  "readout.trafficLight.green": "\u7DD1"
@@ -3818,6 +3836,34 @@ function evaluateOne(entry, values) {
3818
3836
  }
3819
3837
  }
3820
3838
 
3839
+ // src/input-option.ts
3840
+ function \u9078\u629E\u80A2\u306E\u5024(option) {
3841
+ return typeof option === "string" ? option : option.value;
3842
+ }
3843
+ function \u9078\u629E\u80A2\u306E\u540D\u524D(option) {
3844
+ return typeof option === "string" || option.label === "" ? \u9078\u629E\u80A2\u306E\u5024(option) : option.label;
3845
+ }
3846
+ function \u5024\u306E\u540D\u524D\u306E\u8868\u3092\u4F5C\u308B(inputs) {
3847
+ const \u8868 = /* @__PURE__ */ new Map();
3848
+ for (const input of inputs ?? []) {
3849
+ const \u540D\u524D = /* @__PURE__ */ new Map();
3850
+ if (input.kind === "dropdown" || input.kind === "radio" || input.kind === "tabs" || input.kind === "multi-select") {
3851
+ for (const option of input.options) {
3852
+ if (typeof option !== "string" && option.label !== "") \u540D\u524D.set(option.value, option.label);
3853
+ }
3854
+ } else if (input.kind === "toggle") {
3855
+ if (input.onLabel) \u540D\u524D.set("true", input.onLabel);
3856
+ if (input.offLabel) \u540D\u524D.set("false", input.offLabel);
3857
+ }
3858
+ if (\u540D\u524D.size > 0) \u8868.set(input.id, { \u540D\u524D, \u8907\u6570: input.kind === "multi-select" });
3859
+ }
3860
+ return \u8868;
3861
+ }
3862
+ function \u5024\u3092\u540D\u524D\u3067\u8AAD\u3080(\u5165\u529B\u6B04, \u5024) {
3863
+ if (!\u5165\u529B\u6B04.\u8907\u6570) return \u5165\u529B\u6B04.\u540D\u524D.get(\u5024) ?? \u5024;
3864
+ return \u5024.split(",").map((v) => \u5165\u529B\u6B04.\u540D\u524D.get(v) ?? v).join(",");
3865
+ }
3866
+
3821
3867
  // src/render/utils.ts
3822
3868
  var TEMPLATE_REF_RE = new RegExp(TEMPLATE_REF_SRC, "g");
3823
3869
  var TEMPLATE_LEFTOVER_TEST_RE = new RegExp(TEMPLATE_LEFTOVER_SRC);
@@ -3866,11 +3912,14 @@ function mergeStateValues(base, overrides) {
3866
3912
  }
3867
3913
  return merged;
3868
3914
  }
3869
- function interpolate(template, values) {
3915
+ function interpolate(template, values, \u540D\u524D\u306E\u8868) {
3870
3916
  return template.replace(TEMPLATE_REF_RE, (_, id, accessor) => {
3871
3917
  const raw = Object.hasOwn(values, id) ? values[id] : void 0;
3872
3918
  if (raw === void 0) return `{${id}${accessor ?? ""}}`;
3873
- if (!accessor) return raw;
3919
+ if (!accessor) {
3920
+ const \u5165\u529B\u6B04 = \u540D\u524D\u306E\u8868?.get(id);
3921
+ return \u5165\u529B\u6B04 ? \u5024\u3092\u540D\u524D\u3067\u8AAD\u3080(\u5165\u529B\u6B04, raw) : raw;
3922
+ }
3874
3923
  const arr = parseArraySignal(raw);
3875
3924
  if (!arr) return `{${id}${accessor}}`;
3876
3925
  if (accessor === ".length") return String(arr.length);
@@ -12055,7 +12104,8 @@ function GenericNode({
12055
12104
  node,
12056
12105
  active,
12057
12106
  value,
12058
- stateValues
12107
+ stateValues,
12108
+ \u5024\u306E\u540D\u524D
12059
12109
  }) {
12060
12110
  const base = STYLES[node.kind] ?? FALLBACK;
12061
12111
  const toned = toneColor3(node.tone);
@@ -12141,7 +12191,7 @@ function GenericNode({
12141
12191
  style.look === "ledger" && /* @__PURE__ */ jsxRuntime.jsx("line", { x1: 1, y1: h - 7, x2: w - 1, y2: h - 7, stroke: paint.stroke, strokeWidth: 1 })
12142
12192
  ] });
12143
12193
  })();
12144
- const resolvedValue = value !== void 0 ? interpolate(value, stateValues) : void 0;
12194
+ const resolvedValue = value !== void 0 ? interpolate(value, stateValues, \u5024\u306E\u540D\u524D) : void 0;
12145
12195
  const hasRows = (node.rows?.length ?? 0) > 0;
12146
12196
  const centered = genericTextCentered(node.kind, hasRows);
12147
12197
  const textAnchor = centered ? "middle" : "start";
@@ -12191,7 +12241,7 @@ function GenericNode({
12191
12241
  }
12192
12242
  ),
12193
12243
  node.rows && node.rows.length > 0 && (() => {
12194
- const resolved = node.rows.map((row) => interpolate(row, stateValues));
12244
+ const resolved = node.rows.map((row) => interpolate(row, stateValues, \u5024\u306E\u540D\u524D));
12195
12245
  const splits = resolved.map(splitRow);
12196
12246
  const leftMaxWidth = splits.reduce(
12197
12247
  (m, s) => Math.max(m, rowColumnWidth(s.left, GENERIC_ROW_LEFT_SIZE_PX, false)),
@@ -18856,10 +18906,11 @@ function CdlNodeView({
18856
18906
  currentPhaseId,
18857
18907
  chartLineScale,
18858
18908
  \u95A2\u4FC2\u306E\u53D7\u3051\u53E3,
18859
- lang
18909
+ lang,
18910
+ \u5024\u306E\u540D\u524D
18860
18911
  }) {
18861
- const value = node.value ? interpolate(node.value, stateValues) : void 0;
18862
- const rows = (node.rows ?? []).map((r) => interpolate(r, stateValues));
18912
+ const value = node.value ? interpolate(node.value, stateValues, \u5024\u306E\u540D\u524D) : void 0;
18913
+ const rows = (node.rows ?? []).map((r) => interpolate(r, stateValues, \u5024\u306E\u540D\u524D));
18863
18914
  const boundW = node.wBind ? resolveNumericAttr(node.wBind, stateValues, node.w) : node.w;
18864
18915
  const boundH = node.hBind ? resolveNumericAttr(node.hBind, stateValues, node.h) : node.h;
18865
18916
  const boundOpacity = node.opacity !== void 0 ? Math.min(1, Math.max(0, resolveNumericAttr(node.opacity, stateValues, 1))) : void 0;
@@ -18873,9 +18924,9 @@ function CdlNodeView({
18873
18924
  }
18874
18925
  const resolvedNode = {
18875
18926
  ...node,
18876
- title: interpolate(node.title, stateValues),
18877
- subtitle: node.subtitle ? interpolate(node.subtitle, stateValues) : node.subtitle,
18878
- eyebrow: node.eyebrow ? interpolate(node.eyebrow, stateValues) : node.eyebrow,
18927
+ title: interpolate(node.title, stateValues, \u5024\u306E\u540D\u524D),
18928
+ subtitle: node.subtitle ? interpolate(node.subtitle, stateValues, \u5024\u306E\u540D\u524D) : node.subtitle,
18929
+ eyebrow: node.eyebrow ? interpolate(node.eyebrow, stateValues, \u5024\u306E\u540D\u524D) : node.eyebrow,
18879
18930
  w: boundW,
18880
18931
  h: boundH
18881
18932
  };
@@ -19156,7 +19207,7 @@ function CdlNodeView({
19156
19207
  case "mark-end":
19157
19208
  return /* @__PURE__ */ jsxRuntime.jsx(MarkEndNode, { node: resolvedNode, active });
19158
19209
  default:
19159
- return /* @__PURE__ */ jsxRuntime.jsx(GenericNode, { node: resolvedNode, active, value: node.value, stateValues });
19210
+ return /* @__PURE__ */ jsxRuntime.jsx(GenericNode, { node: resolvedNode, active, value: node.value, stateValues, \u5024\u306E\u540D\u524D });
19160
19211
  }
19161
19212
  })();
19162
19213
  const offsetX = node.renderOffsetX !== void 0 ? resolveNumericAttr(node.renderOffsetX, stateValues, 0) : 0;
@@ -19238,7 +19289,8 @@ function CdlStage({
19238
19289
  stateValues,
19239
19290
  debug,
19240
19291
  compact = false,
19241
- svgRef
19292
+ svgRef,
19293
+ \u5024\u306E\u540D\u524D
19242
19294
  }) {
19243
19295
  const [\u7126\u70B9, set\u7126\u70B9] = react.useState(null);
19244
19296
  const \u95A2\u4FC2\u3092\u5149\u3089\u305B\u308B = (laid.relationFocus ?? RELATION_FOCUS_DEFAULT) === "hover";
@@ -19518,6 +19570,7 @@ function CdlStage({
19518
19570
  drawing: \u63CF\u304F,
19519
19571
  progress: \u63CF\u304F ? \u63CF\u304F\u9032\u307F : progress,
19520
19572
  stateValues,
19573
+ \u5024\u306E\u540D\u524D,
19521
19574
  currentPhaseId: currentPhase?.id,
19522
19575
  chartLineScale: chartLineScales.get(node.id)
19523
19576
  }
@@ -20686,7 +20739,7 @@ function InputWidget({
20686
20739
  },
20687
20740
  "data-cdl-input": input.id,
20688
20741
  className: "cdl-ip-dropdown-select",
20689
- children: input.options.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt, children: opt }, opt))
20742
+ children: input.options.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: \u9078\u629E\u80A2\u306E\u5024(opt), children: \u9078\u629E\u80A2\u306E\u540D\u524D(opt) }, \u9078\u629E\u80A2\u306E\u5024(opt)))
20690
20743
  }
20691
20744
  )
20692
20745
  ] });
@@ -20703,17 +20756,17 @@ function InputWidget({
20703
20756
  {
20704
20757
  type: "radio",
20705
20758
  name: input.id,
20706
- value: opt,
20707
- checked: value === opt,
20759
+ value: \u9078\u629E\u80A2\u306E\u5024(opt),
20760
+ checked: value === \u9078\u629E\u80A2\u306E\u5024(opt),
20708
20761
  onChange: () => {
20709
- signal2.value = opt;
20762
+ signal2.value = \u9078\u629E\u80A2\u306E\u5024(opt);
20710
20763
  },
20711
20764
  "data-cdl-input": input.id,
20712
20765
  className: "cdl-ip-radio-input"
20713
20766
  }
20714
20767
  ),
20715
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdl-ip-radio-label", children: opt })
20716
- ] }, opt)) })
20768
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdl-ip-radio-label", children: \u9078\u629E\u80A2\u306E\u540D\u524D(opt) })
20769
+ ] }, \u9078\u629E\u80A2\u306E\u5024(opt))) })
20717
20770
  ] });
20718
20771
  case "color":
20719
20772
  return /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "cdl-ip-item cdl-ip-color", "data-cdl-input-kind": "color", children: [
@@ -20763,14 +20816,14 @@ function InputWidget({
20763
20816
  {
20764
20817
  type: "button",
20765
20818
  role: "tab",
20766
- className: `cdl-ip-tabs-btn ${value === opt ? "cdl-ip-tabs-active" : ""}`,
20819
+ className: `cdl-ip-tabs-btn ${value === \u9078\u629E\u80A2\u306E\u5024(opt) ? "cdl-ip-tabs-active" : ""}`,
20767
20820
  onClick: () => {
20768
- signal2.value = opt;
20821
+ signal2.value = \u9078\u629E\u80A2\u306E\u5024(opt);
20769
20822
  },
20770
20823
  "data-cdl-input": input.id,
20771
- children: opt
20824
+ children: \u9078\u629E\u80A2\u306E\u540D\u524D(opt)
20772
20825
  },
20773
- opt
20826
+ \u9078\u629E\u80A2\u306E\u5024(opt)
20774
20827
  )) })
20775
20828
  ] });
20776
20829
  case "datetime":
@@ -22825,13 +22878,13 @@ function MultiSelectWidget({
22825
22878
  "button",
22826
22879
  {
22827
22880
  type: "button",
22828
- className: `cdl-ip-multi-select-chip ${selected.has(opt) ? "cdl-ip-multi-select-active" : ""}`,
22829
- onClick: () => toggle(opt),
22881
+ className: `cdl-ip-multi-select-chip ${selected.has(\u9078\u629E\u80A2\u306E\u5024(opt)) ? "cdl-ip-multi-select-active" : ""}`,
22882
+ onClick: () => toggle(\u9078\u629E\u80A2\u306E\u5024(opt)),
22830
22883
  "data-cdl-input": input.id,
22831
- "data-cdl-multi-value": opt,
22832
- children: opt
22884
+ "data-cdl-multi-value": \u9078\u629E\u80A2\u306E\u5024(opt),
22885
+ children: \u9078\u629E\u80A2\u306E\u540D\u524D(opt)
22833
22886
  },
22834
- opt
22887
+ \u9078\u629E\u80A2\u306E\u5024(opt)
22835
22888
  )) })
22836
22889
  ] });
22837
22890
  }
@@ -26387,12 +26440,14 @@ function StatusTimelineReadout({
26387
26440
  } catch {
26388
26441
  }
26389
26442
  }
26443
+ const \u5F15\u304F = use\u5B57\u5F15();
26390
26444
  const colorLookup = new Map(colorMap.map((c) => [c.status.toLowerCase(), c.color]));
26391
26445
  const shown = events.slice(0, max);
26392
26446
  const stripHeight = 28;
26393
26447
  const width = 320;
26394
26448
  const cellW = shown.length > 0 ? (width - 20) / shown.length : 0;
26395
26449
  const height = stripHeight + 40;
26450
+ const \u533A\u9593\u306E\u5B57 = (status) => status === "active" || status === "idle" || status === "error" ? \u5F15\u304F(`readout.statusTimeline.${status}`) : status.toUpperCase();
26396
26451
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cdl-ip-item cdl-ip-readout-status-timeline", "data-cdl-readout": id, children: [
26397
26452
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdl-ip-label", children: label }),
26398
26453
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -26405,9 +26460,11 @@ function StatusTimelineReadout({
26405
26460
  children: shown.map((ev, i) => {
26406
26461
  const x = 10 + i * cellW;
26407
26462
  const c = colorLookup.get(ev.status) ?? "#cbd5e1";
26408
- return /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-status-event": i, children: [
26463
+ const \u5B572 = \u533A\u9593\u306E\u5B57(ev.status);
26464
+ const \u63CF\u304F\u5B57 = \u5E45\u3067\u5207\u308B(\u5B572, 10, cellW - 8);
26465
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-status-event": i, "data-cdl-status": ev.status, children: [
26409
26466
  /* @__PURE__ */ jsxRuntime.jsx("rect", { x, y: 10, width: cellW - 2, height: stripHeight, fill: c, rx: 2 }),
26410
- /* @__PURE__ */ jsxRuntime.jsx(
26467
+ /* @__PURE__ */ jsxRuntime.jsxs(
26411
26468
  "text",
26412
26469
  {
26413
26470
  x: x + cellW / 2,
@@ -26417,7 +26474,10 @@ function StatusTimelineReadout({
26417
26474
  fill: "#ffffff",
26418
26475
  fontWeight: 600,
26419
26476
  style: { userSelect: "none" },
26420
- children: ev.status.length > 5 ? ev.status.slice(0, 4).toUpperCase() : ev.status.toUpperCase()
26477
+ children: [
26478
+ \u63CF\u304F\u5B57 !== \u5B572 ? /* @__PURE__ */ jsxRuntime.jsx("title", { children: \u5B572 }) : null,
26479
+ \u63CF\u304F\u5B57
26480
+ ]
26421
26481
  }
26422
26482
  ),
26423
26483
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -26735,6 +26795,8 @@ function UserPresenceReadout({
26735
26795
  const width = 260;
26736
26796
  const height = shown.length * rowH + (overflow > 0 ? 20 : 0) + 8;
26737
26797
  const statusColor = (s) => s === "online" ? "#22c55e" : s === "away" ? "#eab308" : "#94a3b8";
26798
+ const \u5F15\u304F = use\u5B57\u5F15();
26799
+ const \u72B6\u614B\u306E\u5B57 = (s) => s === "online" || s === "away" || s === "offline" ? \u5F15\u304F(`readout.presence.${s}`) : s;
26738
26800
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cdl-ip-item cdl-ip-readout-user-presence", "data-cdl-readout": id, children: [
26739
26801
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdl-ip-label", children: label }),
26740
26802
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -26747,7 +26809,7 @@ function UserPresenceReadout({
26747
26809
  children: [
26748
26810
  shown.map((u, i) => {
26749
26811
  const y = 4 + i * rowH;
26750
- return /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-presence-user": i, children: [
26812
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-presence-user": i, "data-cdl-presence-status": u.status, children: [
26751
26813
  /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: 12, cy: y + rowH / 2, r: 6, fill: statusColor(u.status) }),
26752
26814
  /* @__PURE__ */ jsxRuntime.jsx(
26753
26815
  "text",
@@ -26770,7 +26832,7 @@ function UserPresenceReadout({
26770
26832
  textAnchor: "end",
26771
26833
  fill: "#64748b",
26772
26834
  style: { userSelect: "none" },
26773
- children: u.status
26835
+ children: \u72B6\u614B\u306E\u5B57(u.status)
26774
26836
  }
26775
26837
  )
26776
26838
  ] }, i);
@@ -28363,6 +28425,7 @@ function CdlDiagramView({ diagram, laid: laidProp, hideHeader = false, hideMiniP
28363
28425
  if (!isInteractive) return baseStateValues;
28364
28426
  return mergeStateValues(baseStateValues, interactive.stateOverrides);
28365
28427
  }, [isInteractive, baseStateValues, interactive.stateOverrides]);
28428
+ const \u5024\u306E\u540D\u524D = react.useMemo(() => \u5024\u306E\u540D\u524D\u306E\u8868\u3092\u4F5C\u308B(diagram.inputs), [diagram.inputs]);
28366
28429
  return /* @__PURE__ */ jsxRuntime.jsxs(
28367
28430
  "div",
28368
28431
  {
@@ -28391,7 +28454,7 @@ function CdlDiagramView({ diagram, laid: laidProp, hideHeader = false, hideMiniP
28391
28454
  }
28392
28455
  ),
28393
28456
  isInteractive && interactive.panel,
28394
- /* @__PURE__ */ jsxRuntime.jsx(CdlStage, { laid, currentPhase, progress, drawProgress, stateValues, debug, compact: hideHeader, svgRef: isInteractive ? interactive.svgRef : void 0 }),
28457
+ /* @__PURE__ */ jsxRuntime.jsx(CdlStage, { laid, currentPhase, progress, drawProgress, stateValues, \u5024\u306E\u540D\u524D, debug, compact: hideHeader, svgRef: isInteractive ? interactive.svgRef : void 0 }),
28395
28458
  hideHeader && !hideMiniPhaseIndicator && currentPhase && laid.phases.length > 1 && /* @__PURE__ */ jsxRuntime.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: [
28396
28459
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
28397
28460
  laid.phases.map((p, i) => /* @__PURE__ */ jsxRuntime.jsx(