@formicoidea/labre-framework-ddd-context-map 0.40.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/LICENSE ADDED
@@ -0,0 +1,384 @@
1
+ # Mozilla Public License Version 2.0
2
+
3
+ Copyright (c) TOEVERYTHING PTE. LTD. and its affiliates.
4
+
5
+ 1. Definitions
6
+
7
+ ---
8
+
9
+ 1.1. "Contributor"
10
+ means each individual or legal entity that creates, contributes to
11
+ the creation of, or owns Covered Software.
12
+
13
+ 1.2. "Contributor Version"
14
+ means the combination of the Contributions of others (if any) used
15
+ by a Contributor and that particular Contributor's Contribution.
16
+
17
+ 1.3. "Contribution"
18
+ means Covered Software of a particular Contributor.
19
+
20
+ 1.4. "Covered Software"
21
+ means Source Code Form to which the initial Contributor has attached
22
+ the notice in Exhibit A, the Executable Form of such Source Code
23
+ Form, and Modifications of such Source Code Form, in each case
24
+ including portions thereof.
25
+
26
+ 1.5. "Incompatible With Secondary Licenses"
27
+ means
28
+
29
+ (a) that the initial Contributor has attached the notice described
30
+ in Exhibit B to the Covered Software; or
31
+
32
+ (b) that the Covered Software was made available under the terms of
33
+ version 1.1 or earlier of the License, but not also under the
34
+ terms of a Secondary License.
35
+
36
+ 1.6. "Executable Form"
37
+ means any form of the work other than Source Code Form.
38
+
39
+ 1.7. "Larger Work"
40
+ means a work that combines Covered Software with other material, in
41
+ a separate file or files, that is not Covered Software.
42
+
43
+ 1.8. "License"
44
+ means this document.
45
+
46
+ 1.9. "Licensable"
47
+ means having the right to grant, to the maximum extent possible,
48
+ whether at the time of the initial grant or subsequently, any and
49
+ all of the rights conveyed by this License.
50
+
51
+ 1.10. "Modifications"
52
+ means any of the following:
53
+
54
+ (a) any file in Source Code Form that results from an addition to,
55
+ deletion from, or modification of the contents of Covered
56
+ Software; or
57
+
58
+ (b) any new file in Source Code Form that contains any Covered
59
+ Software.
60
+
61
+ 1.11. "Patent Claims" of a Contributor
62
+ means any patent claim(s), including without limitation, method,
63
+ process, and apparatus claims, in any patent Licensable by such
64
+ Contributor that would be infringed, but for the grant of the
65
+ License, by the making, using, selling, offering for sale, having
66
+ made, import, or transfer of either its Contributions or its
67
+ Contributor Version.
68
+
69
+ 1.12. "Secondary License"
70
+ means either the GNU General Public License, Version 2.0, the GNU
71
+ Lesser General Public License, Version 2.1, the GNU Affero General
72
+ Public License, Version 3.0, or any later versions of those
73
+ licenses.
74
+
75
+ 1.13. "Source Code Form"
76
+ means the form of the work preferred for making modifications.
77
+
78
+ 1.14. "You" (or "Your")
79
+ means an individual or a legal entity exercising rights under this
80
+ License. For legal entities, "You" includes any entity that
81
+ controls, is controlled by, or is under common control with You. For
82
+ purposes of this definition, "control" means (a) the power, direct
83
+ or indirect, to cause the direction or management of such entity,
84
+ whether by contract or otherwise, or (b) ownership of more than
85
+ fifty percent (50%) of the outstanding shares or beneficial
86
+ ownership of such entity.
87
+
88
+ 2. License Grants and Conditions
89
+
90
+ ---
91
+
92
+ 2.1. Grants
93
+
94
+ Each Contributor hereby grants You a world-wide, royalty-free,
95
+ non-exclusive license:
96
+
97
+ (a) under intellectual property rights (other than patent or trademark)
98
+ Licensable by such Contributor to use, reproduce, make available,
99
+ modify, display, perform, distribute, and otherwise exploit its
100
+ Contributions, either on an unmodified basis, with Modifications, or
101
+ as part of a Larger Work; and
102
+
103
+ (b) under Patent Claims of such Contributor to make, use, sell, offer
104
+ for sale, have made, import, and otherwise transfer either its
105
+ Contributions or its Contributor Version.
106
+
107
+ 2.2. Effective Date
108
+
109
+ The licenses granted in Section 2.1 with respect to any Contribution
110
+ become effective for each Contribution on the date the Contributor first
111
+ distributes such Contribution.
112
+
113
+ 2.3. Limitations on Grant Scope
114
+
115
+ The licenses granted in this Section 2 are the only rights granted under
116
+ this License. No additional rights or licenses will be implied from the
117
+ distribution or licensing of Covered Software under this License.
118
+ Notwithstanding Section 2.1(b) above, no patent license is granted by a
119
+ Contributor:
120
+
121
+ (a) for any code that a Contributor has removed from Covered Software;
122
+ or
123
+
124
+ (b) for infringements caused by: (i) Your and any other third party's
125
+ modifications of Covered Software, or (ii) the combination of its
126
+ Contributions with other software (except as part of its Contributor
127
+ Version); or
128
+
129
+ (c) under Patent Claims infringed by Covered Software in the absence of
130
+ its Contributions.
131
+
132
+ This License does not grant any rights in the trademarks, service marks,
133
+ or logos of any Contributor (except as may be necessary to comply with
134
+ the notice requirements in Section 3.4).
135
+
136
+ 2.4. Subsequent Licenses
137
+
138
+ No Contributor makes additional grants as a result of Your choice to
139
+ distribute the Covered Software under a subsequent version of this
140
+ License (see Section 10.2) or under the terms of a Secondary License (if
141
+ permitted under the terms of Section 3.3).
142
+
143
+ 2.5. Representation
144
+
145
+ Each Contributor represents that the Contributor believes its
146
+ Contributions are its original creation(s) or it has sufficient rights
147
+ to grant the rights to its Contributions conveyed by this License.
148
+
149
+ 2.6. Fair Use
150
+
151
+ This License is not intended to limit any rights You have under
152
+ applicable copyright doctrines of fair use, fair dealing, or other
153
+ equivalents.
154
+
155
+ 2.7. Conditions
156
+
157
+ Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
158
+ in Section 2.1.
159
+
160
+ 3. Responsibilities
161
+
162
+ ---
163
+
164
+ 3.1. Distribution of Source Form
165
+
166
+ All distribution of Covered Software in Source Code Form, including any
167
+ Modifications that You create or to which You contribute, must be under
168
+ the terms of this License. You must inform recipients that the Source
169
+ Code Form of the Covered Software is governed by the terms of this
170
+ License, and how they can obtain a copy of this License. You may not
171
+ attempt to alter or restrict the recipients' rights in the Source Code
172
+ Form.
173
+
174
+ 3.2. Distribution of Executable Form
175
+
176
+ If You distribute Covered Software in Executable Form then:
177
+
178
+ (a) such Covered Software must also be made available in Source Code
179
+ Form, as described in Section 3.1, and You must inform recipients of
180
+ the Executable Form how they can obtain a copy of such Source Code
181
+ Form by reasonable means in a timely manner, at a charge no more
182
+ than the cost of distribution to the recipient; and
183
+
184
+ (b) You may distribute such Executable Form under the terms of this
185
+ License, or sublicense it under different terms, provided that the
186
+ license for the Executable Form does not attempt to limit or alter
187
+ the recipients' rights in the Source Code Form under this License.
188
+
189
+ 3.3. Distribution of a Larger Work
190
+
191
+ You may create and distribute a Larger Work under terms of Your choice,
192
+ provided that You also comply with the requirements of this License for
193
+ the Covered Software. If the Larger Work is a combination of Covered
194
+ Software with a work governed by one or more Secondary Licenses, and the
195
+ Covered Software is not Incompatible With Secondary Licenses, this
196
+ License permits You to additionally distribute such Covered Software
197
+ under the terms of such Secondary License(s), so that the recipient of
198
+ the Larger Work may, at their option, further distribute the Covered
199
+ Software under the terms of either this License or such Secondary
200
+ License(s).
201
+
202
+ 3.4. Notices
203
+
204
+ You may not remove or alter the substance of any license notices
205
+ (including copyright notices, patent notices, disclaimers of warranty,
206
+ or limitations of liability) contained within the Source Code Form of
207
+ the Covered Software, except that You may alter any license notices to
208
+ the extent required to remedy known factual inaccuracies.
209
+
210
+ 3.5. Application of Additional Terms
211
+
212
+ You may choose to offer, and to charge a fee for, warranty, support,
213
+ indemnity or liability obligations to one or more recipients of Covered
214
+ Software. However, You may do so only on Your own behalf, and not on
215
+ behalf of any Contributor. You must make it absolutely clear that any
216
+ such warranty, support, indemnity, or liability obligation is offered by
217
+ You alone, and You hereby agree to indemnify every Contributor for any
218
+ liability incurred by such Contributor as a result of warranty, support,
219
+ indemnity or liability terms You offer. You may include additional
220
+ disclaimers of warranty and limitations of liability specific to any
221
+ jurisdiction.
222
+
223
+ 4. Inability to Comply Due to Statute or Regulation
224
+
225
+ ---
226
+
227
+ If it is impossible for You to comply with any of the terms of this
228
+ License with respect to some or all of the Covered Software due to
229
+ statute, judicial order, or regulation then You must: (a) comply with
230
+ the terms of this License to the maximum extent possible; and (b)
231
+ describe the limitations and the code they affect. Such description must
232
+ be placed in a text file included with all distributions of the Covered
233
+ Software under this License. Except to the extent prohibited by statute
234
+ or regulation, such description must be sufficiently detailed for a
235
+ recipient of ordinary skill to be able to understand it.
236
+
237
+ 5. Termination
238
+
239
+ ---
240
+
241
+ 5.1. The rights granted under this License will terminate automatically
242
+ if You fail to comply with any of its terms. However, if You become
243
+ compliant, then the rights granted under this License from a particular
244
+ Contributor are reinstated (a) provisionally, unless and until such
245
+ Contributor explicitly and finally terminates Your grants, and (b) on an
246
+ ongoing basis, if such Contributor fails to notify You of the
247
+ non-compliance by some reasonable means prior to 60 days after You have
248
+ come back into compliance. Moreover, Your grants from a particular
249
+ Contributor are reinstated on an ongoing basis if such Contributor
250
+ notifies You of the non-compliance by some reasonable means, this is the
251
+ first time You have received notice of non-compliance with this License
252
+ from such Contributor, and You become compliant prior to 30 days after
253
+ Your receipt of the notice.
254
+
255
+ 5.2. If You initiate litigation against any entity by asserting a patent
256
+ infringement claim (excluding declaratory judgment actions,
257
+ counter-claims, and cross-claims) alleging that a Contributor Version
258
+ directly or indirectly infringes any patent, then the rights granted to
259
+ You by any and all Contributors for the Covered Software under Section
260
+ 2.1 of this License shall terminate.
261
+
262
+ 5.3. In the event of termination under Sections 5.1 or 5.2 above, all
263
+ end user license agreements (excluding distributors and resellers) which
264
+ have been validly granted by You or Your distributors under this License
265
+ prior to termination shall survive termination.
266
+
267
+ ---
268
+
269
+ - *
270
+ - 6. Disclaimer of Warranty \*
271
+ - ------------------------- \*
272
+ - *
273
+ - Covered Software is provided under this License on an "as is" \*
274
+ - basis, without warranty of any kind, either expressed, implied, or \*
275
+ - statutory, including, without limitation, warranties that the \*
276
+ - Covered Software is free of defects, merchantable, fit for a \*
277
+ - particular purpose or non-infringing. The entire risk as to the \*
278
+ - quality and performance of the Covered Software is with You. \*
279
+ - Should any Covered Software prove defective in any respect, You \*
280
+ - (not any Contributor) assume the cost of any necessary servicing, \*
281
+ - repair, or correction. This disclaimer of warranty constitutes an \*
282
+ - essential part of this License. No use of any Covered Software is \*
283
+ - authorized under this License except under this disclaimer. \*
284
+ - *
285
+
286
+ ---
287
+
288
+ ---
289
+
290
+ - *
291
+ - 7. Limitation of Liability \*
292
+ - -------------------------- \*
293
+ - *
294
+ - Under no circumstances and under no legal theory, whether tort \*
295
+ - (including negligence), contract, or otherwise, shall any \*
296
+ - Contributor, or anyone who distributes Covered Software as \*
297
+ - permitted above, be liable to You for any direct, indirect, \*
298
+ - special, incidental, or consequential damages of any character \*
299
+ - including, without limitation, damages for lost profits, loss of \*
300
+ - goodwill, work stoppage, computer failure or malfunction, or any \*
301
+ - and all other commercial damages or losses, even if such party \*
302
+ - shall have been informed of the possibility of such damages. This \*
303
+ - limitation of liability shall not apply to liability for death or \*
304
+ - personal injury resulting from such party's negligence to the \*
305
+ - extent applicable law prohibits such limitation. Some \*
306
+ - jurisdictions do not allow the exclusion or limitation of \*
307
+ - incidental or consequential damages, so this exclusion and \*
308
+ - limitation may not apply to You. \*
309
+ - *
310
+
311
+ ---
312
+
313
+ 8. Litigation
314
+
315
+ ---
316
+
317
+ Any litigation relating to this License may be brought only in the
318
+ courts of a jurisdiction where the defendant maintains its principal
319
+ place of business and such litigation shall be governed by laws of that
320
+ jurisdiction, without reference to its conflict-of-law provisions.
321
+ Nothing in this Section shall prevent a party's ability to bring
322
+ cross-claims or counter-claims.
323
+
324
+ 9. Miscellaneous
325
+
326
+ ---
327
+
328
+ This License represents the complete agreement concerning the subject
329
+ matter hereof. If any provision of this License is held to be
330
+ unenforceable, such provision shall be reformed only to the extent
331
+ necessary to make it enforceable. Any law or regulation which provides
332
+ that the language of a contract shall be construed against the drafter
333
+ shall not be used to construe this License against a Contributor.
334
+
335
+ 10. Versions of the License
336
+
337
+ ---
338
+
339
+ 10.1. New Versions
340
+
341
+ Mozilla Foundation is the license steward. Except as provided in Section
342
+ 10.3, no one other than the license steward has the right to modify or
343
+ publish new versions of this License. Each version will be given a
344
+ distinguishing version number.
345
+
346
+ 10.2. Effect of New Versions
347
+
348
+ You may distribute the Covered Software under the terms of the version
349
+ of the License under which You originally received the Covered Software,
350
+ or under the terms of any subsequent version published by the license
351
+ steward.
352
+
353
+ 10.3. Modified Versions
354
+
355
+ If you create software not governed by this License, and you want to
356
+ create a new license for such software, you may create and use a
357
+ modified version of this License if you rename the license and remove
358
+ any references to the name of the license steward (except to note that
359
+ such modified license differs from this License).
360
+
361
+ 10.4. Distributing Source Code Form that is Incompatible With Secondary
362
+ Licenses
363
+
364
+ If You choose to distribute Source Code Form that is Incompatible With
365
+ Secondary Licenses under the terms of this version of the License, the
366
+ notice described in Exhibit B of this License must be attached.
367
+
368
+ ## Exhibit A - Source Code Form License Notice
369
+
370
+ This Source Code Form is subject to the terms of the Mozilla Public
371
+ License, v. 2.0. If a copy of the MPL was not distributed with this
372
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
373
+
374
+ If it is not possible or desirable to put the notice in a particular
375
+ file, then You may include the notice in a location (such as a LICENSE
376
+ file in a relevant directory) where a recipient would be likely to look
377
+ for such a notice.
378
+
379
+ You may add additional accurate notices of copyright ownership.
380
+
381
+ ## Exhibit B - "Incompatible With Secondary Licenses" Notice
382
+
383
+ This Source Code Form is "Incompatible With Secondary Licenses", as
384
+ defined by the Mozilla Public License, v. 2.0.
@@ -1,4 +1,30 @@
1
+ import { type ChromeWording } from '@formicoidea/labre-core/shared/services';
1
2
  import type { CommandDescriptor } from '@formicoidea/labre-core/std';
