@bpmn-nova/studio 0.3.8-preview → 0.3.9-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 CHANGED
@@ -4,7 +4,7 @@ BPMN Nova 的 Vanilla JavaScript / TypeScript 完整入口,提供流程设计
4
4
 
5
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.8-preview`。请使用 `@preview` 安装,并在生产接入前验证目标 BPMN XML 与引擎扩展。
7
+ > 当前版本为 `0.3.9-preview`。请使用 `@preview` 安装,并在生产接入前验证目标 BPMN XML 与引擎扩展。
8
8
 
9
9
  ![BPMN Nova 流程设计器](https://raw.githubusercontent.com/daxiangme/bpmn-nova/dev/docs/assets/bpmn-nova-designer.jpg)
10
10
 
package/dist/config.js CHANGED
@@ -159,6 +159,34 @@ export function normalizeStudioRegions(regions, current = DEFAULT_STUDIO_SHELL_R
159
159
  return { ...current, ...regions };
160
160
  }
161
161
 
162
+ const CANVAS_HEAD_KEYS = Object.freeze(['editingMode', 'scopePath']);
163
+ const CANVAS_HEAD_SCOPE_PATHS = Object.freeze(['always', 'nested']);
164
+
165
+ export const DEFAULT_STUDIO_CANVAS_HEAD = Object.freeze({
166
+ editingMode: true,
167
+ scopePath: 'always',
168
+ });
169
+
170
+ export function normalizeStudioCanvasHead(value) {
171
+ if (value === undefined || value === null) return DEFAULT_STUDIO_CANVAS_HEAD;
172
+ assertObject(value, 'config.ui.canvasHead');
173
+ for (const key of Object.keys(value)) {
174
+ if (!CANVAS_HEAD_KEYS.includes(key)) {
175
+ throw new TypeError(`config.ui.canvasHead contains unknown option "${key}"; expected editingMode or scopePath.`);
176
+ }
177
+ }
178
+ if (value.editingMode !== undefined && typeof value.editingMode !== 'boolean') {
179
+ throw new TypeError('config.ui.canvasHead.editingMode must be a boolean.');
180
+ }
181
+ if (value.scopePath !== undefined && !CANVAS_HEAD_SCOPE_PATHS.includes(value.scopePath)) {
182
+ throw new TypeError('config.ui.canvasHead.scopePath must be "always" or "nested".');
183
+ }
184
+ return Object.freeze({
185
+ editingMode: value.editingMode ?? DEFAULT_STUDIO_CANVAS_HEAD.editingMode,
186
+ scopePath: value.scopePath ?? DEFAULT_STUDIO_CANVAS_HEAD.scopePath,
187
+ });
188
+ }
189
+
162
190
  function normalizeProjectionOptions(value) {
163
191
  if (value === undefined || value === null) return undefined;
164
192
  if (!Array.isArray(value)) throw new TypeError('config.viewer.projectionOptions must be a readonly array.');
@@ -251,6 +279,7 @@ export function normalizeStudioConfig(config, { fallback = null, legacy = null }
251
279
  regions: Object.freeze(normalizeStudioRegions(uiInput.regions, {})),
252
280
  leftPanel: normalizeSidebarConfig(uiInput.leftPanel, 'left'),
253
281
  rightPanel: normalizeSidebarConfig(uiInput.rightPanel, 'right'),
282
+ canvasHead: normalizeStudioCanvasHead(uiInput.canvasHead),
254
283
  sidebarWidth: Object.freeze({
255
284
  left: normalizeSidebarWidth(leftWidth, 244, 'config.ui.sidebarWidth.left'),
256
285
  right: normalizeSidebarWidth(rightWidth, 360, 'config.ui.sidebarWidth.right'),
package/dist/index.d.ts CHANGED
@@ -252,11 +252,23 @@ export interface StudioRightPanelConfig extends StudioSidebarConfig {
252
252
  /** Defaults to flex. In scroll mode Nova scrolls the entire supplied content. */
253
253
  layout?: 'flex' | 'scroll'
254
254
  }
255
+ /** Floating head in the top-left corner of the design canvas. Since 0.3.9-preview. */
256
+ export interface StudioCanvasHeadConfig {
257
+ /** Show the "编辑模式" badge. Defaults to true. */
258
+ editingMode?: boolean
259
+ /**
260
+ * `always` (default) shows the scope path at every level; `nested` shows it only
261
+ * inside nested scopes such as sub-processes. The back button only appears in
262
+ * nested scopes either way. With nothing to show, the head takes no space.
263
+ */
264
+ scopePath?: 'always' | 'nested'
265
+ }
255
266
  export interface StudioUiConfig {
256
267
  controlSize?: StudioControlSize
257
268
  regions?: StudioShellRegions
258
269
  leftPanel?: StudioSidebarConfig
259
270
  rightPanel?: StudioRightPanelConfig
271
+ canvasHead?: StudioCanvasHeadConfig
260
272
  sidebarWidth?: {
261
273
  left?: number
262
274
  right?: number
package/dist/shell.js CHANGED
@@ -431,6 +431,7 @@ export class BpmnStudioShell {
431
431
  _footer: statusbar,
432
432
  _canvasHost: canvasHost,
433
433
  _floatingHead: floatingHead,
434
+ _editingMode: editingMode,
434
435
  _scopeBack: scopeBack,
435
436
  _scopeNav: scopeNav,
436
437
  _modeButtons: modeButtons,
@@ -508,11 +509,24 @@ export class BpmnStudioShell {
508
509
  this._setMode(this.mode, { force: true, emit: false });
509
510
  }
510
511
 
512
+ _syncCanvasHead() {
513
+ if (!this._floatingHead) return;
514
+ const { editingMode, scopePath } = this._config.ui.canvasHead;
515
+ const path = this.studio.getState().scopePath || [];
516
+ const nested = path.length > 1;
517
+ const showScopePath = scopePath === 'always' || nested;
518
+ if (this._editingMode) this._editingMode.hidden = !editingMode;
519
+ if (this._scopeNav) this._scopeNav.hidden = !showScopePath;
520
+ // With nothing to show the head takes no space and no pointer events.
521
+ this._floatingHead.hidden = !editingMode && !showScopePath;
522
+ }
523
+
511
524
  _renderScopePath() {
512
525
  if (!this._scopeNav) return;
513
526
  this._scopeNav.replaceChildren();
514
527
  const path = this.studio.getState().scopePath || [];
515
528
  const parent = path.length > 1 ? path[path.length - 2] : null;
529
+ this._syncCanvasHead();
516
530
  this._scopeBack.hidden = !parent;
517
531
  if (parent) {
518
532
  this._scopeBack.title = `返回上一级:${parent.name}`;
@@ -564,6 +578,10 @@ export class BpmnStudioShell {
564
578
  if (!this._modeSwitch) return;
565
579
  this._modeSwitch.replaceChildren();
566
580
  this._modeButtons = new Map();
581
+ // A switch with a single option has nothing to switch to, so it is not rendered.
582
+ const single = this.allowedModes.length <= 1;
583
+ this._modeSwitch.classList.toggle('is-hidden', single);
584
+ if (single) return;
567
585
  for (const item of STUDIO_MODE_OPTIONS.filter(({ value }) => this.allowedModes.includes(value))) {
568
586
  const button = node('button');
569
587
  const active = item.value === this.mode;
@@ -610,6 +628,7 @@ export class BpmnStudioShell {
610
628
  this._body?.classList.toggle('is-readonly', readonly);
611
629
  this._applyRegions({ fit: false });
612
630
  this._floatingHead?.classList.toggle('is-hidden', readonly);
631
+ this._syncCanvasHead();
613
632
  this._designControls?.forEach((control) => control.classList.toggle('is-hidden-by-mode', readonly));
614
633
  this._projectionSwitch?.classList.toggle('is-hidden', this.mode !== 'instance');
615
634
  this._exportBpmnButton?.classList.toggle('is-hidden', this.mode !== 'design');
@@ -928,6 +947,7 @@ export class BpmnStudioShell {
928
947
  const previousSidebars = this._sidebars?.getState();
929
948
  const nextMetrics = resolveStudioControlMetrics(next.ui.controlSize);
930
949
  const regionsChanged = !sameConfigValue(previous.ui.regions, next.ui.regions);
950
+ const canvasHeadChanged = !sameConfigValue(previous.ui.canvasHead, next.ui.canvasHead);
931
951
  const projectionOptionsChanged = !sameConfigValue(previous.viewer.projectionOptions, next.viewer.projectionOptions);
932
952
  const responsiveChanged = previous.viewer.responsive !== next.viewer.responsive;
933
953
  const displayChanged = ['timeline', 'runtimeDetails', 'runtimeTraceOptions']
@@ -960,6 +980,7 @@ export class BpmnStudioShell {
960
980
  }
961
981
 
962
982
  if (regionsChanged) this._applyRegions({ fit: false, sidebars: false });
983
+ if (canvasHeadChanged) this._syncCanvasHead();
963
984
  if (previousSidebars) this._sidebars.updateConfig(previousSidebars);
964
985
  if (projectionOptionsChanged || responsiveChanged) this._rebuildProjectionButtons();
965
986
  if (this.canvas?.renderer && exportChanged) this.canvas.renderer.svgExportOptions = this.svgExport || {};
package/dist/styles.css CHANGED
@@ -1169,6 +1169,7 @@ textarea.property-control { resize: vertical; }
1169
1169
  .nova-studio-mode-switch button { height: var(--nova-mode-button-height); border: 0; border-radius: var(--nova-control-radius); padding: 0 var(--nova-mode-control-padding-inline); display: flex; align-items: center; gap: 5px; color: var(--nova-color-text-muted, #8a93a4); background: transparent; font-size: var(--nova-control-font-size); line-height: 18px; white-space: nowrap; cursor: pointer; }
1170
1170
  .nova-studio-mode-switch button.is-active { color: var(--nova-tone-primary-foreground, #4f5dd1); background: var(--nova-color-surface, #fff); font-weight: var(--nova-font-weight-semibold); box-shadow: var(--nova-shadow-sm); }
1171
1171
  .nova-studio-projection-switch { height: var(--nova-control-height); border: 1px solid var(--nova-color-border, #e2e6ef); border-radius: calc(var(--nova-control-radius) + 1px); padding: 2px; display: flex; align-items: center; gap: 2px; background: var(--nova-color-surface, #fff); }
1172
+ .nova-studio-mode-switch.is-hidden { display: none; }
1172
1173
  .nova-studio-projection-switch.is-hidden { display: none; }
1173
1174
  .nova-studio-projection-switch button { height: var(--nova-projection-button-height); border: 0; border-radius: max(0px, calc(var(--nova-control-radius) - 1px)); padding: 0 max(0px, calc(var(--nova-control-padding-inline) - 1px)); color: var(--nova-color-text-muted, #7c8799); background: transparent; font-size: var(--nova-control-font-size); line-height: 18px; white-space: nowrap; cursor: pointer; }
1174
1175
  .nova-studio-projection-switch button:hover { color: var(--nova-tone-primary-foreground, #4d59ca); background: var(--nova-color-primary-soft, #f4f5ff); }.nova-studio-projection-switch button.is-active { color: var(--nova-tone-primary-foreground, #4654c8); background: var(--nova-color-primary-soft, #eef0ff); font-weight: var(--nova-font-weight-semibold); }
@@ -1408,6 +1409,7 @@ textarea.property-control { resize: vertical; }
1408
1409
  .nova-studio-editing-mode-label { color: var(--nova-tone-primary-foreground); font-size: var(--nova-font-size-sm); line-height: 18px; white-space: nowrap; }
1409
1410
  .nova-studio-scope-back { flex: none; height: 36px; border: 1px solid var(--nova-tone-primary-border, #d9ddff); border-radius: 10px; padding: 0 10px; display: inline-flex; align-items: center; gap: 5px; color: var(--nova-tone-primary-foreground); background: var(--nova-color-primary-soft, #f0f1ff); font-size: var(--nova-font-size-sm); line-height: 18px; font-weight: var(--nova-font-weight-semibold); white-space: nowrap; cursor: pointer; pointer-events: auto; box-shadow: 0 5px 16px rgba(37,45,72,.10); box-shadow: var(--nova-shadow-md); transition: color .14s ease, background .14s ease, border-color .14s ease; }
1410
1411
  .nova-studio-scope-back[hidden] { display: none; }
1412
+ .nova-studio-editing-mode[hidden], .nova-studio-scope-nav[hidden], .nova-studio-canvas-floating-head[hidden] { display: none; }
1411
1413
  .nova-studio-scope-back:hover { color: var(--nova-color-primary-hover); border-color: var(--nova-color-primary); background: color-mix(in srgb, var(--nova-color-primary-soft) 88%, var(--nova-color-primary)); }
1412
1414
  .nova-studio-scope-nav { flex: 0 1 auto; min-width: 54px; max-width: min(520px, calc(100% - 190px)); height: 36px; border: 1px solid var(--nova-color-border, #e1e5ef); border-radius: 10px; padding: 0 7px; display: flex; align-items: center; gap: 2px; overflow: hidden; color: var(--nova-color-text-muted); background: color-mix(in srgb, var(--nova-color-surface) 94%, transparent); box-shadow: 0 5px 16px rgba(37,45,72,.10); box-shadow: var(--nova-shadow-md); pointer-events: auto; }
1413
1415
  .nova-studio-scope-nav button { flex: 1 1 auto; min-width: 0; max-width: 150px; height: 28px; border: 0; border-radius: 7px; padding: 0 6px; overflow: hidden; color: var(--nova-tone-primary-foreground); background: transparent; font-size: var(--nova-font-size-sm); line-height: 18px; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; transition: color .14s ease, background .14s ease; }
@@ -1436,7 +1438,7 @@ textarea.property-control { resize: vertical; }
1436
1438
  .nova-studio-readonly-row { display: grid; gap: 4px; }.nova-studio-readonly-row span { color: var(--nova-color-text-muted); font-size: var(--nova-font-size-xs); line-height: 14px; }.nova-studio-readonly-row strong { min-height: 32px; border: 1px solid var(--nova-color-border); border-radius: 7px; padding: 0 9px; display: flex; align-items: center; color: var(--nova-color-text-secondary, #4d586c); background: var(--nova-color-surface-subtle, #fafbfc); font-size: var(--nova-font-size-sm); line-height: 18px; font-weight: var(--nova-font-weight-medium); }
1437
1439
  @media (max-width: 1120px) {
1438
1440
  .nova-studio-shell { --nova-left-width: 210px; --nova-right-width: 320px; }
1439
- .nova-studio-header { grid-template-columns: minmax(150px, auto) minmax(0,1fr); gap: 10px; }
1441
+ .nova-studio-header { grid-template-columns: minmax(150px, auto) auto minmax(0,1fr); gap: 10px; }
1440
1442
  .nova-studio-mode-switch { display: none; }
1441
1443
  .nova-studio-projection-switch { display: flex; }
1442
1444
  .nova-studio-brand-copy span { max-width: 115px; }
package/llms-full.txt CHANGED
@@ -323,7 +323,7 @@ Before changing Nova package versions, publishing, or recovering a partial relea
323
323
  - **流程展示**:只读 BPMN、实际审批路径、移动时间线和完整 BPMN 运行态。
324
324
  - **嵌入与扩展**:宿主布局、业务属性、节点内容、主题、审批详情及纯 SVG 导出。
325
325
 
326
- 当前版本为 **`0.3.8-preview`**,使用 `@preview` 安装。组件负责建模、展示和交互;流程执行、审批提交及权限由宿主业务系统负责。完整能力与 Preview 边界见[项目介绍](https://github.com/daxiangme/bpmn-nova/blob/dev/docs/src/guide/overview.md)。
326
+ 当前版本为 **`0.3.9-preview`**,使用 `@preview` 安装。组件负责建模、展示和交互;流程执行、审批提交及权限由宿主业务系统负责。完整能力与 Preview 边界见[项目介绍](https://github.com/daxiangme/bpmn-nova/blob/dev/docs/src/guide/overview.md)。
327
327
 
328
328
  ## 安装
329
329
 
@@ -412,7 +412,7 @@ npm run docs:ai:check
412
412
  BPMN Nova 提供可嵌入的流程设计器、只读 Viewer、运行态审批轨迹、实例级主题、纯 SVG 导出,以及 React / Vue 适配。项目使用独立的 DOM / SVG 渲染实现,不依赖 `bpmn-js`,并为 Flowable 与 Activiti 提供 XML Profile 和属性扩展。
413
413
 
414
414
  > [!IMPORTANT]
415
- > 当前版本为 `0.3.8-preview`。它适合 SDK 评估、产品集成验证和企业审批原型;公开 Interface、BPMN XML round-trip 与引擎兼容能力仍在持续稳定中,建议使用 `@preview` 安装并在生产接入前完成目标流程验证。
415
+ > 当前版本为 `0.3.9-preview`。它适合 SDK 评估、产品集成验证和企业审批原型;公开 Interface、BPMN XML round-trip 与引擎兼容能力仍在持续稳定中,建议使用 `@preview` 安装并在生产接入前完成目标流程验证。
416
416
 
417
417
  AI 或代码生成工具接入必须从 [`llms.txt`](https://github.com/daxiangme/bpmn-nova/blob/dev/llms.txt) 的完整安装流程开始;需要全部接口与定制上下文时再读取 [`llms-full.txt`](https://github.com/daxiangme/bpmn-nova/blob/dev/llms-full.txt)。这两份文件也会随三个公开 npm 包发布。
418
418
 
@@ -1842,7 +1842,7 @@ export function createAssetResolver(resolveAssetUrl: ResolveAssetUrl): RuntimeAs
1842
1842
 
1843
1843
  # BPMN Nova 快速开始
1844
1844
 
1845
- 本文面向通过 NPM 集成 BPMN Nova 的应用开发者。版本 `0.3.8-preview` 要求现代浏览器;Node.js 18+ 用于构建、SSR 和开发工具。
1845
+ 本文面向通过 NPM 集成 BPMN Nova 的应用开发者。版本 `0.3.9-preview` 要求现代浏览器;Node.js 18+ 用于构建、SSR 和开发工具。
1846
1846
 
1847
1847
  ## 1. 按语言与框架选择入口
1848
1848
 
@@ -2318,7 +2318,7 @@ BPMN Nova 的 Vanilla JavaScript / TypeScript 完整入口,提供流程设计
2318
2318
 
2319
2319
  > **English summary:** The complete framework-neutral BPMN Nova package for process design, viewing, approval traces, themes, properties, and pure SVG export.
2320
2320
 
2321
- > 当前版本为 `0.3.8-preview`。请使用 `@preview` 安装,并在生产接入前验证目标 BPMN XML 与引擎扩展。
2321
+ > 当前版本为 `0.3.9-preview`。请使用 `@preview` 安装,并在生产接入前验证目标 BPMN XML 与引擎扩展。
2322
2322
 
2323
2323
  ![BPMN Nova 流程设计器](../../assets/bpmn-nova-designer.jpg)
2324
2324
 
@@ -2520,6 +2520,16 @@ console.log(shell.getConfig())
2520
2520
  console.log(shell.ui.controlSize, shell.ui.controlHeight) // 36px, 36px
2521
2521
  ```
