@formicoidea/labre-framework-bpmn 0.23.2 → 0.24.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.
Files changed (40) hide show
  1. package/dist/consts.d.ts +41 -0
  2. package/{src/consts.ts → dist/consts.js} +47 -57
  3. package/dist/descriptor.d.ts +7 -0
  4. package/{src/descriptor.ts → dist/descriptor.js} +4 -5
  5. package/dist/effects.d.ts +9 -0
  6. package/dist/effects.js +6 -0
  7. package/dist/element-renderer.d.ts +12 -0
  8. package/dist/element-renderer.js +57 -0
  9. package/dist/element-view.d.ts +21 -0
  10. package/dist/element-view.js +102 -0
  11. package/{src/index.ts → dist/index.d.ts} +1 -1
  12. package/dist/index.js +1 -0
  13. package/dist/node/node-renderer.d.ts +15 -0
  14. package/dist/node/node-renderer.js +42 -0
  15. package/dist/node/node-view.d.ts +16 -0
  16. package/dist/node/node-view.js +27 -0
  17. package/dist/templates/index.d.ts +2 -0
  18. package/dist/templates/index.js +113 -0
  19. package/dist/toolbar/bpmn-menu.d.ts +26 -0
  20. package/dist/toolbar/bpmn-menu.js +178 -0
  21. package/dist/toolbar/bpmn-senior-button.d.ts +15 -0
  22. package/{src/toolbar/bpmn-senior-button.ts → dist/toolbar/bpmn-senior-button.js} +45 -51
  23. package/dist/toolbar/config.d.ts +13 -0
  24. package/dist/toolbar/config.js +54 -0
  25. package/dist/toolbar/icons.d.ts +15 -0
  26. package/{src/toolbar/icons.ts → dist/toolbar/icons.js} +23 -30
  27. package/dist/toolbar/senior-tool.d.ts +1 -0
  28. package/{src/toolbar/senior-tool.ts → dist/toolbar/senior-tool.js} +9 -10
  29. package/dist/view.d.ts +6 -0
  30. package/dist/view.js +33 -0
  31. package/package.json +15 -6
  32. package/src/effects.ts +0 -14
  33. package/src/element-renderer.ts +0 -93
  34. package/src/element-view.ts +0 -116
  35. package/src/node/node-renderer.ts +0 -65
  36. package/src/node/node-view.ts +0 -34
  37. package/src/templates/index.ts +0 -156
  38. package/src/toolbar/bpmn-menu.ts +0 -224
  39. package/src/toolbar/config.ts +0 -74
  40. package/src/view.ts +0 -37