2
3
  import { type TemplateResult } from 'lit';
4
+ /**
5
+ * The seeds baked into a placed artefact: the bounded-context bubble's
6
+ * default caption, and the general-purpose cloud's. The nine relationship
7
+ * patterns carry no seed of their own — since WS2 the palette ARMS the
8
+ * connector tool rather than dropping a labelled group, so no word is
9
+ * written into the document for them any more
10
+ * (`activateContextMapRelationship`). Declared here, beside the commands that
11
+ * write them, and imported by `translations.ts` — never the other way, which
12
+ * would cycle back into `contextMapCommands`.
13
+ */
14
+ export declare const CONTEXT_MAP_SEED_BOUNDED_CONTEXT: ChromeWording;
15
+ export declare const CONTEXT_MAP_SEED_CLOUD: ChromeWording;
16
+ /**
17
+ * The automatic legend's own section titles — text stamped onto the board the
18
+ * moment the legend is built, like any other seed, and declared HERE because
19
+ * the rows that file themselves under them are subscribed by the commands
20
+ * below. The box title itself is not one of them: it says the shared word
21
+ * "Legend" and reuses `BOARD_LEGEND_TITLE`.
22
+ *
23
+ * Two sub-titles for a framework whose twelve commands all sit in ONE category:
24
+ * `section` is what keeps "Boundaries" and "Relationships" apart where the
25
+ * category would say "Map" once (`docs/adr/0026`).
26
+ */
27
+ export declare const CONTEXT_MAP_SEED_LEGEND_BOUNDARIES: ChromeWording;
28
+ export declare const CONTEXT_MAP_SEED_LEGEND_RELATIONSHIPS: ChromeWording;
3
29
  export declare const contextMapCommands: CommandDescriptor[];
