@formicoidea/labre-framework-ddd-context-map 0.32.0 → 0.34.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/actions.d.ts +38 -0
- package/dist/actions.js +84 -0
- package/dist/background.d.ts +19 -0
- package/dist/background.js +51 -0
- package/dist/commands-manifest.d.ts +18 -0
- package/dist/commands-manifest.js +114 -0
- package/dist/commands.js +37 -61
- package/dist/descriptor.d.ts +7 -2
- package/dist/descriptor.js +5 -2
- package/dist/element-renderer.d.ts +17 -0
- package/dist/element-renderer.js +15 -0
- package/dist/element-view.d.ts +17 -0
- package/dist/element-view.js +18 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +6 -1
- package/dist/legend.d.ts +20 -0
- package/dist/legend.js +56 -0
- package/dist/nudges.d.ts +19 -0
- package/dist/nudges.js +55 -0
- package/dist/profiles.d.ts +2 -0
- package/dist/profiles.js +73 -0
- package/dist/roles.d.ts +65 -0
- package/dist/roles.js +64 -0
- package/dist/rules.d.ts +2 -0
- package/dist/rules.js +264 -0
- package/dist/toolbar/board-config.d.ts +30 -0
- package/dist/toolbar/board-config.js +87 -0
- package/dist/toolbar/context-map-menu.d.ts +1 -1
- package/dist/toolbar/context-map-menu.js +1 -1
- package/dist/toolbar/senior-button.d.ts +1 -0
- package/dist/toolbar/senior-button.js +1 -0
- package/dist/toolbar/senior-tool.js +1 -0
- package/dist/translations.d.ts +9 -9
- package/dist/translations.js +22 -11
- package/dist/view.d.ts +17 -1
- package/dist/view.js +60 -2
- package/package.json +7 -3
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { EdgelessCRUDIdentifier } from '@formicoidea/labre-core/blocks/surface';
|
|
2
|
+
import { createAutoLegend, dddLegendIcon } from '@formicoidea/labre-ddd-shared';
|
|
3
|
+
import { ContextMapBoardElementModel } from '@formicoidea/labre-core/model';
|
|
4
|
+
import { BOARD_LEGEND_NOTATION, BOARD_RESIZE_TOGGLE, TelemetryProvider, ToolbarModuleExtension, } from '@formicoidea/labre-core/shared/services';
|
|
5
|
+
import { BlockFlavourIdentifier } from '@formicoidea/labre-core/std';
|
|
6
|
+
import { html } from 'lit';
|
|
7
|
+
import { CONTEXT_MAP_AUTO_LEGEND } from '../legend.js';
|
|
8
|
+
const ResizeIcon = html `<svg
|
|
9
|
+
width="24"
|
|
10
|
+
height="24"
|
|
11
|
+
viewBox="0 0 24 24"
|
|
12
|
+
fill="none"
|
|
13
|
+
stroke="currentColor"
|
|
14
|
+
stroke-width="1.6"
|
|
15
|
+
stroke-linecap="round"
|
|
16
|
+
stroke-linejoin="round"
|
|
17
|
+
>
|
|
18
|
+
<path d="M9 5H5v4M15 19h4v-4" />
|
|
19
|
+
<path d="M5 5l6 6M19 19l-6-6" />
|
|
20
|
+
</svg>`;
|
|
21
|
+
/**
|
|
22
|
+
* The selected board's contextual toolbar: the resize toggle, and the automatic
|
|
23
|
+
* legend of what is actually drawn on the board. Registered ALWAYS-ON
|
|
24
|
+
* (`DddContextMapRenderViewExtension`) — a stored board must stay usable with
|
|
25
|
+
* the Context Map button switched off (`docs/adr/0009`), legend included: a
|
|
26
|
+
* legend is real editable elements, so generating one is authoring a document,
|
|
27
|
+
* not tooling that a flag may take away.
|
|
28
|
+
*
|
|
29
|
+
* This is THE legend of the module. The palette used to also offer a static,
|
|
30
|
+
* full-notation one; the PO's recette (27/08/2026) removed it — two legends were
|
|
31
|
+
* two answers to one question, and the honest answer is what is actually drawn.
|
|
32
|
+
* Same single-gesture shape as Core Domain Chart.
|
|
33
|
+
*/
|
|
34
|
+
export const contextMapBoardToolbarConfig = {
|
|
35
|
+
actions: [
|
|
36
|
+
{
|
|
37
|
+
id: 'a.toggle-resize',
|
|
38
|
+
tooltipWording: BOARD_RESIZE_TOGGLE,
|
|
39
|
+
icon: ResizeIcon,
|
|
40
|
+
active(ctx) {
|
|
41
|
+
const models = ctx.getSurfaceModelsByType(ContextMapBoardElementModel);
|
|
42
|
+
return models.length > 0 && models.every(model => model.resizeEnabled);
|
|
43
|
+
},
|
|
44
|
+
run(ctx) {
|
|
45
|
+
const models = ctx.getSurfaceModelsByType(ContextMapBoardElementModel);
|
|
46
|
+
if (!models.length)
|
|
47
|
+
return;
|
|
48
|
+
const enable = !models.every(model => model.resizeEnabled);
|
|
49
|
+
ctx.std.store.captureSync();
|
|
50
|
+
const crud = ctx.std.get(EdgelessCRUDIdentifier);
|
|
51
|
+
for (const model of models) {
|
|
52
|
+
crud.updateElement(model.id, { resizeEnabled: enable });
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 'b.legend',
|
|
58
|
+
tooltipWording: BOARD_LEGEND_NOTATION,
|
|
59
|
+
icon: dddLegendIcon,
|
|
60
|
+
run(ctx) {
|
|
61
|
+
const board = ctx.getSurfaceModelsByType(ContextMapBoardElementModel)[0];
|
|
62
|
+
if (!board)
|
|
63
|
+
return;
|
|
64
|
+
createAutoLegend(ctx.std, board, CONTEXT_MAP_AUTO_LEGEND);
|
|
65
|
+
ctx.std
|
|
66
|
+
.getOptional(TelemetryProvider)
|
|
67
|
+
?.track('FrameworkLegendCreated', {
|
|
68
|
+
// The WIRE value, which is not the module id: the framework is
|
|
69
|
+
// `ddd-context-map` in code and `context-map` in PostHog
|
|
70
|
+
// (`frameworks.ts` `telemetryKey`, and the only value
|
|
71
|
+
// `FrameworkElementEvent` accepts). Same convention as Wardley's own
|
|
72
|
+
// legend button, so the two are comparable.
|
|
73
|
+
framework: 'context-map',
|
|
74
|
+
element: 'legend',
|
|
75
|
+
page: 'whiteboard editor',
|
|
76
|
+
segment: 'element toolbar',
|
|
77
|
+
module: 'context-map toolbar',
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
when: (ctx) => ctx.getSurfaceModelsByType(ContextMapBoardElementModel).length > 0,
|
|
83
|
+
};
|
|
84
|
+
export const contextMapBoardToolbarExtension = ToolbarModuleExtension({
|
|
85
|
+
id: BlockFlavourIdentifier('affine:surface:contextMap'),
|
|
86
|
+
config: contextMapBoardToolbarConfig,
|
|
87
|
+
});
|
|
@@ -3,7 +3,7 @@ import { EdgelessCommandMenu } from '@formicoidea/labre-core/widgets/edgeless-to
|
|
|
3
3
|
/**
|
|
4
4
|
* Context Map palette, rendered from `contextMapCommands` for the
|
|
5
5
|
* `senior-menu` surface (`docs/adr/0008`). Keeps the DDD palettes' tighter gap
|
|
6
|
-
* — it is the widest one, at
|
|
6
|
+
* — it is the widest one, at 13 buttons.
|
|
7
7
|
*/
|
|
8
8
|
export declare class EdgelessDddContextMapMenu extends EdgelessCommandMenu {
|
|
9
9
|
static styles: import("lit").CSSResultGroup[];
|
|
@@ -4,7 +4,7 @@ import { css } from 'lit';
|
|
|
4
4
|
/**
|
|
5
5
|
* Context Map palette, rendered from `contextMapCommands` for the
|
|
6
6
|
* `senior-menu` surface (`docs/adr/0008`). Keeps the DDD palettes' tighter gap
|
|
7
|
-
* — it is the widest one, at
|
|
7
|
+
* — it is the widest one, at 13 buttons.
|
|
8
8
|
*/
|
|
9
9
|
export class EdgelessDddContextMapMenu extends EdgelessCommandMenu {
|
|
10
10
|
constructor() {
|
|
@@ -2,5 +2,6 @@ import { DddSeniorButtonBase } from '@formicoidea/labre-ddd-shared';
|
|
|
2
2
|
export declare class EdgelessDddContextMapSeniorButton extends DddSeniorButtonBase {
|
|
3
3
|
protected menuTag: "edgeless-ddd-context-map-menu";
|
|
4
4
|
protected label: string;
|
|
5
|
+
protected labelKey: string;
|
|
5
6
|
protected icon: import("lit-html").TemplateResult<2>;
|
|
6
7
|
}
|
|
@@ -4,6 +4,7 @@ export class EdgelessDddContextMapSeniorButton extends DddSeniorButtonBase {
|
|
|
4
4
|
super(...arguments);
|
|
5
5
|
this.menuTag = 'edgeless-ddd-context-map-menu';
|
|
6
6
|
this.label = 'Context Map';
|
|
7
|
+
this.labelKey = 'com.labre.framework.ddd-context-map';
|
|
7
8
|
this.icon = contextMapToolbarIcon;
|
|
8
9
|
}
|
|
9
10
|
}
|
|
@@ -3,6 +3,7 @@ import { html } from 'lit';
|
|
|
3
3
|
/** Independent senior tool — Context Map. */
|
|
4
4
|
export const contextMapSeniorTool = SeniorToolExtension('ddd-context-map', ({ block }) => ({
|
|
5
5
|
name: 'Context Map',
|
|
6
|
+
labelKey: 'com.labre.framework.ddd-context-map',
|
|
6
7
|
content: html `<edgeless-ddd-context-map-senior-button
|
|
7
8
|
.edgeless=${block}
|
|
8
9
|
></edgeless-ddd-context-map-senior-button>`,
|
package/dist/translations.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { type TranslationKeyManifestEntry } from '@formicoidea/labre-core/std';
|
|
2
2
|
/**
|
|
3
|
-
* THIS framework's contribution to the translation-key manifest
|
|
3
|
+
* THIS framework's contribution to the translation-key manifest — every
|
|
4
|
+
* `com.labre.*` key Context Mapping can hand to `TranslationProvider.t`,
|
|
5
|
+
* derived from the very declarations the editor registers (never restated).
|
|
4
6
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* core
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* `contextMapCommands` into the command registry. See
|
|
12
|
-
* `packages/affine/all/src/translations.ts`.
|
|
7
|
+
* It lives HERE, not in `@labre/affine/translations`, because the bundled
|
|
8
|
+
* distribution splits the library along exactly this line:
|
|
9
|
+
* `@formicoidea/labre-core` is the editor MINUS the frameworks, and a host that
|
|
10
|
+
* installs `@formicoidea/labre-framework-ddd-context-map` composes this export
|
|
11
|
+
* into the catalogue it builds — the same sentence that already holds for
|
|
12
|
+
* `contextMapCommands`. See `packages/affine/all/src/translations.ts`.
|
|
13
13
|
*/
|
|
14
14
|
export declare const contextMapTranslationEntries: TranslationKeyManifestEntry[];
|
package/dist/translations.js
CHANGED
|
@@ -1,15 +1,26 @@
|
|
|
1
|
-
import { commandTranslationEntries, } from '@formicoidea/labre-core/std';
|
|
1
|
+
import { collectTranslationKeys, commandCategoryTranslationEntries, 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
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* core
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
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),
|
|
21
|
+
// The catalogue's own group headers, derived from the very categories
|
|
22
|
+
// these commands declare. They ship WITH the framework because core's
|
|
23
|
+
// registry names no framework category in the bundled distribution, so a
|
|
24
|
+
// host that composed core's manifest alone drew translated entries under
|
|
25
|
+
// 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));
|
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 —
|
|
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 {
|
|
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 —
|
|
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.
|
|
4
|
+
"version": "0.34.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"author": "lajola",
|
|
@@ -21,14 +21,18 @@
|
|
|
21
21
|
"./descriptor": {
|
|
22
22
|
"types": "./dist/descriptor.d.ts",
|
|
23
23
|
"import": "./dist/descriptor.js"
|
|
24
|
+
},
|
|
25
|
+
"./commands-manifest": {
|
|
26
|
+
"types": "./dist/commands-manifest.d.ts",
|
|
27
|
+
"import": "./dist/commands-manifest.js"
|
|
24
28
|
}
|
|
25
29
|
},
|
|
26
30
|
"files": [
|
|
27
31
|
"dist"
|
|
28
32
|
],
|
|
29
33
|
"dependencies": {
|
|
30
|
-
"@formicoidea/labre-core": "0.
|
|
31
|
-
"@formicoidea/labre-ddd-shared": "0.
|
|
34
|
+
"@formicoidea/labre-core": "0.34.1",
|
|
35
|
+
"@formicoidea/labre-ddd-shared": "0.34.1",
|
|
32
36
|
"lit": "^3.2.0"
|
|
33
37
|
}
|
|
34
38
|
}
|