@formicoidea/labre-framework-ddd-context-map 0.36.0 → 0.38.1

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 CHANGED
@@ -9,3 +9,4 @@ export { contextMapTemplateCategory } from './templates.js';
9
9
  export { contextMapSeniorTool } from './toolbar/senior-tool.js';
10
10
  export { EdgelessDddContextMapSeniorButton } from './toolbar/senior-button.js';
11
11
  export { DddContextMapRenderViewExtension, DddContextMapViewExtension, } from './view.js';
12
+ export { CONTEXT_MAP_READING } from './reading.js';
package/dist/index.js CHANGED
@@ -9,3 +9,4 @@ export { contextMapTemplateCategory } from './templates.js';
9
9
  export { contextMapSeniorTool } from './toolbar/senior-tool.js';
10
10
  export { EdgelessDddContextMapSeniorButton } from './toolbar/senior-button.js';
11
11
  export { DddContextMapRenderViewExtension, DddContextMapViewExtension, } from './view.js';
12
+ export { CONTEXT_MAP_READING } from './reading.js';
@@ -0,0 +1,36 @@
1
+ import type { ReadingProfile } from '@formicoidea/labre-core/blocks/surface';
2
+ /**
3
+ * What a Context Map lets the tool read of a bounded context (MF3, the reversed
4
+ * reading).
5
+ *
6
+ * DATA, like the rules and the profiles beside it: the engine
7
+ * (`@labre/affine-block-surface`) knows how to read a role and a typed edge — it
8
+ * knows nothing about context mapping. Everything below is already stated in
9
+ * `roles.ts` and is merely POINTED AT here.
10
+ *
11
+ * Registered from the FLAG-GATED view extension: reading a map is tooling, so a
12
+ * board whose flag is off keeps every element it has and simply stops being read
13
+ * (ADR 0009).
14
+ *
15
+ * ## One subject, and the board is not it
16
+ *
17
+ * `context-map:context` is the only artefact this notation places; the board is
18
+ * the FRAME and specialises nothing, exactly so that what is written about the
19
+ * contexts never falls on the card they sit on.
20
+ *
21
+ * ## The nine patterns are read through their parent
22
+ *
23
+ * `appliesTo` on the relation is `context-map:relationship`, and the nine DDD
24
+ * Crew patterns specialise it — so `roleIsA` reaches every one of them without
25
+ * this file naming a single pattern. The four SYMMETRIC ones (Partnership,
26
+ * Shared Kernel, Separate Ways, Big Ball of Mud) declare no `direction`, and the
27
+ * panel still lists them under whichever side the drawing put them on: that is
28
+ * not a claim about upstream and downstream, it is where the link happens to
29
+ * start. The asymmetry is the notation's, and `roles.ts` is where it is argued.
30
+ *
31
+ * ## No nature, no phase
32
+ *
33
+ * The framework ships no type-3 tag pack, and the board declares no zones a
34
+ * position could be read against.
35
+ */
36
+ export declare const CONTEXT_MAP_READING: ReadingProfile;
@@ -0,0 +1,57 @@
1
+ import { CONTEXT_MAP_ROLE, CONTEXT_MAP_ROLES } from './roles.js';
2
+ /**
3
+ * What a Context Map lets the tool read of a bounded context (MF3, the reversed
4
+ * reading).
5
+ *
6
+ * DATA, like the rules and the profiles beside it: the engine
7
+ * (`@labre/affine-block-surface`) knows how to read a role and a typed edge — it
8
+ * knows nothing about context mapping. Everything below is already stated in
9
+ * `roles.ts` and is merely POINTED AT here.
10
+ *
11
+ * Registered from the FLAG-GATED view extension: reading a map is tooling, so a
12
+ * board whose flag is off keeps every element it has and simply stops being read
13
+ * (ADR 0009).
14
+ *
15
+ * ## One subject, and the board is not it
16
+ *
17
+ * `context-map:context` is the only artefact this notation places; the board is
18
+ * the FRAME and specialises nothing, exactly so that what is written about the
19
+ * contexts never falls on the card they sit on.
20
+ *
21
+ * ## The nine patterns are read through their parent
22
+ *
23
+ * `appliesTo` on the relation is `context-map:relationship`, and the nine DDD
24
+ * Crew patterns specialise it — so `roleIsA` reaches every one of them without
25
+ * this file naming a single pattern. The four SYMMETRIC ones (Partnership,
26
+ * Shared Kernel, Separate Ways, Big Ball of Mud) declare no `direction`, and the
27
+ * panel still lists them under whichever side the drawing put them on: that is
28
+ * not a claim about upstream and downstream, it is where the link happens to
29
+ * start. The asymmetry is the notation's, and `roles.ts` is where it is argued.
30
+ *
31
+ * ## No nature, no phase
32
+ *
33
+ * The framework ships no type-3 tag pack, and the board declares no zones a
34
+ * position could be read against.
35
+ */
36
+ export const CONTEXT_MAP_READING = {
37
+ id: 'context-map',
38
+ framework: 'ddd-context-map',
39
+ roles: CONTEXT_MAP_ROLES,
40
+ appliesTo: CONTEXT_MAP_ROLE.context,
41
+ relation: {
42
+ edgeRole: CONTEXT_MAP_ROLE.relationship,
43
+ // The DDD Crew wording, verbatim, and the direction `roles.ts` declares:
44
+ // the SOURCE is the upstream context. So an edge leaving the subject names
45
+ // what is downstream of it, and one arriving names what it is downstream of.
46
+ sides: {
47
+ consumer: {
48
+ labelKey: 'com.labre.ddd-context-map.reading.relations.consumer',
49
+ labelFallback: 'Upstream',
50
+ },
51
+ supplier: {
52
+ labelKey: 'com.labre.ddd-context-map.reading.relations.supplier',
53
+ labelFallback: 'Downstream',
54
+ },
55
+ },
56
+ },
57
+ };
@@ -1,6 +1,2 @@
1
- /**
2
- * Context Map Templates-panel category. The builder lives in the shared package
3
- * so the aggregate package can register all DDD categories under the single
4
- * `ddd-templates` flag; re-exported here for a stable per-package API.
5
- */
6
- export { contextMapTemplateCategory } from '@formicoidea/labre-ddd-shared';
1
+ import { type TemplateCategory } from '@formicoidea/labre-core/gfx/template';
2
+ export declare const contextMapTemplateCategory: TemplateCategory;
package/dist/templates.js CHANGED
@@ -1,6 +1,37 @@
1
+ import { CLOUD, CM_BUBBLE } from '@formicoidea/labre-ddd-shared';
2
+ import { templateFromCommand, } from '@formicoidea/labre-core/gfx/template';
3
+ import { contextMapCommands } from './commands.js';
1
4
  /**
2
- * Context Map Templates-panel category. The builder lives in the shared package
3
- * so the aggregate package can register all DDD categories under the single
4
- * `ddd-templates` flag; re-exported here for a stable per-package API.
5
+ * The Context Map palette — DERIVED from the toolbox, one template per
6
+ * placement command.
7
+ *
8
+ * It used to be hand-written surface JSON in `ddd-shared`, untouched since
9
+ * 2026-06-21: the bubble carried neither `context-map:context` nor its overflow
10
+ * fit mode, the cloud's name was text stored on the polygon instead of the
11
+ * grouped label the prefab writes, there was no board template, and NINE of the
12
+ * eleven entries were free-floating connectors — the drawing WS2 removed from
13
+ * the toolbox (`docs/adr/0010`). Those nine are gone: their commands arm the
14
+ * connector tool, so there is no artefact to record and the user draws the
15
+ * relation between two real contexts.
5
16
  */