4
30
  export declare const contextMapCommandIcons: Record<string, TemplateResult>;
package/dist/commands.js CHANGED
@@ -1,9 +1,47 @@
1
- import { addBubble, addCloud, CLOUD, CM_RELATIONSHIPS, placeDddElement, } from '@formicoidea/labre-ddd-shared';
1
+ import { addBubble, addCloud, CLOUD, CM_BUBBLE, CM_RELATIONSHIPS, contextMapToolbarIcon, LABEL_COLOR, placeDddElement, } from '@formicoidea/labre-ddd-shared';
2
2
  import { NOTATION_NEUTRALS } from '@formicoidea/labre-core/shared/consts';
3
+ import { translateKey, } from '@formicoidea/labre-core/shared/services';
3
4
  import { GfxControllerIdentifier } from '@formicoidea/labre-core/std/gfx';
4
5
  import { svg } from 'lit';
5
6
  import { activateContextMapRelationship, createContextMapBoard, } from './actions.js';
6
- import { CONTEXT_MAP_ROLE } from './roles.js';
7
+ import { CM_PATTERN_ROLE, CONTEXT_MAP_ROLE } from './roles.js';
8
+ /**
9
+ * The seeds baked into a placed artefact: the bounded-context bubble's
10
+ * default caption, and the general-purpose cloud's. The nine relationship
11
+ * patterns carry no seed of their own — since WS2 the palette ARMS the
12
+ * connector tool rather than dropping a labelled group, so no word is
13
+ * written into the document for them any more
14
+ * (`activateContextMapRelationship`). Declared here, beside the commands that
15
+ * write them, and imported by `translations.ts` — never the other way, which
16
+ * would cycle back into `contextMapCommands`.
17
+ */
18
+ export const CONTEXT_MAP_SEED_BOUNDED_CONTEXT = [
19
+ 'com.labre.ddd-context-map.seed.bounded-context',
20
+ 'Bounded Context',
21
+ ];
22
+ export const CONTEXT_MAP_SEED_CLOUD = [
23
+ 'com.labre.ddd-context-map.seed.cloud',
24
+ 'System',
25
+ ];
26
+ /**
27
+ * The automatic legend's own section titles — text stamped onto the board the
28
+ * moment the legend is built, like any other seed, and declared HERE because
29
+ * the rows that file themselves under them are subscribed by the commands
30
+ * below. The box title itself is not one of them: it says the shared word
31
+ * "Legend" and reuses `BOARD_LEGEND_TITLE`.
32
+ *
33
+ * Two sub-titles for a framework whose twelve commands all sit in ONE category:
34
+ * `section` is what keeps "Boundaries" and "Relationships" apart where the
35
+ * category would say "Map" once (`docs/adr/0026`).
36
+ */
37
+ export const CONTEXT_MAP_SEED_LEGEND_BOUNDARIES = [
38
+ 'com.labre.ddd-context-map.seed.legend-boundaries',
39
+ 'Boundaries',
40
+ ];
41
+ export const CONTEXT_MAP_SEED_LEGEND_RELATIONSHIPS = [
42
+ 'com.labre.ddd-context-map.seed.legend-relationships',
43
+ 'Relationships',
44
+ ];
7
45
  /**
8
46
  * The Context Map palette as commands: the board, the bounded-context bubble,
9
47
  * the cloud and the nine relationship patterns (`docs/adr/0008`).
@@ -33,6 +71,9 @@ const SPECS = [
33
71
  board: true,
34
72
  icon: boardSwatch,
35
73
  run: std => createContextMapBoard(std.get(GfxControllerIdentifier)),
74
+ // Wider than the shared 260: nine pattern rows carry an abbreviation in
75
+ // front of their wording ("OHS — Open Host Service") and wrapped at 260.
76
+ legendBox: { width: 290 },
36
77
  },
37
78
  {
38
79
  id: 'addBoundedContext',
@@ -41,10 +82,17 @@ const SPECS = [
41
82
  element: 'bounded-context',
42
83
  icon: bubbleSwatch,
43
84
  run: std => placeDddElement(std, (surface, cx, cy) =>
44
- // The role is what makes a bubble a bounded CONTEXT rather than a blue
45
- // pill: every rule in `rules.ts` reads it, and a pill drawn before WS2
46
- // carries none and is never evaluated (promesse #71).
47
- addBubble(surface, cx, cy, 'Bounded Context', CONTEXT_MAP_ROLE.context)),
85
+ // Translated HERE and once: the caption is document content the
86
+ // moment it lands (ADR 0023). The role is what makes a bubble a
87
+ // bounded CONTEXT rather than a blue pill: every rule in `rules.ts`
88
+ // reads it, and a pill drawn before WS2 carries none and is never
89
+ // evaluated (promesse #71).
90
+ addBubble(surface, cx, cy, translateKey(std, ...CONTEXT_MAP_SEED_BOUNDED_CONTEXT), CONTEXT_MAP_ROLE.context)),
91
+ legend: {
92
+ role: CONTEXT_MAP_ROLE.context,
93
+ section: CONTEXT_MAP_SEED_LEGEND_BOUNDARIES,
94
+ row: { swatch: 'square', color: CM_BUBBLE.fill },
95
+ },
48
96
  },
49
97
  {
50
98
  id: 'addCloud',
@@ -52,25 +100,50 @@ const SPECS = [
52
100
  iconKey: 'ddd-context-map.cloud',
53
101
  element: 'cloud',
54
102
  icon: cloudSwatch,
55
- run: std => placeDddElement(std, (surface, cx, cy) => addCloud(surface, std, cx, cy, 'System')),
103
+ run: std => placeDddElement(std, (surface, cx, cy) =>
104
+ // Translated HERE and once, like the bubble above (ADR 0023). The
105
+ // role is what lets the automatic legend list the cloud; no rule's
106
+ // matrix cites it, so a relationship drawn onto one stays unjudged.
107
+ addCloud(surface, std, cx, cy, translateKey(std, ...CONTEXT_MAP_SEED_CLOUD), CONTEXT_MAP_ROLE.system)),
108
+ // Beside the bounded context, in the cloud's own lilac. A cloud placed
109
+ // before `context-map:system` existed carries no role and stays out: the
110
+ // scan reads roles and nothing else, and telling a legacy cloud from any
111
+ // other lilac polygon would mean detecting by shape or fill.
112
+ legend: {
113
+ role: CONTEXT_MAP_ROLE.system,
114
+ section: CONTEXT_MAP_SEED_LEGEND_BOUNDARIES,
115
+ row: { swatch: 'square', color: CLOUD.fill },
116
+ },
56
117
  },
57
118
  ...CM_RELATIONSHIPS.map((preset) => ({
58
119
  id: `add${preset.kind[0].toUpperCase()}${preset.kind.slice(1)}`,
59
120
  label: preset.label,
60
121
  iconKey: `ddd-context-map.relationship.${preset.kind}`,
61
122
  element: `relationship:${preset.kind}`,
123
+ kind: 'tool',
62
124
  icon: relationSwatch(preset.dashed, preset.upDown),
63
125
  // No longer a placement: the nine patterns arm the connector tool and the
64
126
  // user DRAWS the relation between two contexts. See
65
127
  // `activateContextMapRelationship` for why the free-floating group had to
66
128
  // go. The telemetry `element` value is untouched.
67
129
  run: std => activateContextMapRelationship(std.get(GfxControllerIdentifier), preset.kind, { upDown: preset.upDown, dashed: preset.dashed }),
130
+ // One row per PATTERN, not one for `context-map:relationship`: a legend
131
+ // that said "Relationship" would document nothing a reader could use. Both
132
+ // the row and the command come out of the same preset, so the dashed
133
+ // sample marks the two "no real integration" patterns exactly as the board
134
+ // draws them, and a tenth pattern gets its row with no edit.
135
+ legend: {
136
+ role: CM_PATTERN_ROLE[preset.kind],
137
+ section: CONTEXT_MAP_SEED_LEGEND_RELATIONSHIPS,
138
+ labelPrefix: preset.abbrev,
139
+ row: { swatch: 'line', color: LABEL_COLOR, dashed: preset.dashed },
140
+ },
68
141
  })),
69
142
  ];
70
143
  export const contextMapCommands = SPECS.map((spec, order) => ({
71
144
  id: `ddd-context-map.${spec.id}`,
72
145
  owner: 'ddd-context-map',
73
- kind: 'artefact',
146
+ kind: spec.kind ?? 'artefact',
74
147
  labelKey: `com.labre.commands.ddd-context-map.${spec.id}`,
75
148
  labelFallback: spec.label,
76
149
  category: 'map',
@@ -86,5 +159,12 @@ export const contextMapCommands = SPECS.map((spec, order) => ({
86
159
  element: spec.element,
87
160
  board: spec.board,
88
161
  },
162
+ legend: spec.legend,
163
+ legendBox: spec.legendBox,
89
164
  }));
90
- export const contextMapCommandIcons = Object.fromEntries(SPECS.map(spec => [spec.iconKey, spec.icon]));
165
+ export const contextMapCommandIcons = {
166
+ ...Object.fromEntries(SPECS.map(spec => [spec.iconKey, spec.icon])),
167
+ // The senior button's 56×56 glyph, so `FrameworkDescriptor.iconKey` resolves
168
+ // through `getCommandIcon`.
169
+ 'ddd-context-map.toolbar': contextMapToolbarIcon,
170
+ };
package/dist/nudges.js CHANGED
@@ -34,10 +34,10 @@ export const CONTEXT_MAP_NUDGES = [
34
34
  /**
35
35
  * The rule this nudge replaces. "Every downstream of a Big Ball of Mud is
36
36
  * protected" is decidable in principle — walk the edges out of the cloud and
37
- * look for an ACL — and undecidable in practice on THIS canvas: the cloud
38
- * carries no role (a v1 cut), so there is nothing for a rule to walk from,
39
- * and a shape somebody drew a mess with is not a claim that it IS one.
40
- * Level 2 is the honest home for it until the cloud has a role.
37
+ * look for an ACL — and undecidable in practice on THIS canvas: the cloud's
38
+ * role is `context-map:system`, which says "a system", not "a mess", and a
39
+ * shape somebody drew a mess with is not a claim that it IS one. Level 2 is
40
+ * the honest home for it.
41
41
  */