2522
2522
 
2523
+ 宿主顶栏已经显示流程名称与状态时,可以用 `config.ui.canvasHead`(自 0.3.9-preview 起)去掉画布左上角的重复信息:根作用域不显示浮动头部,进入子流程后才显示作用域路径与“返回上一级”。默认 `{ editingMode: true, scopePath: 'always' }` 与之前一致。
2524
+
2525
+ ```js
2526
+ shell.setConfig({
2527
+ ui: { canvasHead: { editingMode: false, scopePath: 'nested' } },
2528
+ })
2529
+ ```
2530
+
2531
+ `allowedModes` 只有一种时,默认 Header 不显示模式切换(自 0.3.9-preview 起)。
2532
+
2523
2533
  尺寸只作用于 Header;Footer、Canvas 浮动工具、Palette 和 Properties 不随之缩放。Header Slot 可读取只读 `ui`,并继承 `--nova-control-height`、`--nova-header-height`、`--nova-control-font-size`、`--nova-control-padding-inline`、`--nova-control-icon-size` 和 `--nova-control-radius`。Element Plus `default`、Ant Design `middle` 都对应 Nova `medium`。
2524
2534
 
2525
2535
  旧顶层配置仍兼容但已 Deprecated;同一字段同时出现时旧顶层显式值优先。`setConfig()` 原地应用 UI、Viewer 和 Export,不重建 Canvas;`config.modeling` 只在创建 Controller 时生效,运行中继续通过 `setPropertiesProfile()` 修改 Profile,节点/连线白名单保持不变量。
