@formicoidea/labre-framework-ddd-core-domain 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
@@ -12,3 +12,4 @@ export { coreDomainTemplateCategory } from './templates.js';
12
12
  export { coreDomainSeniorTool } from './toolbar/senior-tool.js';
13
13
  export { EdgelessDddCoreDomainSeniorButton } from './toolbar/senior-button.js';
14
14
  export { DddCoreDomainRenderViewExtension, DddCoreDomainViewExtension, } from './view.js';
15
+ export { CORE_DOMAIN_MARKER_READING, CORE_DOMAIN_READING, CORE_DOMAIN_READINGS, } from './reading.js';
package/dist/index.js CHANGED
@@ -15,3 +15,4 @@ export { coreDomainTemplateCategory } from './templates.js';
15
15
  export { coreDomainSeniorTool } from './toolbar/senior-tool.js';
16
16
  export { EdgelessDddCoreDomainSeniorButton } from './toolbar/senior-button.js';
17
17
  export { DddCoreDomainRenderViewExtension, DddCoreDomainViewExtension, } from './view.js';
18
+ export { CORE_DOMAIN_MARKER_READING, CORE_DOMAIN_READING, CORE_DOMAIN_READINGS, } from './reading.js';
@@ -0,0 +1,51 @@
1
+ import type { ReadingProfile } from '@formicoidea/labre-core/blocks/surface';
2
+ /**
3
+ * What a Core Domain Chart lets the tool read (MF3, the reversed reading).
4
+ *
5
+ * DATA, like the rules and the profiles beside it: the engine
6
+ * (`@labre/affine-block-surface`) knows how to read a role and a typed edge — it
7
+ * knows nothing about this framework. Everything below is already stated in
8
+ * `roles.ts` and is merely POINTED AT here.
9
+ *
10
+ * Registered from the FLAG-GATED view extension: reading a chart is tooling, so
11
+ * a chart whose flag is off keeps every element it has and simply stops being
12
+ * read (ADR 0009).
13
+ *
14
+ * ## TWO profiles, because the vocabulary has two disjoint node families
15
+ *
16
+ * `roles.ts` makes the split deliberately: a sub-domain is a thing PLOTTED at a
17
+ * (differentiation, complexity) position, a Team Topologies marker is an
18
+ * annotation about how work flows between teams. Neither specialises the other,
19
+ * so neither `appliesTo` can cover both — and giving them a common parent would
20
+ * mean minting a role the notation does not have, which ADR 0007 forbids.
21
+ *
22
+ * The chart itself is the FRAME and is not read.
23
+ *
24
+ * ## No nature, no phase
25
+ *
26
+ * The framework ships no type-3 tag pack: the five dot presets ARE roles, and
27
+ * the panel says them on the type line with the chain above them ("Platform
28
+ * sub-domain › Sub-domain"). And the chart's two axes are a plane, not a set of
29
+ * declared zones with ids — reading a phase off it would be an invented fact, so
30
+ * the section is absent rather than empty. A follow-up ticket covers the
31
+ * variant-scoped 2D zones the engine would need.
32
+ */
33
+ /**
34
+ * The dots: the five presets, and the two bounded-context positions.
35
+ *
36
+ * The MOVEMENT is the only typed edge on this board. ADR 0010 tier 2 on that
37
+ * role: the verb is "is moving to", so the SOURCE is where the context stands
38
+ * today and the TARGET where it is headed — an edge leaving the subject names
39
+ * where it goes, one arriving names where it came from.
40
+ */
41
+ export declare const CORE_DOMAIN_READING: ReadingProfile;
42
+ /**
43
+ * The Team Topologies markers.
44
+ *
45
+ * No relation: a movement runs between two positions of a bounded context, and
46
+ * `core-domain.malformed-movement` is written on exactly that. A marker is what
47
+ * the chart SAYS about an interaction, not a thing that moves.
48
+ */
49
+ export declare const CORE_DOMAIN_MARKER_READING: ReadingProfile;
50
+ /** Both profiles, in the order the view extension registers them. */
51
+ export declare const CORE_DOMAIN_READINGS: readonly ReadingProfile[];
@@ -0,0 +1,77 @@
1
+ import { CORE_DOMAIN_ROLE, CORE_DOMAIN_ROLES } from './roles.js';
2
+ /**
3
+ * What a Core Domain Chart lets the tool read (MF3, the reversed reading).
4
+ *
5
+ * DATA, like the rules and the profiles beside it: the engine
6
+ * (`@labre/affine-block-surface`) knows how to read a role and a typed edge — it
7
+ * knows nothing about this framework. Everything below is already stated in
8
+ * `roles.ts` and is merely POINTED AT here.
9
+ *
10
+ * Registered from the FLAG-GATED view extension: reading a chart is tooling, so
11
+ * a chart whose flag is off keeps every element it has and simply stops being
12
+ * read (ADR 0009).
13
+ *
14
+ * ## TWO profiles, because the vocabulary has two disjoint node families
15
+ *
16
+ * `roles.ts` makes the split deliberately: a sub-domain is a thing PLOTTED at a
17
+ * (differentiation, complexity) position, a Team Topologies marker is an
18
+ * annotation about how work flows between teams. Neither specialises the other,
19
+ * so neither `appliesTo` can cover both — and giving them a common parent would
20
+ * mean minting a role the notation does not have, which ADR 0007 forbids.
21
+ *
22
+ * The chart itself is the FRAME and is not read.
23
+ *
24
+ * ## No nature, no phase
25
+ *
26
+ * The framework ships no type-3 tag pack: the five dot presets ARE roles, and
27
+ * the panel says them on the type line with the chain above them ("Platform
28
+ * sub-domain › Sub-domain"). And the chart's two axes are a plane, not a set of
29
+ * declared zones with ids — reading a phase off it would be an invented fact, so
30
+ * the section is absent rather than empty. A follow-up ticket covers the
31
+ * variant-scoped 2D zones the engine would need.
32
+ */
33
+ /**
34
+ * The dots: the five presets, and the two bounded-context positions.
35
+ *
36
+ * The MOVEMENT is the only typed edge on this board. ADR 0010 tier 2 on that
37
+ * role: the verb is "is moving to", so the SOURCE is where the context stands
38
+ * today and the TARGET where it is headed — an edge leaving the subject names
39
+ * where it goes, one arriving names where it came from.
40
+ */
41
+ export const CORE_DOMAIN_READING = {
42
+ id: 'core-domain',
43
+ framework: 'ddd-core-domain',
44
+ roles: CORE_DOMAIN_ROLES,
45
+ appliesTo: CORE_DOMAIN_ROLE.subdomain,
46
+ relation: {
47
+ edgeRole: CORE_DOMAIN_ROLE.movement,
48
+ sides: {
49
+ consumer: {
50
+ labelKey: 'com.labre.core-domain.reading.relations.consumer',
51
+ labelFallback: 'Moved from',
52
+ },
53
+ supplier: {
54
+ labelKey: 'com.labre.core-domain.reading.relations.supplier',
55
+ labelFallback: 'Moves to',
56
+ },
57
+ },
58
+ },
59
+ };
60
+ /**
61
+ * The Team Topologies markers.
62
+ *
63
+ * No relation: a movement runs between two positions of a bounded context, and
64
+ * `core-domain.malformed-movement` is written on exactly that. A marker is what
65
+ * the chart SAYS about an interaction, not a thing that moves.
66
+ */
67
+ export const CORE_DOMAIN_MARKER_READING = {
68
+ id: 'core-domain-marker',
69
+ framework: 'ddd-core-domain',
70
+ roles: CORE_DOMAIN_ROLES,
71
+ appliesTo: CORE_DOMAIN_ROLE.marker,
72
+ };
73
+ /** Both profiles, in the order the view extension registers them. */
74
+ export const CORE_DOMAIN_READINGS = [
75
+ CORE_DOMAIN_READING,
76
+ CORE_DOMAIN_MARKER_READING,
77
+ ];
@@ -1,6 +1,2 @@
1
- /**
2
- * Core Domain Chart Templates-panel category. The builder lives in the shared
3
- * package so the aggregate package can register all DDD categories under the
4
- * single `ddd-templates` flag; re-exported here for a stable per-package API.
5
- */
6
- export { coreDomainTemplateCategory } from '@formicoidea/labre-ddd-shared';
1
+ import { type TemplateCategory } from '@formicoidea/labre-core/gfx/template';
2
+ export declare const coreDomainTemplateCategory: TemplateCategory;
package/dist/templates.js CHANGED
@@ -1,6 +1,37 @@
1
+ import { CD_SUBDOMAINS, TEAM_TOPOLOGIES } from '@formicoidea/labre-ddd-shared';
2
+ import { templateFromCommand, } from '@formicoidea/labre-core/gfx/template';
3
+ import { coreDomainCommands } from './commands.js';
1
4
  /**
2
- * Core Domain Chart Templates-panel category. The builder lives in the shared
3
- * package so the aggregate package can register all DDD categories under the
4
- * single `ddd-templates` flag; re-exported here for a stable per-package API.
5
+ * The Core Domain Chart 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 chart background had lost `role: core-domain:chart` (so the
10
+ * validation engine never saw a templated chart as a chart at all), the dots
11
+ * were bare ellipses with neither role, name nor group, and the markers were a
12
+ * single square instead of the square + glyph + caption the prefab groups.
13
+ * Derived, none of that can happen again.
14
+ *
15
+ * "Movement over time" has no template on purpose: it arms the connector tool
16
+ * and draws nothing (`docs/adr/0010`) — the movement is a pair the user draws.
5
17
  */