42
42
  id: 'context-map.q3-bbom-protected',
43
43
  framework: 'ddd-context-map',
package/dist/reading.d.ts CHANGED
@@ -16,7 +16,10 @@ import type { ReadingProfile } from '@formicoidea/labre-core/blocks/surface';
16
16
  *
17
17
  * `context-map:context` is the only artefact this notation places; the board is
18
18
  * the FRAME and specialises nothing, exactly so that what is written about the
19
- * contexts never falls on the card they sit on.
19
+ * contexts never falls on the card they sit on. The cloud
20
+ * (`context-map:system`) is not a subject either: its role is there for the
21
+ * legend, the map does not model what is inside it, and it is read exactly as
22
+ * much as when it carried no role — not at all.
20
23
  *
21
24
  * ## The nine patterns are read through their parent
22
25
  *
package/dist/reading.js CHANGED
@@ -16,7 +16,10 @@ import { CONTEXT_MAP_ROLE, CONTEXT_MAP_ROLES } from './roles.js';
16
16
  *
17
17
  * `context-map:context` is the only artefact this notation places; the board is
18
18
  * the FRAME and specialises nothing, exactly so that what is written about the
19
- * contexts never falls on the card they sit on.
19
+ * contexts never falls on the card they sit on. The cloud
20
+ * (`context-map:system`) is not a subject either: its role is there for the
21
+ * legend, the map does not model what is inside it, and it is read exactly as
22
+ * much as when it carried no role — not at all.
20
23
  *
21
24
  * ## The nine patterns are read through their parent
22
25
  *
package/dist/roles.d.ts CHANGED
@@ -4,10 +4,11 @@ import type { RoleDefs } from '@formicoidea/labre-core/std/gfx';
4
4
  * Context Mapping role vocabulary (WS2).
5
5
  *
6
6
  * Roles are the semantic identity of a Context Map artefact — no rule will ever
7
- * look at a shape type. Three families:
7
+ * look at a shape type. Four families:
8
8
  *
9
9
  * - the **board** (`context-map:board`), the white card the map is drawn on;
10
10
  * - the **bounded context** (`context-map:context`), the blue pill;
11
+ * - the **system** (`context-map:system`), the cloud — see below;
11
12
  * - the **relationship** (`context-map:relationship`), the edge parent, with
12
13
  * one child per DDD pattern.
13
14
  *
@@ -37,9 +38,27 @@ import type { RoleDefs } from '@formicoidea/labre-core/std/gfx';
37
38
  * would show a sentence the framework does not say. They therefore declare none,
38
39
  * which is exactly what an untyped edge already did.
39
40
  *
41
+ * ## The cloud is a `system`, not a Big Ball of Mud
42
+ *
43
+ * DDD Crew's cheat sheet defines Big Ball of Mud as "a (part of a) system which
44
+ * is a mess" — a DEMARCATION of a system's quality, not a kind of node. The
45
+ * cloud is the thing being demarcated: something out there the map integrates
46
+ * with and does not model as a bounded context (a legacy, a vendor package, a
47
+ * mess). Naming the role `big-ball-of-mud` would make every cloud a quality
48
+ * claim the user never made, and the id `context-map:bbom` is the PATTERN's
49
+ * already. So the role is the neutral `context-map:system`, and its label keeps
50
+ * the Big Ball of Mud reading in sight because that is what the palette entry
51
+ * has always said.
52
+ *
53
+ * The role exists so the automatic legend can SEE a cloud (detection is by role
54
+ * only). It is deliberately absent from every rule's endpoint matrix: a
55
+ * relationship drawn onto a cloud stays outside the alphabet, hence unjudged
56
+ * (`rules.ts`, CM1).
57
+ *
40
58
  * ## Compat
41
59
  *
42
- * Nothing is backfilled. Relationships drawn before these roles existed — the
60
+ * Nothing is backfilled. A cloud placed before `context-map:system` existed
61
+ * carries no role, stays out of the legend, and is otherwise the same drawing. Relationships drawn before these roles existed — the
43
62
  * old free connector + tag + U/D markers group — carry no role and are never
