@formicoidea/labre-framework-ddd-aggregate 0.25.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.
@@ -0,0 +1,7 @@
1
+ import { DddTemplatesViewExtension } from './view.js';
2
+ /** Host wiring for the ddd-aggregate framework. */
3
+ export declare const dddAggregateFramework: {
4
+ readonly flag: "ddd-templates";
5
+ readonly telemetry: "ddd-aggregate";
6
+ readonly viewExtension: typeof DddTemplatesViewExtension;
7
+ };
@@ -0,0 +1,7 @@
1
+ import { DddTemplatesViewExtension } from './view.js';
2
+ /** Host wiring for the ddd-aggregate framework. */
3
+ export const dddAggregateFramework = {
4
+ flag: 'ddd-templates',
5
+ telemetry: 'ddd-aggregate',
6
+ viewExtension: DddTemplatesViewExtension,
7
+ };
@@ -0,0 +1,2 @@
1
+ export { aggregateTemplateCategory } from './templates.js';
2
+ export { DddTemplatesViewExtension } from './view.js';
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { aggregateTemplateCategory } from './templates.js';
2
+ export { DddTemplatesViewExtension } from './view.js';
@@ -0,0 +1,7 @@
1
+ import { type TemplateCategory } from '@formicoidea/labre-core/gfx/template';
2
+ /**
3
+ * Standalone Aggregate Design Canvas section (gated by `ddd-templates`). Unlike
4
+ * the per-senior-button categories (which live in the shared package), this one
5
+ * has no senior button — it ships only as a Templates-panel prefab.
6
+ */
7
+ export declare const aggregateTemplateCategory: TemplateCategory;
@@ -0,0 +1,94 @@
1
+ import { makeTemplateSnapshot, surfaceText, } from '@formicoidea/labre-core/gfx/template';
2
+ import { FontFamily, ShapeStyle, TextAlign } from '@formicoidea/labre-core/model';
3
+ const DARK = '#323d4f';
4
+ const WHITE = '#ffffff';
5
+ function box(x, y, w, h) {
6
+ return {
7
+ type: 'shape',
8
+ shapeType: 'rect',
9
+ filled: true,
10
+ fillColor: WHITE,
11
+ strokeColor: DARK,
12
+ strokeWidth: 1,
13
+ shapeStyle: ShapeStyle.General,
14
+ roughness: 0,
15
+ radius: 0,
16
+ xywh: `[${x},${y},${w},${h}]`,
17
+ };
18
+ }
19
+ function title(x, y, str, color = DARK, fontSize = 20) {
20
+ return {
21
+ type: 'text',
22
+ text: surfaceText(str),
23
+ color,
24
+ fontFamily: FontFamily.Inter,
25
+ fontSize,
26
+ textAlign: TextAlign.Left,
27
+ xywh: `[${x},${y},340,28]`,
28
+ };
29
+ }
30
+ /** The Aggregate Design Canvas v1.1 (Kacper Gunia / DDD Crew): nine sections. */
31
+ function aggregateCanvas() {
32
+ return {
33
+ bg: {
34
+ type: 'shape',
35
+ shapeType: 'rect',
36
+ filled: true,
37
+ fillColor: DARK,
38
+ strokeColor: '#00000000',
39
+ strokeWidth: 0,
40
+ shapeStyle: ShapeStyle.General,
41
+ roughness: 0,
42
+ radius: 0,
43
+ xywh: '[0,0,1060,770]',
44
+ },
45
+ headerBar: {
46
+ type: 'shape',
47
+ shapeType: 'rect',
48
+ filled: true,
49
+ fillColor: DARK,
50
+ strokeColor: '#00000000',
51
+ strokeWidth: 0,
52
+ shapeStyle: ShapeStyle.General,
53
+ roughness: 0,
54
+ radius: 0,
55
+ xywh: '[9,10,1040,40]',
56
+ },
57
+ headerTitle: title(16, 18, 'Aggregate Design Canvas', WHITE, 30),
58
+ nameBox: box(9, 60, 350, 50),
59
+ nameTitle: title(18, 72, '1. Name'),
60
+ descBox: box(9, 120, 350, 170),
61
+ descTitle: title(18, 132, '2. Description'),
62
+ stateBox: box(369, 60, 680, 230),
63
+ stateTitle: title(378, 72, '3. State Transitions'),
64
+ invariantsBox: box(9, 300, 350, 210),
65
+ invariantsTitle: title(18, 312, '4. Enforced Invariants'),
66
+ policiesBox: box(9, 520, 350, 200),
67
+ policiesTitle: title(18, 532, '5. Corrective Policies'),
68
+ commandsBox: box(369, 300, 350, 210),
69
+ commandsTitle: title(378, 312, '6. Handled Commands'),
70
+ eventsBox: box(369, 520, 350, 200),
71
+ eventsTitle: title(378, 532, '7. Created Events'),
72
+ throughputBox: box(729, 300, 320, 210),
73
+ throughputTitle: title(738, 312, '8. Throughput'),
74
+ sizeBox: box(729, 520, 320, 200),
75
+ sizeTitle: title(738, 532, '9. Size'),
76
+ };
77
+ }
78
+ const PREVIEW = `<svg width="100%" height="100%" viewBox="0 0 135 80" xmlns="http://www.w3.org/2000/svg"><rect width="135" height="80" fill="#323d4f"/><rect x="3" y="3" width="129" height="6" fill="#323d4f"/><g fill="#fff"><rect x="3" y="11" width="42" height="6"/><rect x="3" y="19" width="42" height="22"/><rect x="47" y="11" width="85" height="28"/><rect x="3" y="43" width="42" height="16"/><rect x="3" y="61" width="42" height="16"/><rect x="47" y="43" width="42" height="16"/><rect x="47" y="61" width="42" height="16"/><rect x="91" y="43" width="41" height="16"/><rect x="91" y="61" width="41" height="16"/></g></svg>`;
79
+ /**
80
+ * Standalone Aggregate Design Canvas section (gated by `ddd-templates`). Unlike
81
+ * the per-senior-button categories (which live in the shared package), this one
82
+ * has no senior button — it ships only as a Templates-panel prefab.
83
+ */
84
+ export const aggregateTemplateCategory = {
85
+ name: 'Aggregate Design Canvas',
86
+ templates: [
87
+ {
88
+ name: 'Aggregate Design Canvas',
89
+ type: 'template',
90
+ preview: PREVIEW,
91
+ content: makeTemplateSnapshot(aggregateCanvas(), 'Aggregate Design Canvas'),
92
+ },
93
+ ],
94
+ };
package/dist/view.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ import { ViewExtensionProvider } from '@formicoidea/labre-core/ext-loader';
2
+ /**
3
+ * DDD Templates sections — flag-gated (`ddd-templates`). Registers ALL four DDD
4
+ * Templates-panel categories (Event Storming, Core Domain Chart, Context Map and
5
+ * the standalone Aggregate Design Canvas) under the single `ddd-templates` flag,
6
+ * so the catalogue stays available even when individual senior buttons are off.
7
+ * The three senior-button categories are sourced from the shared package; the
8
+ * aggregate category lives here.
9
+ */
10
+ export declare class DddTemplatesViewExtension extends ViewExtensionProvider {
11
+ name: string;
12
+ effect(): void;
13
+ }
package/dist/view.js ADDED
@@ -0,0 +1,25 @@
1
+ import { ViewExtensionProvider } from '@formicoidea/labre-core/ext-loader';
2
+ import { contextMapTemplateCategory, coreDomainTemplateCategory, eventStormingTemplateCategory, } from '@formicoidea/labre-ddd-shared';
3
+ import { extendTemplateCategory } from '@formicoidea/labre-core/gfx/template';
4
+ import { aggregateTemplateCategory } from './templates';
5
+ /**
6
+ * DDD Templates sections — flag-gated (`ddd-templates`). Registers ALL four DDD
7
+ * Templates-panel categories (Event Storming, Core Domain Chart, Context Map and
8
+ * the standalone Aggregate Design Canvas) under the single `ddd-templates` flag,
9
+ * so the catalogue stays available even when individual senior buttons are off.
10
+ * The three senior-button categories are sourced from the shared package; the
11
+ * aggregate category lives here.
12
+ */
13
+ export class DddTemplatesViewExtension extends ViewExtensionProvider {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.name = 'affine-ddd-templates';
17
+ }
18
+ effect() {
19
+ super.effect();
20
+ extendTemplateCategory(eventStormingTemplateCategory);
21
+ extendTemplateCategory(coreDomainTemplateCategory);
22
+ extendTemplateCategory(contextMapTemplateCategory);
23
+ extendTemplateCategory(aggregateTemplateCategory);
24
+ }
25
+ }
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@formicoidea/labre-framework-ddd-aggregate",
3
+ "description": "Labre ddd-aggregate framework for @formicoidea/labre-core.",
4
+ "version": "0.25.0",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "author": "lajola",
8
+ "contributors": [
9
+ "toeverything"
10
+ ],
11
+ "license": "MPL-2.0",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.js"
16
+ },
17
+ "./view": {
18
+ "types": "./dist/view.d.ts",
19
+ "import": "./dist/view.js"
20
+ },
21
+ "./descriptor": {
22
+ "types": "./dist/descriptor.d.ts",
23
+ "import": "./dist/descriptor.js"
24
+ }
25
+ },
26
+ "files": [
27
+ "dist"
28
+ ],
29
+ "dependencies": {
30
+ "@formicoidea/labre-core": "0.25.0",
31
+ "@formicoidea/labre-ddd-shared": "0.25.0",
32
+ "lit": "^3.2.0"
33
+ }
34
+ }