@formicoidea/labre-framework-wardley 0.40.0 → 0.42.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,10 +1,48 @@
1
- import { EdgelessCRUDIdentifier } from '@formicoidea/labre-core/blocks/surface';
1
+ import { EdgelessCRUDIdentifier, legendToolbarAction, validationToolbarConfig, } from '@formicoidea/labre-core/blocks/surface';
2
2
  import { WardleyBackgroundElementModel } from '@formicoidea/labre-core/model';
3
- import { BOARD_LEGEND_COMPONENTS, BOARD_RESIZE_TOGGLE, TelemetryProvider, ToolbarModuleExtension, } from '@formicoidea/labre-core/shared/services';
3
+ import { BOARD_LEGEND_COMPONENTS, BOARD_RESIZE_TOGGLE, commandMoreAction, ToolbarModuleExtension, } from '@formicoidea/labre-core/shared/services';
4
4
  import { BlockFlavourIdentifier } from '@formicoidea/labre-core/std';
5
5
  import { html } from 'lit';
6
- import { createWardleyLegend } from '../legend.js';
7
- import { wardleyLegendIcon } from './icons.js';
6
+ import { wardleyExportOwmIcon, wardleyLegendIcon } from './icons.js';
7
+ /** The seven toolbar tooltips this file used to hard-code as English literals. */
8
+ const EVOLUTION_AXIS_TOGGLE = [
9
+ 'com.labre.wardley.toolbar.evolution-axis',
10
+ 'Evolution axis (X)',
11
+ ];
12
+ const EVOLUTION_PHASE_LABELS_TOGGLE = [
13
+ 'com.labre.wardley.toolbar.evolution-phase-labels',
14
+ 'Evolution phase labels',
15
+ ];
16
+ const COLUMNS_TOGGLE = [
17
+ 'com.labre.wardley.toolbar.columns',
18
+ 'Columns (dividers)',
19
+ ];
20
+ const CORNER_LABELS_TOGGLE = [
21
+ 'com.labre.wardley.toolbar.corner-labels',
22
+ 'Labels Uncharted / Industrialized',
23
+ ];
24
+ const GRADIENT_TOGGLE = [
25
+ 'com.labre.wardley.toolbar.gradient',
26
+ 'Show / hide the gradient',
27
+ ];
28
+ const VALUE_CHAIN_AXIS_TOGGLE = [
29
+ 'com.labre.wardley.toolbar.value-chain-axis',
30
+ 'Value Chain axis (Y)',
31
+ ];
32
+ const VISIBILITY_LABELS_TOGGLE = [
33
+ 'com.labre.wardley.toolbar.visibility-labels',
34
+ 'Labels Visible / Invisible',
35
+ ];
36
+ /** Every wording above, for `translations.ts`'s manifest contribution. */
37
+ export const WARDLEY_TOOLBAR_WORDINGS = [
38
+ EVOLUTION_AXIS_TOGGLE,
39
+ EVOLUTION_PHASE_LABELS_TOGGLE,
40
+ COLUMNS_TOGGLE,
41
+ CORNER_LABELS_TOGGLE,
42
+ GRADIENT_TOGGLE,
43
+ VALUE_CHAIN_AXIS_TOGGLE,
44
+ VISIBILITY_LABELS_TOGGLE,
45
+ ];
8
46
  const ResizeIcon = html `<svg
9
47
  width="24"
10
48
  height="24"
@@ -162,12 +200,12 @@ export const wardleyToolbarConfig = {
162
200
  {
163
201
  id: 'b.evolution',
164
202
  actions: [
165
- booleanToggle('b.1-axis-x', 'Evolution axis (X)', XAxisIcon, 'showXAxis'),
166
- booleanToggle('b.2-column-labels', 'Evolution phase labels', ColumnLabelsIcon, 'showColumnLabels'),
167
- booleanToggle('b.3-columns', 'Columns (dividers)', ColumnsIcon, 'showColumnDividers'),
168
- booleanToggle('b.4-corner-labels', 'Labels Uncharted / Industrialized', CornerLabelsIcon, 'showCornerLabels'),
203
+ booleanToggle('b.1-axis-x', EVOLUTION_AXIS_TOGGLE, XAxisIcon, 'showXAxis'),
204
+ booleanToggle('b.2-column-labels', EVOLUTION_PHASE_LABELS_TOGGLE, ColumnLabelsIcon, 'showColumnLabels'),
205
+ booleanToggle('b.3-columns', COLUMNS_TOGGLE, ColumnsIcon, 'showColumnDividers'),
206
+ booleanToggle('b.4-corner-labels', CORNER_LABELS_TOGGLE, CornerLabelsIcon, 'showCornerLabels'),
169
207
  // Only relevant when the selection has a gradient variant.
170
- booleanToggle('b.5-gradient', 'Show / hide the gradient', GradientIcon, 'showGradient', ctx => ctx
208
+ booleanToggle('b.5-gradient', GRADIENT_TOGGLE, GradientIcon, 'showGradient', ctx => ctx
171
209
  .getSurfaceModelsByType(WardleyBackgroundElementModel)
172
210
  .some(model => model.variant !== 'classic')),
173
211
  ],
@@ -176,33 +214,18 @@ export const wardleyToolbarConfig = {
176
214
  {
177
215
  id: 'c.value-chain',
178
216
  actions: [
179
- booleanToggle('c.1-axis-y', 'Value Chain axis (Y)', YAxisIcon, 'showYAxis'),
180
- booleanToggle('c.2-visibility-labels', 'Labels Visible / Invisible', VisibilityIcon, 'showVisibilityLabels'),
217
+ booleanToggle('c.1-axis-y', VALUE_CHAIN_AXIS_TOGGLE, YAxisIcon, 'showYAxis'),
218
+ booleanToggle('c.2-visibility-labels', VISIBILITY_LABELS_TOGGLE, VisibilityIcon, 'showVisibilityLabels'),
181
219
  ],
182
220
  },
183
- // Generate the auto-legend from the components present inside this
184
- // background's perimeter (+ a gradient-meaning block for gradient variants).
185
- {
186
- id: 'd.legend',
187
- tooltipWording: BOARD_LEGEND_COMPONENTS,
188
- icon: wardleyLegendIcon,
189
- run(ctx) {
190
- const models = ctx.getSurfaceModelsByType(WardleyBackgroundElementModel);
191
- const bg = models[0];
192
- if (!bg)
193
- return;
194
- createWardleyLegend(ctx.std, bg);
195
- ctx.std
196
- .getOptional(TelemetryProvider)
197
- ?.track('FrameworkLegendCreated', {
198
- framework: 'wardley',
199
- element: 'legend',
200
- page: 'whiteboard editor',
201
- segment: 'element toolbar',
202
- module: 'wardley toolbar',
203
- });
204
- },
205
- },
221
+ // The OWM export, in the "⋮" — R5 of
222
+ // `docs/add-a-framework/02-framework-rules.md`, the position
223
+ // `bpmn.exportXml` and `c4.exportMermaid` already hold on their own boards.
224
+ // This module is registered ALWAYS-ON (`view.ts`) while the commands are
225
+ // flag-gated, and that needs no extra guard: the entry's `when` looks the
226
+ // command up in the registry and withdraws when the wardley flag left it
227
+ // unregistered.
228
+ commandMoreAction('z.export-owm', 'wardley.exportOwm', 'com.labre.commands.wardley.exportOwm', 'Export Wardley map (OWM)', wardleyExportOwmIcon),
206
229
  ],
207
230
  when: ctx => ctx.getSurfaceModelsByType(WardleyBackgroundElementModel).length > 0,
208
231
  };
@@ -210,3 +233,55 @@ export const wardleyToolbarExtension = ToolbarModuleExtension({
210
233
  id: BlockFlavourIdentifier('affine:surface:wardley'),
211
234
  config: wardleyToolbarConfig,
212
235
  });
236
+ /**
237
+ * The map's flag-gated row, WHOLE: the Legend button and the Validation
238
+ * dropdown, in one module.
239
+ *
240
+ * ## Why they cannot be two modules
241
+ *
242
+ * `renderToolbar` merges exactly four slots per element — `<flavour>`,
243
+ * `custom:<flavour>` and the two `affine:surface:*` wildcards — and
244
+ * `ToolbarModuleExtension` binds by DI variant, so a second module claiming
245
+ * `custom:affine:surface:wardley` would throw
246
+ * `DuplicateServiceDefinitionError` before the editor finished setting up. Two
247
+ * slots, and Wardley has three things to put on a selected map: the axis and
248
+ * label toggles (always-on, `<flavour>`, above), the legend and the level of
249
+ * requirement. The precedent is C4's `c4BoardToolingToolbarConfig`.
250
+ *
251
+ * ## Why the legend moved OUT of the always-on half
252
+ *
253
+ * Because GENERATING one is tooling, and `docs/adr/0009` gates tooling: the
254
+ * flag off takes away the gesture that writes legend elements, exactly as it
255
+ * takes away the sub-menu that draws components. What the gesture already
256
+ * wrote is document CONTENT and keeps being painted — the box is plain shapes,
257
+ * text and `wardleyNode`s with no role, all drawn by the always-on renderers.
258
+ * The axis and label toggles stay always-on for the opposite reason: a stored
259
+ * map must keep its axes whatever the flag says.
260
+ *
261
+ * Sorting keeps the row readable across the merge — `a.` … `d.legend` from the
262
+ * two modules, then `z.validation` — whatever order they were registered in.
263
+ */
264
+ export const wardleyBoardToolingToolbarConfig = {
265
+ actions: [
266
+ // `d.legend` and not the factory's default `b.legend`: the row is sorted
267
+ // lexicographically by id and the two axis groups already hold `b.` and
268
+ // `c.`, so the legend reads after the toggles it documents the map beside.
269
+ legendToolbarAction({
270
+ id: 'd.legend',
271
+ Model: WardleyBackgroundElementModel,
272
+ owner: 'wardley',
273
+ framework: 'wardley',
274
+ tooltipWording: BOARD_LEGEND_COMPONENTS,
275
+ icon: wardleyLegendIcon,
276
+ }),
277
+ // The generic dropdown, not a Wardley variant of it: the config names no
278
+ // framework — it reads the registered rules and profiles — so this is the
279
+ // very same object c4, bpmn and the context map register.
280
+ ...validationToolbarConfig.actions,
281
+ ],
282
+ when: wardleyToolbarConfig.when,
283
+ };
284
+ export const wardleyBoardToolingToolbarExtension = ToolbarModuleExtension({
285
+ id: BlockFlavourIdentifier('custom:affine:surface:wardley'),
286
+ config: wardleyBoardToolingToolbarConfig,
287
+ });
@@ -1,4 +1,6 @@
1
- import { type Color, type Palette, type ShapeElementModel } from '@formicoidea/labre-core/model';
1
+ import type { FrameworkPalette, NamedPalette } from '@formicoidea/labre-core/components/color-picker';
2
+ import { type Color, type ShapeElementModel } from '@formicoidea/labre-core/model';
3
+ import { type ChromeWording } from '@formicoidea/labre-core/shared/services';
2
4
  /**
3
5
  * What a picked swatch WRITES on a Wardley node.
4
6
  *
@@ -13,9 +15,39 @@ import { type Color, type Palette, type ShapeElementModel } from '@formicoidea/l
13
15
  * (`--affine-…`) is not a hex at all and must reach the document intact.
14
16
  */
15
17
  export declare function wardleyFillColor(model: ShapeElementModel, value: Color): Color;
18
+ /**
19
+ * The nine Wardley swatches' own names, resolved by `resolvePaletteLabel`
20
+ * (`@labre/affine-components/color-picker`) through each swatch's own
21
+ * {@link NamedPalette.labelWording} — the framework-agnostic mechanism a
22
+ * gfx module uses to name a palette without touching `Palette`
23
+ * (`packages/affine/model`, RED ZONE) or importing another framework.
24
+ *
25
+ * Exported so `../translations.ts` can list them in the manifest under
26
+ * source `chrome`, the same treatment `WARDLEY_TOOLBAR_WORDINGS` already
27
+ * gets — a swatch's name is toolbar chrome, re-rendered on every locale
28
+ * switch, never seeded into a document.
29
+ */
30
+ export declare const WARDLEY_PALETTE_WORDING_WONDER: ChromeWording;
31
+ export declare const WARDLEY_PALETTE_WORDING_PEACE: ChromeWording;
32
+ export declare const WARDLEY_PALETTE_WORDING_WAR: ChromeWording;
33
+ export declare const WARDLEY_PALETTE_WORDING_WONDER_LIGHT: ChromeWording;
34
+ export declare const WARDLEY_PALETTE_WORDING_PEACE_LIGHT: ChromeWording;
35
+ export declare const WARDLEY_PALETTE_WORDING_WAR_LIGHT: ChromeWording;
36
+ export declare const WARDLEY_PALETTE_WORDING_RED: ChromeWording;
37
+ export declare const WARDLEY_PALETTE_WORDING_INERTIA: ChromeWording;
38
+ export declare const WARDLEY_PALETTE_WORDING_METHOD_GREY: ChromeWording;
39
+ export declare const WARDLEY_PALETTE_WORDINGS: readonly ChromeWording[];
16
40
  /**
17
41
  * From the default editor palette we keep ONLY the neutrals — the historical
18
42
  * colours are dropped in favour of the Wardley swatches above.
19
43
  */
20
- export declare const WARDLEY_PALETTE_LIST: Palette[];
44
+ export declare const WARDLEY_PALETTE_LIST: NamedPalette[];
45
+ /**
46
+ * Wardley's page of the colour pickers' carousel (`docs/adr/0027`) — the very
47
+ * list its own node picker is seeded with, offered on every other picker too:
48
+ * a connector between two components, a free-text label, a frame drawn over
49
+ * the map. Registered from the FLAG-GATED view extension, because offering
50
+ * hues is tooling (`docs/adr/0009`).
51
+ */
52
+ export declare const WARDLEY_FRAMEWORK_PALETTE: FrameworkPalette;
21
53
  export declare const wardleyNodeToolbarExtension: import("@formicoidea/labre-core/store").ExtensionType;
@@ -29,6 +29,65 @@ export function wardleyFillColor(model, value) {
29
29
  return value;
30
30
  return `${value}${AREA_ALPHA}`;
31
31
  }
32
+ /**
33
+ * The nine Wardley swatches' own names, resolved by `resolvePaletteLabel`
34
+ * (`@labre/affine-components/color-picker`) through each swatch's own
35
+ * {@link NamedPalette.labelWording} — the framework-agnostic mechanism a
36
+ * gfx module uses to name a palette without touching `Palette`
37
+ * (`packages/affine/model`, RED ZONE) or importing another framework.
38
+ *
39
+ * Exported so `../translations.ts` can list them in the manifest under
40
+ * source `chrome`, the same treatment `WARDLEY_TOOLBAR_WORDINGS` already
41
+ * gets — a swatch's name is toolbar chrome, re-rendered on every locale
42
+ * switch, never seeded into a document.
43
+ */
44
+ export const WARDLEY_PALETTE_WORDING_WONDER = [
45
+ 'com.labre.wardley.palette.wonder',
46
+ 'Wonder',
47
+ ];
48
+ export const WARDLEY_PALETTE_WORDING_PEACE = [
49
+ 'com.labre.wardley.palette.peace',
50
+ 'Peace',
51
+ ];
52
+ export const WARDLEY_PALETTE_WORDING_WAR = [
53
+ 'com.labre.wardley.palette.war',
54
+ 'War',
55
+ ];
56
+ export const WARDLEY_PALETTE_WORDING_WONDER_LIGHT = [
57
+ 'com.labre.wardley.palette.wonder-light',
58
+ 'Wonder light',
59
+ ];
60
+ export const WARDLEY_PALETTE_WORDING_PEACE_LIGHT = [
61
+ 'com.labre.wardley.palette.peace-light',
62
+ 'Peace light',
63
+ ];
64
+ export const WARDLEY_PALETTE_WORDING_WAR_LIGHT = [
65
+ 'com.labre.wardley.palette.war-light',
66
+ 'War light',
67
+ ];
68
+ export const WARDLEY_PALETTE_WORDING_RED = [
69
+ 'com.labre.wardley.palette.wardley-red',
70
+ 'Wardley red',
71
+ ];
72
+ export const WARDLEY_PALETTE_WORDING_INERTIA = [
73
+ 'com.labre.wardley.palette.inertia',
74
+ 'Inertia',
75
+ ];
76
+ export const WARDLEY_PALETTE_WORDING_METHOD_GREY = [
77
+ 'com.labre.wardley.palette.method-grey',
78
+ 'Method grey',
79
+ ];
80
+ export const WARDLEY_PALETTE_WORDINGS = [
81
+ WARDLEY_PALETTE_WORDING_WONDER,
82
+ WARDLEY_PALETTE_WORDING_PEACE,
83
+ WARDLEY_PALETTE_WORDING_WAR,
84
+ WARDLEY_PALETTE_WORDING_WONDER_LIGHT,
85
+ WARDLEY_PALETTE_WORDING_PEACE_LIGHT,
86
+ WARDLEY_PALETTE_WORDING_WAR_LIGHT,
87
+ WARDLEY_PALETTE_WORDING_RED,
88
+ WARDLEY_PALETTE_WORDING_INERTIA,
89
+ WARDLEY_PALETTE_WORDING_METHOD_GREY,
90
+ ];
32
91
  /**
33
92
  * The Wardley **evolution cycle**, surfaced as ready-made swatches in the node
34
93
  * colour picker: Wonder / Peace / War, the three climatic phases a component
@@ -41,15 +100,47 @@ export function wardleyFillColor(model, value) {
41
100
  * an author is free to ignore them, and the custom picker stays one click away.
42
101
  */
43
102
  const WARDLEY_PALETTES = [
44
- { key: 'Wonder', value: '#3ec9f2' },
45
- { key: 'Peace', value: '#5b9cf6' },
46
- { key: 'War', value: '#9d6df0' },
47
- { key: 'Wonder light', value: '#b9e9fa' },
48
- { key: 'Peace light', value: '#c6dbfc' },
49
- { key: 'War light', value: '#d9c9fa' },
50
- { key: 'Wardley red', value: WARDLEY_RED },
51
- { key: 'Inertia', value: INERTIA_COLOR },
52
- { key: 'Method grey', value: METHOD_FILL },
103
+ {
104
+ key: 'Wonder',
105
+ value: '#3ec9f2',
106
+ labelWording: WARDLEY_PALETTE_WORDING_WONDER,
107
+ },
108
+ {
109
+ key: 'Peace',
110
+ value: '#5b9cf6',
111
+ labelWording: WARDLEY_PALETTE_WORDING_PEACE,
112
+ },
113
+ { key: 'War', value: '#9d6df0', labelWording: WARDLEY_PALETTE_WORDING_WAR },
114
+ {
115
+ key: 'Wonder light',
116
+ value: '#b9e9fa',
117
+ labelWording: WARDLEY_PALETTE_WORDING_WONDER_LIGHT,
118
+ },
119
+ {
120
+ key: 'Peace light',
121
+ value: '#c6dbfc',
122
+ labelWording: WARDLEY_PALETTE_WORDING_PEACE_LIGHT,
123
+ },
124
+ {
125
+ key: 'War light',
126
+ value: '#d9c9fa',
127
+ labelWording: WARDLEY_PALETTE_WORDING_WAR_LIGHT,
128
+ },
129
+ {
130
+ key: 'Wardley red',
131
+ value: WARDLEY_RED,
132
+ labelWording: WARDLEY_PALETTE_WORDING_RED,
133
+ },
134
+ {
135
+ key: 'Inertia',
136
+ value: INERTIA_COLOR,
137
+ labelWording: WARDLEY_PALETTE_WORDING_INERTIA,
138
+ },
139
+ {
140
+ key: 'Method grey',
141
+ value: METHOD_FILL,
142
+ labelWording: WARDLEY_PALETTE_WORDING_METHOD_GREY,
143
+ },
53
144
  ];
54
145
  /**
55
146
  * From the default editor palette we keep ONLY the neutrals — the historical
@@ -59,6 +150,18 @@ export const WARDLEY_PALETTE_LIST = [
59
150
  ...WARDLEY_PALETTES,
60
151
  ...neutralPalettes(),
61
152
  ];
153
+ /**
154
+ * Wardley's page of the colour pickers' carousel (`docs/adr/0027`) — the very
155
+ * list its own node picker is seeded with, offered on every other picker too:
156
+ * a connector between two components, a free-text label, a frame drawn over
157
+ * the map. Registered from the FLAG-GATED view extension, because offering
158
+ * hues is tooling (`docs/adr/0009`).
159
+ */
160
+ export const WARDLEY_FRAMEWORK_PALETTE = {
161
+ framework: 'wardley',
162
+ labelWording: ['com.labre.framework.wardley', 'Wardley map'],
163
+ palettes: WARDLEY_PALETTE_LIST,
164
+ };
62
165
  /**
63
166
  * Wardley nodes are {@link ShapeElementModel} subclasses, so the shape toolbar's
64
167
  * actions (which target `getSurfaceModelsByType(ShapeElementModel)`) operate on
@@ -12,6 +12,14 @@ export declare class EdgelessWardleySeniorButton extends EdgelessWardleySeniorBu
12
12
  enableActiveBackground: boolean;
13
13
  type: typeof EmptyTool;
14
14
  private _toggleMenu;
15
+ /**
16
+ * Lit while one of THIS framework's artefacts is armed under the cursor, as
17
+ * well as while its menu is open. The menu closes the moment the pointer goes
18
+ * to the board, so without this the ghost would be traceable to no button at
19
+ * all — and Shift+S, which walks that ghost along this framework's row, would
20
+ * read as a keystroke belonging to nothing.
21
+ */
22
+ private get _armed();
15
23
  render(): import("lit-html").TemplateResult<1>;
16
24
  }
17
25
  export {};
@@ -1,7 +1,7 @@
1
1
  import { DefaultTool } from '@formicoidea/labre-core/blocks/surface';
2
2
  import { EmptyTool } from '@formicoidea/labre-core/gfx/pointer';
3
3
  import { translateKey } from '@formicoidea/labre-core/shared/services';
4
- import { EdgelessToolbarToolMixin } from '@formicoidea/labre-core/widgets/edgeless-toolbar';
4
+ import { armedArtefact, EdgelessToolbarToolMixin, } from '@formicoidea/labre-core/widgets/edgeless-toolbar';
5
5
  import { SignalWatcher } from '@formicoidea/labre-core/global/lit';
6
6
  import { css, html, LitElement } from 'lit';
7
7
  import { wardleyToolbarIcon } from './icons.js';
@@ -80,6 +80,16 @@ export class EdgelessWardleySeniorButton extends EdgelessToolbarToolMixin(Signal
80
80
  const menu = this.createPopper('edgeless-wardley-menu', this);
81
81
  menu.element.edgeless = this.edgeless;
82
82
  }
83
+ /**
84
+ * Lit while one of THIS framework's artefacts is armed under the cursor, as
85
+ * well as while its menu is open. The menu closes the moment the pointer goes
86
+ * to the board, so without this the ghost would be traceable to no button at
87
+ * all — and Shift+S, which walks that ghost along this framework's row, would
88
+ * read as a keystroke belonging to nothing.
89
+ */
90
+ get _armed() {
91
+ return armedArtefact(this.gfx)?.owner === 'wardley';
92
+ }
83
93
  render() {
84
94
  return html `<edgeless-toolbar-button
