@formicoidea/labre-framework-ddd-context-map 0.32.0 → 0.33.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,15 +1,20 @@
1
- import { commandTranslationEntries, } from '@formicoidea/labre-core/std';
1
+ import { collectTranslationKeys, commandTranslationEntries, mergeTranslationEntries, } from '@formicoidea/labre-core/std';
2
+ import { CONTEXT_MAP_BACKGROUND } from './background.js';
2
3
  import { contextMapCommands } from './commands.js';
4
+ import { CONTEXT_MAP_NUDGES } from './nudges.js';
5
+ import { CONTEXT_MAP_PROFILES } from './profiles.js';
6
+ import { CONTEXT_MAP_ROLES } from './roles.js';
7
+ import { CONTEXT_MAP_RULES } from './rules.js';
3
8
  /**
4
- * THIS framework's contribution to the translation-key manifest.
9
+ * THIS framework's contribution to the translation-key manifest — every
10
+ * `com.labre.*` key Context Mapping can hand to `TranslationProvider.t`,
11
+ * derived from the very declarations the editor registers (never restated).
5
12
  *
6
- * Its command labels and descriptions are built from a TEMPLATE, so the
7
- * concrete keys exist nowhere but in the declarations themselves and the
8
- * core manifest could not restate them even if it wanted to. The
9
- * contribution therefore ships WITH the framework: in the bundled
10
- * distribution `@formicoidea/labre-framework-ddd-context-map` carries it, and a host
11
- * composes it into its catalogue exactly as it already composes
12
- * `contextMapCommands` into the command registry. See
13
- * `packages/affine/all/src/translations.ts`.
13
+ * It lives HERE, not in `@labre/affine/translations`, because the bundled
14
+ * distribution splits the library along exactly this line:
15
+ * `@formicoidea/labre-core` is the editor MINUS the frameworks, and a host that
16
+ * installs `@formicoidea/labre-framework-ddd-context-map` composes this export
17
+ * into the catalogue it builds the same sentence that already holds for
18
+ * `contextMapCommands`. See `packages/affine/all/src/translations.ts`.
14
19
  */
15
- export const contextMapTranslationEntries = commandTranslationEntries(contextMapCommands);
20
+ export const contextMapTranslationEntries = mergeTranslationEntries(commandTranslationEntries(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));
package/dist/view.d.ts CHANGED
@@ -1,6 +1,22 @@
1
1
  import { type ViewExtensionContext, ViewExtensionProvider } from '@formicoidea/labre-core/ext-loader';