6
- export { coreDomainTemplateCategory } from '@formicoidea/labre-ddd-shared';
18
+ /** The command a derived template is the picture of. Throws rather than skips. */
19
+ function byLabel(label) {
20
+ const command = coreDomainCommands.find(entry => entry.labelFallback === label);
21
+ if (!command) {
22
+ throw new Error(`[ddd-core-domain] templates: no command "${label}"`);
23
+ }
24
+ return command;
25
+ }
26
+ const ATTRS = 'width="100%" height="100%" viewBox="0 0 135 80" xmlns="http://www.w3.org/2000/svg"';
27
+ const circ = (c) => `<svg ${ATTRS}><circle cx="68" cy="40" r="22" fill="${c}" stroke="#1f2328" stroke-width="1.5"/></svg>`;
28
+ const mk = (c, l) => `<svg ${ATTRS}><rect x="48" y="20" width="40" height="40" rx="5" fill="${c}" stroke="#1f2328" stroke-width="1.5"/><text x="68" y="47" text-anchor="middle" font-size="20" fill="#1f2328">${l}</text></svg>`;
29
+ const CHART_PREVIEW = `<svg ${ATTRS} fill="none"><rect x="10" y="6" width="115" height="62" fill="#4d9900" fill-opacity="0.5"/><rect x="10" y="6" width="22" height="62" fill="#9933ff" fill-opacity="0.5"/><path d="M10 68 V6 M10 68 H125" stroke="#1f2328" stroke-width="1.6"/></svg>`;
30
+ export const coreDomainTemplateCategory = {
31
+ name: 'Core Domain Chart',
32
+ templates: [
33
+ templateFromCommand(byLabel('Core Domain Chart'), CHART_PREVIEW, 'Core Domain Chart'),
34
+ ...CD_SUBDOMAINS.map(preset => templateFromCommand(byLabel(preset.label), circ(preset.fill), `Core Domain — ${preset.label}`)),
35
+ ...TEAM_TOPOLOGIES.map(preset => templateFromCommand(byLabel(preset.label), mk(preset.fill, preset.letter), `Team topology — ${preset.label}`)),
36
+ ],
37
+ };
@@ -3,6 +3,7 @@ import { coreDomainCommands } from './commands.js';
3
3
  import { CORE_DOMAIN_BACKGROUND } from './core-domain/background.js';
