@bpmn-nova/react 0.3.1-preview → 0.3.2-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 ADDED
@@ -0,0 +1,225 @@
1
+ # BPMN Nova integration runbook
2
+
3
+ > BPMN Nova is a framework-neutral BPMN 2.0 design, viewing, approval-trace, theme, and pure SVG export toolkit for Flowable and Activiti applications. The current release is Preview.
4
+
5
+ Use this file as the executable starting point for installing BPMN Nova. Complete the steps in order. Read the co-located `llms-full.txt` only when the selected branch needs advanced customization or complete Interface reference.
6
+
7
+ ## 1. Resolve the target application
8
+
9
+ Before installing or editing code:
10
+
11
+ 1. Locate the target application's `package.json`, source entry, and build configuration.
12
+ 2. In a monorepo, select the concrete Web application instead of the workspace root.
13
+ 3. Determine whether that application uses Vue, React, or another browser JavaScript/TypeScript stack.
14
+ 4. Determine its existing package manager from `packageManager` and lockfiles. Preserve that package manager.
15
+ 5. Inspect the application lifecycle and layout so the visual component is mounted only in the browser and receives a computable height.
16
+
17
+ This step is complete only when one application root, one framework branch, and one package manager are unambiguous. If any is ambiguous, stop before installing and ask the user to identify the target application and framework. Missing framework evidence is not evidence of a Vanilla application.
18
+
19
+ ## 2. Select exactly one public package
20
+
21
+ | Target application | Public package | Minimum host version |
22
+ | --- | --- | --- |
23
+ | Vue or Nuxt | `@bpmn-nova/vue` | Vue 3.3 |
24
+ | React, Next.js, or Remix | `@bpmn-nova/react` | React 18 |
25
+ | Another confirmed browser JavaScript/TypeScript stack | `@bpmn-nova/studio` | Node 18 for installation/build |
26
+
27
+ Preserve an already installed public package when it matches the target stack. Do not install historical internal packages such as Core, Designer, Viewer, Runtime, Theme, Export SVG, Properties, or engine profiles. Studio exposes supported `/designer`, `/viewer`, `/runtime`, `/theme`, `/export-svg`, `/flowable`, and `/activiti` subpaths.
28
+
29
+ Install with the application's existing package manager:
30
+
31
+ ```bash
32
+ npm install @bpmn-nova/vue@preview
33
+ pnpm add @bpmn-nova/vue@preview
34
+ yarn add @bpmn-nova/vue@preview
35
+ ```
36
+
37
+ Replace `vue` with `react` or `studio` only when the selected framework branch requires it. Run one installation command, not all three.
38
+
39
+ 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
+
41
+ ## 3. Select the visual Interface
42
+
43
+ Choose the smallest Interface that owns the required experience:
44
+
45
+ | Requirement | Interface |
46
+ | --- | --- |
47
+ | Complete workbench with Palette, Canvas, Properties, history, import/export, and optional viewing modes | `BpmnStudio` or `createStudioShell()` |
48
+ | Embeddable design canvas without the complete workbench | `BpmnDesigner` |
49
+ | Read-only BPMN, approval path, or mobile timeline | `BpmnViewer` |
50
+ | Custom host layout with official Controller, Canvas, Palette, and Properties modules | external Studio Controller plus adapter components/registries |
51
+
52
+ Use `engine="flowable"` or `engine="activiti"` explicitly from the host workflow engine. Do not infer the engine from BPMN XML namespace declarations alone.
53
+
54
+ ## 4. Mount a minimal integration
55
+
56
+ Every branch must import its own public `styles.css` exactly once and provide a height through the complete parent layout chain.
57
+
58
+ ### Vue
59
+
60
+ ```vue
61
+ <script setup>
62
+ import { ref } from 'vue'
63
+ import { BpmnStudio } from '@bpmn-nova/vue'
64
+ import '@bpmn-nova/vue/styles.css'
65
+
66
+ const props = defineProps({ initialXml: String })
67
+ const emit = defineEmits(['change'])
68
+ const studioRef = ref(null)
69
+
70
+ function handleChange(model, reason, xml) {
71
+ emit('change', xml)
72
+ }
73
+ </script>
74
+
75
+ <template>
76
+ <div style="height: min(760px, calc(100vh - 96px)); min-height: 520px">
77
+ <BpmnStudio
78
+ ref="studioRef"
79
+ :xml="props.initialXml"
80
+ engine="flowable"
81
+ mode="design"
82
+ :allowed-edge-types="['sequenceFlow']"
83
+ :allowed-modes="['design']"
84
+ theme="auto"
85
+ @change="handleChange"
86
+ />
87
+ </div>
88
+ </template>
89
+ ```
90
+
91
+ ### React
92
+
93
+ ```jsx
94
+ import { useRef } from 'react'
95
+ import { BpmnStudio } from '@bpmn-nova/react'
96
+ import '@bpmn-nova/react/styles.css'
97
+
98
+ export function WorkflowEditor({ initialXml, saveDraft }) {
99
+ const studioRef = useRef(null)
100
+ return (
101
+ <div style={{ height: 'min(760px, calc(100vh - 96px))', minHeight: 520 }}>
102
+ <BpmnStudio
103
+ ref={studioRef}
104
+ xml={initialXml}
105
+ engine="flowable"
106
+ mode="design"
107
+ allowedEdgeTypes={['sequenceFlow']}
108
+ allowedModes={['design']}
109
+ theme="auto"
110
+ onChange={(model, reason, xml) => saveDraft(xml)}
111
+ />
112
+ </div>
113
+ )
114
+ }
115
+ ```
116
+
117
+ ### Vanilla JavaScript/TypeScript
118
+
119
+ ```js
120
+ import {
121
+ createEmptyProcess,
122
+ createStudioController,
123
+ createStudioShell,
124
+ } from '@bpmn-nova/studio'
125
+ import '@bpmn-nova/studio/styles.css'
126
+
127
+ const studio = createStudioController({
128
+ model: createEmptyProcess('flowable'),
129
+ allowedEdgeTypes: ['sequenceFlow'],
130
+ })
131
+ const shell = createStudioShell({
132
+ container: document.querySelector('#workflow-studio'),
133
+ studio,
134
+ mode: 'design',
135
+ allowedModes: ['design'],
136
+ theme: 'auto',
137
+ })
138
+
139
+ const unsubscribe = studio.subscribe((event) => {
140
+ if (event.type === 'modelChanged') saveDraft(studio.exportXml())
141
+ })
142
+
143
+ export function disposeWorkflowStudio() {
144
+ unsubscribe()
145
+ shell.destroy()
146
+ studio.destroy()
147
+ }
148
+ ```
149
+
150
+ The Vanilla container needs the same explicit height as the framework examples.
151
+
152
+ This step is complete when the workbench is visible, the initial XML is rendered, and one edit produces a non-empty exported XML value.
153
+
154
+ ### 4.1 Embed the complete Studio in an existing business workbench
155
+
156
+ `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:
157
+
158
+ ```vue
159
+ <BpmnStudio
160
+ ref="studioRef"
161
+ :xml="xml"
162
+ engine="activiti"
163
+ mode="design"
164
+ :allowed-modes="['design']"
165
+ :allowed-node-types="supportedNodeTypes"
166
+ :allowed-edge-types="['sequenceFlow']"
167
+ :regions="{ right: 'hidden' }"
168
+ theme="auto"
169
+ @change="handleChange"
170
+ @selection-change="handleSelectionChange"
171
+ >
172
+ <template #header-start="{ state, actions }">
173
+ <!-- Host back action, business icon, process name, and type -->
174
+ </template>
175
+ </BpmnStudio>
176
+ ```
177
+
178
+ - Vue uses native `#header-start` / `#header` slots. React uses `headerStart` / `header` render props. Core uses `slots.headerStart` / `slots.header`.
179
+ - Header Start replaces only the Nova Brand. A complete Header replacement calls the public Actions Interface for undo, redo, layout, fit, validation, BPMN import/export, and SVG export.
180
+ - `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.
181
+ - 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`.
182
+ - Join host business configuration by stable BPMN element ID. Saving, publishing, authorization, upload, and server transactions remain host responsibilities.
183
+ - `theme="auto"` explicitly follows the system theme. The compatibility default remains `light`.
184
+ - Vue and React both export standalone `BpmnPalettePanel` for a fully custom layout. Pass the same external Studio Controller to Canvas, Palette, and Properties.
185
+
186
+ ## 5. Keep model ownership deterministic
187
+
188
+ - Treat `xml` and `model` as external replacement inputs. Use the emitted/exported XML as the draft output.
189
+ - A local edit followed by the host echoing the same exported XML must not re-import the model or clear Undo/Redo history.
190
+ - Replace `xml` when the host intentionally loads another server revision or another process.
191
+ - For a custom host layout, create one external Studio Controller and pass the same instance to Canvas, Palette, and Properties. The creator owns that Controller and destroys it.
192
+ - Use stable BPMN element IDs as the join key for host business configuration. BPMN Nova does not own the host's persistence transaction.
193
+
194
+ This step is complete when edit, undo, redo, save, reload, and intentional external XML replacement all produce the expected model without duplicate remounts.
195
+
196
+ ## 6. Add host constraints before business use
197
+
198
+ 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. Configure matching Palette and Properties registries when the host needs custom labels or business fields.
199
+
200
+ Use `allowedModes` to expose only host-authorized workbench modes. Pass real Runtime data for instance mode; absence of Runtime data means no approval trace rather than demo business data.
201
+
202
+ 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.
203
+
204
+ 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.
205
+
206
+ ## 7. Verify the integration
207
+
208
+ Run the target application's existing non-destructive quality commands, including its type check and production build. Then verify in a real browser:
209
+
210
+ 1. The component fills its intended container and has complete styles.
211
+ 2. Existing BPMN XML imports without losing IDs, names, topology, or DI positions.
212
+ 3. Create, connect, edit, delete, Undo, and Redo work in design mode.
213
+ 4. Change output is persisted and reloads to the same process.
214
+ 5. Intentional external XML replacement loads once and resets history once.
215
+ 6. Disallowed node types are unavailable and rejected by import/creation commands; disallowed modes are not rendered and `setMode()` leaves the current mode unchanged.
216
+ 7. Theme changes update the existing instance.
217
+ 8. Unmount/remount leaves no duplicate listeners, overlays, or framework instances.
218
+ 9. Browser Console has no errors.
219
+
220
+ 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.
221
+
222
+ ## Reference
223
+
224
+ - `README.md`: human-facing product overview and quick start.
225
+ - `llms-full.txt`: complete generated AI context containing setup, component, Interface, customization, publishing, and architecture documentation.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpmn-nova/react",
3
- "version": "0.3.1-preview",
3
+ "version": "0.3.2-preview",
4
4
  "description": "React components and hooks for BPMN Nova Designer, Viewer, Studio and Properties.",
5
5
  "keywords": [
6
6
  "bpmn",
@@ -26,13 +26,15 @@
26
26
  "files": [
27
27
  "dist",
28
28
  "README.md",
29
+ "llms.txt",
30
+ "llms-full.txt",
29
31
  "LICENSE"
30
32
  ],
31
33
  "sideEffects": [
32
34
  "./dist/styles.css"
33
35
  ],
34
36
  "scripts": {
35
- "prepack": "node ../../scripts/build-packages.mjs --package react",
37
+ "prepack": "node ../../scripts/check-public-package-versions.mjs && node ../../scripts/build-ai-docs.mjs --check && node ../../scripts/build-packages.mjs --package react",
36
38
  "prepublishOnly": "node ../../scripts/guard-preview-publish.mjs"
37
39
  },
38
40
  "peerDependencies": {
@@ -40,7 +42,7 @@
40
42
  "react-dom": ">=18"
41
43
  },
42
44
  "dependencies": {
43
- "@bpmn-nova/studio": "0.3.1-preview"
45
+ "@bpmn-nova/studio": "0.3.2-preview"
44
46
  },
45
47
  "engines": {
46
48
  "node": ">=18"