@formicoidea/labre-framework-bpmn 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.
@@ -0,0 +1,65 @@
1
+ import { neutralPalettes } from '@formicoidea/labre-core/gfx/shape';
2
+ import { EVENT_END, EVENT_START } from '../consts.js';
3
+ /**
4
+ * The two BPMN swatches' own names, resolved by `resolvePaletteLabel`
5
+ * (`@labre/affine-components/color-picker`) through each swatch's own
6
+ * {@link NamedPalette.labelWording} — the mechanism `WARDLEY_PALETTE_WORDINGS`
7
+ * established, reused here without either package naming the other.
8
+ *
9
+ * Exported so `../translations.ts` can list them under source `chrome`: a
10
+ * swatch's name is toolbar chrome, never seeded into a document.
11
+ */
12
+ export const BPMN_PALETTE_WORDING_START = [
13
+ 'com.labre.bpmn.palette.start-green',
14
+ 'Start green',
15
+ ];
16
+ export const BPMN_PALETTE_WORDING_END = [
17
+ 'com.labre.bpmn.palette.end-red',
18
+ 'End red',
19
+ ];
20
+ export const BPMN_PALETTE_WORDINGS = [
21
+ BPMN_PALETTE_WORDING_START,
22
+ BPMN_PALETTE_WORDING_END,
23
+ ];
24
+ /**
25
+ * BPMN's own two hues — and deliberately only two.
26
+ *
27
+ * BPMN is a black-and-white notation: the SHAPE carries the meaning and the
28
+ * ink is the shared notation grey (`NEUTRAL_STROKE`, `NODE_FILL`, see
29
+ * `../consts.ts`), so a long shelf of BPMN colours would be an invention
30
+ * rather than the standard. The exceptions the pack itself draws are the two
31
+ * ends of a process — the start event's green ring and the end event's red one
32
+ * — and those are the two the picker offers, read off the consts rather than
33
+ * restated.
34
+ *
35
+ * Everything else an author needs is the neutral tail below, and the base
36
+ * palette which the carousel never hides.
37
+ */
38
+ const BPMN_PALETTES = [
39
+ {
40
+ key: 'Start green',
41
+ value: EVENT_START,
42
+ labelWording: BPMN_PALETTE_WORDING_START,
43
+ },
44
+ {
45
+ key: 'End red',
46
+ value: EVENT_END,
47
+ labelWording: BPMN_PALETTE_WORDING_END,
48
+ },
49
+ ];
50
+ /** The two notation hues, then the neutrals every drawing needs. */
51
+ export const BPMN_PALETTE_LIST = [
52
+ ...BPMN_PALETTES,
53
+ ...neutralPalettes(),
54
+ ];
55
+ /**
56
+ * BPMN's page of the colour pickers' carousel (`docs/adr/0027`). Registered
57
+ * from the FLAG-GATED view extension, because offering hues is TOOLING: a
58
+ * process drawn while the flag was on keeps every colour it was painted with
59
+ * when the flag goes off (`docs/adr/0009`).
60
+ */
61
+ export const BPMN_FRAMEWORK_PALETTE = {
62
+ framework: 'bpmn',
63
+ labelWording: ['com.labre.framework.bpmn', 'BPMN'],
64
+ palettes: BPMN_PALETTE_LIST,
65
+ };
@@ -7,6 +7,7 @@ import { BPMN_PROFILES } from './profiles.js';
7
7
  import { BPMN_READINGS } from './reading.js';
8
8
  import { BPMN_ROLES } from './roles.js';
9
9
  import { BPMN_RULES } from './rules.js';
10
+ import { BPMN_PALETTE_WORDINGS } from './toolbar/palette.js';
10
11
  import { BPMN_TEMPLATE_NAME_MESSAGE_EXCHANGE, BPMN_TEMPLATE_NAME_SEQUENCE_FLOW, BPMN_TEMPLATE_NAME_SIMPLE_PROCESS, MESSAGE_EXCHANGE_SEED, SIMPLE_PROCESS_SEED, } from './templates/index.js';
11
12
  /**
12
13
  * The captions a placed artefact is seeded with, and the fixed-wording remarks
@@ -53,7 +54,7 @@ const quarantineReasonEntries = () => Object.keys(BPMN_QUARANTINE_REASON).map(re
53
54
  source: 'chrome',
54
55
  }));
55
56
  /**
56
- * The nine export-warning keys ({@link BPMN_EXPORT_WARNING_KEYS}) — a report
57
+ * The ten export-warning keys ({@link BPMN_EXPORT_WARNING_KEYS}) — a report
57
58
  * built from the board rather than written into it, so `chrome` like the
58
59
  * import remarks above and not `seed`.
59
60
  */
@@ -90,6 +91,16 @@ const templateNameEntries = () => [
90
91
  BPMN_TEMPLATE_NAME_MESSAGE_EXCHANGE,
91
92
  BPMN_TEMPLATE_NAME_SEQUENCE_FLOW,
92
93
  ].map(([key, fallback]) => ({ key, fallback, source: 'chrome' }));