6
- export { contextMapTemplateCategory } from '@formicoidea/labre-ddd-shared';
17
+ /** The command a derived template is the picture of. Throws rather than skips. */
18
+ function byLabel(label) {
19
+ const command = contextMapCommands.find(entry => entry.labelFallback === label);
20
+ if (!command) {
21
+ throw new Error(`[ddd-context-map] templates: no command "${label}"`);
22
+ }
23
+ return command;
24
+ }
25
+ const ATTRS = 'width="100%" height="100%" viewBox="0 0 135 80" xmlns="http://www.w3.org/2000/svg"';
26
+ /** 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 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
+ 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
+ export const contextMapTemplateCategory = {
31
+ name: 'Context Map',
32
+ templates: [
33
+ templateFromCommand(byLabel('Context Map board'), BOARD_PREVIEW, 'Context Map board'),
34
+ templateFromCommand(byLabel('Bounded Context'), BUBBLE_PREVIEW, 'Context Map — Bounded Context'),
35
+ templateFromCommand(byLabel('Cloud / System (Big Ball of Mud)'), CLOUD_PREVIEW, 'Context Map — Cloud / System'),
36
+ ],
37
+ };
@@ -3,6 +3,7 @@ import { CONTEXT_MAP_BACKGROUND } from './background.js';
3
3
  import { contextMapCommands } from './commands.js';
4
4
  import { CONTEXT_MAP_NUDGES } from './nudges.js';
5
5
  import { CONTEXT_MAP_PROFILES } from './profiles.js';
6
+ import { CONTEXT_MAP_READING } from './reading.js';
6
7
  import { CONTEXT_MAP_ROLES } from './roles.js';
7
8
  import { CONTEXT_MAP_RULES } from './rules.js';
8
9
  /**
@@ -23,4 +24,9 @@ export const contextMapTranslationEntries = mergeTranslationEntries(commandTrans
23
24
  // registry names no framework category in the bundled distribution, so a
24
25
  // host that composed core's manifest alone drew translated entries under
25
26
  // English headers (#183).
26
- commandCategoryTranslationEntries(contextMapCommands), collectTranslationKeys('role', CONTEXT_MAP_ROLES), collectTranslationKeys('background', CONTEXT_MAP_BACKGROUND), collectTranslationKeys('rule', CONTEXT_MAP_RULES), collectTranslationKeys('nudge', CONTEXT_MAP_NUDGES), collectTranslationKeys('profile', CONTEXT_MAP_PROFILES));
27
+ commandCategoryTranslationEntries(contextMapCommands), collectTranslationKeys('role', CONTEXT_MAP_ROLES), collectTranslationKeys('background', CONTEXT_MAP_BACKGROUND), collectTranslationKeys('rule', CONTEXT_MAP_RULES), collectTranslationKeys('nudge', CONTEXT_MAP_NUDGES), collectTranslationKeys('profile', CONTEXT_MAP_PROFILES),
28
+ // LAST, and the order is load-bearing: a reading profile carries the
29
+ // framework's own `roles`, so walking it reaches every role key the `role`
30
+ // line above already named. `mergeTranslationEntries` keeps the FIRST
31
+ // occurrence, which is what makes each key report the source it comes from.
32
+ collectTranslationKeys('reading', CONTEXT_MAP_READING));
package/dist/view.d.ts CHANGED
@@ -19,8 +19,7 @@ export declare class DddContextMapRenderViewExtension extends ViewExtensionProvi
19
19
  * flag comes back.
20
20
  *
21
21
  * Note: its Templates-panel category is registered by the aggregate package's
22
- * {@link DddTemplatesViewExtension} (gated by `ddd-templates`), so templates
23
- * stay available even when this senior button is disabled.
22
+ * The Templates-panel category is registered here too (see `effect`).
24
23
  */
