@cardenelabs/cdl 0.49.0 → 0.51.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/CHANGELOG.md +33 -1
- package/dist/index.cjs +135 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +136 -19
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +130 -17
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +131 -18
- package/dist/react.js.map +1 -1
- package/dist/{render-C53-PeJZ.d.cts → render-BoBEyCu-.d.cts} +7 -0
- package/dist/{render-C53-PeJZ.d.ts → render-BoBEyCu-.d.ts} +7 -0
- package/package.json +1 -1
- package/src/builder.ts +6 -0
- package/src/kinds/actor.tsx +2 -1
- package/src/kinds/event.tsx +3 -2
- package/src/kinds/function.tsx +2 -1
- package/src/kinds/generic.tsx +5 -4
- package/src/kinds/sequence-board.tsx +2 -1
- package/src/kinds/storage.tsx +4 -3
- package/src/layout/head-label.ts +136 -0
- package/src/presets.ts +4 -2
- package/src/render/edges.tsx +40 -1
- package/src/render/mono-text.ts +44 -0
- package/src/render/stage.tsx +12 -1
- package/src/types.ts +7 -0
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-
|
|
2
|
-
export { q as CdlDiagramView, r as CdlEventBinding, s as CdlEventKind, t as CdlFormula, u as CdlPhase, v as ChartPieForm, w as ChartSlopeForm, x as EDGE_HEADS, y as EDGE_HEAD_DEFAULT, z as EDGE_HEAD_FILLS, A as EDGE_HEAD_FILL_DEFAULT, D as EDGE_REVEALS, F as EDGE_REVEAL_DEFAULT, G as EDGE_STYLES, H as EdgeReveal, I as InteractiveHandlerMap, K as InteractiveSignalsAccessor, M as LaidLane, O as NODE_KINDS, P as RELATION_FOCUSES, U as RELATION_FOCUS_DEFAULT, V as RelationFocus, W as ScrollProgressHandle, X as TONES, Y as computeEventBindingKey, Z as computeFormulaKey, _ as computeInputSignalKey, $ as computeScrollTriggerKey, a0 as computed, a1 as createInteractiveSignalsAccessor, a2 as createScrollProgressHandle, a3 as createScrollProgressSignals, a4 as hasInteractivePrimitives, a5 as sequenceBoardMetrics, a6 as sequenceStepId, a7 as signal } from './render-
|
|
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-BoBEyCu-.cjs';
|
|
2
|
+
export { q as CdlDiagramView, r as CdlEventBinding, s as CdlEventKind, t as CdlFormula, u as CdlPhase, v as ChartPieForm, w as ChartSlopeForm, x as EDGE_HEADS, y as EDGE_HEAD_DEFAULT, z as EDGE_HEAD_FILLS, A as EDGE_HEAD_FILL_DEFAULT, D as EDGE_REVEALS, F as EDGE_REVEAL_DEFAULT, G as EDGE_STYLES, H as EdgeReveal, I as InteractiveHandlerMap, K as InteractiveSignalsAccessor, M as LaidLane, O as NODE_KINDS, P as RELATION_FOCUSES, U as RELATION_FOCUS_DEFAULT, V as RelationFocus, W as ScrollProgressHandle, X as TONES, Y as computeEventBindingKey, Z as computeFormulaKey, _ as computeInputSignalKey, $ as computeScrollTriggerKey, a0 as computed, a1 as createInteractiveSignalsAccessor, a2 as createScrollProgressHandle, a3 as createScrollProgressSignals, a4 as hasInteractivePrimitives, a5 as sequenceBoardMetrics, a6 as sequenceStepId, a7 as signal } from './render-BoBEyCu-.cjs';
|
|
3
3
|
import { JSX } from 'react';
|
|
4
4
|
|
|
5
5
|
declare function effect(fn: () => void | (() => void)): () => void;
|
|
@@ -1046,6 +1046,8 @@ type DiagramBuilder = {
|
|
|
1046
1046
|
guard?: string;
|
|
1047
1047
|
/** ER 関係 cardinality、 text-dsl v0.5 inline option (`cardinality: "1:N"`) を CdlEdge.cardinality へ透過 */
|
|
1048
1048
|
cardinality?: string;
|
|
1049
|
+
/** 行き先の端に添える字 (#821)。 クラス図の多重度に使う */
|
|
1050
|
+
headLabel?: string;
|
|
1049
1051
|
labelOffsetX?: number;
|
|
1050
1052
|
labelOffsetY?: number;
|
|
1051
1053
|
routing?: "default" | "back-detour";
|
|
@@ -1136,6 +1138,8 @@ type DiagramBuilder = {
|
|
|
1136
1138
|
tailHeadFill?: EdgeHeadFill;
|
|
1137
1139
|
guard?: string;
|
|
1138
1140
|
cardinality?: string;
|
|
1141
|
+
/** 行き先の端に添える字 (#821)。 クラス図の多重度に使う */
|
|
1142
|
+
headLabel?: string;
|
|
1139
1143
|
labelOffsetX?: number;
|
|
1140
1144
|
labelOffsetY?: number;
|
|
1141
1145
|
routing?: "default" | "back-detour";
|
|
@@ -3406,7 +3410,7 @@ type UmlRelation = {
|
|
|
3406
3410
|
type: ClassRelationType;
|
|
3407
3411
|
/** 関係 label (default は type 名) */
|
|
3408
3412
|
label?: string;
|
|
3409
|
-
/** 多重度 (例 "1..*" / "0..1") */
|
|
3413
|
+
/** 多重度 (例 "1..*" / "0..1")。 行き先 (`to`) の端に添える (#821) */
|
|
3410
3414
|
cardinality?: string;
|
|
3411
3415
|
tone?: Tone;
|
|
3412
3416
|
/**
|
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-
|
|
2
|
-
export { q as CdlDiagramView, r as CdlEventBinding, s as CdlEventKind, t as CdlFormula, u as CdlPhase, v as ChartPieForm, w as ChartSlopeForm, x as EDGE_HEADS, y as EDGE_HEAD_DEFAULT, z as EDGE_HEAD_FILLS, A as EDGE_HEAD_FILL_DEFAULT, D as EDGE_REVEALS, F as EDGE_REVEAL_DEFAULT, G as EDGE_STYLES, H as EdgeReveal, I as InteractiveHandlerMap, K as InteractiveSignalsAccessor, M as LaidLane, O as NODE_KINDS, P as RELATION_FOCUSES, U as RELATION_FOCUS_DEFAULT, V as RelationFocus, W as ScrollProgressHandle, X as TONES, Y as computeEventBindingKey, Z as computeFormulaKey, _ as computeInputSignalKey, $ as computeScrollTriggerKey, a0 as computed, a1 as createInteractiveSignalsAccessor, a2 as createScrollProgressHandle, a3 as createScrollProgressSignals, a4 as hasInteractivePrimitives, a5 as sequenceBoardMetrics, a6 as sequenceStepId, a7 as signal } from './render-
|
|
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-BoBEyCu-.js';
|
|
2
|
+
export { q as CdlDiagramView, r as CdlEventBinding, s as CdlEventKind, t as CdlFormula, u as CdlPhase, v as ChartPieForm, w as ChartSlopeForm, x as EDGE_HEADS, y as EDGE_HEAD_DEFAULT, z as EDGE_HEAD_FILLS, A as EDGE_HEAD_FILL_DEFAULT, D as EDGE_REVEALS, F as EDGE_REVEAL_DEFAULT, G as EDGE_STYLES, H as EdgeReveal, I as InteractiveHandlerMap, K as InteractiveSignalsAccessor, M as LaidLane, O as NODE_KINDS, P as RELATION_FOCUSES, U as RELATION_FOCUS_DEFAULT, V as RelationFocus, W as ScrollProgressHandle, X as TONES, Y as computeEventBindingKey, Z as computeFormulaKey, _ as computeInputSignalKey, $ as computeScrollTriggerKey, a0 as computed, a1 as createInteractiveSignalsAccessor, a2 as createScrollProgressHandle, a3 as createScrollProgressSignals, a4 as hasInteractivePrimitives, a5 as sequenceBoardMetrics, a6 as sequenceStepId, a7 as signal } from './render-BoBEyCu-.js';
|
|
3
3
|
import { JSX } from 'react';
|
|
4
4
|
|
|
5
5
|
declare function effect(fn: () => void | (() => void)): () => void;
|
|
@@ -1046,6 +1046,8 @@ type DiagramBuilder = {
|
|
|
1046
1046
|
guard?: string;
|
|
1047
1047
|
/** ER 関係 cardinality、 text-dsl v0.5 inline option (`cardinality: "1:N"`) を CdlEdge.cardinality へ透過 */
|
|
1048
1048
|
cardinality?: string;
|
|
1049
|
+
/** 行き先の端に添える字 (#821)。 クラス図の多重度に使う */
|
|
1050
|
+
headLabel?: string;
|
|
1049
1051
|
labelOffsetX?: number;
|
|
1050
1052
|
labelOffsetY?: number;
|
|
1051
1053
|
routing?: "default" | "back-detour";
|
|
@@ -1136,6 +1138,8 @@ type DiagramBuilder = {
|
|
|
1136
1138
|
tailHeadFill?: EdgeHeadFill;
|
|
1137
1139
|
guard?: string;
|
|
1138
1140
|
cardinality?: string;
|
|
1141
|
+
/** 行き先の端に添える字 (#821)。 クラス図の多重度に使う */
|
|
1142
|
+
headLabel?: string;
|
|
1139
1143
|
labelOffsetX?: number;
|
|
1140
1144
|
labelOffsetY?: number;
|
|
1141
1145
|
routing?: "default" | "back-detour";
|
|
@@ -3406,7 +3410,7 @@ type UmlRelation = {
|
|
|
3406
3410
|
type: ClassRelationType;
|
|
3407
3411
|
/** 関係 label (default は type 名) */
|
|
3408
3412
|
label?: string;
|
|
3409
|
-
/** 多重度 (例 "1..*" / "0..1") */
|
|
3413
|
+
/** 多重度 (例 "1..*" / "0..1")。 行き先 (`to`) の端に添える (#821) */
|
|
3410
3414
|
cardinality?: string;
|
|
3411
3415
|
tone?: Tone;
|
|
3412
3416
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useMemo, useEffect, useState, useSyncExternalStore, useRef, useCallback, useLayoutEffect, useId } from 'react';
|
|
1
|
+
import { useMemo, useEffect, useState, useSyncExternalStore, useRef, useCallback, useLayoutEffect, useId, createElement } from 'react';
|
|
2
2
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
4
|
// src/reactive/internal.ts
|
|
@@ -9499,6 +9499,7 @@ function diagram(id, options) {
|
|
|
9499
9499
|
tailHeadFill: opts.tailHeadFill,
|
|
9500
9500
|
guard: opts.guard,
|
|
9501
9501
|
cardinality: opts.cardinality,
|
|
9502
|
+
headLabel: opts.headLabel,
|
|
9502
9503
|
labelOffsetX: opts.labelOffsetX,
|
|
9503
9504
|
labelOffsetY: opts.labelOffsetY,
|
|
9504
9505
|
routing: opts.routing,
|
|
@@ -9625,6 +9626,7 @@ function diagram(id, options) {
|
|
|
9625
9626
|
tailHeadFill: d.tailHeadFill,
|
|
9626
9627
|
guard: d.guard,
|
|
9627
9628
|
cardinality: d.cardinality,
|
|
9629
|
+
headLabel: d.headLabel,
|
|
9628
9630
|
labelOffsetX: d.labelOffsetX,
|
|
9629
9631
|
labelOffsetY: d.labelOffsetY,
|
|
9630
9632
|
routing: d.routing,
|
|
@@ -14103,10 +14105,10 @@ function \u66F8\u8A18\u7D20\u306B\u5206\u3051\u308B(text) {
|
|
|
14103
14105
|
if (typeof \u533A\u5207\u308A !== "function") return [...text];
|
|
14104
14106
|
return [...new \u533A\u5207\u308A(void 0, { granularity: "grapheme" }).segment(text)].map((g) => g.segment);
|
|
14105
14107
|
}
|
|
14106
|
-
function \u7BB1\u306B\u7A4D\u3080(\u884C, \u7BB1\u306E\u5E45, \u7BB1\u306E\u9AD8\
|
|
14108
|
+
function \u7BB1\u306B\u7A4D\u3080(\u884C, \u7BB1\u306E\u5E45, \u7BB1\u306E\u9AD8\u30553) {
|
|
14107
14109
|
const \u5019\u88DC = \u884C.filter((r, i) => i === 0 || r.text.trim() !== "");
|
|
14108
14110
|
if (\u5019\u88DC.length === 0) return [];
|
|
14109
|
-
const \u4F7F\u3048\u308B\u9AD8\u3055 = \u7BB1\u306E\u9AD8\
|
|
14111
|
+
const \u4F7F\u3048\u308B\u9AD8\u3055 = \u7BB1\u306E\u9AD8\u30553 - \u4E0A\u4E0B\u306E\u4F59\u767D * 2;
|
|
14110
14112
|
const \u9AD8\u3055 = (rs) => rs.reduce((a, r) => a + r.fontSize * \u884C\u9001\u308A\u306E\u6BD4, 0);
|
|
14111
14113
|
const \u6B8B\u3059 = [...\u5019\u88DC];
|
|
14112
14114
|
while (\u6B8B\u3059.length > 1 && \u9AD8\u3055(\u6B8B\u3059) > \u4F7F\u3048\u308B\u9AD8\u3055) \u6B8B\u3059.pop();
|
|
@@ -14833,7 +14835,7 @@ function \u30D9\u30B8\u30A8\u306E\u7D2F\u7A4D\u5272\u5408(\u70B9, \u5236\u5FA1\u
|
|
|
14833
14835
|
function \u7BB1\u306E\u6587\u5B57({
|
|
14834
14836
|
\u884C,
|
|
14835
14837
|
x,
|
|
14836
|
-
\u7BB1\u306E\u9AD8\u3055: \u7BB1\u306E\u9AD8\
|
|
14838
|
+
\u7BB1\u306E\u9AD8\u3055: \u7BB1\u306E\u9AD8\u30553,
|
|
14837
14839
|
fill,
|
|
14838
14840
|
\u540D\u524D\u306E\u592A\u3055
|
|
14839
14841
|
}) {
|
|
@@ -14842,7 +14844,7 @@ function \u7BB1\u306E\u6587\u5B57({
|
|
|
14842
14844
|
{
|
|
14843
14845
|
"data-cdl-role": r.\u5F79\u5272 === "subtitle" ? "tree-node-subtitle" : void 0,
|
|
14844
14846
|
x,
|
|
14845
|
-
y: \u7BB1\u306E\u9AD8\
|
|
14847
|
+
y: \u7BB1\u306E\u9AD8\u30553 / 2 + r.dy,
|
|
14846
14848
|
fontSize: r.fontSize,
|
|
14847
14849
|
fontWeight: r.\u5F79\u5272 === "title" ? \u540D\u524D\u306E\u592A\u3055 : 500,
|
|
14848
14850
|
textAnchor: "middle",
|
|
@@ -22918,6 +22920,84 @@ function edgeHeadPaint(head, fill, color) {
|
|
|
22918
22920
|
}
|
|
22919
22921
|
return { fill: color, stroke: "none" };
|
|
22920
22922
|
}
|
|
22923
|
+
var \u89D2\u62EC\u5F27\u306E\u9699\u9593 = 0.08;
|
|
22924
|
+
function \u7B49\u5E45\u306E\u5B57(text, fontSize) {
|
|
22925
|
+
if (typeof text !== "string" || !text.includes("[]")) return text;
|
|
22926
|
+
const \u584A = text.split("[]");
|
|
22927
|
+
const out = [];
|
|
22928
|
+
\u584A.forEach((s, i) => {
|
|
22929
|
+
if (i > 0) out.push("[", createElement("tspan", { key: i, dx: fontSize * \u89D2\u62EC\u5F27\u306E\u9699\u9593 }, "]"));
|
|
22930
|
+
if (s !== "") out.push(s);
|
|
22931
|
+
});
|
|
22932
|
+
return out;
|
|
22933
|
+
}
|
|
22934
|
+
|
|
22935
|
+
// src/layout/head-label.ts
|
|
22936
|
+
var \u7AEF\u306E\u5B57\u3092\u623B\u3059\u8DDD\u96E2 = 22;
|
|
22937
|
+
var \u7AEF\u306E\u5B57\u3068\u7DDA\u306E\u9699\u9593 = 8;
|
|
22938
|
+
var \u7AEF\u306E\u5B57\u306E\u5927\u304D\u3055 = EDGE_LABEL_TEXT.sub.fontSize;
|
|
22939
|
+
var \u7BB1\u306E\u9AD8\u30552 = Math.round(\u7AEF\u306E\u5B57\u306E\u5927\u304D\u3055 * 1.2);
|
|
22940
|
+
var BASELINE_RATIO = 0.8;
|
|
22941
|
+
function \u6700\u5F8C\u306E\u5411\u304D(d) {
|
|
22942
|
+
const segs = extractPathSegments(d);
|
|
22943
|
+
const last = segs[segs.length - 1];
|
|
22944
|
+
if (!last) return null;
|
|
22945
|
+
const end = { x: last.x2, y: last.y2 };
|
|
22946
|
+
for (let i = segs.length - 1; i >= 0; i--) {
|
|
22947
|
+
const s = segs[i];
|
|
22948
|
+
const \u5236\u5FA1\u70B9 = s.cmd === "Q" ? s.ctrl?.[0] : s.cmd === "C" ? s.ctrl?.[1] : void 0;
|
|
22949
|
+
for (const p of [\u5236\u5FA1\u70B9, { x: s.x1, y: s.y1 }]) {
|
|
22950
|
+
if (!p) continue;
|
|
22951
|
+
const dx = end.x - p.x;
|
|
22952
|
+
const dy = end.y - p.y;
|
|
22953
|
+
const len = Math.hypot(dx, dy);
|
|
22954
|
+
if (len > 1e-6) return { end, ux: dx / len, uy: dy / len };
|
|
22955
|
+
}
|
|
22956
|
+
}
|
|
22957
|
+
return null;
|
|
22958
|
+
}
|
|
22959
|
+
function \u7AEF\u306E\u5B57\u3092\u7F6E\u304F(edge) {
|
|
22960
|
+
const text = edge.headLabel?.trim();
|
|
22961
|
+
if (!text) return null;
|
|
22962
|
+
const \u5411\u304D = \u6700\u5F8C\u306E\u5411\u304D(edge.d);
|
|
22963
|
+
if (!\u5411\u304D) return null;
|
|
22964
|
+
const { end, ux, uy } = \u5411\u304D;
|
|
22965
|
+
const bx = end.x - ux * \u7AEF\u306E\u5B57\u3092\u623B\u3059\u8DDD\u96E2;
|
|
22966
|
+
const by = end.y - uy * \u7AEF\u306E\u5B57\u3092\u623B\u3059\u8DDD\u96E2;
|
|
22967
|
+
const w = measureTextWidth(text, {
|
|
22968
|
+
fontSize: \u7AEF\u306E\u5B57\u306E\u5927\u304D\u3055,
|
|
22969
|
+
fontWeight: EDGE_LABEL_TEXT.sub.fontWeight,
|
|
22970
|
+
fontFamily: "mono"
|
|
22971
|
+
});
|
|
22972
|
+
const h = \u7BB1\u306E\u9AD8\u30552;
|
|
22973
|
+
const \u672D = hasRenderedLabel(edge) && edge.labelX !== void 0 && edge.labelY !== void 0 ? { x: edge.labelX, y: edge.labelY } : null;
|
|
22974
|
+
let anchor;
|
|
22975
|
+
let box;
|
|
22976
|
+
if (Math.abs(ux) >= Math.abs(uy)) {
|
|
22977
|
+
const \u53F3\u3078\u9032\u3080 = ux > 0;
|
|
22978
|
+
const \u4E0A\u306B\u7F6E\u304F = \u672D !== null && \u672D.y > by;
|
|
22979
|
+
anchor = \u53F3\u3078\u9032\u3080 ? "end" : "start";
|
|
22980
|
+
box = {
|
|
22981
|
+
x: \u53F3\u3078\u9032\u3080 ? bx - w : bx,
|
|
22982
|
+
y: \u4E0A\u306B\u7F6E\u304F ? by - \u7AEF\u306E\u5B57\u3068\u7DDA\u306E\u9699\u9593 - h : by + \u7AEF\u306E\u5B57\u3068\u7DDA\u306E\u9699\u9593,
|
|
22983
|
+
w,
|
|
22984
|
+
h
|
|
22985
|
+
};
|
|
22986
|
+
} else {
|
|
22987
|
+
const \u4E0B\u3078\u9032\u3080 = uy > 0;
|
|
22988
|
+
const \u53F3\u306B\u7F6E\u304F = \u672D !== null && \u672D.x < bx;
|
|
22989
|
+
anchor = \u53F3\u306B\u7F6E\u304F ? "start" : "end";
|
|
22990
|
+
box = {
|
|
22991
|
+
x: \u53F3\u306B\u7F6E\u304F ? bx + \u7AEF\u306E\u5B57\u3068\u7DDA\u306E\u9699\u9593 : bx - \u7AEF\u306E\u5B57\u3068\u7DDA\u306E\u9699\u9593 - w,
|
|
22992
|
+
y: \u4E0B\u3078\u9032\u3080 ? by - h : by,
|
|
22993
|
+
w,
|
|
22994
|
+
h
|
|
22995
|
+
};
|
|
22996
|
+
}
|
|
22997
|
+
const x = anchor === "start" ? box.x : box.x + box.w;
|
|
22998
|
+
const y = box.y + (h - \u7AEF\u306E\u5B57\u306E\u5927\u304D\u3055) / 2 + \u7AEF\u306E\u5B57\u306E\u5927\u304D\u3055 * BASELINE_RATIO;
|
|
22999
|
+
return { x, y, anchor, box };
|
|
23000
|
+
}
|
|
22921
23001
|
function defaultEdgeWidth(active) {
|
|
22922
23002
|
return active ? 2.5 : 1.25;
|
|
22923
23003
|
}
|
|
@@ -23173,13 +23253,40 @@ function CdlEdgeLabelView({
|
|
|
23173
23253
|
fill: active ? color : "var(--cdl-text-dim, #5a6270)",
|
|
23174
23254
|
opacity: labelTextOpacity("sub"),
|
|
23175
23255
|
style: { fontFamily: fontFamilyAttr("sub") },
|
|
23176
|
-
children: edge.sub
|
|
23256
|
+
children: \u7B49\u5E45\u306E\u5B57(edge.sub, EDGE_LABEL_TEXT.sub.fontSize)
|
|
23177
23257
|
}
|
|
23178
23258
|
)
|
|
23179
23259
|
]
|
|
23180
23260
|
}
|
|
23181
23261
|
);
|
|
23182
23262
|
}
|
|
23263
|
+
function CdlEdgeHeadLabelView({
|
|
23264
|
+
edge,
|
|
23265
|
+
active
|
|
23266
|
+
}) {
|
|
23267
|
+
const \u7F6E\u304D\u5834\u6240 = \u7AEF\u306E\u5B57\u3092\u7F6E\u304F(edge);
|
|
23268
|
+
if (!\u7F6E\u304D\u5834\u6240) return null;
|
|
23269
|
+
const color = edgeColor(edge);
|
|
23270
|
+
return /* @__PURE__ */ jsx(
|
|
23271
|
+
"text",
|
|
23272
|
+
{
|
|
23273
|
+
"data-cdl-role": "edge-end-label",
|
|
23274
|
+
"data-cdl-edge-end-label-for": edge.id,
|
|
23275
|
+
x: \u7F6E\u304D\u5834\u6240.x,
|
|
23276
|
+
y: \u7F6E\u304D\u5834\u6240.y,
|
|
23277
|
+
fontSize: \u7AEF\u306E\u5B57\u306E\u5927\u304D\u3055,
|
|
23278
|
+
fontWeight: EDGE_LABEL_TEXT.sub.fontWeight,
|
|
23279
|
+
textAnchor: \u7F6E\u304D\u5834\u6240.anchor,
|
|
23280
|
+
fill: active ? color : "var(--cdl-text-dim, #5a6270)",
|
|
23281
|
+
stroke: "var(--cdl-label-bg, #ffffff)",
|
|
23282
|
+
strokeWidth: 4,
|
|
23283
|
+
strokeLinejoin: "round",
|
|
23284
|
+
paintOrder: "stroke",
|
|
23285
|
+
style: { fontFamily: fontFamilyAttr("sub") },
|
|
23286
|
+
children: \u7B49\u5E45\u306E\u5B57(edge.headLabel, \u7AEF\u306E\u5B57\u306E\u5927\u304D\u3055)
|
|
23287
|
+
}
|
|
23288
|
+
);
|
|
23289
|
+
}
|
|
23183
23290
|
|
|
23184
23291
|
// src/kinds/node-tone.ts
|
|
23185
23292
|
function nodeAccent(node, fallback) {
|
|
@@ -23253,7 +23360,7 @@ function ActorNode({ node, active, value }) {
|
|
|
23253
23360
|
textAnchor: "end",
|
|
23254
23361
|
fill: "var(--cdl-text, #1a1f2a)",
|
|
23255
23362
|
style: { fontFamily: "'JetBrains Mono', monospace" },
|
|
23256
|
-
children: value
|
|
23363
|
+
children: \u7B49\u5E45\u306E\u5B57(value, 42)
|
|
23257
23364
|
}
|
|
23258
23365
|
)
|
|
23259
23366
|
] });
|
|
@@ -23429,7 +23536,7 @@ function SequenceBoardNode({
|
|
|
23429
23536
|
textAnchor: "middle",
|
|
23430
23537
|
fill: "var(--cdl-text, #1a1f2a)",
|
|
23431
23538
|
style: { fontFamily: "'JetBrains Mono', monospace" },
|
|
23432
|
-
children: a.name
|
|
23539
|
+
children: \u7B49\u5E45\u306E\u5B57(a.name, SEQ_NAME)
|
|
23433
23540
|
}
|
|
23434
23541
|
),
|
|
23435
23542
|
a.subtitle && /* @__PURE__ */ jsx(
|
|
@@ -23619,7 +23726,7 @@ function EventNode({
|
|
|
23619
23726
|
fill: "var(--cdl-text, #1a1f2a)",
|
|
23620
23727
|
textAnchor: \u540D\u524D.anchor,
|
|
23621
23728
|
style: { fontFamily: "'JetBrains Mono', monospace" },
|
|
23622
|
-
children: node.title
|
|
23729
|
+
children: \u7B49\u5E45\u306E\u5B57(node.title, \u540D\u524D.size)
|
|
23623
23730
|
}
|
|
23624
23731
|
),
|
|
23625
23732
|
node.subtitle && /* @__PURE__ */ jsx(
|
|
@@ -23630,7 +23737,7 @@ function EventNode({
|
|
|
23630
23737
|
fontSize: 21,
|
|
23631
23738
|
fill: "var(--cdl-text-dim, #5a6270)",
|
|
23632
23739
|
style: { fontFamily: "'JetBrains Mono', monospace" },
|
|
23633
|
-
children: node.subtitle
|
|
23740
|
+
children: \u7B49\u5E45\u306E\u5B57(node.subtitle, 21)
|
|
23634
23741
|
}
|
|
23635
23742
|
)
|
|
23636
23743
|
] })
|
|
@@ -23679,7 +23786,7 @@ function FunctionNode({ node, active }) {
|
|
|
23679
23786
|
fill: "var(--cdl-text, #1a1f2a)",
|
|
23680
23787
|
textAnchor: \u540D\u524D.anchor,
|
|
23681
23788
|
style: { fontFamily: "'JetBrains Mono', monospace" },
|
|
23682
|
-
children: node.title
|
|
23789
|
+
children: \u7B49\u5E45\u306E\u5B57(node.title, \u540D\u524D.size)
|
|
23683
23790
|
}
|
|
23684
23791
|
),
|
|
23685
23792
|
node.subtitle && /* @__PURE__ */ jsx("text", { x: 26, y: 126 - \u305A\u3089\u3057, fontSize: 20, fill: "var(--cdl-text-dim, #5a6270)", children: node.subtitle })
|
|
@@ -23792,7 +23899,7 @@ function StorageNode({
|
|
|
23792
23899
|
fill: "var(--cdl-text, #1a1f2a)",
|
|
23793
23900
|
textAnchor: \u540D\u524D.anchor,
|
|
23794
23901
|
style: { fontFamily: "'JetBrains Mono', monospace" },
|
|
23795
|
-
children: node.title
|
|
23902
|
+
children: \u7B49\u5E45\u306E\u5B57(node.title, \u540D\u524D.size)
|
|
23796
23903
|
}
|
|
23797
23904
|
),
|
|
23798
23905
|
rows.length > 0 && !\u5370\u3067\u5206\u3051\u308B && /* @__PURE__ */ jsx(
|
|
@@ -23853,7 +23960,7 @@ function StorageNode({
|
|
|
23853
23960
|
fontWeight: \u5370\u3067\u5206\u3051\u308B ? 500 : 600,
|
|
23854
23961
|
fill: "var(--cdl-text, #1a1f2a)",
|
|
23855
23962
|
style: { fontFamily: "'JetBrains Mono', monospace" },
|
|
23856
|
-
children: s.left
|
|
23963
|
+
children: \u7B49\u5E45\u306E\u5B57(s.left, 26)
|
|
23857
23964
|
}
|
|
23858
23965
|
),
|
|
23859
23966
|
/* @__PURE__ */ jsx(
|
|
@@ -23867,7 +23974,7 @@ function StorageNode({
|
|
|
23867
23974
|
textAnchor: \u5370\u3067\u5206\u3051\u308B ? "end" : "start",
|
|
23868
23975
|
fill: \u5370\u3067\u5206\u3051\u308B ? "var(--cdl-text-dim, #5a6270)" : highlightRows ? accent : "var(--cdl-text, #1a1f2a)",
|
|
23869
23976
|
style: { fontFamily: "'JetBrains Mono', monospace" },
|
|
23870
|
-
children: s.right
|
|
23977
|
+
children: \u7B49\u5E45\u306E\u5B57(s.right, \u5370\u3067\u5206\u3051\u308B ? ROW_TYPE_FONT : 26)
|
|
23871
23978
|
}
|
|
23872
23979
|
)
|
|
23873
23980
|
] }, idx);
|
|
@@ -24141,8 +24248,8 @@ function GenericNode({
|
|
|
24141
24248
|
/* @__PURE__ */ jsx("path", { d: style.icon, fill: style.eyebrowColor, opacity: 0.7, transform: "scale(1)" })
|
|
24142
24249
|
] }),
|
|
24143
24250
|
node.eyebrow && /* @__PURE__ */ jsx("text", { x: textX, y: eyebrowY, fontSize: 17, fontWeight: 700, letterSpacing: 1.5, fill: paint.onSolid ? "var(--cdl-node-fill, #ffffff)" : style.eyebrowColor, textAnchor, dominantBaseline, children: node.eyebrow }),
|
|
24144
|
-
/* @__PURE__ */ jsx("text", { "data-cdl-role": "node-label", x: textX, y: titleY, fontSize: 20, fontWeight: 700, fill: paint.onSolid ? "var(--cdl-node-fill, #ffffff)" : "var(--cdl-text, #1a1f2a)", textAnchor, dominantBaseline, style: node.kind === "function" || node.kind === "api" ? { fontFamily: "'JetBrains Mono', monospace" } : void 0, children: node.title }),
|
|
24145
|
-
node.subtitle && /* @__PURE__ */ jsx("text", { x: textX, y: subtitleY, fontSize: 17, fill: paint.onSolid ? "var(--cdl-node-fill, #ffffff)" : "var(--cdl-text-dim, #5a6270)", textAnchor, dominantBaseline, style: { fontFamily: "'JetBrains Mono', monospace" }, children: node.subtitle }),
|
|
24251
|
+
/* @__PURE__ */ jsx("text", { "data-cdl-role": "node-label", x: textX, y: titleY, fontSize: 20, fontWeight: 700, fill: paint.onSolid ? "var(--cdl-node-fill, #ffffff)" : "var(--cdl-text, #1a1f2a)", textAnchor, dominantBaseline, style: node.kind === "function" || node.kind === "api" ? { fontFamily: "'JetBrains Mono', monospace" } : void 0, children: node.kind === "function" || node.kind === "api" ? \u7B49\u5E45\u306E\u5B57(node.title, 20) : node.title }),
|
|
24252
|
+
node.subtitle && /* @__PURE__ */ jsx("text", { x: textX, y: subtitleY, fontSize: 17, fill: paint.onSolid ? "var(--cdl-node-fill, #ffffff)" : "var(--cdl-text-dim, #5a6270)", textAnchor, dominantBaseline, style: { fontFamily: "'JetBrains Mono', monospace" }, children: \u7B49\u5E45\u306E\u5B57(node.subtitle, 17) }),
|
|
24146
24253
|
resolvedValue && /* @__PURE__ */ jsx(
|
|
24147
24254
|
"text",
|
|
24148
24255
|
{
|
|
@@ -24153,7 +24260,7 @@ function GenericNode({
|
|
|
24153
24260
|
textAnchor: "end",
|
|
24154
24261
|
fill: "var(--cdl-text, #1a1f2a)",
|
|
24155
24262
|
style: { fontFamily: "'JetBrains Mono', monospace" },
|
|
24156
|
-
children: resolvedValue
|
|
24263
|
+
children: \u7B49\u5E45\u306E\u5B57(resolvedValue, 32)
|
|
24157
24264
|
}
|
|
24158
24265
|
),
|
|
24159
24266
|
node.rows && node.rows.length > 0 && (() => {
|
|
@@ -24178,7 +24285,7 @@ function GenericNode({
|
|
|
24178
24285
|
textAnchor: "start",
|
|
24179
24286
|
fill: "var(--cdl-text, #1a1f2a)",
|
|
24180
24287
|
style: { fontFamily: "'JetBrains Mono', monospace" },
|
|
24181
|
-
children: s.right
|
|
24288
|
+
children: \u7B49\u5E45\u306E\u5B57(s.right, 21)
|
|
24182
24289
|
}
|
|
24183
24290
|
)
|
|
24184
24291
|
] }, i)) });
|
|
@@ -31464,6 +31571,14 @@ function CdlStage({
|
|
|
31464
31571
|
},
|
|
31465
31572
|
`label-${edge.id}`
|
|
31466
31573
|
)),
|
|
31574
|
+
laid.edges.filter((edge) => edge.headLabel && \u77E2\u5370\u306E\u51FA\u756A.\u51FA\u308B\u304B(edge.id)).map((edge) => /* @__PURE__ */ jsx(
|
|
31575
|
+
CdlEdgeHeadLabelView,
|
|
31576
|
+
{
|
|
31577
|
+
edge,
|
|
31578
|
+
active: activeSet.has(edge.id)
|
|
31579
|
+
},
|
|
31580
|
+
`head-label-${edge.id}`
|
|
31581
|
+
)),
|
|
31467
31582
|
debug && /* @__PURE__ */ jsxs("g", { pointerEvents: "none", children: [
|
|
31468
31583
|
laid.bboxes.map((bbox, idx) => {
|
|
31469
31584
|
const color = bbox.kind === "node" ? "#3b82f6" : bbox.kind === "lane-label" ? "#a855f7" : bbox.kind === "edge-label" ? "#10b981" : "#f59e0b";
|
|
@@ -32508,7 +32623,9 @@ function classDiagram(preset) {
|
|
|
32508
32623
|
b.edge(r.from, r.to, {
|
|
32509
32624
|
id: edgeId,
|
|
32510
32625
|
label: r.label ?? r.type,
|
|
32511
|
-
|
|
32626
|
+
// 多重度は行き先の端に添える (#821)。 札の下の行に入れると語と続けて読まれ
|
|
32627
|
+
// (英字の頃は「HAS 1..*」 が「HAS1」)、 どちらの端の数かも読めない
|
|
32628
|
+
...r.cardinality ? { headLabel: r.cardinality } : {},
|
|
32512
32629
|
tone: r.tone ?? \u56F3\u306E\u65E2\u5B9A ?? CLASS_RELATION_TONE[r.type],
|
|
32513
32630
|
// 関係の種類から線と端の形を決める (cdl#574 / #578)。 書いた値が勝つ
|
|
32514
32631
|
style: r.style ?? \u898B\u305F\u76EE.style,
|