@formicoidea/labre-framework-ddd-context-map 0.37.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.
@@ -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
+ };
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,9 +1,11 @@
1
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';
@@ -52,8 +54,7 @@ export class DddContextMapRenderViewExtension extends ViewExtensionProvider {
52
54
  * flag comes back.
53
55
  *
54
56
  * Note: its Templates-panel category is registered by the aggregate package's
55
- * {@link DddTemplatesViewExtension} (gated by `ddd-templates`), so templates
56
- * stay available even when this senior button is disabled.
57
+ * The Templates-panel category is registered here too (see `effect`).
57
58
  */
58
59
  export class DddContextMapViewExtension extends ViewExtensionProvider {
59
60
  constructor() {
@@ -63,6 +64,10 @@ export class DddContextMapViewExtension extends ViewExtensionProvider {
63
64
  effect() {
64
65
  super.effect();
65
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);
66
71
  }
67
72
  setup(context) {
68
73
  super.setup(context);
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.37.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.37.0",
35
- "@formicoidea/labre-ddd-shared": "0.37.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
  }