25
24
  export declare class DddContextMapViewExtension extends ViewExtensionProvider {
26
25
  name: string;
package/dist/view.js CHANGED
@@ -1,14 +1,17 @@
1
- import { QualityNudgeExtension, validationToolbarConfig, ValidationProfileExtension, ValidationRuleExtension, } from '@formicoidea/labre-core/blocks/surface';
1
+ import { QualityNudgeExtension, ReadingProfileExtension, validationToolbarConfig, ValidationProfileExtension, ValidationRuleExtension, } from '@formicoidea/labre-core/blocks/surface';
2
2
  import { ViewExtensionProvider, } from '@formicoidea/labre-core/ext-loader';
3
3
  import { ToolbarModuleExtension } from '@formicoidea/labre-core/shared/services';
4
+ import { extendTemplateCategory } from '@formicoidea/labre-core/gfx/template';
4
5
  import { BlockFlavourIdentifier, CommandExtension } from '@formicoidea/labre-core/std';
5
6
  import { RoleVocabularyExtension } from '@formicoidea/labre-core/std/gfx';
6
7
  import { contextMapCommandIcons, contextMapCommands } from './commands.js';
8
+ import { contextMapTemplateCategory } from './templates.js';
7
9
  import { contextMapEffects } from './effects.js';
8
10
  import { ContextMapRendererExtension } from './element-renderer.js';
9
11
  import { ContextMapInteraction, ContextMapView } from './element-view.js';
10
12
  import { CONTEXT_MAP_NUDGES } from './nudges.js';
11
13
  import { CONTEXT_MAP_PROFILES } from './profiles.js';
14
+ import { CONTEXT_MAP_READING } from './reading.js';
12
15
  import { CONTEXT_MAP_ROLES } from './roles.js';
13
16
  import { CONTEXT_MAP_RULES } from './rules.js';
14
17
  import { contextMapBoardToolbarExtension } from './toolbar/board-config.js';
@@ -51,8 +54,7 @@ export class DddContextMapRenderViewExtension extends ViewExtensionProvider {
51
54
  * flag comes back.
52
55
  *
53
56
  * Note: its Templates-panel category is registered by the aggregate package's
54
- * {@link DddTemplatesViewExtension} (gated by `ddd-templates`), so templates
55
- * stay available even when this senior button is disabled.
57
+ * The Templates-panel category is registered here too (see `effect`).
56
58
  */
57
59
  export class DddContextMapViewExtension extends ViewExtensionProvider {
58
60
  constructor() {
@@ -62,6 +64,10 @@ export class DddContextMapViewExtension extends ViewExtensionProvider {
62
64
  effect() {
63
65
  super.effect();
64
66
  contextMapEffects();
67
+ // The Templates-panel category, gated by this framework's own flag like
68
+ // every other framework's: a template is tooling (`docs/adr/0009`), and it
69
+ // is DERIVED from this package's commands, so it registers where they do.
70
+ extendTemplateCategory(contextMapTemplateCategory);
65
71
  }
66
72
  setup(context) {
67
73
  super.setup(context);
@@ -80,6 +86,12 @@ export class DddContextMapViewExtension extends ViewExtensionProvider {
80
86
  id: BlockFlavourIdentifier('custom:affine:surface:contextMap'),
81
87
  config: validationToolbarConfig,
82
88
  }));
89
+ // The reversed reading (MF3): what the map says about a bounded context,
90
+ // on demand. One declaration — the roles and the relationship edge, both
91
+ // already stated elsewhere in this framework. The CLICK that triggers it
92
+ // is registered once by the surface and gated by the presence of this
93
+ // profile, so it goes with the flag without either side naming the other.
94
+ context.register(ReadingProfileExtension(CONTEXT_MAP_READING));
83
95
  context.register(contextMapSeniorTool);
84
96
  context.register(CommandExtension(contextMapCommands, contextMapCommandIcons));
85
97
  }
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.36.0",
4
+ "version": "0.38.1",
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.36.0",
35
- "@formicoidea/labre-ddd-shared": "0.36.0",
34
+ "@formicoidea/labre-core": "0.38.1",
35
+ "@formicoidea/labre-ddd-shared": "0.38.1",
36
36
  "lit": "^3.2.0"
37
37
  }
38
38
  }