44
63
  * evaluated (promesse #71): they stay drawings, in the documents they are in.
45
64
  */
@@ -47,7 +66,7 @@ import type { RoleDefs } from '@formicoidea/labre-core/std/gfx';
47
66
  export type ContextMapPatternKind = (typeof CM_RELATIONSHIPS)[number]['kind'];
48
67
  export type ContextMapRoleId = `context-map:${string}`;
49
68
  export declare const CM_PATTERN_ROLE: Record<ContextMapPatternKind, ContextMapRoleId>;
50
- /** The three roles that are not a pattern, plus the pattern ids. */
69
+ /** The four roles that are not a pattern, plus the pattern ids. */
51
70
  export declare const CONTEXT_MAP_ROLE: {
52
71
  readonly partnership: `context-map:${string}`;
53
72
  readonly sharedKernel: `context-map:${string}`;
@@ -60,6 +79,7 @@ export declare const CONTEXT_MAP_ROLE: {
60
79
  readonly bbom: `context-map:${string}`;
61
80
  readonly board: "context-map:board";
62
81
  readonly context: "context-map:context";
82
+ readonly system: "context-map:system";
63
83
  readonly relationship: "context-map:relationship";
64
84
  };
65
85
  export declare const CONTEXT_MAP_ROLES: RoleDefs;
package/dist/roles.js CHANGED
@@ -10,10 +10,11 @@ export const CM_PATTERN_ROLE = Object.fromEntries(CM_RELATIONSHIPS.map(preset =>
10
10
  preset.kind,
11
11
  `context-map:${kebab(preset.kind)}`,
12
12
  ]));
13
- /** The three roles that are not a pattern, plus the pattern ids. */
13
+ /** The four roles that are not a pattern, plus the pattern ids. */
14
14
  export const CONTEXT_MAP_ROLE = {
15
15
  board: 'context-map:board',
16
16
  context: 'context-map:context',
17
+ system: 'context-map:system',
17
18
  relationship: 'context-map:relationship',
18
19
  ...CM_PATTERN_ROLE,
19
20
  };
@@ -40,6 +41,14 @@ const DEFS = [
40
41
  labelKey: 'com.labre.ddd-context-map.role.context',
41
42
  labelFallback: 'Bounded context',
42
43
  },
44
+ // The cloud. Specialises nothing — above all not `context-map:context`, which
45
+ // would pull it into the endpoint alphabet and the off-board rule.
46
+ {
47
+ id: CONTEXT_MAP_ROLE.system,
48
+ kind: 'node',
49
+ labelKey: 'com.labre.ddd-context-map.role.system',
50
+ labelFallback: 'System / Big Ball of Mud',
51
+ },
43
52
  // The edge parent. Carries no `direction` of its own: five of its nine
44
53
  // children have one and four do not, and a verb on the parent would be
45
54
  // inherited by the symmetric patterns that deny having one.
package/dist/rules.js CHANGED
@@ -59,10 +59,12 @@ import { CONTEXT_MAP_ROLE, CONTEXT_MAP_ROLES } from './roles.js';
59
59
  * tolerable but the correct notation. Judging it would be indicting the act of
60
60
  * sketching (PRD principle 8).
61
61
  *
62
- * The branch becomes reachable the day a second NODE role lands — a role on the
63
- * cloud, say — and on that day this declaration already says what to do with it
64
- * without a line changing. Until then `offMatrix` carries no words of its own
65
- * and the rule's own sentence stands behind it, unused.
62
+ * The cloud has a role of its own since 17/09/2026 (`context-map:system`, there
63
+ * so the legend can list it) and that changes nothing here: the alphabet is the
64
+ * roles the MATRIX cites, not the roles the vocabulary declares, and `system`
65
+ * is cited by no triplet. The branch becomes reachable only the day a second
66
+ * node role is written INTO a triplet. Until then `offMatrix` carries no words
67
+ * of its own and the rule's own sentence stands behind it, unused.
66
68
  */
67
69
  const relationshipEndpoints = {
68
70
  id: 'context-map.relationship-endpoints',
package/dist/templates.js CHANGED
@@ -30,8 +30,13 @@ const BUBBLE_PREVIEW = `<svg ${ATTRS} fill="none"><rect x="20" y="25" width="95"
30
30
  const CLOUD_PREVIEW = `<svg ${ATTRS} fill="none"><path d="M30 52 C18 52 16 40 26 37 C24 25 42 24 46 32 C50 22 70 24 70 35 C84 32 90 46 78 50 Z" fill="${CLOUD.fill}" stroke="${CLOUD.stroke}" stroke-width="1.4"/></svg>`;
31
31
  export const contextMapTemplateCategory = {
32
32
  name: 'Context Map',
33
+ // Reuses the senior button's own key — see `TemplateCategory.nameKey`.
34
+ nameKey: 'com.labre.framework.ddd-context-map',
33
35
  templates: [
34
- templateFromCommand(byLabel('Context Map board'), BOARD_PREVIEW, 'Context Map board'),
36
+ // No name override: it would only restate `addBoard`'s own
37
+ // `labelFallback` as a second literal the panel could not translate — see
38
+ // `resolveTemplateName`, which reads the command's `labelKey` instead.
39
+ templateFromCommand(byLabel('Context Map board'), BOARD_PREVIEW),
35
40
  templateFromCommand(byLabel('Bounded Context'), BUBBLE_PREVIEW, 'Context Map — Bounded Context'),
36
41
  templateFromCommand(byLabel('Cloud / System (Big Ball of Mud)'), CLOUD_PREVIEW, 'Context Map — Cloud / System'),
37
42
  ],
@@ -1,16 +1,13 @@
1
- import { type ToolbarContext } from '@formicoidea/labre-core/shared/services';
1
+ import { type ToolbarContext, type ToolbarModuleConfig } from '@formicoidea/labre-core/shared/services';
2
2
  /**
3
- * The selected board's contextual toolbar: the resize toggle, and the automatic
4
- * legend of what is actually drawn on the board. Registered ALWAYS-ON
5
- * (`DddContextMapRenderViewExtension`) — a stored board must stay usable with
6
- * the Context Map button switched off (`docs/adr/0009`), legend included: a
7
- * legend is real editable elements, so generating one is authoring a document,
8
- * not tooling that a flag may take away.
3
+ * The selected board's ALWAYS-ON row: the resize toggle, and nothing else. A
4
+ * stored board must stay usable with the Context Map button switched off
5
+ * (`docs/adr/0009`) — it keeps its handles, and everything already drawn on it,
6
+ * legend boxes included, keeps being painted.
9
7
  *
10
- * This is THE legend of the module. The palette used to also offer a static,
11
- * full-notation one; the PO's recette (27/08/2026) removed it — two legends were
12
- * two answers to one question, and the honest answer is what is actually drawn.
13
- * Same single-gesture shape as Core Domain Chart.
8
+ * The legend BUTTON moved out of here to {@link contextMapBoardToolingToolbarConfig}
9
+ * (`docs/adr/0026`): generating one is a gesture the flag may take away, even
10
+ * though what it writes is document content.
14
11
  */
15
12
  export declare const contextMapBoardToolbarConfig: {
16
13
  readonly actions: [{
@@ -19,12 +16,24 @@ export declare const contextMapBoardToolbarConfig: {
19
16
  readonly icon: import("lit-html").TemplateResult<1>;
20
17
  readonly active: (ctx: ToolbarContext) => boolean;
21
18
  readonly run: (ctx: ToolbarContext) => void;
22
- }, {
23
- readonly id: "b.legend";
24
- readonly tooltipWording: import("@formicoidea/labre-core/shared/services").ChromeWording;
25
- readonly icon: import("lit-html").TemplateResult<1>;
26
- readonly run: (ctx: ToolbarContext) => void;
27
19
  }];
28
20
  readonly when: (ctx: ToolbarContext) => boolean;
29
21
  };
30
22
  export declare const contextMapBoardToolbarExtension: import("@formicoidea/labre-core/store").ExtensionType;
23
+ /**
24
+ * The board's FLAG-GATED row, whole: the legend button and the Validation
25
+ * dropdown, in one module.
26
+ *
27
+ * They cannot be two, and that is a hard constraint rather than a preference:
28
+ * `ToolbarModuleExtension` binds by DI variant, so a second module claiming
29
+ * `custom:affine:surface:contextMap` throws `DuplicateServiceDefinitionError`
30
+ * before the editor finishes setting up. The C4 board's own row was merged this
31
+ * way first (`c4BoardToolingToolbarConfig`).
32
+ *
33
+ * Both entries go with the `ddd-context-map` flag for the same reason: turning
34
+ * it off takes away the gesture that GENERATES legend elements and the choice of
35
+ * how hard to check the map, and leaves the stored board its handles and
36
+ * everything already written on it. The legend rows themselves are derived from
37
+ * `contextMapCommands` — the module writes no table (`docs/adr/0026`).
38
+ */
39
+ export declare const contextMapBoardToolingToolbarConfig: ToolbarModuleConfig;
@@ -1,10 +1,8 @@
1
- import { EdgelessCRUDIdentifier } from '@formicoidea/labre-core/blocks/surface';
2
- import { createAutoLegend, dddLegendIcon } from '@formicoidea/labre-ddd-shared';
1
+ import { EdgelessCRUDIdentifier, legendToolbarAction, validationToolbarConfig, } from '@formicoidea/labre-core/blocks/surface';
3
2
  import { ContextMapBoardElementModel } from '@formicoidea/labre-core/model';
4
- import { BOARD_LEGEND_NOTATION, BOARD_RESIZE_TOGGLE, TelemetryProvider, ToolbarModuleExtension, } from '@formicoidea/labre-core/shared/services';
3
+ import { BOARD_RESIZE_TOGGLE, ToolbarModuleExtension, } from '@formicoidea/labre-core/shared/services';
5
4
  import { BlockFlavourIdentifier } from '@formicoidea/labre-core/std';
6
5
  import { html } from 'lit';
7
- import { CONTEXT_MAP_AUTO_LEGEND } from '../legend.js';
8
6
  const ResizeIcon = html `<svg
9
7
  width="24"
10
8
  height="24"
@@ -19,17 +17,14 @@ const ResizeIcon = html `<svg
19
17
  <path d="M5 5l6 6M19 19l-6-6" />
20
18
  </svg>`;
21
19
  /**
22
- * The selected board's contextual toolbar: the resize toggle, and the automatic
23
- * legend of what is actually drawn on the board. Registered ALWAYS-ON
24
- * (`DddContextMapRenderViewExtension`) — a stored board must stay usable with
25
- * the Context Map button switched off (`docs/adr/0009`), legend included: a
26
- * legend is real editable elements, so generating one is authoring a document,
27
- * not tooling that a flag may take away.
20
+ * The selected board's ALWAYS-ON row: the resize toggle, and nothing else. A
21
+ * stored board must stay usable with the Context Map button switched off
22
+ * (`docs/adr/0009`) — it keeps its handles, and everything already drawn on it,
23
+ * legend boxes included, keeps being painted.
28
24
  *
29
- * This is THE legend of the module. The palette used to also offer a static,
30
- * full-notation one; the PO's recette (27/08/2026) removed it — two legends were
31
- * two answers to one question, and the honest answer is what is actually drawn.
32
- * Same single-gesture shape as Core Domain Chart.
25
+ * The legend BUTTON moved out of here to {@link contextMapBoardToolingToolbarConfig}
26
+ * (`docs/adr/0026`): generating one is a gesture the flag may take away, even
27
+ * though what it writes is document content.
33
28
  */
34
29
  export const contextMapBoardToolbarConfig = {
35
30
  actions: [
@@ -53,31 +48,6 @@ export const contextMapBoardToolbarConfig = {
53
48
  }
54
49
  },
55
50
  },
56
- {
57
- id: 'b.legend',
58
- tooltipWording: BOARD_LEGEND_NOTATION,
59
- icon: dddLegendIcon,
60
- run(ctx) {
61
- const board = ctx.getSurfaceModelsByType(ContextMapBoardElementModel)[0];
62
- if (!board)
63
- return;
64
- createAutoLegend(ctx.std, board, CONTEXT_MAP_AUTO_LEGEND);
65
- ctx.std
66
- .getOptional(TelemetryProvider)
67
- ?.track('FrameworkLegendCreated', {
68
- // The WIRE value, which is not the module id: the framework is
69
- // `ddd-context-map` in code and `context-map` in PostHog
70
- // (`frameworks.ts` `telemetryKey`, and the only value
71
- // `FrameworkElementEvent` accepts). Same convention as Wardley's own
72
- // legend button, so the two are comparable.
73
- framework: 'context-map',
74
- element: 'legend',
75
- page: 'whiteboard editor',
76
- segment: 'element toolbar',
77
- module: 'context-map toolbar',
78
- });
79
- },
80
- },
81
51
  ],
82
52
  when: (ctx) => ctx.getSurfaceModelsByType(ContextMapBoardElementModel).length > 0,
83
53
  };
