@bpmn-nova/studio 0.3.0-preview → 0.3.1-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.
Files changed (61) hide show
  1. package/README.md +202 -19
  2. package/dist/canvas.js +5 -3
  3. package/dist/context-menu.js +1 -1
  4. package/dist/controller.js +2 -2
  5. package/dist/index.d.ts +76 -35
  6. package/dist/index.js +12 -11
  7. package/dist/interactions.js +1 -1
  8. package/dist/modules/bpmn-model/index.d.ts +11 -0
  9. package/dist/modules/bpmn-model/index.js +703 -0
  10. package/dist/modules/core/containment.js +590 -0
  11. package/dist/modules/core/gateway.js +72 -0
  12. package/dist/modules/core/history.js +32 -0
  13. package/dist/modules/core/index.d.ts +268 -0
  14. package/dist/modules/core/index.js +7 -0
  15. package/dist/modules/core/layout.js +644 -0
  16. package/dist/modules/core/model.js +287 -0
  17. package/dist/modules/core/runtime-transition-route.js +360 -0
  18. package/dist/modules/core/scope.js +99 -0
  19. package/dist/modules/designer/index.d.ts +79 -0
  20. package/dist/modules/designer/index.js +607 -0
  21. package/dist/modules/engine-activiti/index.d.ts +19 -0
  22. package/dist/modules/engine-activiti/index.js +160 -0
  23. package/dist/modules/engine-flowable/index.d.ts +19 -0
  24. package/dist/modules/engine-flowable/index.js +160 -0
  25. package/dist/modules/export-svg/index.d.ts +112 -0
  26. package/dist/modules/export-svg/index.js +2 -0
  27. package/dist/modules/export-svg/preview.js +327 -0
  28. package/dist/modules/export-svg/render.js +718 -0
  29. package/dist/modules/icons/index.d.ts +24 -0
  30. package/dist/modules/icons/index.js +264 -0
  31. package/dist/modules/palette/index.d.ts +62 -0
  32. package/dist/modules/palette/index.js +99 -0
  33. package/dist/modules/palette/panel.js +99 -0
  34. package/dist/modules/properties/index.d.ts +20 -0
  35. package/dist/modules/properties/index.js +19 -0
  36. package/dist/modules/properties-activiti/index.d.ts +3 -0
  37. package/dist/modules/properties-activiti/index.js +97 -0
  38. package/dist/modules/properties-bpmn/index.d.ts +3 -0
  39. package/dist/modules/properties-bpmn/index.js +516 -0
  40. package/dist/modules/properties-core/index.d.ts +124 -0
  41. package/dist/modules/properties-core/index.js +312 -0
  42. package/dist/modules/properties-flowable/index.d.ts +3 -0
  43. package/dist/modules/properties-flowable/index.js +114 -0
  44. package/dist/modules/properties-renderer/index.d.ts +25 -0
  45. package/dist/modules/properties-renderer/index.js +491 -0
  46. package/dist/modules/renderer-svg/index.d.ts +117 -0
  47. package/dist/modules/renderer-svg/index.js +1460 -0
  48. package/dist/modules/runtime/index.d.ts +169 -0
  49. package/dist/modules/runtime/index.js +535 -0
  50. package/dist/modules/theme/index.d.ts +95 -0
  51. package/dist/modules/theme/index.js +368 -0
  52. package/dist/modules/viewer/index.d.ts +265 -0
  53. package/dist/modules/viewer/index.js +1011 -0
  54. package/dist/modules/viewer/runtime-content.js +123 -0
  55. package/dist/modules/viewer/runtime-details-motion.js +228 -0
  56. package/dist/modules/viewer/runtime-trace.js +574 -0
  57. package/dist/modules/viewer/timeline.js +276 -0
  58. package/dist/selection-layout.js +1 -1
  59. package/dist/shell.js +82 -9
  60. package/dist/styles.css +108 -7
  61. package/package.json +36 -15
package/README.md CHANGED
@@ -1,26 +1,39 @@
1
1
  # @bpmn-nova/studio
2
2
 
3
- BPMN Nova 的推荐聚合入口,组合流程设计器、只读 Viewer、审批轨迹、Palette、Properties 和主题。
3
+ BPMN Nova Vanilla JavaScript / TypeScript 完整入口,提供流程设计、只读展示、审批轨迹、主题、属性面板和纯 SVG 导出。
4
4
 
5
- > **English summary:** The recommended aggregate package for BPMN Nova Designer, Viewer, runtime visualization, Palette and Properties.
5
+ > **English summary:** The complete framework-neutral BPMN Nova package for process design, viewing, approval traces, themes, properties, and pure SVG export.
6
6
 
