@bpmn-nova/studio 0.3.7-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/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; }