@cardenelabs/cdl 0.27.0 → 0.29.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-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';
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-CabTMeao.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-CabTMeao.cjs';
3
3
  import { JSX } from 'react';
4
4
 
5
5
  declare function effect(fn: () => void | (() => void)): () => void;
@@ -1210,6 +1210,10 @@ declare function diagram(id: string, options: {
1210
1210
  * この図をどの配色で描くか (#1553)。 詳細は `CdlDiagram.palette` の doc 参照。
1211
1211
  */
1212
1212
  palette?: string;
1213
+ /**
1214
+ * この図がどの種類か (#645)。 詳しくは `CdlDiagram.type` の説明を参照。
1215
+ */
1216
+ type?: string;
1213
1217
  }): DiagramBuilder;
1214
1218
 
1215
1219
  /**
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-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';
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-CabTMeao.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-CabTMeao.js';
3
3
  import { JSX } from 'react';
4
4
 
5
5
  declare function effect(fn: () => void | (() => void)): () => void;
@@ -1210,6 +1210,10 @@ declare function diagram(id: string, options: {
1210
1210
  * この図をどの配色で描くか (#1553)。 詳細は `CdlDiagram.palette` の doc 参照。
1211
1211
  */
1212
1212
  palette?: string;
1213
+ /**
1214
+ * この図がどの種類か (#645)。 詳しくは `CdlDiagram.type` の説明を参照。
1215
+ */
1216
+ type?: string;
1213
1217
  }): DiagramBuilder;
1214
1218
 