@@ -85,3 +55,36 @@ export const contextMapBoardToolbarExtension = ToolbarModuleExtension({
85
55
  id: BlockFlavourIdentifier('affine:surface:contextMap'),
86
56
  config: contextMapBoardToolbarConfig,
87
57
  });
58
+ /**
59
+ * The board's FLAG-GATED row, whole: the legend button and the Validation
60
+ * dropdown, in one module.
61
+ *
62
+ * They cannot be two, and that is a hard constraint rather than a preference:
63
+ * `ToolbarModuleExtension` binds by DI variant, so a second module claiming
64
+ * `custom:affine:surface:contextMap` throws `DuplicateServiceDefinitionError`
65
+ * before the editor finishes setting up. The C4 board's own row was merged this
66
+ * way first (`c4BoardToolingToolbarConfig`).
67
+ *
68
+ * Both entries go with the `ddd-context-map` flag for the same reason: turning
69
+ * it off takes away the gesture that GENERATES legend elements and the choice of
70
+ * how hard to check the map, and leaves the stored board its handles and
71
+ * everything already written on it. The legend rows themselves are derived from
72
+ * `contextMapCommands` — the module writes no table (`docs/adr/0026`).
73
+ */
74
+ export const contextMapBoardToolingToolbarConfig = {
75
+ actions: [
76
+ legendToolbarAction({
77
+ Model: ContextMapBoardElementModel,
78
+ owner: 'ddd-context-map',
79
+ // The WIRE value, which is not the module id: the framework is
80
+ // `ddd-context-map` in code and `context-map` in PostHog (`frameworks.ts`
81
+ // `telemetryKey`). Unchanged by the button becoming shared.
82
+ framework: 'context-map',
83
+ }),
84
+ // The generic dropdown, not a Context Map variant of it: the config names no
85
+ // framework — it reads the registered rules and profiles — so this is the
86
+ // very same object c4, wardley and bpmn register.
87
+ ...validationToolbarConfig.actions,
88
+ ],
89
+ when: contextMapBoardToolbarConfig.when,
90
+ };
@@ -0,0 +1,32 @@
1
+ import type { FrameworkPalette, NamedPalette } from '@formicoidea/labre-core/components/color-picker';
2
+ import type { ChromeWording } from '@formicoidea/labre-core/shared/services';
3
+ /**
4
+ * The Context Map swatches' own names, resolved by `resolvePaletteLabel`
5
+ * (`@labre/affine-components/color-picker`) through each swatch's own
6
+ * {@link NamedPalette.labelWording} — the mechanism `WARDLEY_PALETTE_WORDINGS`
7
+ * established, reused here without either package naming the other.
8
+ *
9
+ * Exported so `../translations.ts` can list them under source `chrome`: a
10
+ * swatch's name is toolbar chrome, never seeded into a document. The keys are
11
+ * this framework's own even though the colours come from `ddd-shared`, which
12
+ * declares no `com.labre.*` key of its own by design (see its header).
13
+ */
14
+ export declare const CONTEXT_MAP_PALETTE_WORDING_BUBBLE: ChromeWording;
15
+ export declare const CONTEXT_MAP_PALETTE_WORDING_BUBBLE_OUTLINE: ChromeWording;
16
+ export declare const CONTEXT_MAP_PALETTE_WORDING_CLOUD: ChromeWording;
17
+ export declare const CONTEXT_MAP_PALETTE_WORDING_COLLABORATION: ChromeWording;
18
+ export declare const CONTEXT_MAP_PALETTE_WORDING_XAAS: ChromeWording;
19
+ export declare const CONTEXT_MAP_PALETTE_WORDING_FACILITATING: ChromeWording;
20
+ export declare const CONTEXT_MAP_PALETTE_WORDINGS: readonly ChromeWording[];
21
+ /**
22
+ * From the default editor palette we keep ONLY the neutrals — the historical
23
+ * colours say nothing in this notation.
24
+ */
25
+ export declare const CONTEXT_MAP_PALETTE_LIST: NamedPalette[];
26
+ /**
27
+ * The Context Map's page of the colour pickers' carousel (`docs/adr/0027`).
28
+ * Registered from the FLAG-GATED view extension, because offering hues is
29
+ * TOOLING: a map drawn while the flag was on keeps every colour it was painted
30
+ * with when the flag goes off (`docs/adr/0009`).
31
+ */
32
+ export declare const CONTEXT_MAP_FRAMEWORK_PALETTE: FrameworkPalette;
@@ -0,0 +1,112 @@
1
+ import { CLOUD, CM_BUBBLE, TEAM_TOPOLOGIES, } from '@formicoidea/labre-ddd-shared';
2
+ import { neutralPalettes } from '@formicoidea/labre-core/gfx/shape';
3
+ /**
4
+ * The Context Map swatches' own names, resolved by `resolvePaletteLabel`
5
+ * (`@labre/affine-components/color-picker`) through each swatch's own
6
+ * {@link NamedPalette.labelWording} — the mechanism `WARDLEY_PALETTE_WORDINGS`
7
+ * established, reused here without either package naming the other.
8
+ *
9
+ * Exported so `../translations.ts` can list them under source `chrome`: a
10
+ * swatch's name is toolbar chrome, never seeded into a document. The keys are
11
+ * this framework's own even though the colours come from `ddd-shared`, which
12
+ * declares no `com.labre.*` key of its own by design (see its header).
13
+ */
14
+ export const CONTEXT_MAP_PALETTE_WORDING_BUBBLE = [
15
+ 'com.labre.ddd-context-map.palette.bounded-context-blue',
16
+ 'Bounded context blue',
17
+ ];
18
+ export const CONTEXT_MAP_PALETTE_WORDING_BUBBLE_OUTLINE = [
19
+ 'com.labre.ddd-context-map.palette.bounded-context-outline',
20
+ 'Bounded context outline',
21
+ ];
22
+ export const CONTEXT_MAP_PALETTE_WORDING_CLOUD = [
23
+ 'com.labre.ddd-context-map.palette.big-ball-of-mud-lilac',
24
+ 'Big ball of mud lilac',
25
+ ];
26
+ export const CONTEXT_MAP_PALETTE_WORDING_COLLABORATION = [
27
+ 'com.labre.ddd-context-map.palette.collaboration-green',
28
+ 'Collaboration green',
29
+ ];
30
+ export const CONTEXT_MAP_PALETTE_WORDING_XAAS = [
31
+ 'com.labre.ddd-context-map.palette.x-as-a-service-blue',
32
+ 'X-as-a-Service blue',
33
+ ];
34
+ export const CONTEXT_MAP_PALETTE_WORDING_FACILITATING = [
35
+ 'com.labre.ddd-context-map.palette.facilitating-yellow',
36
+ 'Facilitating yellow',
37
+ ];
38
+ export const CONTEXT_MAP_PALETTE_WORDINGS = [
39
+ CONTEXT_MAP_PALETTE_WORDING_BUBBLE,
40
+ CONTEXT_MAP_PALETTE_WORDING_BUBBLE_OUTLINE,
41
+ CONTEXT_MAP_PALETTE_WORDING_CLOUD,
42
+ CONTEXT_MAP_PALETTE_WORDING_COLLABORATION,
43
+ CONTEXT_MAP_PALETTE_WORDING_XAAS,
44
+ CONTEXT_MAP_PALETTE_WORDING_FACILITATING,
45
+ ];
46
+ /**
47
+ * The Team Topologies interaction-mode fills, by kind — derived from
48
+ * {@link TEAM_TOPOLOGIES} rather than restated.
49
+ */
50
+ const TEAM_MODE_FILL = Object.fromEntries(TEAM_TOPOLOGIES.map(mode => [mode.kind, mode.fill]));
51
+ /**
52
+ * What a Context Map is drawn in: the bounded-context bubble (its wash and the
53
+ * blue it is outlined in), the Big-Ball-of-Mud cloud's lilac, and the three
54
+ * Team Topologies interaction modes — collaboration, X-as-a-Service,
55
+ * facilitating — whose LETTER is the notation and whose colour is the
56
+ * shorthand a reader picks up first.
57
+ *
58
+ * Every value is read off the shared DDD tables rather than restated, so the
59
+ * shelf and the notation cannot drift apart. They are SHORTCUTS, never
60
+ * constraints: no rule of this pack reads a colour.
61
+ */
62
+ const CONTEXT_MAP_PALETTES = [
63
+ {
64
+ key: 'Bounded context blue',
65
+ value: CM_BUBBLE.fill,
66
+ labelWording: CONTEXT_MAP_PALETTE_WORDING_BUBBLE,
67
+ },
68
+ {
69
+ key: 'Bounded context outline',
70
+ value: CM_BUBBLE.stroke,
71
+ labelWording: CONTEXT_MAP_PALETTE_WORDING_BUBBLE_OUTLINE,
72
+ },
73
+ {
74
+ key: 'Big ball of mud lilac',
75
+ value: CLOUD.fill,
76
+ labelWording: CONTEXT_MAP_PALETTE_WORDING_CLOUD,
77
+ },
78
+ {
79
+ key: 'Collaboration green',
80
+ value: TEAM_MODE_FILL.collaboration,
81
+ labelWording: CONTEXT_MAP_PALETTE_WORDING_COLLABORATION,
82
+ },
83
+ {
84
+ key: 'X-as-a-Service blue',
85
+ value: TEAM_MODE_FILL.xaas,
86
+ labelWording: CONTEXT_MAP_PALETTE_WORDING_XAAS,
87
+ },
88
+ {
89
+ key: 'Facilitating yellow',
90
+ value: TEAM_MODE_FILL.facilitating,
91
+ labelWording: CONTEXT_MAP_PALETTE_WORDING_FACILITATING,
92
+ },
93
+ ];
94
+ /**
95
+ * From the default editor palette we keep ONLY the neutrals — the historical
96
+ * colours say nothing in this notation.
97
+ */
98
+ export const CONTEXT_MAP_PALETTE_LIST = [
99
+ ...CONTEXT_MAP_PALETTES,
100
+ ...neutralPalettes(),
101
+ ];
102
+ /**
103
+ * The Context Map's page of the colour pickers' carousel (`docs/adr/0027`).
104
+ * Registered from the FLAG-GATED view extension, because offering hues is
105
+ * TOOLING: a map drawn while the flag was on keeps every colour it was painted
106
+ * with when the flag goes off (`docs/adr/0009`).
107
+ */
108
+ export const CONTEXT_MAP_FRAMEWORK_PALETTE = {
109
+ framework: 'ddd-context-map',
110
+ labelWording: ['com.labre.framework.ddd-context-map', 'Context Map'],
111
+ palettes: CONTEXT_MAP_PALETTE_LIST,
112
+ };
@@ -4,4 +4,5 @@ export declare class EdgelessDddContextMapSeniorButton extends DddSeniorButtonBa
4
4
  protected label: string;
