@formicoidea/labre-framework-c4 0.41.0 → 0.42.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/legend.js DELETED
@@ -1,149 +0,0 @@
1
- import { roleLabel } from '@formicoidea/labre-ddd-shared';
2
- import { BOARD_LEGEND_TITLE, } from '@formicoidea/labre-core/shared/services';
3
- import { BOUNDARY_STROKE, NODE_PALETTE, RELATIONSHIP_STROKE } from './consts.js';
4
- import { C4_ROLE, C4_ROLES } from './roles.js';
5
- /**
6
- * What the C4 board's automatic legend can say — a TABLE, and nothing else: the
7
- * scan, the placement and the box are `createAutoLegend`'s job, shared with the
8
- * three DDD boards.
9
- *
10
- * Every row is DERIVED twice over: its WORDING from the role vocabulary's own
11
- * `labelFallback` ({@link roleLabel}), and its COLOUR from the very palette the
12
- * creation site paints with ({@link NODE_PALETTE}). Neither is restated here, so
13
- * renaming a role renames its legend row and restyling the pack restyles its
14
- * swatches — which is what keeps a legend a description of the board rather than
15
- * a second opinion about it.
16
- *
17
- * ## Why `exact` on the container, and only there
18
- *
19
- * `c4:database` specialises `c4:container`, so an inclusive entry on the parent
20
- * would put a "Container" row — with the container's blue square — on a board
21
- * carrying nothing but cylinders. The row would name a shape that is nowhere on
22
- * the diagram. EDGY's four base kinds hit this first and `AutoLegendEntry.exact`
23
- * exists for it: base and specialisation become two separate statements, each
24
- * listed when it is the thing the user actually drew.
25
- *
26
- * The other four element roles are childless, so `exact` would change nothing
27
- * for them and is left off — the flag marks the places where the distinction is
28
- * real.
29
- *
30
- * ## What is missing, and why
31
- *
32
- * `mobile` and `browser` get no row of their own: they carry `c4:container`,
33
- * because a phone app and a single-page app are containers with a picture
34
- * (`roles.ts`). Detection is by role and only by role, so a board of nothing but
35
- * mobile apps lists "Container" — which is the honest answer about what the
36
- * boxes MEAN. `person-ext` and `system-ext` collapse the same way onto person
37
- * and system, for the same reason: the grey says "out of scope", not "a
38
- * different sort of thing".
39
- */
40
- /** This section's own keys. */
41
- const SECTION_ELEMENTS = [
42
- 'com.labre.c4.legend.section.elements',
43
- 'Elements',
44
- ];
45
- const SECTION_FRAMES = [
46
- 'com.labre.c4.legend.section.frames',
47
- 'Frames',
48
- ];
49
- const SECTION_RELATIONS = [
50
- 'com.labre.c4.legend.section.relations',
51
- 'Relations',
52
- ];
53
- /** Every section `titleKey` above, for `translations.ts`'s manifest. */
54
- export const C4_LEGEND_SECTION_WORDINGS = [
55
- SECTION_ELEMENTS,
56
- SECTION_FRAMES,
57
- SECTION_RELATIONS,
58
- ];
59
- export const C4_AUTO_LEGEND = {
60
- // The shared DDD auto-legend box's own generic chrome, resolved through
61
- // the same key every board that has one reuses — see `AutoLegendSpec.title`.
62
- title: BOARD_LEGEND_TITLE[1],
63
- titleKey: BOARD_LEGEND_TITLE[0],
64
- width: 290,
65
- roles: C4_ROLES,
66
- sections: [
67
- {
68
- title: 'Elements',
69
- titleKey: SECTION_ELEMENTS[0],
70
- entries: [
71
- {
72
- role: C4_ROLE.person,
73
- row: {
74
- swatch: 'square',
75
- color: NODE_PALETTE.person.fill,
76
- label: roleLabel(C4_ROLES, C4_ROLE.person),
77
- },
78
- },
79
- {
80
- role: C4_ROLE.system,
81
- row: {
82
- swatch: 'square',
83
- color: NODE_PALETTE.system.fill,
84
- label: roleLabel(C4_ROLES, C4_ROLE.system),
85
- },
86
- },
87
- {
88
- role: C4_ROLE.container,
89
- // See the note above: a board of cylinders must not claim a container.
90
- exact: true,
91
- row: {
92
- swatch: 'square',
93
- color: NODE_PALETTE.container.fill,
94
- label: roleLabel(C4_ROLES, C4_ROLE.container),
95
- },
96
- },
97
- {
98
- role: C4_ROLE.database,
99
- row: {
100
- swatch: 'square',
101
- color: NODE_PALETTE.database.fill,
102
- label: roleLabel(C4_ROLES, C4_ROLE.database),
103
- },
104
- },
105
- {
106
- role: C4_ROLE.component,
107
- row: {
108
- swatch: 'square',
109
- color: NODE_PALETTE.component.fill,
110
- label: roleLabel(C4_ROLES, C4_ROLE.component),
111
- },
112
- },
113
- ],
114
- },
115
- {
116
- title: 'Frames',
117
- titleKey: SECTION_FRAMES[0],
118
- entries: [
119
- {
120
- role: C4_ROLE.boundary,
121
- row: {
122
- // A line, not a square: a boundary has no body — it is the dashed
123
- // frame itself, and a filled swatch would draw the one thing this
124
- // background deliberately does not paint.
125
- swatch: 'line',
126
- color: BOUNDARY_STROKE,
127
- dashed: true,
128
- label: roleLabel(C4_ROLES, C4_ROLE.boundary),
129
- },
130
- },
131
- ],
132
- },
133
- {
134
- title: 'Relations',
135
- titleKey: SECTION_RELATIONS[0],
136
- entries: [
137
- {
138
- role: C4_ROLE.relationship,
139
- row: {
140
- swatch: 'line',
141
- color: RELATIONSHIP_STROKE,
142
- dashed: true,
143
- label: roleLabel(C4_ROLES, C4_ROLE.relationship),
144
- },
145
- },
146
- ],
147
- },
148
- ],
149
- };