@formicoidea/labre-framework-c4 0.41.0 → 0.43.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.js CHANGED
@@ -48,10 +48,10 @@ export { C4_ELEMENT_MATRIX, C4_RELATIONSHIP_MATRIX, C4_RULES, } from './rules.js
48
48
  // The toolbox, for the host that composes the command registry and the
49
49
  // translation-key manifest out of the frameworks it installed (see
50
50
  // `packages/affine/all/src/{commands,translations}.ts`).
51
+ // What the board's automatic legend can say is no longer a table of its own:
52
+ // every row is subscribed by the command that draws the artefact
53
+ // (`CommandDescriptor.legend`, `docs/adr/0026`), so `c4Commands` already
54
+ // answers "what does this framework document about itself" without a canvas.
51
55
  export { c4CommandIcons, c4Commands } from './commands.js';
52
56
  export { c4TranslationEntries } from './translations.js';
53
- // The legend TABLE — what the board's automatic legend can say. Exported for
54
- // the same reason the two background declarations are: it answers "what does
55
- // this framework document about itself" without a canvas.
56
- export { C4_AUTO_LEGEND } from './legend.js';
57
57
  export { C4_COMPONENT_READING, C4_CONTAINER_READING, C4_PERSON_READING, C4_READINGS, C4_SYSTEM_READING, } from './reading.js';
@@ -16,4 +16,5 @@ export declare class EdgelessC4SeniorButton extends DddSeniorButtonBase {
16
16
  protected label: string;
17
17
  protected labelKey: string;
18
18
  protected icon: import("lit-html").TemplateResult<2>;
19
+ protected owner: "c4";
19
20
  }
@@ -19,5 +19,6 @@ export class EdgelessC4SeniorButton extends DddSeniorButtonBase {
19
19
  this.label = 'C4 model';
20
20
  this.labelKey = 'com.labre.framework.c4';
21
21
  this.icon = c4ToolbarIcon;
22
+ this.owner = 'c4';
22
23
  }
23
24
  }
@@ -1,5 +1,4 @@
1
- import { ActionPlacement, type ToolbarContext, type ToolbarModuleConfig } from '@formicoidea/labre-core/shared/services';
2
- import { type TemplateResult } from 'lit';
1
+ import { type ToolbarContext, type ToolbarModuleConfig } from '@formicoidea/labre-core/shared/services';
3
2
  /**
4
3
  * The selected C4 board's contextual toolbar: the resize toggle, and the
5
4
  * automatic legend of what is actually drawn on the board.
@@ -13,15 +12,14 @@ import { type TemplateResult } from 'lit';
13
12
  * The PO's call is that generating one belongs to a board you have SELECTED and
14
13
  * to nothing else: it is not an artefact to pick off a palette, and an entry in
15
14
  * a catalogue of things C4 draws would offer it to a user with no board in front
16
- * of them. So there is no `c4.legend` command, this button is the only way to
17
- * reach it, and the telemetry it owes is emitted by hand below.
15
+ * of them. So there is no `c4.legend` command, and this button is the only way
16
+ * to reach it.
18
17
  *
19
- * That is the same shape — and the same exception — the Context Map board makes
20
- * (`ddd-context-map/src/toolbar/board-config.ts`), down to the payload, so the
21
- * two frameworks' legends stay comparable on one dashboard. The cost is the one
22
- * the bottleneck exists to avoid and is accepted knowingly: this `track()` call
23
- * is a second emitter, and it is on whoever edits it to keep the wire values
24
- * matching what `reportCommandTelemetry` would have sent.
18
+ * That is the same shape — and the same exception — every other framework with a
19
+ * legend makes. The cost is the one the bottleneck exists to avoid: the
20
+ * telemetry it owes is emitted outside `runCommand`. It is emitted ONCE, by the
21
+ * shared factory (`legend-toolbar.ts`), so the seven copies of those wire values
22
+ * that used to sit in seven files can no longer drift apart.
25
23
  *
26
24
  * ## Two modules on one element, and why
27
25
  *
@@ -66,35 +64,26 @@ export declare const c4BoardToolbarConfig: {
66
64
  readonly actions: [{
67
65
  readonly id: "a.toggle-resize";
68
66
  readonly tooltipWording: import("@formicoidea/labre-core/shared/services").ChromeWording;
69
- readonly icon: TemplateResult<1>;
67
+ readonly icon: import("lit-html").TemplateResult<1>;
70
68
  readonly active: (ctx: ToolbarContext) => boolean;
71
69
  readonly run: (ctx: ToolbarContext) => void;
72
- }, {
73
- id: string;
74
- placement: ActionPlacement;
75
- when: (ctx: ToolbarContext) => boolean;
76
- generate: (ctx: ToolbarContext) => {
77
- icon: TemplateResult;
78
- label: string;
79
- run: (runCtx: ToolbarContext) => void;
80
- };
81
- }];
70
+ }, import("@formicoidea/labre-core/shared/services").ToolbarActionGenerator];
82
71
  readonly when: (ctx: ToolbarContext) => boolean;
83
72
  };
84
73
  export declare const c4BoardToolbarExtension: import("@formicoidea/labre-core/store").ExtensionType;
85
74
  /**
86
75
  * The legend button — the flag-gated half of the row (see the note above).
87
76
  *
88
- * `b.` sorts it after the resize toggle, so the two modules render as the one
89
- * row a user sees rather than in registration order.
77
+ * The SHARED factory, not a C4 copy of it: the button, the placement, the box
78
+ * and the one `FrameworkLegendCreated` emission all live in the surface block
79
+ * (`legend-toolbar.ts`, `docs/adr/0026`), and C4 hands it the board model to
80
+ * look for, whose commands to read the rows off, and the historical wire value.
81
+ *
82
+ * `b.` — the factory's default — sorts it after the resize toggle, so the two
83
+ * modules render as the one row a user sees rather than in registration order.
90
84
  */
