@bpmn-nova/react 0.3.3-preview → 0.3.5-preview
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/README.md +73 -6
- package/dist/index.d.ts +78 -0
- package/dist/index.js +48 -3
- package/dist/styles.css +72 -12
- package/llms-full.txt +1614 -93
- package/llms.txt +76 -15
- package/package.json +2 -2
package/llms.txt
CHANGED
|
@@ -36,6 +36,20 @@ yarn add @bpmn-nova/vue@preview
|
|
|
36
36
|
|
|
37
37
|
Replace `vue` with `react` or `studio` only when the selected framework branch requires it. Run one installation command, not all three.
|
|
38
38
|
|
|
39
|
+
In TypeScript host code, import shared BPMN model types from that same selected public package. Vue and React explicitly re-export `BpmnEdge`, `BpmnNode`, `EdgeType`, `ElementSelection`, `EngineId`, `LayoutOptions`, `NodeType`, and `ProcessModel`; do not add a direct Studio dependency only to obtain these types:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import type {
|
|
43
|
+
BpmnNode,
|
|
44
|
+
EdgeType,
|
|
45
|
+
ElementSelection,
|
|
46
|
+
NodeType,
|
|
47
|
+
ProcessModel,
|
|
48
|
+
} from '@bpmn-nova/vue'
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Use `@bpmn-nova/react` instead in a React application.
|
|
52
|
+
|
|
39
53
|
This step is complete when the application manifest contains exactly the selected direct BPMN Nova dependency and the package manager finishes without peer-dependency errors.
|
|
40
54
|
|
|
41
55
|
## 3. Select the visual Interface
|
|
@@ -53,6 +67,8 @@ Use `engine="flowable"` or `engine="activiti"` explicitly from the host workflow
|
|
|
53
67
|
|
|
54
68
|
Studio modes are presentation state: `design` means editable process design, `viewer` means read-only process viewing, and `instance` means approval trace. Observe the actual Shell state through `subscribeMode()` or framework mode events; never store it in the BPMN model.
|
|
55
69
|
|
|
70
|
+
Node geometry is also presentation, not DI normalization. Loading server XML via the component parses its BPMN DI Bounds; XML export already writes model dimensions. The `0.3.5-preview` gateway/data fix scales standard shells to fit those bounds and docks display endpoints without rewriting model geometry or waypoints. Do not resize stored nodes, recreate them, or patch internal CSS to compensate. See [Node DI and visual geometry](docs/API.md#节点-di-与视觉尺寸) and the customization section in the co-located `llms-full.txt`; `node-geometry` is internal, not another installable package.
|
|
71
|
+
|
|
56
72
|
## 4. Mount a minimal integration
|
|
57
73
|
|
|
58
74
|
Every branch must import its own public `styles.css` exactly once and provide a height through the complete parent layout chain.
|
|
@@ -68,6 +84,10 @@ import '@bpmn-nova/vue/styles.css'
|
|
|
68
84
|
const props = defineProps({ initialXml: String })
|
|
69
85
|
const emit = defineEmits(['change'])
|
|
70
86
|
const studioRef = ref(null)
|
|
87
|
+
const config = {
|
|
88
|
+
modeling: { allowedEdgeTypes: ['sequenceFlow'] },
|
|
89
|
+
ui: { controlSize: 'medium' },
|
|
90
|
+
}
|
|
71
91
|
|
|
72
92
|
function handleChange(model, reason, xml) {
|
|
73
93
|
emit('change', xml)
|
|
@@ -80,8 +100,8 @@ function handleChange(model, reason, xml) {
|
|
|
80
100
|
ref="studioRef"
|
|
81
101
|
:xml="props.initialXml"
|
|
82
102
|
engine="flowable"
|
|
103
|
+
:config="config"
|
|
83
104
|
mode="design"
|
|
84
|
-
:allowed-edge-types="['sequenceFlow']"
|
|
85
105
|
:allowed-modes="['design', 'viewer']"
|
|
86
106
|
theme="auto"
|
|
87
107
|
@change="handleChange"
|
|
@@ -97,6 +117,11 @@ import { useRef } from 'react'
|
|
|
97
117
|
import { BpmnStudio } from '@bpmn-nova/react'
|
|
98
118
|
import '@bpmn-nova/react/styles.css'
|
|
99
119
|
|
|
120
|
+
const STUDIO_CONFIG = {
|
|
121
|
+
modeling: { allowedEdgeTypes: ['sequenceFlow'] },
|
|
122
|
+
ui: { controlSize: 'medium' },
|
|
123
|
+
}
|
|
124
|
+
|
|
100
125
|
export function WorkflowEditor({ initialXml, saveDraft }) {
|
|
101
126
|
const studioRef = useRef(null)
|
|
102
127
|
return (
|
|
@@ -105,8 +130,8 @@ export function WorkflowEditor({ initialXml, saveDraft }) {
|
|
|
105
130
|
ref={studioRef}
|
|
106
131
|
xml={initialXml}
|
|
107
132
|
engine="flowable"
|
|
133
|
+
config={STUDIO_CONFIG}
|
|
108
134
|
mode="design"
|
|
109
|
-
allowedEdgeTypes={['sequenceFlow']}
|
|
110
135
|
allowedModes={['design', 'viewer']}
|
|
111
136
|
theme="auto"
|
|
112
137
|
onChange={(model, reason, xml) => saveDraft(xml)}
|
|
@@ -126,13 +151,19 @@ import {
|
|
|
126
151
|
} from '@bpmn-nova/studio'
|
|
127
152
|
import '@bpmn-nova/studio/styles.css'
|
|
128
153
|
|
|
154
|
+
const config = {
|
|
155
|
+
modeling: { allowedEdgeTypes: ['sequenceFlow'] },
|
|
156
|
+
ui: { controlSize: 'medium' },
|
|
157
|
+
}
|
|
158
|
+
|
|
129
159
|
const studio = createStudioController({
|
|
130
160
|
model: createEmptyProcess('flowable'),
|
|
131
|
-
|
|
161
|
+
config,
|
|
132
162
|
})
|
|
133
163
|
const shell = createStudioShell({
|
|
134
164
|
container: document.querySelector('#workflow-studio'),
|
|
135
165
|
studio,
|
|
166
|
+
config,
|
|
136
167
|
mode: 'design',
|
|
137
168
|
allowedModes: ['design', 'viewer'],
|
|
138
169
|
theme: 'auto',
|
|
@@ -155,18 +186,16 @@ This step is complete when the workbench is visible, the initial XML is rendered
|
|
|
155
186
|
|
|
156
187
|
### 4.1 Embed the complete Studio in an existing business workbench
|
|
157
188
|
|
|
158
|
-
`BpmnStudio` is a complete Header + Palette + Canvas + Properties + Statusbar workbench by default. Preserve that default unless the host already owns a region. To keep the Nova Palette and editing tools, replace only the Header start area and explicitly hide Nova Properties:
|
|
189
|
+
`BpmnStudio` is a complete Header + Palette + Canvas + Properties + Statusbar workbench by default. Preserve that default unless the host already owns a region. Define a stable `studioConfig` object in host code. To keep the Nova Palette and editing tools, replace only the Header start area and explicitly hide Nova Properties:
|
|
159
190
|
|
|
160
191
|
```vue
|
|
161
192
|
<BpmnStudio
|
|
162
193
|
ref="studioRef"
|
|
163
194
|
:xml="xml"
|
|
164
195
|
engine="activiti"
|
|
196
|
+
:config="studioConfig"
|
|
165
197
|
mode="design"
|
|
166
198
|
:allowed-modes="['design']"
|
|
167
|
-
:allowed-node-types="supportedNodeTypes"
|
|
168
|
-
:allowed-edge-types="['sequenceFlow']"
|
|
169
|
-
:regions="{ right: 'hidden' }"
|
|
170
199
|
theme="auto"
|
|
171
200
|
@change="handleChange"
|
|
172
201
|
@selection-change="handleSelectionChange"
|
|
@@ -174,23 +203,43 @@ This step is complete when the workbench is visible, the initial XML is rendered
|
|
|
174
203
|
<template #header-start="{ state, actions }">
|
|
175
204
|
<!-- Host back action, business icon, process name, and type -->
|
|
176
205
|
</template>
|
|
177
|
-
<template #header-actions="{ actions, mode }">
|
|
206
|
+
<template #header-actions="{ actions, mode, ui }">
|
|
178
207
|
<!-- Host Validate / Save / Publish actions. Validation calls actions.validate(). -->
|
|
179
208
|
</template>
|
|
180
209
|
</BpmnStudio>
|
|
181
210
|
```
|
|
182
211
|
|
|
183
|
-
- Vue uses native `#header-start` / `#header-actions` / `#header` slots. React uses `headerStart` / `headerActions` / `header` render props. Core uses matching DOM Slots.
|
|
212
|
+
- Vue uses native `#header-start` / `#header-actions` / `#header` / `#right` slots. React uses `headerStart` / `headerActions` / `header` / `right` render props. Core uses matching DOM Slots. Native Right support starts in `0.3.5-preview`; inspect the installed declarations before using it.
|
|
184
213
|
- Vue supports `v-model:mode` and `mode-change`; React supports `mode` and `onModeChange`. Framework Header contexts expose the actual reactive `mode`. Core Slots use `getMode()` / `subscribeMode()`.
|
|
185
214
|
- Header Start replaces only the Nova Brand. Header Actions replaces only the default Validate / Import / Export group, so a host can compose Validate / Save / Publish without rebuilding the editing tools. A complete Header replacement calls the public Actions Interface.
|
|
186
215
|
- `actions.validate()` updates Nova's default status summary before emitting a read-only validation result with `source: 'toolbar'`; `shell.validate()` and framework Handle/Expose methods use `source: 'api'`. Vue receives `validation`, React receives `onValidation`, and Core uses `subscribeValidation()`. `valid` means there are no errors; warnings do not block publishing by default.
|
|
187
216
|
- The default Header does not duplicate Fit; use the footer control or `fitView()`.
|
|
188
|
-
- `regions` can hide `header`, `left`, `right`, or `footer` without leaving an empty layout track.
|
|
189
|
-
-
|
|
217
|
+
- `config.ui.regions` can hide `header`, `left`, `right`, or `footer` without leaving an empty layout track. Config changes update the existing Shell; do not rebuild the Canvas.
|
|
218
|
+
- A host panel can replace right content inside Nova, or live beside the Nova root after explicitly hiding the whole region. For an external design panel use `selection-change` / `onSelectionChange`, covering nodes, edges, multi-selection, clearing, and keyboard selection. Do not substitute `element-click` / `onElementClick`. Use the new `panelSelection` context for selection across read-only modes.
|
|
190
219
|
- Join host business configuration by stable BPMN element ID. Saving, publishing, authorization, upload, and server transactions remain host responsibilities.
|
|
191
220
|
- `theme="auto"` explicitly follows the system theme. The compatibility default remains `light`.
|
|
192
221
|
- Vue and React both export standalone `BpmnPalettePanel` for a fully custom layout. Pass the same external Studio Controller to Canvas, Palette, and Properties.
|
|
193
222
|
|
|
223
|
+
Group static Studio options under `config`: modeling constraints in `config.modeling`, Header layout in `config.ui`, Viewer display defaults in `config.viewer`, and SVG defaults in `config.export`. Keep model/XML, mode/allowedModes/runtime/projection/theme, resolvers, renderers, registries, callbacks, and Slots at the top level. Deprecated top-level configuration aliases remain compatible and explicitly win when the same item is supplied in both places.
|
|
224
|
+
|
|
225
|
+
`config.ui.controlSize` defaults to `medium` (32px). `small`, `medium`, and `large` map to 28px, 32px, and 40px; Element Plus `default` and Ant Design `middle` both map to Nova `medium`. A host-specific value must be a strict `24px`–`48px` string such as `36px`; numbers, other units, CSS expressions, and out-of-range values are invalid. Header contexts expose read-only `ui.controlSize` and `ui.controlHeight`, while custom actions inherit `--nova-control-height`, `--nova-header-height`, `--nova-control-font-size`, `--nova-control-padding-inline`, `--nova-control-icon-size`, and `--nova-control-radius`. These sizes never change footer zoom, canvas floating controls, Palette, or Properties.
|
|
226
|
+
|
|
227
|
+
Core Shell and framework handles expose `getConfig()` and `setConfig()`. The setter validates first and updates UI, Viewer, and Export in place without changing Model, XML, History, Selection, Mode, or Viewport. Modeling allowlists are Controller creation invariants; use the existing `setPropertiesProfile()` only for a runtime Profile change.
|
|
228
|
+
|
|
229
|
+
### 4.2 Sidebar layout and collapse (0.3.5-preview)
|
|
230
|
+
|
|
231
|
+
Read `SOURCE: docs/CUSTOMIZATION.md`, section `侧栏布局与平滑折叠`, in the co-located `llms-full.txt` before integrating the sidebar interfaces introduced in `0.3.5-preview`. They are not available in the older `0.3.4-preview` package. The host must still provide a computable container height.
|
|
232
|
+
|
|
233
|
+
- Configure `config.ui.leftPanel/rightPanel.collapsible` (default `true`) and `defaultCollapsed` (wide-layout initialization only, default `false`). `config.ui.rightPanel.layout` defaults to `flex`: Nova supplies a bounded column, the host arranges fixed regions and a `flex: 1; min-height: 0; overflow: auto` body. Use `scroll` for Nova-owned scrolling of the entire content; avoid nested scroll containers unless intentional.
|
|
234
|
+
- Core `slots.right`, Vue `#right`, and React `right` replace only content. Native slots preserve the host application tree and win over same-name Core DOM slots. Do not create another framework root or patch Nova classes. Header/Right contexts share `state`, `mode`, `ui`, and `panelSelection`, plus `studio`, `shell`, and `actions`.
|
|
235
|
+
- Design shows both panels by default; Viewer only the right; Instance hides both. An omitted right region uses mode defaults; explicit `regions.right: 'default'` opts into Instance, while `'hidden'` removes the panel and its toggle. A slot never overrides hidden. Preserve this distinction when reading/updating Config.
|
|
236
|
+
- Collapsed retains an edge toggle; hidden does not. Sidebars animate independently for 200ms and respect reduced motion. The first entry into a Shell container at or below 720px starts collapsible panels collapsed, with separate wide/narrow state memory. Expansion pushes the canvas, never opens a drawer. Content/form/scroll state survives; no automatic Fit occurs. Automatic Viewer projection responds once to the final size.
|
|
237
|
+
- Use `getSidebarState()`, `setSidebarCollapsed(side, collapsed)`, and `subscribeSidebarChange()`. The setter returns `true` only for actual changes; unavailable/redundant requests return `false`. Vue emits `sidebar-change`; React uses `onSidebarChange`. The read-only event contains `side`, `collapsed`, `previousCollapsed`, `mode`, and `source: button | api | responsive | config`.
|
|
238
|
+
- `panelSelection` contains `selection`, `selectedElement`, and `trace`. Core reads/subscribes with `getPanelSelection()` / `subscribePanelSelection()`. Design follows Controller selection; read-only clicks do not rewrite design selection. Do not substitute `state.selection` for the current approval-trace context. Hiding the sidebar does not disable trace clicks, details, or assets.
|
|
239
|
+
- These policies belong to the default Shell, not a complete custom `layout()` or standalone Designer/Viewer. Sidebar UI state must never enter BPMN XML, Model, or History.
|
|
240
|
+
|
|
241
|
+
### 4.3 Definition-time subtitle presentation
|
|
242
|
+
|
|
194
243
|
For a host-owned definition-time subtitle, pass `nodeSubtitleResolver` to Studio, Canvas, or Viewer. Return `undefined` for Nova's default subtitle, `null` to remove the row, or a string (including an empty string) as the override. After data inside a stable closure or Map changes, call `refreshPresentation()` on the component handle or Shell. This refresh must not be implemented by mutating a node, re-importing XML, or remounting the component. The resolver applies only to standard Design/Viewer task and container cards and standard SVG fallback; a complete custom renderer wins, and Instance runtime summaries are never overridden.
|
|
195
244
|
|
|
196
245
|
## 5. Keep model ownership deterministic
|
|
@@ -205,12 +254,16 @@ This step is complete when edit, undo, redo, save, reload, and intentional exter
|
|
|
205
254
|
|
|
206
255
|
## 6. Add host constraints before business use
|
|
207
256
|
|
|
208
|
-
Production workflow applications usually support a subset of BPMN. Configure `allowedNodeTypes` and `allowedEdgeTypes` on the Studio Controller or framework `BpmnStudio`; these reject unsupported imported models and block node/edge creation outside the host contract. The node allowlist filters Palette entries, but one allowed node type may still have multiple Palette presets. Configure matching Palette and Properties registries when the host needs custom labels or business fields.
|
|
257
|
+
Production workflow applications usually support a subset of BPMN. Configure `config.modeling.allowedNodeTypes` and `config.modeling.allowedEdgeTypes` on the Studio Controller or framework `BpmnStudio`; these reject unsupported imported models and block node/edge creation outside the host contract. The node allowlist filters Palette entries, but one allowed node type may still have multiple Palette presets. Configure matching Palette and Properties registries when the host needs custom labels or business fields.
|
|
209
258
|
|
|
210
259
|
Use `allowedModes` to expose only host-authorized workbench modes. Runtime changes use `setAllowedModes()` rather than rebuilding the Studio; invalid, empty, or duplicate lists are errors. Pass real Runtime data for instance mode; absence of Runtime data means no approval trace rather than demo business data.
|
|
211
260
|
|
|
212
261
|
Runtime snapshots store asset references only. The host supplies `runtimeAssetResolver`. BPMN Nova does not execute workflow engines, submit approvals, upload/store attachments, issue permissions, or export PNG/PDF.
|
|
213
262
|
|
|
263
|
+
For approval-trace integration, read the complete `SOURCE: docs/RUNTIME-INTEGRATION.md` section in the co-located `llms-full.txt` before mapping backend records. It covers instance-bound XML, stable work-item/visit identities, Flowable/Activiti mapping limits, complete approval scenarios, request cancellation, and assets. Runtime data stays top-level; only Studio display configuration belongs in `config.viewer`. Finish this branch only after the guide's relevant integration checks pass; report missing history instead of inventing facts.
|
|
264
|
+
|
|
265
|
+
Named Runtime type re-exports from the Vue/React facade start in `0.3.5-preview`. Check the installed declarations before using them; the guide gives a Props-based type fallback for older releases. Keep the one-direct-package rule rather than adding Studio for these types.
|
|
266
|
+
|
|
214
267
|
Read `llms-full.txt` before implementing custom Shell regions, Header composition, Actions, Palette, Properties, Context Menu, Renderer, Runtime, theme, or SVG export behavior. Use only public exports from the one selected package or supported Studio subpaths. `llms-full.txt` is generated by the Nova repository and must not be edited by hand.
|
|
215
268
|
|
|
216
269
|
## 7. Verify the integration
|
|
@@ -224,13 +277,21 @@ Run the target application's existing non-destructive quality commands, includin
|
|
|
224
277
|
5. Intentional external XML replacement loads once and resets history once.
|
|
225
278
|
6. Disallowed node types are unavailable and rejected by import/creation commands; disallowed modes are not rendered and `setMode()` returns `false` without changing state.
|
|
226
279
|
7. Theme changes update the existing instance.
|
|
227
|
-
8.
|
|
228
|
-
9.
|
|
229
|
-
10.
|
|
280
|
+
8. Default `medium`, presets, and a custom value such as `36px` resize only Header controls; invalid `config.ui.controlSize` leaves the previous DOM and configuration intact.
|
|
281
|
+
9. Unmount/remount leaves no duplicate listeners, overlays, or framework instances.
|
|
282
|
+
10. Browser Console has no errors.
|
|
283
|
+
11. If a subtitle resolver is used, verify override, `undefined`, `null`, SVG parity, and that `refreshPresentation()` preserves XML, history, selection, scope, zoom, pan, theme, and mode. Verify Instance summaries are unchanged.
|
|
284
|
+
12. If sidebars are used, verify independent collapse, narrow containers, reduced motion, keyboard focus, host form/scroll preservation, Flex/Scroll behavior, native slot updates, Instance defaults, and selection/event consistency. Keep XML, history, and viewport invariant during ordinary collapse; record automatic projection changes separately.
|
|
230
285
|
|
|
231
286
|
The installation is complete only when the package is present, the production build succeeds, and the relevant browser checks pass. Report any unverified branch explicitly.
|
|
232
287
|
|
|
288
|
+
## Maintainer release policy
|
|
289
|
+
|
|
290
|
+
Before changing Nova package versions, publishing, or recovering a partial release, read the complete `SOURCE: docs/NPM-PACKAGES.md` section in the co-located `llms-full.txt` (or that file in the source repository). It defines mandatory lockstep versions and full releases of all three public packages, including unchanged packages, plus Registry completion checks. This is a maintainer rule, not an instruction for host applications to install all three packages or authorization to publish without a user request.
|
|
291
|
+
|
|
233
292
|
## Reference
|
|
234
293
|
|
|
235
294
|
- `README.md`: human-facing product overview and quick start.
|
|
236
295
|
- `llms-full.txt`: complete generated AI context containing setup, component, Interface, customization, publishing, and architecture documentation.
|
|
296
|
+
- `docs/RUNTIME-INTEGRATION.md`: authoritative approval-trace guide in the source repository; the full content also ships inside every public package's `llms-full.txt`.
|
|
297
|
+
- `docs/NPM-PACKAGES.md`: authoritative global version and full-release policy, including partial-release recovery.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bpmn-nova/react",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5-preview",
|
|
4
4
|
"description": "React components and hooks for BPMN Nova Designer, Viewer, Studio and Properties.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bpmn",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"react-dom": ">=18"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@bpmn-nova/studio": "0.3.
|
|
45
|
+
"@bpmn-nova/studio": "0.3.5-preview"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|
|
48
48
|
"node": ">=18"
|