@cardenelabs/cdl 0.24.0 → 0.25.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 EdgeRole, f as EdgeHead, g as EdgeHeadFill, h as CdlState, i as CdlEventTarget, j as Computed, k as CdlDerivedValue, l as CdlScrollTrigger, L as LaidDiagram, m as CdlDiagramViewProps, n as LaidEdge, o as LaidNode, p as CdlEdge, B as BBox, R as RowMark, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-CfXUl0Yz.cjs';
2
- export { q as CdlDiagramView, r as CdlEventBinding, s as CdlEventKind, t as CdlFormula, u as CdlPhase, v as EDGE_HEADS, w as EDGE_HEAD_DEFAULT, x as EDGE_HEAD_FILLS, y as EDGE_HEAD_FILL_DEFAULT, z as EDGE_REVEALS, A as EDGE_REVEAL_DEFAULT, D as EDGE_STYLES, F as EdgeReveal, I as InteractiveHandlerMap, G as InteractiveSignalsAccessor, H as LaidLane, K as NODE_KINDS, M as ScrollProgressHandle, O as TONES, P as computeEventBindingKey, U as computeFormulaKey, V as computeInputSignalKey, W as computeScrollTriggerKey, X as computed, Y as createInteractiveSignalsAccessor, Z as createScrollProgressHandle, _ as createScrollProgressSignals, $ as hasInteractivePrimitives, a0 as sequenceBoardMetrics, a1 as sequenceStepId, a2 as signal } from './render-CfXUl0Yz.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 EdgeRole, f as EdgeHead, g as EdgeHeadFill, h as CdlState, i as CdlEventTarget, j as Computed, k as CdlDerivedValue, l as CdlScrollTrigger, L as LaidDiagram, m as CdlDiagramViewProps, n as LaidEdge, o as LaidNode, p as CdlEdge, B as BBox, R as RowMark, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-ViWKnlu1.cjs';
2
+ export { q as CdlDiagramView, r as CdlEventBinding, s as CdlEventKind, t as CdlFormula, u as CdlPhase, v as EDGE_HEADS, w as EDGE_HEAD_DEFAULT, x as EDGE_HEAD_FILLS, y as EDGE_HEAD_FILL_DEFAULT, z as EDGE_REVEALS, A as EDGE_REVEAL_DEFAULT, D as EDGE_STYLES, F as EdgeReveal, I as InteractiveHandlerMap, G as InteractiveSignalsAccessor, H as LaidLane, K as NODE_KINDS, M as ScrollProgressHandle, O as TONES, P as computeEventBindingKey, U as computeFormulaKey, V as computeInputSignalKey, W as computeScrollTriggerKey, X as computed, Y as createInteractiveSignalsAccessor, Z as createScrollProgressHandle, _ as createScrollProgressSignals, $ as hasInteractivePrimitives, a0 as sequenceBoardMetrics, a1 as sequenceStepId, a2 as signal } from './render-ViWKnlu1.cjs';
3
3
  import { JSX } from 'react';
4
4
 
5
5
  declare function effect(fn: () => void | (() => void)): () => void;
@@ -1206,6 +1206,10 @@ declare function diagram(id: string, options: {
1206
1206
  * `"exclude"` を付ける。 詳細は `CdlDiagram.structuredData` の doc 参照。
1207
1207
  */
1208
1208
  structuredData?: "extract" | "exclude";
1209
+ /**
1210
+ * この図をどの配色で描くか (#1553)。 詳細は `CdlDiagram.palette` の doc 参照。
1211
+ */
1212
+ palette?: string;
1209
1213
  }): DiagramBuilder;
1210
1214
 
1211
1215
  /**
@@ -3069,6 +3073,22 @@ type ErPreset = {
3069
3073
  * 広げるため、 狭く宣言すると宣言座標と実座標がずれる)。
3070
3074
  */
3071
3075
  entityWidth?: number;
