@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/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 EdV4H
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# @edv4h/usketch-plugin-domain-design
|
|
2
|
+
|
|
3
|
+
uSketch 上で **DDD(ドメイン駆動設計)の戦略 / 戦術モデリング図** を描くためのプラグイン。
|
|
4
|
+
|
|
5
|
+
## 提供する shape
|
|
6
|
+
|
|
7
|
+
戦略レベル:
|
|
8
|
+
|
|
9
|
+
- `domain-bounded-context` — Bounded Context 枠(チーム名 / Core Domain 区分)
|
|
10
|
+
- `domain-context-map-connector` — ContextMap 関係 connector(Customer/Supplier、ACL、Conformist など)
|
|
11
|
+
|
|
12
|
+
戦術レベル:
|
|
13
|
+
|
|
14
|
+
- `domain-aggregate` — Aggregate Root を表す丸枠
|
|
15
|
+
- `domain-class-box` — Entity / ValueObject / Service / Repository / DomainEvent / Factory のクラスボックス
|
|
16
|
+
- `domain-tactical-connector` — クラス間の関係矢印(inheritance / composition / association ほか)
|
|
17
|
+
|
|
18
|
+
## 提供する tool
|
|
19
|
+
|
|
20
|
+
- `domain-draw` — 上記 shape を切り替えながら描画するツール(ショートカット: `d`)
|
|
21
|
+
|
|
22
|
+
## ドメイン固有データの保持
|
|
23
|
+
|
|
24
|
+
このプラグインは **`ShapeData<TMeta>` の `meta` フィールド** に DDD 固有のデータ(クラス名、属性、コンテキスト名、関係種別など)を保持する。
|
|
25
|
+
core ShapeData の geometry / style とは分離されているため、core ロジックに DDD 知識が漏れない。
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
interface ClassBoxMeta {
|
|
29
|
+
className: string;
|
|
30
|
+
stereotype: "Entity" | "ValueObject" | "Service" | "Repository" | "DomainEvent" | "Factory";
|
|
31
|
+
attributes: string[];
|
|
32
|
+
methods: string[];
|
|
33
|
+
}
|
|
34
|
+
type ClassBoxShape = ShapeData<ClassBoxMeta>;
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## インライン編集
|
|
38
|
+
|
|
39
|
+
ClassBox / Aggregate / BoundedContext はダブルクリックでインライン編集できる。
|
|
40
|
+
ClassBox は「クラス名 / 属性 / メソッド」の 3 セクション、Aggregate / BoundedContext はタイトル 1 行編集。
|
|
41
|
+
編集確定(blur / Enter)で `meta` が更新され、undo / redo に対応する。
|
|
42
|
+
|
|
43
|
+
## 使い方
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import { domainDesignPlugin } from "@edv4h/usketch-plugin-domain-design";
|
|
47
|
+
|
|
48
|
+
createApp({
|
|
49
|
+
plugins: [/* ..., */ domainDesignPlugin],
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
詳しくは [ドメイン設計プラグインのガイド](https://edv4h.github.io/usketch/docs/guides/domain-design-plugin/) を参照。
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ContextMapRelation, type DomainConnectorShape, type TacticalRelation } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Default DDD connector shape. Anchor fields (sourceId / sourcePoint etc) are
|
|
4
|
+
* filled in by the draw tool — `createDefaultDomainConnector` only seeds the
|
|
5
|
+
* geometry / style / meta payload.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createDefaultDomainConnector(params: {
|
|
8
|
+
id: string;
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
domainKind: "context-map" | "tactical";
|
|
12
|
+
relation?: ContextMapRelation | TacticalRelation;
|
|
13
|
+
}): DomainConnectorShape;
|
|
14
|
+
//# sourceMappingURL=connector-shape.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connector-shape.d.ts","sourceRoot":"","sources":["../../src/connectors/connector-shape.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,kBAAkB,EAGvB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE;IACpD,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,UAAU,EAAE,aAAa,GAAG,UAAU,CAAC;IACvC,QAAQ,CAAC,EAAE,kBAAkB,GAAG,gBAAgB,CAAC;CACjD,GAAG,oBAAoB,CA2BvB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { DOMAIN_TYPES, } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Default DDD connector shape. Anchor fields (sourceId / sourcePoint etc) are
|
|
4
|
+
* filled in by the draw tool — `createDefaultDomainConnector` only seeds the
|
|
5
|
+
* geometry / style / meta payload.
|
|
6
|
+
*/
|
|
7
|
+
export function createDefaultDomainConnector(params) {
|
|
8
|
+
const meta = buildDefaultMeta(params.domainKind, params.relation);
|
|
9
|
+
const sourcePoint = { x: params.x, y: params.y };
|
|
10
|
+
const targetPoint = { x: params.x + 100, y: params.y };
|
|
11
|
+
return {
|
|
12
|
+
id: params.id,
|
|
13
|
+
type: DOMAIN_TYPES.connector,
|
|
14
|
+
x: params.x,
|
|
15
|
+
y: params.y,
|
|
16
|
+
width: 100,
|
|
17
|
+
height: 0,
|
|
18
|
+
style: { fill: "transparent", stroke: "#1e1e1e", strokeWidth: 2, opacity: 1 },
|
|
19
|
+
sourceId: undefined,
|
|
20
|
+
targetId: undefined,
|
|
21
|
+
sourceAnchor: "auto",
|
|
22
|
+
targetAnchor: "auto",
|
|
23
|
+
sourcePoint,
|
|
24
|
+
targetPoint,
|
|
25
|
+
controlPoint: undefined,
|
|
26
|
+
controlPointAuto: true,
|
|
27
|
+
// Tactical relations get a forward arrow head; context-map relations are
|
|
28
|
+
// undirected lines (the relation badge encodes the upstream / downstream
|
|
29
|
+
// distinction instead).
|
|
30
|
+
arrowHead: params.domainKind === "tactical" ? "forward" : "none",
|
|
31
|
+
pathType: "straight",
|
|
32
|
+
meta,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function buildDefaultMeta(domainKind, relation) {
|
|
36
|
+
if (domainKind === "context-map") {
|
|
37
|
+
return {
|
|
38
|
+
domainKind: "context-map",
|
|
39
|
+
relation: relation ?? "customer-supplier",
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
domainKind: "tactical",
|
|
44
|
+
relation: relation ?? "association",
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=connector-shape.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connector-shape.js","sourceRoot":"","sources":["../../src/connectors/connector-shape.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,YAAY,GAIZ,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,MAAM,UAAU,4BAA4B,CAAC,MAM5C;IACA,MAAM,IAAI,GAAG,gBAAgB,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IAClE,MAAM,WAAW,GAAU,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;IACxD,MAAM,WAAW,GAAU,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;IAC9D,OAAO;QACN,EAAE,EAAE,MAAM,CAAC,EAAE;QACb,IAAI,EAAE,YAAY,CAAC,SAAS;QAC5B,CAAC,EAAE,MAAM,CAAC,CAAC;QACX,CAAC,EAAE,MAAM,CAAC,CAAC;QACX,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE;QAC7E,QAAQ,EAAE,SAAS;QACnB,QAAQ,EAAE,SAAS;QACnB,YAAY,EAAE,MAAM;QACpB,YAAY,EAAE,MAAM;QACpB,WAAW;QACX,WAAW;QACX,YAAY,EAAE,SAAS;QACvB,gBAAgB,EAAE,IAAI;QACtB,yEAAyE;QACzE,yEAAyE;QACzE,wBAAwB;QACxB,SAAS,EAAE,MAAM,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM;QAChE,QAAQ,EAAE,UAAU;QACpB,IAAI;KACJ,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CACxB,UAAsC,EACtC,QAAgD;IAEhD,IAAI,UAAU,KAAK,aAAa,EAAE,CAAC;QAClC,OAAO;YACN,UAAU,EAAE,aAAa;YACzB,QAAQ,EAAG,QAA2C,IAAI,mBAAmB;SAC7E,CAAC;IACH,CAAC;IACD,OAAO;QACN,UAAU,EAAE,UAAU;QACtB,QAAQ,EAAG,QAAyC,IAAI,aAAa;KACrE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { CanvasPointerEvent, ToolContext } from "@edv4h/usketch-shared";
|
|
2
|
+
import { type ContextMapRelation, type TacticalRelation } from "../types.js";
|
|
3
|
+
export interface DomainConnectorDrawTool {
|
|
4
|
+
onPointerDown(toolCtx: ToolContext, event: CanvasPointerEvent): void;
|
|
5
|
+
onPointerMove(toolCtx: ToolContext, event: CanvasPointerEvent): void;
|
|
6
|
+
onPointerUp(toolCtx: ToolContext, event: CanvasPointerEvent): void;
|
|
7
|
+
onDeactivate(toolCtx: ToolContext): void;
|
|
8
|
+
isActive(): boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface DomainConnectorDrawConfig {
|
|
11
|
+
domainKind: "context-map" | "tactical";
|
|
12
|
+
relation: ContextMapRelation | TacticalRelation;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Draw tool for DDD `domain-connector` shapes. Mirrors the standard connector
|
|
16
|
+
* tool flow (pointerdown picks a source shape, pointermove tracks a candidate
|
|
17
|
+
* target, pointerup commits) but emits a `domain-connector` shape with the
|
|
18
|
+
* relation / domainKind embedded in its `meta`.
|
|
19
|
+
*
|
|
20
|
+
* Important: DDD connectors require **both** source and target shapes — free
|
|
21
|
+
* lines (no target) are discarded on pointerup. This matches the DDD modeling
|
|
22
|
+
* intent that every relation is between two shapes.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createDomainConnectorDrawTool(getConfig: () => DomainConnectorDrawConfig): DomainConnectorDrawTool;
|
|
25
|
+
//# sourceMappingURL=draw-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draw-tool.d.ts","sourceRoot":"","sources":["../../src/connectors/draw-tool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAoB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAG/F,OAAO,EACN,KAAK,kBAAkB,EAGvB,KAAK,gBAAgB,EACrB,MAAM,aAAa,CAAC;AASrB,MAAM,WAAW,uBAAuB;IACvC,aAAa,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACrE,aAAa,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACrE,WAAW,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACnE,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IACzC,QAAQ,IAAI,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,yBAAyB;IACzC,UAAU,EAAE,aAAa,GAAG,UAAU,CAAC;IACvC,QAAQ,EAAE,kBAAkB,GAAG,gBAAgB,CAAC;CAChD;AAED;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAC5C,SAAS,EAAE,MAAM,yBAAyB,GACxC,uBAAuB,CAmHzB"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { findShapeAtPoint, getAnchorPoint } from "@edv4h/usketch-connector-anchor";
|
|
2
|
+
import { generateId } from "@edv4h/usketch-shared";
|
|
3
|
+
import { createAddShapeCommand } from "@edv4h/usketch-store";
|
|
4
|
+
import { DOMAIN_TYPES, } from "../types.js";
|
|
5
|
+
import { createDefaultDomainConnector } from "./connector-shape.js";
|
|
6
|
+
// Exclude all known connector types from source / target hit-testing so a DDD
|
|
7
|
+
// relation can never anchor onto another connector. The plain "connector"
|
|
8
|
+
// string covers the standard shape-connector type without taking a reverse
|
|
9
|
+
// dependency on that plugin.
|
|
10
|
+
const EXCLUDE_CONNECTOR_TYPES = new Set([DOMAIN_TYPES.connector, "connector"]);
|
|
11
|
+
/**
|
|
12
|
+
* Draw tool for DDD `domain-connector` shapes. Mirrors the standard connector
|
|
13
|
+
* tool flow (pointerdown picks a source shape, pointermove tracks a candidate
|
|
14
|
+
* target, pointerup commits) but emits a `domain-connector` shape with the
|
|
15
|
+
* relation / domainKind embedded in its `meta`.
|
|
16
|
+
*
|
|
17
|
+
* Important: DDD connectors require **both** source and target shapes — free
|
|
18
|
+
* lines (no target) are discarded on pointerup. This matches the DDD modeling
|
|
19
|
+
* intent that every relation is between two shapes.
|
|
20
|
+
*/
|
|
21
|
+
export function createDomainConnectorDrawTool(getConfig) {
|
|
22
|
+
let drawState = null;
|
|
23
|
+
function onPointerDown(toolCtx, event) {
|
|
24
|
+
const sourceShape = findShapeAtPoint(toolCtx, event.worldPoint, {
|
|
25
|
+
excludeTypes: EXCLUDE_CONNECTOR_TYPES,
|
|
26
|
+
});
|
|
27
|
+
if (!sourceShape)
|
|
28
|
+
return;
|
|
29
|
+
const config = getConfig();
|
|
30
|
+
const id = generateId();
|
|
31
|
+
const sourceAnchor = "auto";
|
|
32
|
+
const sourcePoint = getAnchorPoint(sourceShape, sourceAnchor, event.worldPoint);
|
|
33
|
+
const base = createDefaultDomainConnector({
|
|
34
|
+
id,
|
|
35
|
+
x: sourcePoint.x,
|
|
36
|
+
y: sourcePoint.y,
|
|
37
|
+
domainKind: config.domainKind,
|
|
38
|
+
relation: config.relation,
|
|
39
|
+
});
|
|
40
|
+
const connector = {
|
|
41
|
+
...base,
|
|
42
|
+
sourceId: sourceShape.id,
|
|
43
|
+
targetId: undefined,
|
|
44
|
+
sourceAnchor,
|
|
45
|
+
targetAnchor: "auto",
|
|
46
|
+
sourcePoint,
|
|
47
|
+
targetPoint: { x: event.worldPoint.x, y: event.worldPoint.y },
|
|
48
|
+
};
|
|
49
|
+
toolCtx.store.addShape(connector);
|
|
50
|
+
drawState = { connectorId: id, sourceShape, sourceAnchor };
|
|
51
|
+
}
|
|
52
|
+
function onPointerMove(toolCtx, event) {
|
|
53
|
+
if (!drawState)
|
|
54
|
+
return;
|
|
55
|
+
const targetShape = findShapeAtPoint(toolCtx, event.worldPoint, {
|
|
56
|
+
excludeTypes: EXCLUDE_CONNECTOR_TYPES,
|
|
57
|
+
});
|
|
58
|
+
const targetPoint = event.worldPoint;
|
|
59
|
+
const sourcePoint = getAnchorPoint(drawState.sourceShape, drawState.sourceAnchor, targetPoint);
|
|
60
|
+
const resolvedTarget = targetShape && targetShape.id !== drawState.sourceShape.id
|
|
61
|
+
? getAnchorPoint(targetShape, "auto", sourcePoint)
|
|
62
|
+
: targetPoint;
|
|
63
|
+
toolCtx.store.updateShape(drawState.connectorId, {
|
|
64
|
+
sourcePoint,
|
|
65
|
+
targetPoint: resolvedTarget,
|
|
66
|
+
x: Math.min(sourcePoint.x, resolvedTarget.x),
|
|
67
|
+
y: Math.min(sourcePoint.y, resolvedTarget.y),
|
|
68
|
+
width: Math.abs(resolvedTarget.x - sourcePoint.x),
|
|
69
|
+
height: Math.abs(resolvedTarget.y - sourcePoint.y),
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function onPointerUp(toolCtx, event) {
|
|
73
|
+
if (!drawState)
|
|
74
|
+
return;
|
|
75
|
+
const targetShape = findShapeAtPoint(toolCtx, event.worldPoint, {
|
|
76
|
+
excludeTypes: EXCLUDE_CONNECTOR_TYPES,
|
|
77
|
+
});
|
|
78
|
+
const connector = toolCtx.store.getShape(drawState.connectorId);
|
|
79
|
+
if (!connector || !targetShape || targetShape.id === drawState.sourceShape.id) {
|
|
80
|
+
toolCtx.store.deleteShape(drawState.connectorId);
|
|
81
|
+
drawState = null;
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const sourcePoint = getAnchorPoint(drawState.sourceShape, drawState.sourceAnchor, {
|
|
85
|
+
x: targetShape.x + targetShape.width / 2,
|
|
86
|
+
y: targetShape.y + targetShape.height / 2,
|
|
87
|
+
});
|
|
88
|
+
const targetPoint = getAnchorPoint(targetShape, "auto", sourcePoint);
|
|
89
|
+
toolCtx.store.deleteShape(drawState.connectorId);
|
|
90
|
+
const finalShape = {
|
|
91
|
+
...connector,
|
|
92
|
+
targetId: targetShape.id,
|
|
93
|
+
targetAnchor: "auto",
|
|
94
|
+
sourcePoint,
|
|
95
|
+
targetPoint,
|
|
96
|
+
x: Math.min(sourcePoint.x, targetPoint.x),
|
|
97
|
+
y: Math.min(sourcePoint.y, targetPoint.y),
|
|
98
|
+
width: Math.abs(targetPoint.x - sourcePoint.x),
|
|
99
|
+
height: Math.abs(targetPoint.y - sourcePoint.y),
|
|
100
|
+
};
|
|
101
|
+
toolCtx.commands.execute(createAddShapeCommand(toolCtx.store, finalShape));
|
|
102
|
+
drawState = null;
|
|
103
|
+
toolCtx.store.setActiveToolId("select");
|
|
104
|
+
}
|
|
105
|
+
function onDeactivate(toolCtx) {
|
|
106
|
+
if (drawState) {
|
|
107
|
+
toolCtx.store.deleteShape(drawState.connectorId);
|
|
108
|
+
drawState = null;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
onPointerDown,
|
|
113
|
+
onPointerMove,
|
|
114
|
+
onPointerUp,
|
|
115
|
+
onDeactivate,
|
|
116
|
+
isActive: () => drawState !== null,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=draw-tool.js.map
|
|
@@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AAG,SAAS;YACZ,QAAQ,EAAE,WAAW,CAAC,EAAE;YACxB,YAAY,EAAE,MAAoB;YAClC,WAAW;YACX,WAAW;YACX,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC;YACzC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC;YACzC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC;YAC9C,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC;SAC/C,CAAC;QACF,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,qBAAqB,CAAC,OAAO,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;QAE3E,SAAS,GAAG,IAAI,CAAC;QACjB,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;IAED,SAAS,YAAY,CAAC,OAAoB;QACzC,IAAI,SAAS,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;YACjD,SAAS,GAAG,IAAI,CAAC;QAClB,CAAC;IACF,CAAC;IAED,OAAO;QACN,aAAa;QACb,aAAa;QACb,WAAW;QACX,YAAY;QACZ,QAAQ,EAAE,GAAG,EAAE,CAAC,SAAS,KAAK,IAAI;KAClC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-domain-connector.d.ts","sourceRoot":"","sources":["../../src/connectors/render-domain-connector.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAS,SAAS,EAAE,MAAM,uBAAuB,CAAC;AA6C9D,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,SAAS,2CAoCrD"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { getDefaultControlPoint, getElbowPoints, getPathMidpoint, } from "@edv4h/usketch-connector-anchor";
|
|
3
|
+
import { readMeta, } from "../types.js";
|
|
4
|
+
// ── ContextMap relation styling ──
|
|
5
|
+
const CONTEXT_MAP_LABEL = {
|
|
6
|
+
"customer-supplier": { short: "C/S", full: "Customer/Supplier" },
|
|
7
|
+
conformist: { short: "CF", full: "Conformist" },
|
|
8
|
+
"anticorruption-layer": { short: "ACL", full: "Anticorruption Layer" },
|
|
9
|
+
"shared-kernel": { short: "SK", full: "Shared Kernel" },
|
|
10
|
+
"open-host-service": { short: "OHS", full: "Open Host Service" },
|
|
11
|
+
partnership: { short: "P", full: "Partnership" },
|
|
12
|
+
"published-language": { short: "PL", full: "Published Language" },
|
|
13
|
+
"separate-ways": { short: "SW", full: "Separate Ways" },
|
|
14
|
+
};
|
|
15
|
+
const CONTEXT_MAP_DASHED = new Set([
|
|
16
|
+
"separate-ways",
|
|
17
|
+
"anticorruption-layer",
|
|
18
|
+
]);
|
|
19
|
+
const TACTICAL_STYLE = {
|
|
20
|
+
inheritance: { dashed: false, headFill: "#ffffff", headShape: "triangle" },
|
|
21
|
+
realization: { dashed: true, headFill: "#ffffff", headShape: "triangle" },
|
|
22
|
+
composition: { dashed: false, headFill: "#1e1e1e", headShape: "diamond" },
|
|
23
|
+
aggregation: { dashed: false, headFill: "#ffffff", headShape: "diamond" },
|
|
24
|
+
association: { dashed: false, headFill: "#1e1e1e", headShape: "open" },
|
|
25
|
+
dependency: { dashed: true, headFill: "#1e1e1e", headShape: "open" },
|
|
26
|
+
};
|
|
27
|
+
// ── Renderer ──
|
|
28
|
+
export function renderDomainConnector(shape) {
|
|
29
|
+
const meta = readMeta(shape);
|
|
30
|
+
if (!meta.domainKind)
|
|
31
|
+
return _jsx("g", {});
|
|
32
|
+
const sourcePoint = shape.sourcePoint ?? {
|
|
33
|
+
x: shape.x,
|
|
34
|
+
y: shape.y,
|
|
35
|
+
};
|
|
36
|
+
const targetPoint = shape.targetPoint ?? {
|
|
37
|
+
x: shape.x + shape.width,
|
|
38
|
+
y: shape.y + shape.height,
|
|
39
|
+
};
|
|
40
|
+
const controlPoint = shape.controlPoint;
|
|
41
|
+
const pathType = (shape.pathType ?? "straight") ||
|
|
42
|
+
"straight";
|
|
43
|
+
const stroke = shape.style.stroke;
|
|
44
|
+
const sw = shape.style.strokeWidth;
|
|
45
|
+
const opacity = shape.style.opacity;
|
|
46
|
+
const args = {
|
|
47
|
+
shape,
|
|
48
|
+
meta,
|
|
49
|
+
sourcePoint,
|
|
50
|
+
targetPoint,
|
|
51
|
+
controlPoint,
|
|
52
|
+
pathType,
|
|
53
|
+
stroke,
|
|
54
|
+
strokeWidth: sw,
|
|
55
|
+
opacity,
|
|
56
|
+
};
|
|
57
|
+
if (meta.domainKind === "context-map") {
|
|
58
|
+
return renderContextMapConnector(args);
|
|
59
|
+
}
|
|
60
|
+
return renderTacticalConnector(args);
|
|
61
|
+
}
|
|
62
|
+
function renderContextMapConnector(args) {
|
|
63
|
+
const meta = args.meta;
|
|
64
|
+
const relation = meta.relation ?? "customer-supplier";
|
|
65
|
+
const label = CONTEXT_MAP_LABEL[relation];
|
|
66
|
+
const dashed = CONTEXT_MAP_DASHED.has(relation);
|
|
67
|
+
const upstreamLabel = meta.upstream === "from" ? "U → D" : meta.upstream === "to" ? "D ← U" : null;
|
|
68
|
+
// Use the actual on-path midpoint so the badge stays on the line/curve/elbow
|
|
69
|
+
// regardless of pathType (arithmetic midpoint drifts off curves).
|
|
70
|
+
const mid = getPathMidpoint(args.pathType, args.sourcePoint, args.targetPoint, args.controlPoint);
|
|
71
|
+
return (_jsxs("g", { opacity: args.opacity, children: [_jsxs("title", { children: [label.full, upstreamLabel ? ` (${upstreamLabel})` : ""] }), renderPath(args, dashed), _jsxs("g", { transform: `translate(${mid.x}, ${mid.y})`, children: [_jsx("rect", { x: -22, y: -9, width: 44, height: 18, rx: 3, fill: "#ffffff", stroke: args.stroke, strokeWidth: 1 }), _jsx("text", { x: 0, y: 1, textAnchor: "middle", dominantBaseline: "middle", fontSize: 11, fontWeight: 600, fill: "#1e1e1e", children: label.short })] })] }));
|
|
72
|
+
}
|
|
73
|
+
function renderTacticalConnector(args) {
|
|
74
|
+
const meta = args.meta;
|
|
75
|
+
const relation = meta.relation ?? "association";
|
|
76
|
+
const styleSpec = TACTICAL_STYLE[relation];
|
|
77
|
+
const stroke = args.stroke;
|
|
78
|
+
const sw = args.strokeWidth;
|
|
79
|
+
const x1 = args.sourcePoint.x;
|
|
80
|
+
const y1 = args.sourcePoint.y;
|
|
81
|
+
const x2 = args.targetPoint.x;
|
|
82
|
+
const y2 = args.targetPoint.y;
|
|
83
|
+
const length = Math.hypot(x2 - x1, y2 - y1) || 1;
|
|
84
|
+
const headSize = Math.min(14, Math.max(8, length * 0.12));
|
|
85
|
+
const angle = Math.atan2(y2 - y1, x2 - x1);
|
|
86
|
+
const cos = Math.cos(angle);
|
|
87
|
+
const sin = Math.sin(angle);
|
|
88
|
+
const head = renderTacticalArrowHead(styleSpec, x2, y2, cos, sin, headSize, stroke, sw);
|
|
89
|
+
const labelText = meta.label ?? "";
|
|
90
|
+
const fromLabel = meta.multiplicityFrom ?? "";
|
|
91
|
+
const toLabel = meta.multiplicityTo ?? "";
|
|
92
|
+
return (_jsxs("g", { opacity: args.opacity, children: [_jsx("title", { children: `${relation}${labelText ? `: ${labelText}` : ""}` }), renderPath({
|
|
93
|
+
...args,
|
|
94
|
+
// Tactical arrow head occupies a small slice at the target end; pull
|
|
95
|
+
// the line back by 60% of the head size so the line and head don't overlap.
|
|
96
|
+
targetPoint: { x: x2 - cos * headSize * 0.6, y: y2 - sin * headSize * 0.6 },
|
|
97
|
+
}, styleSpec.dashed), head, labelText &&
|
|
98
|
+
(() => {
|
|
99
|
+
// Use on-path midpoint so the label sits on the actual rendered
|
|
100
|
+
// path (curve/elbow/straight), not at the arithmetic midpoint.
|
|
101
|
+
const mid = getPathMidpoint(args.pathType, args.sourcePoint, args.targetPoint, args.controlPoint);
|
|
102
|
+
return (_jsx("text", { x: mid.x, y: mid.y - 4, textAnchor: "middle", fontSize: 11, fill: "#1e1e1e", children: labelText }));
|
|
103
|
+
})(), fromLabel && (_jsx("text", { x: x1 + cos * 12 - sin * 8, y: y1 + sin * 12 + cos * 8, fontSize: 10, fill: "#475569", children: fromLabel })), toLabel && (_jsx("text", { x: x2 - cos * 12 - sin * 8, y: y2 - sin * 12 + cos * 8, fontSize: 10, fill: "#475569", textAnchor: "end", children: toLabel }))] }));
|
|
104
|
+
}
|
|
105
|
+
function renderPath(args, dashed) {
|
|
106
|
+
const dashArray = dashed ? "6 4" : undefined;
|
|
107
|
+
if (args.pathType === "curve") {
|
|
108
|
+
// Rebuild from current sourcePoint/targetPoint instead of trusting the
|
|
109
|
+
// caller-passed `pathD`: tactical connectors shorten targetPoint to make
|
|
110
|
+
// room for the arrow head, and we want the curve to follow that.
|
|
111
|
+
const cp = args.shape.controlPoint ??
|
|
112
|
+
getDefaultControlPoint(args.sourcePoint, args.targetPoint);
|
|
113
|
+
const d = `M ${args.sourcePoint.x},${args.sourcePoint.y} Q ${cp.x},${cp.y} ${args.targetPoint.x},${args.targetPoint.y}`;
|
|
114
|
+
return (_jsx("path", { d: d, fill: "none", stroke: args.stroke, strokeWidth: args.strokeWidth, strokeDasharray: dashArray }));
|
|
115
|
+
}
|
|
116
|
+
if (args.pathType === "elbow") {
|
|
117
|
+
const points = getElbowPoints(args.sourcePoint, args.targetPoint)
|
|
118
|
+
.map((p) => `${p.x},${p.y}`)
|
|
119
|
+
.join(" ");
|
|
120
|
+
return (_jsx("polyline", { points: points, fill: "none", stroke: args.stroke, strokeWidth: args.strokeWidth, strokeDasharray: dashArray }));
|
|
121
|
+
}
|
|
122
|
+
return (_jsx("line", { x1: args.sourcePoint.x, y1: args.sourcePoint.y, x2: args.targetPoint.x, y2: args.targetPoint.y, stroke: args.stroke, strokeWidth: args.strokeWidth, strokeDasharray: dashArray }));
|
|
123
|
+
}
|
|
124
|
+
function renderTacticalArrowHead(style, tipX, tipY, cos, sin, headSize, stroke, sw) {
|
|
125
|
+
switch (style.headShape) {
|
|
126
|
+
case "triangle": {
|
|
127
|
+
const baseX = tipX - cos * headSize;
|
|
128
|
+
const baseY = tipY - sin * headSize;
|
|
129
|
+
const halfBase = headSize * 0.5;
|
|
130
|
+
const px = -sin * halfBase;
|
|
131
|
+
const py = cos * halfBase;
|
|
132
|
+
return (_jsx("polygon", { points: `${tipX},${tipY} ${baseX + px},${baseY + py} ${baseX - px},${baseY - py}`, fill: style.headFill, stroke: stroke, strokeWidth: sw }));
|
|
133
|
+
}
|
|
134
|
+
case "diamond": {
|
|
135
|
+
const midX = tipX - cos * headSize;
|
|
136
|
+
const midY = tipY - sin * headSize;
|
|
137
|
+
const baseX = tipX - cos * headSize * 2;
|
|
138
|
+
const baseY = tipY - sin * headSize * 2;
|
|
139
|
+
const halfWidth = headSize * 0.4;
|
|
140
|
+
const px = -sin * halfWidth;
|
|
141
|
+
const py = cos * halfWidth;
|
|
142
|
+
return (_jsx("polygon", { points: `${tipX},${tipY} ${midX + px},${midY + py} ${baseX},${baseY} ${midX - px},${midY - py}`, fill: style.headFill, stroke: stroke, strokeWidth: sw }));
|
|
143
|
+
}
|
|
144
|
+
case "open": {
|
|
145
|
+
const baseX = tipX - cos * headSize;
|
|
146
|
+
const baseY = tipY - sin * headSize;
|
|
147
|
+
const halfBase = headSize * 0.5;
|
|
148
|
+
const px = -sin * halfBase;
|
|
149
|
+
const py = cos * halfBase;
|
|
150
|
+
return (_jsx("polyline", { points: `${baseX + px},${baseY + py} ${tipX},${tipY} ${baseX - px},${baseY - py}`, fill: "none", stroke: stroke, strokeWidth: sw }));
|
|
151
|
+
}
|
|
152
|
+
default:
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=render-domain-connector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-domain-connector.js","sourceRoot":"","sources":["../../src/connectors/render-domain-connector.tsx"],"names":[],"mappings":";AAAA,OAAO,EACN,sBAAsB,EACtB,cAAc,EACd,eAAe,GACf,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAGN,QAAQ,GAER,MAAM,aAAa,CAAC;AAErB,oCAAoC;AAEpC,MAAM,iBAAiB,GAAgE;IACtF,mBAAmB,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,mBAAmB,EAAE;IAChE,UAAU,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE;IAC/C,sBAAsB,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,sBAAsB,EAAE;IACtE,eAAe,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE;IACvD,mBAAmB,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,mBAAmB,EAAE;IAChE,WAAW,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,aAAa,EAAE;IAChD,oBAAoB,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,oBAAoB,EAAE;IACjE,eAAe,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE;CACvD,CAAC;AAEF,MAAM,kBAAkB,GAAoC,IAAI,GAAG,CAAC;IACnE,eAAe;IACf,sBAAsB;CACtB,CAAC,CAAC;AAUH,MAAM,cAAc,GAA4C;IAC/D,WAAW,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE;IAC1E,WAAW,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE;IACzE,WA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KAAK,CAAC,QAAQ,EACpB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,EAAE,GACd,CACF,CAAC;QACH,CAAC;QACD,KAAK,MAAM,CAAC,CAAC,CAAC;YACb,MAAM,KAAK,GAAG,IAAI,GAAG,GAAG,GAAG,QAAQ,CAAC;YACpC,MAAM,KAAK,GAAG,IAAI,GAAG,GAAG,GAAG,QAAQ,CAAC;YACpC,MAAM,QAAQ,GAAG,QAAQ,GAAG,GAAG,CAAC;YAChC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,QAAQ,CAAC;YAC3B,MAAM,EAAE,GAAG,GAAG,GAAG,QAAQ,CAAC;YAC1B,OAAO,CACN,mBACC,MAAM,EAAE,GAAG,KAAK,GAAG,EAAE,IAAI,KAAK,GAAG,EAAE,IAAI,IAAI,IAAI,IAAI,IAAI,KAAK,GAAG,EAAE,IAAI,KAAK,GAAG,EAAE,EAAE,EACjF,IAAI,EAAC,MAAM,EACX,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,EAAE,GACd,CACF,CAAC;QACH,CAAC;QACD;YACC,OAAO,IAAI,CAAC;IACd,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { PluginContext } from "@edv4h/usketch-shared";
|
|
2
|
+
export declare const EDITABLE_DOMAIN_TYPES: ReadonlySet<string>;
|
|
3
|
+
type EditingEvent = {
|
|
4
|
+
type: "POINTER_DOWN";
|
|
5
|
+
shapeId: string | null;
|
|
6
|
+
} | {
|
|
7
|
+
type: "CLICK_TIMEOUT";
|
|
8
|
+
} | {
|
|
9
|
+
type: "COMMIT";
|
|
10
|
+
id: string;
|
|
11
|
+
nextMeta: Record<string, unknown>;
|
|
12
|
+
} | {
|
|
13
|
+
type: "CANCEL";
|
|
14
|
+
id: string;
|
|
15
|
+
} | {
|
|
16
|
+
type: "DESELECTED";
|
|
17
|
+
};
|
|
18
|
+
export declare function createDomainEditingService(pluginCtx: PluginContext): {
|
|
19
|
+
send: (event: EditingEvent) => void;
|
|
20
|
+
readonly editingShapeId: string | null;
|
|
21
|
+
matches(...values: string[]): boolean;
|
|
22
|
+
stop(): void;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=editing-machine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editing-machine.d.ts","sourceRoot":"","sources":["../../src/editor/editing-machine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAa,MAAM,uBAAuB,CAAC;AAMtE,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,MAAM,CAIpD,CAAC;AAEH,KAAK,YAAY,GACd;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,GACzB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GACjE;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,CAAC;AAuO1B,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,aAAa;;;uBAU9C,MAAM,EAAE;;EAU5B"}
|