@@ -0,0 +1,178 @@
1
+ import { DefaultTool } from '@formicoidea/labre-core/blocks/surface';
2
+ import { ConnectorTool } from '@formicoidea/labre-core/gfx/connector';
3
+ import { EmptyTool } from '@formicoidea/labre-core/gfx/pointer';
4
+ import { ConnectorMode, FontFamily, PointStyle, ShapeStyle, StrokeStyle, } from '@formicoidea/labre-core/model';
5
+ import { EditPropsStore, TelemetryProvider, } from '@formicoidea/labre-core/shared/services';
6
+ import { EdgelessToolbarToolMixin } from '@formicoidea/labre-core/widgets/edgeless-toolbar';
7
+ import { Bound } from '@formicoidea/labre-core/global/gfx';
8
+ import { css, html, LitElement } from 'lit';
9
+ import { EVENT_END, EVENT_START, END_WIDTH, INNER_FONT_SIZE, NEUTRAL_STROKE, NODE_FILL, NODE_LABEL, NODE_SIZE, NODE_STROKE_WIDTH, SEQUENCE_STROKE, SEQUENCE_WIDTH, START_WIDTH, TASK_RADIUS, } from '../consts';
10
+ import { bpmnEndIcon, bpmnGatewayIcon, bpmnPoolIcon, bpmnSequenceIcon, bpmnStartIcon, bpmnTaskIcon, } from './icons';
11
+ /** Per-kind native shape + accent presets (style C). */
12
+ const NODE_PRESETS = {
13
+ startEvent: { shapeType: 'ellipse', stroke: EVENT_START, width: START_WIDTH },
14
+ endEvent: { shapeType: 'ellipse', stroke: EVENT_END, width: END_WIDTH },
15
+ task: { shapeType: 'rect', stroke: NEUTRAL_STROKE, width: NODE_STROKE_WIDTH },
16
+ gatewayExclusive: {
17
+ shapeType: 'diamond',
18
+ stroke: NEUTRAL_STROKE,
19
+ width: NODE_STROKE_WIDTH,
20
+ },
21
+ };
22
+ /**
23
+ * The popover above the toolbar for the BPMN toolbox. Items create the flow
24
+ * objects (native shapes, so they stay editable), the pool background, and arm
25
+ * the native connector tool for sequence flows. Mirrors the EDGY menu.
26
+ */
27
+ export class EdgelessBpmnMenu extends EdgelessToolbarToolMixin(LitElement) {
28
+ constructor() {
29
+ super(...arguments);
30
+ this.type = EmptyTool;
31
+ }
32
+ static { this.styles = css `
33
+ :host {
34
+ position: absolute;
35
+ display: flex;
36
+ z-index: -1;
37
+ }
38
+ .menu-content {
39
+ display: flex;
40
+ align-items: center;
41
+ justify-content: center;
42
+ }
43
+ .button-group-container {
44
+ display: flex;
45
+ align-items: center;
46
+ gap: 14px;
47
+ fill: var(--affine-icon-color);
48
+ }
49
+ .button-group-container svg {
50
+ width: 24px;
51
+ height: 24px;
52
+ }
53
+ `; }
54
+ /** Create a flow-object node (native shape) centred on the viewport. */
55
+ _createNode(kind) {
56
+ const surface = this.gfx.surface;
57
+ if (!surface)
58
+ return;
59
+ const { w, h } = NODE_SIZE[kind];
60
+ const { centerX: cx, centerY: cy } = this.gfx.viewport;
61
+ const preset = NODE_PRESETS[kind];
62
+ const id = surface.addElement({
63
+ type: 'bpmnNode',
64
+ kind,
65
+ shapeType: preset.shapeType,
66
+ filled: true,
67
+ fillColor: NODE_FILL,
68
+ strokeColor: preset.stroke,
69
+ strokeWidth: preset.width,
70
+ shapeStyle: ShapeStyle.General,
71
+ roughness: 0,
72
+ radius: kind === 'task' ? TASK_RADIUS : 0,
73
+ text: NODE_LABEL[kind] || undefined,
74
+ color: NEUTRAL_STROKE,
75
+ fontFamily: FontFamily.Inter,
76
+ fontSize: INNER_FONT_SIZE,
77
+ textAlign: 'center',
78
+ xywh: new Bound(cx - w / 2, cy - h / 2, w, h).serialize(),
79
+ });
80
+ this._track('FrameworkElementAdded', `node:${kind}`);
81
+ this._finish(id);
82
+ }
83
+ /** Create a pool (background container) centred on the viewport. */
84
+ _createPool() {
85
+ const surface = this.gfx.surface;
86
+ if (!surface)
87
+ return;
88
+ const w = 560;
89
+ const h = 200;
90
+ const { centerX: cx, centerY: cy } = this.gfx.viewport;
91
+ const id = surface.addElement({
92
+ type: 'bpmnPool',
93
+ xywh: new Bound(cx - w / 2, cy - h / 2, w, h).serialize(),
94
+ });
95
+ this._track('FrameworkElementAdded', 'pool');
96
+ this._finish(id);
97
+ }
98
+ /**
99
+ * Arm the native connector tool, pre-styled for a BPMN sequence flow:
100
+ * orthogonal, solid, with a filled triangle head. The user then draws from
101
+ * one node to another (endpoints attach to centers).
102
+ */
103
+ _activateSequenceFlow() {
104
+ this.edgeless.std.get(EditPropsStore).recordLastProps('connector', {
105
+ mode: ConnectorMode.Orthogonal,
106
+ stroke: SEQUENCE_STROKE,
107
+ strokeStyle: StrokeStyle.Solid,
108
+ strokeWidth: SEQUENCE_WIDTH,
109
+ frontEndpointStyle: PointStyle.None,
110
+ rearEndpointStyle: PointStyle.Triangle,
111
+ });
112
+ this._track('FrameworkToolPicked', 'connector:sequence');
113
+ this.gfx.tool.setTool(ConnectorTool, { mode: ConnectorMode.Orthogonal });
114
+ // Keep the palette open (native sub-menu behaviour).
115
+ }
116
+ _finish(id) {
117
+ const { gfx } = this;
118
+ gfx.doc.captureSync();
119
+ gfx.tool.setTool(DefaultTool);
120
+ gfx.selection.set({ elements: [id], editing: false });
121
+ // Keep the palette open (native sub-menu behaviour).
122
+ }
123
+ _track(event, element) {
124
+ this.edgeless.std.getOptional(TelemetryProvider)?.track(event, {
125
+ framework: 'bpmn',
126
+ element,
127
+ page: 'whiteboard editor',
128
+ segment: 'bpmn toolbox',
129
+ module: 'bpmn menu',
130
+ });
131
+ }
132
+ render() {
133
+ return html `
134
+ <edgeless-slide-menu>
135
+ <div class="menu-content">
136
+ <div class="button-group-container">
137
+ <edgeless-tool-icon-button
138
+ .tooltip=${'Start event'}
139
+ @click=${() => this._createNode('startEvent')}
140
+ >
141
+ ${bpmnStartIcon}
142
+ </edgeless-tool-icon-button>
143
+ <edgeless-tool-icon-button
144
+ .tooltip=${'End event'}
145
+ @click=${() => this._createNode('endEvent')}
146
+ >
147
+ ${bpmnEndIcon}
148
+ </edgeless-tool-icon-button>
149
+ <edgeless-tool-icon-button
150
+ .tooltip=${'Task'}
151
+ @click=${() => this._createNode('task')}
152
+ >
153
+ ${bpmnTaskIcon}
154
+ </edgeless-tool-icon-button>
155
+ <edgeless-tool-icon-button
156
+ .tooltip=${'Exclusive gateway'}
157
+ @click=${() => this._createNode('gatewayExclusive')}
158
+ >
159
+ ${bpmnGatewayIcon}
160
+ </edgeless-tool-icon-button>
161
+ <edgeless-tool-icon-button
162
+ .tooltip=${'Sequence flow'}
163
+ @click=${this._activateSequenceFlow}
164
+ >
165
+ ${bpmnSequenceIcon}
166
+ </edgeless-tool-icon-button>
167
+ <edgeless-tool-icon-button
168
+ .tooltip=${'Pool'}
169
+ @click=${this._createPool}
170
+ >
171
+ ${bpmnPoolIcon}
172
+ </edgeless-tool-icon-button>
173
+ </div>
174
+ </div>
175
+ </edgeless-slide-menu>
176
+ `;
177
+ }
178
+ }
@@ -0,0 +1,15 @@
1
+ import { EmptyTool } from '@formicoidea/labre-core/gfx/pointer';
2
+ import { LitElement } from 'lit';
3
+ declare const EdgelessBpmnSeniorButton_base: typeof LitElement & import("@formicoidea/labre-core/_pkgs/global/utils").Constructor<import("@formicoidea/labre-core/_pkgs/affine-widget-edgeless-toolbar").EdgelessToolbarToolClass>;
4
+ /**
5
+ * Main toolbar button (colored BPMN glyph) that opens the BPMN toolbox sub-menu
6
+ * above the toolbar. Mirrors the EDGY / Wardley senior buttons.
7
+ */
8
+ export declare class EdgelessBpmnSeniorButton extends EdgelessBpmnSeniorButton_base {
9
+ static styles: import("lit").CSSResult;
10
+ enableActiveBackground: boolean;
11
+ type: typeof EmptyTool;
12
+ private _toggleMenu;
13
+ render(): import("lit-html").TemplateResult<1>;
14
+ }
15
+ export {};
@@ -1,19 +1,20 @@
1
- import { DefaultTool } from '@formicoidea/labre-core/blocks/surface';
2
- import { EmptyTool } from '@formicoidea/labre-core/gfx/pointer';
3
- import { EdgelessToolbarToolMixin } from '@formicoidea/labre-core/widgets/edgeless-toolbar';
4
- import { SignalWatcher } from '@formicoidea/labre-core/global/lit';
5
- import { css, html, LitElement } from 'lit';
6
-
7
- import { bpmnToolbarIcon } from './icons';
8
-
9
- /**
10
- * Main toolbar button (colored BPMN glyph) that opens the BPMN toolbox sub-menu
11
- * above the toolbar. Mirrors the EDGY / Wardley senior buttons.
12
- */
13
- export class EdgelessBpmnSeniorButton extends EdgelessToolbarToolMixin(
14
- SignalWatcher(LitElement)
15
- ) {
16
- static override styles = css`
1
+ import { DefaultTool } from '@formicoidea/labre-core/blocks/surface';
2
+ import { EmptyTool } from '@formicoidea/labre-core/gfx/pointer';
3
+ import { EdgelessToolbarToolMixin } from '@formicoidea/labre-core/widgets/edgeless-toolbar';
4
+ import { SignalWatcher } from '@formicoidea/labre-core/global/lit';
5
+ import { css, html, LitElement } from 'lit';
6
+ import { bpmnToolbarIcon } from './icons';
7
+ /**
8
+ * Main toolbar button (colored BPMN glyph) that opens the BPMN toolbox sub-menu
9
+ * above the toolbar. Mirrors the EDGY / Wardley senior buttons.
10
+ */
11
+ export class EdgelessBpmnSeniorButton extends EdgelessToolbarToolMixin(SignalWatcher(LitElement)) {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.enableActiveBackground = true;
15
+ this.type = EmptyTool;
16
+ }
17
+ static { this.styles = css `
17
18
  :host,
18
19
  .bpmn-button {
19
20
  display: block;
@@ -56,38 +57,31 @@ export class EdgelessBpmnSeniorButton extends EdgelessToolbarToolMixin(
56
57
  --y: -10px;
57
58
  --s: 1.07;
58
59
  }
59
- `;
60
-
61
- override enableActiveBackground = true;
62
-
63
- override type = EmptyTool;
64
-
65
- private _toggleMenu() {
66
- if (this.popper) {
67
- this.popper.dispose();
68
- this.popper = null;
69
- return;
70
- }
71
- this.setEdgelessTool(DefaultTool);
72
- const menu = this.createPopper('edgeless-bpmn-menu', this);
73
- menu.element.edgeless = this.edgeless;
74
-
75
- const el = menu.element as HTMLElement;
76
- const wrap = el.parentElement;
77
- if (wrap) {
78
- wrap.style.overflow = 'visible';
79
- wrap.style.justifyContent = 'flex-end';
80
- }
81
- Object.assign(el.style, {
82
- position: 'static',
83
- width: 'max-content',
84
- maxWidth: 'calc(100vw - 16px)',
85
- marginLeft: '0',
86
- });
87
- }
88
-
89
- override render() {
90
- return html`<edgeless-toolbar-button
60
+ `; }
61
+ _toggleMenu() {
62
+ if (this.popper) {
63
+ this.popper.dispose();
64
+ this.popper = null;
65
+ return;
66
+ }
67
+ this.setEdgelessTool(DefaultTool);
68
+ const menu = this.createPopper('edgeless-bpmn-menu', this);
69
+ menu.element.edgeless = this.edgeless;
70
+ const el = menu.element;
71
+ const wrap = el.parentElement;
72
+ if (wrap) {
73
+ wrap.style.overflow = 'visible';
74
+ wrap.style.justifyContent = 'flex-end';
75
+ }
76
+ Object.assign(el.style, {
77
+ position: 'static',
78
+ width: 'max-content',
79
+ maxWidth: 'calc(100vw - 16px)',
80
+ marginLeft: '0',
81
+ });
82
+ }
83
+ render() {
84
+ return html `<edgeless-toolbar-button
91
85
  class="bpmn-button"
92
86
  .tooltip=${this.popper ? '' : 'BPMN'}
93
87
  .tooltipOffset=${4}
@@ -97,6 +91,6 @@ export class EdgelessBpmnSeniorButton extends EdgelessToolbarToolMixin(
97
91
  <div class="bpmn-root">
98
92
  <div class="bpmn-card">${bpmnToolbarIcon}</div>
99
93
  </div>
100
- </edgeless-toolbar-button>`;
101
- }
102
- }
94
+ </edgeless-toolbar-button>`;
95
+ }
96
+ }
@@ -0,0 +1,13 @@
1
+ import { type ToolbarContext } from '@formicoidea/labre-core/shared/services';
2
+ import { type TemplateResult } from 'lit';
3
+ export declare const bpmnPoolToolbarConfig: {
4
+ readonly actions: [{
5
+ id: string;
6
+ tooltip: string;
7
+ icon: TemplateResult;
8
+ active(ctx: ToolbarContext): boolean;
9
+ run(ctx: ToolbarContext): void;
10
+ }];
11
+ readonly when: (ctx: ToolbarContext) => boolean;
12
+ };
13
+ export declare const bpmnPoolToolbarExtension: import("@formicoidea/labre-core/store").ExtensionType;
@@ -0,0 +1,54 @@
1
+ import { EdgelessCRUDIdentifier } from '@formicoidea/labre-core/blocks/surface';
2
+ import { BpmnPoolElementModel } from '@formicoidea/labre-core/model';
3
+ import { ToolbarModuleExtension, } from '@formicoidea/labre-core/shared/services';
4
+ import { BlockFlavourIdentifier } from '@formicoidea/labre-core/std';
5
+ import { html } from 'lit';
6
+ const ResizeIcon = html `<svg
7
+ width="24"
8
+ height="24"
9
+ viewBox="0 0 24 24"
10
+ fill="none"
11
+ stroke="currentColor"
12
+ stroke-width="1.6"
13
+ stroke-linecap="round"
14
+ stroke-linejoin="round"
15
+ >
16
+ <path d="M9 5H5v4M15 19h4v-4" />
17
+ <path d="M5 5l6 6M19 19l-6-6" />
18
+ </svg>`;
19
+ /**
20
+ * Build a toolbar toggle that flips a boolean flag on every selected pool:
21
+ * `active` reflects the current state, `run` flips it (with an undo checkpoint).
22
+ */
23
+ function booleanToggle(id, tooltip, icon, prop) {
24
+ return {
25
+ id,
26
+ tooltip,
27
+ icon,
28
+ active(ctx) {
29
+ const models = ctx.getSurfaceModelsByType(BpmnPoolElementModel);
30
+ return models.length > 0 && models.every(model => model[prop]);
31
+ },
32
+ run(ctx) {
33
+ const models = ctx.getSurfaceModelsByType(BpmnPoolElementModel);
34
+ if (!models.length)
35
+ return;
36
+ const enable = !models.every(model => model[prop]);
37
+ ctx.std.store.captureSync();
38
+ const crud = ctx.std.get(EdgelessCRUDIdentifier);
39
+ for (const model of models) {
40
+ crud.updateElement(model.id, { [prop]: enable });
41
+ }
42
+ },
43
+ };
44
+ }
45
+ export const bpmnPoolToolbarConfig = {
46
+ actions: [
47
+ booleanToggle('a.toggle-resize', 'Enable / lock resizing', ResizeIcon, 'resizeEnabled'),
48
+ ],
49
+ when: ctx => ctx.getSurfaceModelsByType(BpmnPoolElementModel).length > 0,
50
+ };
51
+ export const bpmnPoolToolbarExtension = ToolbarModuleExtension({
52
+ id: BlockFlavourIdentifier('affine:surface:bpmnPool'),
53
+ config: bpmnPoolToolbarConfig,
54
+ });
@@ -0,0 +1,15 @@
1
+ /** Colored BPMN glyph for the main toolbar button: a pool (green name band) with
2
+ * a single activity inside. */
3
+ export declare const bpmnToolbarIcon: import("lit-html").TemplateResult<2>;
4
+ /** Start event — thin green ring. */
5
+ export declare const bpmnStartIcon: import("lit-html").TemplateResult<2>;
6
+ /** End event — thick red ring. */
7
+ export declare const bpmnEndIcon: import("lit-html").TemplateResult<2>;
8
+ /** Task — rounded rectangle. */
9
+ export declare const bpmnTaskIcon: import("lit-html").TemplateResult<2>;
10
+ /** Exclusive gateway — diamond with an X. */
11
+ export declare const bpmnGatewayIcon: import("lit-html").TemplateResult<2>;
12
+ /** Sequence flow — solid arrow with a filled head. */
13
+ export declare const bpmnSequenceIcon: import("lit-html").TemplateResult<2>;
14
+ /** Pool — rectangle with a left name band. */
15
+ export declare const bpmnPoolIcon: import("lit-html").TemplateResult<2>;
@@ -1,43 +1,36 @@
1
- import { svg } from 'lit';
2
-
3
- /** Colored BPMN glyph for the main toolbar button: a pool (green name band) with
4
- * a single activity inside. */
5
- export const bpmnToolbarIcon = svg`<svg width="100%" height="100%" viewBox="0 0 56 56" fill="none" xmlns="http://www.w3.org/2000/svg">
1
+ import { svg } from 'lit';
2
+ /** Colored BPMN glyph for the main toolbar button: a pool (green name band) with
3
+ * a single activity inside. */
4
+ export const bpmnToolbarIcon = svg `<svg width="100%" height="100%" viewBox="0 0 56 56" fill="none" xmlns="http://www.w3.org/2000/svg">
6
5
  <rect x="4" y="13" width="48" height="30" rx="3" fill="#ffffff" stroke="#262626" stroke-width="2.2"/>
7
6
  <path d="M6 14 h5 v28 h-5 z" fill="#43a06b"/>
8
7
  <line x1="11" y1="13" x2="11" y2="43" stroke="#262626" stroke-width="1.8"/>
9
8
  <rect x="20" y="20" width="24" height="16" rx="3.5" fill="#ffffff" stroke="#262626" stroke-width="2.2"/>
10
- </svg>`;
11
-
12
- /** Start event thin green ring. */
13
- export const bpmnStartIcon = svg`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
9
+ </svg>`;
10
+ /** Start event — thin green ring. */
11
+ export const bpmnStartIcon = svg `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
14
12
  <circle cx="12" cy="12" r="8" stroke="#43a06b" stroke-width="2"/>
15
- </svg>`;
16
-
17
- /** End event thick red ring. */
18
- export const bpmnEndIcon = svg`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
13
+ </svg>`;
14
+ /** End event — thick red ring. */
15
+ export const bpmnEndIcon = svg `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
19
16
  <circle cx="12" cy="12" r="8" stroke="#cf5648" stroke-width="3.5"/>
20
- </svg>`;
21
-
22
- /** Task rounded rectangle. */
23
- export const bpmnTaskIcon = svg`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
17
+ </svg>`;
18
+ /** Task — rounded rectangle. */
19
+ export const bpmnTaskIcon = svg `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
24
20
  <rect x="3.5" y="6.5" width="17" height="11" rx="2.5" stroke="currentColor" stroke-width="1.6"/>
25
- </svg>`;
26
-
27
- /** Exclusive gateway diamond with an X. */
28
- export const bpmnGatewayIcon = svg`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
21
+ </svg>`;
22
+ /** Exclusive gateway — diamond with an X. */
23
+ export const bpmnGatewayIcon = svg `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
29
24
  <path d="M12 3 L21 12 L12 21 L3 12 Z" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round"/>
30
25
  <path d="M9 9 L15 15 M15 9 L9 15" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/>
31
- </svg>`;
32
-
33
- /** Sequence flow solid arrow with a filled head. */
34
- export const bpmnSequenceIcon = svg`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
26
+ </svg>`;
27
+ /** Sequence flow — solid arrow with a filled head. */
28
+ export const bpmnSequenceIcon = svg `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
35
29
  <path d="M3 12 H17" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
36
30
  <path d="M15 8 L21 12 L15 16 Z" fill="currentColor"/>
37
- </svg>`;
38
-
39
- /** Pool rectangle with a left name band. */
40
- export const bpmnPoolIcon = svg`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
31
+ </svg>`;
32
+ /** Pool — rectangle with a left name band. */
33
+ export const bpmnPoolIcon = svg `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
41
34
  <rect x="3.5" y="5.5" width="17" height="13" rx="1.5" stroke="currentColor" stroke-width="1.6"/>
42
35
  <path d="M8 5.5 V18.5" stroke="currentColor" stroke-width="1.6"/>
43
- </svg>`;
36
+ </svg>`;
@@ -0,0 +1 @@
1
+ export declare const bpmnSeniorTool: import("@formicoidea/labre-core/store").ExtensionType;
@@ -1,11 +1,10 @@
1
- import { SeniorToolExtension } from '@formicoidea/labre-core/widgets/edgeless-toolbar';
2
- import { html } from 'lit';
3
-
4
- export const bpmnSeniorTool = SeniorToolExtension('bpmn', ({ block }) => {
5
- return {
6
- name: 'BPMN',
7
- content: html`<edgeless-bpmn-senior-button
1
+ import { SeniorToolExtension } from '@formicoidea/labre-core/widgets/edgeless-toolbar';
2
+ import { html } from 'lit';
3
+ export const bpmnSeniorTool = SeniorToolExtension('bpmn', ({ block }) => {
4
+ return {
5
+ name: 'BPMN',
6
+ content: html `<edgeless-bpmn-senior-button
8
7
  .edgeless=${block}
9
- ></edgeless-bpmn-senior-button>`,
10
- };
11
- });
8
+ ></edgeless-bpmn-senior-button>`,
9
+ };
10
+ });
package/dist/view.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { type ViewExtensionContext, ViewExtensionProvider } from '@formicoidea/labre-core/ext-loader';
2
+ export declare class BpmnViewExtension extends ViewExtensionProvider {
3
+ name: string;
4
+ effect(): void;
5
+ setup(context: ViewExtensionContext): void;
6
+ }
package/dist/view.js ADDED
@@ -0,0 +1,33 @@
1
+ import { ViewExtensionProvider, } from '@formicoidea/labre-core/ext-loader';
2
+ import { extendTemplateCategory } from '@formicoidea/labre-core/gfx/template';
3
+ import { effects } from './effects';
4
+ import { bpmnTemplateCategory } from './templates';
5
+ import { BpmnPoolRendererExtension } from './element-renderer';
6
+ import { BpmnPoolInteraction, BpmnPoolView } from './element-view';
7
+ import { BpmnNodeRendererExtension } from './node/node-renderer';
8
+ import { BpmnNodeView } from './node/node-view';
9
+ import { bpmnPoolToolbarExtension } from './toolbar/config';
10
+ import { bpmnSeniorTool } from './toolbar/senior-tool';
11
+ export class BpmnViewExtension extends ViewExtensionProvider {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.name = 'affine-bpmn-gfx';
15
+ }
16
+ effect() {
17
+ super.effect();
18
+ effects();
19
+ extendTemplateCategory(bpmnTemplateCategory);
20
+ }
21
+ setup(context) {
22
+ super.setup(context);
23
+ context.register(BpmnPoolView);
24
+ context.register(BpmnPoolRendererExtension);
25
+ context.register(BpmnNodeView);
26
+ context.register(BpmnNodeRendererExtension);
27
+ if (this.isEdgeless(context.scope)) {
28
+ context.register(BpmnPoolInteraction);
29
+ context.register(bpmnSeniorTool);
30
+ context.register(bpmnPoolToolbarExtension);
31
+ }
32
+ }
33
+ }
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.23.2",
4
+ "version": "0.24.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "author": "lajola",
@@ -10,15 +10,24 @@
10
10
  ],