5
5
  protected labelKey: string;
6
6
  protected icon: import("lit-html").TemplateResult<2>;
7
+ protected owner: "ddd-context-map";
7
8
  }
@@ -6,5 +6,6 @@ export class EdgelessDddContextMapSeniorButton extends DddSeniorButtonBase {
6
6
  this.label = 'Context Map';
7
7
  this.labelKey = 'com.labre.framework.ddd-context-map';
8
8
  this.icon = contextMapToolbarIcon;
9
+ this.owner = 'ddd-context-map';
9
10
  }
10
11
  }
@@ -1,11 +1,12 @@
1
1
  import { collectTranslationKeys, commandCategoryTranslationEntries, commandTranslationEntries, mergeTranslationEntries, } from '@formicoidea/labre-core/std';
2
2
  import { CONTEXT_MAP_BACKGROUND } from './background.js';
3
- import { contextMapCommands } from './commands.js';
3
+ import { CONTEXT_MAP_SEED_BOUNDED_CONTEXT, CONTEXT_MAP_SEED_CLOUD, CONTEXT_MAP_SEED_LEGEND_BOUNDARIES, CONTEXT_MAP_SEED_LEGEND_RELATIONSHIPS, contextMapCommands, } from './commands.js';
4
4
  import { CONTEXT_MAP_NUDGES } from './nudges.js';
5
5
  import { CONTEXT_MAP_PROFILES } from './profiles.js';
6
6
  import { CONTEXT_MAP_READING } from './reading.js';
7
7
  import { CONTEXT_MAP_ROLES } from './roles.js';
8
8
  import { CONTEXT_MAP_RULES } from './rules.js';