91
85
  export declare const c4LegendToolbarConfig: {
92
- readonly actions: [{
93
- readonly id: "b.legend";
94
- readonly tooltipWording: import("@formicoidea/labre-core/shared/services").ChromeWording;
95
- readonly icon: TemplateResult<1>;
96
- readonly run: (ctx: ToolbarContext) => void;
97
- }];
86
+ readonly actions: [import("@formicoidea/labre-core/shared/services").ToolbarAction];
98
87
  readonly when: (ctx: ToolbarContext) => boolean;
99
88
  };
100
89
  /**
@@ -1,10 +1,8 @@
1
- import { EdgelessCRUDIdentifier, validationToolbarConfig, } from '@formicoidea/labre-core/blocks/surface';
2
- import { dddLegendIcon } from '@formicoidea/labre-ddd-shared';
1
+ import { EdgelessCRUDIdentifier, legendToolbarAction, validationToolbarConfig, } from '@formicoidea/labre-core/blocks/surface';
3
2
  import { C4BoardElementModel } from '@formicoidea/labre-core/model';
4
- import { ActionPlacement, BOARD_LEGEND_NOTATION, BOARD_RESIZE_TOGGLE, TelemetryProvider, ToolbarModuleExtension, translateKey, } from '@formicoidea/labre-core/shared/services';
5
- import { BlockFlavourIdentifier, getRegisteredCommands, runCommand, } from '@formicoidea/labre-core/std';
3
+ import { BOARD_RESIZE_TOGGLE, commandMoreAction, TelemetryProvider, ToolbarModuleExtension, translateKey, } from '@formicoidea/labre-core/shared/services';
4
+ import { BlockFlavourIdentifier } from '@formicoidea/labre-core/std';
6
5
  import { html, nothing } from 'lit';
7
- import { createC4Legend } from '../actions.js';
8
6
  import { C4_BOARD_LEVEL_MENU } from '../levels.js';
9
7
  import { c4ExportMermaidIcon } from './icons.js';
10
8
  const ResizeIcon = html `<svg
@@ -56,55 +54,6 @@ const CheckIcon = html `<svg
56
54
  >
57
55
  <path d="M5 12.5l4.5 4.5L19 7.5" />
58
56
  </svg>`;
59
- const findCommand = (ctx, id) => getRegisteredCommands(ctx.std).find(candidate => candidate.id === id);
60
- /**
61
- * A "⋮" entry that INVOKES a registered command instead of restating what it
62
- * does — the shape `docs/adr/0010` M3 introduced, and the reason the export has
63
- * one behaviour, one availability rule and one telemetry emission whether it is
64
- * reached from here, from the catalogue, from the palette, from
65
- * Settings › Shortcuts or from the agent.
66
- *
67
- * Two things the widget imposes: a menu line is drawn from `label` (a tooltip on
68
- * a line that is already words would be a second copy of them), and
69
- * `placement: ActionPlacement.More` is what partitions it out of the row in the
70
- * first place — `renderToolbar` splits on exactly that flag, and the entries it
71
- * collects come from every module contributing to the element, so a framework
72
- * can add to the "⋮" without owning it.
73
- *
74
- * `generate` rather than a static entry because the i18n seam needs `std`:
75
- * `translateKey` is what reaches the host's catalogue, and a hard-coded English
76
- * label would be the one wording a host could not override.
77
- *
78
- * Lifted from the BPMN pool's row, where `bpmn.exportXml` sits in exactly this
79
- * position.
80
- */
81
- function commandMoreAction(id, commandId, labelKey, labelFallback, icon) {
82
- return {
83
- id,
84
- placement: ActionPlacement.More,
85
- when: (ctx) => {
86
- const command = findCommand(ctx, commandId);
87
- return command !== undefined && (command.when?.(ctx.std) ?? true);
88
- },
89
- generate: (ctx) => ({
90
- icon,
91
- label: translateKey(ctx.std, labelKey, labelFallback),
92
- run: (runCtx) => {
93
- const command = findCommand(runCtx, commandId);
94
- if (!command)
95
- return;
96
- // The same `source` the row's own entries report: the "⋮" is a
97
- // degradation of the row, not a surface of its own, and the
98
- // `ElementCreationSource` union deliberately names places rather than
99
- // widths (`docs/adr/0008`).
100
- runCommand(runCtx.std, command, {
101
- surface: 'contextual-toolbar',
102
- source: 'toolbar:general',
103
- });
104
- },
105
- }),
106
- };
107
- }
108
57
  /**
109
58
  * The selected C4 board's contextual toolbar: the resize toggle, and the
110
59
  * automatic legend of what is actually drawn on the board.
@@ -118,15 +67,14 @@ function commandMoreAction(id, commandId, labelKey, labelFallback, icon) {
118
67
  * The PO's call is that generating one belongs to a board you have SELECTED and
119
68
  * to nothing else: it is not an artefact to pick off a palette, and an entry in
120
69
  * a catalogue of things C4 draws would offer it to a user with no board in front
121
- * of them. So there is no `c4.legend` command, this button is the only way to
122
- * reach it, and the telemetry it owes is emitted by hand below.
70
+ * of them. So there is no `c4.legend` command, and this button is the only way
71
+ * to reach it.
123
72
  *
124
- * That is the same shape — and the same exception — the Context Map board makes
125
- * (`ddd-context-map/src/toolbar/board-config.ts`), down to the payload, so the
126
- * two frameworks' legends stay comparable on one dashboard. The cost is the one
127
- * the bottleneck exists to avoid and is accepted knowingly: this `track()` call
128
- * is a second emitter, and it is on whoever edits it to keep the wire values
129
- * matching what `reportCommandTelemetry` would have sent.
73
+ * That is the same shape — and the same exception — every other framework with a
74
+ * legend makes. The cost is the one the bottleneck exists to avoid: the
75
+ * telemetry it owes is emitted outside `runCommand`. It is emitted ONCE, by the
76
+ * shared factory (`legend-toolbar.ts`), so the seven copies of those wire values
77
+ * that used to sit in seven files can no longer drift apart.
130
78
  *
131
79
  * ## Two modules on one element, and why
132
80
  *
@@ -345,32 +293,21 @@ const levelPickerAction = {
345
293
  /**
346
294
  * The legend button — the flag-gated half of the row (see the note above).
347
295
  *
348
- * `b.` sorts it after the resize toggle, so the two modules render as the one
349
- * row a user sees rather than in registration order.
296
+ * The SHARED factory, not a C4 copy of it: the button, the placement, the box
297
+ * and the one `FrameworkLegendCreated` emission all live in the surface block
298
+ * (`legend-toolbar.ts`, `docs/adr/0026`), and C4 hands it the board model to
299
+ * look for, whose commands to read the rows off, and the historical wire value.
300
+ *
301
+ * `b.` — the factory's default — sorts it after the resize toggle, so the two
302
+ * modules render as the one row a user sees rather than in registration order.
350
303
  */