@@ -2755,7 +2765,7 @@ BPMN Nova 的 Vue 3.3+ Adapter,提供 Studio、Designer、Viewer、审批轨
2755
2765
 
2756
2766
  > **English summary:** Vue 3.3+ components and exposed instance methods for BPMN Nova process design, viewing, approval traces, properties, themes, and SVG export.
2757
2767
 
2758
- > 当前版本为 `0.3.8-preview`。Vue 由宿主工程提供,本包不会替应用选择或升级框架版本。
2768
+ > 当前版本为 `0.3.9-preview`。Vue 由宿主工程提供,本包不会替应用选择或升级框架版本。
2759
2769
 
2760
2770
  ![BPMN Nova Vue 流程工作台](../../assets/bpmn-nova-designer.jpg)
2761
2771
 
@@ -2988,6 +2998,17 @@ async function publishProcess(actions) {
2988
2998
  </BpmnStudio>
2989
2999
  ```
2990
3000
 
3001
+ 宿主顶栏已显示流程名称与状态时,用 `config.ui.canvasHead`(自 0.3.9-preview 起)去掉画布左上角的重复信息;`allowed-modes` 只有一种时默认 Header 不显示模式切换。
3002
+
3003
+ ```vue
3004
+ <BpmnStudio
3005
+ :allowed-modes="['design']"
3006
+ :config="{ ui: { canvasHead: { editingMode: false, scopePath: 'nested' } } }"
3007
+ />
3008
+ ```
3009
+
3010
+ `editingMode: false` 不显示“编辑模式”徽标,`scopePath: 'nested'` 只在子流程等嵌套作用域显示作用域路径;默认 `{ editingMode: true, scopePath: 'always' }`。
3011
+
2991
3012
  Expose 同步提供 `getConfig()` / `setConfig()`;响应式更新 UI、Viewer 或 Export 不重建 Canvas。旧顶层配置继续兼容并标记 Deprecated,同项冲突时显式旧值优先。`config.modeling` 只在内部 Controller 创建时建立节点和连线约束。
2992
3013
 
2993
3014
  ## 原生右侧 Slot 与折叠
@@ -3212,7 +3233,7 @@ BPMN Nova 的 React 18+ Adapter,提供 Studio、Designer、Viewer、审批轨
3212
3233
 
3213
3234
  > **English summary:** React 18+ components and refs for BPMN Nova process design, viewing, approval traces, properties, themes, and SVG export.
3214
3235
 
3215
- > 当前版本为 `0.3.8-preview`。React 与 React DOM 由宿主工程提供,本包不会替应用选择或升级框架版本。
3236
+ > 当前版本为 `0.3.9-preview`。React 与 React DOM 由宿主工程提供,本包不会替应用选择或升级框架版本。
3216
3237
 
3217
3238
  ![BPMN Nova React 流程工作台](../../assets/bpmn-nova-designer.jpg)
3218
3239
 
@@ -3407,6 +3428,17 @@ async function publishProcess(actions) {
3407
3428
  />
3408
3429
  ```
3409
3430
 
3431
+ 宿主顶栏已显示流程名称与状态时,用 `config.ui.canvasHead`(自 0.3.9-preview 起)去掉画布左上角的重复信息;`allowedModes` 只有一种时默认 Header 不显示模式切换。
3432
+
3433
+ ```jsx
3434
+ <BpmnStudio
3435
+ allowedModes={['design']}
3436
+ config={{ ui: { canvasHead: { editingMode: false, scopePath: 'nested' } } }}
3437
+ />
3438
+ ```
3439
+
3440
+ `editingMode: false` 不显示“编辑模式”徽标,`scopePath: 'nested'` 只在子流程等嵌套作用域显示作用域路径;默认 `{ editingMode: true, scopePath: 'always' }`。
3441
+
3410
3442
  Ref 同步提供 `getConfig()` / `setConfig()`;运行时更新 UI、Viewer 或 Export 不重建 Canvas。旧顶层配置继续兼容并标记 Deprecated,同项冲突时显式旧值优先。`config.modeling` 只在内部 Controller 创建时建立节点和连线约束。
3411
3443
 
3412
3444
  ## 原生右侧内容与折叠
@@ -3620,7 +3652,7 @@ Apache-2.0. See [LICENSE](https://github.com/daxiangme/bpmn-nova/blob/dev/packag
3620
3652
 
3621
3653
  # BPMN Nova 组件参数
3622
3654
 
3623
- 本手册记录 `0.3.8-preview` 的公开组件参数、回调和实例方法。所有视觉组件都需要具有实际尺寸的容器,并显式导入所属包的 `styles.css`。
3655
+ 本手册记录 `0.3.9-preview` 的公开组件参数、回调和实例方法。所有视觉组件都需要具有实际尺寸的容器,并显式导入所属包的 `styles.css`。
3624
3656
 
3625
3657
  ## 在线体验
3626
3658
 
@@ -3711,7 +3743,7 @@ studio.changeNodeType('EndEvent_1', 'startEvent') // 返回 false
3711
3743
  | `studio` | `BpmnStudioController` | 必填 | 外部 Controller |
3712
3744
  | `config` | `BpmnStudioConfig` | `{}` | `ui/viewer/export` 静态配置;`modeling` 由 Controller 创建时消费 |
3713
3745
  | `mode` | `'design' \| 'viewer' \| 'instance'` | `'design'` | 当前展示模式 |
3714
- | `allowedModes` | `('design' \| 'viewer' \| 'instance')[]` | 全部模式 | 默认工作台显示并允许切换的模式 |
3746
+ | `allowedModes` | `('design' \| 'viewer' \| 'instance')[]` | 全部模式 | 默认工作台显示并允许切换的模式;只有一种时不显示模式切换(自 0.3.9-preview 起) |
3715
3747
  | `runtime` | `ProcessInstanceSnapshot \| null` | `null` | 实例模式数据;没有数据时保持空运行事实 |
3716
3748
  | `projection` | `ViewerProjection` | 实例模式默认 `approval` | 审批轨迹投影 |
3717
3749
  | `responsive` | `boolean` | `false` | Deprecated;使用 `config.viewer.responsive` |
@@ -3742,9 +3774,15 @@ studio.changeNodeType('EndEvent_1', 'startEvent') // 返回 false
3742
3774
  | `leftPanel.collapsible` / `rightPanel.collapsible` | `true` | 显示分隔线中点折叠按钮;`false` 时可见面板保持展开 |
3743
3775
  | `leftPanel.defaultCollapsed` / `rightPanel.defaultCollapsed` | `false` | 宽屏初始化状态;不随 Config 更新重置 |
3744
3776
  | `rightPanel.layout` | `'flex'` | `'flex'` 由宿主安排内部滚动;`'scroll'` 由 Nova 滚动整块内容 |
3777
+ | `canvasHead.editingMode` | `true` | 自 0.3.9-preview 起。是否显示画布左上角的“编辑模式”徽标 |
3778
+ | `canvasHead.scopePath` | `'always'` | 自 0.3.9-preview 起。`'always'` 在每一层显示作用域路径;`'nested'` 只在子流程等嵌套作用域显示,根作用域不显示 |
3745
3779
 
3746
3780
  首次进入 ≤720px 的 Shell 容器时,可折叠面板默认收起且保留按钮,宽窄屏分别记忆状态。折叠动画为 200ms,支持减少动态效果,不卸载 Slot、不执行 Fit。Design 默认左右可见,Viewer 仅右侧可见,Instance 默认两侧隐藏;显式 `regions.right: 'default'` 可在 Instance 开启,`'hidden'` 隐藏整个区域和按钮,不能用右侧 Slot 覆盖。
3747
3781
 
3782
+ 画布左上角浮动头部(自 0.3.9-preview 起)由“编辑模式”徽标、“返回上一级”和作用域路径组成,只在流程设计模式显示。“返回上一级”始终只在嵌套作用域出现;`canvasHead` 让宿主在自身顶栏已显示对象名称与状态时去掉重复信息,例如 `{ editingMode: false, scopePath: 'nested' }` 在根作用域完全不显示浮动头部(不留空白与点击区域),进入子流程后显示路径与返回按钮。`setConfig()` 更新后立即生效;未知键、非布尔的 `editingMode` 或 `always | nested` 之外的 `scopePath` 抛 `TypeError`。
3783
+
3784
+ 默认 Header 在 `allowedModes` 只有一种时不显示模式切换,运行时 `setAllowedModes()` 增减模式随之出现或消失;容器不超过 1120px 时 Header 保持单行,Brand、撤销、重做、一键美化与 `headerStart` / `headerActions` 内容都留在第一行(自 0.3.9-preview 起)。
3785
+
3748
3786
  `BpmnStudioConfig` 分为四组:`modeling`(Profile、节点/连线白名单与 `nodeLimits` 数量上限)、`ui`(`controlSize`、Regions、侧栏宽度、折叠与内容布局)、`viewer`(响应式投影、投影选项、Timeline/Details/Trace)和 `export`。`setConfig()` 先完整校验,再原地更新 UI、Viewer 与 Export,不重建 Canvas。`controlSize` 默认 `medium`,接受 `small | medium | large | '24px'…'48px'`;`null`、裸数字、其他单位及范围外值会抛出包含 `config.ui.controlSize` 的错误。
3749
3787
 
3750
3788
  `shell.actions` 是默认 Header 与宿主自定义 Header 共用的稳定 Interface,提供 `undo()`、`redo()`、`beautify()`、`rerouteEdges()`、`fitView()`、`validate()`、`importXml()`、`exportXml()`、`exportSvg()` 和 `openSvgExportPreview()`。它不包含保存、发布、权限或文件上传等宿主业务动作。
@@ -3883,7 +3921,7 @@ canvas.setViewportState({ zoom: 0.8, pan: { x: 0, y: 0 } }) // 直
3883
3921
  | `propertiesProfile` | 创建内部 Controller 时的属性 Profile |
3884
3922
  | `allowedNodeTypes` | 创建内部 Controller 时使用的完整模型节点白名单 |
3885
3923
  | `allowedEdgeTypes` | 创建内部 Controller 时使用的完整模型连线白名单 |
3886
- | `allowedModes` | Shell 显示并允许切换的工作台模式 |
3924
+ | `allowedModes` | Shell 显示并允许切换的工作台模式;只有一种时不显示模式切换(自 0.3.9-preview 起) |
3887
3925
  | `mode` / `onModeChange` | 受控输入与实际 Mode 事件;Header Render Context 同步提供 `mode` |
3888
3926
  | `nodeSubtitleResolver` | Design/Viewer 标准节点副标题 Resolver |
3889
3927
  | `contextMenuRegistry` | 自定义右键动作 Registry |
@@ -3982,7 +4020,7 @@ Runtime Details、Timeline 和 Transition Details 组件通过对应 `createReac
3982
4020
 
3983
4021
  <!-- SOURCE: docs/src/api/index.md -->
3984
4022
 
3985
- # BPMN Nova v0.3.8 Preview API
4023
+ # BPMN Nova v0.3.9 Preview API
3986
4024
 
3987
4025
  ## Framework Adapter 类型门面
3988
4026
 
@@ -4040,12 +4078,22 @@ interface StudioRightPanelConfig extends StudioSidebarConfig {
4040
4078
  layout?: 'flex' | 'scroll'
4041
4079
  }
4042
4080
 
4081
+ /** 自 0.3.9-preview 起:画布左上角浮动头部。 */
4082
+ interface StudioCanvasHeadConfig {
4083
+ /** 是否显示“编辑模式”徽标,默认 true。 */
4084
+ editingMode?: boolean
4085
+ /** 'always'(默认)每一层都显示作用域路径;'nested' 只在嵌套作用域显示。 */
4086
+ scopePath?: 'always' | 'nested'
4087
+ }
4088
+
4043
4089
  interface StudioUiConfig {
4044
4090
  controlSize?: StudioControlSize
4045
4091
  regions?: StudioShellRegions
4046
4092
  sidebarWidth?: { left?: number; right?: number }
4047
4093
  leftPanel?: StudioSidebarConfig
4048
4094
  rightPanel?: StudioRightPanelConfig
4095
+ /** 自 0.3.9-preview 起。默认 { editingMode: true, scopePath: 'always' }。 */
4096
+ canvasHead?: StudioCanvasHeadConfig
4049
4097
  }
4050
4098
 
4051
4099
  /** 自 0.3.8-preview 起:每种节点类型的数量上限,按整个模型(含全部子流程作用域)统计。 */
@@ -4101,6 +4149,8 @@ console.log(shell.getConfig(), shell.ui.controlHeight)
4101
4149
 
4102
4150
  同一项同时出现时,旧顶层显式值优先,以保证现有接入无行为变化。
4103
4151
 
4152
+ `config.ui.canvasHead`(自 0.3.9-preview 起)控制设计画布左上角的浮动头部,`StudioCanvasHeadConfig` 从 Studio/Vue/React 根声明入口导出。不传时与之前完全一致;`editingMode: false` 不显示“编辑模式”徽标,`scopePath: 'nested'` 在根作用域不显示作用域路径。没有可显示内容时浮动头部整体不占位。“返回上一级”只在嵌套作用域出现,与配置无关。非对象、未知键、非布尔 `editingMode` 或 `always | nested` 以外的 `scopePath` 抛 `TypeError`。
4153
+
4104
4154
  ### 侧栏配置、状态与选择
4105
4155
 
4106
4156
  自 `0.3.5-preview` 起,新增侧栏类型和接口从 Studio/Vue/React 根声明入口提供,不要求增加其他直接依赖。`config.ui.leftPanel/rightPanel.collapsible` 默认 `true`;`defaultCollapsed` 只用于宽屏初始化,默认 `false`。`rightPanel.layout` 默认 `flex`,宿主控制内部滚动;`scroll` 由 Nova 负责整块内容滚动。完整示例见[侧栏布局与平滑折叠](../customization/index.md#侧栏布局与平滑折叠)。
@@ -5861,7 +5911,7 @@ Default ●
5861
5911
 
5862
5912
  # BPMN Nova NPM 包与发布
5863
5913
 
5864
- 版本:`0.3.8-preview`。BPMN Nova 只发布三个 `@bpmn-nova` 公共包,均使用 ESM、附带 TypeScript 声明、采用 Apache-2.0 License,并通过 `preview` dist-tag 发布。
5914
+ 版本:`0.3.9-preview`。BPMN Nova 只发布三个 `@bpmn-nova` 公共包,均使用 ESM、附带 TypeScript 声明、采用 Apache-2.0 License,并通过 `preview` dist-tag 发布。
5865
5915
 
5866
5916
  ## 公共包
5867
5917
 
@@ -5885,6 +5935,8 @@ React/Vue 的声明入口显式重导出宿主常用的 Core 类型:`BpmnEdge`
5885
5935
 
5886
5936
  `0.3.8-preview` 新增 `config.modeling.nodeLimits` 节点数量限制、`BpmnCanvas.revealElement()` 按元素定位、框架入口完整公开类型、`xml` 导入失败的受控出口(`onImportError` / `import-error`),并把框架回调参数改为不可变快照。详见更新日志、组件参数与 API 文档。
5887
5937
 
5938
+ `0.3.9-preview` 新增 `config.ui.canvasHead`,可关闭画布左上角的“编辑模式”徽标、让作用域路径只在嵌套作用域显示;`allowedModes` 只有一种时默认 Header 不再显示模式切换;容器不超过 1120px 时 Header 保持单行。详见更新日志与组件参数。
5939
+
5888
5940
  ## Studio 子路径
5889
5941
 
5890
5942
  Studio 根入口重新导出稳定的完整能力;以下子路径用于让导入意图更清晰:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpmn-nova/studio",
3
- "version": "0.3.8-preview",
3
+ "version": "0.3.9-preview",
4
4
  "description": "Complete BPMN Nova Studio with Designer, Viewer, Palette, Properties and runtime visualization.",
5
5
  "keywords": [
6
6
  "bpmn",