@formicoidea/labre-framework-ddd-aggregate 0.39.3 → 0.41.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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/templates.js +55 -12
- package/dist/translations.d.ts +38 -0
- package/dist/translations.js +81 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/templates.js
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
import { makeTemplateSnapshot, surfaceText, } from '@formicoidea/labre-core/gfx/template';
|
|
2
2
|
import { FontFamily, ShapeStyle, TextAlign } from '@formicoidea/labre-core/model';
|
|
3
|
+
import { translateKey } from '@formicoidea/labre-core/shared/services';
|
|
4
|
+
import { AGGREGATE_SEED_CORRECTIVE_POLICIES, AGGREGATE_SEED_CREATED_EVENTS, AGGREGATE_SEED_DESCRIPTION, AGGREGATE_SEED_ENFORCED_INVARIANTS, AGGREGATE_SEED_HANDLED_COMMANDS, AGGREGATE_SEED_HEADER, AGGREGATE_SEED_NAME, AGGREGATE_SEED_SIZE, AGGREGATE_SEED_STATE_TRANSITIONS, AGGREGATE_SEED_THROUGHPUT, } from './translations.js';
|
|
5
|
+
const EN_SEEDS = {
|
|
6
|
+
header: AGGREGATE_SEED_HEADER[1],
|
|
7
|
+
name: AGGREGATE_SEED_NAME[1],
|
|
8
|
+
description: AGGREGATE_SEED_DESCRIPTION[1],
|
|
9
|
+
stateTransitions: AGGREGATE_SEED_STATE_TRANSITIONS[1],
|
|
10
|
+
enforcedInvariants: AGGREGATE_SEED_ENFORCED_INVARIANTS[1],
|
|
11
|
+
correctivePolicies: AGGREGATE_SEED_CORRECTIVE_POLICIES[1],
|
|
12
|
+
handledCommands: AGGREGATE_SEED_HANDLED_COMMANDS[1],
|
|
13
|
+
createdEvents: AGGREGATE_SEED_CREATED_EVENTS[1],
|
|
14
|
+
throughput: AGGREGATE_SEED_THROUGHPUT[1],
|
|
15
|
+
size: AGGREGATE_SEED_SIZE[1],
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The seeds in the inserting editor's language — or the English default with
|
|
19
|
+
* no host registered, which is exactly {@link EN_SEEDS} (`content`'s build).
|
|
20
|
+
*/
|
|
21
|
+
function seedsFor(std) {
|
|
22
|
+
if (!std)
|
|
23
|
+
return EN_SEEDS;
|
|
24
|
+
return {
|
|
25
|
+
header: translateKey(std, ...AGGREGATE_SEED_HEADER),
|
|
26
|
+
name: translateKey(std, ...AGGREGATE_SEED_NAME),
|
|
27
|
+
description: translateKey(std, ...AGGREGATE_SEED_DESCRIPTION),
|
|
28
|
+
stateTransitions: translateKey(std, ...AGGREGATE_SEED_STATE_TRANSITIONS),
|
|
29
|
+
enforcedInvariants: translateKey(std, ...AGGREGATE_SEED_ENFORCED_INVARIANTS),
|
|
30
|
+
correctivePolicies: translateKey(std, ...AGGREGATE_SEED_CORRECTIVE_POLICIES),
|
|
31
|
+
handledCommands: translateKey(std, ...AGGREGATE_SEED_HANDLED_COMMANDS),
|
|
32
|
+
createdEvents: translateKey(std, ...AGGREGATE_SEED_CREATED_EVENTS),
|
|
33
|
+
throughput: translateKey(std, ...AGGREGATE_SEED_THROUGHPUT),
|
|
34
|
+
size: translateKey(std, ...AGGREGATE_SEED_SIZE),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
3
37
|
const DARK = '#323d4f';
|
|
4
38
|
/**
|
|
5
39
|
* The header band, and why it is not `DARK`.
|
|
@@ -37,7 +71,7 @@ function title(x, y, str, color = DARK, fontSize = 20) {
|
|
|
37
71
|
};
|
|
38
72
|
}
|
|
39
73
|
/** The Aggregate Design Canvas v1.1 (Kacper Gunia / DDD Crew): nine sections. */
|
|
40
|
-
function aggregateCanvas() {
|
|
74
|
+
function aggregateCanvas(seeds) {
|
|
41
75
|
return {
|
|
42
76
|
bg: {
|
|
43
77
|
type: 'shape',
|
|
@@ -63,25 +97,25 @@ function aggregateCanvas() {
|
|
|
63
97
|
radius: 0,
|
|
64
98
|
xywh: '[9,10,1040,40]',
|
|
65
99
|
},
|
|
66
|
-
headerTitle: title(16, 18,
|
|
100
|
+
headerTitle: title(16, 18, seeds.header, WHITE, 30),
|
|
67
101
|
nameBox: box(9, 60, 350, 50),
|
|
68
|
-
nameTitle: title(18, 72,
|
|
102
|
+
nameTitle: title(18, 72, seeds.name),
|
|
69
103
|
descBox: box(9, 120, 350, 170),
|
|
70
|
-
descTitle: title(18, 132,
|
|
104
|
+
descTitle: title(18, 132, seeds.description),
|
|
71
105
|
stateBox: box(369, 60, 680, 230),
|
|
72
|
-
stateTitle: title(378, 72,
|
|
106
|
+
stateTitle: title(378, 72, seeds.stateTransitions),
|
|
73
107
|
invariantsBox: box(9, 300, 350, 210),
|
|
74
|
-
invariantsTitle: title(18, 312,
|
|
108
|
+
invariantsTitle: title(18, 312, seeds.enforcedInvariants),
|
|
75
109
|
policiesBox: box(9, 520, 350, 200),
|
|
76
|
-
policiesTitle: title(18, 532,
|
|
110
|
+
policiesTitle: title(18, 532, seeds.correctivePolicies),
|
|
77
111
|
commandsBox: box(369, 300, 350, 210),
|
|
78
|
-
commandsTitle: title(378, 312,
|
|
112
|
+
commandsTitle: title(378, 312, seeds.handledCommands),
|
|
79
113
|
eventsBox: box(369, 520, 350, 200),
|
|
80
|
-
eventsTitle: title(378, 532,
|
|
114
|
+
eventsTitle: title(378, 532, seeds.createdEvents),
|
|
81
115
|
throughputBox: box(729, 300, 320, 210),
|
|
82
|
-
throughputTitle: title(738, 312,
|
|
116
|
+
throughputTitle: title(738, 312, seeds.throughput),
|
|
83
117
|
sizeBox: box(729, 520, 320, 200),
|
|
84
|
-
sizeTitle: title(738, 532,
|
|
118
|
+
sizeTitle: title(738, 532, seeds.size),
|
|
85
119
|
};
|
|
86
120
|
}
|
|
87
121
|
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="${HEADER_BAND}"/><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>`;
|
|
@@ -92,12 +126,21 @@ const PREVIEW = `<svg width="100%" height="100%" viewBox="0 0 135 80" xmlns="htt
|
|
|
92
126
|
*/
|
|
93
127
|
export const aggregateTemplateCategory = {
|
|
94
128
|
name: 'Aggregate Design Canvas',
|
|
129
|
+
// Reuses the canvas's own header seed key: the tab, the tile's tooltip
|
|
130
|
+
// (unconverted — see `TemplateCategory.nameKey`'s own doc, hand-written
|
|
131
|
+
// templates get no generic tooltip seam) and the header band all say the
|
|
132
|
+
// exact same English word.
|
|
133
|
+
nameKey: AGGREGATE_SEED_HEADER[0],
|
|
95
134
|
templates: [
|
|
96
135
|
{
|
|
97
136
|
name: 'Aggregate Design Canvas',
|
|
98
137
|
type: 'template',
|
|
99
138
|
preview: PREVIEW,
|
|
100
|
-
content: makeTemplateSnapshot(aggregateCanvas(), 'Aggregate Design Canvas'),
|
|
139
|
+
content: makeTemplateSnapshot(aggregateCanvas(EN_SEEDS), 'Aggregate Design Canvas'),
|
|
140
|
+
// The nine section titles and the header are document content the
|
|
141
|
+
// moment the template lands (ADR 0016); `content` stays the English
|
|
142
|
+
// build.
|
|
143
|
+
localize: std => makeTemplateSnapshot(aggregateCanvas(seedsFor(std)), 'Aggregate Design Canvas'),
|
|
101
144
|
},
|
|
102
145
|
],
|
|
103
146
|
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ChromeWording } from '@formicoidea/labre-core/shared/services';
|
|
2
|
+
import type { TranslationKeyManifestEntry } from '@formicoidea/labre-core/std';
|
|
3
|
+
/**
|
|
4
|
+
* The Aggregate Design Canvas template's own seeds: the header band's caption
|
|
5
|
+
* and the nine numbered section titles painted onto the canvas
|
|
6
|
+
* (`templates.ts`). This is a hand-composed template (no command draws this
|
|
7
|
+
* scene), so the seeds are resolved through `Template.localize` rather than at
|
|
8
|
+
* a creation action — see `templates.ts`'s `build`.
|
|
9
|
+
*
|
|
10
|
+
* `ddd-aggregate` carries no `FrameworkId` (it ships one template, no command,
|
|
11
|
+
* no role): it is a non-framework package, so its keys follow
|
|
12
|
+
* `com.labre.ddd-aggregate.seed.<slug>` and its wordings join
|
|
13
|
+
* `AUXILIARY_TRANSLATION_GROUPS` (`packages/affine/all/src/translations.ts`)
|
|
14
|
+
* through {@link dddAggregateTranslationEntries}: this package ships as its own
|
|
15
|
+
* bundle, so core must not import it, and the bundler strips the group from
|
|
16
|
+
* core's copy exactly as it strips a framework's.
|
|
17
|
+
*/
|
|
18
|
+
export declare const AGGREGATE_SEED_HEADER: ChromeWording;
|
|
19
|
+
export declare const AGGREGATE_SEED_NAME: ChromeWording;
|
|
20
|
+
export declare const AGGREGATE_SEED_DESCRIPTION: ChromeWording;
|
|
21
|
+
export declare const AGGREGATE_SEED_STATE_TRANSITIONS: ChromeWording;
|
|
22
|
+
export declare const AGGREGATE_SEED_ENFORCED_INVARIANTS: ChromeWording;
|
|
23
|
+
export declare const AGGREGATE_SEED_CORRECTIVE_POLICIES: ChromeWording;
|
|
24
|
+
export declare const AGGREGATE_SEED_HANDLED_COMMANDS: ChromeWording;
|
|
25
|
+
export declare const AGGREGATE_SEED_CREATED_EVENTS: ChromeWording;
|
|
26
|
+
export declare const AGGREGATE_SEED_THROUGHPUT: ChromeWording;
|
|
27
|
+
export declare const AGGREGATE_SEED_SIZE: ChromeWording;
|
|
28
|
+
/**
|
|
29
|
+
* This package's contribution to the translation-key manifest, listed in
|
|
30
|
+
* `PACKAGE_SEED_WORDINGS` under source `seed`.
|
|
31
|
+
*/
|
|
32
|
+
export declare const DDD_AGGREGATE_WORDINGS: readonly ChromeWording[];
|
|
33
|
+
/**
|
|
34
|
+
* The same wordings as manifest entries, exported from the package root the way
|
|
35
|
+
* a framework bundle exports its `…TranslationEntries`: a bundled host composes
|
|
36
|
+
* them with core's manifest when it installs this bundle.
|
|
37
|
+
*/
|
|
38
|
+
export declare const dddAggregateTranslationEntries: readonly TranslationKeyManifestEntry[];
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Aggregate Design Canvas template's own seeds: the header band's caption
|
|
3
|
+
* and the nine numbered section titles painted onto the canvas
|
|
4
|
+
* (`templates.ts`). This is a hand-composed template (no command draws this
|
|
5
|
+
* scene), so the seeds are resolved through `Template.localize` rather than at
|
|
6
|
+
* a creation action — see `templates.ts`'s `build`.
|
|
7
|
+
*
|
|
8
|
+
* `ddd-aggregate` carries no `FrameworkId` (it ships one template, no command,
|
|
9
|
+
* no role): it is a non-framework package, so its keys follow
|
|
10
|
+
* `com.labre.ddd-aggregate.seed.<slug>` and its wordings join
|
|
11
|
+
* `AUXILIARY_TRANSLATION_GROUPS` (`packages/affine/all/src/translations.ts`)
|
|
12
|
+
* through {@link dddAggregateTranslationEntries}: this package ships as its own
|
|
13
|
+
* bundle, so core must not import it, and the bundler strips the group from
|
|
14
|
+
* core's copy exactly as it strips a framework's.
|
|
15
|
+
*/
|
|
16
|
+
export const AGGREGATE_SEED_HEADER = [
|
|
17
|
+
'com.labre.ddd-aggregate.seed.header',
|
|
18
|
+
'Aggregate Design Canvas',
|
|
19
|
+
];
|
|
20
|
+
export const AGGREGATE_SEED_NAME = [
|
|
21
|
+
'com.labre.ddd-aggregate.seed.name',
|
|
22
|
+
'1. Name',
|
|
23
|
+
];
|
|
24
|
+
export const AGGREGATE_SEED_DESCRIPTION = [
|
|
25
|
+
'com.labre.ddd-aggregate.seed.description',
|
|
26
|
+
'2. Description',
|
|
27
|
+
];
|
|
28
|
+
export const AGGREGATE_SEED_STATE_TRANSITIONS = [
|
|
29
|
+
'com.labre.ddd-aggregate.seed.state-transitions',
|
|
30
|
+
'3. State Transitions',
|
|
31
|
+
];
|
|
32
|
+
export const AGGREGATE_SEED_ENFORCED_INVARIANTS = [
|
|
33
|
+
'com.labre.ddd-aggregate.seed.enforced-invariants',
|
|
34
|
+
'4. Enforced Invariants',
|
|
35
|
+
];
|
|
36
|
+
export const AGGREGATE_SEED_CORRECTIVE_POLICIES = [
|
|
37
|
+
'com.labre.ddd-aggregate.seed.corrective-policies',
|
|
38
|
+
'5. Corrective Policies',
|
|
39
|
+
];
|
|
40
|
+
export const AGGREGATE_SEED_HANDLED_COMMANDS = [
|
|
41
|
+
'com.labre.ddd-aggregate.seed.handled-commands',
|
|
42
|
+
'6. Handled Commands',
|
|
43
|
+
];
|
|
44
|
+
export const AGGREGATE_SEED_CREATED_EVENTS = [
|
|
45
|
+
'com.labre.ddd-aggregate.seed.created-events',
|
|
46
|
+
'7. Created Events',
|
|
47
|
+
];
|
|
48
|
+
export const AGGREGATE_SEED_THROUGHPUT = [
|
|
49
|
+
'com.labre.ddd-aggregate.seed.throughput',
|
|
50
|
+
'8. Throughput',
|
|
51
|
+
];
|
|
52
|
+
export const AGGREGATE_SEED_SIZE = [
|
|
53
|
+
'com.labre.ddd-aggregate.seed.size',
|
|
54
|
+
'9. Size',
|
|
55
|
+
];
|
|
56
|
+
/**
|
|
57
|
+
* This package's contribution to the translation-key manifest, listed in
|
|
58
|
+
* `PACKAGE_SEED_WORDINGS` under source `seed`.
|
|
59
|
+
*/
|
|
60
|
+
export const DDD_AGGREGATE_WORDINGS = [
|
|
61
|
+
AGGREGATE_SEED_HEADER,
|
|
62
|
+
AGGREGATE_SEED_NAME,
|
|
63
|
+
AGGREGATE_SEED_DESCRIPTION,
|
|
64
|
+
AGGREGATE_SEED_STATE_TRANSITIONS,
|
|
65
|
+
AGGREGATE_SEED_ENFORCED_INVARIANTS,
|
|
66
|
+
AGGREGATE_SEED_CORRECTIVE_POLICIES,
|
|
67
|
+
AGGREGATE_SEED_HANDLED_COMMANDS,
|
|
68
|
+
AGGREGATE_SEED_CREATED_EVENTS,
|
|
69
|
+
AGGREGATE_SEED_THROUGHPUT,
|
|
70
|
+
AGGREGATE_SEED_SIZE,
|
|
71
|
+
];
|
|
72
|
+
/**
|
|
73
|
+
* The same wordings as manifest entries, exported from the package root the way
|
|
74
|
+
* a framework bundle exports its `…TranslationEntries`: a bundled host composes
|
|
75
|
+
* them with core's manifest when it installs this bundle.
|
|
76
|
+
*/
|
|
77
|
+
export const dddAggregateTranslationEntries = DDD_AGGREGATE_WORDINGS.map(([key, fallback]) => ({
|
|
78
|
+
key,
|
|
79
|
+
fallback,
|
|
80
|
+
source: 'seed',
|
|
81
|
+
}));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formicoidea/labre-framework-ddd-aggregate",
|
|
3
3
|
"description": "Labre ddd-aggregate framework for @formicoidea/labre-core.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.41.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"author": "lajola",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@formicoidea/labre-core": "0.
|
|
30
|
+
"@formicoidea/labre-core": "0.41.0",
|
|
31
31
|
"lit": "^3.2.0"
|
|
32
32
|
}
|
|
33
33
|
}
|