4
4
  import { CORE_DOMAIN_NUDGES } from './nudges.js';
5
5
  import { CORE_DOMAIN_PROFILES } from './profiles.js';
6
+ import { CORE_DOMAIN_READINGS } from './reading.js';
6
7
  import { CORE_DOMAIN_ROLES } from './roles.js';
7
8
  import { CORE_DOMAIN_RULES } from './rules.js';
8
9
  /**
@@ -23,4 +24,9 @@ export const coreDomainTranslationEntries = 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(coreDomainCommands), collectTranslationKeys('role', CORE_DOMAIN_ROLES), collectTranslationKeys('background', CORE_DOMAIN_BACKGROUND), collectTranslationKeys('rule', CORE_DOMAIN_RULES), collectTranslationKeys('nudge', CORE_DOMAIN_NUDGES), collectTranslationKeys('profile', CORE_DOMAIN_PROFILES));
27
+ commandCategoryTranslationEntries(coreDomainCommands), collectTranslationKeys('role', CORE_DOMAIN_ROLES), collectTranslationKeys('background', CORE_DOMAIN_BACKGROUND), collectTranslationKeys('rule', CORE_DOMAIN_RULES), collectTranslationKeys('nudge', CORE_DOMAIN_NUDGES), collectTranslationKeys('profile', CORE_DOMAIN_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', CORE_DOMAIN_READINGS));
package/dist/view.d.ts CHANGED
@@ -16,8 +16,7 @@ export declare class DddCoreDomainRenderViewExtension extends ViewExtensionProvi
16
16
  * work-quality checklist.
17
17
  *
18
18
  * Note: its Templates-panel category is registered by the aggregate package's
19
- * {@link DddTemplatesViewExtension} (gated by `ddd-templates`), so templates
20
- * stay available even when this senior button is disabled.
19
+ * The Templates-panel category is registered here too (see `effect`).
21
20
  */
