@edv4h/usketch-plugin-domain-design 0.2.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/LICENSE +21 -0
- package/README.md +53 -0
- package/dist/connectors/connector-shape.d.ts +14 -0
- package/dist/connectors/connector-shape.d.ts.map +1 -0
- package/dist/connectors/connector-shape.js +47 -0
- package/dist/connectors/connector-shape.js.map +1 -0
- package/dist/connectors/draw-tool.d.ts +25 -0
- package/dist/connectors/draw-tool.d.ts.map +1 -0
- package/dist/connectors/draw-tool.js +119 -0
- package/dist/connectors/draw-tool.js.map +1 -0
- package/dist/connectors/render-domain-connector.d.ts +3 -0
- package/dist/connectors/render-domain-connector.d.ts.map +1 -0
- package/dist/connectors/render-domain-connector.js +156 -0
- package/dist/connectors/render-domain-connector.js.map +1 -0
- package/dist/editor/editing-machine.d.ts +25 -0
- package/dist/editor/editing-machine.d.ts.map +1 -0
- package/dist/editor/editing-machine.js +220 -0
- package/dist/editor/editing-machine.js.map +1 -0
- package/dist/editor/editors.d.ts +25 -0
- package/dist/editor/editors.d.ts.map +1 -0
- package/dist/editor/editors.js +185 -0
- package/dist/editor/editors.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.d.ts +3 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +275 -0
- package/dist/plugin.js.map +1 -0
- package/dist/property-bar/domain-connector-bar.d.ts +2 -0
- package/dist/property-bar/domain-connector-bar.d.ts.map +1 -0
- package/dist/property-bar/domain-connector-bar.js +207 -0
- package/dist/property-bar/domain-connector-bar.js.map +1 -0
- package/dist/registry.d.ts +41 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +122 -0
- package/dist/registry.js.map +1 -0
- package/dist/shapes/aggregate.d.ts +3 -0
- package/dist/shapes/aggregate.d.ts.map +1 -0
- package/dist/shapes/aggregate.js +48 -0
- package/dist/shapes/aggregate.js.map +1 -0
- package/dist/shapes/bounded-context.d.ts +3 -0
- package/dist/shapes/bounded-context.d.ts.map +1 -0
- package/dist/shapes/bounded-context.js +60 -0
- package/dist/shapes/bounded-context.js.map +1 -0
- package/dist/shapes/class-box.d.ts +3 -0
- package/dist/shapes/class-box.d.ts.map +1 -0
- package/dist/shapes/class-box.js +65 -0
- package/dist/shapes/class-box.js.map +1 -0
- package/dist/types.d.ts +64 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +17 -0
- package/dist/types.js.map +1 -0
- package/package.json +55 -0
package/dist/registry.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DEFAULT_STYLE } from "@edv4h/usketch-shared";
|
|
3
|
+
import { DOMAIN_TYPES, } from "./types.js";
|
|
4
|
+
// ── アイコン ──
|
|
5
|
+
function BoundedContextIcon() {
|
|
6
|
+
return (_jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", children: _jsx("rect", { x: "1.5", y: "3", width: "13", height: "10", rx: "1", fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeDasharray: "2 1.5" }) }));
|
|
7
|
+
}
|
|
8
|
+
function AggregateIcon() {
|
|
9
|
+
return (_jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", children: _jsx("ellipse", { cx: "8", cy: "8", rx: "6.5", ry: "5", fill: "none", stroke: "currentColor", strokeWidth: "1.6" }) }));
|
|
10
|
+
}
|
|
11
|
+
function ClassBoxIcon() {
|
|
12
|
+
return (_jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", children: [_jsx("rect", { x: "2", y: "2", width: "12", height: "12", fill: "none", stroke: "currentColor", strokeWidth: "1.2" }), _jsx("line", { x1: "2", y1: "6", x2: "14", y2: "6", stroke: "currentColor", strokeWidth: "1" }), _jsx("line", { x1: "2", y1: "10", x2: "14", y2: "10", stroke: "currentColor", strokeWidth: "1" })] }));
|
|
13
|
+
}
|
|
14
|
+
function ContextMapIcon() {
|
|
15
|
+
return (_jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", children: [_jsx("line", { x1: "2", y1: "8", x2: "14", y2: "8", stroke: "currentColor", strokeWidth: "1.4", strokeDasharray: "2 1.5" }), _jsx("text", { x: "8", y: "6", textAnchor: "middle", fontSize: "4", fill: "currentColor", children: "U/D" })] }));
|
|
16
|
+
}
|
|
17
|
+
function TacticalRelationIcon() {
|
|
18
|
+
return (_jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", children: [_jsx("line", { x1: "2", y1: "8", x2: "12", y2: "8", stroke: "currentColor", strokeWidth: "1.4" }), _jsx("polygon", { points: "12,5 15,8 12,11", fill: "none", stroke: "currentColor", strokeWidth: "1.2" })] }));
|
|
19
|
+
}
|
|
20
|
+
// ── createDefault (shape only) ──
|
|
21
|
+
function createBoundedContext(params) {
|
|
22
|
+
return {
|
|
23
|
+
id: params.id,
|
|
24
|
+
type: DOMAIN_TYPES.boundedContext,
|
|
25
|
+
x: params.x,
|
|
26
|
+
y: params.y,
|
|
27
|
+
width: 320,
|
|
28
|
+
height: 200,
|
|
29
|
+
style: { ...DEFAULT_STYLE, fill: "#fff7ed", stroke: "#f97316", strokeWidth: 2 },
|
|
30
|
+
meta: {
|
|
31
|
+
contextName: "BoundedContext",
|
|
32
|
+
coreDomain: "supporting",
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function createAggregate(params) {
|
|
37
|
+
return {
|
|
38
|
+
id: params.id,
|
|
39
|
+
type: DOMAIN_TYPES.aggregate,
|
|
40
|
+
x: params.x,
|
|
41
|
+
y: params.y,
|
|
42
|
+
width: 200,
|
|
43
|
+
height: 140,
|
|
44
|
+
style: { ...DEFAULT_STYLE, fill: "#fefce8", stroke: "#a16207", strokeWidth: 3 },
|
|
45
|
+
meta: { rootName: "AggregateRoot" },
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function createClassBox(params) {
|
|
49
|
+
return {
|
|
50
|
+
id: params.id,
|
|
51
|
+
type: DOMAIN_TYPES.classBox,
|
|
52
|
+
x: params.x,
|
|
53
|
+
y: params.y,
|
|
54
|
+
width: 180,
|
|
55
|
+
height: 120,
|
|
56
|
+
style: { ...DEFAULT_STYLE, fill: "#ffffff", stroke: "#1e1e1e", strokeWidth: 1.5 },
|
|
57
|
+
meta: {
|
|
58
|
+
className: "ClassName",
|
|
59
|
+
stereotype: "Entity",
|
|
60
|
+
attributes: ["id: ID"],
|
|
61
|
+
methods: [],
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
// ── 一覧 ──
|
|
66
|
+
/**
|
|
67
|
+
* Subtype identifier used by the picker for connector subtypes. Multiple picker
|
|
68
|
+
* entries map to the same underlying `domain-connector` shape type — they only
|
|
69
|
+
* differ in default `domainKind` / `relation`.
|
|
70
|
+
*/
|
|
71
|
+
const CONTEXT_MAP_SUBTYPE = "domain-context-map";
|
|
72
|
+
const TACTICAL_SUBTYPE = "domain-tactical";
|
|
73
|
+
export const DOMAIN_SUBTYPES = [
|
|
74
|
+
{
|
|
75
|
+
kind: "shape",
|
|
76
|
+
type: DOMAIN_TYPES.boundedContext,
|
|
77
|
+
label: "Bounded Context",
|
|
78
|
+
category: "strategic",
|
|
79
|
+
icon: BoundedContextIcon,
|
|
80
|
+
createDefault: createBoundedContext,
|
|
81
|
+
defaultSize: { width: 320, height: 200 },
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
kind: "connector",
|
|
85
|
+
type: CONTEXT_MAP_SUBTYPE,
|
|
86
|
+
label: "Context Map 関係",
|
|
87
|
+
category: "relation",
|
|
88
|
+
icon: ContextMapIcon,
|
|
89
|
+
domainKind: "context-map",
|
|
90
|
+
defaultRelation: "customer-supplier",
|
|
91
|
+
defaultSize: { width: 160, height: 0 },
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
kind: "shape",
|
|
95
|
+
type: DOMAIN_TYPES.aggregate,
|
|
96
|
+
label: "Aggregate",
|
|
97
|
+
category: "tactical",
|
|
98
|
+
icon: AggregateIcon,
|
|
99
|
+
createDefault: createAggregate,
|
|
100
|
+
defaultSize: { width: 200, height: 140 },
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
kind: "shape",
|
|
104
|
+
type: DOMAIN_TYPES.classBox,
|
|
105
|
+
label: "Class Box",
|
|
106
|
+
category: "tactical",
|
|
107
|
+
icon: ClassBoxIcon,
|
|
108
|
+
createDefault: createClassBox,
|
|
109
|
+
defaultSize: { width: 180, height: 120 },
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
kind: "connector",
|
|
113
|
+
type: TACTICAL_SUBTYPE,
|
|
114
|
+
label: "戦術関係",
|
|
115
|
+
category: "relation",
|
|
116
|
+
icon: TacticalRelationIcon,
|
|
117
|
+
domainKind: "tactical",
|
|
118
|
+
defaultRelation: "association",
|
|
119
|
+
defaultSize: { width: 160, height: 0 },
|
|
120
|
+
},
|
|
121
|
+
];
|
|
122
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAkB,MAAM,uBAAuB,CAAC;AAEtE,OAAO,EAKN,YAAY,GAEZ,MAAM,YAAY,CAAC;AAkCpB,aAAa;AAEb,SAAS,kBAAkB;IAC1B,OAAO,CACN,cAAK,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,YAC9C,eACC,CAAC,EAAC,KAAK,EACP,CAAC,EAAC,GAAG,EACL,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,EAAE,EAAC,GAAG,EACN,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EACjB,eAAe,EAAC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EAAE,UAAU;QACpB,IAAI,EAAE,cAAc;QACpB,UAAU,EAAE,aAAa;QACzB,eAAe,EAAE,mBAAmB;QACpC,WAAW,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE;KACtC;IACD;QACC,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,YAAY,CAAC,SAAS;QAC5B,KAAK,EAAE,WAAW;QAClB,QAAQ,EAAE,UAAU;QACpB,IAAI,EAAE,aAAa;QACnB,aAAa,EAAE,eAAe;QAC9B,WAAW,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE;KACxC;IACD;QACC,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,YAAY,CAAC,QAAQ;QAC3B,KAAK,EAAE,WAAW;QAClB,QAAQ,EAAE,UAAU;QACpB,IAAI,EAAE,YAAY;QAClB,aAAa,EAAE,cAAc;QAC7B,WAAW,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE;KACxC;IACD;QACC,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,UAAU;QACpB,IAAI,EAAE,oBAAoB;QAC1B,UAAU,EAAE,UAAU;QACtB,eAAe,EAAE,aAAa;QAC9B,WAAW,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE;KACtC;CACD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregate.d.ts","sourceRoot":"","sources":["../../src/shapes/aggregate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIvD,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,2CAuE/C"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { TitleEditor } from "../editor/editors.js";
|
|
3
|
+
import { readMeta } from "../types.js";
|
|
4
|
+
export function renderAggregate(shape) {
|
|
5
|
+
const meta = readMeta(shape);
|
|
6
|
+
const isEditing = shape["x-domain-editing"] === true;
|
|
7
|
+
return (_jsxs("div", { style: {
|
|
8
|
+
width: "100%",
|
|
9
|
+
height: "100%",
|
|
10
|
+
background: shape.style.fill,
|
|
11
|
+
border: `${shape.style.strokeWidth}px solid ${shape.style.stroke}`,
|
|
12
|
+
borderRadius: "50%",
|
|
13
|
+
boxSizing: "border-box",
|
|
14
|
+
padding: 16,
|
|
15
|
+
display: "flex",
|
|
16
|
+
flexDirection: "column",
|
|
17
|
+
alignItems: "center",
|
|
18
|
+
justifyContent: "center",
|
|
19
|
+
gap: 4,
|
|
20
|
+
overflow: "hidden",
|
|
21
|
+
opacity: shape.style.opacity,
|
|
22
|
+
}, children: [_jsx("span", { style: {
|
|
23
|
+
fontSize: 9,
|
|
24
|
+
fontWeight: 500,
|
|
25
|
+
letterSpacing: 1,
|
|
26
|
+
color: "#a16207",
|
|
27
|
+
textTransform: "uppercase",
|
|
28
|
+
}, children: "\u00ABAggregate\u00BB" }), isEditing ? (_jsx(TitleEditor, { shapeId: shape.id, initial: meta.rootName ?? "", field: "rootName" })) : (_jsx("span", { style: {
|
|
29
|
+
fontSize: 16,
|
|
30
|
+
fontWeight: 600,
|
|
31
|
+
color: "#1e1e1e",
|
|
32
|
+
textAlign: "center",
|
|
33
|
+
overflow: "hidden",
|
|
34
|
+
textOverflow: "ellipsis",
|
|
35
|
+
whiteSpace: "nowrap",
|
|
36
|
+
maxWidth: "100%",
|
|
37
|
+
}, children: meta.rootName || "(no name)" })), meta.invariants && meta.invariants.length > 0 && (_jsx("ul", { style: {
|
|
38
|
+
margin: "4px 0 0",
|
|
39
|
+
padding: "0 0 0 16px",
|
|
40
|
+
fontSize: 10,
|
|
41
|
+
color: "#475569",
|
|
42
|
+
maxHeight: "40%",
|
|
43
|
+
overflow: "hidden",
|
|
44
|
+
}, children: meta.invariants.slice(0, 3).map((inv, i) => (
|
|
45
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: invariant order is stable per shape
|
|
46
|
+
_jsx("li", { children: inv }, i))) }))] }));
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=aggregate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregate.js","sourceRoot":"","sources":["../../src/shapes/aggregate.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAsB,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE3D,MAAM,UAAU,eAAe,CAAC,KAAgB;IAC/C,MAAM,IAAI,GAAG,QAAQ,CAAgB,KAAK,CAAC,CAAC;IAC5C,MAAM,SAAS,GAAG,KAAK,CAAC,kBAAkB,CAAC,KAAK,IAAI,CAAC;IAErD,OAAO,CACN,eACC,KAAK,EAAE;YACN,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,MAAM;YACd,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI;YAC5B,MAAM,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,WAAW,YAAY,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE;YAClE,YAAY,EAAE,KAAK;YACnB,SAAS,EAAE,YAAY;YACvB,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,MAAM;YACf,aAAa,EAAE,QAAQ;YACvB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,QAAQ;YACxB,GAAG,EAAE,CAAC;YACN,QAAQ,EAAE,QAAQ;YAClB,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO;SAC5B,aAED,eACC,KAAK,EAAE;oBACN,QAAQ,EAAE,CAAC;oBACX,UAAU,EAAE,GAAG;oBACf,aAAa,EAAE,CAAC;oBAChB,KAAK,EAAE,SAAS;oBAChB,aAAa,EAAE,WAAW;iBAC1B,sCAGK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+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { TitleEditor } from "../editor/editors.js";
|
|
3
|
+
import { readMeta } from "../types.js";
|
|
4
|
+
const CORE_DOMAIN_LABEL = {
|
|
5
|
+
core: "Core",
|
|
6
|
+
supporting: "Supporting",
|
|
7
|
+
generic: "Generic",
|
|
8
|
+
};
|
|
9
|
+
const CORE_DOMAIN_ACCENT = {
|
|
10
|
+
core: "#dc2626",
|
|
11
|
+
supporting: "#f97316",
|
|
12
|
+
generic: "#64748b",
|
|
13
|
+
};
|
|
14
|
+
export function renderBoundedContext(shape) {
|
|
15
|
+
const meta = readMeta(shape);
|
|
16
|
+
const isEditing = shape["x-domain-editing"] === true;
|
|
17
|
+
const accent = meta.coreDomain != null ? CORE_DOMAIN_ACCENT[meta.coreDomain] : shape.style.stroke;
|
|
18
|
+
return (_jsxs("div", { style: {
|
|
19
|
+
width: "100%",
|
|
20
|
+
height: "100%",
|
|
21
|
+
background: shape.style.fill,
|
|
22
|
+
border: `${shape.style.strokeWidth}px dashed ${shape.style.stroke}`,
|
|
23
|
+
borderRadius: 6,
|
|
24
|
+
boxSizing: "border-box",
|
|
25
|
+
padding: 12,
|
|
26
|
+
display: "flex",
|
|
27
|
+
flexDirection: "column",
|
|
28
|
+
gap: 6,
|
|
29
|
+
overflow: "hidden",
|
|
30
|
+
opacity: shape.style.opacity,
|
|
31
|
+
}, children: [_jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [_jsx("span", { style: {
|
|
32
|
+
width: 8,
|
|
33
|
+
height: 8,
|
|
34
|
+
borderRadius: 999,
|
|
35
|
+
background: accent,
|
|
36
|
+
flexShrink: 0,
|
|
37
|
+
} }), isEditing ? (_jsx(TitleEditor, { shapeId: shape.id, initial: meta.contextName ?? "" })) : (_jsx("span", { style: {
|
|
38
|
+
fontSize: 16,
|
|
39
|
+
fontWeight: 600,
|
|
40
|
+
color: "#1e1e1e",
|
|
41
|
+
overflow: "hidden",
|
|
42
|
+
textOverflow: "ellipsis",
|
|
43
|
+
whiteSpace: "nowrap",
|
|
44
|
+
}, children: meta.contextName || "(no name)" })), meta.coreDomain != null && (_jsx("span", { style: {
|
|
45
|
+
marginLeft: "auto",
|
|
46
|
+
fontSize: 10,
|
|
47
|
+
fontWeight: 500,
|
|
48
|
+
color: accent,
|
|
49
|
+
border: `1px solid ${accent}`,
|
|
50
|
+
borderRadius: 4,
|
|
51
|
+
padding: "2px 6px",
|
|
52
|
+
flexShrink: 0,
|
|
53
|
+
}, children: CORE_DOMAIN_LABEL[meta.coreDomain] }))] }), meta.team && _jsxs("div", { style: { fontSize: 11, color: "#475569" }, children: ["Team: ", meta.team] }), meta.description && (_jsx("div", { style: {
|
|
54
|
+
fontSize: 12,
|
|
55
|
+
color: "#475569",
|
|
56
|
+
whiteSpace: "pre-wrap",
|
|
57
|
+
overflow: "hidden",
|
|
58
|
+
}, children: meta.description }))] }));
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=bounded-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bounded-context.js","sourceRoot":"","sources":["../../src/shapes/bounded-context.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAA2B,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEhE,MAAM,iBAAiB,GAAkE;IACxF,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,YAAY;IACxB,OAAO,EAAE,SAAS;CAClB,CAAC;AAEF,MAAM,kBAAkB,GAAkE;IACzF,IAAI,EAAE,SAAS;IACf,UAAU,EAAE,SAAS;IACrB,OAAO,EAAE,SAAS;CAClB,CAAC;AAEF,MAAM,UAAU,oBAAoB,CAAC,KAAgB;IACpD,MAAM,IAAI,GAAG,QAAQ,CAAqB,KAAK,CAAC,CAAC;IACjD,MAAM,SAAS,GAAG,KAAK,CAAC,kBAAkB,CAAC,KAAK,IAAI,CAAC;I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WAAW,IAAI,WAAW,GAC1B,CACP,EACA,IAAI,CAAC,UAAU,IAAI,IAAI,IAAI,CAC3B,eACC,KAAK,EAAE;4BACN,UAAU,EAAE,MAAM;4BAClB,QAAQ,EAAE,EAAE;4BACZ,UAAU,EAAE,GAAG;4BACf,KAAK,EAAE,MAAM;4BACb,MAAM,EAAE,aAAa,MAAM,EAAE;4BAC7B,YAAY,EAAE,CAAC;4BACf,OAAO,EAAE,SAAS;4BAClB,UAAU,EAAE,CAAC;yBACb,YAEA,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,GAC7B,CACP,IACI,EACL,IAAI,CAAC,IAAI,IAAI,eAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,uBAAS,IAAI,CAAC,IAAI,IAAO,EACpF,IAAI,CAAC,WAAW,IAAI,CACpB,cACC,KAAK,EAAE;oBACN,QAAQ,EAAE,EAAE;oBACZ,KAAK,EAAE,SAAS;oBAChB,UAAU,EAAE,UAAU;oBACtB,QAAQ,EAAE,QAAQ;iBAClB,YAEA,IAAI,CAAC,WAAW,GACZ,CACN,IACI,CACN,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"class-box.d.ts","sourceRoot":"","sources":["../../src/shapes/class-box.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAavD,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,2CA+E9C"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ClassBoxEditor } from "../editor/editors.js";
|
|
3
|
+
import { readMeta } from "../types.js";
|
|
4
|
+
const STEREOTYPE_ACCENT = {
|
|
5
|
+
Entity: "#2563eb",
|
|
6
|
+
ValueObject: "#0891b2",
|
|
7
|
+
Service: "#7c3aed",
|
|
8
|
+
Repository: "#16a34a",
|
|
9
|
+
DomainEvent: "#ea580c",
|
|
10
|
+
Factory: "#db2777",
|
|
11
|
+
};
|
|
12
|
+
export function renderClassBox(shape) {
|
|
13
|
+
const partial = readMeta(shape);
|
|
14
|
+
const meta = {
|
|
15
|
+
className: partial.className ?? "",
|
|
16
|
+
stereotype: partial.stereotype ?? "Entity",
|
|
17
|
+
attributes: partial.attributes ?? [],
|
|
18
|
+
methods: partial.methods ?? [],
|
|
19
|
+
};
|
|
20
|
+
const isEditing = shape["x-domain-editing"] === true;
|
|
21
|
+
const accent = STEREOTYPE_ACCENT[meta.stereotype];
|
|
22
|
+
if (isEditing) {
|
|
23
|
+
return _jsx(ClassBoxEditor, { shapeId: shape.id, meta: meta, accent: accent, style: shape.style });
|
|
24
|
+
}
|
|
25
|
+
return (_jsxs("div", { style: {
|
|
26
|
+
width: "100%",
|
|
27
|
+
height: "100%",
|
|
28
|
+
background: shape.style.fill,
|
|
29
|
+
border: `${shape.style.strokeWidth}px solid ${shape.style.stroke}`,
|
|
30
|
+
boxSizing: "border-box",
|
|
31
|
+
display: "flex",
|
|
32
|
+
flexDirection: "column",
|
|
33
|
+
overflow: "hidden",
|
|
34
|
+
opacity: shape.style.opacity,
|
|
35
|
+
fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
36
|
+
}, children: [_jsxs("div", { style: {
|
|
37
|
+
padding: "6px 8px",
|
|
38
|
+
borderBottom: `1px solid ${shape.style.stroke}`,
|
|
39
|
+
textAlign: "center",
|
|
40
|
+
background: `${accent}10`,
|
|
41
|
+
}, children: [_jsxs("div", { style: { fontSize: 10, color: accent, fontWeight: 500 }, children: ["\u00AB", meta.stereotype, "\u00BB"] }), _jsx("div", { style: {
|
|
42
|
+
fontSize: 14,
|
|
43
|
+
fontWeight: 600,
|
|
44
|
+
color: "#1e1e1e",
|
|
45
|
+
overflow: "hidden",
|
|
46
|
+
textOverflow: "ellipsis",
|
|
47
|
+
whiteSpace: "nowrap",
|
|
48
|
+
}, children: meta.className || "(no name)" })] }), _jsx("div", { style: {
|
|
49
|
+
padding: "4px 8px",
|
|
50
|
+
borderBottom: `1px solid ${shape.style.stroke}`,
|
|
51
|
+
fontSize: 11,
|
|
52
|
+
color: "#1e1e1e",
|
|
53
|
+
flex: 1,
|
|
54
|
+
overflow: "hidden",
|
|
55
|
+
whiteSpace: "pre-wrap",
|
|
56
|
+
}, children: (meta.attributes ?? []).join("\n") }), _jsx("div", { style: {
|
|
57
|
+
padding: "4px 8px",
|
|
58
|
+
fontSize: 11,
|
|
59
|
+
color: "#1e1e1e",
|
|
60
|
+
flex: 1,
|
|
61
|
+
overflow: "hidden",
|
|
62
|
+
whiteSpace: "pre-wrap",
|
|
63
|
+
}, children: (meta.methods ?? []).join("\n") })] }));
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=class-box.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"class-box.js","sourceRoot":"","sources":["../../src/shapes/class-box.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAA2C,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEhF,MAAM,iBAAiB,GAAoC;IAC1D,MAAM,EAAE,SAAS;IACjB,WAAW,EAAE,SAAS;IACtB,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,SAAS;IACrB,WAAW,EAAE,SAAS;IACtB,OAAO,EAAE,SAAS;CAClB,CAAC;AAEF,MAAM,UAAU,cAAc,CAAC,KAAgB;IAC9C,MAAM,OAAO,GAAG,QAAQ,CAAe,KAAK,CAAC,CAAC;IAC9C,MAAM,IAAI,GAAiB;QAC1B,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,EAAE;QAClC,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,QAAQ;QAC1C,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,EAAE;QACpC,OAAO,EAAE,OAAO,CAAC,OAAO,I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B,UAAU,EAAE,QAAQ;yBACpB,YAEA,IAAI,CAAC,SAAS,IAAI,WAAW,GACzB,IACD,EACN,cACC,KAAK,EAAE;oBACN,OAAO,EAAE,SAAS;oBAClB,YAAY,EAAE,aAAa,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE;oBAC/C,QAAQ,EAAE,EAAE;oBACZ,KAAK,EAAE,SAAS;oBAChB,IAAI,EAAE,CAAC;oBACP,QAAQ,EAAE,QAAQ;oBAClB,UAAU,EAAE,UAAU;iBACtB,YAEA,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAC9B,EACN,cACC,KAAK,EAAE;oBACN,OAAO,EAAE,SAAS;oBAClB,QAAQ,EAAE,EAAE;oBACZ,KAAK,EAAE,SAAS;oBAChB,IAAI,EAAE,CAAC;oBACP,QAAQ,EAAE,QAAQ;oBAClB,UAAU,EAAE,UAAU;iBACtB,YAEA,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAC3B,IACD,CACN,CAAC;AACH,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { ConnectableShapeData } from "@edv4h/usketch-connector-anchor";
|
|
2
|
+
import type { ShapeData } from "@edv4h/usketch-shared";
|
|
3
|
+
/**
|
|
4
|
+
* `shape.meta` を型付き view に変換する境界 helper。
|
|
5
|
+
* `ShapeData<TMeta>` の `meta` は generic 共変性の制約上、render 側で
|
|
6
|
+
* unknown 経由のキャストが必要になる。その escape をこの関数 1 箇所に閉じ込め、
|
|
7
|
+
* 利用側 (shapes/* / connectors/*) は型付きアクセスだけで済むようにする。
|
|
8
|
+
*/
|
|
9
|
+
export declare function readMeta<T>(shape: ShapeData): Partial<T>;
|
|
10
|
+
export declare const DOMAIN_TYPES: {
|
|
11
|
+
readonly boundedContext: "domain-bounded-context";
|
|
12
|
+
readonly aggregate: "domain-aggregate";
|
|
13
|
+
readonly classBox: "domain-class-box";
|
|
14
|
+
readonly connector: "domain-connector";
|
|
15
|
+
};
|
|
16
|
+
export interface BoundedContextMeta {
|
|
17
|
+
contextName: string;
|
|
18
|
+
team?: string;
|
|
19
|
+
coreDomain?: "core" | "supporting" | "generic";
|
|
20
|
+
description?: string;
|
|
21
|
+
}
|
|
22
|
+
export type BoundedContextShape = ShapeData<BoundedContextMeta>;
|
|
23
|
+
export type ContextMapRelation = "customer-supplier" | "conformist" | "anticorruption-layer" | "shared-kernel" | "open-host-service" | "partnership" | "published-language" | "separate-ways";
|
|
24
|
+
export interface AggregateMeta {
|
|
25
|
+
rootName: string;
|
|
26
|
+
invariants?: string[];
|
|
27
|
+
}
|
|
28
|
+
export type AggregateShape = ShapeData<AggregateMeta>;
|
|
29
|
+
export type ClassStereotype = "Entity" | "ValueObject" | "Service" | "Repository" | "DomainEvent" | "Factory";
|
|
30
|
+
export interface ClassBoxMeta {
|
|
31
|
+
className: string;
|
|
32
|
+
stereotype: ClassStereotype;
|
|
33
|
+
attributes: string[];
|
|
34
|
+
methods: string[];
|
|
35
|
+
}
|
|
36
|
+
export type ClassBoxShape = ShapeData<ClassBoxMeta>;
|
|
37
|
+
export type TacticalRelation = "inheritance" | "composition" | "aggregation" | "association" | "dependency" | "realization";
|
|
38
|
+
/**
|
|
39
|
+
* `domain-connector` shape の meta payload。
|
|
40
|
+
* `domainKind` discriminator で context-map / tactical を分け、relation 種別と
|
|
41
|
+
* それぞれの追加メタデータを保持する。
|
|
42
|
+
*/
|
|
43
|
+
export type DomainConnectorMeta = {
|
|
44
|
+
domainKind: "context-map";
|
|
45
|
+
relation: ContextMapRelation;
|
|
46
|
+
upstream?: "from" | "to";
|
|
47
|
+
notes?: string;
|
|
48
|
+
} | {
|
|
49
|
+
domainKind: "tactical";
|
|
50
|
+
relation: TacticalRelation;
|
|
51
|
+
multiplicityFrom?: string;
|
|
52
|
+
multiplicityTo?: string;
|
|
53
|
+
label?: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* DDD connector shape: 既存 `connector` shape と同じ anchor 構造(sourceId /
|
|
57
|
+
* targetId / sourceAnchor / sourcePoint 等)を持ちつつ、`type` と `meta` を
|
|
58
|
+
* domain-design 専用にしたもの。
|
|
59
|
+
*/
|
|
60
|
+
export interface DomainConnectorShape extends ConnectableShapeData {
|
|
61
|
+
type: typeof DOMAIN_TYPES.connector;
|
|
62
|
+
meta: DomainConnectorMeta;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,CAExD;AAID,eAAO,MAAM,YAAY;;;;;CAKf,CAAC;AAIX,MAAM,WAAW,kBAAkB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAAC;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,mBAAmB,GAAG,SAAS,CAAC,kBAAkB,CAAC,CAAC;AAEhE,MAAM,MAAM,kBAAkB,GAC3B,mBAAmB,GACnB,YAAY,GACZ,sBAAsB,GACtB,eAAe,GACf,mBAAmB,GACnB,aAAa,GACb,oBAAoB,GACpB,eAAe,CAAC;AAInB,MAAM,WAAW,aAAa;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,MAAM,cAAc,GAAG,SAAS,CAAC,aAAa,CAAC,CAAC;AAEtD,MAAM,MAAM,eAAe,GACxB,QAAQ,GACR,aAAa,GACb,SAAS,GACT,YAAY,GACZ,aAAa,GACb,SAAS,CAAC;AAEb,MAAM,WAAW,YAAY;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,eAAe,CAAC;IAC5B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,MAAM,aAAa,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC;AAEpD,MAAM,MAAM,gBAAgB,GACzB,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,YAAY,GACZ,aAAa,CAAC;AAIjB;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAC5B;IACA,UAAU,EAAE,aAAa,CAAC;IAC1B,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CACd,GACD;IACA,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEL;;;;GAIG;AACH,MAAM,WAAW,oBAAqB,SAAQ,oBAAoB;IACjE,IAAI,EAAE,OAAO,YAAY,CAAC,SAAS,CAAC;IACpC,IAAI,EAAE,mBAAmB,CAAC;CAC1B"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `shape.meta` を型付き view に変換する境界 helper。
|
|
3
|
+
* `ShapeData<TMeta>` の `meta` は generic 共変性の制約上、render 側で
|
|
4
|
+
* unknown 経由のキャストが必要になる。その escape をこの関数 1 箇所に閉じ込め、
|
|
5
|
+
* 利用側 (shapes/* / connectors/*) は型付きアクセスだけで済むようにする。
|
|
6
|
+
*/
|
|
7
|
+
export function readMeta(shape) {
|
|
8
|
+
return (shape.meta ?? {});
|
|
9
|
+
}
|
|
10
|
+
// ── 識別子 ──
|
|
11
|
+
export const DOMAIN_TYPES = {
|
|
12
|
+
boundedContext: "domain-bounded-context",
|
|
13
|
+
aggregate: "domain-aggregate",
|
|
14
|
+
classBox: "domain-class-box",
|
|
15
|
+
connector: "domain-connector",
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAI,KAAgB;IAC3C,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAA0B,CAAC;AACpD,CAAC;AAED,YAAY;AAEZ,MAAM,CAAC,MAAM,YAAY,GAAG;IAC3B,cAAc,EAAE,wBAAwB;IACxC,SAAS,EAAE,kBAAkB;IAC7B,QAAQ,EAAE,kBAAkB;IAC5B,SAAS,EAAE,kBAAkB;CACpB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@edv4h/usketch-plugin-domain-design",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"source": "./src/index.ts",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@zag-js/core": "^1.37.0",
|
|
16
|
+
"@zag-js/vanilla": "^1.37.0",
|
|
17
|
+
"@edv4h/usketch-canvas-engine": "1.1.0",
|
|
18
|
+
"@edv4h/usketch-connector-anchor": "0.2.0",
|
|
19
|
+
"@edv4h/usketch-core": "1.1.0",
|
|
20
|
+
"@edv4h/usketch-shape-utils": "2.0.0",
|
|
21
|
+
"@edv4h/usketch-shared": "2.0.0",
|
|
22
|
+
"@edv4h/usketch-store": "2.0.0"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"react": ">=19"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/react": "19.2.14",
|
|
29
|
+
"typescript": "5.9.3",
|
|
30
|
+
"vitest": "3.2.4"
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"dist",
|
|
37
|
+
"README.md"
|
|
38
|
+
],
|
|
39
|
+
"license": "MIT",
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "git+https://github.com/EdV4H/usketch.git",
|
|
43
|
+
"directory": "plugins/usketch-plugin-domain-design"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://github.com/EdV4H/usketch#readme",
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/EdV4H/usketch/issues"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "tsc -p tsconfig.json",
|
|
51
|
+
"typecheck": "tsc --noEmit",
|
|
52
|
+
"test": "vitest run --passWithNoTests",
|
|
53
|
+
"clean": "rm -rf dist"
|
|
54
|
+
}
|
|
55
|
+
}
|