351
304
  export const c4LegendToolbarConfig = {
352
305
  actions: [
353
- {
354
- id: 'b.legend',
355
- tooltipWording: BOARD_LEGEND_NOTATION,
356
- icon: dddLegendIcon,
357
- run(ctx) {
358
- createC4Legend(ctx.std);
359
- ctx.std
360
- .getOptional(TelemetryProvider)
361
- ?.track('FrameworkLegendCreated', {
362
- // The WIRE values, and they are the ones `reportCommandTelemetry`
363
- // would have sent for a `kind: 'legend'` command — `framework` from
364
- // the descriptor's `telemetryKey`, `element: 'legend'` as Wardley
365
- // and the Context Map both emit, so the three are one metric.
366
- framework: 'c4',
367
- element: 'legend',
368
- page: 'whiteboard editor',
369
- segment: 'element toolbar',
370
- module: 'c4 toolbar',
371
- });
372
- },
373
- },
306
+ legendToolbarAction({
307
+ Model: C4BoardElementModel,
308
+ owner: 'c4',
309
+ framework: 'c4',
310
+ }),
374
311
  ],
375
312
  when: (ctx) => ctx.getSurfaceModelsByType(C4BoardElementModel).length > 0,
376
313
  };
@@ -67,11 +67,14 @@ export declare const c4ExportMermaidIcon: import("lit-html").TemplateResult<2>;
67
67
  *