3076
+ /**
3077
+ * 行に 1 行おきの縞を敷くか (#1553、 既定 = 敷く)。
3078
+ *
3079
+ * ER 図は小さい字が密に並ぶので、行を横に追う時の目印が無い。
3080
+ * 色を増やさずに面を 1 行おきに変えて追えるようにする。
3081
+ *
3082
+ * 設計の形 (`columns` を書いた実体) だけが対象。 `rows` を直接書いた古い形は
3083
+ * 行頭の印を持たないので敷かない。
3084
+ */
3085
+ rowStripe?: boolean;
3086
+ /**
3087
+ * この図をどの配色で描くか (#1553)。 書かない図は消費側の既定で描かれる。
3088
+ *
3089
+ * cdl は色の値を持たない。 名前を markup に出すだけで、実際の値は消費側が決める。
3090
+ */
3091
+ palette?: string;
3072
3092
  };
3073
3093
  type ErBuilder = {
3074
3094
  entity: (e: ErEntity) => ErBuilder;
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 EdgeRole, f as EdgeHead, g as EdgeHeadFill, h as CdlState, i as CdlEventTarget, j as Computed, k as CdlDerivedValue, l as CdlScrollTrigger, L as LaidDiagram, m as CdlDiagramViewProps, n as LaidEdge, o as LaidNode, p as CdlEdge, B as BBox, R as RowMark, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-CfXUl0Yz.js';
2
- export { q as CdlDiagramView, r as CdlEventBinding, s as CdlEventKind, t as CdlFormula, u as CdlPhase, v as EDGE_HEADS, w as EDGE_HEAD_DEFAULT, x as EDGE_HEAD_FILLS, y as EDGE_HEAD_FILL_DEFAULT, z as EDGE_REVEALS, A as EDGE_REVEAL_DEFAULT, D as EDGE_STYLES, F as EdgeReveal, I as InteractiveHandlerMap, G as InteractiveSignalsAccessor, H as LaidLane, K as NODE_KINDS, M as ScrollProgressHandle, O as TONES, P as computeEventBindingKey, U as computeFormulaKey, V as computeInputSignalKey, W as computeScrollTriggerKey, X as computed, Y as createInteractiveSignalsAccessor, Z as createScrollProgressHandle, _ as createScrollProgressSignals, $ as hasInteractivePrimitives, a0 as sequenceBoardMetrics, a1 as sequenceStepId, a2 as signal } from './render-CfXUl0Yz.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 EdgeRole, f as EdgeHead, g as EdgeHeadFill, h as CdlState, i as CdlEventTarget, j as Computed, k as CdlDerivedValue, l as CdlScrollTrigger, L as LaidDiagram, m as CdlDiagramViewProps, n as LaidEdge, o as LaidNode, p as CdlEdge, B as BBox, R as RowMark, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-ViWKnlu1.js';
2
+ export { q as CdlDiagramView, r as CdlEventBinding, s as CdlEventKind, t as CdlFormula, u as CdlPhase, v as EDGE_HEADS, w as EDGE_HEAD_DEFAULT, x as EDGE_HEAD_FILLS, y as EDGE_HEAD_FILL_DEFAULT, z as EDGE_REVEALS, A as EDGE_REVEAL_DEFAULT, D as EDGE_STYLES, F as EdgeReveal, I as InteractiveHandlerMap, G as InteractiveSignalsAccessor, H as LaidLane, K as NODE_KINDS, M as ScrollProgressHandle, O as TONES, P as computeEventBindingKey, U as computeFormulaKey, V as computeInputSignalKey, W as computeScrollTriggerKey, X as computed, Y as createInteractiveSignalsAccessor, Z as createScrollProgressHandle, _ as createScrollProgressSignals, $ as hasInteractivePrimitives, a0 as sequenceBoardMetrics, a1 as sequenceStepId, a2 as signal } from './render-ViWKnlu1.js';
3
3
  import { JSX } from 'react';
4
4
 
5
5
  declare function effect(fn: () => void | (() => void)): () => void;
@@ -1206,6 +1206,10 @@ declare function diagram(id: string, options: {
1206
1206
  * `"exclude"` を付ける。 詳細は `CdlDiagram.structuredData` の doc 参照。
1207
1207
  */
1208
1208
  structuredData?: "extract" | "exclude";
1209
+ /**
1210
+ * この図をどの配色で描くか (#1553)。 詳細は `CdlDiagram.palette` の doc 参照。
1211
+ */
1212
+ palette?: string;
1209
1213
  }): DiagramBuilder;
1210
1214
 
1211
1215
  /**
@@ -3069,6 +3073,22 @@ type ErPreset = {
3069
3073
  * 広げるため、 狭く宣言すると宣言座標と実座標がずれる)。
3070
3074
  */
3071
3075
  entityWidth?: number;
3076
+ /**
3077
+ * 行に 1 行おきの縞を敷くか (#1553、 既定 = 敷く)。
3078
+ *
3079
+ * ER 図は小さい字が密に並ぶので、行を横に追う時の目印が無い。
3080
+ * 色を増やさずに面を 1 行おきに変えて追えるようにする。
3081
+ *
3082
+ * 設計の形 (`columns` を書いた実体) だけが対象。 `rows` を直接書いた古い形は
3083
+ * 行頭の印を持たないので敷かない。
3084
+ */
3085
+ rowStripe?: boolean;
3086
+ /**
3087
+ * この図をどの配色で描くか (#1553)。 書かない図は消費側の既定で描かれる。
3088
+ *
3089
+ * cdl は色の値を持たない。 名前を markup に出すだけで、実際の値は消費側が決める。
3090
+ */
3091
+ palette?: string;
3072
3092
  };
