@formicoidea/labre-framework-ddd-context-map 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.
@@ -1,4 +1,5 @@
1
1
  import { CLOUD, CM_BUBBLE, FONT_FAMILY } from '@formicoidea/labre-ddd-shared';
2
+ import { NOTATION_NEUTRALS } from '@formicoidea/labre-core/shared/consts';
2
3
  import { CONTEXT_MAP_ROLE } from './roles.js';
3
4
  /**
4
5
  * The Context Map board, DECLARED (the `FrameworkBackgroundDef` primitive).
@@ -34,8 +35,9 @@ export const CONTEXT_MAP_BACKGROUND = {
34
35
  chrome: {
35
36
  fontFamily: FONT_FAMILY,
36
37
  palette: {
37
- card: '#ffffff',
38
- cardBorder: '#d5d9e0',
38
+ /** The card: the shared notation scale's, painted at render time. */
39
+ card: NOTATION_NEUTRALS.cardFill,
40
+ cardBorder: NOTATION_NEUTRALS.cardBorder,
39
41
  /** The bounded-context pill: the map's own blue. */
40
42
  context: CM_BUBBLE.fill,
41
43
  contextBorder: CM_BUBBLE.stroke,
@@ -1,4 +1,17 @@
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;
3
16
  export declare const contextMapCommands: CommandDescriptor[];
4
17
  export declare const contextMapCommandIcons: Record<string, TemplateResult>;
package/dist/commands.js CHANGED
@@ -1,8 +1,28 @@
1
- import { addBubble, addCloud, CM_RELATIONSHIPS, placeDddElement, } from '@formicoidea/labre-ddd-shared';
1
+ import { addBubble, addCloud, CLOUD, CM_RELATIONSHIPS, placeDddElement, } from '@formicoidea/labre-ddd-shared';
2
+ import { NOTATION_NEUTRALS } from '@formicoidea/labre-core/shared/consts';
3
+ import { translateKey, } from '@formicoidea/labre-core/shared/services';
2
4
  import { GfxControllerIdentifier } from '@formicoidea/labre-core/std/gfx';
3
5
  import { svg } from 'lit';
4
6
  import { activateContextMapRelationship, createContextMapBoard, } from './actions.js';
5
7
  import { 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
+ ];
6
26
  /**
7
27
  * The Context Map palette as commands: the board, the bounded-context bubble,
8
28
  * the cloud and the nine relationship patterns (`docs/adr/0008`).
@@ -17,9 +37,9 @@ import { CONTEXT_MAP_ROLE } from './roles.js';
17
37
  * Chart makes. A palette that could also drop a second, static legend was two
18
38
  * answers to one question.
19
39
  */
20
- const boardSwatch = svg `<svg viewBox="0 0 24 24" fill="none"><rect x="2.5" y="4.5" width="19" height="15" rx="2" fill="#ffffff" stroke="currentColor" stroke-width="1.6"/><rect x="5.5" y="8" width="6" height="3.5" rx="1.75" fill="#e6f0fa" stroke="#2f6fb0" stroke-width="1.1"/><rect x="13" y="13" width="6" height="3.5" rx="1.75" fill="#e6f0fa" stroke="#2f6fb0" stroke-width="1.1"/><path d="M11.5 10.5 L13.5 13.8" stroke="currentColor" stroke-width="1.2"/></svg>`;
40
+ const boardSwatch = svg `<svg viewBox="0 0 24 24" fill="none"><rect x="2.5" y="4.5" width="19" height="15" rx="2" fill="${NOTATION_NEUTRALS.cardFill}" stroke="currentColor" stroke-width="1.6"/><rect x="5.5" y="8" width="6" height="3.5" rx="1.75" fill="#e6f0fa" stroke="#2f6fb0" stroke-width="1.1"/><rect x="13" y="13" width="6" height="3.5" rx="1.75" fill="#e6f0fa" stroke="#2f6fb0" stroke-width="1.1"/><path d="M11.5 10.5 L13.5 13.8" stroke="currentColor" stroke-width="1.2"/></svg>`;
21
41
  const bubbleSwatch = svg `<svg viewBox="0 0 24 24" fill="none"><rect x="2" y="7" width="20" height="10" rx="5" fill="#e6f0fa" stroke="#2f6fb0" stroke-width="1.6"/></svg>`;