68
68
  * {@link c4ExportMermaidIcon} is deliberately NOT here and is added to
69
69
  * `c4CommandIcons` in `commands.ts` instead: this record is the TOOLBOX — the
70
- * thirteen glyphs of things C4 DRAWS — and an export draws nothing.
70
+ * thirteen glyphs of things C4 DRAWS — and an export draws nothing. The same
71
+ * goes for {@link c4ToolbarIcon}, registered there under `c4.toolbar` for
72
+ * `FrameworkDescriptor.iconKey`; it is the one key that test exempts from the
73
+ * glyph ⇄ command bijection.
71
74
  *
72
75
  * The legend's glyph is in neither, because the legend is no longer a command at
73
- * all: it is `dddLegendIcon`, referenced straight from `config.ts` by the button
74
- * that is now the only way to reach it (PO arbitration, 27/08/2026).
76
+ * all: it is the surface block's own `legendIcon`, drawn by the shared button
77
+ * factory that is now the only way to reach it (PO arbitration, 27/08/2026).
75
78
  */
76
79
  export declare const C4_TOOLBOX_ICONS: {
77
80
  readonly 'c4.person': import("lit-html").TemplateResult<2>;
@@ -134,11 +134,14 @@ export const c4ExportMermaidIcon = svg `<svg width="24" height="24" viewBox="0 0
134
134
  *
135
135
  * {@link c4ExportMermaidIcon} is deliberately NOT here and is added to
136
136
  * `c4CommandIcons` in `commands.ts` instead: this record is the TOOLBOX — the
137
- * thirteen glyphs of things C4 DRAWS — and an export draws nothing.
137
+ * thirteen glyphs of things C4 DRAWS — and an export draws nothing. The same
138
+ * goes for {@link c4ToolbarIcon}, registered there under `c4.toolbar` for
139
+ * `FrameworkDescriptor.iconKey`; it is the one key that test exempts from the
140
+ * glyph ⇄ command bijection.
138
141
  *
139
142
  * The legend's glyph is in neither, because the legend is no longer a command at
140
- * all: it is `dddLegendIcon`, referenced straight from `config.ts` by the button
141
- * that is now the only way to reach it (PO arbitration, 27/08/2026).
143
+ * all: it is the surface block's own `legendIcon`, drawn by the shared button
144
+ * factory that is now the only way to reach it (PO arbitration, 27/08/2026).
142
145
  */
143
146
  export const C4_TOOLBOX_ICONS = {
144
147
  'c4.person': c4PersonIcon,
@@ -0,0 +1,33 @@
1
+ import type { FrameworkPalette, NamedPalette } from '@formicoidea/labre-core/components/color-picker';
2
+ import type { ChromeWording } from '@formicoidea/labre-core/shared/services';
3
+ /**
4
+ * The C4 swatches' own names, resolved by `resolvePaletteLabel`
5
+ * (`@labre/affine-components/color-picker`) through each swatch's own
6
+ * {@link NamedPalette.labelWording} — the same framework-agnostic mechanism
7
+ * Wardley and EDGY use (`WARDLEY_PALETTE_WORDINGS`), so nothing here touches
8
+ * `packages/affine/model` (RED ZONE) or another framework's package.
9
+ *
10
+ * Exported so `../translations.ts` can list them under source `chrome`: a
11
+ * swatch's name is toolbar chrome, re-rendered on every locale switch, never
12
+ * seeded into a document.
13
+ */
14
+ export declare const C4_PALETTE_WORDING_PERSON: ChromeWording;
15
+ export declare const C4_PALETTE_WORDING_SYSTEM: ChromeWording;
16
+ export declare const C4_PALETTE_WORDING_CONTAINER: ChromeWording;
17
+ export declare const C4_PALETTE_WORDING_COMPONENT: ChromeWording;
18
+ export declare const C4_PALETTE_WORDING_EXTERNAL: ChromeWording;
19
+ export declare const C4_PALETTE_WORDING_RELATIONSHIP: ChromeWording;
20
+ export declare const C4_PALETTE_WORDINGS: readonly ChromeWording[];
21
+ /**
22
+ * From the default editor palette we keep ONLY the neutrals — the historical
23
+ * colours say nothing in this notation.
24
+ */
25
+ export declare const C4_PALETTE_LIST: NamedPalette[];
26
+ /**
27
+ * C4's page of the colour pickers' carousel (`docs/adr/0027`). Registered from
28
+ * the FLAG-GATED view extension, because offering hues is TOOLING: a diagram
29
+ * drawn while the flag was on keeps every colour it was painted with when the
30
+ * flag goes off — the shelf that offers more of them is what goes away
31
+ * (`docs/adr/0009`).
32
+ */
33
+ export declare const C4_FRAMEWORK_PALETTE: FrameworkPalette;
@@ -0,0 +1,114 @@
1
+ import { neutralPalettes } from '@formicoidea/labre-core/gfx/shape';
2
+ import { NODE_PALETTE, RELATIONSHIP_STROKE } from '../consts.js';
3
+ /**
4
+ * The C4 swatches' own names, resolved by `resolvePaletteLabel`
5
+ * (`@labre/affine-components/color-picker`) through each swatch's own
6
+ * {@link NamedPalette.labelWording} — the same framework-agnostic mechanism
7
+ * Wardley and EDGY use (`WARDLEY_PALETTE_WORDINGS`), so nothing here touches
8
+ * `packages/affine/model` (RED ZONE) or another framework's package.
9
+ *
10
+ * Exported so `../translations.ts` can list them under source `chrome`: a
11
+ * swatch's name is toolbar chrome, re-rendered on every locale switch, never
12
+ * seeded into a document.
13
+ */
14
+ export const C4_PALETTE_WORDING_PERSON = [
15
+ 'com.labre.c4.palette.person-blue',
16
+ 'Person blue',
17
+ ];
18
+ export const C4_PALETTE_WORDING_SYSTEM = [
19
+ 'com.labre.c4.palette.system-blue',
20
+ 'System blue',
21
+ ];
22
+ export const C4_PALETTE_WORDING_CONTAINER = [
23
+ 'com.labre.c4.palette.container-blue',
24
+ 'Container blue',
25
+ ];
26
+ export const C4_PALETTE_WORDING_COMPONENT = [
27
+ 'com.labre.c4.palette.component-blue',
28
+ 'Component blue',
29
+ ];
30
+ export const C4_PALETTE_WORDING_EXTERNAL = [
31
+ 'com.labre.c4.palette.external-grey',
32
+ 'External grey',
33
+ ];
34
+ export const C4_PALETTE_WORDING_RELATIONSHIP = [
35
+ 'com.labre.c4.palette.relationship-grey',
36
+ 'Relationship grey',
37
+ ];
38
+ export const C4_PALETTE_WORDINGS = [
39
+ C4_PALETTE_WORDING_PERSON,
40
+ C4_PALETTE_WORDING_SYSTEM,
41
+ C4_PALETTE_WORDING_CONTAINER,
42
+ C4_PALETTE_WORDING_COMPONENT,
43
+ C4_PALETTE_WORDING_EXTERNAL,
44
+ C4_PALETTE_WORDING_RELATIONSHIP,
45
+ ];
46
+ /**
47
+ * The C4 **level ladder**, surfaced as ready-made swatches.
48
+ *
49
+ * C4's stencil IS a colour code (see `../consts.ts`): the four levels are four
50
+ * blues running lighter as they go in — person, software system, container,
51
+ * component — anything outside the diagram's scope is one grey, and everything
52
+ * that is not an element (the relationship arrow, the boundary frame) is drawn
53
+ * in a second, darker one.
54
+ *
55
+ * Every value is read off {@link NODE_PALETTE} and {@link RELATIONSHIP_STROKE}
56
+ * rather than restated, so the shelf and the notation cannot drift apart. They
57
+ * are SHORTCUTS, never constraints: no rule of this pack reads a colour.
58
+ */
59
+ const C4_PALETTES = [
60
+ {
61
+ key: 'Person blue',
62
+ value: NODE_PALETTE.person.fill,
63
+ labelWording: C4_PALETTE_WORDING_PERSON,
64
+ },
65
+ {
66
+ key: 'System blue',
67
+ value: NODE_PALETTE.system.fill,
68
+ labelWording: C4_PALETTE_WORDING_SYSTEM,
69
+ },
70
+ {
71
+ key: 'Container blue',
72
+ value: NODE_PALETTE.container.fill,
73
+ labelWording: C4_PALETTE_WORDING_CONTAINER,
74
+ },
75
+ {
76
+ key: 'Component blue',
77
+ value: NODE_PALETTE.component.fill,
78
+ labelWording: C4_PALETTE_WORDING_COMPONENT,
79
+ },
80
+ // One grey for both external kinds, because the stencil paints them the same:
81
+ // "outside the scope of this diagram" is one statement.
82
+ {
83
+ key: 'External grey',
84
+ value: NODE_PALETTE['system-ext'].fill,
85
+ labelWording: C4_PALETTE_WORDING_EXTERNAL,
86
+ },
87
+ // The grey of the relationship arrow — and of the boundary frame, which the
88
+ // stencil draws in the very same `#444444`.
89
+ {
90
+ key: 'Relationship grey',
91
+ value: RELATIONSHIP_STROKE,
92
+ labelWording: C4_PALETTE_WORDING_RELATIONSHIP,
93
+ },
94
+ ];
95
+ /**
96
+ * From the default editor palette we keep ONLY the neutrals — the historical
97
+ * colours say nothing in this notation.
98
+ */
99
+ export const C4_PALETTE_LIST = [
100
+ ...C4_PALETTES,
101
+ ...neutralPalettes(),
102
+ ];
103
+ /**
104
+ * C4's page of the colour pickers' carousel (`docs/adr/0027`). Registered from
105
+ * the FLAG-GATED view extension, because offering hues is TOOLING: a diagram
106
+ * drawn while the flag was on keeps every colour it was painted with when the
107
+ * flag goes off — the shelf that offers more of them is what goes away
108
+ * (`docs/adr/0009`).
109
+ */
110
+ export const C4_FRAMEWORK_PALETTE = {
111
+ framework: 'c4',
112
+ labelWording: ['com.labre.framework.c4', 'C4 model'],
113
+ palettes: C4_PALETTE_LIST,
114
+ };
@@ -1,13 +1,13 @@
1
1
  import { collectTranslationKeys, commandCategoryTranslationEntries, commandTranslationEntries, mergeTranslationEntries, } from '@formicoidea/labre-core/std';