85
95
  class="wardley-button"
@@ -87,7 +97,7 @@ export class EdgelessWardleySeniorButton extends EdgelessToolbarToolMixin(Signal
87
97
  ? ''
88
98
  : translateKey(this.edgeless.std, 'com.labre.framework.wardley', 'Wardley map')}
89
99
  .tooltipOffset=${4}
90
- .active=${!!this.popper}
100
+ .active=${!!this.popper || this._armed}
91
101
  @click=${this._toggleMenu}
92
102
  >
93
103
  <div class="wardley-root">
@@ -1,12 +1,88 @@
1
+ import { tagDefsTranslationEntries } from '@formicoidea/labre-core/shared/services';
1
2
  import { collectTranslationKeys, commandCategoryTranslationEntries, commandTranslationEntries, mergeTranslationEntries, } from '@formicoidea/labre-core/std';
3
+ import { WARDLEY_AXIS_SEED } from './actions.js';
2
4
  import { WARDLEY_AUDIT_CRITERIA } from './audit-criteria.js';
3
5
  import { WARDLEY_BACKGROUND } from './background.js';
4
6
  import { wardleyCommands } from './commands.js';
7
+ import { WARDLEY_OWM_IMPORT_REMARKS } from './import.js';
8
+ import { WARDLEY_LEGEND_WORDINGS } from './legend.js';
9
+ import { WARDLEY_TAG_DEFS } from './natures.js';
5
10
  import { WARDLEY_NUDGES } from './nudges.js';
