@formicoidea/labre-core 0.24.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_pkgs/affine-block-database/database-block.js +7 -2
- package/dist/_pkgs/affine-block-database/service/index.d.ts +12 -1
- package/dist/_pkgs/affine-block-database/service/index.js +1 -0
- package/dist/_pkgs/affine-components/toolbar/toolbar.js +10 -2
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/mindmap-menu.js +1 -1
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/mindmap-tool-button.js +0 -19
- package/dist/_pkgs/affine-model/blocks/database/database-model.d.ts +1 -0
- package/dist/_pkgs/affine-model/blocks/database/database-model.js +2 -1
- package/dist/_pkgs/affine-widget-edgeless-toolbar/edgeless-toolbar.js +6 -0
- package/dist/_pkgs/affine-widget-toolbar/utils.js +5 -1
- package/dist/_pkgs/std/effects.js +12 -5
- package/dist/extensions/view.js +0 -6
- package/dist/flags.d.ts +1 -1
- package/dist/flags.js +0 -4
- package/package.json +1 -1
- package/dist/_pkgs/affine-gfx-ddd/core-domain/consts.d.ts +0 -32
- package/dist/_pkgs/affine-gfx-ddd/core-domain/consts.js +0 -30
- package/dist/_pkgs/affine-gfx-ddd/core-domain/element-renderer.d.ts +0 -12
- package/dist/_pkgs/affine-gfx-ddd/core-domain/element-renderer.js +0 -93
- package/dist/_pkgs/affine-gfx-ddd/core-domain/element-view.d.ts +0 -11
- package/dist/_pkgs/affine-gfx-ddd/core-domain/element-view.js +0 -20
- package/dist/_pkgs/affine-gfx-ddd/core-domain/legend.d.ts +0 -18
- package/dist/_pkgs/affine-gfx-ddd/core-domain/legend.js +0 -69
- package/dist/_pkgs/affine-gfx-ddd/core-domain/toolbar-config.d.ts +0 -1
- package/dist/_pkgs/affine-gfx-ddd/core-domain/toolbar-config.js +0 -45
- package/dist/_pkgs/affine-gfx-ddd/effects.d.ts +0 -17
- package/dist/_pkgs/affine-gfx-ddd/effects.js +0 -21
- package/dist/_pkgs/affine-gfx-ddd/index.d.ts +0 -2
- package/dist/_pkgs/affine-gfx-ddd/index.js +0 -2
- package/dist/_pkgs/affine-gfx-ddd/shared/consts.d.ts +0 -180
- package/dist/_pkgs/affine-gfx-ddd/shared/consts.js +0 -92
- package/dist/_pkgs/affine-gfx-ddd/shared/prefabs.d.ts +0 -71
- package/dist/_pkgs/affine-gfx-ddd/shared/prefabs.js +0 -214
- package/dist/_pkgs/affine-gfx-ddd/shared/utils.d.ts +0 -10
- package/dist/_pkgs/affine-gfx-ddd/shared/utils.js +0 -9
- package/dist/_pkgs/affine-gfx-ddd/templates/components.d.ts +0 -7
- package/dist/_pkgs/affine-gfx-ddd/templates/components.js +0 -158
- package/dist/_pkgs/affine-gfx-ddd/templates/index.d.ts +0 -11
- package/dist/_pkgs/affine-gfx-ddd/templates/index.js +0 -108
- package/dist/_pkgs/affine-gfx-ddd/toolbar/context-map-menu.d.ts +0 -10
- package/dist/_pkgs/affine-gfx-ddd/toolbar/context-map-menu.js +0 -109
- package/dist/_pkgs/affine-gfx-ddd/toolbar/core-domain-menu.d.ts +0 -11
- package/dist/_pkgs/affine-gfx-ddd/toolbar/core-domain-menu.js +0 -118
- package/dist/_pkgs/affine-gfx-ddd/toolbar/event-storming-menu.d.ts +0 -9
- package/dist/_pkgs/affine-gfx-ddd/toolbar/event-storming-menu.js +0 -78
- package/dist/_pkgs/affine-gfx-ddd/toolbar/icons.d.ts +0 -6
- package/dist/_pkgs/affine-gfx-ddd/toolbar/icons.js +0 -20
- package/dist/_pkgs/affine-gfx-ddd/toolbar/menu-base.d.ts +0 -23
- package/dist/_pkgs/affine-gfx-ddd/toolbar/menu-base.js +0 -62
- package/dist/_pkgs/affine-gfx-ddd/toolbar/senior-buttons.d.ts +0 -34
- package/dist/_pkgs/affine-gfx-ddd/toolbar/senior-buttons.js +0 -114
- package/dist/_pkgs/affine-gfx-ddd/toolbar/senior-tool.d.ts +0 -6
- package/dist/_pkgs/affine-gfx-ddd/toolbar/senior-tool.js +0 -23
- package/dist/_pkgs/affine-gfx-ddd/view.d.ts +0 -35
- package/dist/_pkgs/affine-gfx-ddd/view.js +0 -95
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export { aggregateTemplateCategory, contextMapTemplateCategory, coreDomainTemplateCategory, eventStormingTemplateCategory, } from './templates/index.js';
|
|
2
|
-
export { DddContextMapViewExtension, DddCoreDomainRenderViewExtension, DddCoreDomainViewExtension, DddEventStormingViewExtension, DddTemplatesViewExtension, } from './view.js';
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export { aggregateTemplateCategory, contextMapTemplateCategory, coreDomainTemplateCategory, eventStormingTemplateCategory, } from './templates/index.js';
|
|
2
|
-
export { DddContextMapViewExtension, DddCoreDomainRenderViewExtension, DddCoreDomainViewExtension, DddEventStormingViewExtension, DddTemplatesViewExtension, } from './view.js';
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared DDD palette and sizes. Every tool composes the same irreducible units
|
|
3
|
-
* (sticky, dot, bubble, connector, label) from these presets — no duplicated
|
|
4
|
-
* component definitions across the Event Storming / Context Map / Core Domain
|
|
5
|
-
* sub-menus.
|
|
6
|
-
*/
|
|
7
|
-
/** Square sticky side (px, canvas reference). */
|
|
8
|
-
export declare const STICKY_SIZE = 120;
|
|
9
|
-
/** Faux drop-shadow offset + colour (a plain offset rect behind the sticky). */
|
|
10
|
-
export declare const SHADOW_OFFSET = 7;
|
|
11
|
-
export declare const SHADOW_COLOR = "#0000002e";
|
|
12
|
-
/** Handwriting marker font, already shipped in the canvas font set. */
|
|
13
|
-
export declare const STICKY_FONT = "blocksuite:surface:Kalam";
|
|
14
|
-
export declare const STICKY_FONT_SIZE = 20;
|
|
15
|
-
export declare const STICKY_RADIUS = 6;
|
|
16
|
-
/** Event Storming sticky palette — DDD Crew / Brandolini colour code. */
|
|
17
|
-
export declare const ES_STICKIES: readonly [{
|
|
18
|
-
readonly kind: "domainEvent";
|
|
19
|
-
readonly label: "Domain event";
|
|
20
|
-
readonly fill: "#F5963B";
|
|
21
|
-
readonly text: "#5a3000";
|
|
22
|
-
}, {
|
|
23
|
-
readonly kind: "command";
|
|
24
|
-
readonly label: "Command";
|
|
25
|
-
readonly fill: "#5BA3DB";
|
|
26
|
-
readonly text: "#06304d";
|
|
27
|
-
}, {
|
|
28
|
-
readonly kind: "actor";
|
|
29
|
-
readonly label: "Actor";
|
|
30
|
-
readonly fill: "#FFF1A8";
|
|
31
|
-
readonly text: "#5a4b00";
|
|
32
|
-
}, {
|
|
33
|
-
readonly kind: "constraint";
|
|
34
|
-
readonly label: "Constraint";
|
|
35
|
-
readonly fill: "#FFD84D";
|
|
36
|
-
readonly text: "#5a4b00";
|
|
37
|
-
}, {
|
|
38
|
-
readonly kind: "policy";
|
|
39
|
-
readonly label: "Policy";
|
|
40
|
-
readonly fill: "#C9A8E0";
|
|
41
|
-
readonly text: "#3d1f57";
|
|
42
|
-
}, {
|
|
43
|
-
readonly kind: "readModel";
|
|
44
|
-
readonly label: "Read model";
|
|
45
|
-
readonly fill: "#7ED38A";
|
|
46
|
-
readonly text: "#14502a";
|
|
47
|
-
}, {
|
|
48
|
-
readonly kind: "system";
|
|
49
|
-
readonly label: "External system";
|
|
50
|
-
readonly fill: "#F6A6C0";
|
|
51
|
-
readonly text: "#5e1230";
|
|
52
|
-
}];
|
|
53
|
-
/** Hotspot — neon-pink diamond. */
|
|
54
|
-
export declare const ES_HOTSPOT: {
|
|
55
|
-
label: string;
|
|
56
|
-
fill: string;
|
|
57
|
-
text: string;
|
|
58
|
-
};
|
|
59
|
-
/** Context Map bounded-context bubble. */
|
|
60
|
-
export declare const CM_BUBBLE: {
|
|
61
|
-
fill: string;
|
|
62
|
-
stroke: string;
|
|
63
|
-
text: string;
|
|
64
|
-
w: number;
|
|
65
|
-
h: number;
|
|
66
|
-
radius: number;
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* Context Map relationship presets (DDD Crew notation). Each is the SAME
|
|
70
|
-
* connector unit + an abbreviation tag; `upDown` adds U/D markers (upstream →
|
|
71
|
-
* downstream); `dashed` marks the "no real integration" patterns (Separate
|
|
72
|
-
* Ways, Big Ball of Mud).
|
|
73
|
-
*/
|
|
74
|
-
export declare const CM_RELATIONSHIPS: readonly [{
|
|
75
|
-
readonly kind: "partnership";
|
|
76
|
-
readonly label: "Partnership";
|
|
77
|
-
readonly abbrev: "PS";
|
|
78
|
-
readonly upDown: false;
|
|
79
|
-
readonly dashed: false;
|
|
80
|
-
}, {
|
|
81
|
-
readonly kind: "sharedKernel";
|
|
82
|
-
readonly label: "Shared Kernel";
|
|
83
|
-
readonly abbrev: "SK";
|
|
84
|
-
readonly upDown: false;
|
|
85
|
-
readonly dashed: false;
|
|
86
|
-
}, {
|
|
87
|
-
readonly kind: "customerSupplier";
|
|
88
|
-
readonly label: "Customer / Supplier";
|
|
89
|
-
readonly abbrev: "C/S";
|
|
90
|
-
readonly upDown: true;
|
|
91
|
-
readonly dashed: false;
|
|
92
|
-
}, {
|
|
93
|
-
readonly kind: "conformist";
|
|
94
|
-
readonly label: "Conformist";
|
|
95
|
-
readonly abbrev: "CF";
|
|
96
|
-
readonly upDown: true;
|
|
97
|
-
readonly dashed: false;
|
|
98
|
-
}, {
|
|
99
|
-
readonly kind: "acl";
|
|
100
|
-
readonly label: "Anticorruption Layer";
|
|
101
|
-
readonly abbrev: "ACL";
|
|
102
|
-
readonly upDown: true;
|
|
103
|
-
readonly dashed: false;
|
|
104
|
-
}, {
|
|
105
|
-
readonly kind: "ohs";
|
|
106
|
-
readonly label: "Open Host Service";
|
|
107
|
-
readonly abbrev: "OHS";
|
|
108
|
-
readonly upDown: true;
|
|
109
|
-
readonly dashed: false;
|
|
110
|
-
}, {
|
|
111
|
-
readonly kind: "publishedLanguage";
|
|
112
|
-
readonly label: "Published Language";
|
|
113
|
-
readonly abbrev: "PL";
|
|
114
|
-
readonly upDown: true;
|
|
115
|
-
readonly dashed: false;
|
|
116
|
-
}, {
|
|
117
|
-
readonly kind: "separateWays";
|
|
118
|
-
readonly label: "Separate Ways";
|
|
119
|
-
readonly abbrev: "SW";
|
|
120
|
-
readonly upDown: false;
|
|
121
|
-
readonly dashed: true;
|
|
122
|
-
}, {
|
|
123
|
-
readonly kind: "bbom";
|
|
124
|
-
readonly label: "Big Ball of Mud";
|
|
125
|
-
readonly abbrev: "BBoM";
|
|
126
|
-
readonly upDown: false;
|
|
127
|
-
readonly dashed: true;
|
|
128
|
-
}];
|
|
129
|
-
export declare const CLOUD_VERTICES: number[][];
|
|
130
|
-
export declare const CLOUD: {
|
|
131
|
-
w: number;
|
|
132
|
-
h: number;
|
|
133
|
-
fill: string;
|
|
134
|
-
stroke: string;
|
|
135
|
-
};
|
|
136
|
-
/** Team Topologies interaction modes (placeable markers + Notation legend). */
|
|
137
|
-
export declare const TEAM_TOPOLOGIES: readonly [{
|
|
138
|
-
readonly kind: "collaboration";
|
|
139
|
-
readonly label: "Collaboration";
|
|
140
|
-
readonly letter: "C";
|
|
141
|
-
readonly fill: "#99ff99";
|
|
142
|
-
}, {
|
|
143
|
-
readonly kind: "xaas";
|
|
144
|
-
readonly label: "X-as-a-Service";
|
|
145
|
-
readonly letter: "X";
|
|
146
|
-
readonly fill: "#66b2ff";
|
|
147
|
-
}, {
|
|
148
|
-
readonly kind: "facilitating";
|
|
149
|
-
readonly label: "Facilitating";
|
|
150
|
-
readonly letter: "F";
|
|
151
|
-
readonly fill: "#ffd84d";
|
|
152
|
-
}];
|
|
153
|
-
export declare const MARKER_SIZE = 30;
|
|
154
|
-
/** Core Domain sub-domain / bounded-context dot presets (colours from template). */
|
|
155
|
-
export declare const CD_SUBDOMAINS: readonly [{
|
|
156
|
-
readonly kind: "bigBet";
|
|
157
|
-
readonly label: "Big-bet sub-domain";
|
|
158
|
-
readonly fill: "#9933ff";
|
|
159
|
-
}, {
|
|
160
|
-
readonly kind: "platform";
|
|
161
|
-
readonly label: "Platform sub-domain";
|
|
162
|
-
readonly fill: "#66b2ff";
|
|
163
|
-
}, {
|
|
164
|
-
readonly kind: "outsourced";
|
|
165
|
-
readonly label: "Outsourced / purchased";
|
|
166
|
-
readonly fill: "#99ff99";
|
|
167
|
-
}, {
|
|
168
|
-
readonly kind: "bcCurrent";
|
|
169
|
-
readonly label: "Bounded context";
|
|
170
|
-
readonly fill: "#ff3333";
|
|
171
|
-
}, {
|
|
172
|
-
readonly kind: "bcFuture";
|
|
173
|
-
readonly label: "Future position";
|
|
174
|
-
readonly fill: "#cccccc";
|
|
175
|
-
}];
|
|
176
|
-
export declare const DOT_SIZE = 26;
|
|
177
|
-
export declare const MOVEMENT_COLOR = "#ff3333";
|
|
178
|
-
export declare const LABEL_COLOR = "#1f2328";
|
|
179
|
-
export declare const LABEL_FONT = "blocksuite:surface:Inter";
|
|
180
|
-
export declare const LABEL_FONT_SIZE = 14;
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared DDD palette and sizes. Every tool composes the same irreducible units
|
|
3
|
-
* (sticky, dot, bubble, connector, label) from these presets — no duplicated
|
|
4
|
-
* component definitions across the Event Storming / Context Map / Core Domain
|
|
5
|
-
* sub-menus.
|
|
6
|
-
*/
|
|
7
|
-
/** Square sticky side (px, canvas reference). */
|
|
8
|
-
export const STICKY_SIZE = 120;
|
|
9
|
-
/** Faux drop-shadow offset + colour (a plain offset rect behind the sticky). */
|
|
10
|
-
export const SHADOW_OFFSET = 7;
|
|
11
|
-
export const SHADOW_COLOR = '#0000002e';
|
|
12
|
-
/** Handwriting marker font, already shipped in the canvas font set. */
|
|
13
|
-
export const STICKY_FONT = 'blocksuite:surface:Kalam';
|
|
14
|
-
export const STICKY_FONT_SIZE = 20;
|
|
15
|
-
export const STICKY_RADIUS = 6;
|
|
16
|
-
/** Event Storming sticky palette — DDD Crew / Brandolini colour code. */
|
|
17
|
-
export const ES_STICKIES = [
|
|
18
|
-
{ kind: 'domainEvent', label: 'Domain event', fill: '#F5963B', text: '#5a3000' },
|
|
19
|
-
{ kind: 'command', label: 'Command', fill: '#5BA3DB', text: '#06304d' },
|
|
20
|
-
{ kind: 'actor', label: 'Actor', fill: '#FFF1A8', text: '#5a4b00' },
|
|
21
|
-
{ kind: 'constraint', label: 'Constraint', fill: '#FFD84D', text: '#5a4b00' },
|
|
22
|
-
{ kind: 'policy', label: 'Policy', fill: '#C9A8E0', text: '#3d1f57' },
|
|
23
|
-
{ kind: 'readModel', label: 'Read model', fill: '#7ED38A', text: '#14502a' },
|
|
24
|
-
{ kind: 'system', label: 'External system', fill: '#F6A6C0', text: '#5e1230' },
|
|
25
|
-
];
|
|
26
|
-
/** Hotspot — neon-pink diamond. */
|
|
27
|
-
export const ES_HOTSPOT = { label: 'Hotspot', fill: '#FF1E8E', text: '#ffffff' };
|
|
28
|
-
/** Context Map bounded-context bubble. */
|
|
29
|
-
export const CM_BUBBLE = {
|
|
30
|
-
fill: '#e6f0fa',
|
|
31
|
-
stroke: '#2f6fb0',
|
|
32
|
-
text: '#06304d',
|
|
33
|
-
w: 150,
|
|
34
|
-
h: 70,
|
|
35
|
-
radius: 30,
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Context Map relationship presets (DDD Crew notation). Each is the SAME
|
|
39
|
-
* connector unit + an abbreviation tag; `upDown` adds U/D markers (upstream →
|
|
40
|
-
* downstream); `dashed` marks the "no real integration" patterns (Separate
|
|
41
|
-
* Ways, Big Ball of Mud).
|
|
42
|
-
*/
|
|
43
|
-
export const CM_RELATIONSHIPS = [
|
|
44
|
-
{ kind: 'partnership', label: 'Partnership', abbrev: 'PS', upDown: false, dashed: false },
|
|
45
|
-
{ kind: 'sharedKernel', label: 'Shared Kernel', abbrev: 'SK', upDown: false, dashed: false },
|
|
46
|
-
{ kind: 'customerSupplier', label: 'Customer / Supplier', abbrev: 'C/S', upDown: true, dashed: false },
|
|
47
|
-
{ kind: 'conformist', label: 'Conformist', abbrev: 'CF', upDown: true, dashed: false },
|
|
48
|
-
{ kind: 'acl', label: 'Anticorruption Layer', abbrev: 'ACL', upDown: true, dashed: false },
|
|
49
|
-
{ kind: 'ohs', label: 'Open Host Service', abbrev: 'OHS', upDown: true, dashed: false },
|
|
50
|
-
{ kind: 'publishedLanguage', label: 'Published Language', abbrev: 'PL', upDown: true, dashed: false },
|
|
51
|
-
{ kind: 'separateWays', label: 'Separate Ways', abbrev: 'SW', upDown: false, dashed: true },
|
|
52
|
-
{ kind: 'bbom', label: 'Big Ball of Mud', abbrev: 'BBoM', upDown: false, dashed: true },
|
|
53
|
-
];
|
|
54
|
-
/**
|
|
55
|
-
* Context Map cloud (Big Ball of Mud / general-purpose boundary). The canvas
|
|
56
|
-
* polygon renderer draws straight segments (it ignores `smoothFlags`), so the
|
|
57
|
-
* cloud is a DENSE lumpy closed outline — enough points that the lineTo edges
|
|
58
|
-
* read as smooth curves. Normalized [0-1] coordinates relative to the bound.
|
|
59
|
-
*/
|
|
60
|
-
function buildCloud() {
|
|
61
|
-
const N = 56;
|
|
62
|
-
const clamp = (v) => Math.min(0.98, Math.max(0.02, v));
|
|
63
|
-
const pts = [];
|
|
64
|
-
for (let i = 0; i < N; i++) {
|
|
65
|
-
const t = (i / N) * Math.PI * 2;
|
|
66
|
-
const r = 0.4 + 0.05 * Math.sin(6 * t) + 0.03 * Math.sin(3 * t + 0.8);
|
|
67
|
-
pts.push([clamp(0.5 + r * Math.cos(t)), clamp(0.5 + r * 0.6 * Math.sin(t))]);
|
|
68
|
-
}
|
|
69
|
-
return pts;
|
|
70
|
-
}
|
|
71
|
-
export const CLOUD_VERTICES = buildCloud();
|
|
72
|
-
export const CLOUD = { w: 180, h: 120, fill: '#f0eef6', stroke: '#6d6e71' };
|
|
73
|
-
/** Team Topologies interaction modes (placeable markers + Notation legend). */
|
|
74
|
-
export const TEAM_TOPOLOGIES = [
|
|
75
|
-
{ kind: 'collaboration', label: 'Collaboration', letter: 'C', fill: '#99ff99' },
|
|
76
|
-
{ kind: 'xaas', label: 'X-as-a-Service', letter: 'X', fill: '#66b2ff' },
|
|
77
|
-
{ kind: 'facilitating', label: 'Facilitating', letter: 'F', fill: '#ffd84d' },
|
|
78
|
-
];
|
|
79
|
-
export const MARKER_SIZE = 30;
|
|
80
|
-
/** Core Domain sub-domain / bounded-context dot presets (colours from template). */
|
|
81
|
-
export const CD_SUBDOMAINS = [
|
|
82
|
-
{ kind: 'bigBet', label: 'Big-bet sub-domain', fill: '#9933ff' },
|
|
83
|
-
{ kind: 'platform', label: 'Platform sub-domain', fill: '#66b2ff' },
|
|
84
|
-
{ kind: 'outsourced', label: 'Outsourced / purchased', fill: '#99ff99' },
|
|
85
|
-
{ kind: 'bcCurrent', label: 'Bounded context', fill: '#ff3333' },
|
|
86
|
-
{ kind: 'bcFuture', label: 'Future position', fill: '#cccccc' },
|
|
87
|
-
];
|
|
88
|
-
export const DOT_SIZE = 26;
|
|
89
|
-
export const MOVEMENT_COLOR = '#ff3333';
|
|
90
|
-
export const LABEL_COLOR = '#1f2328';
|
|
91
|
-
export const LABEL_FONT = 'blocksuite:surface:Inter';
|
|
92
|
-
export const LABEL_FONT_SIZE = 14;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import type { BlockStdScope } from '../../std/index.js';
|
|
2
|
-
import type { GfxController } from '../../std/gfx/index.js';
|
|
3
|
-
/**
|
|
4
|
-
* Irreducible reusable units composed by all three DDD sub-menus. Each helper
|
|
5
|
-
* wraps native `surface.addElement` (shape / text / connector / group); nothing
|
|
6
|
-
* here defines a new element type, so the same builders back Event Storming
|
|
7
|
-
* stickies, Context Map bubbles + relationships and Core Domain dots + arrows.
|
|
8
|
-
*/
|
|
9
|
-
type Surface = NonNullable<GfxController['surface']>;
|
|
10
|
-
/** Group several element ids; returns the group id (or the first id on failure). */
|
|
11
|
-
export declare function groupIds(std: BlockStdScope, ids: string[]): string;
|
|
12
|
-
/** A post-it: faux-shadow rect + coloured face + centred handwriting label, grouped. */
|
|
13
|
-
export declare function addSticky(surface: Surface, std: BlockStdScope, cx: number, cy: number, opts: {
|
|
14
|
-
fill: string;
|
|
15
|
-
text: string;
|
|
16
|
-
label: string;
|
|
17
|
-
shapeType?: 'rect' | 'diamond';
|
|
18
|
-
size?: number;
|
|
19
|
-
}): string;
|
|
20
|
-
/** A Context Map bounded-context bubble (rounded pill + centred label). */
|
|
21
|
-
export declare function addBubble(surface: Surface, std: BlockStdScope, cx: number, cy: number, label: string): string;
|
|
22
|
-
/** A Core Domain dot (sub-domain / bounded context); optional label to its right. */
|
|
23
|
-
export declare function addDot(surface: Surface, std: BlockStdScope, cx: number, cy: number, fill: string, label?: string): string;
|
|
24
|
-
/** A free-floating label. */
|
|
25
|
-
export declare function addLabel(surface: Surface, cx: number, cy: number, label: string, align?: 'left' | 'center', color?: string): string;
|
|
26
|
-
/** A relationship connector (the single connector unit reused for all patterns). */
|
|
27
|
-
export declare function addConnector(surface: Surface, x1: number, y1: number, x2: number, y2: number, opts?: {
|
|
28
|
-
rearArrow?: boolean;
|
|
29
|
-
dashed?: boolean;
|
|
30
|
-
stroke?: string;
|
|
31
|
-
strokeWidth?: number;
|
|
32
|
-
}): string;
|
|
33
|
-
/** A Team Topologies interaction-mode marker: a coloured square + centred letter. */
|
|
34
|
-
export declare function addMarker(surface: Surface, std: BlockStdScope, cx: number, cy: number, opts: {
|
|
35
|
-
fill: string;
|
|
36
|
-
letter: string;
|
|
37
|
-
label?: string;
|
|
38
|
-
}): string;
|
|
39
|
-
/** A cloud (Big Ball of Mud / general-purpose boundary): a smoothed closed bezier polygon. */
|
|
40
|
-
export declare function addCloud(surface: Surface, std: BlockStdScope, cx: number, cy: number, label?: string): string;
|
|
41
|
-
/**
|
|
42
|
-
* A Context Map relationship in DDD Crew notation: the connector, the pattern
|
|
43
|
-
* abbreviation in a small tag, and (for upstream/downstream patterns) the U / D
|
|
44
|
-
* markers — grouped so the whole pattern reads as one unit.
|
|
45
|
-
*/
|
|
46
|
-
export declare function addRelationship(surface: Surface, std: BlockStdScope, cx: number, cy: number, preset: {
|
|
47
|
-
abbrev: string;
|
|
48
|
-
upDown: boolean;
|
|
49
|
-
dashed: boolean;
|
|
50
|
-
}): string;
|
|
51
|
-
export interface LegendRow {
|
|
52
|
-
swatch: 'dot' | 'square' | 'line';
|
|
53
|
-
color: string;
|
|
54
|
-
letter?: string;
|
|
55
|
-
label: string;
|
|
56
|
-
}
|
|
57
|
-
export interface LegendSection {
|
|
58
|
-
title?: string;
|
|
59
|
-
rows: LegendRow[];
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* A boxed legend: a bordered container with a bold "Légende" title and bold
|
|
63
|
-
* section sub-titles, each row a swatch (dot / square+letter / line) + label.
|
|
64
|
-
* Shared by the Core Domain and Context Map tools. Returns the grouped id.
|
|
65
|
-
*/
|
|
66
|
-
export declare function addLegend(surface: Surface, std: BlockStdScope, x: number, y: number, opts: {
|
|
67
|
-
title: string;
|
|
68
|
-
sections: LegendSection[];
|
|
69
|
-
width?: number;
|
|
70
|
-
}): string;
|
|
71
|
-
export {};
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import { createGroupCommand } from '../../affine-gfx-group/index.js';
|
|
2
|
-
import { ConnectorMode, FontWeight, PointStyle, ShapeStyle, StrokeStyle, } from '../../affine-model/index.js';
|
|
3
|
-
import { Bound } from '../../global/gfx/index.js';
|
|
4
|
-
import { CLOUD, CLOUD_VERTICES, CM_BUBBLE, DOT_SIZE, LABEL_COLOR, LABEL_FONT, LABEL_FONT_SIZE, MARKER_SIZE, SHADOW_COLOR, SHADOW_OFFSET, STICKY_FONT, STICKY_FONT_SIZE, STICKY_RADIUS, STICKY_SIZE, } from './consts';
|
|
5
|
-
const NO_STROKE = '#00000000';
|
|
6
|
-
/** Group several element ids; returns the group id (or the first id on failure). */
|
|
7
|
-
export function groupIds(std, ids) {
|
|
8
|
-
const [, result] = std.command.exec(createGroupCommand, { elements: ids });
|
|
9
|
-
return result.groupId || ids[0];
|
|
10
|
-
}
|
|
11
|
-
function addShape(surface, x, y, w, h, opts) {
|
|
12
|
-
const { shapeType = 'rect', fill, stroke = NO_STROKE, strokeWidth = 0, radius = 0 } = opts;
|
|
13
|
-
return surface.addElement({
|
|
14
|
-
type: 'shape',
|
|
15
|
-
shapeType,
|
|
16
|
-
filled: true,
|
|
17
|
-
fillColor: fill,
|
|
18
|
-
strokeColor: stroke,
|
|
19
|
-
strokeWidth,
|
|
20
|
-
shapeStyle: ShapeStyle.General,
|
|
21
|
-
roughness: 0,
|
|
22
|
-
radius,
|
|
23
|
-
xywh: new Bound(x, y, w, h).serialize(),
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
function addText(surface, x, y, w, text, color, fontFamily, fontSize, textAlign = 'center', bold = false) {
|
|
27
|
-
return surface.addElement({
|
|
28
|
-
type: 'text',
|
|
29
|
-
text,
|
|
30
|
-
color,
|
|
31
|
-
fontFamily,
|
|
32
|
-
fontSize,
|
|
33
|
-
textAlign,
|
|
34
|
-
fontWeight: bold ? FontWeight.SemiBold : FontWeight.Regular,
|
|
35
|
-
xywh: new Bound(x, y, w, fontSize + 10).serialize(),
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
/** A post-it: faux-shadow rect + coloured face + centred handwriting label, grouped. */
|
|
39
|
-
export function addSticky(surface, std, cx, cy, opts) {
|
|
40
|
-
const { fill, text, label, shapeType = 'rect', size = STICKY_SIZE } = opts;
|
|
41
|
-
const half = size / 2;
|
|
42
|
-
const radius = shapeType === 'rect' ? STICKY_RADIUS : 0;
|
|
43
|
-
const shadow = addShape(surface, cx - half + SHADOW_OFFSET, cy - half + SHADOW_OFFSET, size, size, {
|
|
44
|
-
shapeType,
|
|
45
|
-
fill: SHADOW_COLOR,
|
|
46
|
-
radius,
|
|
47
|
-
});
|
|
48
|
-
const face = addShape(surface, cx - half, cy - half, size, size, { shapeType, fill, radius });
|
|
49
|
-
const lbl = addText(surface, cx - half + 10, cy - STICKY_FONT_SIZE / 2, size - 20, label, text, STICKY_FONT, STICKY_FONT_SIZE);
|
|
50
|
-
return groupIds(std, [shadow, face, lbl]);
|
|
51
|
-
}
|
|
52
|
-
/** A Context Map bounded-context bubble (rounded pill + centred label). */
|
|
53
|
-
export function addBubble(surface, std, cx, cy, label) {
|
|
54
|
-
const { w, h, radius, fill, stroke, text } = CM_BUBBLE;
|
|
55
|
-
const box = addShape(surface, cx - w / 2, cy - h / 2, w, h, {
|
|
56
|
-
fill,
|
|
57
|
-
stroke,
|
|
58
|
-
strokeWidth: 1.5,
|
|
59
|
-
radius,
|
|
60
|
-
});
|
|
61
|
-
const lbl = addText(surface, cx - w / 2 + 8, cy - LABEL_FONT_SIZE / 2, w - 16, label, text, LABEL_FONT, LABEL_FONT_SIZE);
|
|
62
|
-
return groupIds(std, [box, lbl]);
|
|
63
|
-
}
|
|
64
|
-
/** A Core Domain dot (sub-domain / bounded context); optional label to its right. */
|
|
65
|
-
export function addDot(surface, std, cx, cy, fill, label) {
|
|
66
|
-
const d = DOT_SIZE;
|
|
67
|
-
const dot = addShape(surface, cx - d / 2, cy - d / 2, d, d, {
|
|
68
|
-
shapeType: 'ellipse',
|
|
69
|
-
fill,
|
|
70
|
-
stroke: '#1f2328',
|
|
71
|
-
strokeWidth: 1.5,
|
|
72
|
-
});
|
|
73
|
-
if (!label)
|
|
74
|
-
return dot;
|
|
75
|
-
const lbl = addText(surface, cx + d / 2 + 6, cy - LABEL_FONT_SIZE / 2, 170, label, LABEL_COLOR, LABEL_FONT, LABEL_FONT_SIZE, 'left');
|
|
76
|
-
return groupIds(std, [dot, lbl]);
|
|
77
|
-
}
|
|
78
|
-
/** A free-floating label. */
|
|
79
|
-
export function addLabel(surface, cx, cy, label, align = 'center', color = LABEL_COLOR) {
|
|
80
|
-
return addText(surface, cx, cy, 200, label, color, LABEL_FONT, LABEL_FONT_SIZE, align);
|
|
81
|
-
}
|
|
82
|
-
/** A relationship connector (the single connector unit reused for all patterns). */
|
|
83
|
-
export function addConnector(surface, x1, y1, x2, y2, opts = {}) {
|
|
84
|
-
const { rearArrow = false, dashed = false, stroke = LABEL_COLOR, strokeWidth = 2 } = opts;
|
|
85
|
-
return surface.addElement({
|
|
86
|
-
type: 'connector',
|
|
87
|
-
mode: ConnectorMode.Straight,
|
|
88
|
-
stroke,
|
|
89
|
-
strokeWidth,
|
|
90
|
-
strokeStyle: dashed ? StrokeStyle.Dash : StrokeStyle.Solid,
|
|
91
|
-
frontEndpointStyle: PointStyle.None,
|
|
92
|
-
rearEndpointStyle: rearArrow ? PointStyle.Arrow : PointStyle.None,
|
|
93
|
-
source: { position: [x1, y1] },
|
|
94
|
-
target: { position: [x2, y2] },
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
/** A Team Topologies interaction-mode marker: a coloured square + centred letter. */
|
|
98
|
-
export function addMarker(surface, std, cx, cy, opts) {
|
|
99
|
-
const { fill, letter, label } = opts;
|
|
100
|
-
const s = MARKER_SIZE;
|
|
101
|
-
const box = addShape(surface, cx - s / 2, cy - s / 2, s, s, {
|
|
102
|
-
fill,
|
|
103
|
-
stroke: '#1f2328',
|
|
104
|
-
strokeWidth: 1.5,
|
|
105
|
-
radius: 4,
|
|
106
|
-
});
|
|
107
|
-
const glyph = addText(surface, cx - s / 2, cy - 9, s, letter, '#1f2328', LABEL_FONT, 15);
|
|
108
|
-
const ids = [box, glyph];
|
|
109
|
-
if (label) {
|
|
110
|
-
ids.push(addText(surface, cx + s / 2 + 6, cy - LABEL_FONT_SIZE / 2, 150, label, LABEL_COLOR, LABEL_FONT, LABEL_FONT_SIZE, 'left'));
|
|
111
|
-
}
|
|
112
|
-
return groupIds(std, ids);
|
|
113
|
-
}
|
|
114
|
-
/** A cloud (Big Ball of Mud / general-purpose boundary): a smoothed closed bezier polygon. */
|
|
115
|
-
export function addCloud(surface, std, cx, cy, label) {
|
|
116
|
-
const { w, h, fill, stroke } = CLOUD;
|
|
117
|
-
const cloud = surface.addElement({
|
|
118
|
-
type: 'shape',
|
|
119
|
-
shapeType: 'polygon',
|
|
120
|
-
vertices: CLOUD_VERTICES,
|
|
121
|
-
isClosed: true,
|
|
122
|
-
filled: true,
|
|
123
|
-
fillColor: fill,
|
|
124
|
-
strokeColor: stroke,
|
|
125
|
-
strokeWidth: 1.5,
|
|
126
|
-
shapeStyle: ShapeStyle.General,
|
|
127
|
-
roughness: 0,
|
|
128
|
-
xywh: new Bound(cx - w / 2, cy - h / 2, w, h).serialize(),
|
|
129
|
-
});
|
|
130
|
-
if (!label)
|
|
131
|
-
return cloud;
|
|
132
|
-
const lbl = addText(surface, cx - w / 2 + 12, cy - LABEL_FONT_SIZE / 2, w - 24, label, '#3d3d3d', LABEL_FONT, LABEL_FONT_SIZE);
|
|
133
|
-
return groupIds(std, [cloud, lbl]);
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* A Context Map relationship in DDD Crew notation: the connector, the pattern
|
|
137
|
-
* abbreviation in a small tag, and (for upstream/downstream patterns) the U / D
|
|
138
|
-
* markers — grouped so the whole pattern reads as one unit.
|
|
139
|
-
*/
|
|
140
|
-
export function addRelationship(surface, std, cx, cy, preset) {
|
|
141
|
-
const conn = addConnector(surface, cx - 130, cy, cx + 130, cy, {
|
|
142
|
-
rearArrow: preset.upDown,
|
|
143
|
-
dashed: preset.dashed,
|
|
144
|
-
});
|
|
145
|
-
const tag = addShape(surface, cx - 26, cy - 42, 52, 24, {
|
|
146
|
-
fill: '#ffffff',
|
|
147
|
-
stroke: '#6d6e71',
|
|
148
|
-
strokeWidth: 1,
|
|
149
|
-
radius: 4,
|
|
150
|
-
});
|
|
151
|
-
const tagText = addText(surface, cx - 26, cy - 36, 52, preset.abbrev, LABEL_COLOR, LABEL_FONT, 13);
|
|
152
|
-
const ids = [conn, tag, tagText];
|
|
153
|
-
if (preset.upDown) {
|
|
154
|
-
ids.push(addText(surface, cx - 150, cy - 30, 24, 'U', LABEL_COLOR, LABEL_FONT, 13));
|
|
155
|
-
ids.push(addText(surface, cx + 126, cy - 30, 24, 'D', LABEL_COLOR, LABEL_FONT, 13));
|
|
156
|
-
}
|
|
157
|
-
return groupIds(std, ids);
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* A boxed legend: a bordered container with a bold "Légende" title and bold
|
|
161
|
-
* section sub-titles, each row a swatch (dot / square+letter / line) + label.
|
|
162
|
-
* Shared by the Core Domain and Context Map tools. Returns the grouped id.
|
|
163
|
-
*/
|
|
164
|
-
export function addLegend(surface, std, x, y, opts) {
|
|
165
|
-
const W = opts.width ?? 260;
|
|
166
|
-
const PAD = 16;
|
|
167
|
-
const TITLE_H = 32;
|
|
168
|
-
const SUB_H = 26;
|
|
169
|
-
const ROW_H = 28;
|
|
170
|
-
const SW = 16;
|
|
171
|
-
let subs = 0;
|
|
172
|
-
let rows = 0;
|
|
173
|
-
for (const s of opts.sections) {
|
|
174
|
-
if (s.title)
|
|
175
|
-
subs++;
|
|
176
|
-
rows += s.rows.length;
|
|
177
|
-
}
|
|
178
|
-
const H = PAD * 2 + TITLE_H + subs * SUB_H + rows * ROW_H;
|
|
179
|
-
const ids = [
|
|
180
|
-
addShape(surface, x, y, W, H, {
|
|
181
|
-
fill: '#ffffff',
|
|
182
|
-
stroke: '#6d6e71',
|
|
183
|
-
strokeWidth: 1.5,
|
|
184
|
-
radius: 8,
|
|
185
|
-
}),
|
|
186
|
-
];
|
|
187
|
-
let cy = y + PAD;
|
|
188
|
-
ids.push(addText(surface, x + PAD, cy, W - PAD * 2, opts.title, LABEL_COLOR, LABEL_FONT, 18, 'left', true));
|
|
189
|
-
cy += TITLE_H;
|
|
190
|
-
for (const sec of opts.sections) {
|
|
191
|
-
if (sec.title) {
|
|
192
|
-
ids.push(addText(surface, x + PAD, cy, W - PAD * 2, sec.title, LABEL_COLOR, LABEL_FONT, 14, 'left', true));
|
|
193
|
-
cy += SUB_H;
|
|
194
|
-
}
|
|
195
|
-
for (const row of sec.rows) {
|
|
196
|
-
const sx = x + PAD;
|
|
197
|
-
const midY = cy + ROW_H / 2;
|
|
198
|
-
if (row.swatch === 'dot') {
|
|
199
|
-
ids.push(addShape(surface, sx, midY - SW / 2, SW, SW, { shapeType: 'ellipse', fill: row.color, stroke: '#1f2328', strokeWidth: 1 }));
|
|
200
|
-
}
|
|
201
|
-
else if (row.swatch === 'square') {
|
|
202
|
-
ids.push(addShape(surface, sx, midY - SW / 2, SW, SW, { fill: row.color, stroke: '#1f2328', strokeWidth: 1, radius: 3 }));
|
|
203
|
-
if (row.letter)
|
|
204
|
-
ids.push(addText(surface, sx, midY - 8, SW, row.letter, '#1f2328', LABEL_FONT, 11));
|
|
205
|
-
}
|
|
206
|
-
else {
|
|
207
|
-
ids.push(addShape(surface, sx, midY - 2, SW, 4, { fill: row.color, radius: 1 }));
|
|
208
|
-
}
|
|
209
|
-
ids.push(addText(surface, sx + SW + 10, midY - LABEL_FONT_SIZE / 2, W - PAD * 2 - SW - 10, row.label, LABEL_COLOR, LABEL_FONT, 13, 'left'));
|
|
210
|
-
cy += ROW_H;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
return groupIds(std, ids);
|
|
214
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Uniform fit of a fixed reference design (`refW × refH`) into an element of
|
|
3
|
-
* size `w × h`: scale factor + centring offsets (letterboxed), undistorted.
|
|
4
|
-
*/
|
|
5
|
-
export declare function refScale(w: number, h: number, refW: number, refH: number): {
|
|
6
|
-
s: number;
|
|
7
|
-
ox: number;
|
|
8
|
-
oy: number;
|
|
9
|
-
};
|
|
10
|
-
export declare const FONT_FAMILY = "Inter, sans-serif";
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Uniform fit of a fixed reference design (`refW × refH`) into an element of
|
|
3
|
-
* size `w × h`: scale factor + centring offsets (letterboxed), undistorted.
|
|
4
|
-
*/
|
|
5
|
-
export function refScale(w, h, refW, refH) {
|
|
6
|
-
const s = Math.min(w / refW, h / refH);
|
|
7
|
-
return { s, ox: (w - refW * s) / 2, oy: (h - refH * s) / 2 };
|
|
8
|
-
}
|
|
9
|
-
export const FONT_FAMILY = 'Inter, sans-serif';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type Template } from '../../affine-gfx-template/index.js';
|
|
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[];
|