@formicoidea/labre-framework-wardley 0.40.0 → 0.41.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.
@@ -5,6 +5,45 @@ import { BlockFlavourIdentifier } from '@formicoidea/labre-core/std';
5
5
  import { html } from 'lit';
6
6
  import { createWardleyLegend } from '../legend.js';
7
7
  import { wardleyLegendIcon } from './icons.js';
8
+ /** The seven toolbar tooltips this file used to hard-code as English literals. */
9
+ const EVOLUTION_AXIS_TOGGLE = [
10
+ 'com.labre.wardley.toolbar.evolution-axis',
11
+ 'Evolution axis (X)',
12
+ ];
13
+ const EVOLUTION_PHASE_LABELS_TOGGLE = [
14
+ 'com.labre.wardley.toolbar.evolution-phase-labels',
15
+ 'Evolution phase labels',
16
+ ];
17
+ const COLUMNS_TOGGLE = [
18
+ 'com.labre.wardley.toolbar.columns',
19
+ 'Columns (dividers)',
20
+ ];
21
+ const CORNER_LABELS_TOGGLE = [
22
+ 'com.labre.wardley.toolbar.corner-labels',
23
+ 'Labels Uncharted / Industrialized',
24
+ ];
25
+ const GRADIENT_TOGGLE = [
26
+ 'com.labre.wardley.toolbar.gradient',
27
+ 'Show / hide the gradient',
28
+ ];
29
+ const VALUE_CHAIN_AXIS_TOGGLE = [
30
+ 'com.labre.wardley.toolbar.value-chain-axis',
31
+ 'Value Chain axis (Y)',
32
+ ];
33
+ const VISIBILITY_LABELS_TOGGLE = [
34
+ 'com.labre.wardley.toolbar.visibility-labels',
35
+ 'Labels Visible / Invisible',
36
+ ];
37
+ /** Every wording above, for `translations.ts`'s manifest contribution. */
38
+ export const WARDLEY_TOOLBAR_WORDINGS = [
39
+ EVOLUTION_AXIS_TOGGLE,
40
+ EVOLUTION_PHASE_LABELS_TOGGLE,
41
+ COLUMNS_TOGGLE,
42
+ CORNER_LABELS_TOGGLE,
43
+ GRADIENT_TOGGLE,
44
+ VALUE_CHAIN_AXIS_TOGGLE,
45
+ VISIBILITY_LABELS_TOGGLE,
46
+ ];
8
47
  const ResizeIcon = html `<svg
9
48
  width="24"
10
49
  height="24"
@@ -162,12 +201,12 @@ export const wardleyToolbarConfig = {
162
201
  {
163
202
  id: 'b.evolution',
164
203
  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'),
204
+ booleanToggle('b.1-axis-x', EVOLUTION_AXIS_TOGGLE, XAxisIcon, 'showXAxis'),
205
+ booleanToggle('b.2-column-labels', EVOLUTION_PHASE_LABELS_TOGGLE, ColumnLabelsIcon, 'showColumnLabels'),
206
+ booleanToggle('b.3-columns', COLUMNS_TOGGLE, ColumnsIcon, 'showColumnDividers'),
207
+ booleanToggle('b.4-corner-labels', CORNER_LABELS_TOGGLE, CornerLabelsIcon, 'showCornerLabels'),
169
208
  // Only relevant when the selection has a gradient variant.
170
- booleanToggle('b.5-gradient', 'Show / hide the gradient', GradientIcon, 'showGradient', ctx => ctx
209
+ booleanToggle('b.5-gradient', GRADIENT_TOGGLE, GradientIcon, 'showGradient', ctx => ctx
171
210
  .getSurfaceModelsByType(WardleyBackgroundElementModel)
172
211
  .some(model => model.variant !== 'classic')),
173
212
  ],
@@ -176,8 +215,8 @@ export const wardleyToolbarConfig = {
176
215
  {
177
216
  id: 'c.value-chain',
178
217
  actions: [
179
- booleanToggle('c.1-axis-y', 'Value Chain axis (Y)', YAxisIcon, 'showYAxis'),
180
- booleanToggle('c.2-visibility-labels', 'Labels Visible / Invisible', VisibilityIcon, 'showVisibilityLabels'),
218
+ booleanToggle('c.1-axis-y', VALUE_CHAIN_AXIS_TOGGLE, YAxisIcon, 'showYAxis'),
219
+ booleanToggle('c.2-visibility-labels', VISIBILITY_LABELS_TOGGLE, VisibilityIcon, 'showVisibilityLabels'),
181
220
  ],
182
221
  },
183
222
  // Generate the auto-legend from the components present inside this
@@ -1,4 +1,6 @@
1
- import { type Color, type Palette, type ShapeElementModel } from '@formicoidea/labre-core/model';
1
+ import type { 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,31 @@ 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[];
21
45
  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
@@ -1,12 +1,87 @@
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_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 table `createWardleyLegend` reads when it writes the group onto
44
+ * 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 four 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_TEA_SHOP,
66
+ WARDLEY_TEMPLATE_NAME_KODAK_INERTIA,
67
+ ].map(([key, fallback]) => ({ key, fallback, source: 'chrome' }));
68
+ /** The five fixed-wording OWM import remarks ({@link WARDLEY_OWM_IMPORT_REMARKS}). */
69
+ const importRemarkEntries = () => Object.values(WARDLEY_OWM_IMPORT_REMARKS).map(([key, english]) => ({
70
+ key,
71
+ fallback: english,
72
+ source: 'chrome',
73
+ }));
74
+ /**
75
+ * The nine node-colour-picker swatches' own names (`WARDLEY_PALETTE_WORDINGS`,
76
+ * `toolbar/node-config.ts`) — chrome, like the toolbar tooltips above: a
77
+ * swatch's name is re-rendered on every locale switch, never seeded into a
78
+ * document.
79
+ */
80
+ const paletteWordingEntries = () => WARDLEY_PALETTE_WORDINGS.map(([key, fallback]) => ({
81
+ key,
82
+ fallback,
83
+ source: 'chrome',
84
+ }));
10
85
  /**
11
86
  * THIS framework's contribution to the translation-key manifest — every
12
87
  * `com.labre.*` key Wardley can hand to `TranslationProvider.t`, derived from
@@ -27,4 +102,8 @@ export const wardleyTranslationEntries = mergeTranslationEntries(commandTranslat
27
102
  // registry names no framework category in the bundled distribution, so a
28
103
  // host that composed core's manifest alone drew translated entries under
29
104
  // 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));
105
+ 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),
106
+ // The library's own tag pack (`WARDLEY_TAG_DEFS`) — the natures and the
107
+ // Porter competition tags. A host's app-seeded pack needs no entry here:
108
+ // see `tagDefsTranslationEntries`.
109
+ tagDefsTranslationEntries(WARDLEY_TAG_DEFS));
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.41.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.41.0",
35
35
  "lit": "^3.2.0"
36
36
  }
37
37
  }