2
2
  import { C4_BOARD_BACKGROUND, C4_BOUNDARY_BACKGROUND } from './background.js';
3
- import { c4Commands } from './commands.js';
3
+ import { c4Commands, C4_LEGEND_SECTION_WORDINGS } from './commands.js';
4
4
  import { BOUNDARY_LABEL, boundaryLabelKey, DESCRIPTION_PLACEHOLDER, DESCRIPTION_PLACEHOLDER_KEY, NODE_LABEL, nodeLabelKey, } from './consts.js';
5
- import { C4_LEGEND_SECTION_WORDINGS } from './legend.js';
6
5
  import { C4_BOARD_LEVEL_MENU } from './levels.js';
7
6
  import { C4_PROFILES } from './profiles.js';
8
7
  import { C4_READINGS } from './reading.js';
9
8
  import { C4_ROLES } from './roles.js';
10
9
  import { C4_RULES } from './rules.js';
10
+ import { C4_PALETTE_WORDINGS } from './toolbar/palette.js';
11
11
  import { C4_TYPE_LINE_WORDINGS } from './type-line.js';
12
12
  /**
13
13
  * The captions a placed component and a placed boundary are seeded with — the
@@ -39,6 +39,16 @@ const seedEntries = () => [
39
39
  source: 'seed',
40
40
  })),
41
41
  ];
42
+ /**
43
+ * The carousel swatches' own names ({@link C4_PALETTE_WORDINGS}) — chrome,
44
+ * re-rendered by the colour picker on every locale switch, never seeded into
45
+ * a document. Same treatment as Wardley's and EDGY's.
46
+ */
47
+ const paletteEntries = () => C4_PALETTE_WORDINGS.map(([key, fallback]) => ({
48
+ key,
49
+ fallback,
50
+ source: 'chrome',
51
+ }));
42
52
  /** The auto-legend's own section titles ({@link C4_LEGEND_SECTION_WORDINGS}). */