22
- const cloudSwatch = svg `<svg viewBox="0 0 24 24" fill="none"><path d="M6 17 C3 17 2 14 4.5 12.5 C4 9 8 8 9.5 10 C11 6.5 16 7.5 16 11 C19 10.5 20.5 14 18 16 C18 17 16.5 17 15 17 Z" fill="#f0eef6" stroke="#6d6e71" stroke-width="1.4"/></svg>`;
42
+ const cloudSwatch = svg `<svg viewBox="0 0 24 24" fill="none"><path d="M6 17 C3 17 2 14 4.5 12.5 C4 9 8 8 9.5 10 C11 6.5 16 7.5 16 11 C19 10.5 20.5 14 18 16 C18 17 16.5 17 15 17 Z" fill="${CLOUD.fill}" stroke="${CLOUD.stroke}" stroke-width="1.4"/></svg>`;
23
43
  const relationSwatch = (dashed, arrow) => svg `<svg viewBox="0 0 24 24" fill="none"><path d="M3 12 H${arrow ? 17 : 21}" stroke="currentColor" stroke-width="2" stroke-dasharray="${dashed ? '3 3' : '0'}"/>${arrow ? svg `<path d="M15 8 L21 12 L15 16" stroke="currentColor" stroke-width="2" fill="none"/>` : ''}</svg>`;