9
+ import { CONTEXT_MAP_PALETTE_WORDINGS } from './toolbar/palette.js';
9
10
  /**
10
11
  * THIS framework's contribution to the translation-key manifest — every
11
12
  * `com.labre.*` key Context Mapping can hand to `TranslationProvider.t`,
@@ -29,4 +30,17 @@ commandCategoryTranslationEntries(contextMapCommands), collectTranslationKeys('r
29
30
  // framework's own `roles`, so walking it reaches every role key the `role`
30
31
  // line above already named. `mergeTranslationEntries` keeps the FIRST
31
32
  // occurrence, which is what makes each key report the source it comes from.
32
- collectTranslationKeys('reading', CONTEXT_MAP_READING));
33
+ collectTranslationKeys('reading', CONTEXT_MAP_READING), [
34
+ CONTEXT_MAP_SEED_BOUNDED_CONTEXT,
35
+ CONTEXT_MAP_SEED_CLOUD,
36
+ CONTEXT_MAP_SEED_LEGEND_BOUNDARIES,
37
+ CONTEXT_MAP_SEED_LEGEND_RELATIONSHIPS,
38
+ ].map(([key, fallback]) => ({ key, fallback, source: 'seed' })),
39
+ // The carousel swatches' own names (`toolbar/palette.ts`) — chrome,
40
+ // re-rendered by the colour picker on every locale switch, never seeded
41
+ // into a document. Same treatment as Wardley's and EDGY's.
42
+ CONTEXT_MAP_PALETTE_WORDINGS.map(([key, fallback]) => ({
43
+ key,
44
+ fallback,
45
+ source: 'chrome',
46
+ })));
package/dist/view.js CHANGED
@@ -1,4 +1,5 @@
1
- import { QualityNudgeExtension, ReadingProfileExtension, validationToolbarConfig, ValidationProfileExtension, ValidationRuleExtension, } from '@formicoidea/labre-core/blocks/surface';
1
+ import { QualityNudgeExtension, ReadingProfileExtension, ValidationProfileExtension, ValidationRuleExtension, } from '@formicoidea/labre-core/blocks/surface';
2
+ import { FrameworkPaletteExtension } from '@formicoidea/labre-core/components/color-picker';
2
3
  import { ViewExtensionProvider, } from '@formicoidea/labre-core/ext-loader';
3
4
  import { ToolbarModuleExtension } from '@formicoidea/labre-core/shared/services';
4
5
  import { TemplateCategoryExtension } from '@formicoidea/labre-core/gfx/template';
@@ -14,7 +15,8 @@ import { CONTEXT_MAP_PROFILES } from './profiles.js';
14
15
  import { CONTEXT_MAP_READING } from './reading.js';
15
16
  import { CONTEXT_MAP_ROLES } from './roles.js';
16
17
  import { CONTEXT_MAP_RULES } from './rules.js';
17
- import { contextMapBoardToolbarExtension } from './toolbar/board-config.js';
18
+ import { contextMapBoardToolbarExtension, contextMapBoardToolingToolbarConfig, } from './toolbar/board-config.js';
19
+ import { CONTEXT_MAP_FRAMEWORK_PALETTE } from './toolbar/palette.js';
18
20
  import { contextMapSeniorTool } from './toolbar/senior-tool.js';
19
21
  /**
20
22
  * Context Map rendering — ALWAYS registered, independent of any flag.
@@ -70,16 +72,16 @@ export class DddContextMapViewExtension extends ViewExtensionProvider {
70
72
  context.register(ValidationRuleExtension(CONTEXT_MAP_RULES));
71
73
  context.register(ValidationProfileExtension(CONTEXT_MAP_PROFILES));
72
74
  context.register(QualityNudgeExtension(CONTEXT_MAP_NUDGES));
73
- // The Validation dropdown on a selected board's contextual toolbar. A
74
- // SECOND module on the same element, through the `custom:` flavour slot:
75
- // `contextMapBoardToolbarExtension` is registered always-on because a
76
- // stored board must keep its resize toggle, while choosing how hard to
77
- // check it is tooling and belongs here. The config names no framework —
78
- // it reads roles and profiles — so it is the very same object Wardley
79
- // registers on its own flavour.
75
+ // The board's gated row — the Legend button and the Validation dropdown,
76
+ // merged into ONE module because a flavour may carry exactly one
77
+ // (`board-config.ts`). A SECOND module on the same element, through the
78
+ // `custom:` flavour slot: `contextMapBoardToolbarExtension` is registered
79
+ // always-on because a stored board must keep its resize toggle, while
80
+ // generating a legend and choosing how hard to check the map are tooling
81
+ // and belong here.
80
82
  context.register(ToolbarModuleExtension({
81
83
  id: BlockFlavourIdentifier('custom:affine:surface:contextMap'),
82
- config: validationToolbarConfig,
84
+ config: contextMapBoardToolingToolbarConfig,
83
85
  }));
84
86
  // The reversed reading (MF3): what the map says about a bounded context,
85
87
  // on demand. One declaration — the roles and the relationship edge, both
@@ -88,6 +90,11 @@ export class DddContextMapViewExtension extends ViewExtensionProvider {
88
90
  // profile, so it goes with the flag without either side naming the other.
89
91
  context.register(ReadingProfileExtension(CONTEXT_MAP_READING));
90
92
  context.register(contextMapSeniorTool);
93
+ // The Context Map's page of the colour pickers' carousel
94
+ // (`docs/adr/0027`). Here, beside the senior tool, because offering hues
95
+ // is TOOLING — the colours already painted on a stored map are content
96
+ // and do not move (`docs/adr/0009`).
97
+ context.register(FrameworkPaletteExtension(CONTEXT_MAP_FRAMEWORK_PALETTE));
91
98
  // The Templates-panel category, gated by this framework's own flag like
92
99
  // every other framework's: a template is tooling (`docs/adr/0009`), and it
93
100
  // is DERIVED from this package's commands, so it registers where they do.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@formicoidea/labre-framework-ddd-context-map",
3
3
  "description": "Labre ddd-context-map framework for @formicoidea/labre-core.",
4
- "version": "0.40.0",
4
+ "version": "0.42.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "author": "lajola",
@@ -31,8 +31,8 @@
31
31
  "dist"
32
32
  ],
33
33
  "dependencies": {
34
- "@formicoidea/labre-core": "0.40.0",
35
- "@formicoidea/labre-ddd-shared": "0.40.0",
34
+ "@formicoidea/labre-core": "0.42.0",
35
+ "@formicoidea/labre-ddd-shared": "0.42.0",
36
36
  "lit": "^3.2.0"
37
37
  }
38
38
  }
package/dist/legend.d.ts DELETED
@@ -1,20 +0,0 @@
1
- import { type AutoLegendSpec } from '@formicoidea/labre-ddd-shared';
2
- /**
3
- * What the Context Map board's automatic legend can say — a TABLE, and nothing
4
- * else: the scan, the placement and the box are `createAutoLegend`'s job.
5
- *
6
- * Every row is DERIVED from the presets the palette itself draws from
7
- * ({@link CM_RELATIONSHIPS}, {@link CM_BUBBLE}) and from the role vocabulary's
8
- * own labels, never restated. A tenth pattern added to `CM_RELATIONSHIPS` gets
9
- * its legend row here with no edit, the same way it gets its role.
10
- *
11
- * ## What is missing, and why
12
- *
13
- * The **cloud** (the "System / Big Ball of Mud" blob) carries no role: it is
14
- * created neutral by `commands.ts`, deliberately — the endpoint grammar treats a
15
- * relationship drawn onto a cloud as a sketch and stays silent on it. Detection
16
- * is by role and only by role, so the automatic legend cannot list the cloud and
17
- * does not pretend to. The palette's static Legend entry still documents it, and
18
- * the day the cloud earns a role its row lands here in one line.
19
- */
20
- export declare const CONTEXT_MAP_AUTO_LEGEND: AutoLegendSpec;
package/dist/legend.js DELETED
@@ -1,56 +0,0 @@
1
- import { CM_BUBBLE, CM_RELATIONSHIPS, LABEL_COLOR, roleLabel, } from '@formicoidea/labre-ddd-shared';
2
- import { CM_PATTERN_ROLE, CONTEXT_MAP_ROLE, CONTEXT_MAP_ROLES } from './roles.js';
3
- /**
4
- * What the Context Map board's automatic legend can say — a TABLE, and nothing
5
- * else: the scan, the placement and the box are `createAutoLegend`'s job.
6
- *
7
- * Every row is DERIVED from the presets the palette itself draws from
8
- * ({@link CM_RELATIONSHIPS}, {@link CM_BUBBLE}) and from the role vocabulary's
9
- * own labels, never restated. A tenth pattern added to `CM_RELATIONSHIPS` gets
10
- * its legend row here with no edit, the same way it gets its role.
11
- *
12
- * ## What is missing, and why
13
- *
14
- * The **cloud** (the "System / Big Ball of Mud" blob) carries no role: it is
15
- * created neutral by `commands.ts`, deliberately — the endpoint grammar treats a
16
- * relationship drawn onto a cloud as a sketch and stays silent on it. Detection
17
- * is by role and only by role, so the automatic legend cannot list the cloud and
18
- * does not pretend to. The palette's static Legend entry still documents it, and
19
- * the day the cloud earns a role its row lands here in one line.
20
- */
21
- export const CONTEXT_MAP_AUTO_LEGEND = {
22
- title: 'Legend',
23
- width: 290,
24
- roles: CONTEXT_MAP_ROLES,
25
- sections: [
26
- {
27
- title: 'Boundaries',
28
- entries: [
29
- {
30
- role: CONTEXT_MAP_ROLE.context,
31
- row: {
32
- swatch: 'square',
33
- color: CM_BUBBLE.fill,
34
- label: roleLabel(CONTEXT_MAP_ROLES, CONTEXT_MAP_ROLE.context),
35
- },
36
- },
37
- ],
38
- },
39
- {
40
- title: 'Relationships',
41
- // One entry per PATTERN, not one for `context-map:relationship`: a legend
42
- // that said "Relationship" would document nothing a reader could use. The
43
- // dashed sample marks the two "no real integration" patterns, exactly as
44
- // the board draws them.
45
- entries: CM_RELATIONSHIPS.map(preset => ({
46
- role: CM_PATTERN_ROLE[preset.kind],
47
- row: {
48
- swatch: 'line',
49
- color: LABEL_COLOR,
50
- dashed: preset.dashed,
51
- label: `${preset.abbrev} — ${preset.label}`,
52
- },
53
- })),
54
- },
55
- ],
56
- };