43
53
  const legendSectionEntries = () => C4_LEGEND_SECTION_WORDINGS.map(([key, fallback]) => ({
44
54
  key,
@@ -79,7 +89,7 @@ commandCategoryTranslationEntries(c4Commands), collectTranslationKeys('role', C4
79
89
  // nothing is restated in `affine/all`, so a key added to the picker
80
90
  // reaches a host's catalogue by construction.
81
91
  C4_BOARD_LEVEL_MENU,
82
- ]), seedEntries(), legendSectionEntries(),
92
+ ]), seedEntries(), legendSectionEntries(), paletteEntries(),
83
93
  // AFTER the two above, and the order is load-bearing: a rule carries its
84
94
  // framework's `roles` and, for `c4.person-in-boundary`, the boundary's own
85
95
  // declaration, so walking the rules reaches keys those two lists already
@@ -164,7 +164,7 @@ export declare const C4_TYPE_PLACEHOLDER: Record<C4NodeKind, string>;
164
164
  * placement site (`createC4Node`, `actions.ts`) seeds a fresh element with
165
165
  * this rather than the English-only constant, so a component drawn in a
166
166
  * translated host starts in that language, like every other seed
167
- * (`docs/adr/0016`). With no `std` this returns exactly
167
+ * (`docs/adr/0023`). With no `std` this returns exactly
168
168
  * `C4_TYPE_PLACEHOLDER[kind]`.
