@widgetic/canvas 0.5.33 → 0.5.35

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.
@@ -52,6 +52,8 @@
52
52
  shouldTakeFocusBack
53
53
  } from './eventScope';
54
54
  import { installTextareaInShadowRoot } from './shadowRootText';
55
+ import { createAutosaveScheduler } from './autosaveScheduler';
56
+ import { toolbarPositionClasses, type ToolbarPosition } from './toolbarPosition';
55
57
  import type { WidgetConversionPayload, StrokeRecognizer } from './types';
56
58
  import { provideCanvasLanguage } from '../i18n/language.js';
57
59
  import { makeShapeWords, setShapeWords, shapeWordsOf } from '../i18n/shapeWords.js';
@@ -183,6 +185,12 @@
183
185
  // PanZoom Panel position: TL (top-left), TC (top-center), TR (top-right), BL, BC, BR
184
186
  export let panZoomPosition: 'TL' | 'TC' | 'TR' | 'BL' | 'BC' | 'BR' = 'TC';
185
187
 
188
+ // Where the drawing toolbar stands along the bottom edge: BL (bottom-left), BC (bottom-center, the default) or BR.
189
+ // The selector bar that replaces the toolbar after the first generation stands in the same place. A host that has
190
+ // something of its own at the bottom centre of the page (Shopify's Sidekick) names the corner it wants. Anything
191
+ // that is not one of the three is the bottom centre.
192
+ export let toolbarPosition: ToolbarPosition = 'BC';
193
+
186
194
  // Wireframe mode: hides color pickers in PropsPanel and enforces wireframe defaults
187
195
  // (white fill, dark stroke) on all newly created objects
188
196
  export let wireframeMode: boolean = true;
@@ -190,6 +198,23 @@
190
198
  // Extra canvas chrome (undo/redo/lock, frame, image, shape library).
191
199
  // Default off for the sketch MVP. Same pattern as wireframeMode: keep the code, hide the UI.
192
200
  export let advancedFeatures: boolean = false;
201
+
202
+ /** The element selector on the toolbar. The host owns whether it is on. */
203
+ export let showElementSelector: boolean = false;
204
+ /** Drawing tools stay until the first generation. After that, only the selector remains. */
205
+ export let showDrawingTools: boolean = true;
206
+ export let elementSelectorActive: boolean = false;
207
+ export let onToggleElementSelector: (() => void) | null = null;
208
+ /** Words for the selector bar that replaces the drawing tools. */
209
+ export let selectorGuide: {
210
+ click: string;
211
+ parentChild: string;
212
+ hold: string;
213
+ cmd: string;
214
+ interact: string;
215
+ esc: string;
216
+ done: string;
217
+ } | null = null;
193
218
  /** The zoom pill. Off on the site when debug is off. The save control stays. */
194
219
  export let showZoomPanel: boolean = true;
195
220
  /** When true and advanced is on, Frame/Image/Video stay on the toolbar. Default true. */
@@ -212,9 +237,12 @@
212
237
  // destroys this component before the auto-save timer fires.
213
238
  export let onBeforeUnmount: ((json: string | null) => void) | null = null;
214
239
 
215
- // Callback fired after every discrete canvas state change (after each history snapshot).
216
- // Receives the serialized canvas JSON so the host doesn't need to call saveCanvas().
217
- export let onAutoSave: ((json: string | null) => void) | null = null;
240
+ // Callback fired once the changes have been quiet for autosaveDelayMs (see the autosave buffer below), and when the
241
+ // host or the page asks to flush. Receives the serialized canvas JSON so the host doesn't need to call saveCanvas().
242
+ // May return a promise: while it is pending no second autosave starts, and what changes meanwhile goes out in one
243
+ // save after it, so a slow server is never flooded. A promise that rejects counts as a failed save (the changes stay
244
+ // unsaved until the next change or flush).
245
+ export let onAutoSave: ((json: string | null) => void | Promise<unknown>) | null = null;
218
246
 
219
247
  // Delay in ms for the internal auto-save debounce.
220
248
  // Controls how long Canvas waits after the last content modification before emitting onAutoSave.
@@ -222,8 +250,13 @@
222
250
  // Lower = more frequent saves, higher = less API pressure. Default: 3000ms.
223
251
  export let autosaveDelayMs: number = 3000;
224
252
 
253
+ // The longest a change waits before it is saved, however busy the person stays (a long stretch of drawing never
254
+ // leaves a quiet delay). A crash then costs at most this long. 0 means no limit. Default: 10000ms.
255
+ export let autosaveMaxWaitMs: number = 10000;
256
+
225
257
  // While set, a due autosave waits another delay instead of serializing.
226
258
  // Serializing during code generation blocks the page thread for the whole save.
259
+ // (Flushing, when the page is hidden or the editor closes, saves whatever the hold.)
227
260
  export let suspendAutosave: boolean = false;
228
261
 
229
262
  // Show a save button in the bottom-right corner of the canvas.
@@ -421,6 +454,15 @@
421
454
  // WidgetShapes (live iframe chrome) — keep a usable footprint when resizing
422
455
  const MIN_WIDGET_SHAPE_SIZE = 50;
423
456
  let activeTool: ToolName = 'draw';
457
+ // A hidden pencil must not stay armed. The letter keys are ignored in the toolbar; this drops the tool too.
458
+ $: if (!showDrawingTools) {
459
+ const drawingTool = activeTool === 'draw' || activeTool === 'erase' || activeTool === 'arrow' || activeTool === 'text'
460
+ || (!advancedFeatures && (
461
+ activeTool === 'rect' || activeTool === 'circle' || activeTool === 'circle-true'
462
+ || activeTool === 'triangle' || activeTool === 'frame' || activeTool === 'image' || activeTool === 'video'
463
+ ));
464
+ if (drawingTool) onSelectSelectTool();
465
+ }
424
466
  /**
425
467
  * The pointer handlers belonging to the currently active tool session.
426
468
  * Grouped so their joint lifecycle (attached together, detached together
@@ -1720,6 +1762,23 @@
1720
1762
  return ids;
1721
1763
  }
1722
1764
 
1765
+ /**
1766
+ * Simple canvas keeps one widget shape. Extra widget shapes are taken off the board.
1767
+ * Returns how many were removed.
1768
+ */
1769
+ export function keepOnlyWidgetShape(widgetId: string): number {
1770
+ if (!canvas || !widgetId) return 0;
1771
+ const extras = canvas.getObjects().filter((obj: any) =>
1772
+ obj._isWidgetImage && obj._widgetId && obj._widgetId !== widgetId
1773
+ );
1774
+ if (extras.length === 0) return 0;
1775
+ for (const obj of extras) canvas.remove(obj);
1776
+ try { canvas.discardActiveObject(); } catch { /* selection may already be gone */ }
1777
+ canvas.requestRenderAll();
1778
+ canvasLog('Canvas: simple mode kept one widget shape', widgetId, 'removed', extras.length);
1779
+ return extras.length;
1780
+ }
1781
+
1723
1782
  /**
1724
1783
  * Backfill `_widgetName` / `_imageUrl` on WidgetShapes that were serialized before
1725
1784
  * those fields existed on the shape. Called by widget-creator after canvas load so
@@ -2101,7 +2160,8 @@
2101
2160
  // Clear canvas initialization error
2102
2161
  canvasInitializationError = null;
2103
2162
 
2104
- onSelectDrawTool();
2163
+ if (showDrawingTools) onSelectDrawTool();
2164
+ else onSelectSelectTool();
2105
2165
 
2106
2166
  /**
2107
2167
  * Apply uniform scaling to make shapes regular:
@@ -6334,8 +6394,8 @@
6334
6394
  const unmountJson = saveCanvas();
6335
6395
  onBeforeUnmount?.(unmountJson);
6336
6396
 
6337
- // Clear pending autosave / history debounce timers
6338
- if (_autoSaveTimer) { clearTimeout(_autoSaveTimer); _autoSaveTimer = null; }
6397
+ // Stop the autosave buffer (the host was just given the final save above) and the history debounce timer
6398
+ autosaveScheduler.dispose();
6339
6399
  if (_historyDebounceTimer) { clearTimeout(_historyDebounceTimer); _historyDebounceTimer = null; }
6340
6400
 
6341
6401
  detachCanvasPointerHandlers();
@@ -10174,9 +10234,8 @@ function checkAndAddNewShapeToFrame(shape: any) {
10174
10234
  * Push the current canvas state onto the history stack.
10175
10235
  * Call this AFTER each discrete user action that mutates objects.
10176
10236
  * Is a no-op when called during a history restore (isRestoringHistory = true).
10177
- * Also marks the canvas as dirty and schedules a debounced onAutoSave.
10237
+ * Also marks the canvas as dirty and tells the autosave buffer a change was made.
10178
10238
  */