7
- > 当前版本为 `0.3.0-preview`。API BPMN round-trip 能力仍在稳定中,请固定 Preview 版本或使用 `preview` dist-tag。
7
+ > 当前版本为 `0.3.1-preview`。请使用 `@preview` 安装,并在生产接入前验证目标 BPMN XML 与引擎扩展。
8
+
9
+ ![BPMN Nova 流程设计器](https://raw.githubusercontent.com/daxiangme/bpmn-nova/dev/docs/assets/bpmn-nova-designer.jpg)
10
+
11
+ ## 什么时候使用
12
+
13
+ - Vanilla JavaScript 或 TypeScript 项目安装本包。
14
+ - React 18+ 项目安装 `@bpmn-nova/react`。
15
+ - Vue 3.3+ 项目安装 `@bpmn-nova/vue`。
16
+ - 一个项目只需要选择一个公开包,不需要安装 Core、Viewer、Runtime、Theme 等内部 Module。
8
17
 
9
18
  ## 安装
10
19
 
11
20
  ```bash
12
- npm install @bpmn-nova/studio
21
+ npm install @bpmn-nova/studio@preview
13
22
  ```
14
23
 
15
24
  ```js
16
25
  import '@bpmn-nova/studio/styles.css'
17
26
  ```
18
27
 
19
- JavaScript 不会隐式注入 CSS;只导入当前视觉包的样式入口。
28
+ BPMN Nova 不会在 JavaScript 中隐式注入 CSS。视觉容器必须有明确高度。
20
29
 
21
- ## 最小用法
30
+ ## 流程设计
22
31
 
23
- ```jsx
32
+ ```html
33
+ <div id="studio" style="height: 720px"></div>
34
+ ```
35
+
36
+ ```js
24
37
  import {
25
38
  createEmptyProcess,
26
39
  createStudioController,
@@ -29,31 +42,201 @@ import {
29
42
  import '@bpmn-nova/studio/styles.css'
30
43
 
31
44
  const model = createEmptyProcess('flowable')
45
+ model.id = 'Process_PurchaseApproval'
46
+ model.name = '采购申请审批流程'
47
+
32
48
  const studio = createStudioController({ model })
33
- const shell = createStudioShell({ container, studio, theme: 'auto' })
49
+ const shell = createStudioShell({
50
+ container: document.querySelector('#studio'),
51
+ studio,
52
+ theme: 'auto',
53
+ })
34
54
 
35
55
  const xml = studio.exportXml()
56
+
57
+ // 页面卸载时释放实例。
36
58
  shell.destroy()
37
59
  studio.destroy()
38
60
  ```
39
61
 
40
- ## 主要接口
62
+ ## 只读 Viewer
63
+
64
+ ```js
65
+ import { importBpmn } from '@bpmn-nova/studio'
66
+ import { BpmnViewer } from '@bpmn-nova/studio/viewer'
67
+ import '@bpmn-nova/studio/styles.css'
68
+
69
+ const viewer = new BpmnViewer({
70
+ container: document.querySelector('#viewer'),
71
+ model: importBpmn(xml, 'flowable'),
72
+ projection: 'standard',
73
+ theme: 'auto',
74
+ })
75
+
76
+ viewer.fitView()
77
+ viewer.destroy()
78
+ ```
79
+
80
+ 也可以从 `@bpmn-nova/studio` 根入口导入所有公开 Interface;子路径用于明确表达接入场景。
81
+
82
+ ![BPMN Nova 只读流程展示](https://raw.githubusercontent.com/daxiangme/bpmn-nova/dev/docs/assets/bpmn-nova-viewer.jpg)
83
+
84
+ ## 审批轨迹
85
+
86
+ Viewer 接收引擎中立的 Runtime Snapshot。三种投影使用相同数据:
87
+
88
+ | 投影 | 配置 | 适用场景 |
89
+ | --- | --- | --- |
90
+ | 实际路径 | `projection: 'approval'` | 只展示实际发生的有效路径 |
91
+ | 移动时间线 | `projection: 'compact'` | 按访问轮次展示动作、图片和附件 |
92
+ | 完整 BPMN | `projection: 'standard'` + `runtime` | 完整结构叠加运行状态 |
93
+
94
+ ```js
95
+ const runtime = {
96
+ processInstanceId: 'purchase-20260824',
97
+ status: 'running',
98
+ activities: [{
99
+ id: 'activity-manager-1',
100
+ elementId: 'UserTask_Manager',
101
+ visitId: 'visit-manager-1',
102
+ status: 'completed',
103
+ assignee: '李经理',
104
+ endTime: '2026-08-24T10:12:00+08:00',
105
+ }],
106
+ actions: [{
107
+ id: 'action-manager-approve',
108
+ type: 'approve',
109
+ elementId: 'UserTask_Manager',
110
+ visitId: 'visit-manager-1',
111
+ activityId: 'activity-manager-1',
112
+ actor: { id: 'manager-li', name: '李经理' },
113
+ occurredAt: '2026-08-24T10:12:00+08:00',
114
+ content: {
115
+ plainText: '资料完整,同意提交总经理审批。',
116
+ blocks: [
117
+ { type: 'paragraph', text: '资料完整,同意提交总经理审批。' },
118
+ { type: 'image', assetId: 'quotation-preview' },
119
+ { type: 'file', assetId: 'purchase-checklist' },
120
+ ],
121
+ assets: [
122
+ {
123
+ id: 'quotation-preview',
124
+ name: '现场报价单.png',
125
+ mediaType: 'image/png',
126
+ width: 1280,
127
+ height: 720,
128
+ },
129
+ {
130
+ id: 'purchase-checklist',
131
+ name: '采购核验清单.txt',
132
+ mediaType: 'text/plain',
133
+ size: 248,
134
+ },
135
+ ],
136
+ },
137
+ }],
138
+ visitedEdges: [],
139
+ }
140
+
141
+ const runtimeAssetResolver = async (asset, { purpose, signal }) => {
142
+ const response = await fetch(
143
+ `/api/runtime-assets/${encodeURIComponent(asset.id)}?purpose=${purpose}`,
144
+ { signal },
145
+ )
146
+ if (!response.ok) return null
147
+ return response.url
148
+ }
149
+
150
+ viewer.setRuntime(runtime)
151
+ viewer.setProjection('compact')
152
+ viewer.setDisplayOptions({ runtimeAssetResolver })
153
+ ```
41
154
 
42
- - `createStudioController / BpmnStudioController`
43
- - `createStudioShell / BpmnStudioShell`
44
- - `BpmnCanvas 与 InteractionController`
45
- - `ContextMenu、Template、Palette、Properties Registries`
46
- - `Studio 聚合导出的 Core、XML、Runtime、Theme、Designer 与 Viewer API`
155
+ Snapshot 只保存资源引用,不保存 URL、Base64、Blob 或 HTML。上传、权限签发和资源存储由宿主业务系统负责。
47
156
 
48
- 参数、默认值、事件和实例方法以随包发布的 TypeScript 声明为准。
157
+ | 实际路径 | 移动时间线 |
158
+ | --- | --- |
159
+ | ![审批实际路径](https://raw.githubusercontent.com/daxiangme/bpmn-nova/dev/docs/assets/bpmn-nova-approval-effective-path.jpg) | ![移动审批时间线](https://raw.githubusercontent.com/daxiangme/bpmn-nova/dev/docs/assets/bpmn-nova-approval-mobile-timeline.jpg) |
49
160
 
50
- ## 文档
161
+ ![完整 BPMN 审批轨迹](https://raw.githubusercontent.com/daxiangme/bpmn-nova/dev/docs/assets/bpmn-nova-approval-full-bpmn.jpg)
51
162
 
163
+ ## 主题与运行态配色
164
+
165
+ ```js
166
+ shell.setTheme({
167
+ mode: 'auto',
168
+ dark: {
169
+ colors: {
170
+ canvas: '#0b1018',
171
+ surface: '#18202b',
172
+ },
173
+ },
174
+ })
175
+
176
+ shell.setRuntimeAppearance({
177
+ statuses: { completed: 'success', active: 'primary' },
178
+ actions: {
179
+ approve: { label: '通过', tone: 'success' },
180
+ reject: { label: '驳回', tone: 'danger' },
181
+ },
182
+ })
183
+ ```
184
+
185
+ 主题限定在实例根节点;`auto` 会跟随并监听浏览器系统主题变化,不修改宿主页面的 `<html>`。
186
+
187
+ ![BPMN Nova 深色运行态](https://raw.githubusercontent.com/daxiangme/bpmn-nova/dev/docs/assets/bpmn-nova-dark-runtime.jpg)
188
+
189
+ ## SVG 导出
190
+
191
+ ```js
192
+ // 打开确认预览,用户确认后下载。
193
+ shell.openSvgExportPreview({
194
+ theme: 'current',
195
+ transparentBackground: false,
196
+ filename: '采购申请审批流程.svg',
197
+ })
198
+
199
+ // 或只创建 Artifact,不触发下载。
200
+ const artifact = await shell.exportSvg({ theme: 'dark' })
201
+ console.log(artifact.svg, artifact.warnings)
202
+ ```
203
+
204
+ 导出完整业务内容,不受当前缩放、平移或滚动影响。图片会通过 Resolver 嵌入 SVG,普通附件只展示摘要。
205
+
206
+ ![SVG 导出确认预览](https://raw.githubusercontent.com/daxiangme/bpmn-nova/dev/docs/assets/bpmn-nova-svg-export-preview.jpg)
207
+
208
+ ## 支持的子路径
209
+
210
+ ```js
211
+ import { BpmnDesigner } from '@bpmn-nova/studio/designer'
212
+ import { BpmnViewer } from '@bpmn-nova/studio/viewer'
213
+ import { createRuntimePresentation } from '@bpmn-nova/studio/runtime'
214
+ import { createThemeController } from '@bpmn-nova/studio/theme'
215
+ import { exportDiagramSvg } from '@bpmn-nova/studio/export-svg'
216
+ import { flowableProfile } from '@bpmn-nova/studio/flowable'
217
+ import { activitiProfile } from '@bpmn-nova/studio/activiti'
218
+ ```
219
+
220
+ ## 常见问题
221
+
222
+ - **界面为空或高度为 0:** 为 Studio/Viewer 的父容器设置明确高度。
223
+ - **界面没有样式:** 导入一次 `@bpmn-nova/studio/styles.css`。
224
+ - **附件不可用:** 提供 `runtimeAssetResolver`,并为不同 purpose 返回当前有效地址。
225
+ - **SSR 报错:** 在浏览器挂载阶段创建实例,服务端只准备 XML 和 Runtime 数据。
226
+ - **重复安装:** 不直接安装任何未列出的 `@bpmn-nova/*` 内部 Module。
227
+
228
+ ## 文档与 AI
229
+
230
+ - [项目首页](https://github.com/daxiangme/bpmn-nova)
52
231
  - [快速开始](https://github.com/daxiangme/bpmn-nova/blob/dev/docs/GETTING-STARTED.md)
53
- - [组件参数](https://github.com/daxiangme/bpmn-nova/blob/dev/docs/COMPONENTS.md)
54
- - [API](https://github.com/daxiangme/bpmn-nova/blob/dev/docs/API.md)
232
+ - [公开 Interface](https://github.com/daxiangme/bpmn-nova/blob/dev/docs/API.md)
55
233
  - [自定义指南](https://github.com/daxiangme/bpmn-nova/blob/dev/docs/CUSTOMIZATION.md)
56
- - [Properties Panel](https://github.com/daxiangme/bpmn-nova/blob/dev/docs/PROPERTIES-PANEL.md)
234
+ - [AI 接入入口](https://raw.githubusercontent.com/daxiangme/bpmn-nova/dev/llms.txt)
235
+ - [AI 完整上下文](https://raw.githubusercontent.com/daxiangme/bpmn-nova/dev/llms-full.txt)
236
+
237
+ ## 能力边界
238
+
239
+ BPMN Nova 负责建模、展示、审批轨迹、主题和 SVG 导出;不负责流程引擎执行、审批提交、附件上传存储、权限签发或 PNG/PDF 导出。当前 Preview 不声明 BPMN Schema 100% 覆盖。
57
240
 
58
241
  ## License
59
242
 
package/dist/canvas.js CHANGED
@@ -8,9 +8,9 @@ import {
8
8
  NODE_DEFINITIONS,
9
9
  resolveContainment,
10
10
  snapNodePosition,
11
- } from '@bpmn-nova/core';
12
- import { DiagramRenderer } from '@bpmn-nova/renderer';
13
- import { hydrateIcons } from '@bpmn-nova/icons';
11
+ } from './modules/core/index.js';
12
+ import { DiagramRenderer } from './modules/renderer-svg/index.js';
13
+ import { hydrateIcons } from './modules/icons/index.js';
14
14
  import { canCreateSequenceFlow } from './controller.js';
15
15
  import { createDefaultContextMenuRegistry } from './context-menu.js';
16
16
  import { CREATE_INTENT_MIME } from './interactions.js';
@@ -904,6 +904,8 @@ export class BpmnCanvas {
904
904
  startConnect(nodeId) { this.renderer.closeTransientOverlays?.(); return this.studio.startConnect(nodeId); }
905
905
  editEdgeName(edgeId) { return this.renderer.editEdgeName?.(edgeId) || false; }
906
906
  fitView(padding, options) { this.renderer.fitView(padding, { minZoom: 0.7, ...(options || {}) }); }
907
+ exportSvg(options) { return this.renderer.exportSvg(options); }
908
+ openSvgExportPreview(options) { return this.renderer.openSvgExportPreview(options); }
907
909
  fitSelection(padding = 72) {
908
910
  const bounds = this.studio.getSelectionBounds();
909
911
  if (!bounds) return false;
@@ -3,7 +3,7 @@ import {
3
3
  getEdge,
4
4
  getNode,
5
5
  isEmbeddedSubProcess,
6
- } from '@bpmn-nova/core';
6
+ } from './modules/core/index.js';
7
7
  import { selectedDiagramNodes, selectedGroupableNodes, selectedLayoutNodes } from './selection-layout.js';
8
8
 
9
9
  function insert(actions, action) {
@@ -24,8 +24,8 @@ import {
24
24
  resolveSwimlaneLabelPlacement,
25
25
  scopeExists,
26
26
  validateParallelGateway,
27
- } from '@bpmn-nova/core';
28
- import { exportBpmn, importBpmn } from '@bpmn-nova/bpmn-model';
27
+ } from './modules/core/index.js';
28
+ import { exportBpmn, importBpmn } from './modules/bpmn-model/index.js';
29
29
  import {
30
30
  applySelectionArrangement,
31
31
  mergeSelectionRefs,
package/dist/index.d.ts CHANGED
@@ -1,14 +1,15 @@
1
- export * from '@bpmn-nova/core'
2
- export * from '@bpmn-nova/bpmn-model'
3
- export * from '@bpmn-nova/runtime'
4
- export * from '@bpmn-nova/theme'
5
- export * from '@bpmn-nova/designer'
6
- export * from '@bpmn-nova/viewer'
7
- export * from '@bpmn-nova/flowable'
8
- export * from '@bpmn-nova/activiti'
9
- export * from '@bpmn-nova/properties'
10
- export * from '@bpmn-nova/icons'
11
- export * from '@bpmn-nova/palette'
1
+ export * from './modules/core/index.js'
2
+ export * from './modules/bpmn-model/index.js'
3
+ export * from './modules/runtime/index.js'
4
+ export * from './modules/theme/index.js'
5
+ export * from './modules/export-svg/index.js'
6
+ export * from './modules/designer/index.js'
7
+ export * from './modules/viewer/index.js'
8
+ export * from './modules/engine-flowable/index.js'
9
+ export * from './modules/engine-activiti/index.js'
10
+ export * from './modules/properties/index.js'
11
+ export * from './modules/icons/index.js'
12
+ export * from './modules/palette/index.js'
12
13
 
13
14
  import type {
14
15
  BpmnEdge,
@@ -20,20 +21,21 @@ import type {
20
21
  Point,
21
22
  ProcessModel,
22
23
  SelectionRect,
23
- } from '@bpmn-nova/core'
24
- import type { IconRegistry } from '@bpmn-nova/icons'
25
- import type { PaletteRegistry } from '@bpmn-nova/palette'
26
- import type { PropertiesRegistry } from '@bpmn-nova/properties'
27
- import type { DiagramNodeRenderer, DiagramRendererOptions } from '@bpmn-nova/renderer'
24
+ } from './modules/core/index.js'
25
+ import type { IconRegistry } from './modules/icons/index.js'
26
+ import type { PaletteRegistry } from './modules/palette/index.js'
27
+ import type { PropertiesRegistry } from './modules/properties/index.js'
28
+ import type { DiagramNodeRenderer, DiagramRendererOptions } from './modules/renderer-svg/index.js'
29
+ import type { RuntimeTimelineSvgRenderer, SvgExportArtifact, SvgExportOptions, SvgExportPreviewController, SvgNodeRenderer } from './modules/export-svg/index.js'
28
30
  import type {
29
31
  ActivityInstance as RuntimeActivityInstance,
30
32
  ProcessInstanceSnapshot as RuntimeProcessInstanceSnapshot,
31
- } from '@bpmn-nova/runtime'
32
- import type { NovaThemeInput, NovaThemeMode, NovaThemeState, RuntimeAppearanceOptions, RuntimeAppearanceResolver } from '@bpmn-nova/theme'
33
+ } from './modules/runtime/index.js'
34
+ import type { NovaThemeInput, NovaThemeMode, NovaThemeState, RuntimeAppearanceOptions, RuntimeAppearanceResolver } from './modules/theme/index.js'
33
35
  import type {
34
36
  RuntimeDetailsRenderer,
35
37
  RuntimeTransitionDetailsRenderer,
36
- } from '@bpmn-nova/viewer'
38
+ } from './modules/viewer/index.js'
37
39
 
38
40
  // Aggregate compatibility surface. Studio re-exports the package-level types,
39
41
  // and keeps these frequently consumed declarations visible at its own entry.
@@ -84,12 +86,12 @@ export interface RuntimeTransitionRoute {
84
86
  anchorStrategy: 'outer-same-side' | 'flow-axis-fallback'
85
87
  portConflicts: number
86
88
  }
87
- export function routeRuntimeTransition(model: ProcessModel, transition: import('@bpmn-nova/runtime').RuntimeTransition, options?: RuntimeTransitionRouteOptions): RuntimeTransitionRoute | null
89
+ export function routeRuntimeTransition(model: ProcessModel, transition: import('./modules/runtime/index.js').RuntimeTransition, options?: RuntimeTransitionRouteOptions): RuntimeTransitionRoute | null
88
90
 
89
- export type RuntimeParticipant = import('@bpmn-nova/runtime').RuntimeParticipant
90
- export type RuntimeTransition = import('@bpmn-nova/runtime').RuntimeTransition
91
- export type NodeRuntimePresentation = import('@bpmn-nova/runtime').NodeRuntimePresentation
92
- export type RuntimePresentation = import('@bpmn-nova/runtime').RuntimePresentation
91
+ export type RuntimeParticipant = import('./modules/runtime/index.js').RuntimeParticipant
92
+ export type RuntimeTransition = import('./modules/runtime/index.js').RuntimeTransition
93
+ export type NodeRuntimePresentation = import('./modules/runtime/index.js').NodeRuntimePresentation
94
+ export type RuntimePresentation = import('./modules/runtime/index.js').RuntimePresentation
93
95
  export interface ActivityInstance extends RuntimeActivityInstance {
94
96
  visitId?: string
95
97
  multiInstanceId?: string
@@ -104,18 +106,18 @@ export interface ProcessInstanceSnapshot extends RuntimeProcessInstanceSnapshot
104
106
  }
105
107
 
106
108
  export type ViewerProjection = 'auto' | 'standard' | 'approval' | 'compact'
107
- export type RuntimeTraceProjection = import('@bpmn-nova/viewer').RuntimeTraceProjection
108
- export type RuntimeTraceItem = import('@bpmn-nova/viewer').RuntimeTraceItem
109
- export type RuntimeTraceLink = import('@bpmn-nova/viewer').RuntimeTraceLink
110
- export type RuntimeTraceGroup = import('@bpmn-nova/viewer').RuntimeTraceGroup
109
+ export type RuntimeTraceProjection = import('./modules/viewer/index.js').RuntimeTraceProjection
110
+ export type RuntimeTraceItem = import('./modules/viewer/index.js').RuntimeTraceItem
111
+ export type RuntimeTraceLink = import('./modules/viewer/index.js').RuntimeTraceLink
112
+ export type RuntimeTraceGroup = import('./modules/viewer/index.js').RuntimeTraceGroup
111
113
  export interface RuntimeTraceProjectionOptions {
112
114
  includePredicted?: boolean
113
115
  showStartMilestone?: boolean
114
116
  showEndMilestone?: boolean
115
117
  }
116
118
  export interface ViewerTimelineOptions {
117
- title?: string | null | ((context: import('@bpmn-nova/viewer').ViewerTimelineContext) => string | null)
118
- description?: string | null | ((context: import('@bpmn-nova/viewer').ViewerTimelineContext) => string | null)
119
+ title?: string | null | ((context: import('./modules/viewer/index.js').ViewerTimelineContext) => string | null)
120
+ description?: string | null | ((context: import('./modules/viewer/index.js').ViewerTimelineContext) => string | null)
119
121
  }
120
122
  export interface RuntimeDetailsLayoutOptions {
121
123
  placement?: 'popover' | 'center' | 'bottom'
@@ -129,13 +131,15 @@ export interface RuntimeDetailsOptions {
129
131
  desktop?: RuntimeDetailsLayoutOptions
130
132
  mobile?: RuntimeDetailsLayoutOptions
131
133
  }
132
- export type RuntimeTimelineRenderer = import('@bpmn-nova/viewer').RuntimeTimelineRenderer
133
- export type RuntimeTraceClickEvent = import('@bpmn-nova/viewer').RuntimeTraceClickEvent
134
+ export type RuntimeTimelineRenderer = import('./modules/viewer/index.js').RuntimeTimelineRenderer
135
+ export type RuntimeTraceClickEvent = import('./modules/viewer/index.js').RuntimeTraceClickEvent
134
136
  export interface ViewerOptions {
135
137
  container: HTMLElement
136
138
  model: ProcessModel
137
139
  runtime?: ProcessInstanceSnapshot | null
138
140
  iconRegistry?: IconRegistry
141
+ nodeRenderers?: Record<string, Function>
142
+ nodeRenderer?: Function
139
143
  projection?: ViewerProjection
140
144
  responsive?: boolean
141
145
  timeline?: ViewerTimelineOptions
@@ -143,15 +147,47 @@ export interface ViewerOptions {
143
147
  runtimeTraceOptions?: RuntimeTraceProjectionOptions
144
148
  onTraceClick?: (event: RuntimeTraceClickEvent) => void
145
149
  runtimePresenter?: (context: { model: ProcessModel; runtime: ProcessInstanceSnapshot | null; appearance: RuntimeAppearanceResolver }) => RuntimePresentation
150
+ runtimeTraceProjector?: import('./modules/viewer/index.js').ViewerOptions['runtimeTraceProjector']
151
+ runtimeAssetResolver?: import('./modules/viewer/index.js').RuntimeAssetResolver
152
+ theme?: NovaThemeInput
153
+ runtimeAppearance?: RuntimeAppearanceOptions
154
+ svgExport?: SvgExportOptions & { label?: string; nodeRenderers?: Record<string, SvgNodeRenderer>; runtimeTimelineRenderer?: RuntimeTimelineSvgRenderer }
155
+ onThemeChange?: (state: NovaThemeState) => void
156
+ runtimeTimelineRenderer?: RuntimeTimelineRenderer
157
+ onRuntimeTraceItemClick?: import('./modules/viewer/index.js').ViewerOptions['onRuntimeTraceItemClick']
158
+ onProjectionChange?: import('./modules/viewer/index.js').ViewerOptions['onProjectionChange']
146
159
  runtimeDetailsRenderer?: RuntimeDetailsRenderer | null
147
- onRuntimeDetailsOpen?: Function
160
+ onRuntimeDetailsOpen?: import('./modules/viewer/index.js').ViewerOptions['onRuntimeDetailsOpen']
148
161
  runtimeTransitionDetailsRenderer?: RuntimeTransitionDetailsRenderer | null
149
- onRuntimeTransitionDetailsOpen?: Function
162
+ onRuntimeTransitionDetailsOpen?: import('./modules/viewer/index.js').ViewerOptions['onRuntimeTransitionDetailsOpen']
163
+ onElementClick?: import('./modules/viewer/index.js').ViewerOptions['onElementClick']
150
164
  }
151
165
  export class BpmnViewer {
152
166
  constructor(options: ViewerOptions)
153
- setDisplayOptions(options: { timeline?: ViewerTimelineOptions; runtimeDetails?: RuntimeDetailsOptions; runtimeTraceOptions?: RuntimeTraceProjectionOptions }): void
167
+ model: ProcessModel
168
+ runtime: ProcessInstanceSnapshot | null
169
+ projection: ViewerProjection
170
+ responsive: boolean
171
+ activeProjection: Exclude<ViewerProjection, 'auto'>
172
+ traceProjection: RuntimeTraceProjection | null
173
+ setModel(model: ProcessModel): void
174
+ setRuntime(runtime: ProcessInstanceSnapshot | null): void
175
+ setDisplayOptions(options: { timeline?: ViewerTimelineOptions; runtimeDetails?: RuntimeDetailsOptions; runtimeTraceOptions?: RuntimeTraceProjectionOptions; runtimeAssetResolver?: import('./modules/viewer/index.js').RuntimeAssetResolver | null }): void
176
+ setProjection(projection: ViewerProjection): void
177
+ setTheme(theme: NovaThemeInput): NovaThemeState
178
+ setThemeMode(mode: NovaThemeMode): NovaThemeState
179
+ getThemeState(): NovaThemeState
180
+ exportSvg(options?: SvgExportOptions): Promise<SvgExportArtifact>
181
+ openSvgExportPreview(options?: SvgExportOptions & { previewTitle?: string; onDownload?: (artifact: SvgExportArtifact) => void }): SvgExportPreviewController
182
+ setRuntimeAppearance(options: RuntimeAppearanceOptions | null): void
154
183
  fitView(): void
184
+ zoomBy(delta: number): void
185
+ clearSelection(): void
186
+ openRuntimeDetails(node: BpmnNode, presentation?: NodeRuntimePresentation, anchor?: Element | null): boolean
187
+ openRuntimeTransitionDetails(transition: import('./modules/runtime/index.js').RuntimeTransitionPresentation | string, anchor?: Element | null): boolean
188
+ closeRuntimeAssetPreview(): void
189
+ closeRuntimeDetails(): void
190
+ refresh(): void
155
191
  destroy(): void
156
192
  }
157
193
 
@@ -387,6 +423,8 @@ export class BpmnCanvas {
387
423
  setTheme(theme: NovaThemeInput): NovaThemeState
388
424
  setThemeMode(mode: NovaThemeMode): NovaThemeState
389
425
  getThemeState(): NovaThemeState
426
+ exportSvg(options?: SvgExportOptions): Promise<SvgExportArtifact>
427
+ openSvgExportPreview(options?: SvgExportOptions & { previewTitle?: string; onDownload?: (artifact: SvgExportArtifact) => void }): SvgExportPreviewController
390
428
  closeContextMenu(): void
391
429
  destroy(): void
392
430
  }
@@ -426,6 +464,7 @@ export interface StudioShellOptions {
426
464
  rightWidth?: number
427
465
  theme?: NovaThemeInput
428
466
  runtimeAppearance?: RuntimeAppearanceOptions
467
+ svgExport?: SvgExportOptions & { label?: string; nodeRenderers?: Record<string, SvgNodeRenderer>; runtimeTimelineRenderer?: RuntimeTimelineSvgRenderer }
429
468
  onThemeChange?: (state: NovaThemeState) => void
430
469
  }
431
470
  export class BpmnStudioShell {
@@ -442,6 +481,8 @@ export class BpmnStudioShell {
442
481
  setRuntimeAppearance(options: RuntimeAppearanceOptions | null): void
443
482
  fitView(): void
444
483
  zoomBy(factor: number): void
484
+ exportSvg(options?: SvgExportOptions): Promise<SvgExportArtifact>
485
+ openSvgExportPreview(options?: SvgExportOptions & { previewTitle?: string; onDownload?: (artifact: SvgExportArtifact) => void }): SvgExportPreviewController | null
445
486
  destroy(): void
446
487
  }
447
488
  export function createStudioShell(options: StudioShellOptions): BpmnStudioShell
package/dist/index.js CHANGED
@@ -1,16 +1,17 @@
1
- export * from '@bpmn-nova/core';
2
- export * from '@bpmn-nova/bpmn-model';
3
- export * from '@bpmn-nova/runtime';
4
- export * from '@bpmn-nova/theme';
5
- export * from '@bpmn-nova/designer';
6
- export * from '@bpmn-nova/viewer';
7
- export * from '@bpmn-nova/flowable';
8
- export * from '@bpmn-nova/activiti';
9
- export * from '@bpmn-nova/properties';
1
+ export * from './modules/core/index.js';
2
+ export * from './modules/bpmn-model/index.js';
3
+ export * from './modules/runtime/index.js';
4
+ export * from './modules/theme/index.js';
5
+ export * from './modules/export-svg/index.js';
6
+ export * from './modules/designer/index.js';
7
+ export * from './modules/viewer/index.js';
8
+ export * from './modules/engine-flowable/index.js';
9
+ export * from './modules/engine-activiti/index.js';
10
+ export * from './modules/properties/index.js';
10
11
  export * from './controller.js';
11
12
  export * from './interactions.js';
12
13
  export * from './canvas.js';
13
14
  export * from './context-menu.js';
14
15
  export * from './shell.js';
15
- export * from '@bpmn-nova/icons';
16
- export * from '@bpmn-nova/palette';
16
+ export * from './modules/icons/index.js';
17
+ export * from './modules/palette/index.js';
@@ -1,4 +1,4 @@
1
- import { NODE_DEFINITIONS } from '@bpmn-nova/core';
1
+ import { NODE_DEFINITIONS } from './modules/core/index.js';
2
2
 
3
3
  export const CREATE_INTENT_MIME = 'application/x-bpmn-nova-create-intent+json';
4
4
 
@@ -0,0 +1,11 @@
1
+ import type { EngineId, ProcessModel } from '../core/index.js'
2
+ import type { FlowableEngineProfile } from '../engine-flowable/index.js'
3
+ import type { ActivitiEngineProfile } from '../engine-activiti/index.js'
4
+
5
+ export const engineProfiles: {
6
+ flowable: FlowableEngineProfile
7
+ activiti: ActivitiEngineProfile
8
+ }
9
+ export function detectEngineFromXml(xml: string): EngineId
10
+ export function importBpmn(xml: string, engineHint?: EngineId): ProcessModel
11
+ export function exportBpmn(model: ProcessModel, engineOverride?: EngineId): string