@formicoidea/labre-ddd-shared 0.37.0 → 0.38.1
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.ts +0 -2
- package/dist/index.js +0 -2
- package/dist/shared/prefabs.d.ts +0 -12
- package/dist/shared/prefabs.js +0 -28
- package/package.json +2 -2
- package/dist/templates/categories.d.ts +0 -11
- package/dist/templates/categories.js +0 -20
- package/dist/templates/components.d.ts +0 -7
- package/dist/templates/components.js +0 -165
package/dist/index.d.ts
CHANGED
|
@@ -4,5 +4,3 @@ export * from './shared/prefabs.js';
|
|
|
4
4
|
export * from './shared/utils.js';
|
|
5
5
|
export * from './toolbar/icons.js';
|
|
6
6
|
export { DddSeniorButtonBase } from './toolbar/senior-buttons.js';
|
|
7
|
-
export { CD_TEMPLATES, CM_TEMPLATES, ES_TEMPLATES, } from './templates/components.js';
|
|
8
|
-
export { contextMapTemplateCategory, coreDomainTemplateCategory, eventStormingTemplateCategory, } from './templates/categories.js';
|
package/dist/index.js
CHANGED
|
@@ -4,5 +4,3 @@ export * from './shared/prefabs.js';
|
|
|
4
4
|
export * from './shared/utils.js';
|
|
5
5
|
export * from './toolbar/icons.js';
|
|
6
6
|
export { DddSeniorButtonBase } from './toolbar/senior-buttons.js';
|
|
7
|
-
export { CD_TEMPLATES, CM_TEMPLATES, ES_TEMPLATES, } from './templates/components.js';
|
|
8
|
-
export { contextMapTemplateCategory, coreDomainTemplateCategory, eventStormingTemplateCategory, } from './templates/categories.js';
|
package/dist/shared/prefabs.d.ts
CHANGED
|
@@ -97,8 +97,6 @@ export declare function markerShapeOpts(fill: string, role?: string): ShapeOpts;
|
|
|
97
97
|
export declare function addDot(surface: Surface, std: BlockStdScope, cx: number, cy: number, fill: string, label?: string,
|
|
98
98
|
/** Stamped on the ELLIPSE, never on the group: the dot is the artefact. */
|
|
99
99
|
role?: string): string;
|
|
100
|
-
/** A free-floating label. */
|
|
101
|
-
export declare function addLabel(surface: Surface, cx: number, cy: number, label: string, align?: 'left' | 'center', color?: string): string;
|
|
102
100
|
/** A relationship connector (the single connector unit reused for all patterns). */
|
|
103
101
|
export declare function addConnector(surface: Surface, x1: number, y1: number, x2: number, y2: number, opts?: {
|
|
104
102
|
rearArrow?: boolean;
|
|
@@ -124,16 +122,6 @@ export declare function addMarker(surface: Surface, std: BlockStdScope, cx: numb
|
|
|
124
122
|
}): string;
|
|
125
123
|
/** A cloud (Big Ball of Mud / general-purpose boundary): a smoothed closed bezier polygon. */
|
|
126
124
|
export declare function addCloud(surface: Surface, std: BlockStdScope, cx: number, cy: number, label?: string): string;
|
|
127
|
-
/**
|
|
128
|
-
* A Context Map relationship in DDD Crew notation: the connector, the pattern
|
|
129
|
-
* abbreviation in a small tag, and (for upstream/downstream patterns) the U / D
|
|
130
|
-
* markers — grouped so the whole pattern reads as one unit.
|
|
131
|
-
*/
|
|
132
|
-
export declare function addRelationship(surface: Surface, std: BlockStdScope, cx: number, cy: number, preset: {
|
|
133
|
-
abbrev: string;
|
|
134
|
-
upDown: boolean;
|
|
135
|
-
dashed: boolean;
|
|
136
|
-
}): string;
|
|
137
125
|
export interface LegendRow {
|
|
138
126
|
swatch: 'dot' | 'square' | 'line';
|
|
139
127
|
color: string;
|
package/dist/shared/prefabs.js
CHANGED
|
@@ -172,10 +172,6 @@ role) {
|
|
|
172
172
|
const lbl = addText(surface, cx + d / 2 + 6, cy - LABEL_FONT_SIZE / 2, 170, label, LABEL_COLOR, LABEL_FONT, LABEL_FONT_SIZE, 'left');
|
|
173
173
|
return groupIds(std, [dot, lbl]);
|
|
174
174
|
}
|
|
175
|
-
/** A free-floating label. */
|
|
176
|
-
export function addLabel(surface, cx, cy, label, align = 'center', color = LABEL_COLOR) {
|
|
177
|
-
return addText(surface, cx, cy, 200, label, color, LABEL_FONT, LABEL_FONT_SIZE, align);
|
|
178
|
-
}
|
|
179
175
|
/** A relationship connector (the single connector unit reused for all patterns). */
|
|
180
176
|
export function addConnector(surface, x1, y1, x2, y2, opts = {}) {
|
|
181
177
|
const { rearArrow = false, dashed = false, stroke = LABEL_COLOR, strokeWidth = 2, role, } = opts;
|
|
@@ -232,30 +228,6 @@ export function addCloud(surface, std, cx, cy, label) {
|
|
|
232
228
|
const lbl = addText(surface, cx - w / 2 + 12, cy - LABEL_FONT_SIZE / 2, w - 24, label, '#3d3d3d', LABEL_FONT, LABEL_FONT_SIZE);
|
|
233
229
|
return groupIds(std, [cloud, lbl]);
|
|
234
230
|
}
|
|
235
|
-
/**
|
|
236
|
-
* A Context Map relationship in DDD Crew notation: the connector, the pattern
|
|
237
|
-
* abbreviation in a small tag, and (for upstream/downstream patterns) the U / D
|
|
238
|
-
* markers — grouped so the whole pattern reads as one unit.
|
|
239
|
-
*/
|
|
240
|
-
export function addRelationship(surface, std, cx, cy, preset) {
|
|
241
|
-
const conn = addConnector(surface, cx - 130, cy, cx + 130, cy, {
|
|
242
|
-
rearArrow: preset.upDown,
|
|
243
|
-
dashed: preset.dashed,
|
|
244
|
-
});
|
|
245
|
-
const tag = addShape(surface, cx - 26, cy - 42, 52, 24, {
|
|
246
|
-
fill: '#ffffff',
|
|
247
|
-
stroke: '#6d6e71',
|
|
248
|
-
strokeWidth: 1,
|
|
249
|
-
radius: 4,
|
|
250
|
-
});
|
|
251
|
-
const tagText = addText(surface, cx - 26, cy - 36, 52, preset.abbrev, LABEL_COLOR, LABEL_FONT, 13);
|
|
252
|
-
const ids = [conn, tag, tagText];
|
|
253
|
-
if (preset.upDown) {
|
|
254
|
-
ids.push(addText(surface, cx - 150, cy - 30, 24, 'U', LABEL_COLOR, LABEL_FONT, 13));
|
|
255
|
-
ids.push(addText(surface, cx + 126, cy - 30, 24, 'D', LABEL_COLOR, LABEL_FONT, 13));
|
|
256
|
-
}
|
|
257
|
-
return groupIds(std, ids);
|
|
258
|
-
}
|
|
259
231
|
/**
|
|
260
232
|
* The legend box's geometry, in one place because two callers need it: the one
|
|
261
233
|
* that DRAWS the box and the one that has to know how tall it will be before
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formicoidea/labre-ddd-shared",
|
|
3
3
|
"description": "Labre ddd-shared — shared building blocks for @formicoidea/labre-core frameworks.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.38.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"author": "lajola",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"dist"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@formicoidea/labre-core": "0.
|
|
22
|
+
"@formicoidea/labre-core": "0.38.1",
|
|
23
23
|
"lit": "^3.2.0"
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { TemplateCategory } from '@formicoidea/labre-core/gfx/template';
|
|
2
|
-
/**
|
|
3
|
-
* One Templates-panel section per senior button. These are gated by
|
|
4
|
-
* `ddd-templates` only — never by a senior-button flag — so the catalogue stays
|
|
5
|
-
* available even when a senior button is hidden. They live in the shared
|
|
6
|
-
* package so the aggregate package can register all DDD categories under the
|
|
7
|
-
* single `ddd-templates` flag.
|
|
8
|
-
*/
|
|
9
|
-
export declare const eventStormingTemplateCategory: TemplateCategory;
|
|
10
|
-
export declare const coreDomainTemplateCategory: TemplateCategory;
|
|
11
|
-
export declare const contextMapTemplateCategory: TemplateCategory;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { CD_TEMPLATES, CM_TEMPLATES, ES_TEMPLATES } from './components.js';
|
|
2
|
-
/**
|
|
3
|
-
* One Templates-panel section per senior button. These are gated by
|
|
4
|
-
* `ddd-templates` only — never by a senior-button flag — so the catalogue stays
|
|
5
|
-
* available even when a senior button is hidden. They live in the shared
|
|
6
|
-
* package so the aggregate package can register all DDD categories under the
|
|
7
|
-
* single `ddd-templates` flag.
|
|
8
|
-
*/
|
|
9
|
-
export const eventStormingTemplateCategory = {
|
|
10
|
-
name: 'Event Storming',
|
|
11
|
-
templates: ES_TEMPLATES,
|
|
12
|
-
};
|
|
13
|
-
export const coreDomainTemplateCategory = {
|
|
14
|
-
name: 'Core Domain Chart',
|
|
15
|
-
templates: CD_TEMPLATES,
|
|
16
|
-
};
|
|
17
|
-
export const contextMapTemplateCategory = {
|
|
18
|
-
name: 'Context Map',
|
|
19
|
-
templates: CM_TEMPLATES,
|
|
20
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type Template } from '@formicoidea/labre-core/gfx/template';
|
|
2
|
-
/** Event Storming: one template per sticky kind + the hotspot. */
|
|
3
|
-
export declare const ES_TEMPLATES: Template[];
|
|
4
|
-
/** Core Domain: the chart background, the sub-domain dots, the team-topology markers, the movement arrow. */
|
|
5
|
-
export declare const CD_TEMPLATES: Template[];
|
|
6
|
-
/** Context Map: the bounded-context bubble, the cloud, the nine relationship patterns. */
|
|
7
|
-
export declare const CM_TEMPLATES: Template[];
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { makeTemplateSnapshot, surfaceText, } from '@formicoidea/labre-core/gfx/template';
|
|
2
|
-
import { ConnectorMode, FontFamily, PointStyle, ShapeStyle, StrokeStyle, TextAlign, } from '@formicoidea/labre-core/model';
|
|
3
|
-
import { CD_SUBDOMAINS, CLOUD, CLOUD_VERTICES, CM_BUBBLE, CM_RELATIONSHIPS, ES_HOTSPOT, ES_STICKIES, MOVEMENT_COLOR, TEAM_TOPOLOGIES, } from '../shared/consts.js';
|
|
4
|
-
/**
|
|
5
|
-
* Every DDD component (the things the three senior menus create) re-expressed as
|
|
6
|
-
* an insertable Template, so the whole toolbox is also available from the
|
|
7
|
-
* Templates panel. Authored as static surface-element JSON from the SAME consts
|
|
8
|
-
* the live prefabs use, so colours/labels stay in sync.
|
|
9
|
-
*/
|
|
10
|
-
const ATTRS = 'width="100%" height="100%" viewBox="0 0 135 80" xmlns="http://www.w3.org/2000/svg"';
|
|
11
|
-
const NO_STROKE = '#00000000';
|
|
12
|
-
function tpl(name, preview, elements) {
|
|
13
|
-
return {
|
|
14
|
-
name,
|
|
15
|
-
type: 'template',
|
|
16
|
-
preview,
|
|
17
|
-
content: makeTemplateSnapshot(elements, name),
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function stickyEl(fill, text, label, shapeType) {
|
|
21
|
-
return {
|
|
22
|
-
type: 'shape',
|
|
23
|
-
shapeType,
|
|
24
|
-
filled: true,
|
|
25
|
-
fillColor: fill,
|
|
26
|
-
strokeColor: NO_STROKE,
|
|
27
|
-
strokeWidth: 0,
|
|
28
|
-
shapeStyle: ShapeStyle.General,
|
|
29
|
-
roughness: 0,
|
|
30
|
-
radius: shapeType === 'rect' ? 6 : 0,
|
|
31
|
-
text: surfaceText(label),
|
|
32
|
-
color: text,
|
|
33
|
-
fontFamily: FontFamily.Kalam,
|
|
34
|
-
fontSize: 20,
|
|
35
|
-
textAlign: TextAlign.Center,
|
|
36
|
-
xywh: '[0,0,120,120]',
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
const sq = (c) => `<svg ${ATTRS}><rect x="38" y="13" width="60" height="54" rx="5" fill="${c}"/></svg>`;
|
|
40
|
-
const dia = (c) => `<svg ${ATTRS}><rect x="48" y="20" width="40" height="40" transform="rotate(45 68 40)" fill="${c}"/></svg>`;
|
|
41
|
-
const circ = (c) => `<svg ${ATTRS}><circle cx="68" cy="40" r="22" fill="${c}" stroke="#1f2328" stroke-width="1.5"/></svg>`;
|
|
42
|
-
const mk = (c, l) => `<svg ${ATTRS}><rect x="48" y="20" width="40" height="40" rx="5" fill="${c}" stroke="#1f2328" stroke-width="1.5"/><text x="68" y="47" text-anchor="middle" font-size="20" fill="#1f2328">${l}</text></svg>`;
|
|
43
|
-
const line = (dashed, arrow) => `<svg ${ATTRS} fill="none"><path d="M20 40 H${arrow ? 100 : 115}" stroke="#1f2328" stroke-width="2" stroke-dasharray="${dashed ? '5 4' : '0'}"/>${arrow ? '<path d="M98 32 L114 40 L98 48" stroke="#1f2328" stroke-width="2"/>' : ''}</svg>`;
|
|
44
|
-
/** Event Storming: one template per sticky kind + the hotspot. */
|
|
45
|
-
export const ES_TEMPLATES = [
|
|
46
|
-
...ES_STICKIES.map(p => tpl(`Event Storming — ${p.label}`, sq(p.fill), {
|
|
47
|
-
s: stickyEl(p.fill, p.text, p.label, 'rect'),
|
|
48
|
-
})),
|
|
49
|
-
tpl('Event Storming — Hotspot', dia(ES_HOTSPOT.fill), {
|
|
50
|
-
s: stickyEl(ES_HOTSPOT.fill, ES_HOTSPOT.text, ES_HOTSPOT.label, 'diamond'),
|
|
51
|
-
}),
|
|
52
|
-
];
|
|
53
|
-
/** Core Domain: the chart background, the sub-domain dots, the team-topology markers, the movement arrow. */
|
|
54
|
-
export const CD_TEMPLATES = [
|
|
55
|
-
tpl('Core Domain Chart', `<svg ${ATTRS} fill="none"><rect x="10" y="6" width="115" height="62" fill="#4d9900" fill-opacity="0.5"/><rect x="10" y="6" width="22" height="62" fill="#9933ff" fill-opacity="0.5"/><path d="M10 68 V6 M10 68 H125" stroke="#1f2328" stroke-width="1.6"/></svg>`, { bg: { type: 'coreDomain', xywh: '[0,0,900,820]' } }),
|
|
56
|
-
...CD_SUBDOMAINS.map(d => tpl(`Core Domain — ${d.label}`, circ(d.fill), {
|
|
57
|
-
dot: {
|
|
58
|
-
type: 'shape',
|
|
59
|
-
shapeType: 'ellipse',
|
|
60
|
-
filled: true,
|
|
61
|
-
fillColor: d.fill,
|
|
62
|
-
strokeColor: '#1f2328',
|
|
63
|
-
strokeWidth: 1.5,
|
|
64
|
-
shapeStyle: ShapeStyle.General,
|
|
65
|
-
roughness: 0,
|
|
66
|
-
xywh: '[0,0,26,26]',
|
|
67
|
-
},
|
|
68
|
-
})),
|
|
69
|
-
...TEAM_TOPOLOGIES.map(t => tpl(`Team topology — ${t.label}`, mk(t.fill, t.letter), {
|
|
70
|
-
m: {
|
|
71
|
-
type: 'shape',
|
|
72
|
-
shapeType: 'rect',
|
|
73
|
-
filled: true,
|
|
74
|
-
fillColor: t.fill,
|
|
75
|
-
strokeColor: '#1f2328',
|
|
76
|
-
strokeWidth: 1.5,
|
|
77
|
-
shapeStyle: ShapeStyle.General,
|
|
78
|
-
roughness: 0,
|
|
79
|
-
radius: 4,
|
|
80
|
-
text: surfaceText(t.letter),
|
|
81
|
-
color: '#1f2328',
|
|
82
|
-
fontFamily: FontFamily.Inter,
|
|
83
|
-
fontSize: 15,
|
|
84
|
-
textAlign: TextAlign.Center,
|
|
85
|
-
xywh: '[0,0,30,30]',
|
|
86
|
-
},
|
|
87
|
-
})),
|
|
88
|
-
tpl('Core Domain — Movement over time', line(true, true), {
|
|
89
|
-
c: {
|
|
90
|
-
type: 'connector',
|
|
91
|
-
mode: ConnectorMode.Straight,
|
|
92
|
-
stroke: MOVEMENT_COLOR,
|
|
93
|
-
strokeWidth: 2,
|
|
94
|
-
strokeStyle: StrokeStyle.Dash,
|
|
95
|
-
frontEndpointStyle: PointStyle.None,
|
|
96
|
-
rearEndpointStyle: PointStyle.Arrow,
|
|
97
|
-
source: { position: [0, 80] },
|
|
98
|
-
target: { position: [160, 0] },
|
|
99
|
-
},
|
|
100
|
-
}),
|
|
101
|
-
];
|
|
102
|
-
/** Context Map: the bounded-context bubble, the cloud, the nine relationship patterns. */
|
|
103
|
-
export const CM_TEMPLATES = [
|
|
104
|
-
tpl('Context Map — Bounded Context', `<svg ${ATTRS} fill="none"><rect x="20" y="25" width="95" height="30" rx="15" fill="${CM_BUBBLE.fill}" stroke="${CM_BUBBLE.stroke}" stroke-width="1.6"/></svg>`, {
|
|
105
|
-
b: {
|
|
106
|
-
type: 'shape',
|
|
107
|
-
shapeType: 'rect',
|
|
108
|
-
filled: true,
|
|
109
|
-
fillColor: CM_BUBBLE.fill,
|
|
110
|
-
strokeColor: CM_BUBBLE.stroke,
|
|
111
|
-
strokeWidth: 1.5,
|
|
112
|
-
shapeStyle: ShapeStyle.General,
|
|
113
|
-
roughness: 0,
|
|
114
|
-
radius: CM_BUBBLE.radius,
|
|
115
|
-
text: surfaceText('Bounded Context'),
|
|
116
|
-
color: CM_BUBBLE.text,
|
|
117
|
-
fontFamily: FontFamily.Inter,
|
|
118
|
-
fontSize: 14,
|
|
119
|
-
textAlign: TextAlign.Center,
|
|
120
|
-
xywh: `[0,0,${CM_BUBBLE.w},${CM_BUBBLE.h}]`,
|
|
121
|
-
},
|
|
122
|
-
}),
|
|
123
|
-
tpl('Context Map — Cloud / System', `<svg ${ATTRS} fill="none"><path d="M30 52 C18 52 16 40 26 37 C24 25 42 24 46 32 C50 22 70 24 70 35 C84 32 90 46 78 50 Z" fill="${CLOUD.fill}" stroke="${CLOUD.stroke}" stroke-width="1.4"/></svg>`, {
|
|
124
|
-
c: {
|
|
125
|
-
type: 'shape',
|
|
126
|
-
shapeType: 'polygon',
|
|
127
|
-
vertices: CLOUD_VERTICES,
|
|
128
|
-
isClosed: true,
|
|
129
|
-
filled: true,
|
|
130
|
-
fillColor: CLOUD.fill,
|
|
131
|
-
strokeColor: CLOUD.stroke,
|
|
132
|
-
strokeWidth: 1.5,
|
|
133
|
-
shapeStyle: ShapeStyle.General,
|
|
134
|
-
roughness: 0,
|
|
135
|
-
text: surfaceText('System'),
|
|
136
|
-
color: '#3d3d3d',
|
|
137
|
-
fontFamily: FontFamily.Inter,
|
|
138
|
-
fontSize: 14,
|
|
139
|
-
textAlign: TextAlign.Center,
|
|
140
|
-
xywh: `[0,0,${CLOUD.w},${CLOUD.h}]`,
|
|
141
|
-
},
|
|
142
|
-
}),
|
|
143
|
-
...CM_RELATIONSHIPS.map(r => tpl(`Context Map — ${r.label}`, line(r.dashed, r.upDown), {
|
|
144
|
-
c: {
|
|
145
|
-
type: 'connector',
|
|
146
|
-
mode: ConnectorMode.Straight,
|
|
147
|
-
stroke: '#1f2328',
|
|
148
|
-
strokeWidth: 2,
|
|
149
|
-
strokeStyle: r.dashed ? StrokeStyle.Dash : StrokeStyle.Solid,
|
|
150
|
-
frontEndpointStyle: PointStyle.None,
|
|
151
|
-
rearEndpointStyle: r.upDown ? PointStyle.Arrow : PointStyle.None,
|
|
152
|
-
source: { position: [0, 0] },
|
|
153
|
-
target: { position: [240, 0] },
|
|
154
|
-
},
|
|
155
|
-
t: {
|
|
156
|
-
type: 'text',
|
|
157
|
-
text: surfaceText(r.abbrev),
|
|
158
|
-
color: '#1f2328',
|
|
159
|
-
fontFamily: FontFamily.Inter,
|
|
160
|
-
fontSize: 13,
|
|
161
|
-
textAlign: TextAlign.Center,
|
|
162
|
-
xywh: '[94,-30,52,22]',
|
|
163
|
-
},
|
|
164
|
-
})),
|
|
165
|
-
];
|