11
11
  "license": "MPL-2.0",
12
12
  "exports": {
13
- ".": "./src/index.ts",
14
- "./view": "./src/view.ts",
15
- "./descriptor": "./src/descriptor.ts"
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.js"
16
+ },
17
+ "./view": {
18
+ "types": "./dist/view.d.ts",
19
+ "import": "./dist/view.js"
20
+ },
21
+ "./descriptor": {
22
+ "types": "./dist/descriptor.d.ts",
23
+ "import": "./dist/descriptor.js"
24
+ }
16
25
  },
17
26
  "files": [
18
- "src"
27
+ "dist"
19
28
  ],
20
29
  "dependencies": {
21
- "@formicoidea/labre-core": "0.23.2",
30
+ "@formicoidea/labre-core": "0.24.0",
22
31
  "lit": "^3.2.0"
23
32
  }
24
33
  }
package/src/effects.ts DELETED
@@ -1,14 +0,0 @@
1
- import { EdgelessBpmnMenu } from './toolbar/bpmn-menu';
2
- import { EdgelessBpmnSeniorButton } from './toolbar/bpmn-senior-button';
3
-
4
- export function effects() {
5
- customElements.define('edgeless-bpmn-menu', EdgelessBpmnMenu);
6
- customElements.define('edgeless-bpmn-senior-button', EdgelessBpmnSeniorButton);
7
- }
8
-
9
- declare global {
10
- interface HTMLElementTagNameMap {
11
- 'edgeless-bpmn-menu': EdgelessBpmnMenu;
12
- 'edgeless-bpmn-senior-button': EdgelessBpmnSeniorButton;
13
- }
14
- }