1215
1219
  /**
package/dist/index.js CHANGED
@@ -11484,6 +11484,8 @@ function diagram(id, options) {
11484
11484
  ...options.structuredData === "exclude" ? { structuredData: "exclude" } : {},
11485
11485
  // 配色の名前は素通しする。 空文字の遮断は `layout` が持つ (後段が必ず通るため)
11486
11486
  ...options.palette !== void 0 ? { palette: options.palette } : {},
11487
+ // 種類の名前も同じ経路で渡し、空文字の扱いを `layout` の 1 箇所に揃える
11488
+ ...options.type !== void 0 ? { type: options.type } : {},
11487
11489
  // inputs / formulas / scrollTriggers / eventBindings は空なら省略 (static diagram の JSON 形状維持)
11488
11490
  ...inputs.length > 0 ? { inputs: [...inputs] } : {},
11489
11491
  ...formulas.length > 0 ? { formulas: [...formulas] } : {},
@@ -20280,6 +20282,8 @@ function layout(diag) {
20280
20282
  // **遮断はここだけに置く**。 描画は必ず組み立てを通り、組み立て API も `er` も
20281
20283
  // 素通しにしてある。 上流にも置くと、どの入力でも通らない分岐が残る
20282
20284
  ...diag.palette ? { palette: diag.palette } : {},
20285
+ // 種類も配色と同じく空の目印を出さない。 遮断をここに揃えると手書きの図にも効く
20286
+ ...diag.type ? { type: diag.type } : {},
20283
20287
  bboxes,
20284
20288
  collisions,
20285
20289
  nearCollisions,
@@ -29699,6 +29703,7 @@ function CdlStage({
29699
29703
  "data-cdl-stage": "",
29700
29704
  "data-cdl-scale": diagramScale === 1 ? void 0 : diagramScale,
29701
29705
  "data-cdl-palette": laid.palette,
29706
+ "data-cdl-type": laid.type,
29702
29707
  children: [
29703
29708
  /* @__PURE__ */ jsxs("defs", { children: [
29704
29709
  Object.entries(TONE).flatMap(
@@ -30368,7 +30373,7 @@ function fitRowsWidth(boxW, rows) {
30368
30373
  }
30369
30374
  function swimlane(preset) {
30370
30375
  const w = preset.laneWidth ?? 400;
30371
- const b = diagram(preset.id, { topic: preset.topic });
30376
+ const b = diagram(preset.id, { topic: preset.topic, type: "swimlane" });
30372
30377
  const labelToId = /* @__PURE__ */ new Map();
30373
30378
  const idsInOrder = [];
30374
30379
  for (const label of preset.lanes) {
@@ -30388,7 +30393,7 @@ function swimlane(preset) {
30388
30393
  }
30389
30394
  function flow(preset) {
30390
30395
  const w = preset.laneWidth ?? 400;
30391
- const b = diagram(preset.id, { topic: preset.topic });
30396
+ const b = diagram(preset.id, { topic: preset.topic, type: "flow" });
30392
30397
  b.lane("flow", { width: w, ...preset.laneLabel ? { label: preset.laneLabel } : {} });
30393
30398
  const tone = preset.defaultTone ?? "accent";
30394
30399
  const style = preset.defaultStyle ?? "dotted-flow";
@@ -30449,7 +30454,7 @@ var SEQUENCE_MESSAGE_LOOK = {
30449
30454
  };
30450
30455
  function sequence(preset) {
30451
30456
  const tone = preset.defaultTone ?? "accent";
30452
- const b = diagram(preset.id, { topic: preset.topic });
30457
+ const b = diagram(preset.id, { topic: preset.topic, type: "sequence" });
30453
30458
  const \u9762\u3005 = preset.actors.map(
30454
30459
  (a) => typeof a === "string" ? { name: a } : { name: a.name, ...a.subtitle ? { subtitle: a.subtitle } : {} }
30455
30460
  );
@@ -30504,7 +30509,7 @@ function topology(preset) {
30504
30509
  const groupW = preset.groupWidth ?? 460;
30505
30510
  const tone = preset.defaultTone ?? "accent";
30506
30511
  const style = preset.defaultStyle ?? "solid";
30507
- const b = diagram(preset.id, { topic: preset.topic });
30512
+ const b = diagram(preset.id, { topic: preset.topic, type: "topology" });
30508
30513
  const groupOrder = [];
30509
30514
  const groupStackCount = /* @__PURE__ */ new Map();
30510
30515
  const phaseActivate = [];
@@ -30573,7 +30578,7 @@ function er(preset) {
30573
30578
  const entityW = resolveStorageBoxW(preset.entityWidth, "er", "entityWidth");
30574
30579
  const tone = preset.defaultTone ?? "info";
30575
30580
  const \u7E1E\u3092\u6577\u304F = preset.rowStripe ?? true;
30576
- const b = diagram(preset.id, { topic: preset.topic, palette: preset.palette });
30581
+ const b = diagram(preset.id, { topic: preset.topic, palette: preset.palette, type: "er" });
30577
30582
  const entities = [];
30578
30583
  const phaseActivate = [];
30579
30584
  let relIdx = 0;
@@ -30659,7 +30664,7 @@ var FSM_ACTION_MARK = {
30659
30664
  function stateMachine(preset) {
30660
30665
  const stateW = resolveStateW(preset.stateWidth, "stateMachine");
30661
30666
  const tone = preset.defaultTone ?? "accent";
30662
- const b = diagram(preset.id, { topic: preset.topic });
30667
+ const b = diagram(preset.id, { topic: preset.topic, type: "state" });
30663
30668
  const phaseActivate = [];
30664
30669
  const stateOrder = /* @__PURE__ */ new Map();
30665
30670
  const \u72B6\u614B = [];
@@ -30771,7 +30776,7 @@ function infrastructure(preset) {
30771
30776
  const laneW = preset.laneWidth ?? 380;
30772
30777
  const tone = preset.defaultTone ?? "accent";
30773
30778
  const style = preset.defaultStyle ?? "solid";
30774
- const b = diagram(preset.id, { topic: preset.topic });
30779
+ const b = diagram(preset.id, { topic: preset.topic, type: "infrastructure" });
30775
30780
  const colLaneIds = /* @__PURE__ */ new Map();
30776
30781
  const phaseActivate = [];
30777
30782
  let connIdx = 0;
@@ -30830,6 +30835,14 @@ var CLASS_RELATION_LOOK = {
30830
30835
  associates: { head: "open", fill: "solid", tailHead: "none", tailFill: "solid", style: "solid" },
30831
30836
  uses: { head: "open", fill: "solid", tailHead: "none", tailFill: "solid", style: "dashed" }
30832
30837
  };
30838
+ var CLASS_RELATION_TONE = {
30839
+ extends: "accent",
30840
+ implements: "accent",
30841
+ aggregates: "teal",
30842
+ composes: "teal",
30843
+ associates: "success",
30844
+ uses: "success"
30845
+ };
30833
30846
  Object.fromEntries(
30834
30847
  Object.entries(CLASS_RELATION_LOOK).map(([k, v]) => [k, v.head])
30835
30848
  );
@@ -30842,9 +30855,9 @@ function stripAccess(row) {
30842
30855
  }
30843
30856
  function classDiagram(preset) {
30844
30857
  const classW = resolveStorageBoxW(preset.classWidth, "classDiagram", "classWidth");
30845
- const tone = preset.defaultTone ?? "info";
30858
+ const \u56F3\u306E\u65E2\u5B9A = preset.defaultTone;
30846
30859
  const \u7E1E\u3092\u6577\u304F = preset.rowStripe ?? true;
30847
- const b = diagram(preset.id, { topic: preset.topic, palette: preset.palette });
30860
+ const b = diagram(preset.id, { topic: preset.topic, palette: preset.palette, type: "class" });
30848
30861
  const classes = [];
30849
30862
  const phaseActivate = [];
30850
30863
  const \u7BB1 = [];
@@ -30906,7 +30919,7 @@ function classDiagram(preset) {
30906
30919
  id: edgeId,
30907
30920
  label: r.label ?? r.type,
30908
30921
  ...r.cardinality ? { sub: r.cardinality } : {},
30909
- tone: r.tone ?? tone,
30922
+ tone: r.tone ?? \u56F3\u306E\u65E2\u5B9A ?? CLASS_RELATION_TONE[r.type],
30910
30923
  // 関係の種類から線と端の形を決める (cdl#574 / #578)。 書いた値が勝つ
30911
30924
  style: r.style ?? \u898B\u305F\u76EE.style,
30912
30925
  head: r.head ?? \u898B\u305F\u76EE.head,
@@ -30931,7 +30944,7 @@ function classDiagram(preset) {
30931
30944
  function tree(preset) {
30932
30945
  const canvasW = preset.nodeWidth ? preset.nodeWidth * 2 : 720;
30933
30946
  const canvasH = 480;
30934
- const b = diagram(preset.id, { topic: preset.topic });
30947
+ const b = diagram(preset.id, { topic: preset.topic, type: "tree" });
30935
30948
  const treeNodes = [];
30936
30949
  const api = {
30937
30950
  node(n) {
@@ -30969,7 +30982,7 @@ function tree(preset) {
30969
30982
  function userJourney(preset) {
30970
30983
  const canvasW = preset.stepWidth ? preset.stepWidth * 2 : 720;
30971
30984
  const canvasH = 480;
30972
- const b = diagram(preset.id, { topic: preset.topic });
30985
+ const b = diagram(preset.id, { topic: preset.topic, type: "journey" });
30973
30986
  const steps = [];
30974
30987
  const api = {
30975
30988
  step(s) {
@@ -31008,7 +31021,7 @@ function userJourney(preset) {
31008
31021
  function mindMap(preset) {
31009
31022
  const canvasW = preset.branchWidth ? preset.branchWidth * 2 : 720;
31010
31023
  const canvasH = 480;
31011
- const b = diagram(preset.id, { topic: preset.topic });
31024
+ const b = diagram(preset.id, { topic: preset.topic, type: "mindmap" });
31012
31025
  const branches = [];
31013
31026
  const api = {
31014
31027
  branch(br) {
@@ -31052,7 +31065,7 @@ function mindMap(preset) {
31052
31065
  function funnel(preset) {
31053
31066
  const canvasW = toGridSize(preset.stageWidth ?? 560);
31054
31067
  const canvasH = 480;
31055
- const b = diagram(preset.id, { topic: preset.topic });
31068
+ const b = diagram(preset.id, { topic: preset.topic, type: "funnel" });
31056
31069
  const stages = [];
31057
31070
  const api = {
31058
31071
  stage(s) {
@@ -31090,7 +31103,7 @@ function funnel(preset) {
31090
31103
  function quadrant(preset) {
31091
31104
  const canvasW = 640;
31092
31105
  const canvasH = 480;
31093
- const b = diagram(preset.id, { topic: preset.topic });
31106
+ const b = diagram(preset.id, { topic: preset.topic, type: "quadrant" });
31094
31107
  const items = [];
31095
31108
  const api = {
31096
31109
  item(it) {
@@ -31141,7 +31154,7 @@ function chart(preset) {
31141
31154
  const canvasH = toGridSize(
31142
31155
  preset.type === "pie" || preset.type === "gauge" || preset.type === "radial" || preset.type === "stat" || preset.type === "waffle" || preset.type === "stacked-bar" ? 320 : 360
31143
31156
  );
31144
- const b = diagram(preset.id, { topic: preset.topic });
31157
+ const b = diagram(preset.id, { topic: preset.topic, type: "chart" });
31145
31158
  const data = [];
31146
31159
  const kindMap = {
31147
31160
  line: "chart-line",
@@ -31190,7 +31203,7 @@ function gantt(preset) {
31190
31203
  const canvasW = preset.laneWidth ? preset.laneWidth * 2 : 720;
31191
31204
  const canvasH = 360;
31192
31205
  const tone = preset.defaultTone ?? "teal";
31193
- const b = diagram(preset.id, { topic: preset.topic });
31206
+ const b = diagram(preset.id, { topic: preset.topic, type: "gantt" });
31194
31207
  const tasks = [];
31195
31208
  const api = {
31196
31209
  task(t) {
@@ -31256,7 +31269,7 @@ var SHAPE_EYEBROW = {
31256
31269
  function flowchart(preset) {
31257
31270
  const laneW = preset.laneWidth ?? 380;
31258
31271
  const tone = preset.defaultTone ?? "accent";
31259
- const b = diagram(preset.id, { topic: preset.topic });
31272
+ const b = diagram(preset.id, { topic: preset.topic, type: "flowchart" });
31260
31273
  const laneToId = /* @__PURE__ */ new Map();
31261
31274
  const laneStackCount = /* @__PURE__ */ new Map();
31262
31275
  for (const label of preset.lanes) {
@@ -31317,7 +31330,7 @@ var NET_KIND_MAP = {
31317
31330
  function network(preset) {
31318
31331
  const laneW = preset.laneWidth ?? 320;
31319
31332
  const tone = preset.defaultTone ?? "info";
31320
- const b = diagram(preset.id, { topic: preset.topic });
31333
+ const b = diagram(preset.id, { topic: preset.topic, type: "network" });
31321
31334
  const colLaneIds = /* @__PURE__ */ new Map();
31322
31335
  const phaseActivate = [];
31323
31336
  let edgeIdx = 0;
@@ -31367,7 +31380,7 @@ function stateMachine2(preset) {
31367
31380
  const stateW = resolveStateW(preset.stateWidth, "stateMachine2");
31368
31381
  const laneW = boxLaneW(stateW);
31369
31382
  const tone = preset.defaultTone ?? "accent";
31370
- const b = diagram(preset.id, { topic: preset.topic });
31383
+ const b = diagram(preset.id, { topic: preset.topic, type: "state" });
31371
31384
  const stateOrder = /* @__PURE__ */ new Map();
31372
31385
  const phaseActivate = [];
31373
31386
  let transIdx = 0;