@formicoidea/labre-framework-ddd-core-domain 0.59.0 → 0.61.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/actions.js +12 -18
- package/dist/core-domain/background.js +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/interchange-headless.d.ts +10 -0
- package/dist/interchange-headless.js +10 -0
- package/dist/roles.d.ts +1 -1
- package/dist/roles.js +1 -1
- package/dist/toolbox.d.ts +36 -0
- package/dist/toolbox.js +135 -0
- package/package.json +7 -3
package/dist/actions.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { backgroundSize } from '@formicoidea/labre-core/blocks/surface';
|
|
2
2
|
import { ConnectorTool } from '@formicoidea/labre-core/gfx/connector';
|
|
3
|
-
import {
|
|
4
|
-
import { ConnectorMode, PointStyle, StrokeStyle } from '@formicoidea/labre-core/model';
|
|
5
|
-
import { Bound } from '@formicoidea/labre-core/global/gfx';
|
|
3
|
+
import { ConnectorMode } from '@formicoidea/labre-core/model';
|
|
6
4
|
import { GfxControllerIdentifier } from '@formicoidea/labre-core/std/gfx';
|
|
7
5
|
import { CORE_DOMAIN_BACKGROUND } from './core-domain/background.js';
|
|
8
6
|
import { CORE_DOMAIN_ROLE } from './roles.js';
|
|
9
|
-
|
|
10
|
-
const MOVEMENT_STROKE_WIDTH = 2;
|
|
7
|
+
import { coreDomainChartElement, coreDomainMovementStyle } from './toolbox.js';
|
|
11
8
|
/**
|
|
12
9
|
* Post a Core Domain Chart background, centred on `(cx, cy)`.
|
|
13
10
|
*
|
|
@@ -19,12 +16,13 @@ const MOVEMENT_STROKE_WIDTH = 2;
|
|
|
19
16
|
*/
|
|
20
17
|
export function createCoreDomainChart(surface, cx, cy) {
|
|
21
18
|
const { width, height } = backgroundSize(CORE_DOMAIN_BACKGROUND);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
// The chart's props come from the toolbox (`docs/adr/0045`), the one
|
|
20
|
+
// assembly a host with no editor also calls; the centre is the caller's.
|
|
21
|
+
const { id: _local, ...props } = coreDomainChartElement({
|
|
22
|
+
x: cx - width / 2,
|
|
23
|
+
y: cy - height / 2,
|
|
27
24
|
});
|
|
25
|
+
return surface.addElement(props);
|
|
28
26
|
}
|
|
29
27
|
/**
|
|
30
28
|
* Activate the native connector tool, pre-styled for a movement over time
|
|
@@ -46,13 +44,9 @@ export function activateMovement(std) {
|
|
|
46
44
|
mode: ConnectorMode.Straight,
|
|
47
45
|
role: CORE_DOMAIN_ROLE.movement,
|
|
48
46
|
// The look rides on the activation, never through the last-props store:
|
|
49
|
-
// the plain connector tool must keep the user's own style (#144 M1).
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
strokeWidth: MOVEMENT_STROKE_WIDTH,
|
|
54
|
-
frontEndpointStyle: PointStyle.None,
|
|
55
|
-
rearEndpointStyle: PointStyle.Arrow,
|
|
56
|
-
},
|
|
47
|
+
// the plain connector tool must keep the user's own style (#144 M1). It is
|
|
48
|
+
// the toolbox's (`coreDomainMovementStyle`, `docs/adr/0045`), so a
|
|
49
|
+
// movement drawn here and one built by a host look the same.
|
|
50
|
+
style: coreDomainMovementStyle(),
|
|
57
51
|
});
|
|
58
52
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CD_SUBDOMAINS, FONT_FAMILY } from '@formicoidea/labre-ddd-shared';
|
|
2
|
-
import { NOTATION_NEUTRALS } from '@formicoidea/labre-core/shared/
|
|
1
|
+
import { CD_SUBDOMAINS, FONT_FAMILY, } from '@formicoidea/labre-ddd-shared/headless';
|
|
2
|
+
import { NOTATION_NEUTRALS } from '@formicoidea/labre-core/shared/headless';
|
|
3
3
|
import { CORE_DOMAIN_ROLE } from '../roles.js';
|
|
4
4
|
/**
|
|
5
5
|
* The Core Domain Chart background, DECLARED.
|
package/dist/index.d.ts
CHANGED
|
@@ -13,3 +13,4 @@ export { coreDomainSeniorTool } from './toolbar/senior-tool.js';
|
|
|
13
13
|
export { EdgelessDddCoreDomainSeniorButton } from './toolbar/senior-button.js';
|
|
14
14
|
export { DddCoreDomainRenderViewExtension, DddCoreDomainViewExtension, } from './view.js';
|
|
15
15
|
export { CORE_DOMAIN_MARKER_READING, CORE_DOMAIN_READING, CORE_DOMAIN_READINGS, } from './reading.js';
|
|
16
|
+
export { CORE_DOMAIN_TOOLBOX, coreDomainChartElement, coreDomainMarkerElements, coreDomainMovementElement, coreDomainMovementStyle, coreDomainSubdomainElements, } from './toolbox.js';
|
package/dist/index.js
CHANGED
|
@@ -16,3 +16,5 @@ export { coreDomainSeniorTool } from './toolbar/senior-tool.js';
|
|
|
16
16
|
export { EdgelessDddCoreDomainSeniorButton } from './toolbar/senior-button.js';
|
|
17
17
|
export { DddCoreDomainRenderViewExtension, DddCoreDomainViewExtension, } from './view.js';
|
|
18
18
|
export { CORE_DOMAIN_MARKER_READING, CORE_DOMAIN_READING, CORE_DOMAIN_READINGS, } from './reading.js';
|
|
19
|
+
// The toolbar as pure builders (`docs/adr/0045`), also on `./interchange`.
|
|
20
|
+
export { CORE_DOMAIN_TOOLBOX, coreDomainChartElement, coreDomainMarkerElements, coreDomainMovementElement, coreDomainMovementStyle, coreDomainSubdomainElements, } from './toolbox.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `./interchange` — the Core Domain Chart with no editor behind it (ADR 0012,
|
|
3
|
+
* P3 as amended 2026-10-14): its toolbar as pure builders (`docs/adr/0045`),
|
|
4
|
+
* so a host with no editor (the Labre workspace connector, labre-mcp) places
|
|
5
|
+
* the very chart, sub-domain dots, Team Topologies markers and movements a
|
|
6
|
+
* user places from the toolbar. Held by `interchange-headless.unit.spec.ts` in
|
|
7
|
+
* `packages/affine/all`, which bundles this entry and fails on any editor
|
|
8
|
+
* module in its graph.
|
|
9
|
+
*/
|
|
10
|
+
export { CORE_DOMAIN_TOOLBOX, coreDomainChartElement, coreDomainMarkerElements, coreDomainMovementElement, coreDomainMovementStyle, coreDomainSubdomainElements, } from './toolbox.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `./interchange` — the Core Domain Chart with no editor behind it (ADR 0012,
|
|
3
|
+
* P3 as amended 2026-10-14): its toolbar as pure builders (`docs/adr/0045`),
|
|
4
|
+
* so a host with no editor (the Labre workspace connector, labre-mcp) places
|
|
5
|
+
* the very chart, sub-domain dots, Team Topologies markers and movements a
|
|
6
|
+
* user places from the toolbar. Held by `interchange-headless.unit.spec.ts` in
|
|
7
|
+
* `packages/affine/all`, which bundles this entry and fails on any editor
|
|
8
|
+
* module in its graph.
|
|
9
|
+
*/
|
|
10
|
+
export { CORE_DOMAIN_TOOLBOX, coreDomainChartElement, coreDomainMarkerElements, coreDomainMovementElement, coreDomainMovementStyle, coreDomainSubdomainElements, } from './toolbox.js';
|
package/dist/roles.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CD_SUBDOMAINS, TEAM_TOPOLOGIES } from '@formicoidea/labre-ddd-shared';
|
|
1
|
+
import { CD_SUBDOMAINS, TEAM_TOPOLOGIES } from '@formicoidea/labre-ddd-shared/headless';
|
|
2
2
|
import type { RoleDefs, RoleId } from '@formicoidea/labre-core/std/gfx';
|
|
3
3
|
/**
|
|
4
4
|
* The five dot presets' own `kind`, read off the shared table rather than
|
package/dist/roles.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CD_SUBDOMAINS, TEAM_TOPOLOGIES } from '@formicoidea/labre-ddd-shared';
|
|
1
|
+
import { CD_SUBDOMAINS, TEAM_TOPOLOGIES, } from '@formicoidea/labre-ddd-shared/headless';
|
|
2
2
|
/**
|
|
3
3
|
* Role ids, keyed by the `kind` the creation sites use — camelCased, exactly
|
|
4
4
|
* like `CD_SUBDOMAINS[].kind`, so `commands.ts` can hand a preset's own kind
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type FrameworkToolbox, type SerializedElementProps, type ToolboxPoint } from '@formicoidea/labre-core/interchange';
|
|
2
|
+
import { PointStyle, StrokeStyle } from '@formicoidea/labre-core/model/headless';
|
|
3
|
+
import { type CdMarkerKind, type CdSubdomainKind } from './roles.js';
|
|
4
|
+
/**
|
|
5
|
+
* How a movement is drawn: a red dashed line, the arrow at the far end. The
|
|
6
|
+
* look rides on the connector, the meaning is `core-domain:movement`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function coreDomainMovementStyle(): {
|
|
9
|
+
stroke: string;
|
|
10
|
+
strokeStyle: StrokeStyle;
|
|
11
|
+
strokeWidth: number;
|
|
12
|
+
frontEndpointStyle: PointStyle;
|
|
13
|
+
rearEndpointStyle: PointStyle;
|
|
14
|
+
};
|
|
15
|
+
/** The chart a core domain map is drawn on, at `at`. */
|
|
16
|
+
export declare function coreDomainChartElement(at: ToolboxPoint, local?: string): SerializedElementProps;
|
|
17
|
+
/**
|
|
18
|
+
* A sub-domain dot of one preset whose ellipse is at `at`, captioned `name` or
|
|
19
|
+
* the toolbar's English seed: the ellipse carrying the preset's role, the
|
|
20
|
+
* caption to its right and their group.
|
|
21
|
+
*/
|
|
22
|
+
export declare function coreDomainSubdomainElements(kind: CdSubdomainKind, at: ToolboxPoint, name?: string, local?: string): SerializedElementProps[];
|
|
23
|
+
/**
|
|
24
|
+
* A Team Topologies marker of one interaction mode whose square is at `at`,
|
|
25
|
+
* captioned `name` or the toolbar's English seed: the square carrying the
|
|
26
|
+
* mode's role, its letter, the caption and their group.
|
|
27
|
+
*/
|
|
28
|
+
export declare function coreDomainMarkerElements(kind: CdMarkerKind, at: ToolboxPoint, name?: string, local?: string): SerializedElementProps[];
|
|
29
|
+
/**
|
|
30
|
+
* A movement over time between two elements: the connector the palette's
|
|
31
|
+
* entry arms the tool with. Its source is the current position, its target
|
|
32
|
+
* the future one, the pair `core-domain.malformed-movement` reads back.
|
|
33
|
+
*/
|
|
34
|
+
export declare function coreDomainMovementElement(from: string, to: string, label?: string): SerializedElementProps;
|
|
35
|
+
/** Every item of the Core Domain Chart toolbar, in the toolbar's order. */
|
|
36
|
+
export declare const CORE_DOMAIN_TOOLBOX: FrameworkToolbox;
|
package/dist/toolbox.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { backgroundSize, } from '@formicoidea/labre-core/interchange';
|
|
2
|
+
import { CD_SUBDOMAINS, DOT_SIZE, dotElements, MARKER_SIZE, markerElements, MOVEMENT_COLOR, TEAM_TOPOLOGIES, } from '@formicoidea/labre-ddd-shared/headless';
|
|
3
|
+
import { ConnectorMode, PointStyle, StrokeStyle, } from '@formicoidea/labre-core/model/headless';
|
|
4
|
+
import { Bound } from '@formicoidea/labre-core/global/gfx';
|
|
5
|
+
import { coreDomainCommandsManifest } from './commands-manifest.js';
|
|
6
|
+
import { CORE_DOMAIN_BACKGROUND } from './core-domain/background.js';
|
|
7
|
+
import { CORE_DOMAIN_ROLE, markerRole, subdomainRole, } from './roles.js';
|
|
8
|
+
/**
|
|
9
|
+
* The Core Domain Chart toolbar as pure builders (`docs/adr/0045`): the chart,
|
|
10
|
+
* the five sub-domain dots, the three Team Topologies markers and the movement
|
|
11
|
+
* over time, with no editor behind them. The dots and the markers are the very
|
|
12
|
+
* builders the palette's prefabs write (`@labre/affine-gfx-ddd-shared/headless`),
|
|
13
|
+
* and `createCoreDomainChart` and `activateMovement` read the chart and the
|
|
14
|
+
* movement style from here, so a dot drawn by a host and one placed from the
|
|
15
|
+
* toolbar are the same element.
|
|
16
|
+
*/
|
|
17
|
+
/** The stroke width the movement arrow has always been drawn at. */
|
|
18
|
+
const MOVEMENT_STROKE_WIDTH = 2;
|
|
19
|
+
/**
|
|
20
|
+
* How a movement is drawn: a red dashed line, the arrow at the far end. The
|
|
21
|
+
* look rides on the connector, the meaning is `core-domain:movement`.
|
|
22
|
+
*/
|
|
23
|
+
export function coreDomainMovementStyle() {
|
|
24
|
+
return {
|
|
25
|
+
stroke: MOVEMENT_COLOR,
|
|
26
|
+
strokeStyle: StrokeStyle.Dash,
|
|
27
|
+
strokeWidth: MOVEMENT_STROKE_WIDTH,
|
|
28
|
+
frontEndpointStyle: PointStyle.None,
|
|
29
|
+
rearEndpointStyle: PointStyle.Arrow,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/** The chart a core domain map is drawn on, at `at`. */
|
|
33
|
+
export function coreDomainChartElement(at, local = 'chart') {
|
|
34
|
+
const { width, height } = backgroundSize(CORE_DOMAIN_BACKGROUND);
|
|
35
|
+
return {
|
|
36
|
+
type: CORE_DOMAIN_BACKGROUND.type,
|
|
37
|
+
id: local,
|
|
38
|
+
// The chart is a first-class role: rules position artefacts against
|
|
39
|
+
// `core-domain:chart`, never against the `coreDomain` element type.
|
|
40
|
+
role: CORE_DOMAIN_BACKGROUND.role,
|
|
41
|
+
resizeEnabled: CORE_DOMAIN_BACKGROUND.geometry.resizable,
|
|
42
|
+
xywh: new Bound(at.x, at.y, width, height).serialize(),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const kebab = (kind) => kind.replace(/[A-Z]/g, letter => `-${letter.toLowerCase()}`);
|
|
46
|
+
/**
|
|
47
|
+
* A sub-domain dot of one preset whose ellipse is at `at`, captioned `name` or
|
|
48
|
+
* the toolbar's English seed: the ellipse carrying the preset's role, the
|
|
49
|
+
* caption to its right and their group.
|
|
50
|
+
*/
|
|
51
|
+
export function coreDomainSubdomainElements(kind, at, name, local = kebab(kind)) {
|
|
52
|
+
const preset = CD_SUBDOMAINS.find(p => p.kind === kind);
|
|
53
|
+
if (!preset)
|
|
54
|
+
return [];
|
|
55
|
+
return dotElements(at, preset.fill, name?.trim() || preset.label, subdomainRole(kind), local);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A Team Topologies marker of one interaction mode whose square is at `at`,
|
|
59
|
+
* captioned `name` or the toolbar's English seed: the square carrying the
|
|
60
|
+
* mode's role, its letter, the caption and their group.
|
|
61
|
+
*/
|
|
62
|
+
export function coreDomainMarkerElements(kind, at, name, local = kebab(kind)) {
|
|
63
|
+
const preset = TEAM_TOPOLOGIES.find(p => p.kind === kind);
|
|
64
|
+
if (!preset)
|
|
65
|
+
return [];
|
|
66
|
+
return markerElements(at, {
|
|
67
|
+
fill: preset.fill,
|
|
68
|
+
letter: preset.letter,
|
|
69
|
+
label: name?.trim() || preset.label,
|
|
70
|
+
role: markerRole(kind),
|
|
71
|
+
}, local);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A movement over time between two elements: the connector the palette's
|
|
75
|
+
* entry arms the tool with. Its source is the current position, its target
|
|
76
|
+
* the future one, the pair `core-domain.malformed-movement` reads back.
|
|
77
|
+
*/
|
|
78
|
+
export function coreDomainMovementElement(from, to, label) {
|
|
79
|
+
return {
|
|
80
|
+
type: 'connector',
|
|
81
|
+
role: CORE_DOMAIN_ROLE.movement,
|
|
82
|
+
mode: ConnectorMode.Straight,
|
|
83
|
+
...coreDomainMovementStyle(),
|
|
84
|
+
source: { id: from },
|
|
85
|
+
target: { id: to },
|
|
86
|
+
...(label?.trim() ? { text: label.trim() } : {}),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/** The toolbar command's label, so a host names an item as the toolbar does. */
|
|
90
|
+
function label(command) {
|
|
91
|
+
const id = `ddd-core-domain.${command}`;
|
|
92
|
+
const row = coreDomainCommandsManifest.find(r => r.id === id);
|
|
93
|
+
return {
|
|
94
|
+
labelKey: row?.labelKey ?? id,
|
|
95
|
+
labelFallback: row?.labelFallback ?? id,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
const command = (kind) => `add${kind[0]?.toUpperCase()}${kind.slice(1)}`;
|
|
99
|
+
const subdomain = (kind) => ({
|
|
100
|
+
id: kebab(kind),
|
|
101
|
+
...label(command(kind)),
|
|
102
|
+
texts: ['name'],
|
|
103
|
+
size: { w: DOT_SIZE, h: DOT_SIZE },
|
|
104
|
+
build: (at, texts, local) => coreDomainSubdomainElements(kind, at, texts?.name, local),
|
|
105
|
+
});
|
|
106
|
+
const marker = (kind) => ({
|
|
107
|
+
id: kebab(kind),
|
|
108
|
+
...label(command(kind)),
|
|
109
|
+
texts: ['name'],
|
|
110
|
+
size: { w: MARKER_SIZE, h: MARKER_SIZE },
|
|
111
|
+
build: (at, texts, local) => coreDomainMarkerElements(kind, at, texts?.name, local),
|
|
112
|
+
});
|
|
113
|
+
const CHART_SIZE = backgroundSize(CORE_DOMAIN_BACKGROUND);
|
|
114
|
+
/** Every item of the Core Domain Chart toolbar, in the toolbar's order. */
|
|
115
|
+
export const CORE_DOMAIN_TOOLBOX = {
|
|
116
|
+
framework: 'ddd-core-domain',
|
|
117
|
+
items: [
|
|
118
|
+
{
|
|
119
|
+
id: 'chart',
|
|
120
|
+
...label('addChart'),
|
|
121
|
+
texts: [],
|
|
122
|
+
size: { w: CHART_SIZE.width, h: CHART_SIZE.height },
|
|
123
|
+
build: (at, _texts, local) => [coreDomainChartElement(at, local)],
|
|
124
|
+
},
|
|
125
|
+
...CD_SUBDOMAINS.map(preset => subdomain(preset.kind)),
|
|
126
|
+
...TEAM_TOPOLOGIES.map(preset => marker(preset.kind)),
|
|
127
|
+
],
|
|
128
|
+
links: [
|
|
129
|
+
{
|
|
130
|
+
id: 'movement',
|
|
131
|
+
...label('addMovement'),
|
|
132
|
+
build: (from, to, text) => coreDomainMovementElement(from, to, text),
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formicoidea/labre-framework-ddd-core-domain",
|
|
3
3
|
"description": "Labre ddd-core-domain framework for @formicoidea/labre-core.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.61.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"author": "lajola",
|
|
@@ -25,14 +25,18 @@
|
|
|
25
25
|
"./commands-manifest": {
|
|
26
26
|
"types": "./dist/commands-manifest.d.ts",
|
|
27
27
|
"import": "./dist/commands-manifest.js"
|
|
28
|
+
},
|
|
29
|
+
"./interchange": {
|
|
30
|
+
"types": "./dist/interchange-headless.d.ts",
|
|
31
|
+
"import": "./dist/interchange-headless.js"
|
|
28
32
|
}
|
|
29
33
|
},
|
|
30
34
|
"files": [
|
|
31
35
|
"dist"
|
|
32
36
|
],
|
|
33
37
|
"dependencies": {
|
|
34
|
-
"@formicoidea/labre-core": "0.
|
|
35
|
-
"@formicoidea/labre-ddd-shared": "0.
|
|
38
|
+
"@formicoidea/labre-core": "0.61.0",
|
|
39
|
+
"@formicoidea/labre-ddd-shared": "0.61.0",
|
|
36
40
|
"lit": "^3.2.0"
|
|
37
41
|
}
|
|
38
42
|
}
|