169
169
  */
170
170
  export declare function c4TypePlaceholder(kind: C4NodeKind, std?: BlockStdScope): string;
package/dist/type-line.js CHANGED
@@ -295,7 +295,7 @@ export const C4_TYPE_PLACEHOLDER = Object.fromEntries(Object.keys(C4_TYPE_WORD).
295
295
  * placement site (`createC4Node`, `actions.ts`) seeds a fresh element with
296
296
  * this rather than the English-only constant, so a component drawn in a
297
297
  * translated host starts in that language, like every other seed
298
- * (`docs/adr/0016`). With no `std` this returns exactly
298
+ * (`docs/adr/0023`). With no `std` this returns exactly
299
299
  * `C4_TYPE_PLACEHOLDER[kind]`.
300
300
  */
301
301
  export function c4TypePlaceholder(kind, std) {
package/dist/view.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { FrameworkBackgroundInteractionExtension, InterchangeExtension, morphToolbarConfig, ReadingProfileExtension, ValidationProfileExtension, ValidationRuleExtension, } from '@formicoidea/labre-core/blocks/surface';
2
+ import { FrameworkPaletteExtension } from '@formicoidea/labre-core/components/color-picker';
2
3
  import { ViewExtensionProvider, } from '@formicoidea/labre-core/ext-loader';
3
4
  import { TemplateCategoryExtension } from '@formicoidea/labre-core/gfx/template';
4
5
  import { ToolbarModuleExtension, toolbarModuleKey, } from '@formicoidea/labre-core/shared/services';
@@ -20,6 +21,7 @@ import { C4_ROLES } from './roles.js';
20
21
  import { C4_RULES } from './rules.js';
21
22
  import { c4TemplateCategory } from './templates.js';
22
23
  import { c4BoardToolbarExtension, c4BoardToolingToolbarExtension, } from './toolbar/config.js';
24
+ import { C4_FRAMEWORK_PALETTE } from './toolbar/palette.js';
23
25
  import { c4SeniorTool } from './toolbar/senior-tool.js';
24
26
  /**
25
27
  * C4 rendering — ALWAYS registered, independent of any flag. Boards, boundaries
@@ -112,6 +114,11 @@ export class C4ViewExtension extends ViewExtensionProvider {
112
114
  context.register(ReadingProfileExtension(reading));
113
115
  }
114
116
  context.register(c4SeniorTool);
117
+ // C4's page of the colour pickers' carousel (`docs/adr/0027`). Here,
118
+ // beside the senior tool, because offering hues is TOOLING — the colours
119
+ // already painted on a stored diagram are content and do not move
120
+ // (`docs/adr/0009`).
121
+ context.register(FrameworkPaletteExtension(C4_FRAMEWORK_PALETTE));
115
122
  // The Templates-panel category — tooling, so it goes with the flag (#244).
116
123
  context.register(TemplateCategoryExtension(c4TemplateCategory));
117
124
  context.register(CommandExtension(c4Commands, c4CommandIcons));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@formicoidea/labre-framework-c4",
3
3
  "description": "Labre c4 framework for @formicoidea/labre-core.",
4
- "version": "0.41.0",
4
+ "version": "0.43.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.41.0",
35
- "@formicoidea/labre-ddd-shared": "0.41.0",
34
+ "@formicoidea/labre-core": "0.43.1",
35
+ "@formicoidea/labre-ddd-shared": "0.43.1",
36
36
  "lit": "^3.2.0"
37
37
  }
38
38
  }
package/dist/legend.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { type AutoLegendSpec } from '@formicoidea/labre-ddd-shared';
2
- import { type ChromeWording } from '@formicoidea/labre-core/shared/services';
3
- /** Every section `titleKey` above, for `translations.ts`'s manifest. */
4
- export declare const C4_LEGEND_SECTION_WORDINGS: readonly ChromeWording[];
5
- export declare const C4_AUTO_LEGEND: AutoLegendSpec;