22
21
  export declare class DddCoreDomainViewExtension extends ViewExtensionProvider {
23
22
  name: string;
package/dist/view.js CHANGED
@@ -1,9 +1,11 @@
1
- import { morphToolbarConfig, QualityNudgeExtension, validationToolbarConfig, ValidationProfileExtension, ValidationRuleExtension, } from '@formicoidea/labre-core/blocks/surface';
1
+ import { morphToolbarConfig, 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, toolbarModuleKey, } 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 { coreDomainCommandIcons, coreDomainCommands } from './commands.js';
8
+ import { coreDomainTemplateCategory } from './templates.js';
7
9
  import { CoreDomainRendererExtension } from './core-domain/element-renderer.js';
8
10
  import { CoreDomainInteraction, CoreDomainView, } from './core-domain/element-view.js';
9
11
  import { coreDomainToolbarExtension } from './core-domain/toolbar-config.js';
@@ -11,6 +13,7 @@ import { coreDomainEffects } from './effects.js';
11
13
  import { CORE_DOMAIN_MORPH_SPEC } from './morph.js';
12
14
  import { CORE_DOMAIN_NUDGES } from './nudges.js';
13
15
  import { CORE_DOMAIN_PROFILES } from './profiles.js';
16
+ import { CORE_DOMAIN_READINGS } from './reading.js';
14
17
  import { CORE_DOMAIN_ROLES } from './roles.js';
15
18
  import { CORE_DOMAIN_RULES } from './rules.js';
16
19
  import { coreDomainSeniorTool } from './toolbar/senior-tool.js';
@@ -49,8 +52,7 @@ export class DddCoreDomainRenderViewExtension extends ViewExtensionProvider {
49
52
  * work-quality checklist.
50
53
  *
51
54
  * Note: its Templates-panel category is registered by the aggregate package's
52
- * {@link DddTemplatesViewExtension} (gated by `ddd-templates`), so templates
53
- * stay available even when this senior button is disabled.
55
+ * The Templates-panel category is registered here too (see `effect`).
54
56
  */
55
57
  export class DddCoreDomainViewExtension extends ViewExtensionProvider {
56
58
  constructor() {
@@ -60,6 +62,10 @@ export class DddCoreDomainViewExtension extends ViewExtensionProvider {
60
62
  effect() {
61
63
  super.effect();
62
64
  coreDomainEffects();
65
+ // The Templates-panel category, gated by this framework's own flag like
66
+ // every other framework's: a template is tooling (`docs/adr/0009`), and it
67
+ // is DERIVED from this package's commands, so it registers where they do.
68
+ extendTemplateCategory(coreDomainTemplateCategory);
63
69
  }
64
70
  setup(context) {
65
71
  super.setup(context);
@@ -78,6 +84,14 @@ export class DddCoreDomainViewExtension extends ViewExtensionProvider {
78
84
  id: BlockFlavourIdentifier('custom:affine:surface:coreDomain'),
79
85
  config: validationToolbarConfig,
80
86
  }));
87
+ // The reversed reading (MF3): what the chart says about an artefact, on
88
+ // demand. Two profiles, because the vocabulary has two disjoint node
89
+ // families and neither may inherit the other's rules (`reading.ts`). The
90
+ // CLICK that triggers it is registered once by the surface and gated by
91
+ // the presence of a profile.
92
+ for (const reading of CORE_DOMAIN_READINGS) {
93
+ context.register(ReadingProfileExtension(reading));
94
+ }
81
95
  context.register(coreDomainSeniorTool);
82
96
  context.register(CommandExtension(coreDomainCommands, coreDomainCommandIcons));
83
97
  // The "Change type" dropdown on a selected dot's or marker's contextual
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@formicoidea/labre-framework-ddd-core-domain",
3
3
  "description": "Labre ddd-core-domain 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
  }