@formicoidea/labre-framework-cynefin 0.32.0 → 0.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,7 @@ import { makeTemplateSnapshot, surfaceText, } from '@formicoidea/labre-core/gfx/
2
2
  import { FontFamily, ShapeStyle, TextAlign } from '@formicoidea/labre-core/model';
3
3
  import { REF_H as CYN_H, REF_W as CYN_W } from '../cynefin/consts.js';
4
4
  import { HEX_FILL, HEX_SIZE, HEX_STROKE, HEX_VERTICES, REF_H as EST_H, REF_W as EST_W, } from '../estuarine/consts.js';
5
+ import { ESTUARINE_ROLE } from '../estuarine/roles.js';
5
6
  function sticky(x, y, text) {
6
7
  return {
7
8
  type: 'shape',
@@ -24,6 +25,9 @@ function sticky(x, y, text) {
24
25
  function hexagon(x, y) {
25
26
  return {
26
27
  type: 'shape',
28
+ // Same role the toolbox stamps (`actions.ts`): a template must produce the
29
+ // map a user would have drawn by hand, roles included.
30
+ role: ESTUARINE_ROLE.constraint,
27
31
  shapeType: 'polygon',
28
32
  vertices: HEX_VERTICES,
29
33
  filled: true,
@@ -47,11 +51,23 @@ function caption(x, y, str) {
47
51
  };
48
52
  }
49
53
  function tpl(name, preview, elements) {
50
- return { name, type: 'template', preview, content: makeTemplateSnapshot(elements, name) };
54
+ return {
55
+ name,
56
+ type: 'template',
57
+ preview,
58
+ content: makeTemplateSnapshot(elements, name),
59
+ };
51
60
  }
52
61
  const ATTRS = 'width="100%" height="100%" viewBox="0 0 135 80" xmlns="http://www.w3.org/2000/svg"';
62
+ // Cynefin's background carries NO role, deliberately and for good: the
63
+ // framework is out of the validation perimeter (PO, 26/08/2026). See
64
+ // `estuarine/roles.ts`.
53
65
  const cynefinBg = (xywh) => ({ type: 'cynefin', xywh });
54
- const estuarineBg = (xywh) => ({ type: 'estuarine', xywh });
66
+ const estuarineBg = (xywh) => ({
67
+ type: 'estuarine',
68
+ role: ESTUARINE_ROLE.map,
69
+ xywh,
70
+ });
55
71
  export const cynefinTemplateCategory = {
56
72
  name: 'Cynefin',
57
73
  templates: [
@@ -1,5 +1,6 @@
1
1
  import { DefaultTool } from '@formicoidea/labre-core/blocks/surface';
2
2
  import { EmptyTool } from '@formicoidea/labre-core/gfx/pointer';
3
+ import { translateKey } from '@formicoidea/labre-core/shared/services';
3
4
  import { EdgelessToolbarToolMixin } from '@formicoidea/labre-core/widgets/edgeless-toolbar';
4
5
  import { SignalWatcher } from '@formicoidea/labre-core/global/lit';
5
6
  import { css, html, LitElement } from 'lit';
@@ -64,7 +65,9 @@ export class EdgelessCynefinEstuarineSeniorButton extends EdgelessToolbarToolMix
64
65
  render() {
65
66
  return html `<edgeless-toolbar-button
66
67
  class="ce-button"
67
- .tooltip=${this.popper ? '' : 'Cynefin / Estuarine'}
68
+ .tooltip=${this.popper
69
+ ? ''
70
+ : translateKey(this.edgeless.std, 'com.labre.framework.cynefin-estuarine', 'Cynefin / Estuarine')}
68
71
  .tooltipOffset=${4}
69
72
  .active=${!!this.popper}
70
73
  @click=${this._toggleMenu}
@@ -4,6 +4,7 @@ import { html } from 'lit';
4
4
  export const cynefinEstuarineSeniorTool = SeniorToolExtension('cynefin-estuarine', ({ block }) => {
5
5
  return {
6
6
  name: 'Cynefin / Estuarine',
7
+ labelKey: 'com.labre.framework.cynefin-estuarine',
7
8
  content: html `<edgeless-cynefin-estuarine-senior-button
8
9
  .edgeless=${block}
9
10
  ></edgeless-cynefin-estuarine-senior-button>`,
@@ -2,6 +2,11 @@ import { type TranslationKeyManifestEntry } from '@formicoidea/labre-core/std';
2
2
  /**
3
3
  * THIS framework's contribution to the translation-key manifest.
4
4
  *
5
+ * Since WS4 it also carries the Estuarine ROLE labels and the four Map quality
6
+ * NUDGES — the framework's entire validation vocabulary, since it declares no
7
+ * rule and no profile (`estuarine/nudges.ts`). Cynefin contributes neither,
8
+ * having no role of its own.
9
+ *
5
10
  * Its command labels and descriptions are built from a TEMPLATE, so the
6
11
  * concrete keys exist nowhere but in the declarations themselves and the
7
12
  * core manifest could not restate them even if it wanted to. The
@@ -1,8 +1,15 @@
1
- import { commandTranslationEntries, } from '@formicoidea/labre-core/std';
1
+ import { collectTranslationKeys, commandTranslationEntries, mergeTranslationEntries, } from '@formicoidea/labre-core/std';
2
2
  import { cynefinEstuarineCommands } from './commands.js';
3
+ import { ESTUARINE_NUDGES } from './estuarine/nudges.js';
4
+ import { ESTUARINE_ROLES } from './estuarine/roles.js';
3
5
  /**
4
6
  * THIS framework's contribution to the translation-key manifest.
5
7
  *
8
+ * Since WS4 it also carries the Estuarine ROLE labels and the four Map quality
9
+ * NUDGES — the framework's entire validation vocabulary, since it declares no
10
+ * rule and no profile (`estuarine/nudges.ts`). Cynefin contributes neither,
11
+ * having no role of its own.
12
+ *
6
13
  * Its command labels and descriptions are built from a TEMPLATE, so the
7
14
  * concrete keys exist nowhere but in the declarations themselves and the
8
15
  * core manifest could not restate them even if it wanted to. The
@@ -12,4 +19,4 @@ import { cynefinEstuarineCommands } from './commands.js';
12
19
  * `cynefinEstuarineCommands` into the command registry. See
13
20
  * `packages/affine/all/src/translations.ts`.
14
21
  */
15
- export const cynefinEstuarineTranslationEntries = commandTranslationEntries(cynefinEstuarineCommands);
22
+ export const cynefinEstuarineTranslationEntries = mergeTranslationEntries(commandTranslationEntries(cynefinEstuarineCommands), collectTranslationKeys('role', ESTUARINE_ROLES), collectTranslationKeys('nudge', ESTUARINE_NUDGES));
package/dist/view.js CHANGED
@@ -1,6 +1,9 @@
1
+ import { QualityNudgeExtension, ValidationFrameworkExtension, validationToolbarConfig, } from '@formicoidea/labre-core/blocks/surface';
1
2
  import { ViewExtensionProvider, } from '@formicoidea/labre-core/ext-loader';
2
3
  import { extendTemplateCategory } from '@formicoidea/labre-core/gfx/template';
3
- import { CommandExtension } from '@formicoidea/labre-core/std';
4
+ import { ToolbarModuleExtension } from '@formicoidea/labre-core/shared/services';
5
+ import { BlockFlavourIdentifier, CommandExtension } from '@formicoidea/labre-core/std';
6
+ import { RoleVocabularyExtension } from '@formicoidea/labre-core/std/gfx';
4
7
  import { cynefinEstuarineCommandIcons, cynefinEstuarineCommands, } from './commands.js';
5
8
  import { CynefinRendererExtension } from './cynefin/element-renderer.js';
6
9
  import { CynefinInteraction, CynefinView } from './cynefin/element-view.js';
@@ -8,6 +11,9 @@ import { cynefinToolbarExtension } from './cynefin/toolbar/config.js';
8
11
  import { effects } from './effects.js';
9
12
  import { EstuarineRendererExtension } from './estuarine/element-renderer.js';
10
13
  import { EstuarineInteraction, EstuarineView } from './estuarine/element-view.js';
14
+ import { EstuarineGhostManager, EstuarineGhostOverlay, } from './estuarine/ghost-overlay.js';
15
+ import { ESTUARINE_NUDGES } from './estuarine/nudges.js';
16
+ import { ESTUARINE_ROLE, ESTUARINE_ROLES } from './estuarine/roles.js';
11
17
  import { estuarineToolbarExtension } from './estuarine/toolbar/config.js';
12
18
  import { cynefinTemplateCategory, estuarineTemplateCategory, } from './templates/index.js';
13
19
  import { cynefinEstuarineSeniorTool } from './toolbar/senior-tool.js';
@@ -29,11 +35,26 @@ export class CynefinEstuarineRenderViewExtension extends ViewExtensionProvider {
29
35
  context.register(CynefinRendererExtension);
30
36
  context.register(EstuarineView);
31
37
  context.register(EstuarineRendererExtension);
38
+ // The role VOCABULARY, always on. A role is written in the document, not in
39
+ // the tooling: a map drawn while the flag was on and opened while it is off
40
+ // still carries `estuarine:map`, and anything that READS a role — the
41
+ // qualification toolbar, a host panel — has to keep working
42
+ // (`docs/adr/0009`). What JUDGES those roles stays flag-gated below.
43
+ // Cynefin contributes nothing here and never will (`estuarine/roles.ts`).
44
+ context.register(RoleVocabularyExtension(ESTUARINE_ROLES));
32
45
  if (this.isEdgeless(context.scope)) {
33
46
  context.register(CynefinInteraction);
34
47
  context.register(EstuarineInteraction);
35
48
  context.register(cynefinToolbarExtension);
36
49
  context.register(estuarineToolbarExtension);
50
+ // The reveal animation of a curve toggle. ALWAYS on, with the renderer
51
+ // it animates: the permanent ghost is how a shown curve looks now, so
52
+ // the ~600 ms that makes its arrival visible is part of painting the
53
+ // element, not part of the creation tooling. It writes nothing, and it
54
+ // costs one media query plus one map lookup on a board with no
55
+ // Estuarine map at all.
56
+ context.register(EstuarineGhostOverlay);
57
+ context.register(EstuarineGhostManager);
37
58
  }
38
59
  }
39
60
  }
@@ -56,6 +77,33 @@ export class CynefinEstuarineViewExtension extends ViewExtensionProvider {
56
77
  setup(context) {
57
78
  super.setup(context);
58
79
  if (this.isEdgeless(context.scope)) {
80
+ // Estuarine's ROOT INSTANCE declaration (WS0.3). Every other framework
81
+ // derives "this element is my frame" from a rule naming the role as its
82
+ // background; Estuarine ships no rule at all — by arbitration, not by
83
+ // omission (see `estuarine/nudges.ts`) — so it says so explicitly rather
84
+ // than inventing a rule that fires on nothing just to open a gate.
85
+ context.register(ValidationFrameworkExtension([
86
+ {
87
+ framework: 'estuarine',
88
+ backgroundRole: ESTUARINE_ROLE.map,
89
+ roles: ESTUARINE_ROLES,
90
+ },
91
+ ]));
92
+ // Map quality: the four expectations no algorithm can check. This is the
93
+ // whole of what validation offers on an Estuarine map — no rules, and
94
+ // therefore NO profiles: a severity dial over an empty rule set is a
95
+ // control that decides nothing.
96
+ context.register(QualityNudgeExtension(ESTUARINE_NUDGES));
97
+ // The Validation dropdown on a selected map's contextual toolbar — a
98
+ // SECOND module on the same element, through the free `custom:` flavour
99
+ // slot (`estuarineToolbarExtension` owns the plain one and is always-on,
100
+ // because a stored map must keep its curve toggles). The config names no
101
+ // framework: it reads roles, profiles and nudges, so here it renders the
102
+ // checklist entry and no profile picker.
103
+ context.register(ToolbarModuleExtension({
104
+ id: BlockFlavourIdentifier('custom:affine:surface:estuarine'),
105
+ config: validationToolbarConfig,
106
+ }));
59
107
  context.register(cynefinEstuarineSeniorTool);
60
108
  context.register(CommandExtension(cynefinEstuarineCommands, cynefinEstuarineCommandIcons));
61
109
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@formicoidea/labre-framework-cynefin",
3
3
  "description": "Labre cynefin-estuarine framework for @formicoidea/labre-core.",
4
- "version": "0.32.0",
4
+ "version": "0.33.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "author": "lajola",
@@ -27,7 +27,8 @@
27
27
  "dist"
28
28
  ],
29
29
  "dependencies": {
30
- "@formicoidea/labre-core": "0.32.0",
30
+ "@formicoidea/labre-core": "0.33.0",
31
+ "@preact/signals-core": "^1.8.0",
31
32
  "lit": "^3.2.0"
32
33
  }
33
34
  }