@widgetic/canvas 0.5.29 → 0.5.30

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.
@@ -190,6 +190,8 @@
190
190
  // Extra canvas chrome (undo/redo/lock, frame, image, shape library).
191
191
  // Default off for the sketch MVP. Same pattern as wireframeMode: keep the code, hide the UI.
192
192
  export let advancedFeatures: boolean = false;
193
+ /** The zoom pill. Off on the site when debug is off. The save control stays. */
194
+ export let showZoomPanel: boolean = true;
193
195
  /** When true and advanced is on, Frame/Image/Video stay on the toolbar. Default true. */
194
196
  export let mediaBtsOnBar: boolean = true;
195
197
 
@@ -12806,6 +12808,7 @@ function checkAndAddNewShapeToFrame(shape: any) {
12806
12808
  isPanActive={activeTool === 'pan'}
12807
12809
  {showGrid}
12808
12810
  {advancedFeatures}
12811
+ showZoomControls={showZoomPanel}
12809
12812
  onPanToggle={() => activeTool === 'pan' ? onSelectSelectTool() : onSelectPanTool()}
12810
12813
  onZoomIn={zoomIn}
12811
12814
  onZoomOut={zoomOut}
@@ -36,6 +36,7 @@ declare const Canvas: $$__sveltets_2_IsomorphicComponent<{
36
36
  panZoomPosition?: "TL" | "TC" | "TR" | "BL" | "BC" | "BR";
37
37
  wireframeMode?: boolean;
38
38
  advancedFeatures?: boolean;
39
+ /** The zoom pill. Off on the site when debug is off. The save control stays. */ showZoomPanel?: boolean;
39
40
  /** When true and advanced is on, Frame/Image/Video stay on the toolbar. Default true. */ mediaBtsOnBar?: boolean;
40
41
  initialData?: string | null;
41
42
  onReady?: (() => void) | null;
@@ -33,6 +33,8 @@
33
33
 
34
34
  /** Extra view controls (grid, pan, 1:1, fit, shortcuts). Zoom ± / % and save stay available. */
35
35
  export let advancedFeatures: boolean = false;
36
+ /** The percent pill and the zoom tools. The save control stays when this is off. */
37
+ export let showZoomControls: boolean = true;
36
38
 
37
39
  // Save button: visible when showSaveButton is true
38
40
  export let showSaveButton: boolean = false;
@@ -72,7 +74,28 @@
72
74
  }
73
75
  </script>
74
76
 
75
- <div class="pan-zoom-panel-ct {className ? className + ' ' : ''}pan-zoom-panel {isMinimized ? 'pan-zoom-panel-minimized' : ''}" style={style}>
77
+ <div class="pan-zoom-panel-ct {className ? className + ' ' : ''}pan-zoom-panel {isMinimized || !showZoomControls ? 'pan-zoom-panel-minimized' : ''}" style={style}>
78
+ {#if showSaveButton}
79
+ <Tooltip text={$t(hasUnsavedChanges ? 'canvas.zoom.unsavedTitle' : 'canvas.zoom.savedTitle')} position="above">
80
+ <button
81
+ type="button"
82
+ class="panel-btn save-btn {hasUnsavedChanges ? 'save-btn--dirty' : ''}"
83
+ onclick={() => onSave?.()}
84
+ aria-label={$t(hasUnsavedChanges ? 'canvas.zoom.unsavedTitle' : 'canvas.zoom.savedTitle')}
85
+ >
86
+ {#if hasUnsavedChanges}
87
+ <span class="save-dirty-dot">●</span>
88
+ {:else}
89
+ <svg width="14" height="14" viewBox="0 0 14 14" fill="none">
90
+ <path d="M2 2h8l2 2v8a1 1 0 01-1 1H3a1 1 0 01-1-1V2z" stroke="currentColor" stroke-width="1.3"/>
91
+ <rect x="4.5" y="2" width="3" height="3.5" rx="0.5" stroke="currentColor" stroke-width="1.2"/>
92
+ <rect x="3" y="7.5" width="8" height="4" rx="0.5" stroke="currentColor" stroke-width="1.2"/>
93
+ </svg>
94
+ {/if}
95
+ </button>
96
+ </Tooltip>
97
+ {/if}
98
+ {#if showZoomControls}
76
99
  {#if isMinimized}
77
100
  <Tooltip text={$t('canvas.zoom.expandTitle', { percent: String(zoomLevel) })} position="above">
78
101
  <button
@@ -232,27 +255,6 @@
232
255
  </Tooltip>
233
256
  {/if}
234
257
 
235
- {#if showSaveButton && advancedFeatures}
236
- <div class="divider"></div>
237
- <Tooltip text={$t(hasUnsavedChanges ? 'canvas.zoom.unsavedTitle' : 'canvas.zoom.savedTitle')} position="above">
238
- <button
239
- class="panel-btn save-btn {hasUnsavedChanges ? 'save-btn--dirty' : ''}"
240
- onclick={() => onSave?.()}
241
- aria-label={$t(hasUnsavedChanges ? 'canvas.zoom.unsavedTitle' : 'canvas.zoom.savedTitle')}
242
- >
243
- {#if hasUnsavedChanges}
244
- <span class="save-dirty-dot">●</span>
245
- {:else}
246
- <svg width="14" height="14" viewBox="0 0 14 14" fill="none">
247
- <path d="M2 2h8l2 2v8a1 1 0 01-1 1H3a1 1 0 01-1-1V2z" stroke="currentColor" stroke-width="1.3"/>
248
- <rect x="4.5" y="2" width="3" height="3.5" rx="0.5" stroke="currentColor" stroke-width="1.2"/>
249
- <rect x="3" y="7.5" width="8" height="4" rx="0.5" stroke="currentColor" stroke-width="1.2"/>
250
- </svg>
251
- {/if}
252
- </button>
253
- </Tooltip>
254
- {/if}
255
-
256
258
  <div class="pan-zoom-minimize-anchor">
257
259
  <Tooltip text={$t('canvas.zoom.minimize')} position="above">
258
260
  <button
@@ -268,6 +270,7 @@
268
270
  </Tooltip>
269
271
  </div>
270
272
  {/if}
273
+ {/if}
271
274
  </div>
272
275
 
273
276
  <style>
@@ -27,6 +27,7 @@ declare const PanZoomPanel: $$__sveltets_2_IsomorphicComponent<{
27
27
  onShortcutsToggle?: () => void;
28
28
  shortcutsOpen?: boolean;
29
29
  /** Extra view controls (grid, pan, 1:1, fit, shortcuts). Zoom ± / % and save stay available. */ advancedFeatures?: boolean;
30
+ /** The percent pill and the zoom tools. The save control stays when this is off. */ showZoomControls?: boolean;
30
31
  showSaveButton?: boolean;
31
32
  hasUnsavedChanges?: boolean;
32
33
  onSave?: (() => void) | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widgetic/canvas",
3
- "version": "0.5.29",
3
+ "version": "0.5.30",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "type": "module",
6
6
  "svelte": "./dist/index.js",