24
44
  const SPECS = [
25
45
  {
@@ -40,10 +60,12 @@ const SPECS = [
40
60
  element: 'bounded-context',
41
61
  icon: bubbleSwatch,
42
62
  run: std => placeDddElement(std, (surface, cx, cy) =>
43
- // The role is what makes a bubble a bounded CONTEXT rather than a blue
44
- // pill: every rule in `rules.ts` reads it, and a pill drawn before WS2
45
- // carries none and is never evaluated (promesse #71).
46
- addBubble(surface, cx, cy, 'Bounded Context', CONTEXT_MAP_ROLE.context)),
63
+ // Translated HERE and once: the caption is document content the
64
+ // moment it lands (ADR 0016). The role is what makes a bubble a
65
+ // bounded CONTEXT rather than a blue pill: every rule in `rules.ts`
66
+ // reads it, and a pill drawn before WS2 carries none and is never
67
+ // evaluated (promesse #71).
68
+ addBubble(surface, cx, cy, translateKey(std, ...CONTEXT_MAP_SEED_BOUNDED_CONTEXT), CONTEXT_MAP_ROLE.context)),
47
69
  },
48
70
  {
49
71
  id: 'addCloud',
@@ -51,7 +73,9 @@ const SPECS = [
51
73
  iconKey: 'ddd-context-map.cloud',
52
74
  element: 'cloud',
53
75
  icon: cloudSwatch,
54
- run: std => placeDddElement(std, (surface, cx, cy) => addCloud(surface, std, cx, cy, 'System')),
76
+ run: std => placeDddElement(std, (surface, cx, cy) =>
77
+ // Translated HERE and once, like the bubble above (ADR 0016).
78
+ addCloud(surface, std, cx, cy, translateKey(std, ...CONTEXT_MAP_SEED_CLOUD))),
55
79
  },
56
80
  ...CM_RELATIONSHIPS.map((preset) => ({
57
81
  id: `add${preset.kind[0].toUpperCase()}${preset.kind.slice(1)}`,
package/dist/legend.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import { CM_BUBBLE, CM_RELATIONSHIPS, LABEL_COLOR, roleLabel, } from '@formicoidea/labre-ddd-shared';
2
+ import { BOARD_LEGEND_TITLE } from '@formicoidea/labre-core/shared/services';
2
3
  import { CM_PATTERN_ROLE, CONTEXT_MAP_ROLE, CONTEXT_MAP_ROLES } from './roles.js';
4
+ import { CONTEXT_MAP_SEED_LEGEND_BOUNDARIES, CONTEXT_MAP_SEED_LEGEND_RELATIONSHIPS, } from './translations.js';
3
5
  /**
4
6
  * What the Context Map board's automatic legend can say — a TABLE, and nothing
5
7
  * else: the scan, the placement and the box are `createAutoLegend`'s job.
@@ -19,12 +21,14 @@ import { CM_PATTERN_ROLE, CONTEXT_MAP_ROLE, CONTEXT_MAP_ROLES } from './roles.js
19
21
  * the day the cloud earns a role its row lands here in one line.
20
22
  */
21
23
  export const CONTEXT_MAP_AUTO_LEGEND = {
22
- title: 'Legend',
24
+ title: BOARD_LEGEND_TITLE[1],
25
+ titleKey: BOARD_LEGEND_TITLE[0],
23
26
  width: 290,
24
27
  roles: CONTEXT_MAP_ROLES,
25
28
  sections: [
26
29
  {
27
- title: 'Boundaries',
30
+ title: CONTEXT_MAP_SEED_LEGEND_BOUNDARIES[1],
31
+ titleKey: CONTEXT_MAP_SEED_LEGEND_BOUNDARIES[0],
28
32
  entries: [
29
33
  {
30
34
  role: CONTEXT_MAP_ROLE.context,
@@ -37,18 +41,24 @@ export const CONTEXT_MAP_AUTO_LEGEND = {
37
41
  ],
38
42
  },
39
43
  {
40
- title: 'Relationships',
44
+ title: CONTEXT_MAP_SEED_LEGEND_RELATIONSHIPS[1],
45
+ titleKey: CONTEXT_MAP_SEED_LEGEND_RELATIONSHIPS[0],
41
46
  // One entry per PATTERN, not one for `context-map:relationship`: a legend
42
47
  // that said "Relationship" would document nothing a reader could use. The
43
48
  // dashed sample marks the two "no real integration" patterns, exactly as
44
49
  // the board draws them.
45
50
  entries: CM_RELATIONSHIPS.map(preset => ({
46
51
  role: CM_PATTERN_ROLE[preset.kind],
52
+ labelPrefix: preset.abbrev,
47
53
  row: {
48
54
  swatch: 'line',
49
55
  color: LABEL_COLOR,
50
56
  dashed: preset.dashed,
51
- label: `${preset.abbrev} — ${preset.label}`,
57
+ // Overwritten by `resolveRowLabel` (labelPrefix + the role's own
58
+ // translated `labelKey`, which every one of the nine patterns
59
+ // carries) the moment the legend is actually built — this is the
60
+ // pre-translation placeholder only.
61
+ label: preset.label,
52
62
  },
53
63
  })),
54
64
  },
package/dist/templates.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { CLOUD, CM_BUBBLE } from '@formicoidea/labre-ddd-shared';
2
2
  import { templateFromCommand, } from '@formicoidea/labre-core/gfx/template';
3
+ import { NOTATION_NEUTRALS } from '@formicoidea/labre-core/shared/consts';
3
4
  import { contextMapCommands } from './commands.js';
4
5
  /**
5
6
  * The Context Map palette — DERIVED from the toolbox, one template per
@@ -24,13 +25,18 @@ function byLabel(label) {
24
25
  }
25
26
  const ATTRS = 'width="100%" height="100%" viewBox="0 0 135 80" xmlns="http://www.w3.org/2000/svg"';
26
27
  /** The map, in miniature: a white card, two contexts and the line between them. */
27
- const BOARD_PREVIEW = `<svg ${ATTRS} fill="none"><rect x="4" y="6" width="127" height="68" rx="6" fill="#ffffff" stroke="#d5d9e0" stroke-width="1.5"/><rect x="18" y="20" width="44" height="18" rx="9" fill="${CM_BUBBLE.fill}" stroke="${CM_BUBBLE.stroke}" stroke-width="1.5"/><rect x="74" y="44" width="44" height="18" rx="9" fill="${CM_BUBBLE.fill}" stroke="${CM_BUBBLE.stroke}" stroke-width="1.5"/><path d="M62 33 L76 48" stroke="#1f2328" stroke-width="1.5"/></svg>`;
28
+ const BOARD_PREVIEW = `<svg ${ATTRS} fill="none"><rect x="4" y="6" width="127" height="68" rx="6" fill="${NOTATION_NEUTRALS.cardFill}" stroke="${NOTATION_NEUTRALS.cardBorder}" stroke-width="1.5"/><rect x="18" y="20" width="44" height="18" rx="9" fill="${CM_BUBBLE.fill}" stroke="${CM_BUBBLE.stroke}" stroke-width="1.5"/><rect x="74" y="44" width="44" height="18" rx="9" fill="${CM_BUBBLE.fill}" stroke="${CM_BUBBLE.stroke}" stroke-width="1.5"/><path d="M62 33 L76 48" stroke="${NOTATION_NEUTRALS.ink}" stroke-width="1.5"/></svg>`;
28
29
  const BUBBLE_PREVIEW = `<svg ${ATTRS} fill="none"><rect x="20" y="25" width="95" height="30" rx="15" fill="${CM_BUBBLE.fill}" stroke="${CM_BUBBLE.stroke}" stroke-width="1.6"/></svg>`;
29
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>`;
30
31
  export const contextMapTemplateCategory = {
31
32
  name: 'Context Map',
33
+ // Reuses the senior button's own key — see `TemplateCategory.nameKey`.
34
+ nameKey: 'com.labre.framework.ddd-context-map',
32
35
  templates: [
33
- 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),
34
40
  templateFromCommand(byLabel('Bounded Context'), BUBBLE_PREVIEW, 'Context Map — Bounded Context'),
35
41
  templateFromCommand(byLabel('Cloud / System (Big Ball of Mud)'), CLOUD_PREVIEW, 'Context Map — Cloud / System'),
36
42
  ],
@@ -1,4 +1,14 @@
1
+ import type { ChromeWording } from '@formicoidea/labre-core/shared/services';
1
2
  import { type TranslationKeyManifestEntry } from '@formicoidea/labre-core/std';
3
+ /**
4
+ * The automatic legend's own section titles (`legend.ts`) — text stamped onto
5
+ * the board the moment the legend is built (`createAutoLegend`), like any
6
+ * other seed. The box title itself is NOT here: it says the shared word
7
+ * "Legend", so it reuses `BOARD_LEGEND_TITLE`
8
+ * (`@labre/affine-shared/services`) instead of a key of its own.
9
+ */
10
+ export declare const CONTEXT_MAP_SEED_LEGEND_BOUNDARIES: ChromeWording;
11
+ export declare const CONTEXT_MAP_SEED_LEGEND_RELATIONSHIPS: ChromeWording;
2
12
  /**
3
13
  * THIS framework's contribution to the translation-key manifest — every
4
14
  * `com.labre.*` key Context Mapping can hand to `TranslationProvider.t`,
@@ -1,11 +1,26 @@
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, 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
+ /**
10
+ * The automatic legend's own section titles (`legend.ts`) — text stamped onto
11
+ * the board the moment the legend is built (`createAutoLegend`), like any
12
+ * other seed. The box title itself is NOT here: it says the shared word
13
+ * "Legend", so it reuses `BOARD_LEGEND_TITLE`
14
+ * (`@labre/affine-shared/services`) instead of a key of its own.
15
+ */
16
+ export const CONTEXT_MAP_SEED_LEGEND_BOUNDARIES = [
17
+ 'com.labre.ddd-context-map.seed.legend-boundaries',
18
+ 'Boundaries',
19
+ ];
20
+ export const CONTEXT_MAP_SEED_LEGEND_RELATIONSHIPS = [
21
+ 'com.labre.ddd-context-map.seed.legend-relationships',
22
+ 'Relationships',
23
+ ];
9
24
  /**
10
25
  * THIS framework's contribution to the translation-key manifest — every
11
26
  * `com.labre.*` key Context Mapping can hand to `TranslationProvider.t`,
@@ -29,4 +44,9 @@ commandCategoryTranslationEntries(contextMapCommands), collectTranslationKeys('r
29
44
  // framework's own `roles`, so walking it reaches every role key the `role`
30
45
  // line above already named. `mergeTranslationEntries` keeps the FIRST
31
46
  // occurrence, which is what makes each key report the source it comes from.
32
- collectTranslationKeys('reading', CONTEXT_MAP_READING));
47
+ collectTranslationKeys('reading', CONTEXT_MAP_READING), [
48
+ CONTEXT_MAP_SEED_BOUNDED_CONTEXT,
49
+ CONTEXT_MAP_SEED_CLOUD,
50
+ CONTEXT_MAP_SEED_LEGEND_BOUNDARIES,
51
+ CONTEXT_MAP_SEED_LEGEND_RELATIONSHIPS,
52
+ ].map(([key, fallback]) => ({ key, fallback, source: 'seed' })));
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.39.3",
4
+ "version": "0.41.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.39.3",
35
- "@formicoidea/labre-ddd-shared": "0.39.3",
34
+ "@formicoidea/labre-core": "0.41.0",
35
+ "@formicoidea/labre-ddd-shared": "0.41.0",
36
36
  "lit": "^3.2.0"
37
37
  }
38
38
  }