3073
3093
  type ErBuilder = {
3074
3094
  entity: (e: ErEntity) => ErBuilder;
package/dist/index.js CHANGED
@@ -11482,6 +11482,8 @@ function diagram(id, options) {
11482
11482
  topic: options.topic,
11483
11483
  // 既定 (extract) は省略して JSON 形状を変えない。 exclude を明示した図だけ持たせる。
11484
11484
  ...options.structuredData === "exclude" ? { structuredData: "exclude" } : {},
11485
+ // 配色の名前は素通しする。 空文字の遮断は `layout` が持つ (後段が必ず通るため)
11486
+ ...options.palette !== void 0 ? { palette: options.palette } : {},
11485
11487
  // inputs / formulas / scrollTriggers / eventBindings は空なら省略 (static diagram の JSON 形状維持)
11486
11488
  ...inputs.length > 0 ? { inputs: [...inputs] } : {},
11487
11489
  ...formulas.length > 0 ? { formulas: [...formulas] } : {},
@@ -11792,6 +11794,12 @@ function rowBaselineY(kind, index) {
11792
11794
  if (!rendersRows(kind)) return null;
11793
11795
  return kind === "storage" ? ROW_TOP_STORAGE + index * ROW_PITCH_STORAGE : ROW_TOP_GENERIC + genericTextShift(kind) + index * ROW_PITCH_GENERIC;
11794
11796
  }
11797
+ function rowStripeBand(kind, index, shift) {
11798
+ const baseline = rowBaselineY(kind, index);
11799
+ if (baseline === null) return null;
11800
+ const pitch = ROW_PITCH_STORAGE ;
11801
+ return { y: baseline + shift - pitch / 2, h: pitch };
11802
+ }
11795
11803
  function genericTextShift(kind) {
11796
11804
  return KINDS_SHAPE_CYLINDER.has(kind ?? "") ? GENERIC_TEXT_SHIFT_CYLINDER : 0;
11797
11805
  }
@@ -20256,6 +20264,12 @@ function layout(diag) {
20256
20264
  ...diag.derived ? { derived: diag.derived } : {},
20257
20265
  // 矢印をいつ出すか (#582)。 描き手が読む欄なので、そのまま持ち越す
20258
20266
  ...diag.edgeReveal ? { edgeReveal: diag.edgeReveal } : {},
20267
+ // どの配色で描くか (#1553)。 空文字は書かなかった扱いにする = 空の目印を出すと、
20268
+ // 消費側の `[data-cdl-palette]` が配色を書いていない図にも当たる。
20269
+ //
20270
+ // **遮断はここだけに置く**。 描画は必ず組み立てを通り、組み立て API も `er` も
20271
+ // 素通しにしてある。 上流にも置くと、どの入力でも通らない分岐が残る
20272
+ ...diag.palette ? { palette: diag.palette } : {},
20259
20273
  bboxes,
20260
20274
  collisions,
20261
20275
  nearCollisions,
@@ -22807,6 +22821,25 @@ function StorageNode({
22807
22821
  strokeWidth: active ? 3 : 1.25
22808
22822
  }
22809
22823
  ),
22824
+ node.rowStripe && rows.map((_, idx) => {
22825
+ if (idx % 2 !== 0) return null;
22826
+ const \u5E2F = rowStripeBand("storage", idx, \u884C\u306E\u4E0B\u3052);
22827
+ if (!\u5E2F) return null;
22828
+ if (\u5E2F.y + \u5E2F.h > node.h) return null;
22829
+ return /* @__PURE__ */ jsx(
22830
+ "rect",
22831
+ {
22832
+ "data-cdl-role": "node-row-stripe",
22833
+ "data-cdl-row-index": idx,
22834
+ x: 1,
22835
+ y: \u5E2F.y,
22836
+ width: node.w - 2,
22837
+ height: \u5E2F.h,
22838
+ fill: "var(--cdl-row-stripe, var(--cdl-label-bg, #f3f4f6))"
22839
+ },
22840
+ `stripe-${idx}`
22841
+ );
22842
+ }),
22810
22843
  node.eyebrow && /* @__PURE__ */ jsx("text", { x: 26, y: 38, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
22811
22844
  \u5370\u3067\u5206\u3051\u308B && node.subtitle && // 呼び名は **印で分ける箱でだけ** 出す (#578)。 従来の箱は題の下に区切り線が来るので
22812
22845
  // 置き場が無い
@@ -29654,6 +29687,7 @@ function CdlStage({
29654
29687
  "aria-label": buildDiagramAltText(laid.topic, currentPhase),
29655
29688
  "data-cdl-stage": "",
29656
29689
  "data-cdl-scale": diagramScale === 1 ? void 0 : diagramScale,
29690
+ "data-cdl-palette": laid.palette,
29657
29691
  children: [
29658
29692
  /* @__PURE__ */ jsxs("defs", { children: [
29659
29693
  Object.entries(TONE).flatMap(
@@ -30527,7 +30561,8 @@ var ER_CARDINALITY_HEAD = {
30527
30561
  function er(preset) {
30528
30562
  const entityW = resolveStorageBoxW(preset.entityWidth, "er", "entityWidth");
30529
30563
  const tone = preset.defaultTone ?? "info";
30530
- const b = diagram(preset.id, { topic: preset.topic });
30564
+ const \u7E1E\u3092\u6577\u304F = preset.rowStripe ?? true;
30565
+ const b = diagram(preset.id, { topic: preset.topic, palette: preset.palette });
30531
30566
  const entities = [];
30532
30567
  const phaseActivate = [];
30533
30568
  let relIdx = 0;
@@ -30563,7 +30598,10 @@ function er(preset) {
30563
30598
  ...\u8A2D\u8A08\u306E\u5F62 ? {} : { eyebrow: "\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3" },
30564
30599
  ...\u8A2D\u8A08\u306E\u5F62 && e.subtitle ? { subtitle: e.subtitle } : {},
30565
30600
  rows,
30566
- ...\u8A2D\u8A08\u306E\u5F62 ? { rowMarks: \u5370 } : {}
30601
+ ...\u8A2D\u8A08\u306E\u5F62 ? { rowMarks: \u5370 } : {},
30602
+ // 縞は設計の形だけに敷く (#1553)。 `rows` を直接書いた古い形は行頭の印を持たず、
30603
+ // 群の区切りも線で表しているので、縞を足すと手掛かりが 3 つになる
30604
+ ...\u8A2D\u8A08\u306E\u5F62 && \u7E1E\u3092\u6577\u304F ? { rowStripe: true } : {}
30567
30605
  });
30568
30606
  entities.push(e.id);
30569
30607
  phaseActivate.push(e.id);