94
+ /**
95
+ * The carousel swatches' own names ({@link BPMN_PALETTE_WORDINGS}) — chrome,
96
+ * re-rendered by the colour picker on every locale switch, never seeded into a
97
+ * document. Same treatment as Wardley's and EDGY's.
98
+ */
99
+ const paletteEntries = () => BPMN_PALETTE_WORDINGS.map(([key, fallback]) => ({
100
+ key,
101
+ fallback,
102
+ source: 'chrome',
103
+ }));
93
104
  /**
94
105
  * THIS framework's contribution to the translation-key manifest — every
95
106
  * `com.labre.*` key BPMN can hand to `TranslationProvider.t`, derived from the
@@ -110,7 +121,7 @@ export const bpmnTranslationEntries = mergeTranslationEntries(commandTranslation
110
121
  // registry names no framework category in the bundled distribution, so a
111
122
  // host that composed core's manifest alone drew translated entries under
112
123
  // English headers (#183).
113
- commandCategoryTranslationEntries(bpmnCommands), collectTranslationKeys('role', BPMN_ROLES), collectTranslationKeys('rule', BPMN_RULES), collectTranslationKeys('profile', BPMN_PROFILES), seedEntries(), furnitureSeedEntries(), exampleSeedEntries(), templateNameEntries(), importRemarkEntries(), importErrorEntries(), quarantineReasonEntries(), exportWarningEntries(),
124
+ commandCategoryTranslationEntries(bpmnCommands), collectTranslationKeys('role', BPMN_ROLES), collectTranslationKeys('rule', BPMN_RULES), collectTranslationKeys('profile', BPMN_PROFILES), seedEntries(), furnitureSeedEntries(), exampleSeedEntries(), templateNameEntries(), paletteEntries(), importRemarkEntries(), importErrorEntries(), quarantineReasonEntries(), exportWarningEntries(),
114
125
  // LAST, and the order is load-bearing: a reading profile carries the
115
126
  // framework's own `roles`, so walking it reaches every role key the `role`
116
127
  // line above already named. `mergeTranslationEntries` keeps the FIRST
package/dist/view.js CHANGED
@@ -1,4 +1,5 @@
1
- import { FrameworkBackgroundInteractionExtension, InterchangeExtension, morphToolbarConfig, ReadingProfileExtension, ValidationProfileExtension, ValidationRuleExtension, validationToolbarConfig, } from '@formicoidea/labre-core/blocks/surface';
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 } from '@formicoidea/labre-core/shared/services';
@@ -18,7 +19,8 @@ import { BpmnPoolRendererExtension } from './element-renderer.js';
18
19
  import { BpmnPoolView } from './element-view.js';
19
20
  import { BpmnNodeRendererExtension } from './node/node-renderer.js';
20
21
  import { BpmnNodeView } from './node/node-view.js';
21
- import { bpmnPoolToolbarExtension } from './toolbar/config.js';
22
+ import { bpmnPoolToolbarExtension, bpmnPoolToolingToolbarExtension, } from './toolbar/config.js';
23
+ import { BPMN_FRAMEWORK_PALETTE } from './toolbar/palette.js';
22
24
  import { bpmnSeniorTool } from './toolbar/senior-tool.js';
23
25
  /**
24
26
  * BPMN rendering — ALWAYS registered, independent of any flag. Disabling `bpmn`
@@ -80,18 +82,15 @@ export class BpmnViewExtension extends ViewExtensionProvider {
80
82
  // off there is nothing to export WITH, while a board a past import wrote
81
83
  // keeps every element and every byte it was given (`docs/adr/0009`).
82
84
  context.register(InterchangeExtension(BPMN_INTERCHANGE));
83
- // The Validation dropdown on a selected pool's contextual toolbar. A
84
- // SECOND module on the same element, through the `custom:` flavour slot,
85
- // exactly as wardley and the context map register it on theirs:
86
- // `bpmnPoolToolbarExtension` is registered always-on because a stored pool
87
- // must keep its lanes and its resize toggle, while choosing how hard to
88
- // check the process is tooling and belongs here. The config names no
89
- // framework — it reads roles and profiles — so it is the very same object
90
- // the other two register.
91
- context.register(ToolbarModuleExtension({
92
- id: BlockFlavourIdentifier('custom:affine:surface:bpmnPool'),
93
- config: validationToolbarConfig,
94
- }));
85
+ // The Legend button and the Validation dropdown on a selected pool's
86
+ // contextual toolbar. A SECOND module on the same element, through the
87
+ // `custom:` flavour slot, exactly as wardley and the context map register
88
+ // it on theirs: `bpmnPoolToolbarExtension` is registered always-on
89
+ // because a stored pool must keep its lanes and its resize toggle, while
90
+ // GENERATING a legend and choosing how hard to check the process are both
91
+ // tooling and belong here (ADR 0026). One module, because a flavour may
92
+ // carry exactly one — see `bpmnPoolToolingToolbarConfig`.
93
+ context.register(bpmnPoolToolingToolbarExtension);
95
94
  // The "Change type" dropdown on a selected NODE's contextual toolbar —
96
95
  // the generic module, parameterized by BPMN's own families table.
97
96
  //
@@ -124,6 +123,11 @@ export class BpmnViewExtension extends ViewExtensionProvider {
124
123
  context.register(ReadingProfileExtension(reading));
125
124
  }
126
125
  context.register(bpmnSeniorTool);
126
+ // BPMN's page of the colour pickers' carousel (`docs/adr/0027`). Here,
127
+ // beside the senior tool, because offering hues is TOOLING — the colours
128
+ // already painted on a stored process are content and do not move
129
+ // (`docs/adr/0009`).
130
+ context.register(FrameworkPaletteExtension(BPMN_FRAMEWORK_PALETTE));
127
131
  // The Templates-panel category — tooling, so it goes with the flag (#244).
128
132
  context.register(TemplateCategoryExtension(bpmnTemplateCategory));
129
133
  context.register(CommandExtension(bpmnCommands, bpmnCommandIcons));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@formicoidea/labre-framework-bpmn",
3
3
  "description": "Labre bpmn 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,7 +31,7 @@
31
31
  "dist"
32
32
  ],
33
33
  "dependencies": {
34
- "@formicoidea/labre-core": "0.41.0",
34
+ "@formicoidea/labre-core": "0.43.1",
35
35
  "lit": "^3.2.0"
36
36
  }
37
37
  }