2
2
  /**
3
- * Context Map — independently flag-gated (`ddd-context-map`).
3
+ * Context Map rendering ALWAYS registered, independent of any flag.
4
+ * Disabling `ddd-context-map` hides only the creation tooling (see
5
+ * {@link DddContextMapViewExtension}); boards already drawn must still paint,
6
+ * stay selectable, stay movable and keep their contextual toolbar. See
7
+ * `docs/adr/0009`.
8
+ */
9
+ export declare class DddContextMapRenderViewExtension extends ViewExtensionProvider {
10
+ name: string;
11
+ setup(context: ViewExtensionContext): void;
12
+ }
13
+ /**
14
+ * Context Map creation tooling — independently flag-gated
15
+ * (`ddd-context-map`): the senior toolbar button, its palette and the
16
+ * validation rules, profiles and quality nudges. Both halves are tooling: a map
17
+ * drawn while the flag was on keeps rendering when it goes off, it just stops
18
+ * being checked — and the profile it was put on stays written, unread, until the
19
+ * flag comes back.
4
20
  *
5
21
  * Note: its Templates-panel category is registered by the aggregate package's
6
22
  * {@link DddTemplatesViewExtension} (gated by `ddd-templates`), so templates
package/dist/view.js CHANGED
@@ -1,10 +1,54 @@
1
+ import { QualityNudgeExtension, validationToolbarConfig, ValidationProfileExtension, ValidationRuleExtension, } from '@formicoidea/labre-core/blocks/surface';
1
2
  import { ViewExtensionProvider, } from '@formicoidea/labre-core/ext-loader';
2
- import { CommandExtension } from '@formicoidea/labre-core/std';
3
+ import { ToolbarModuleExtension } from '@formicoidea/labre-core/shared/services';
4
+ import { BlockFlavourIdentifier, CommandExtension } from '@formicoidea/labre-core/std';
5
+ import { RoleVocabularyExtension } from '@formicoidea/labre-core/std/gfx';
3
6
  import { contextMapCommandIcons, contextMapCommands } from './commands.js';
4
7
  import { contextMapEffects } from './effects.js';
8
+ import { ContextMapRendererExtension } from './element-renderer.js';
9
+ import { ContextMapInteraction, ContextMapView } from './element-view.js';
10
+ import { CONTEXT_MAP_NUDGES } from './nudges.js';
11
+ import { CONTEXT_MAP_PROFILES } from './profiles.js';
12
+ import { CONTEXT_MAP_ROLES } from './roles.js';
13
+ import { CONTEXT_MAP_RULES } from './rules.js';
14
+ import { contextMapBoardToolbarExtension } from './toolbar/board-config.js';
5
15
  import { contextMapSeniorTool } from './toolbar/senior-tool.js';
6
16
  /**
7
- * Context Map — independently flag-gated (`ddd-context-map`).
17
+ * Context Map rendering ALWAYS registered, independent of any flag.
18
+ * Disabling `ddd-context-map` hides only the creation tooling (see
19
+ * {@link DddContextMapViewExtension}); boards already drawn must still paint,
20
+ * stay selectable, stay movable and keep their contextual toolbar. See
21
+ * `docs/adr/0009`.
22
+ */
23
+ export class DddContextMapRenderViewExtension extends ViewExtensionProvider {
24
+ constructor() {
25
+ super(...arguments);
26
+ this.name = 'affine-ddd-context-map-render-gfx';
27
+ }
28
+ setup(context) {
29
+ super.setup(context);
30
+ context.register(ContextMapView);
31
+ context.register(ContextMapRendererExtension);
32
+ // The role VOCABULARY, always on. A role is written in the DOCUMENT, not in
33
+ // the tooling: the direction reveal of a typed relationship, the inversion
34
+ // command and the toolbar entry that must not lie about one all read this,
35
+ // and they have to keep working on a map drawn while the flag was on and
36
+ // opened while it is off (`docs/adr/0009`, `docs/adr/0010`). The rules that
37
+ // JUDGE those roles stay in the flag-gated extension below.
38
+ context.register(RoleVocabularyExtension(CONTEXT_MAP_ROLES));
39
+ if (this.isEdgeless(context.scope)) {
40
+ context.register(ContextMapInteraction);
41
+ context.register(contextMapBoardToolbarExtension);
42
+ }
43
+ }
44
+ }
45
+ /**
46
+ * Context Map creation tooling — independently flag-gated
47
+ * (`ddd-context-map`): the senior toolbar button, its palette and the
48
+ * validation rules, profiles and quality nudges. Both halves are tooling: a map
49
+ * drawn while the flag was on keeps rendering when it goes off, it just stops
50
+ * being checked — and the profile it was put on stays written, unread, until the
51
+ * flag comes back.
8
52
  *
9
53
  * Note: its Templates-panel category is registered by the aggregate package's
10
54
  * {@link DddTemplatesViewExtension} (gated by `ddd-templates`), so templates
@@ -22,6 +66,20 @@ export class DddContextMapViewExtension extends ViewExtensionProvider {
22
66
  setup(context) {
23
67
  super.setup(context);
24
68
  if (this.isEdgeless(context.scope)) {
69
+ context.register(ValidationRuleExtension(CONTEXT_MAP_RULES));
70
+ context.register(ValidationProfileExtension(CONTEXT_MAP_PROFILES));
71
+ context.register(QualityNudgeExtension(CONTEXT_MAP_NUDGES));
72
+ // The Validation dropdown on a selected board's contextual toolbar. A
73
+ // SECOND module on the same element, through the `custom:` flavour slot:
74
+ // `contextMapBoardToolbarExtension` is registered always-on because a
75
+ // stored board must keep its resize toggle, while choosing how hard to
76
+ // check it is tooling and belongs here. The config names no framework —
77
+ // it reads roles and profiles — so it is the very same object Wardley
78
+ // registers on its own flavour.
79
+ context.register(ToolbarModuleExtension({
80
+ id: BlockFlavourIdentifier('custom:affine:surface:contextMap'),
81
+ config: validationToolbarConfig,
82
+ }));
25
83
  context.register(contextMapSeniorTool);
26
84
  context.register(CommandExtension(contextMapCommands, contextMapCommandIcons));
27
85
  }
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.32.0",
4
+ "version": "0.33.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "author": "lajola",
@@ -27,8 +27,8 @@
27
27
  "dist"
28
28
  ],
29
29
  "dependencies": {
30
- "@formicoidea/labre-core": "0.32.0",
31
- "@formicoidea/labre-ddd-shared": "0.32.0",
30
+ "@formicoidea/labre-core": "0.33.0",
31
+ "@formicoidea/labre-ddd-shared": "0.33.0",
32
32
  "lit": "^3.2.0"
33
33
  }
34
34
  }