@bpmn-nova/studio 0.3.2-preview → 0.3.3-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 +64 -1
- package/dist/canvas.js +3 -1
- package/dist/index.d.ts +39 -3
- package/dist/modules/export-svg/index.d.ts +2 -0
- package/dist/modules/export-svg/render.js +32 -8
- package/dist/modules/node-presentation/index.d.ts +25 -0
- package/dist/modules/node-presentation/index.js +51 -0
- package/dist/modules/renderer-svg/index.d.ts +3 -0
- package/dist/modules/renderer-svg/index.js +79 -18
- package/dist/modules/viewer/index.d.ts +3 -0
- package/dist/modules/viewer/index.js +21 -4
- package/dist/shell.js +378 -166
- package/dist/styles.css +4 -3
- package/llms-full.txt +298 -58
- package/llms.txt +19 -8
- package/package.json +1 -1
|
@@ -20,6 +20,7 @@ import type {
|
|
|
20
20
|
RuntimeAppearanceResolver,
|
|
21
21
|
} from '../theme/index.js'
|
|
22
22
|
import type { RuntimeTimelineSvgRenderer, SvgExportArtifact, SvgExportOptions, SvgExportPreviewController, SvgNodeRenderer } from '../export-svg/index.js'
|
|
23
|
+
import type { NodeSubtitleResolver } from '../node-presentation/index.js'
|
|
23
24
|
|
|
24
25
|
export type ViewerProjection = 'auto' | 'standard' | 'approval' | 'compact'
|
|
25
26
|
export interface RuntimeTraceItem {
|
|
@@ -200,6 +201,7 @@ export interface ViewerOptions {
|
|
|
200
201
|
iconRegistry?: IconRegistry
|
|
201
202
|
nodeRenderers?: Record<string, Function>
|
|
202
203
|
nodeRenderer?: Function
|
|
204
|
+
nodeSubtitleResolver?: NodeSubtitleResolver
|
|
203
205
|
projection?: ViewerProjection
|
|
204
206
|
responsive?: boolean
|
|
205
207
|
runtimeTraceOptions?: RuntimeTraceProjectionOptions
|
|
@@ -245,6 +247,7 @@ export class BpmnViewer {
|
|
|
245
247
|
traceProjection: RuntimeTraceProjection | null
|
|
246
248
|
setModel(model: ProcessModel): void
|
|
247
249
|
setRuntime(runtime: ProcessInstanceSnapshot | null): void
|
|
250
|
+
refreshPresentation(): void
|
|
248
251
|
setDisplayOptions(options: { timeline?: ViewerTimelineOptions; runtimeDetails?: RuntimeDetailsOptions; runtimeTraceOptions?: RuntimeTraceProjectionOptions; runtimeAssetResolver?: RuntimeAssetResolver | null }): void
|
|
249
252
|
setProjection(projection: ViewerProjection): void
|
|
250
253
|
setTheme(theme: NovaThemeInput): NovaThemeState
|
|
@@ -367,7 +367,7 @@ export class BpmnViewer {
|
|
|
367
367
|
this.responsive = options.responsive === true;
|
|
368
368
|
this.projection = options.projection || (this.runtime && this.responsive ? 'auto' : this.runtime ? 'approval' : 'standard');
|
|
369
369
|
this.activeProjection = 'standard';
|
|
370
|
-
this.mode = this.runtime ? 'instance' : 'viewer';
|
|
370
|
+
this.mode = options.mode === 'instance' || this.runtime ? 'instance' : 'viewer';
|
|
371
371
|
this.onElementClick = options.onElementClick || (() => {});
|
|
372
372
|
this.onTraceClick = options.onTraceClick || (() => {});
|
|
373
373
|
this.runtimePresenter = options.runtimePresenter || ((context) => createRuntimePresentation(context));
|
|
@@ -414,8 +414,15 @@ export class BpmnViewer {
|
|
|
414
414
|
};
|
|
415
415
|
document.addEventListener('pointerdown', this._outsideHandler, true);
|
|
416
416
|
document.addEventListener('keydown', this._keyHandler);
|
|
417
|
-
|
|
418
|
-
|
|
417
|
+
try {
|
|
418
|
+
this._rebuildProjection();
|
|
419
|
+
this._mountRenderer();
|
|
420
|
+
} catch (error) {
|
|
421
|
+
document.removeEventListener('pointerdown', this._outsideHandler, true);
|
|
422
|
+
document.removeEventListener('keydown', this._keyHandler);
|
|
423
|
+
if (this._ownsThemeController) this.themeController.destroy();
|
|
424
|
+
throw error;
|
|
425
|
+
}
|
|
419
426
|
this._resizeObserver = typeof ResizeObserver === 'function'
|
|
420
427
|
? new ResizeObserver(() => {
|
|
421
428
|
if (this.projection !== 'auto') return;
|
|
@@ -576,6 +583,7 @@ export class BpmnViewer {
|
|
|
576
583
|
iconRegistry: this.options.iconRegistry,
|
|
577
584
|
nodeRenderers: this.options.nodeRenderers,
|
|
578
585
|
nodeRenderer: this.options.nodeRenderer,
|
|
586
|
+
nodeSubtitleResolver: this.options.nodeSubtitleResolver,
|
|
579
587
|
svgExport: this.svgExportOptions,
|
|
580
588
|
runtimeAppearance: this.runtimeAppearance,
|
|
581
589
|
onNodeClick: (node, event) => this._select('node', node, event),
|
|
@@ -918,7 +926,12 @@ export class BpmnViewer {
|
|
|
918
926
|
}
|
|
919
927
|
|
|
920
928
|
setModel(model) { this.model = model; this._svgExportAssetCache.clear(); this.refresh(); }
|
|
921
|
-
setRuntime(runtime) {
|
|
929
|
+
setRuntime(runtime) {
|
|
930
|
+
this.runtime = runtime ? normalizeRuntime(runtime) : null;
|
|
931
|
+
this.mode = this.options.mode === 'instance' || this.runtime ? 'instance' : 'viewer';
|
|
932
|
+
this._svgExportAssetCache.clear();
|
|
933
|
+
this.refresh();
|
|
934
|
+
}
|
|
922
935
|
setProjection(projection) {
|
|
923
936
|
if (!['auto', 'standard', 'approval', 'compact'].includes(projection)) return;
|
|
924
937
|
this.projection = projection;
|
|
@@ -954,6 +967,10 @@ export class BpmnViewer {
|
|
|
954
967
|
this.runtimeAppearance = createRuntimeAppearance(this.runtimeAppearanceOptions);
|
|
955
968
|
this.refresh();
|
|
956
969
|
}
|
|
970
|
+
refreshPresentation() {
|
|
971
|
+
if (this.mode !== 'viewer' || (this.runtime && this.activeProjection === 'compact')) return;
|
|
972
|
+
this.renderer?.refreshPresentation?.();
|
|
973
|
+
}
|
|
957
974
|
exportSvg(options = {}) {
|
|
958
975
|
const isTimeline = Boolean(this.runtime && this.activeProjection === 'compact' && this.traceProjection);
|
|
959
976
|
const label = isTimeline ? '移动时间线' : this.activeProjection === 'approval' ? '实际路径' : this.runtime ? '完整 BPMN' : '流程展示';
|