@bpmn-nova/react 0.3.4-preview → 0.3.6-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/llms.txt CHANGED
@@ -67,6 +67,8 @@ Use `engine="flowable"` or `engine="activiti"` explicitly from the host workflow
67
67
 
68
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.
69
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/src/api/index.md#节点-di-与视觉尺寸) and the customization section in the co-located `llms-full.txt`; `node-geometry` is internal, not another installable package.
71
+
70
72
  ## 4. Mount a minimal integration
71
73
 
72
74
  Every branch must import its own public `styles.css` exactly once and provide a height through the complete parent layout chain.
@@ -82,6 +84,10 @@ import '@bpmn-nova/vue/styles.css'
82
84
  const props = defineProps({ initialXml: String })
83
85
  const emit = defineEmits(['change'])
84
86
  const studioRef = ref(null)
87
+ const config = {
88
+ modeling: { allowedEdgeTypes: ['sequenceFlow'] },
89
+ ui: { controlSize: 'medium' },
90
+ }
85
91
 
86
92
  function handleChange(model, reason, xml) {
87
93
  emit('change', xml)
@@ -94,8 +100,8 @@ function handleChange(model, reason, xml) {
94
100
  ref="studioRef"
95
101
  :xml="props.initialXml"
96
102
  engine="flowable"
103
+ :config="config"
97
104
  mode="design"
98
- :allowed-edge-types="['sequenceFlow']"
99
105
  :allowed-modes="['design', 'viewer']"
100
106
  theme="auto"
101
107
  @change="handleChange"
@@ -111,6 +117,11 @@ import { useRef } from 'react'
111
117
  import { BpmnStudio } from '@bpmn-nova/react'
112
118
  import '@bpmn-nova/react/styles.css'
113
119
 
120
+ const STUDIO_CONFIG = {
121
+ modeling: { allowedEdgeTypes: ['sequenceFlow'] },
122
+ ui: { controlSize: 'medium' },
123
+ }
124
+
114
125
  export function WorkflowEditor({ initialXml, saveDraft }) {
115
126
  const studioRef = useRef(null)
116
127
  return (
@@ -119,8 +130,8 @@ export function WorkflowEditor({ initialXml, saveDraft }) {
119
130
  ref={studioRef}
120
131
  xml={initialXml}
121
132
  engine="flowable"
133
+ config={STUDIO_CONFIG}
122
134
  mode="design"
123
- allowedEdgeTypes={['sequenceFlow']}
124
135
  allowedModes={['design', 'viewer']}
125
136
  theme="auto"
126
137
  onChange={(model, reason, xml) => saveDraft(xml)}
@@ -140,13 +151,19 @@ import {
140
151
  } from '@bpmn-nova/studio'
141
152
  import '@bpmn-nova/studio/styles.css'
142
153
 
154
+ const config = {
155
+ modeling: { allowedEdgeTypes: ['sequenceFlow'] },
156
+ ui: { controlSize: 'medium' },
157
+ }
158
+
143
159
  const studio = createStudioController({
144
160
  model: createEmptyProcess('flowable'),
145
- allowedEdgeTypes: ['sequenceFlow'],
161
+ config,
146
162
  })
147
163
  const shell = createStudioShell({
148
164
  container: document.querySelector('#workflow-studio'),
149
165
  studio,
166
+ config,
150
167
  mode: 'design',
151
168
  allowedModes: ['design', 'viewer'],
152
169
  theme: 'auto',
@@ -169,18 +186,16 @@ This step is complete when the workbench is visible, the initial XML is rendered
169
186
 
170
187
  ### 4.1 Embed the complete Studio in an existing business workbench
171
188
 
172
- `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:
173
190
 
174
191
  ```vue
175
192
  <BpmnStudio
176
193
  ref="studioRef"
177
194
  :xml="xml"
178
195
  engine="activiti"
196
+ :config="studioConfig"
179
197
  mode="design"
180
198
  :allowed-modes="['design']"
181
- :allowed-node-types="supportedNodeTypes"
182
- :allowed-edge-types="['sequenceFlow']"
183
- :regions="{ right: 'hidden' }"
184
199
  theme="auto"
185
200
  @change="handleChange"
186
201
  @selection-change="handleSelectionChange"
@@ -188,23 +203,43 @@ This step is complete when the workbench is visible, the initial XML is rendered
188
203
  <template #header-start="{ state, actions }">
189
204
  <!-- Host back action, business icon, process name, and type -->
190
205
  </template>
191
- <template #header-actions="{ actions, mode }">
206
+ <template #header-actions="{ actions, mode, ui }">
192
207
  <!-- Host Validate / Save / Publish actions. Validation calls actions.validate(). -->
193
208
  </template>
194
209
  </BpmnStudio>
195
210
  ```
196
211
 
197
- - 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.
198
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()`.
199
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.
200
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.
201
216
  - The default Header does not duplicate Fit; use the footer control or `fitView()`.
202
- - `regions` can hide `header`, `left`, `right`, or `footer` without leaving an empty layout track. Prop changes update the existing Shell; do not rebuild the Canvas.
203
- - Put a host-owned properties panel beside the Nova root. Use `selection-change` / `onSelectionChange` as its source of truth because it covers nodes, edges, multi-selection, clearing, and keyboard selection. Do not substitute `element-click` / `onElementClick`.
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.
204
219
  - Join host business configuration by stable BPMN element ID. Saving, publishing, authorization, upload, and server transactions remain host responsibilities.
205
220
  - `theme="auto"` explicitly follows the system theme. The compatibility default remains `light`.
206
221
  - Vue and React both export standalone `BpmnPalettePanel` for a fully custom layout. Pass the same external Studio Controller to Canvas, Palette, and Properties.
207
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/src/customization/index.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
+
208
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.
209
244
 
210
245
  ## 5. Keep model ownership deterministic
@@ -219,12 +254,16 @@ This step is complete when edit, undo, redo, save, reload, and intentional exter
219
254
 
220
255
  ## 6. Add host constraints before business use
221
256
 
222
- 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.
223
258
 
224
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.
225
260
 
226
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.
227
262
 
263
+ For approval-trace integration, read the complete `SOURCE: docs/src/guide/runtime.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
+
228
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.
229
268
 
230
269
  ## 7. Verify the integration
@@ -238,13 +277,23 @@ Run the target application's existing non-destructive quality commands, includin
238
277
  5. Intentional external XML replacement loads once and resets history once.
239
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.
240
279
  7. Theme changes update the existing instance.
241
- 8. Unmount/remount leaves no duplicate listeners, overlays, or framework instances.
242
- 9. Browser Console has no errors.
243
- 10. 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.
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.
244
285
 
245
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.
246
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
+
247
292
  ## Reference
248
293
 
249
294
  - `README.md`: human-facing product overview and quick start.
295
+ - `docs/src/`: authoritative public documentation for VitePress; maintain detailed integration instructions here.
296
+ - `docs/src/examples/`: example guides with code imported from `examples/website/`; these shared snippets are expanded in `llms-full.txt`.
250
297
  - `llms-full.txt`: complete generated AI context containing setup, component, Interface, customization, publishing, and architecture documentation.
298
+ - `docs/src/guide/runtime.md`: authoritative approval-trace guide in the source repository; the full content also ships inside every public package's `llms-full.txt`.
299
+ - `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.4-preview",
3
+ "version": "0.3.6-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.4-preview"
45
+ "@bpmn-nova/studio": "0.3.6-preview"
46
46
  },
47
47
  "engines": {
48
48
  "node": ">=18"