11
+ import { WARDLEY_NODE_LABEL, wardleyNodeLabelKey } from './presets.js';
6
12
  import { WARDLEY_PROFILES } from './profiles.js';
7
13
  import { WARDLEY_READING } from './reading.js';
8
14
  import { WARDLEY_ROLES } from './roles.js';
9
15
  import { WARDLEY_RULES } from './rules.js';
16
+ import { KODAK_INERTIA_SEED, TEA_SHOP_SEED, WARDLEY_TEMPLATE_NAME_KODAK_INERTIA, WARDLEY_TEMPLATE_NAME_TEA_SHOP, } from './templates/maps.js';
17
+ import { WARDLEY_TEMPLATE_NAME_AREA_POLYGON, WARDLEY_TEMPLATE_NAME_EVOLUTION_ARROW, WARDLEY_TEMPLATE_NAME_LINK, } from './templates/index.js';
18
+ import { WARDLEY_TOOLBAR_WORDINGS } from './toolbar/config.js';
19
+ import { WARDLEY_PALETTE_WORDINGS } from './toolbar/node-config.js';
20
+ /**
21
+ * The prompt every labelled artefact is created NEXT TO — the fallback IS
22
+ * `WARDLEY_NODE_LABEL[kind]`, never restated, mirroring BPMN's `seedEntries`.
23
+ */
24
+ const nodeSeedEntries = () => Object.entries(WARDLEY_NODE_LABEL).map(([kind, label]) => ({
25
+ key: wardleyNodeLabelKey(kind),
26
+ fallback: label,
27
+ source: 'seed',
28
+ }));
29
+ /** The three axis words a translated background variant is seeded with. */
30
+ const axisSeedEntries = () => Object.values(WARDLEY_AXIS_SEED).map(({ key, fallback }) => ({
31
+ key,
32
+ fallback,
33
+ source: 'seed',
34
+ }));
35
+ /**
36
+ * The seeds the two worked-example maps write — derived from the very tables
37
+ * `templates/maps.ts` reads at placement.
38
+ */
39
+ const exampleSeedEntries = () => [...Object.values(TEA_SHOP_SEED), ...Object.values(KODAK_INERTIA_SEED)].map(({ key, fallback }) => ({ key, fallback, source: 'seed' }));
40
+ /**
41
+ * The auto-legend's own wordings — title, row captions, gradient blocks and
42
+ * the Porter panel — derived from `legend.ts`'s own `WARDLEY_LEGEND_WORDINGS`,
43
+ * the very declarations the rows subscribe and the two extras write when the
44
+ * group lands on the canvas.
45
+ */
46
+ const legendSeedEntries = () => WARDLEY_LEGEND_WORDINGS.map(([key, fallback]) => ({
47
+ key,
48
+ fallback,
49
+ source: 'seed',
50
+ }));
51
+ /** The toolbar tooltips this framework used to hard-code as English literals. */
52
+ const toolbarChromeEntries = () => WARDLEY_TOOLBAR_WORDINGS.map(([key, fallback]) => ({
53
+ key,
54
+ fallback,
55
+ source: 'chrome',
56
+ }));
57
+ /**
58
+ * The five hand-composed cards' own tile names — chrome, not seeds: a
59
+ * `Template.nameKey`, re-resolved every time the panel opens, never written
60
+ * into a document. See `templates/index.ts` and `templates/maps.ts`.
61
+ */
62
+ const templateNameEntries = () => [
63
+ WARDLEY_TEMPLATE_NAME_LINK,
64
+ WARDLEY_TEMPLATE_NAME_EVOLUTION_ARROW,
65
+ WARDLEY_TEMPLATE_NAME_AREA_POLYGON,
66
+ WARDLEY_TEMPLATE_NAME_TEA_SHOP,
67
+ WARDLEY_TEMPLATE_NAME_KODAK_INERTIA,
68
+ ].map(([key, fallback]) => ({ key, fallback, source: 'chrome' }));
69
+ /** The five fixed-wording OWM import remarks ({@link WARDLEY_OWM_IMPORT_REMARKS}). */
70
+ const importRemarkEntries = () => Object.values(WARDLEY_OWM_IMPORT_REMARKS).map(([key, english]) => ({
71
+ key,
72
+ fallback: english,
73
+ source: 'chrome',
74
+ }));
75
+ /**
76
+ * The nine node-colour-picker swatches' own names (`WARDLEY_PALETTE_WORDINGS`,
77
+ * `toolbar/node-config.ts`) — chrome, like the toolbar tooltips above: a
78
+ * swatch's name is re-rendered on every locale switch, never seeded into a
79
+ * document.
80
+ */
81
+ const paletteWordingEntries = () => WARDLEY_PALETTE_WORDINGS.map(([key, fallback]) => ({
82
+ key,
83
+ fallback,
84
+ source: 'chrome',
85
+ }));
10
86
  /**
11
87
  * THIS framework's contribution to the translation-key manifest — every
12
88
  * `com.labre.*` key Wardley can hand to `TranslationProvider.t`, derived from
@@ -27,4 +103,8 @@ export const wardleyTranslationEntries = mergeTranslationEntries(commandTranslat
27
103
  // registry names no framework category in the bundled distribution, so a
28
104
  // host that composed core's manifest alone drew translated entries under
29
105
  // English headers (#183).
30
- commandCategoryTranslationEntries(wardleyCommands), collectTranslationKeys('role', WARDLEY_ROLES), collectTranslationKeys('background', WARDLEY_BACKGROUND), collectTranslationKeys('rule', WARDLEY_RULES), collectTranslationKeys('nudge', WARDLEY_NUDGES), collectTranslationKeys('profile', WARDLEY_PROFILES), collectTranslationKeys('audit-criterion', WARDLEY_AUDIT_CRITERIA), collectTranslationKeys('reading', WARDLEY_READING));
106
+ commandCategoryTranslationEntries(wardleyCommands), collectTranslationKeys('role', WARDLEY_ROLES), collectTranslationKeys('background', WARDLEY_BACKGROUND), collectTranslationKeys('rule', WARDLEY_RULES), collectTranslationKeys('nudge', WARDLEY_NUDGES), collectTranslationKeys('profile', WARDLEY_PROFILES), collectTranslationKeys('audit-criterion', WARDLEY_AUDIT_CRITERIA), nodeSeedEntries(), axisSeedEntries(), exampleSeedEntries(), legendSeedEntries(), templateNameEntries(), toolbarChromeEntries(), importRemarkEntries(), paletteWordingEntries(), collectTranslationKeys('reading', WARDLEY_READING),
107
+ // The library's own tag pack (`WARDLEY_TAG_DEFS`) — the natures and the
108
+ // Porter competition tags. A host's app-seeded pack needs no entry here:
109
+ // see `tagDefsTranslationEntries`.
110
+ tagDefsTranslationEntries(WARDLEY_TAG_DEFS));
package/dist/view.js CHANGED
@@ -1,5 +1,6 @@
1
- import { InterchangeExtension, morphToolbarConfig, ReadingProfileExtension, tagsToolbarConfig, validationToolbarConfig, QualityNudgeExtension, ValidationProfileExtension, ValidationRuleExtension, } from '@formicoidea/labre-core/blocks/surface';
1
+ import { InterchangeExtension, morphToolbarConfig, ReadingProfileExtension, tagsToolbarConfig, QualityNudgeExtension, ValidationProfileExtension, ValidationRuleExtension, } from '@formicoidea/labre-core/blocks/surface';
2
2
  import { AuditCriterionExtension, ToolbarModuleExtension, toolbarModuleKey, UniverseTagDefsExtension, } from '@formicoidea/labre-core/shared/services';
3
+ import { FrameworkPaletteExtension } from '@formicoidea/labre-core/components/color-picker';
3
4
  import { ViewExtensionProvider, } from '@formicoidea/labre-core/ext-loader';
4
5
  import { TemplateCategoryExtension } from '@formicoidea/labre-core/gfx/template';
5
6
  import { BlockFlavourIdentifier, CommandExtension } from '@formicoidea/labre-core/std';
@@ -21,8 +22,8 @@ import { WardleyInteraction, WardleyView } from './element-view.js';
21
22
  import { WardleyNodeRendererExtension } from './node/node-renderer.js';
22
23
  import { WardleyNodeView } from './node/node-view.js';
23
24
  import { WardleyPorterWatcher } from './node/porter-watcher.js';
24
- import { wardleyNodeToolbarExtension } from './toolbar/node-config.js';
25
- import { wardleyToolbarExtension } from './toolbar/config.js';
25
+ import { WARDLEY_FRAMEWORK_PALETTE, wardleyNodeToolbarExtension, } from './toolbar/node-config.js';
26
+ import { wardleyBoardToolingToolbarExtension, wardleyToolbarExtension, } from './toolbar/config.js';
26
27
  import { wardleySeniorTool } from './toolbar/senior-tool.js';
27
28
  /**
28
29
  * Wardley rendering — ALWAYS registered, independent of any flag. Disabling
@@ -106,18 +107,15 @@ export class WardleyViewExtension extends ViewExtensionProvider {
106
107
  // off contributes none and `map.audit` finds nothing to ask about — while
107
108
  // `ai-audit` independently decides whether the command exists at all.
108
109
  context.register(AuditCriterionExtension(WARDLEY_AUDIT_CRITERIA));
109
- // The Validation dropdown on a selected map's contextual toolbar. A
110
- // SECOND module on the same element, through the `custom:` flavour slot
111
- // (the pattern `gfx/mindmap` uses on `custom:affine:surface:shape`):
112
- // `wardleyToolbarExtension` is registered always-on because a stored map
113
- // must keep its axes and labels, while choosing how hard to check it is
114
- // tooling and belongs here. The config itself names no framework — it
115
- // reads roles and profiles — so a second framework registers the very
116
- // same object on its own flavour.
117
- context.register(ToolbarModuleExtension({
118
- id: BlockFlavourIdentifier('custom:affine:surface:wardley'),
119
- config: validationToolbarConfig,
120
- }));
110
+ // The Legend button and the Validation dropdown on a selected map's
111
+ // contextual toolbar — ONE module, through the `custom:` flavour slot
112
+ // (the pattern `gfx/mindmap` uses on `custom:affine:surface:shape`), for
113
+ // the reason `wardleyBoardToolingToolbarConfig` states: a flavour carries
114
+ // exactly one, and a second would throw at set-up. Here and not in the
115
+ // always-on half because both are TOOLING — generating a legend and
116
+ // choosing how hard to check the map — while `wardleyToolbarExtension`
117
+ // stays always-on so a stored map keeps its axes and labels.
118
+ context.register(wardleyBoardToolingToolbarExtension);
121
119
  // The four natures — Wardley's type-3 qualification (MF3, ADR 0007).
122
120
  // Seeded on the SAME mechanism a host uses for its own taxonomy: the
123
121
  // library ships one real pack, and a client's private extension is a
@@ -179,6 +177,12 @@ export class WardleyViewExtension extends ViewExtensionProvider {
179
177
  // the flag without either side naming the other.
180
178
  context.register(ReadingProfileExtension(WARDLEY_READING));
181
179
  context.register(wardleySeniorTool);
180
+ // Wardley's page of the colour pickers' carousel (`docs/adr/0027`).
181
+ // Here, beside the senior tool, because offering hues is TOOLING: a map
182
+ // drawn while the flag was on keeps every colour it was painted with
183
+ // when the flag goes off — the shelf that offers more of them is what
184
+ // goes away (`docs/adr/0009`).
185
+ context.register(FrameworkPaletteExtension(WARDLEY_FRAMEWORK_PALETTE));
182
186
  // The Templates-panel category — tooling, so it goes with the flag (#244).
183
187
  context.register(TemplateCategoryExtension(wardleyTemplateCategory));
184
188
  // The Wardley commands — thirteen artefacts plus the two directions of
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@formicoidea/labre-framework-wardley",
3
3
  "description": "Labre wardley framework for @formicoidea/labre-core.",
4
- "version": "0.40.0",
4
+ "version": "0.42.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "author": "lajola",
@@ -31,7 +31,7 @@
31
31
  "dist"
32
32
  ],
33
33
  "dependencies": {
34
- "@formicoidea/labre-core": "0.40.0",
34
+ "@formicoidea/labre-core": "0.42.0",
35
35
  "lit": "^3.2.0"
36
36
  }
37
37
  }