10179
- let _autoSaveTimer: ReturnType<typeof setTimeout> | null = null;
10180
10239
  function takeHistorySnapshot(silent: boolean = false) {
10181
10240
  if (isRestoringHistory || isCapturingHistory || !canvas) return;
10182
10241
  const snapshot = captureHistorySnapshot();
@@ -10194,43 +10253,92 @@ function checkAndAddNewShapeToFrame(shape: any) {
10194
10253
  // Silent snapshots (e.g. initial empty canvas) only record history — no dirty flag or autosave
10195
10254
  if (silent) return;
10196
10255
 
10197
- // Mark dirty and schedule debounced autosave
10256
+ // Mark dirty and tell the autosave buffer
10198
10257
  _hasUnsavedChanges = true;
10199
10258
  onCanvasDirty?.();
10200
- scheduleAutoSave();
10259
+ autosaveScheduler.markChanged();
10260
+ }
10261
+
10262
+ // ── Autosave buffer ──────────────────────────────────────────────────────
10263
+ // Every change goes through the scheduler, which is the buffer between the person editing and the server:
10264
+ // - a save starts after autosaveDelayMs of quiet (a trailing debounce, so a drag is one save, not fifty);
10265
+ // - a person who never pauses still gets a save every autosaveMaxWaitMs;
10266
+ // - a save waits while suspendAutosave is set (a code generation is running), however long that takes;
10267
+ // - one save at a time: while onAutoSave's promise is pending, what changes goes out in one save after it;
10268
+ // - flushAutosave() (and the page being hidden or closed) saves whatever is unsaved at once.
10269
+ const autosaveScheduler = createAutosaveScheduler({
10270
+ getDelayMs: () => autosaveDelayMs,
10271
+ getMaxWaitMs: () => autosaveMaxWaitMs,
10272
+ isSuspended: () => {
10273
+ if (suspendAutosave && import.meta.env.DEV) {
10274
+ fetch('http://localhost:3000/health?probe=autosave&status=deferred').catch(() => {});
10275
+ }
10276
+ return suspendAutosave;
10277
+ },
10278
+ save: runAutosave,
10279
+ onSaveFailed: (error) => {
10280
+ // The host's save failed: what it was meant to keep is unsaved again, and the next change or flush tries again.
10281
+ _hasUnsavedChanges = true;
10282
+ canvasWarn('Canvas: autosave failed, the changes stay unsaved until the next change', error);
10283
+ }
10284
+ });
10285
+
10286
+ /** One autosave: serializes the board and hands it to the host. Returns the host's promise, so the buffer keeps one save at a time. */
10287
+ function runAutosave(): void | Promise<unknown> {
10288
+ const json = saveCanvas();
10289
+ if (json === null) {
10290
+ // The board has nothing to give right now (it is still loading): nothing was saved, so ask the buffer for
10291
+ // another go a delay later rather than telling the host there is nothing.
10292
+ canvasLog('Canvas: autosave — the board cannot be serialized yet, trying again after the delay');
10293
+ autosaveScheduler.markChanged();
10294
+ return;
10295
+ }
10296
+ if (import.meta.env.DEV) {
10297
+ fetch('http://localhost:3000/health?probe=autosave&status=run').catch(() => {});
10298
+ }
10299
+ _hasUnsavedChanges = false;
10300
+ return onAutoSave?.(json);
10201
10301
  }
10202
10302
 
10203
- /** Debounced autosave — resets on every new snapshot, fires after autosaveDelayMs of inactivity. */
10204
- function scheduleAutoSave() {
10205
- if (_autoSaveTimer) clearTimeout(_autoSaveTimer);
10206
- _autoSaveTimer = setTimeout(() => {
10207
- _autoSaveTimer = null;
10208
- if (suspendAutosave) {
10209
- if (import.meta.env.DEV) {
10210
- fetch('http://localhost:3000/health?probe=autosave&status=deferred').catch(() => {});
10211
- }
10212
- scheduleAutoSave();
10213
- return;
10214
- }
10215
- if (import.meta.env.DEV) {
10216
- fetch('http://localhost:3000/health?probe=autosave&status=run').catch(() => {});
10217
- }
10218
- const json = saveCanvas();
10219
- onAutoSave?.(json);
10220
- _hasUnsavedChanges = false;
10221
- }, autosaveDelayMs);
10303
+ /**
10304
+ * Saves whatever the buffer still holds, now, whatever the delay and the hold. Resolves once the host's save is
10305
+ * done (after the one that was already on its way, so two never overlap). A host calls it before it leaves the
10306
+ * editor (a Back button, Publish) so that the last seconds of work are not lost to the delay; nothing is saved
10307
+ * when nothing changed.
10308
+ */
10309
+ export function flushAutosave(): Promise<void> {
10310
+ return autosaveScheduler.flush();
10222
10311
  }
10223
10312
 
10224
10313
  /** Force an immediate save (used by Cmd+S, the save button, and host post-replace flushes). */
10225
10314
  export function saveNow() {
10226
- if (_autoSaveTimer) clearTimeout(_autoSaveTimer);
10227
- _autoSaveTimer = null;
10315
+ // What the buffer was waiting to save is in this save.
10316
+ autosaveScheduler.cancel();
10228
10317
  const json = saveCanvas();
10229
10318
  onAutoSave?.(json);
10230
10319
  _hasUnsavedChanges = false;
10231
10320
  canvasLog('Canvas: manual save triggered');
10232
10321
  }
10233
10322
 
10323
+ // The page goes away (the tab is closed or reloaded, the browser is put in the background, a phone is locked): save
10324
+ // what is unsaved now instead of after the delay. The hold of suspendAutosave does not apply, a save is better than
10325
+ // losing the last stretch of work. The host's own save is started here; whether the browser lets it finish is the
10326
+ // browser's call, which is why a host keeps its own local copy too.
10327
+ onMount(() => {
10328
+ function flushWhenPageIsLeft() {
10329
+ void autosaveScheduler.flush();
10330
+ }
10331
+ function flushWhenPageIsHidden() {
10332
+ if (document.visibilityState === 'hidden') flushWhenPageIsLeft();
10333
+ }
10334
+ window.addEventListener('pagehide', flushWhenPageIsLeft);
10335
+ document.addEventListener('visibilitychange', flushWhenPageIsHidden);
10336
+ return () => {
10337
+ window.removeEventListener('pagehide', flushWhenPageIsLeft);
10338
+ document.removeEventListener('visibilitychange', flushWhenPageIsHidden);
10339
+ };
10340
+ });
10341
+
10234
10342
  // Debounced version of takeHistorySnapshot — used in continuous slider handlers
10235
10343
  // (stroke width, roundness, etc.) to avoid serializing the canvas on every input event.
10236
10344
  // Fires once 500 ms after the last call, capturing the final slider value.
@@ -10319,7 +10427,7 @@ function checkAndAddNewShapeToFrame(shape: any) {
10319
10427
  await restoreHistorySnapshot(historyStack[historyIndex]);
10320
10428
  _hasUnsavedChanges = true;
10321
10429
  onCanvasDirty?.();
10322
- scheduleAutoSave();
10430
+ autosaveScheduler.markChanged();
10323
10431
  }
10324
10432
 
10325
10433
  /** Redo the previously undone action. No-op if at the newest state. */
@@ -10330,7 +10438,7 @@ function checkAndAddNewShapeToFrame(shape: any) {
10330
10438
  await restoreHistorySnapshot(historyStack[historyIndex]);
10331
10439
  _hasUnsavedChanges = true;
10332
10440
  onCanvasDirty?.();
10333
- scheduleAutoSave();
10441
+ autosaveScheduler.markChanged();
10334
10442
  }
10335
10443
 
10336
10444
  /** Serialize the current canvas state to a JSON string */
@@ -10552,7 +10660,7 @@ function checkAndAddNewShapeToFrame(shape: any) {
10552
10660
  }
10553
10661
 
10554
10662
  // Cancel any pending autosave from previous operations (e.g. loadCanvas)
10555
- if (_autoSaveTimer) { clearTimeout(_autoSaveTimer); _autoSaveTimer = null; }
10663
+ autosaveScheduler.cancel();
10556
10664
 
10557
10665
  // clear the entire canvas
10558
10666
  canvas.clear();
@@ -12998,8 +13106,9 @@ function checkAndAddNewShapeToFrame(shape: any) {
12998
13106
  </div>
12999
13107
  {/if}
13000
13108
 
13001
- <!-- Toolbar: Positioned at the bottom of the canvas -->
13002
- <CanvasToolbar class="absolute bottom-1 left-1/2 -translate-x-1/2 max-w-[calc(100%-1rem)] {isCanvasLoading ? 'pointer-events-none opacity-60 transition-opacity duration-200' : 'transition-opacity duration-200'}"
13109
+ <!-- Drawing toolbar. After the first generation the host hides it and the selector bar below takes this spot. -->
13110
+ {#if showDrawingTools}
13111
+ <CanvasToolbar class="{toolbarPositionClasses(toolbarPosition)} max-w-[calc(100%-1rem)] {isCanvasLoading ? 'pointer-events-none opacity-60 transition-opacity duration-200' : 'transition-opacity duration-200'}"
13003
13112
  {activeTool}
13004
13113
  {onSelectSelectTool}
13005
13114
  {onSelectEraseTool}
@@ -13037,7 +13146,49 @@ function checkAndAddNewShapeToFrame(shape: any) {
13037
13146
  {onSelectLibraryShapeTool}
13038
13147
  {advancedFeatures}
13039
13148
  {mediaBtsOnBar}
13149
+ {showDrawingTools}
13040
13150
  />
13151
+ {/if}
13152
+ {#if !showDrawingTools && showElementSelector}
13153
+ <div class="widget-selector-bar {toolbarPositionClasses(toolbarPosition)} z-20 flex h-12 w-max flex-nowrap items-center justify-center gap-1.5 whitespace-nowrap rounded-full border border-neutral-200 bg-white px-4 shadow-md">
13154
+ <button
13155
+ class="selector-bt flex items-center justify-center rounded-lg focus:outline-none focus-visible:outline-none {elementSelectorActive ? 'selector-bt-open h-7 w-7 bg-[#314F2F]' : 'h-9 w-9 bg-transparent text-neutral-700'}"
13156
+ onclick={() => onToggleElementSelector?.()}
13157
+ aria-pressed={elementSelectorActive}
13158
+ aria-label={$t('canvas.tool.selector')}
13159
+ >
13160
+ <svg class="selector-icon" width={elementSelectorActive ? 16 : 22} height={elementSelectorActive ? 16 : 22} viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
13161
+ <path d="M5 3a2 2 0 0 0-2 2"/>
13162
+ <path d="M19 3a2 2 0 0 1 2 2"/>
13163
+ <path d="M21 19a2 2 0 0 1-2 2"/>
13164
+ <path d="M5 21a2 2 0 0 1-2-2"/>
13165
+ <path d="M9 3h1"/>
13166
+ <path d="M9 21h1"/>
13167
+ <path d="M14 3h1"/>
13168
+ <path d="M3 9v1"/>
13169
+ <path d="M21 9v1"/>
13170
+ <path d="M3 14v1"/>
13171
+ <path d="m12 12 7 2-3 1.5L14.5 19 12 12Z"/>
13172
+ </svg>
13173
+ </button>
13174
+ {#if elementSelectorActive && selectorGuide}
13175
+ <div class="selector-guide flex flex-nowrap items-center justify-center gap-1.5 whitespace-nowrap text-[11px] font-medium text-neutral-600">
13176
+ <span>{selectorGuide.click}</span>
13177
+ <span class="text-neutral-300">·</span>
13178
+ <kbd class="rounded bg-[#7BA668] px-1.5 py-0.5 font-mono text-[10px] text-white">↑</kbd>
13179
+ <kbd class="rounded bg-[#7BA668] px-1.5 py-0.5 font-mono text-[10px] text-white">↓</kbd>
13180
+ <span>{selectorGuide.parentChild}</span>
13181
+ <span class="text-neutral-300">·</span>
13182
+ <span>{selectorGuide.hold}</span>
13183
+ <kbd class="rounded bg-[#7BA668] px-1.5 py-0.5 font-mono text-[10px] text-white">{selectorGuide.cmd}</kbd>
13184
+ <span>{selectorGuide.interact}</span>
13185
+ <span class="text-neutral-300">·</span>
13186
+ <kbd class="rounded bg-[#7BA668] px-1.5 py-0.5 font-mono text-[10px] text-white">{selectorGuide.esc}</kbd>
13187
+ <span>{selectorGuide.done}</span>
13188
+ </div>
13189
+ {/if}
13190
+ </div>
13191
+ {/if}
13041
13192
 
13042
13193
  {#if canvas && widgetSelectionLayerTarget}
13043
13194
  <WidgetSelectionLayer fabricCanvas={canvas} target={widgetSelectionLayerTarget} {advancedFeatures} />
@@ -13199,4 +13350,14 @@ function checkAndAddNewShapeToFrame(shape: any) {
13199
13350
  max-width: calc(100% - 2rem);
13200
13351
  overflow: visible;
13201
13352
  }
13353
+
13354
+ /* The page paints every button icon grey. The open selector stays white, and grey under the pointer. */
13355
+ .widget-selector-bar button.selector-bt-open svg.selector-icon {
13356
+ color: #ffffff;
13357
+ stroke: #ffffff;
13358
+ }
13359
+ .widget-selector-bar button.selector-bt-open:hover svg.selector-icon {
13360
+ color: #a3a3a3;
13361
+ stroke: #a3a3a3;
13362
+ }
13202
13363
  </style>
@@ -1,4 +1,5 @@
1
1
  import { Canvas } from 'fabric';
2
+ import { type ToolbarPosition } from './toolbarPosition';
2
3
  import type { WidgetConversionPayload, StrokeRecognizer } from './types';
3
4
  interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
4
5
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
@@ -34,16 +35,31 @@ declare const Canvas: $$__sveltets_2_IsomorphicComponent<{
34
35
  metadata: Record<string, any>;
35
36
  }) => void) | null;
36
37
  panZoomPosition?: "TL" | "TC" | "TR" | "BL" | "BC" | "BR";
38
+ toolbarPosition?: ToolbarPosition;
37
39
  wireframeMode?: boolean;
38
40
  advancedFeatures?: boolean;
41
+ /** The element selector on the toolbar. The host owns whether it is on. */ showElementSelector?: boolean;
42
+ /** Drawing tools stay until the first generation. After that, only the selector remains. */ showDrawingTools?: boolean;
43
+ elementSelectorActive?: boolean;
44
+ onToggleElementSelector?: (() => void) | null;
45
+ /** Words for the selector bar that replaces the drawing tools. */ selectorGuide?: {
46
+ click: string;
47
+ parentChild: string;
48
+ hold: string;
49
+ cmd: string;
50
+ interact: string;
51
+ esc: string;
52
+ done: string;
53
+ } | null;
39
54
  /** The zoom pill. Off on the site when debug is off. The save control stays. */ showZoomPanel?: boolean;
40
55
  /** When true and advanced is on, Frame/Image/Video stay on the toolbar. Default true. */ mediaBtsOnBar?: boolean;
41
56
  initialData?: string | null;
42
57
  onReady?: (() => void) | null;
43
58
  isExternalDataLoading?: boolean;
44
59
  onBeforeUnmount?: ((json: string | null) => void) | null;
45
- onAutoSave?: ((json: string | null) => void) | null;
60
+ onAutoSave?: ((json: string | null) => void | Promise<unknown>) | null;
46
61
  autosaveDelayMs?: number;
62
+ autosaveMaxWaitMs?: number;
47
63
  suspendAutosave?: boolean;
48
64
  showSaveButton?: boolean;
49
65
  onCanvasDirty?: (() => void) | null;
@@ -115,6 +131,7 @@ declare const Canvas: $$__sveltets_2_IsomorphicComponent<{
115
131
  setWidgetShapeLivePreviewHiddenImage?: (widgetId: string, hidden: boolean) => void;
116
132
  addWidgetShape?: (widgetId: string, widgetName?: string, gridIndex?: number, totalCount?: number, previewImageUrl?: string | null) => string | null;
117
133
  getLinkedWidgetIds?: () => Set<string>;
134
+ keepOnlyWidgetShape?: (widgetId: string) => number;
118
135
  hydrateWidgetShapeMetadata?: (widgetsById: Map<string, {
119
136
  name?: string | null;
120
137
  thumbnailUrl?: string | null;
@@ -151,6 +168,7 @@ declare const Canvas: $$__sveltets_2_IsomorphicComponent<{
151
168
  onUngroupSelection?: () => void;
152
169
  onSelectAllObjects?: () => void;
153
170
  onDeselectAllObjects?: () => void;
171
+ flushAutosave?: () => Promise<void>;
154
172
  saveNow?: () => void;
155
173
  undo?: () => Promise<void>;
156
174
  redo?: () => Promise<void>;
@@ -213,6 +231,7 @@ declare const Canvas: $$__sveltets_2_IsomorphicComponent<{
213
231
  setWidgetShapeLivePreviewHiddenImage: (widgetId: string, hidden: boolean) => void;
214
232
  addWidgetShape: (widgetId: string, widgetName?: string, gridIndex?: number, totalCount?: number, previewImageUrl?: string | null) => string | null;
215
233
  getLinkedWidgetIds: () => Set<string>;
234
+ keepOnlyWidgetShape: (widgetId: string) => number;
216
235
  hydrateWidgetShapeMetadata: (widgetsById: Map<string, {
217
236
  name?: string | null;
218
237
  thumbnailUrl?: string | null;
@@ -249,6 +268,7 @@ declare const Canvas: $$__sveltets_2_IsomorphicComponent<{
249
268
  onUngroupSelection: () => void;
250
269
  onSelectAllObjects: () => void;
251
270
  onDeselectAllObjects: () => void;
271
+ flushAutosave: () => Promise<void>;
252
272
  saveNow: () => void;
253
273
  undo: () => Promise<void>;
254
274
  redo: () => Promise<void>;
@@ -67,6 +67,9 @@
67
67
  export let stickyToolEnabled: boolean = false;
68
68
  export let onToggleStickyTool: () => void = () => {};
69
69
 
70
+ /** Pencil, eraser, select, arrow and text. Off after the widget has been generated. */
71
+ export let showDrawingTools: boolean = true;
72
+
70
73
  // ── Shape library (special shapes: media, arrows, UI) ────────────────────
71
74
  /** Called when user clicks a library shape. Canvas inserts it as a Path. */
72
75
  /** Passed by Canvas.svelte but never read here — export const keeps the
@@ -392,7 +395,12 @@
392
395
  if (event.altKey) return;
393
396
 
394
397
  const key = event.key.toUpperCase();
395
-
398
+ // Hidden tools must not answer their keys. The bar is gone; the letter would still start a pencil or a text box.
399
+ const drawingKey = key === 'V' || key === 'E' || key === 'D' || key === 'A' || key === 'T';
400
+ const shapeKey = key === 'R' || key === 'G' || key === 'O' || key === 'F' || key === 'I' || key === 'H';
401
+ if (drawingKey && !showDrawingTools) return;
402
+ if (shapeKey && !advancedFeatures) return;
403
+
396
404
  // Map keys to handlers — using current prop references
397
405
  switch (key) {
398
406
  case 'V': event.preventDefault(); onSelectSelectTool(); break;
@@ -550,6 +558,7 @@
550
558
  <div class="toolbar-divider"></div>
551
559
  {/if}
552
560
 
561
+ {#if showDrawingTools}
553
562
  <!-- ══ Illustrated tools: Pencil & Eraser — "pulled from sheath" on select ══ -->
554
563
  <!-- Each tool is wrapped in a mask container that clips its body at rest.
555
564
  When active, overflow becomes visible so the tool "pops out" above the toolbar. -->
@@ -643,6 +652,7 @@
643
652
  </svg>
644
653
  </button>
645
654
  </Tooltip>
655
+ {/if}
646
656
 
647
657
  {#if showMediaOnBar}
648
658
  <div class="toolbar-divider"></div>
@@ -42,6 +42,7 @@ declare const CanvasToolbar: $$__sveltets_2_IsomorphicComponent<{
42
42
  /** Disables the Redo button when there is no future state to redo to. */ canRedo?: boolean;
43
43
  /** When true, the drawing tool stays active after placing a shape. */ stickyToolEnabled?: boolean;
44
44
  onToggleStickyTool?: () => void;
45
+ /** Pencil, eraser, select, arrow and text. Off after the widget has been generated. */ showDrawingTools?: boolean;
45
46
  /** Passed by Canvas.svelte but never read here — export const keeps the
46
47
  * init-set contract without the unused-reactive warning. */ onInsertLibraryShape?: (shapeKey: string, pathData: string) => void;
47
48
  /** Draw-to-place: activates library shape tool so user clicks-and-drags to size it. */ onSelectLibraryShapeTool?: (shapeKey: string, pathData: string) => void;
@@ -0,0 +1,58 @@
1
+ /**
2
+ * The buffer between a person who edits the board and the server that keeps it.
3
+ *
4
+ * A save is not made at every change: a drag, a run of nudges or a long stretch of drawing would send the whole board
5
+ * to the server fifty times. The scheduler keeps the rule in one place:
6
+ *
7
+ * - a save starts after a **quiet delay** since the last change (a trailing debounce), so a burst is one save;
8
+ * - a person who never pauses still gets a save every **longest wait**, so a crash costs seconds, not minutes;
9
+ * - a save is **held back** while the host asks for it (a code generation makes the page thread busy), for as long as
10
+ * the host asks, however long that is;
11
+ * - **one save at a time**: when a save is still on its way at the moment the next one is due, the next waits for it
12
+ * and everything that changed meanwhile goes out in a single save after it. A slow server is never flooded;
13
+ * - **flush** sends whatever is unsaved at once, whatever the delay and the hold, for the moments a page is about to
14
+ * go (the tab goes to the background, the page is hidden, the editor closes);
15
+ * - a save that fails leaves the changes unsaved and says so, and **does not try again by itself**: the next change, or
16
+ * the next flush, is the retry. A server that is down is not hammered.
17
+ *
18
+ * Kept free of Svelte and of the DOM (the clock can be replaced) so that Node can test it.
19
+ */
20
+ /** The clock the scheduler reads and sets timers with. Tests pass one they move by hand. */
21
+ export interface AutosaveClock {
22
+ /** Milliseconds, from any fixed point. */
23
+ now(): number;
24
+ /** Calls `callback` once, `delayMs` from now. Returns what {@link clearTimer} needs to take it back. */
25
+ setTimer(callback: () => void, delayMs: number): unknown;
26
+ clearTimer(handle: unknown): void;
27
+ }
28
+ export interface AutosaveSchedulerOptions {
29
+ /** The quiet time after the last change before a save starts, in milliseconds. Read at every change. */
30
+ getDelayMs: () => number;
31
+ /** The longest a change waits before a save starts, however busy the person stays. 0 means no limit. Read at every change. */
32
+ getMaxWaitMs: () => number;
33
+ /**
34
+ * Makes the save. It may return a promise: while that is pending, no second save starts. A save that throws or
35
+ * rejects counts as failed. A save that finds it has nothing to save yet (the board is still loading) calls
36
+ * {@link AutosaveScheduler.markChanged} again to ask for another go a delay later.
37
+ */
38
+ save: () => void | Promise<unknown>;
39
+ /** True while the host wants saves to wait. A save that falls due then looks again a delay later. */
40
+ isSuspended?: () => boolean;
41
+ /** Told when a save failed. The changes stay unsaved. */
42
+ onSaveFailed?: (error: unknown) => void;
43
+ /** Defaults to the real one. */
44
+ clock?: AutosaveClock;
45
+ }
46
+ export interface AutosaveScheduler {
47
+ /** Something changed that is not saved: starts (or restarts) the quiet delay. */
48
+ markChanged(): void;
49
+ /** Saves whatever is unsaved now, after a save that is on its way, whatever the delay and the hold. Resolves once it is done. Never rejects. */
50
+ flush(): Promise<void>;
51
+ /** Forgets what is unsaved, and the time it has waited: the board was just loaded, so what is on it is what is saved. A save on its way is left alone. */
52
+ cancel(): void;
53
+ /** Stops for good: nothing is saved afterwards. */
54
+ dispose(): void;
55
+ /** Whether something changed that no save has taken yet. */
56
+ readonly isDirty: boolean;
57
+ }
58
+ export declare function createAutosaveScheduler(options: AutosaveSchedulerOptions): AutosaveScheduler;
@@ -0,0 +1,157 @@
1
+ /**
2
+ * The buffer between a person who edits the board and the server that keeps it.
3
+ *
4
+ * A save is not made at every change: a drag, a run of nudges or a long stretch of drawing would send the whole board
5
+ * to the server fifty times. The scheduler keeps the rule in one place:
6
+ *
7
+ * - a save starts after a **quiet delay** since the last change (a trailing debounce), so a burst is one save;
8
+ * - a person who never pauses still gets a save every **longest wait**, so a crash costs seconds, not minutes;
9
+ * - a save is **held back** while the host asks for it (a code generation makes the page thread busy), for as long as
10
+ * the host asks, however long that is;
11
+ * - **one save at a time**: when a save is still on its way at the moment the next one is due, the next waits for it
12
+ * and everything that changed meanwhile goes out in a single save after it. A slow server is never flooded;
13
+ * - **flush** sends whatever is unsaved at once, whatever the delay and the hold, for the moments a page is about to
14
+ * go (the tab goes to the background, the page is hidden, the editor closes);
15
+ * - a save that fails leaves the changes unsaved and says so, and **does not try again by itself**: the next change, or
16
+ * the next flush, is the retry. A server that is down is not hammered.
17
+ *
18
+ * Kept free of Svelte and of the DOM (the clock can be replaced) so that Node can test it.
19
+ */
20
+ /** The shortest time a save that is held back waits before the host is asked again, so that a delay of 0 does not spin. */
21
+ const SHORTEST_RECHECK_DELAY_MS = 250;
22
+ const realClock = {
23
+ now: () => Date.now(),
24
+ setTimer: (callback, delayMs) => setTimeout(callback, delayMs),
25
+ clearTimer: (handle) => clearTimeout(handle)
26
+ };
27
+ /** A number a host passed as a duration: anything that is not a finite number of at least 0 is 0. */
28
+ function toDurationMs(value) {
29
+ return Number.isFinite(value) && value > 0 ? value : 0;
30
+ }
31
+ function isPromiseLike(value) {
32
+ return !!value && typeof value.then === 'function';
33
+ }
34
+ export function createAutosaveScheduler(options) {
35
+ const clock = options.clock ?? realClock;
36
+ /** Something changed that no save has taken yet. */
37
+ let dirty = false;
38
+ /** When the first change that no save has taken yet was made: where the longest wait is counted from. */
39
+ let firstChangeAt = null;
40
+ let timerHandle = null;
41
+ /** The save that is on its way, if there is one. It never rejects. */
42
+ let saveOnItsWay = null;
43
+ /** The next save fell due while another was on its way: it starts as soon as that one is done. */
44
+ let dueWhileSaving = false;
45
+ let disposed = false;
46
+ function stopTimer() {
47
+ if (timerHandle === null)
48
+ return;
49
+ clock.clearTimer(timerHandle);
50
+ timerHandle = null;
51
+ }
52
+ function startTimer(waitMs) {
53
+ stopTimer();
54
+ timerHandle = clock.setTimer(onTimerFired, Math.max(0, waitMs));
55
+ }
56
+ function onTimerFired() {
57
+ timerHandle = null;
58
+ if (disposed)
59
+ return;
60
+ if (saveOnItsWay) {
61
+ // One save at a time: this one starts when the one on its way is done.
62
+ dueWhileSaving = true;
63
+ return;
64
+ }
65
+ saveUnlessHeldBack();
66
+ }
67
+ /** Starts the save, or, when the host holds saves back, looks again a delay later. */
68
+ function saveUnlessHeldBack() {
69
+ if (options.isSuspended?.()) {
70
+ startTimer(Math.max(toDurationMs(options.getDelayMs()), SHORTEST_RECHECK_DELAY_MS));
71
+ return;
72
+ }
73
+ void startSave();
74
+ }
75
+ function noteFailure(error) {
76
+ // What the failed save was meant to keep is not kept: it is unsaved again, and the next change or flush tries again.
77
+ dirty = true;
78
+ try {
79
+ options.onSaveFailed?.(error);
80
+ }
81
+ catch (reportError) {
82
+ console.warn('[autosave] onSaveFailed threw', reportError);
83
+ }
84
+ }
85
+ /** Takes everything unsaved into a save, now. The promise it returns never rejects and settles when the save is done. */
86
+ function startSave() {
87
+ stopTimer();
88
+ // What is unsaved goes into this save. Anything that changes from here on (a save that asks for another go, a change
89
+ // made while the save is on its way) is unsaved again, and is the next save's.
90
+ dirty = false;
91
+ firstChangeAt = null;
92
+ let outcome;
93
+ try {
94
+ outcome = options.save();
95
+ }
96
+ catch (error) {
97
+ noteFailure(error);
98
+ return Promise.resolve();
99
+ }
100
+ if (!isPromiseLike(outcome))
101
+ return Promise.resolve();
102
+ const running = Promise.resolve(outcome)
103
+ .then(() => undefined, (error) => noteFailure(error))
104
+ .then(() => {
105
+ if (saveOnItsWay === running)
106
+ saveOnItsWay = null;
107
+ if (disposed)
108
+ return;
109
+ if (dueWhileSaving && dirty) {
110
+ dueWhileSaving = false;
111
+ saveUnlessHeldBack();
112
+ }
113
+ });
114
+ saveOnItsWay = running;
115
+ return running;
116
+ }
117
+ function markChanged() {
118
+ if (disposed)
119
+ return;
120
+ const now = clock.now();
121
+ dirty = true;
122
+ if (firstChangeAt === null)
123
+ firstChangeAt = now;
124
+ const quietUntil = now + toDurationMs(options.getDelayMs());
125
+ const longestWait = toDurationMs(options.getMaxWaitMs());
126
+ const dueAt = longestWait > 0 ? Math.min(quietUntil, firstChangeAt + longestWait) : quietUntil;
127
+ startTimer(dueAt - now);
128
+ }
129
+ async function flush() {
130
+ // A save on its way finishes first, so that two never overlap.
131
+ while (saveOnItsWay)
132
+ await saveOnItsWay;
133
+ // Nothing changed since the last save (or the last failure left nothing unsaved): there is nothing to send.
134
+ if (disposed || !dirty)
135
+ return;
136
+ await startSave();
137
+ }
138
+ function cancel() {
139
+ stopTimer();
140
+ dirty = false;
141
+ firstChangeAt = null;
142
+ dueWhileSaving = false;
143
+ }
144
+ function dispose() {
145
+ cancel();
146
+ disposed = true;
147
+ }
148
+ return {
149
+ markChanged,
150
+ flush,
151
+ cancel,
152
+ dispose,
153
+ get isDirty() {
154
+ return dirty;
155
+ }
156
+ };
157
+ }
@@ -10,6 +10,8 @@ export { default as ContextMenu } from './ContextMenu.svelte';
10
10
  export { default as PanZoomPanel } from './PanZoomPanel.svelte';
11
11
  export { default as PropsPanel } from './props-panel/PropsPanel.svelte';
12
12
  export type { WidgetConversionPayload } from './types';
13
+ export { TOOLBAR_POSITIONS, DEFAULT_TOOLBAR_POSITION } from './toolbarPosition';
14
+ export type { ToolbarPosition } from './toolbarPosition';
13
15
  export type { StrokeRecognizer, StrokeRecognitionRequest, StrokeRecognitionResult } from './types';
14
16
  export { CANVAS_SHAPE_SNAP_ENABLED, STROKE_SNAP_IMAGE_SIDE, projectStrokeToImagePoints, renderStrokeSnapImage } from './shapes/strokeShapeSnap';
15
17
  export { canvasLog, canvasWarn, canvasDebug, setCanvasLogsEnabled, isCanvasLogsEnabled } from './canvasLogger';
@@ -9,6 +9,8 @@ export { default as CanvasToolbar } from './CanvasToolbar.svelte';
9
9
  export { default as ContextMenu } from './ContextMenu.svelte';
10
10
  export { default as PanZoomPanel } from './PanZoomPanel.svelte';
11
11
  export { default as PropsPanel } from './props-panel/PropsPanel.svelte';
12
+ // Where the drawing toolbar stands along the bottom edge of the board (the `toolbarPosition` option of <Canvas>)
13
+ export { TOOLBAR_POSITIONS, DEFAULT_TOOLBAR_POSITION } from './toolbarPosition';
12
14
  export { CANVAS_SHAPE_SNAP_ENABLED, STROKE_SNAP_IMAGE_SIDE, projectStrokeToImagePoints, renderStrokeSnapImage } from './shapes/strokeShapeSnap';
13
15
  export { canvasLog, canvasWarn, canvasDebug, setCanvasLogsEnabled, isCanvasLogsEnabled } from './canvasLogger';
14
16
  export { setShapeImageStore, getShapeImageStore } from './shapes/shapeImageStore';
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Where the drawing toolbar stands along the bottom edge of the board.
3
+ *
4
+ * The toolbar has always been at the bottom centre. A host that has something of its own there (Shopify's Sidekick
5
+ * sits in the same spot, a partner may have a cookie bar or a chat bubble) names the corner it wants with the
6
+ * `toolbarPosition` option instead. The selector bar that replaces the toolbar after the first generation stands in the
7
+ * same place, so the two never jump around when one takes over from the other.
8
+ *
9
+ * Kept free of Svelte and of the DOM so that Node can test it.
10
+ */
11
+ /** The places the toolbar can stand: the bottom left, the bottom centre and the bottom right of the board. */
12
+ export declare const TOOLBAR_POSITIONS: readonly ["BL", "BC", "BR"];
13
+ /** One of {@link TOOLBAR_POSITIONS}. */
14
+ export type ToolbarPosition = (typeof TOOLBAR_POSITIONS)[number];
15
+ /** Where the toolbar stands when the host says nothing: the bottom centre, as it always did. */
16
+ export declare const DEFAULT_TOOLBAR_POSITION: ToolbarPosition;
17
+ /**
18
+ * The position to use for what a host passed. Anything that is not one of the three (a corner at the top, a word in
19
+ * lower case, nothing at all) is the default, so that a mistake in the host's option never takes the toolbar off the
20
+ * board.
21
+ */
22
+ export declare function normalizeToolbarPosition(value: unknown): ToolbarPosition;
23
+ /** The classes that put the toolbar (or the selector bar) where the host asked, on the line it has always been on. */
24
+ export declare function toolbarPositionClasses(value: unknown): string;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Where the drawing toolbar stands along the bottom edge of the board.
3
+ *
4
+ * The toolbar has always been at the bottom centre. A host that has something of its own there (Shopify's Sidekick
5
+ * sits in the same spot, a partner may have a cookie bar or a chat bubble) names the corner it wants with the
6
+ * `toolbarPosition` option instead. The selector bar that replaces the toolbar after the first generation stands in the
7
+ * same place, so the two never jump around when one takes over from the other.
8
+ *
9
+ * Kept free of Svelte and of the DOM so that Node can test it.
10
+ */
11
+ /** The places the toolbar can stand: the bottom left, the bottom centre and the bottom right of the board. */
12
+ export const TOOLBAR_POSITIONS = ['BL', 'BC', 'BR'];
13
+ /** Where the toolbar stands when the host says nothing: the bottom centre, as it always did. */
14
+ export const DEFAULT_TOOLBAR_POSITION = 'BC';
15
+ /**
16
+ * The classes that put the toolbar in place. Written out in full, so that the stylesheet of a page that installs the
17
+ * canvas picks every one of them up when it reads this file.
18
+ */
19
+ const TOOLBAR_POSITION_CLASSES = {
20
+ // rtl-ok: the page names a corner of the screen, as it is drawn
21
+ BL: 'absolute bottom-1 left-2',
22
+ BC: 'absolute bottom-1 left-1/2 -translate-x-1/2',
23
+ // rtl-ok: the page names a corner of the screen, as it is drawn
24
+ BR: 'absolute bottom-1 right-2'
25
+ };
26
+ /**
27
+ * The position to use for what a host passed. Anything that is not one of the three (a corner at the top, a word in
28
+ * lower case, nothing at all) is the default, so that a mistake in the host's option never takes the toolbar off the
29
+ * board.
30
+ */
31
+ export function normalizeToolbarPosition(value) {
32
+ return TOOLBAR_POSITIONS.includes(value) ? value : DEFAULT_TOOLBAR_POSITION;
33
+ }
34
+ /** The classes that put the toolbar (or the selector bar) where the host asked, on the line it has always been on. */
35
+ export function toolbarPositionClasses(value) {
36
+ return TOOLBAR_POSITION_CLASSES[normalizeToolbarPosition(value)];
37
+ }
@@ -3,18 +3,18 @@ import { type MessageOverrides, type MessageProblem } from '@widgetic/design-sys
3
3
  * Called by the root component of a canvas while it is created, so everything inside it speaks the page's language.
4
4
  * It gives back the words as stores and `update(settings)` for when the page sets the language again.
5
5
  */
6
- export declare const provideCanvasLanguage: (initial: import("@widgetic/design-system/i18n").I18nSettings) => import("@widgetic/design-system/i18n").I18nHandle<"canvas.state.loading" | "canvas.state.initFailed" | "canvas.error.imageFromUrl" | "canvas.defaults.textBox" | "canvas.defaults.frameLabel" | "canvas.defaults.untitledFrame" | "canvas.defaults.untitledShape" | "canvas.draw.dropImage" | "canvas.draw.dropVideo" | "canvas.draw.or" | "canvas.draw.doubleClick" | "canvas.draw.widgetName" | "canvas.draw.widgetPreview" | "canvas.tool.select" | "canvas.tool.hand" | "canvas.tool.erase" | "canvas.tool.draw" | "canvas.tool.arrow" | "canvas.tool.rectangle" | "canvas.tool.triangle" | "canvas.tool.ellipse" | "canvas.tool.circle" | "canvas.tool.frame" | "canvas.tool.text" | "canvas.tool.image" | "canvas.tool.video" | "canvas.tool.shapes" | "canvas.tool.moreShapes" | "canvas.tool.undo" | "canvas.tool.redo" | "canvas.tool.withKey" | "canvas.tool.undoTitle" | "canvas.tool.redoTitle" | "canvas.tool.stickyOn" | "canvas.tool.stickyOff" | "canvas.tool.stickyLabel" | "canvas.menu.mediaShapes" | "canvas.category.geometric" | "canvas.category.arrows" | "canvas.category.media" | "canvas.category.ui" | "canvas.category.symbols" | "canvas.shape.hexagon" | "canvas.shape.oval" | "canvas.shape.play" | "canvas.shape.pause" | "canvas.shape.stop" | "canvas.shape.rewind" | "canvas.shape.fastForward" | "canvas.shape.record" | "canvas.shape.arrowRight" | "canvas.shape.arrowLeft" | "canvas.shape.arrowUp" | "canvas.shape.arrowDown" | "canvas.shape.doubleArrow" | "canvas.shape.curvedArrow" | "canvas.shape.checkMark" | "canvas.shape.cross" | "canvas.shape.plus" | "canvas.shape.minus" | "canvas.shape.info" | "canvas.shape.warning" | "canvas.shape.star" | "canvas.shape.heart" | "canvas.shape.speechBubble" | "canvas.shape.rhombus" | "canvas.shape.lightning" | "canvas.shape.shield" | "canvas.action.cut" | "canvas.action.copy" | "canvas.action.paste" | "canvas.action.duplicate" | "canvas.action.delete" | "canvas.action.group" | "canvas.action.ungroup" | "canvas.action.selectAll" | "canvas.action.clearAll" | "canvas.layer.title" | "canvas.layer.front" | "canvas.layer.forward" | "canvas.layer.backward" | "canvas.layer.back" | "canvas.layer.frontShort" | "canvas.layer.upShort" | "canvas.layer.downShort" | "canvas.layer.backShort" | "canvas.shortcuts.title" | "canvas.shortcuts.close" | "canvas.shortcuts.footer" | "canvas.shortcuts.footerHint" | "canvas.shortcuts.groupTools" | "canvas.shortcuts.groupSelection" | "canvas.shortcuts.groupHistory" | "canvas.shortcuts.groupZoom" | "canvas.shortcuts.drillThrough" | "canvas.shortcuts.redoAlt" | "canvas.shortcuts.save" | "canvas.shortcuts.zoomIn" | "canvas.shortcuts.zoomOut" | "canvas.shortcuts.zoomReset" | "canvas.shortcuts.fit" | "canvas.shortcuts.pan" | "canvas.shortcuts.move1" | "canvas.shortcuts.move10" | "canvas.shortcuts.frameResize" | "canvas.shortcuts.frameEdit" | "canvas.key.ctrlCmd" | "canvas.key.alt" | "canvas.key.shift" | "canvas.key.delete" | "canvas.key.space" | "canvas.key.click" | "canvas.key.drag" | "canvas.key.dragCorner" | "canvas.key.doubleClick" | "canvas.zoom.expandTitle" | "canvas.zoom.expandLabel" | "canvas.zoom.gridTitle" | "canvas.zoom.gridLabel" | "canvas.zoom.panTitle" | "canvas.zoom.panLabel" | "canvas.zoom.panBanner" | "canvas.zoom.outTitle" | "canvas.zoom.outLabel" | "canvas.zoom.inTitle" | "canvas.zoom.inLabel" | "canvas.zoom.resetTitle" | "canvas.zoom.resetLabel" | "canvas.zoom.levelLabel" | "canvas.zoom.oneToOneTitle" | "canvas.zoom.fitTitle" | "canvas.zoom.fitLabel" | "canvas.zoom.shortcutsTitle" | "canvas.zoom.shortcutsLabel" | "canvas.zoom.unsavedTitle" | "canvas.zoom.savedTitle" | "canvas.zoom.minimize" | "canvas.props.shape" | "canvas.props.showAll" | "canvas.props.showFewer" | "canvas.props.close" | "canvas.props.children" | "canvas.props.actions" | "canvas.props.general" | "canvas.props.dimensions" | "canvas.props.width" | "canvas.props.height" | "canvas.props.proportionsFixed" | "canvas.props.proportionsUnlock" | "canvas.props.proportionsLock" | "canvas.props.textProperties" | "canvas.props.labelProperties" | "canvas.props.boxProperties" | "canvas.props.groupBox" | "canvas.props.labelText" | "canvas.props.labelPlaceholder" | "canvas.props.textBackground" | "canvas.type.none" | "canvas.type.widget" | "canvas.type.drawing" | "canvas.type.line" | "canvas.type.group" | "canvas.type.selection" | "canvas.type.drawingOf" | "canvas.type.customShape" | "canvas.field.opacity" | "canvas.field.cornerRoundness" | "canvas.field.backgroundColor" | "canvas.field.backgroundOpacity" | "canvas.field.fillColor" | "canvas.field.fillOpacity" | "canvas.field.strokeColor" | "canvas.field.strokeWidth" | "canvas.field.strokeType" | "canvas.field.strokeSolid" | "canvas.field.strokeDashed" | "canvas.field.strokeDotted" | "canvas.field.fontSize" | "canvas.field.textPadding" | "canvas.field.textColor" | "canvas.field.textStrokeColor" | "canvas.field.textStrokeWidth" | "canvas.field.groupFillColor" | "canvas.field.groupFillOpacity" | "canvas.field.groupStrokeColor" | "canvas.field.groupStrokeWidth" | "canvas.field.groupStrokeType" | "canvas.arrange.title" | "canvas.arrange.left" | "canvas.arrange.centerH" | "canvas.arrange.right" | "canvas.arrange.top" | "canvas.arrange.middleV" | "canvas.arrange.bottom" | "canvas.image.source" | "canvas.image.file" | "canvas.image.noFile" | "canvas.image.changeFile" | "canvas.image.chooseFile" | "canvas.image.url" | "canvas.image.pasteUrl" | "canvas.image.newUrl" | "canvas.image.load" | "canvas.widget.createPreview" | "canvas.widget.capture" | "canvas.widget.linked" | "canvas.widget.converting" | "canvas.widget.duplicating" | "canvas.widget.linking" | "canvas.widget.unlinkedTitle" | "canvas.widget.orphanNotice" | "canvas.widget.removeFromCanvas" | "canvas.widget.namePlaceholder" | "canvas.widget.openDetails" | "canvas.widget.refreshPreview" | "canvas.widget.primary" | "canvas.widget.primaryTitle" | "canvas.widget.setPrimary" | "canvas.widget.convertLabel" | "canvas.widget.convertButton" | "canvas.widget.unlinkedName" | "canvas.control.color" | "canvas.control.value" | "canvas.control.openPicker" | "canvas.control.removeColor" | "canvas.control.fontFamily" | "canvas.control.textStyle" | "canvas.control.bold" | "canvas.control.boldMark" | "canvas.control.italic" | "canvas.control.italicMark" | "canvas.control.underline" | "canvas.control.underlineMark" | "canvas.control.textAlign" | "canvas.control.alignLeft" | "canvas.control.alignCenter" | "canvas.control.alignRight">;
6
+ export declare const provideCanvasLanguage: (initial: import("@widgetic/design-system/i18n").I18nSettings) => import("@widgetic/design-system/i18n").I18nHandle<"canvas.state.loading" | "canvas.state.initFailed" | "canvas.error.imageFromUrl" | "canvas.defaults.textBox" | "canvas.defaults.frameLabel" | "canvas.defaults.untitledFrame" | "canvas.defaults.untitledShape" | "canvas.draw.dropImage" | "canvas.draw.dropVideo" | "canvas.draw.or" | "canvas.draw.doubleClick" | "canvas.draw.widgetName" | "canvas.draw.widgetPreview" | "canvas.tool.select" | "canvas.tool.hand" | "canvas.tool.erase" | "canvas.tool.draw" | "canvas.tool.arrow" | "canvas.tool.rectangle" | "canvas.tool.triangle" | "canvas.tool.ellipse" | "canvas.tool.circle" | "canvas.tool.frame" | "canvas.tool.text" | "canvas.tool.selector" | "canvas.tool.image" | "canvas.tool.video" | "canvas.tool.shapes" | "canvas.tool.moreShapes" | "canvas.tool.undo" | "canvas.tool.redo" | "canvas.tool.withKey" | "canvas.tool.undoTitle" | "canvas.tool.redoTitle" | "canvas.tool.stickyOn" | "canvas.tool.stickyOff" | "canvas.tool.stickyLabel" | "canvas.menu.mediaShapes" | "canvas.category.geometric" | "canvas.category.arrows" | "canvas.category.media" | "canvas.category.ui" | "canvas.category.symbols" | "canvas.shape.hexagon" | "canvas.shape.oval" | "canvas.shape.play" | "canvas.shape.pause" | "canvas.shape.stop" | "canvas.shape.rewind" | "canvas.shape.fastForward" | "canvas.shape.record" | "canvas.shape.arrowRight" | "canvas.shape.arrowLeft" | "canvas.shape.arrowUp" | "canvas.shape.arrowDown" | "canvas.shape.doubleArrow" | "canvas.shape.curvedArrow" | "canvas.shape.checkMark" | "canvas.shape.cross" | "canvas.shape.plus" | "canvas.shape.minus" | "canvas.shape.info" | "canvas.shape.warning" | "canvas.shape.star" | "canvas.shape.heart" | "canvas.shape.speechBubble" | "canvas.shape.rhombus" | "canvas.shape.lightning" | "canvas.shape.shield" | "canvas.action.cut" | "canvas.action.copy" | "canvas.action.paste" | "canvas.action.duplicate" | "canvas.action.delete" | "canvas.action.group" | "canvas.action.ungroup" | "canvas.action.selectAll" | "canvas.action.clearAll" | "canvas.layer.title" | "canvas.layer.front" | "canvas.layer.forward" | "canvas.layer.backward" | "canvas.layer.back" | "canvas.layer.frontShort" | "canvas.layer.upShort" | "canvas.layer.downShort" | "canvas.layer.backShort" | "canvas.shortcuts.title" | "canvas.shortcuts.close" | "canvas.shortcuts.footer" | "canvas.shortcuts.footerHint" | "canvas.shortcuts.groupTools" | "canvas.shortcuts.groupSelection" | "canvas.shortcuts.groupHistory" | "canvas.shortcuts.groupZoom" | "canvas.shortcuts.drillThrough" | "canvas.shortcuts.redoAlt" | "canvas.shortcuts.save" | "canvas.shortcuts.zoomIn" | "canvas.shortcuts.zoomOut" | "canvas.shortcuts.zoomReset" | "canvas.shortcuts.fit" | "canvas.shortcuts.pan" | "canvas.shortcuts.move1" | "canvas.shortcuts.move10" | "canvas.shortcuts.frameResize" | "canvas.shortcuts.frameEdit" | "canvas.key.ctrlCmd" | "canvas.key.alt" | "canvas.key.shift" | "canvas.key.delete" | "canvas.key.space" | "canvas.key.click" | "canvas.key.drag" | "canvas.key.dragCorner" | "canvas.key.doubleClick" | "canvas.zoom.expandTitle" | "canvas.zoom.expandLabel" | "canvas.zoom.gridTitle" | "canvas.zoom.gridLabel" | "canvas.zoom.panTitle" | "canvas.zoom.panLabel" | "canvas.zoom.panBanner" | "canvas.zoom.outTitle" | "canvas.zoom.outLabel" | "canvas.zoom.inTitle" | "canvas.zoom.inLabel" | "canvas.zoom.resetTitle" | "canvas.zoom.resetLabel" | "canvas.zoom.levelLabel" | "canvas.zoom.oneToOneTitle" | "canvas.zoom.fitTitle" | "canvas.zoom.fitLabel" | "canvas.zoom.shortcutsTitle" | "canvas.zoom.shortcutsLabel" | "canvas.zoom.unsavedTitle" | "canvas.zoom.savedTitle" | "canvas.zoom.minimize" | "canvas.props.shape" | "canvas.props.showAll" | "canvas.props.showFewer" | "canvas.props.close" | "canvas.props.children" | "canvas.props.actions" | "canvas.props.general" | "canvas.props.dimensions" | "canvas.props.width" | "canvas.props.height" | "canvas.props.proportionsFixed" | "canvas.props.proportionsUnlock" | "canvas.props.proportionsLock" | "canvas.props.textProperties" | "canvas.props.labelProperties" | "canvas.props.boxProperties" | "canvas.props.groupBox" | "canvas.props.labelText" | "canvas.props.labelPlaceholder" | "canvas.props.textBackground" | "canvas.type.none" | "canvas.type.widget" | "canvas.type.drawing" | "canvas.type.line" | "canvas.type.group" | "canvas.type.selection" | "canvas.type.drawingOf" | "canvas.type.customShape" | "canvas.field.opacity" | "canvas.field.cornerRoundness" | "canvas.field.backgroundColor" | "canvas.field.backgroundOpacity" | "canvas.field.fillColor" | "canvas.field.fillOpacity" | "canvas.field.strokeColor" | "canvas.field.strokeWidth" | "canvas.field.strokeType" | "canvas.field.strokeSolid" | "canvas.field.strokeDashed" | "canvas.field.strokeDotted" | "canvas.field.fontSize" | "canvas.field.textPadding" | "canvas.field.textColor" | "canvas.field.textStrokeColor" | "canvas.field.textStrokeWidth" | "canvas.field.groupFillColor" | "canvas.field.groupFillOpacity" | "canvas.field.groupStrokeColor" | "canvas.field.groupStrokeWidth" | "canvas.field.groupStrokeType" | "canvas.arrange.title" | "canvas.arrange.left" | "canvas.arrange.centerH" | "canvas.arrange.right" | "canvas.arrange.top" | "canvas.arrange.middleV" | "canvas.arrange.bottom" | "canvas.image.source" | "canvas.image.file" | "canvas.image.noFile" | "canvas.image.changeFile" | "canvas.image.chooseFile" | "canvas.image.url" | "canvas.image.pasteUrl" | "canvas.image.newUrl" | "canvas.image.load" | "canvas.widget.createPreview" | "canvas.widget.capture" | "canvas.widget.linked" | "canvas.widget.converting" | "canvas.widget.duplicating" | "canvas.widget.linking" | "canvas.widget.unlinkedTitle" | "canvas.widget.orphanNotice" | "canvas.widget.removeFromCanvas" | "canvas.widget.namePlaceholder" | "canvas.widget.openDetails" | "canvas.widget.refreshPreview" | "canvas.widget.primary" | "canvas.widget.primaryTitle" | "canvas.widget.setPrimary" | "canvas.widget.convertLabel" | "canvas.widget.convertButton" | "canvas.widget.unlinkedName" | "canvas.control.color" | "canvas.control.value" | "canvas.control.openPicker" | "canvas.control.removeColor" | "canvas.control.fontFamily" | "canvas.control.textStyle" | "canvas.control.bold" | "canvas.control.boldMark" | "canvas.control.italic" | "canvas.control.italicMark" | "canvas.control.underline" | "canvas.control.underlineMark" | "canvas.control.textAlign" | "canvas.control.alignLeft" | "canvas.control.alignCenter" | "canvas.control.alignRight">;
7
7
  /**
8
8
  * Called by a part of the canvas while it is created. Gives its words as stores, so a part that is already on the screen
9
9
  * changes when the page sets the language again. Outside a canvas (a part used on its own, such as the colour control)
10
10
  * it speaks English.
11
11
  */
12
- export declare const useCanvasLanguage: () => import("@widgetic/design-system/i18n").I18nContext<"canvas.state.loading" | "canvas.state.initFailed" | "canvas.error.imageFromUrl" | "canvas.defaults.textBox" | "canvas.defaults.frameLabel" | "canvas.defaults.untitledFrame" | "canvas.defaults.untitledShape" | "canvas.draw.dropImage" | "canvas.draw.dropVideo" | "canvas.draw.or" | "canvas.draw.doubleClick" | "canvas.draw.widgetName" | "canvas.draw.widgetPreview" | "canvas.tool.select" | "canvas.tool.hand" | "canvas.tool.erase" | "canvas.tool.draw" | "canvas.tool.arrow" | "canvas.tool.rectangle" | "canvas.tool.triangle" | "canvas.tool.ellipse" | "canvas.tool.circle" | "canvas.tool.frame" | "canvas.tool.text" | "canvas.tool.image" | "canvas.tool.video" | "canvas.tool.shapes" | "canvas.tool.moreShapes" | "canvas.tool.undo" | "canvas.tool.redo" | "canvas.tool.withKey" | "canvas.tool.undoTitle" | "canvas.tool.redoTitle" | "canvas.tool.stickyOn" | "canvas.tool.stickyOff" | "canvas.tool.stickyLabel" | "canvas.menu.mediaShapes" | "canvas.category.geometric" | "canvas.category.arrows" | "canvas.category.media" | "canvas.category.ui" | "canvas.category.symbols" | "canvas.shape.hexagon" | "canvas.shape.oval" | "canvas.shape.play" | "canvas.shape.pause" | "canvas.shape.stop" | "canvas.shape.rewind" | "canvas.shape.fastForward" | "canvas.shape.record" | "canvas.shape.arrowRight" | "canvas.shape.arrowLeft" | "canvas.shape.arrowUp" | "canvas.shape.arrowDown" | "canvas.shape.doubleArrow" | "canvas.shape.curvedArrow" | "canvas.shape.checkMark" | "canvas.shape.cross" | "canvas.shape.plus" | "canvas.shape.minus" | "canvas.shape.info" | "canvas.shape.warning" | "canvas.shape.star" | "canvas.shape.heart" | "canvas.shape.speechBubble" | "canvas.shape.rhombus" | "canvas.shape.lightning" | "canvas.shape.shield" | "canvas.action.cut" | "canvas.action.copy" | "canvas.action.paste" | "canvas.action.duplicate" | "canvas.action.delete" | "canvas.action.group" | "canvas.action.ungroup" | "canvas.action.selectAll" | "canvas.action.clearAll" | "canvas.layer.title" | "canvas.layer.front" | "canvas.layer.forward" | "canvas.layer.backward" | "canvas.layer.back" | "canvas.layer.frontShort" | "canvas.layer.upShort" | "canvas.layer.downShort" | "canvas.layer.backShort" | "canvas.shortcuts.title" | "canvas.shortcuts.close" | "canvas.shortcuts.footer" | "canvas.shortcuts.footerHint" | "canvas.shortcuts.groupTools" | "canvas.shortcuts.groupSelection" | "canvas.shortcuts.groupHistory" | "canvas.shortcuts.groupZoom" | "canvas.shortcuts.drillThrough" | "canvas.shortcuts.redoAlt" | "canvas.shortcuts.save" | "canvas.shortcuts.zoomIn" | "canvas.shortcuts.zoomOut" | "canvas.shortcuts.zoomReset" | "canvas.shortcuts.fit" | "canvas.shortcuts.pan" | "canvas.shortcuts.move1" | "canvas.shortcuts.move10" | "canvas.shortcuts.frameResize" | "canvas.shortcuts.frameEdit" | "canvas.key.ctrlCmd" | "canvas.key.alt" | "canvas.key.shift" | "canvas.key.delete" | "canvas.key.space" | "canvas.key.click" | "canvas.key.drag" | "canvas.key.dragCorner" | "canvas.key.doubleClick" | "canvas.zoom.expandTitle" | "canvas.zoom.expandLabel" | "canvas.zoom.gridTitle" | "canvas.zoom.gridLabel" | "canvas.zoom.panTitle" | "canvas.zoom.panLabel" | "canvas.zoom.panBanner" | "canvas.zoom.outTitle" | "canvas.zoom.outLabel" | "canvas.zoom.inTitle" | "canvas.zoom.inLabel" | "canvas.zoom.resetTitle" | "canvas.zoom.resetLabel" | "canvas.zoom.levelLabel" | "canvas.zoom.oneToOneTitle" | "canvas.zoom.fitTitle" | "canvas.zoom.fitLabel" | "canvas.zoom.shortcutsTitle" | "canvas.zoom.shortcutsLabel" | "canvas.zoom.unsavedTitle" | "canvas.zoom.savedTitle" | "canvas.zoom.minimize" | "canvas.props.shape" | "canvas.props.showAll" | "canvas.props.showFewer" | "canvas.props.close" | "canvas.props.children" | "canvas.props.actions" | "canvas.props.general" | "canvas.props.dimensions" | "canvas.props.width" | "canvas.props.height" | "canvas.props.proportionsFixed" | "canvas.props.proportionsUnlock" | "canvas.props.proportionsLock" | "canvas.props.textProperties" | "canvas.props.labelProperties" | "canvas.props.boxProperties" | "canvas.props.groupBox" | "canvas.props.labelText" | "canvas.props.labelPlaceholder" | "canvas.props.textBackground" | "canvas.type.none" | "canvas.type.widget" | "canvas.type.drawing" | "canvas.type.line" | "canvas.type.group" | "canvas.type.selection" | "canvas.type.drawingOf" | "canvas.type.customShape" | "canvas.field.opacity" | "canvas.field.cornerRoundness" | "canvas.field.backgroundColor" | "canvas.field.backgroundOpacity" | "canvas.field.fillColor" | "canvas.field.fillOpacity" | "canvas.field.strokeColor" | "canvas.field.strokeWidth" | "canvas.field.strokeType" | "canvas.field.strokeSolid" | "canvas.field.strokeDashed" | "canvas.field.strokeDotted" | "canvas.field.fontSize" | "canvas.field.textPadding" | "canvas.field.textColor" | "canvas.field.textStrokeColor" | "canvas.field.textStrokeWidth" | "canvas.field.groupFillColor" | "canvas.field.groupFillOpacity" | "canvas.field.groupStrokeColor" | "canvas.field.groupStrokeWidth" | "canvas.field.groupStrokeType" | "canvas.arrange.title" | "canvas.arrange.left" | "canvas.arrange.centerH" | "canvas.arrange.right" | "canvas.arrange.top" | "canvas.arrange.middleV" | "canvas.arrange.bottom" | "canvas.image.source" | "canvas.image.file" | "canvas.image.noFile" | "canvas.image.changeFile" | "canvas.image.chooseFile" | "canvas.image.url" | "canvas.image.pasteUrl" | "canvas.image.newUrl" | "canvas.image.load" | "canvas.widget.createPreview" | "canvas.widget.capture" | "canvas.widget.linked" | "canvas.widget.converting" | "canvas.widget.duplicating" | "canvas.widget.linking" | "canvas.widget.unlinkedTitle" | "canvas.widget.orphanNotice" | "canvas.widget.removeFromCanvas" | "canvas.widget.namePlaceholder" | "canvas.widget.openDetails" | "canvas.widget.refreshPreview" | "canvas.widget.primary" | "canvas.widget.primaryTitle" | "canvas.widget.setPrimary" | "canvas.widget.convertLabel" | "canvas.widget.convertButton" | "canvas.widget.unlinkedName" | "canvas.control.color" | "canvas.control.value" | "canvas.control.openPicker" | "canvas.control.removeColor" | "canvas.control.fontFamily" | "canvas.control.textStyle" | "canvas.control.bold" | "canvas.control.boldMark" | "canvas.control.italic" | "canvas.control.italicMark" | "canvas.control.underline" | "canvas.control.underlineMark" | "canvas.control.textAlign" | "canvas.control.alignLeft" | "canvas.control.alignCenter" | "canvas.control.alignRight">;
12
+ export declare const useCanvasLanguage: () => import("@widgetic/design-system/i18n").I18nContext<"canvas.state.loading" | "canvas.state.initFailed" | "canvas.error.imageFromUrl" | "canvas.defaults.textBox" | "canvas.defaults.frameLabel" | "canvas.defaults.untitledFrame" | "canvas.defaults.untitledShape" | "canvas.draw.dropImage" | "canvas.draw.dropVideo" | "canvas.draw.or" | "canvas.draw.doubleClick" | "canvas.draw.widgetName" | "canvas.draw.widgetPreview" | "canvas.tool.select" | "canvas.tool.hand" | "canvas.tool.erase" | "canvas.tool.draw" | "canvas.tool.arrow" | "canvas.tool.rectangle" | "canvas.tool.triangle" | "canvas.tool.ellipse" | "canvas.tool.circle" | "canvas.tool.frame" | "canvas.tool.text" | "canvas.tool.selector" | "canvas.tool.image" | "canvas.tool.video" | "canvas.tool.shapes" | "canvas.tool.moreShapes" | "canvas.tool.undo" | "canvas.tool.redo" | "canvas.tool.withKey" | "canvas.tool.undoTitle" | "canvas.tool.redoTitle" | "canvas.tool.stickyOn" | "canvas.tool.stickyOff" | "canvas.tool.stickyLabel" | "canvas.menu.mediaShapes" | "canvas.category.geometric" | "canvas.category.arrows" | "canvas.category.media" | "canvas.category.ui" | "canvas.category.symbols" | "canvas.shape.hexagon" | "canvas.shape.oval" | "canvas.shape.play" | "canvas.shape.pause" | "canvas.shape.stop" | "canvas.shape.rewind" | "canvas.shape.fastForward" | "canvas.shape.record" | "canvas.shape.arrowRight" | "canvas.shape.arrowLeft" | "canvas.shape.arrowUp" | "canvas.shape.arrowDown" | "canvas.shape.doubleArrow" | "canvas.shape.curvedArrow" | "canvas.shape.checkMark" | "canvas.shape.cross" | "canvas.shape.plus" | "canvas.shape.minus" | "canvas.shape.info" | "canvas.shape.warning" | "canvas.shape.star" | "canvas.shape.heart" | "canvas.shape.speechBubble" | "canvas.shape.rhombus" | "canvas.shape.lightning" | "canvas.shape.shield" | "canvas.action.cut" | "canvas.action.copy" | "canvas.action.paste" | "canvas.action.duplicate" | "canvas.action.delete" | "canvas.action.group" | "canvas.action.ungroup" | "canvas.action.selectAll" | "canvas.action.clearAll" | "canvas.layer.title" | "canvas.layer.front" | "canvas.layer.forward" | "canvas.layer.backward" | "canvas.layer.back" | "canvas.layer.frontShort" | "canvas.layer.upShort" | "canvas.layer.downShort" | "canvas.layer.backShort" | "canvas.shortcuts.title" | "canvas.shortcuts.close" | "canvas.shortcuts.footer" | "canvas.shortcuts.footerHint" | "canvas.shortcuts.groupTools" | "canvas.shortcuts.groupSelection" | "canvas.shortcuts.groupHistory" | "canvas.shortcuts.groupZoom" | "canvas.shortcuts.drillThrough" | "canvas.shortcuts.redoAlt" | "canvas.shortcuts.save" | "canvas.shortcuts.zoomIn" | "canvas.shortcuts.zoomOut" | "canvas.shortcuts.zoomReset" | "canvas.shortcuts.fit" | "canvas.shortcuts.pan" | "canvas.shortcuts.move1" | "canvas.shortcuts.move10" | "canvas.shortcuts.frameResize" | "canvas.shortcuts.frameEdit" | "canvas.key.ctrlCmd" | "canvas.key.alt" | "canvas.key.shift" | "canvas.key.delete" | "canvas.key.space" | "canvas.key.click" | "canvas.key.drag" | "canvas.key.dragCorner" | "canvas.key.doubleClick" | "canvas.zoom.expandTitle" | "canvas.zoom.expandLabel" | "canvas.zoom.gridTitle" | "canvas.zoom.gridLabel" | "canvas.zoom.panTitle" | "canvas.zoom.panLabel" | "canvas.zoom.panBanner" | "canvas.zoom.outTitle" | "canvas.zoom.outLabel" | "canvas.zoom.inTitle" | "canvas.zoom.inLabel" | "canvas.zoom.resetTitle" | "canvas.zoom.resetLabel" | "canvas.zoom.levelLabel" | "canvas.zoom.oneToOneTitle" | "canvas.zoom.fitTitle" | "canvas.zoom.fitLabel" | "canvas.zoom.shortcutsTitle" | "canvas.zoom.shortcutsLabel" | "canvas.zoom.unsavedTitle" | "canvas.zoom.savedTitle" | "canvas.zoom.minimize" | "canvas.props.shape" | "canvas.props.showAll" | "canvas.props.showFewer" | "canvas.props.close" | "canvas.props.children" | "canvas.props.actions" | "canvas.props.general" | "canvas.props.dimensions" | "canvas.props.width" | "canvas.props.height" | "canvas.props.proportionsFixed" | "canvas.props.proportionsUnlock" | "canvas.props.proportionsLock" | "canvas.props.textProperties" | "canvas.props.labelProperties" | "canvas.props.boxProperties" | "canvas.props.groupBox" | "canvas.props.labelText" | "canvas.props.labelPlaceholder" | "canvas.props.textBackground" | "canvas.type.none" | "canvas.type.widget" | "canvas.type.drawing" | "canvas.type.line" | "canvas.type.group" | "canvas.type.selection" | "canvas.type.drawingOf" | "canvas.type.customShape" | "canvas.field.opacity" | "canvas.field.cornerRoundness" | "canvas.field.backgroundColor" | "canvas.field.backgroundOpacity" | "canvas.field.fillColor" | "canvas.field.fillOpacity" | "canvas.field.strokeColor" | "canvas.field.strokeWidth" | "canvas.field.strokeType" | "canvas.field.strokeSolid" | "canvas.field.strokeDashed" | "canvas.field.strokeDotted" | "canvas.field.fontSize" | "canvas.field.textPadding" | "canvas.field.textColor" | "canvas.field.textStrokeColor" | "canvas.field.textStrokeWidth" | "canvas.field.groupFillColor" | "canvas.field.groupFillOpacity" | "canvas.field.groupStrokeColor" | "canvas.field.groupStrokeWidth" | "canvas.field.groupStrokeType" | "canvas.arrange.title" | "canvas.arrange.left" | "canvas.arrange.centerH" | "canvas.arrange.right" | "canvas.arrange.top" | "canvas.arrange.middleV" | "canvas.arrange.bottom" | "canvas.image.source" | "canvas.image.file" | "canvas.image.noFile" | "canvas.image.changeFile" | "canvas.image.chooseFile" | "canvas.image.url" | "canvas.image.pasteUrl" | "canvas.image.newUrl" | "canvas.image.load" | "canvas.widget.createPreview" | "canvas.widget.capture" | "canvas.widget.linked" | "canvas.widget.converting" | "canvas.widget.duplicating" | "canvas.widget.linking" | "canvas.widget.unlinkedTitle" | "canvas.widget.orphanNotice" | "canvas.widget.removeFromCanvas" | "canvas.widget.namePlaceholder" | "canvas.widget.openDetails" | "canvas.widget.refreshPreview" | "canvas.widget.primary" | "canvas.widget.primaryTitle" | "canvas.widget.setPrimary" | "canvas.widget.convertLabel" | "canvas.widget.convertButton" | "canvas.widget.unlinkedName" | "canvas.control.color" | "canvas.control.value" | "canvas.control.openPicker" | "canvas.control.removeColor" | "canvas.control.fontFamily" | "canvas.control.textStyle" | "canvas.control.bold" | "canvas.control.boldMark" | "canvas.control.italic" | "canvas.control.italicMark" | "canvas.control.underline" | "canvas.control.underlineMark" | "canvas.control.textAlign" | "canvas.control.alignLeft" | "canvas.control.alignCenter" | "canvas.control.alignRight">;
13
13
  /**
14
14
  * The English `t` of the canvas, for code that has no component around it. The screens of the canvas get their words, in
15
15
  * the page's language, from `useCanvasLanguage`.
16
16
  */
17
- export declare const translateEnglish: import("@widgetic/design-system/i18n").Translate<"canvas.state.loading" | "canvas.state.initFailed" | "canvas.error.imageFromUrl" | "canvas.defaults.textBox" | "canvas.defaults.frameLabel" | "canvas.defaults.untitledFrame" | "canvas.defaults.untitledShape" | "canvas.draw.dropImage" | "canvas.draw.dropVideo" | "canvas.draw.or" | "canvas.draw.doubleClick" | "canvas.draw.widgetName" | "canvas.draw.widgetPreview" | "canvas.tool.select" | "canvas.tool.hand" | "canvas.tool.erase" | "canvas.tool.draw" | "canvas.tool.arrow" | "canvas.tool.rectangle" | "canvas.tool.triangle" | "canvas.tool.ellipse" | "canvas.tool.circle" | "canvas.tool.frame" | "canvas.tool.text" | "canvas.tool.image" | "canvas.tool.video" | "canvas.tool.shapes" | "canvas.tool.moreShapes" | "canvas.tool.undo" | "canvas.tool.redo" | "canvas.tool.withKey" | "canvas.tool.undoTitle" | "canvas.tool.redoTitle" | "canvas.tool.stickyOn" | "canvas.tool.stickyOff" | "canvas.tool.stickyLabel" | "canvas.menu.mediaShapes" | "canvas.category.geometric" | "canvas.category.arrows" | "canvas.category.media" | "canvas.category.ui" | "canvas.category.symbols" | "canvas.shape.hexagon" | "canvas.shape.oval" | "canvas.shape.play" | "canvas.shape.pause" | "canvas.shape.stop" | "canvas.shape.rewind" | "canvas.shape.fastForward" | "canvas.shape.record" | "canvas.shape.arrowRight" | "canvas.shape.arrowLeft" | "canvas.shape.arrowUp" | "canvas.shape.arrowDown" | "canvas.shape.doubleArrow" | "canvas.shape.curvedArrow" | "canvas.shape.checkMark" | "canvas.shape.cross" | "canvas.shape.plus" | "canvas.shape.minus" | "canvas.shape.info" | "canvas.shape.warning" | "canvas.shape.star" | "canvas.shape.heart" | "canvas.shape.speechBubble" | "canvas.shape.rhombus" | "canvas.shape.lightning" | "canvas.shape.shield" | "canvas.action.cut" | "canvas.action.copy" | "canvas.action.paste" | "canvas.action.duplicate" | "canvas.action.delete" | "canvas.action.group" | "canvas.action.ungroup" | "canvas.action.selectAll" | "canvas.action.clearAll" | "canvas.layer.title" | "canvas.layer.front" | "canvas.layer.forward" | "canvas.layer.backward" | "canvas.layer.back" | "canvas.layer.frontShort" | "canvas.layer.upShort" | "canvas.layer.downShort" | "canvas.layer.backShort" | "canvas.shortcuts.title" | "canvas.shortcuts.close" | "canvas.shortcuts.footer" | "canvas.shortcuts.footerHint" | "canvas.shortcuts.groupTools" | "canvas.shortcuts.groupSelection" | "canvas.shortcuts.groupHistory" | "canvas.shortcuts.groupZoom" | "canvas.shortcuts.drillThrough" | "canvas.shortcuts.redoAlt" | "canvas.shortcuts.save" | "canvas.shortcuts.zoomIn" | "canvas.shortcuts.zoomOut" | "canvas.shortcuts.zoomReset" | "canvas.shortcuts.fit" | "canvas.shortcuts.pan" | "canvas.shortcuts.move1" | "canvas.shortcuts.move10" | "canvas.shortcuts.frameResize" | "canvas.shortcuts.frameEdit" | "canvas.key.ctrlCmd" | "canvas.key.alt" | "canvas.key.shift" | "canvas.key.delete" | "canvas.key.space" | "canvas.key.click" | "canvas.key.drag" | "canvas.key.dragCorner" | "canvas.key.doubleClick" | "canvas.zoom.expandTitle" | "canvas.zoom.expandLabel" | "canvas.zoom.gridTitle" | "canvas.zoom.gridLabel" | "canvas.zoom.panTitle" | "canvas.zoom.panLabel" | "canvas.zoom.panBanner" | "canvas.zoom.outTitle" | "canvas.zoom.outLabel" | "canvas.zoom.inTitle" | "canvas.zoom.inLabel" | "canvas.zoom.resetTitle" | "canvas.zoom.resetLabel" | "canvas.zoom.levelLabel" | "canvas.zoom.oneToOneTitle" | "canvas.zoom.fitTitle" | "canvas.zoom.fitLabel" | "canvas.zoom.shortcutsTitle" | "canvas.zoom.shortcutsLabel" | "canvas.zoom.unsavedTitle" | "canvas.zoom.savedTitle" | "canvas.zoom.minimize" | "canvas.props.shape" | "canvas.props.showAll" | "canvas.props.showFewer" | "canvas.props.close" | "canvas.props.children" | "canvas.props.actions" | "canvas.props.general" | "canvas.props.dimensions" | "canvas.props.width" | "canvas.props.height" | "canvas.props.proportionsFixed" | "canvas.props.proportionsUnlock" | "canvas.props.proportionsLock" | "canvas.props.textProperties" | "canvas.props.labelProperties" | "canvas.props.boxProperties" | "canvas.props.groupBox" | "canvas.props.labelText" | "canvas.props.labelPlaceholder" | "canvas.props.textBackground" | "canvas.type.none" | "canvas.type.widget" | "canvas.type.drawing" | "canvas.type.line" | "canvas.type.group" | "canvas.type.selection" | "canvas.type.drawingOf" | "canvas.type.customShape" | "canvas.field.opacity" | "canvas.field.cornerRoundness" | "canvas.field.backgroundColor" | "canvas.field.backgroundOpacity" | "canvas.field.fillColor" | "canvas.field.fillOpacity" | "canvas.field.strokeColor" | "canvas.field.strokeWidth" | "canvas.field.strokeType" | "canvas.field.strokeSolid" | "canvas.field.strokeDashed" | "canvas.field.strokeDotted" | "canvas.field.fontSize" | "canvas.field.textPadding" | "canvas.field.textColor" | "canvas.field.textStrokeColor" | "canvas.field.textStrokeWidth" | "canvas.field.groupFillColor" | "canvas.field.groupFillOpacity" | "canvas.field.groupStrokeColor" | "canvas.field.groupStrokeWidth" | "canvas.field.groupStrokeType" | "canvas.arrange.title" | "canvas.arrange.left" | "canvas.arrange.centerH" | "canvas.arrange.right" | "canvas.arrange.top" | "canvas.arrange.middleV" | "canvas.arrange.bottom" | "canvas.image.source" | "canvas.image.file" | "canvas.image.noFile" | "canvas.image.changeFile" | "canvas.image.chooseFile" | "canvas.image.url" | "canvas.image.pasteUrl" | "canvas.image.newUrl" | "canvas.image.load" | "canvas.widget.createPreview" | "canvas.widget.capture" | "canvas.widget.linked" | "canvas.widget.converting" | "canvas.widget.duplicating" | "canvas.widget.linking" | "canvas.widget.unlinkedTitle" | "canvas.widget.orphanNotice" | "canvas.widget.removeFromCanvas" | "canvas.widget.namePlaceholder" | "canvas.widget.openDetails" | "canvas.widget.refreshPreview" | "canvas.widget.primary" | "canvas.widget.primaryTitle" | "canvas.widget.setPrimary" | "canvas.widget.convertLabel" | "canvas.widget.convertButton" | "canvas.widget.unlinkedName" | "canvas.control.color" | "canvas.control.value" | "canvas.control.openPicker" | "canvas.control.removeColor" | "canvas.control.fontFamily" | "canvas.control.textStyle" | "canvas.control.bold" | "canvas.control.boldMark" | "canvas.control.italic" | "canvas.control.italicMark" | "canvas.control.underline" | "canvas.control.underlineMark" | "canvas.control.textAlign" | "canvas.control.alignLeft" | "canvas.control.alignCenter" | "canvas.control.alignRight">;
17
+ export declare const translateEnglish: import("@widgetic/design-system/i18n").Translate<"canvas.state.loading" | "canvas.state.initFailed" | "canvas.error.imageFromUrl" | "canvas.defaults.textBox" | "canvas.defaults.frameLabel" | "canvas.defaults.untitledFrame" | "canvas.defaults.untitledShape" | "canvas.draw.dropImage" | "canvas.draw.dropVideo" | "canvas.draw.or" | "canvas.draw.doubleClick" | "canvas.draw.widgetName" | "canvas.draw.widgetPreview" | "canvas.tool.select" | "canvas.tool.hand" | "canvas.tool.erase" | "canvas.tool.draw" | "canvas.tool.arrow" | "canvas.tool.rectangle" | "canvas.tool.triangle" | "canvas.tool.ellipse" | "canvas.tool.circle" | "canvas.tool.frame" | "canvas.tool.text" | "canvas.tool.selector" | "canvas.tool.image" | "canvas.tool.video" | "canvas.tool.shapes" | "canvas.tool.moreShapes" | "canvas.tool.undo" | "canvas.tool.redo" | "canvas.tool.withKey" | "canvas.tool.undoTitle" | "canvas.tool.redoTitle" | "canvas.tool.stickyOn" | "canvas.tool.stickyOff" | "canvas.tool.stickyLabel" | "canvas.menu.mediaShapes" | "canvas.category.geometric" | "canvas.category.arrows" | "canvas.category.media" | "canvas.category.ui" | "canvas.category.symbols" | "canvas.shape.hexagon" | "canvas.shape.oval" | "canvas.shape.play" | "canvas.shape.pause" | "canvas.shape.stop" | "canvas.shape.rewind" | "canvas.shape.fastForward" | "canvas.shape.record" | "canvas.shape.arrowRight" | "canvas.shape.arrowLeft" | "canvas.shape.arrowUp" | "canvas.shape.arrowDown" | "canvas.shape.doubleArrow" | "canvas.shape.curvedArrow" | "canvas.shape.checkMark" | "canvas.shape.cross" | "canvas.shape.plus" | "canvas.shape.minus" | "canvas.shape.info" | "canvas.shape.warning" | "canvas.shape.star" | "canvas.shape.heart" | "canvas.shape.speechBubble" | "canvas.shape.rhombus" | "canvas.shape.lightning" | "canvas.shape.shield" | "canvas.action.cut" | "canvas.action.copy" | "canvas.action.paste" | "canvas.action.duplicate" | "canvas.action.delete" | "canvas.action.group" | "canvas.action.ungroup" | "canvas.action.selectAll" | "canvas.action.clearAll" | "canvas.layer.title" | "canvas.layer.front" | "canvas.layer.forward" | "canvas.layer.backward" | "canvas.layer.back" | "canvas.layer.frontShort" | "canvas.layer.upShort" | "canvas.layer.downShort" | "canvas.layer.backShort" | "canvas.shortcuts.title" | "canvas.shortcuts.close" | "canvas.shortcuts.footer" | "canvas.shortcuts.footerHint" | "canvas.shortcuts.groupTools" | "canvas.shortcuts.groupSelection" | "canvas.shortcuts.groupHistory" | "canvas.shortcuts.groupZoom" | "canvas.shortcuts.drillThrough" | "canvas.shortcuts.redoAlt" | "canvas.shortcuts.save" | "canvas.shortcuts.zoomIn" | "canvas.shortcuts.zoomOut" | "canvas.shortcuts.zoomReset" | "canvas.shortcuts.fit" | "canvas.shortcuts.pan" | "canvas.shortcuts.move1" | "canvas.shortcuts.move10" | "canvas.shortcuts.frameResize" | "canvas.shortcuts.frameEdit" | "canvas.key.ctrlCmd" | "canvas.key.alt" | "canvas.key.shift" | "canvas.key.delete" | "canvas.key.space" | "canvas.key.click" | "canvas.key.drag" | "canvas.key.dragCorner" | "canvas.key.doubleClick" | "canvas.zoom.expandTitle" | "canvas.zoom.expandLabel" | "canvas.zoom.gridTitle" | "canvas.zoom.gridLabel" | "canvas.zoom.panTitle" | "canvas.zoom.panLabel" | "canvas.zoom.panBanner" | "canvas.zoom.outTitle" | "canvas.zoom.outLabel" | "canvas.zoom.inTitle" | "canvas.zoom.inLabel" | "canvas.zoom.resetTitle" | "canvas.zoom.resetLabel" | "canvas.zoom.levelLabel" | "canvas.zoom.oneToOneTitle" | "canvas.zoom.fitTitle" | "canvas.zoom.fitLabel" | "canvas.zoom.shortcutsTitle" | "canvas.zoom.shortcutsLabel" | "canvas.zoom.unsavedTitle" | "canvas.zoom.savedTitle" | "canvas.zoom.minimize" | "canvas.props.shape" | "canvas.props.showAll" | "canvas.props.showFewer" | "canvas.props.close" | "canvas.props.children" | "canvas.props.actions" | "canvas.props.general" | "canvas.props.dimensions" | "canvas.props.width" | "canvas.props.height" | "canvas.props.proportionsFixed" | "canvas.props.proportionsUnlock" | "canvas.props.proportionsLock" | "canvas.props.textProperties" | "canvas.props.labelProperties" | "canvas.props.boxProperties" | "canvas.props.groupBox" | "canvas.props.labelText" | "canvas.props.labelPlaceholder" | "canvas.props.textBackground" | "canvas.type.none" | "canvas.type.widget" | "canvas.type.drawing" | "canvas.type.line" | "canvas.type.group" | "canvas.type.selection" | "canvas.type.drawingOf" | "canvas.type.customShape" | "canvas.field.opacity" | "canvas.field.cornerRoundness" | "canvas.field.backgroundColor" | "canvas.field.backgroundOpacity" | "canvas.field.fillColor" | "canvas.field.fillOpacity" | "canvas.field.strokeColor" | "canvas.field.strokeWidth" | "canvas.field.strokeType" | "canvas.field.strokeSolid" | "canvas.field.strokeDashed" | "canvas.field.strokeDotted" | "canvas.field.fontSize" | "canvas.field.textPadding" | "canvas.field.textColor" | "canvas.field.textStrokeColor" | "canvas.field.textStrokeWidth" | "canvas.field.groupFillColor" | "canvas.field.groupFillOpacity" | "canvas.field.groupStrokeColor" | "canvas.field.groupStrokeWidth" | "canvas.field.groupStrokeType" | "canvas.arrange.title" | "canvas.arrange.left" | "canvas.arrange.centerH" | "canvas.arrange.right" | "canvas.arrange.top" | "canvas.arrange.middleV" | "canvas.arrange.bottom" | "canvas.image.source" | "canvas.image.file" | "canvas.image.noFile" | "canvas.image.changeFile" | "canvas.image.chooseFile" | "canvas.image.url" | "canvas.image.pasteUrl" | "canvas.image.newUrl" | "canvas.image.load" | "canvas.widget.createPreview" | "canvas.widget.capture" | "canvas.widget.linked" | "canvas.widget.converting" | "canvas.widget.duplicating" | "canvas.widget.linking" | "canvas.widget.unlinkedTitle" | "canvas.widget.orphanNotice" | "canvas.widget.removeFromCanvas" | "canvas.widget.namePlaceholder" | "canvas.widget.openDetails" | "canvas.widget.refreshPreview" | "canvas.widget.primary" | "canvas.widget.primaryTitle" | "canvas.widget.setPrimary" | "canvas.widget.convertLabel" | "canvas.widget.convertButton" | "canvas.widget.unlinkedName" | "canvas.control.color" | "canvas.control.value" | "canvas.control.openPicker" | "canvas.control.removeColor" | "canvas.control.fontFamily" | "canvas.control.textStyle" | "canvas.control.bold" | "canvas.control.boldMark" | "canvas.control.italic" | "canvas.control.italicMark" | "canvas.control.underline" | "canvas.control.underlineMark" | "canvas.control.textAlign" | "canvas.control.alignLeft" | "canvas.control.alignCenter" | "canvas.control.alignRight">;
18
18
  /**
19
19
  * Checks a page's `messages` against the canvas's catalog without showing anything: a key that does not exist (with the
20
20
  * nearest real one), a value that is not text, a template that does not parse, or one that asks for a value the message
@@ -46,6 +46,7 @@ export declare const CANVAS_MESSAGES: {
46
46
  readonly 'canvas.tool.circle': "Circle";
47
47
  readonly 'canvas.tool.frame': "Frame";
48
48
  readonly 'canvas.tool.text': "Text";
49
+ readonly 'canvas.tool.selector': "Selector";
49
50
  readonly 'canvas.tool.image': "Image";
50
51
  readonly 'canvas.tool.video': "Video";
51
52
  readonly 'canvas.tool.shapes': "Shapes";
@@ -50,6 +50,7 @@ export const CANVAS_MESSAGES = {
50
50
  'canvas.tool.circle': 'Circle',
51
51
  'canvas.tool.frame': 'Frame',
52
52
  'canvas.tool.text': 'Text',
53
+ 'canvas.tool.selector': 'Selector',
53
54
  'canvas.tool.image': 'Image',
54
55
  'canvas.tool.video': 'Video',
55
56
  'canvas.tool.shapes': 'Shapes',
package/dist/index.d.ts CHANGED
@@ -8,6 +8,8 @@
8
8
  */
9
9
  export { Canvas, CanvasToolbar, ContextMenu, PanZoomPanel, PropsPanel } from './canvas';
10
10
  export type { WidgetConversionPayload, StrokeRecognizer, StrokeRecognitionRequest, StrokeRecognitionResult } from './canvas';
11
+ export { TOOLBAR_POSITIONS, DEFAULT_TOOLBAR_POSITION } from './canvas';
12
+ export type { ToolbarPosition } from './canvas';
11
13
  export { setShapeImageStore, getShapeImageStore } from './canvas';
12
14
  export type { ShapeImageStore } from './canvas';
13
15
  export { Tooltip, ColorIC, FontSelectorIC, SliderUnitIC, TextAlignIC, TextStyleIC } from './components';
package/dist/index.js CHANGED
@@ -8,6 +8,8 @@
8
8
  */
9
9
  // Canvas (heavy — dynamic import recommended)
10
10
  export { Canvas, CanvasToolbar, ContextMenu, PanZoomPanel, PropsPanel } from './canvas';
11
+ // Where the drawing toolbar stands along the bottom edge of the board (the `toolbarPosition` option of <Canvas>)
12
+ export { TOOLBAR_POSITIONS, DEFAULT_TOOLBAR_POSITION } from './canvas';
11
13
  // Widget thumbnails live outside the canvas JSON when the host installs a store
12
14
  export { setShapeImageStore, getShapeImageStore } from './canvas';
13
15
  // Lightweight components (safe for static import)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widgetic/canvas",
3
- "version": "0.5.33",
3
+ "version": "0.5.35",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "type": "module",
6
6
  "svelte": "./dist/index.js",