@widgetic/canvas 0.5.35 → 0.5.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +105 -36
- package/dist/canvas/DomCanvas.svelte +449 -0
- package/dist/canvas/DomCanvas.svelte.d.ts +221 -0
- package/dist/canvas/boardFrame.d.ts +13 -0
- package/dist/canvas/boardFrame.js +13 -0
- package/dist/canvas/boardSurface.d.ts +9 -0
- package/dist/canvas/boardSurface.js +9 -0
- package/dist/canvas/chromeLayout.d.ts +76 -0
- package/dist/canvas/chromeLayout.js +121 -0
- package/dist/canvas/emptyBoardHint.d.ts +17 -0
- package/dist/canvas/emptyBoardHint.js +12 -0
- package/dist/canvas/eventScope.d.ts +1 -1
- package/dist/canvas/eventScope.js +1 -1
- package/dist/canvas/host/CanvasHost.d.ts +348 -0
- package/dist/canvas/host/CanvasHost.js +1715 -0
- package/dist/canvas/host/CanvasHostApi.d.ts +30 -0
- package/dist/canvas/host/CanvasHostApi.js +95 -0
- package/dist/canvas/host/browserServices.d.ts +46 -0
- package/dist/canvas/host/browserServices.js +167 -0
- package/dist/canvas/host/conversion.d.ts +53 -0
- package/dist/canvas/host/conversion.js +125 -0
- package/dist/canvas/host/hostObject.d.ts +40 -0
- package/dist/canvas/host/hostObject.js +93 -0
- package/dist/canvas/host/pageEvents.d.ts +24 -0
- package/dist/canvas/host/pageEvents.js +35 -0
- package/dist/canvas/host/screenRects.d.ts +66 -0
- package/dist/canvas/host/screenRects.js +102 -0
- package/dist/canvas/host/strokeSnap.d.ts +67 -0
- package/dist/canvas/host/strokeSnap.js +165 -0
- package/dist/canvas/index.d.ts +7 -7
- package/dist/canvas/index.js +8 -8
- package/dist/canvas/openMarks.d.ts +17 -0
- package/dist/canvas/openMarks.js +26 -0
- package/dist/canvas/panZoomPosition.d.ts +15 -0
- package/dist/canvas/panZoomPosition.js +16 -0
- package/dist/canvas/preferredTextFont.d.ts +12 -0
- package/dist/canvas/preferredTextFont.js +38 -0
- package/dist/canvas/shapes/ShapeLibrary.d.ts +1 -1
- package/dist/canvas/shapes/ShapeLibrary.js +13 -1
- package/dist/canvas/shapes/strokeShapeSnap.d.ts +14 -12
- package/dist/canvas/shapes/strokeShapeSnap.js +10 -8
- package/dist/canvas/toolbarPosition.d.ts +11 -11
- package/dist/canvas/toolbarPosition.js +11 -24
- package/dist/canvas/types.d.ts +14 -0
- package/dist/canvas/ui/CanvasContextMenu.svelte +173 -0
- package/dist/canvas/ui/CanvasContextMenu.svelte.d.ts +12 -0
- package/dist/canvas/ui/CanvasHint.svelte +21 -0
- package/dist/canvas/ui/CanvasHint.svelte.d.ts +18 -0
- package/dist/canvas/ui/CanvasToolbar.svelte +95 -0
- package/dist/canvas/ui/CanvasToolbar.svelte.d.ts +14 -0
- package/dist/canvas/ui/ColorField.svelte +156 -0
- package/dist/canvas/ui/ColorField.svelte.d.ts +14 -0
- package/dist/canvas/ui/LoadNotice.svelte +39 -0
- package/dist/canvas/ui/LoadNotice.svelte.d.ts +8 -0
- package/dist/canvas/ui/SelectionPanel.svelte +300 -0
- package/dist/canvas/ui/SelectionPanel.svelte.d.ts +20 -0
- package/dist/canvas/ui/SelectorBar.svelte +82 -0
- package/dist/canvas/ui/SelectorBar.svelte.d.ts +12 -0
- package/dist/canvas/ui/ShapesMenu.svelte +185 -0
- package/dist/canvas/ui/ShapesMenu.svelte.d.ts +15 -0
- package/dist/canvas/ui/ShortcutsPanel.svelte +124 -0
- package/dist/canvas/ui/ShortcutsPanel.svelte.d.ts +7 -0
- package/dist/canvas/ui/ToolButton.svelte +78 -0
- package/dist/canvas/ui/ToolButton.svelte.d.ts +20 -0
- package/dist/canvas/ui/WidgetActions.svelte +145 -0
- package/dist/canvas/ui/WidgetActions.svelte.d.ts +19 -0
- package/dist/canvas/ui/ZoomControl.svelte +89 -0
- package/dist/canvas/ui/ZoomControl.svelte.d.ts +18 -0
- package/dist/canvas/ui/colorModel.d.ts +18 -0
- package/dist/canvas/ui/colorModel.js +85 -0
- package/dist/canvas/ui/colorPickerMessages.d.ts +5 -0
- package/dist/canvas/ui/colorPickerMessages.js +15 -0
- package/dist/canvas/ui/floatingCard.d.ts +107 -0
- package/dist/canvas/ui/floatingCard.js +107 -0
- package/dist/canvas/ui/floatingLayer.d.ts +21 -0
- package/dist/canvas/ui/floatingLayer.js +52 -0
- package/dist/canvas/ui/icons.d.ts +12 -0
- package/dist/canvas/ui/icons.js +7 -0
- package/dist/canvas/ui/keyHints.d.ts +27 -0
- package/dist/canvas/ui/keyHints.js +43 -0
- package/dist/canvas/ui/popoverSide.d.ts +5 -0
- package/dist/canvas/ui/popoverSide.js +20 -0
- package/dist/canvas/ui/selectionTraits.d.ts +61 -0
- package/dist/canvas/ui/selectionTraits.js +99 -0
- package/dist/canvas/view/CanvasStage.svelte +132 -0
- package/dist/canvas/view/CanvasStage.svelte.d.ts +21 -0
- package/dist/canvas/view/EraserTrail.svelte +50 -0
- package/dist/canvas/view/EraserTrail.svelte.d.ts +9 -0
- package/dist/canvas/view/ObjectView.svelte +245 -0
- package/dist/canvas/view/ObjectView.svelte.d.ts +21 -0
- package/dist/canvas/view/SelectionOverlay.svelte +487 -0
- package/dist/canvas/view/SelectionOverlay.svelte.d.ts +17 -0
- package/dist/canvas/view/TextEditor.svelte +76 -0
- package/dist/canvas/view/TextEditor.svelte.d.ts +9 -0
- package/dist/canvas/view/WidgetChromeLayer.svelte +83 -0
- package/dist/canvas/view/WidgetChromeLayer.svelte.d.ts +13 -0
- package/dist/canvas/view/erasingMarks.d.ts +13 -0
- package/dist/canvas/view/erasingMarks.js +34 -0
- package/dist/canvas/view/geometry.d.ts +169 -0
- package/dist/canvas/view/geometry.js +272 -0
- package/dist/components/CanvasBoardPlaceholder.svelte +5 -3
- package/dist/components/CanvasBoardPlaceholder.svelte.d.ts +3 -3
- package/dist/components/index.js +1 -1
- package/dist/components/input-controls/ColorIC.svelte +2 -2
- package/dist/engine/EngineCore.d.ts +273 -0
- package/dist/engine/EngineCore.js +1051 -0
- package/dist/engine/codec/canvasDocument.d.ts +57 -0
- package/dist/engine/codec/canvasDocument.js +471 -0
- package/dist/engine/codec/hostReadableKeys.d.ts +25 -0
- package/dist/engine/codec/hostReadableKeys.js +25 -0
- package/dist/engine/core/arrange.d.ts +20 -0
- package/dist/engine/core/arrange.js +81 -0
- package/dist/engine/core/arrow.d.ts +91 -0
- package/dist/engine/core/arrow.js +182 -0
- package/dist/engine/core/brush.d.ts +68 -0
- package/dist/engine/core/brush.js +173 -0
- package/dist/engine/core/defaults.d.ts +70 -0
- package/dist/engine/core/defaults.js +158 -0
- package/dist/engine/core/freehand.d.ts +130 -0
- package/dist/engine/core/freehand.js +430 -0
- package/dist/engine/core/geometry.d.ts +44 -0
- package/dist/engine/core/geometry.js +216 -0
- package/dist/engine/core/history.d.ts +39 -0
- package/dist/engine/core/history.js +69 -0
- package/dist/engine/core/hitTest.d.ts +54 -0
- package/dist/engine/core/hitTest.js +298 -0
- package/dist/engine/core/matrix.d.ts +47 -0
- package/dist/engine/core/matrix.js +101 -0
- package/dist/engine/core/pathData.d.ts +50 -0
- package/dist/engine/core/pathData.js +550 -0
- package/dist/engine/core/rotationReset.d.ts +10 -0
- package/dist/engine/core/rotationReset.js +17 -0
- package/dist/engine/core/scene.d.ts +99 -0
- package/dist/engine/core/scene.js +450 -0
- package/dist/engine/core/scribble.d.ts +64 -0
- package/dist/engine/core/scribble.js +121 -0
- package/dist/engine/core/shapePaths.d.ts +34 -0
- package/dist/engine/core/shapePaths.js +69 -0
- package/dist/engine/core/shapeTools.d.ts +80 -0
- package/dist/engine/core/shapeTools.js +161 -0
- package/dist/engine/core/snapping.d.ts +64 -0
- package/dist/engine/core/snapping.js +164 -0
- package/dist/engine/core/style.d.ts +40 -0
- package/dist/engine/core/style.js +151 -0
- package/dist/engine/core/transform.d.ts +79 -0
- package/dist/engine/core/transform.js +258 -0
- package/dist/engine/core/types.d.ts +238 -0
- package/dist/engine/core/types.js +31 -0
- package/dist/engine/core/viewport.d.ts +32 -0
- package/dist/engine/core/viewport.js +84 -0
- package/dist/engine/input/PointerController.d.ts +38 -0
- package/dist/engine/input/PointerController.js +545 -0
- package/dist/engine/input/arrowHandles.d.ts +38 -0
- package/dist/engine/input/arrowHandles.js +60 -0
- package/dist/engine/input/gestures.d.ts +79 -0
- package/dist/engine/input/gestures.js +769 -0
- package/dist/engine/input/hoverCursor.d.ts +29 -0
- package/dist/engine/input/hoverCursor.js +23 -0
- package/dist/engine/input/keyboard.d.ts +75 -0
- package/dist/engine/input/keyboard.js +264 -0
- package/dist/engine/input/selectionHandles.d.ts +89 -0
- package/dist/engine/input/selectionHandles.js +169 -0
- package/dist/engine/input/types.d.ts +82 -0
- package/dist/engine/input/types.js +5 -0
- package/dist/engine/render/rasterize.d.ts +74 -0
- package/dist/engine/render/rasterize.js +273 -0
- package/dist/engine/state.d.ts +124 -0
- package/dist/engine/state.js +47 -0
- package/dist/engine/text/layoutText.d.ts +53 -0
- package/dist/engine/text/layoutText.js +170 -0
- package/dist/engine/widgets.d.ts +124 -0
- package/dist/engine/widgets.js +345 -0
- package/dist/i18n/labels.d.ts +4 -15
- package/dist/i18n/labels.js +33 -53
- package/dist/i18n/language.d.ts +3 -3
- package/dist/i18n/messages.d.ts +52 -124
- package/dist/i18n/messages.js +59 -133
- package/dist/i18n/shortcuts.d.ts +0 -1
- package/dist/i18n/shortcuts.js +2 -11
- package/dist/index.d.ts +4 -2
- package/dist/index.js +5 -3
- package/package.json +30 -5
- package/dist/canvas/Canvas.svelte +0 -13363
- package/dist/canvas/Canvas.svelte.d.ts +0 -286
- package/dist/canvas/CanvasToolbar.svelte +0 -1498
- package/dist/canvas/CanvasToolbar.svelte.d.ts +0 -69
- package/dist/canvas/ContextMenu.svelte +0 -305
- package/dist/canvas/ContextMenu.svelte.d.ts +0 -42
- package/dist/canvas/PanZoomPanel.svelte +0 -478
- package/dist/canvas/PanZoomPanel.svelte.d.ts +0 -38
- package/dist/canvas/WidgetSelectionLayer.svelte +0 -156
- package/dist/canvas/WidgetSelectionLayer.svelte.d.ts +0 -11
- package/dist/canvas/props-panel/PropsPanel.svelte +0 -2075
- package/dist/canvas/props-panel/PropsPanel.svelte.d.ts +0 -84
- package/dist/canvas/props-panel/TextPropsICSection.svelte +0 -242
- package/dist/canvas/props-panel/TextPropsICSection.svelte.d.ts +0 -40
- package/dist/canvas/shadowRootText.d.ts +0 -5
- package/dist/canvas/shadowRootText.js +0 -43
- package/dist/canvas/shapes/FrameShape.d.ts +0 -97
- package/dist/canvas/shapes/FrameShape.js +0 -953
- package/dist/canvas/shapes/ImageShape.d.ts +0 -47
- package/dist/canvas/shapes/ImageShape.js +0 -339
- package/dist/canvas/shapes/WidgetShape.d.ts +0 -30
- package/dist/canvas/shapes/WidgetShape.js +0 -200
- package/dist/canvas/widgetPreviewGeometry.d.ts +0 -19
- package/dist/canvas/widgetPreviewGeometry.js +0 -66
- package/dist/i18n/shapeWords.d.ts +0 -30
- package/dist/i18n/shapeWords.js +0 -36
- package/dist/i18n/slots.d.ts +0 -20
- package/dist/i18n/slots.js +0 -40
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
The Widgetic canvas, drawn with the DOM. This is the one public `Canvas` component of the package.
|
|
3
|
+
|
|
4
|
+
It is a thin shell: the state and the rules live in `CanvasHost` (which owns the engine, the autosave and the
|
|
5
|
+
conversions) and in the engine under it, and every piece of what is drawn is its own small component under `view/` and
|
|
6
|
+
`ui/`. This file does four things:
|
|
7
|
+
|
|
8
|
+
1. It takes the props the page sets (the names and defaults a page already uses, in the classic syntax so that
|
|
9
|
+
`<svelte:component this={Canvas} bind:this={ref} bind:wireframeMode …>` and the page's `InstanceType` typing keep
|
|
10
|
+
working) and hands them to the host, which reads each one at the moment it needs it.
|
|
11
|
+
2. It exports the functions the page calls (`CANVAS_EXPORTED_FUNCTION_NAMES`), each forwarding to the host's method of
|
|
12
|
+
the same name. `tests/host/hostSurface.test.mjs` holds the names, the props and this file to the surface that is
|
|
13
|
+
frozen in `tests/fixtures/hostSurface.json`.
|
|
14
|
+
3. It makes the language of the canvas (`locale`, `messages`) that every part reads its words from.
|
|
15
|
+
4. It lays the parts out: the board (the pointer surface) with the chrome as its siblings, never inside it, so a press on
|
|
16
|
+
a button is never a press on the board, and the overlay portal (see `ui/floatingLayer.ts`) that every menu, popover and
|
|
17
|
+
tooltip is drawn into.
|
|
18
|
+
|
|
19
|
+
Nothing here knows how an object is drawn or what a gesture does.
|
|
20
|
+
-->
|
|
21
|
+
<script lang="ts">
|
|
22
|
+
import { onDestroy } from 'svelte';
|
|
23
|
+
import { writable } from 'svelte/store';
|
|
24
|
+
import { Tooltip } from '@widgetic/design-system/components';
|
|
25
|
+
import { onlyCardIsSelected } from '../engine/widgets.js';
|
|
26
|
+
import { provideCanvasLanguage } from '../i18n/language.js';
|
|
27
|
+
import { BOARD_FRAME_CLASSES } from './boardFrame.js';
|
|
28
|
+
import { CanvasHost, DEFAULT_HOST_PROPS } from './host/CanvasHost.js';
|
|
29
|
+
import type { CanvasHostProps, SelectorGuide } from './host/CanvasHost.js';
|
|
30
|
+
import { forwardToHost } from './host/CanvasHostApi.js';
|
|
31
|
+
import { chromeSlots, panelClearanceFor, zoomVisibilityClasses } from './chromeLayout.js';
|
|
32
|
+
import { DEFAULT_PAN_ZOOM_POSITION, normalizePanZoomPosition } from './panZoomPosition.js';
|
|
33
|
+
import type { PanZoomPosition } from './panZoomPosition.js';
|
|
34
|
+
import { DEFAULT_TOOLBAR_POSITION, normalizeToolbarPosition } from './toolbarPosition.js';
|
|
35
|
+
import type { ToolbarPosition } from './toolbarPosition.js';
|
|
36
|
+
import CanvasContextMenu from './ui/CanvasContextMenu.svelte';
|
|
37
|
+
import CanvasToolbar from './ui/CanvasToolbar.svelte';
|
|
38
|
+
import { FLOATING_LAYER_CLASSES, provideFloatingLayer } from './ui/floatingLayer.js';
|
|
39
|
+
import SelectionPanel from './ui/SelectionPanel.svelte';
|
|
40
|
+
import SelectorBar from './ui/SelectorBar.svelte';
|
|
41
|
+
import ShortcutsPanel from './ui/ShortcutsPanel.svelte';
|
|
42
|
+
import ZoomControl from './ui/ZoomControl.svelte';
|
|
43
|
+
import { shouldShowEmptyBoardHint } from './emptyBoardHint.js';
|
|
44
|
+
import CanvasStage from './view/CanvasStage.svelte';
|
|
45
|
+
import WidgetChromeLayer from './view/WidgetChromeLayer.svelte';
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* COMPONENT PROPS
|
|
49
|
+
*/
|
|
50
|
+
// Class
|
|
51
|
+
let className = '';
|
|
52
|
+
export { className as class };
|
|
53
|
+
// Style
|
|
54
|
+
export let style = '';
|
|
55
|
+
|
|
56
|
+
/** Site /canvas embed sits flush under AppHeader: skip the frame (double stroke). */
|
|
57
|
+
export let showContainerFrame: CanvasHostProps['showContainerFrame'] = DEFAULT_HOST_PROPS.showContainerFrame;
|
|
58
|
+
/** The id or class of an element of the page that stands above its live widgets: the frame of a selected widget card is drawn there. */
|
|
59
|
+
export let widgetSelectionLayerTarget: CanvasHostProps['widgetSelectionLayerTarget'] = DEFAULT_HOST_PROPS.widgetSelectionLayerTarget;
|
|
60
|
+
|
|
61
|
+
// Callback: fires when the user clicks/selects an object with screenshot
|
|
62
|
+
export let onObjectClick: CanvasHostProps['onObjectClick'] = DEFAULT_HOST_PROPS.onObjectClick;
|
|
63
|
+
|
|
64
|
+
// Where the zoom control stands: one of eight places, a row letter and a column letter. TL TC TR (the top edge), CL CR
|
|
65
|
+
// (the middle of the left and of the right edge, where it stands upright) and BL BC BR (the bottom edge). The Figma
|
|
66
|
+
// design has it at the bottom left, the default. Anything that is not one of the eight is the bottom left.
|
|
67
|
+
export let panZoomPosition: PanZoomPosition = DEFAULT_PAN_ZOOM_POSITION;
|
|
68
|
+
|
|
69
|
+
// Where the drawing toolbar stands: any of the same eight places (BC, the bottom centre, is the default). On the left or
|
|
70
|
+
// the right edge it stands upright, and its menus open sideways. The selector bar that replaces the toolbar after the
|
|
71
|
+
// first generation stands in the same place. A host that has something of its own at the bottom centre of the page
|
|
72
|
+
// (Shopify's Sidekick) names the place it wants; two cards named for one place stand side by side. Anything that is not
|
|
73
|
+
// one of the eight is the bottom centre.
|
|
74
|
+
export let toolbarPosition: ToolbarPosition = DEFAULT_TOOLBAR_POSITION;
|
|
75
|
+
|
|
76
|
+
// Wireframe mode: hides the colour fields of the selection panel and keeps new objects white with a dark stroke
|
|
77
|
+
export let wireframeMode: CanvasHostProps['wireframeMode'] = DEFAULT_HOST_PROPS.wireframeMode;
|
|
78
|
+
|
|
79
|
+
// The advanced chrome of a widget card: with it on a card can be turned, and the primary widget has its ring. With it off
|
|
80
|
+
// a card shows its four corners only. Everything else (the Shapes menu, undo and redo, the shape tools, the selection
|
|
81
|
+
// panel) is always there. Default off for the sketch MVP.
|
|
82
|
+
export let advancedFeatures: CanvasHostProps['advancedFeatures'] = DEFAULT_HOST_PROPS.advancedFeatures;
|
|
83
|
+
|
|
84
|
+
/** The element selector on the toolbar. The host owns whether it is on. */
|
|
85
|
+
export let showElementSelector: CanvasHostProps['showElementSelector'] = DEFAULT_HOST_PROPS.showElementSelector;
|
|
86
|
+
/** Drawing tools stay until the first generation. After that, only the selector remains. */
|
|
87
|
+
export let showDrawingTools: CanvasHostProps['showDrawingTools'] = DEFAULT_HOST_PROPS.showDrawingTools;
|
|
88
|
+
export let elementSelectorActive: CanvasHostProps['elementSelectorActive'] = DEFAULT_HOST_PROPS.elementSelectorActive;
|
|
89
|
+
export let onToggleElementSelector: CanvasHostProps['onToggleElementSelector'] = DEFAULT_HOST_PROPS.onToggleElementSelector;
|
|
90
|
+
/** Words for the selector bar that replaces the drawing tools. */
|
|
91
|
+
export let selectorGuide: SelectorGuide | null = DEFAULT_HOST_PROPS.selectorGuide;
|
|
92
|
+
/** The zoom card. Off on the site when debug is off. The save control stays. */
|
|
93
|
+
export let showZoomPanel: CanvasHostProps['showZoomPanel'] = DEFAULT_HOST_PROPS.showZoomPanel;
|
|
94
|
+
/** Accepted for the pages that set it. The design puts Image in the Shapes menu, so it no longer changes what is drawn. */
|
|
95
|
+
export let mediaBtsOnBar: CanvasHostProps['mediaBtsOnBar'] = DEFAULT_HOST_PROPS.mediaBtsOnBar;
|
|
96
|
+
|
|
97
|
+
// Initial canvas data, read as soon as the board is on the screen.
|
|
98
|
+
// Avoids flashing an empty board and double-mount cycles.
|
|
99
|
+
export let initialData: CanvasHostProps['initialData'] = DEFAULT_HOST_PROPS.initialData;
|
|
100
|
+
|
|
101
|
+
// Callback fired once when the canvas is ready: the page can call its functions from then on
|
|
102
|
+
export let onReady: CanvasHostProps['onReady'] = DEFAULT_HOST_PROPS.onReady;
|
|
103
|
+
|
|
104
|
+
// Host-controlled loading flag: when true, the canvas shows its loading overlay.
|
|
105
|
+
// Use this to keep the loader visible while the host fetches data from API before calling loadCanvas().
|
|
106
|
+
export let isExternalDataLoading: CanvasHostProps['isExternalDataLoading'] = DEFAULT_HOST_PROPS.isExternalDataLoading;
|
|
107
|
+
|
|
108
|
+
// Callback fired at the very start of component teardown.
|
|
109
|
+
// Use this in the host page to save canvas state when Vite HMR or navigation destroys this component
|
|
110
|
+
// before the auto-save timer fires.
|
|
111
|
+
export let onBeforeUnmount: CanvasHostProps['onBeforeUnmount'] = DEFAULT_HOST_PROPS.onBeforeUnmount;
|
|
112
|
+
|
|
113
|
+
// Callback fired once the changes have been quiet for autosaveDelayMs, and when the host or the page asks to flush.
|
|
114
|
+
// Receives the serialized canvas JSON so the host doesn't need to call saveCanvas().
|
|
115
|
+
// May return a promise: while it is pending no second autosave starts, and what changes meanwhile goes out in one
|
|
116
|
+
// save after it, so a slow server is never flooded. A promise that rejects counts as a failed save (the changes stay
|
|
117
|
+
// unsaved until the next change or flush).
|
|
118
|
+
export let onAutoSave: CanvasHostProps['onAutoSave'] = DEFAULT_HOST_PROPS.onAutoSave;
|
|
119
|
+
|
|
120
|
+
// Delay in ms for the internal auto-save debounce: how long the canvas waits after the last change before onAutoSave.
|
|
121
|
+
// Only real modifications trigger autosave, not pan/zoom. Default: 3000ms.
|
|
122
|
+
export let autosaveDelayMs: CanvasHostProps['autosaveDelayMs'] = DEFAULT_HOST_PROPS.autosaveDelayMs;
|
|
123
|
+
|
|
124
|
+
// The longest a change waits before it is saved, however busy the person stays. 0 means no limit. Default: 10000ms.
|
|
125
|
+
export let autosaveMaxWaitMs: CanvasHostProps['autosaveMaxWaitMs'] = DEFAULT_HOST_PROPS.autosaveMaxWaitMs;
|
|
126
|
+
|
|
127
|
+
// While set, a due autosave waits another delay instead of serializing.
|
|
128
|
+
// (Flushing, when the page is hidden or the editor closes, saves whatever the hold.)
|
|
129
|
+
export let suspendAutosave: CanvasHostProps['suspendAutosave'] = DEFAULT_HOST_PROPS.suspendAutosave;
|
|
130
|
+
|
|
131
|
+
// Show the Save button next to the zoom control, with the state of the save.
|
|
132
|
+
export let showSaveButton: CanvasHostProps['showSaveButton'] = DEFAULT_HOST_PROPS.showSaveButton;
|
|
133
|
+
|
|
134
|
+
// Callback fired IMMEDIATELY when the canvas becomes dirty, BEFORE the debounced auto-save.
|
|
135
|
+
// Fires frequently: implement lightweight (e.g. set a boolean flag only).
|
|
136
|
+
export let onCanvasDirty: CanvasHostProps['onCanvasDirty'] = DEFAULT_HOST_PROPS.onCanvasDirty;
|
|
137
|
+
|
|
138
|
+
// Callback fired when the user intentionally clears all canvas objects
|
|
139
|
+
export let onCanvasCleared: CanvasHostProps['onCanvasCleared'] = DEFAULT_HOST_PROPS.onCanvasCleared;
|
|
140
|
+
|
|
141
|
+
// Callback: fires when a widget card is selected (clicked). The host can use this to open the details of the widget.
|
|
142
|
+
export let onWidgetImageClick: CanvasHostProps['onWidgetImageClick'] = DEFAULT_HOST_PROPS.onWidgetImageClick;
|
|
143
|
+
|
|
144
|
+
// Callback: classify a freehand stroke the geometry engine could not decide on its own. The host owns the model
|
|
145
|
+
// call; returning null, or a shape the geometry ruled out, leaves the stroke exactly as drawn.
|
|
146
|
+
export let onRecognizeStroke: CanvasHostProps['onRecognizeStroke'] = DEFAULT_HOST_PROPS.onRecognizeStroke;
|
|
147
|
+
|
|
148
|
+
// Callback: fires when something that is not a widget card is selected. The host can use this to close the details panel.
|
|
149
|
+
export let onNonWidgetSelected: CanvasHostProps['onNonWidgetSelected'] = DEFAULT_HOST_PROPS.onNonWidgetSelected;
|
|
150
|
+
|
|
151
|
+
// Callback: fires when a widget card is duplicated/pasted.
|
|
152
|
+
// Receives the source widgetId and the cloned card so the host can duplicate the widget in DB and re-link the clone.
|
|
153
|
+
export let onWidgetShapeDuplicated: CanvasHostProps['onWidgetShapeDuplicated'] = DEFAULT_HOST_PROPS.onWidgetShapeDuplicated;
|
|
154
|
+
|
|
155
|
+
// Callback: fires when a widget card is about to be deleted.
|
|
156
|
+
// Returns a Promise<boolean>: if true, proceed with deletion; if false, cancel.
|
|
157
|
+
export let onWidgetShapeDeleting: CanvasHostProps['onWidgetShapeDeleting'] = DEFAULT_HOST_PROPS.onWidgetShapeDeleting;
|
|
158
|
+
|
|
159
|
+
// Callback: fires when the user renames a widget from the selection panel.
|
|
160
|
+
export let onWidgetRename: CanvasHostProps['onWidgetRename'] = DEFAULT_HOST_PROPS.onWidgetRename;
|
|
161
|
+
|
|
162
|
+
// Callback: fires when the user requests a screenshot refresh for the linked widget.
|
|
163
|
+
export let onRefreshScreenshot: CanvasHostProps['onRefreshScreenshot'] = DEFAULT_HOST_PROPS.onRefreshScreenshot;
|
|
164
|
+
|
|
165
|
+
/** Host persists canvases.primary_widget_id after the canvas marks the primary widget. */
|
|
166
|
+
export let onSetPrimaryWidget: CanvasHostProps['onSetPrimaryWidget'] = DEFAULT_HOST_PROPS.onSetPrimaryWidget;
|
|
167
|
+
|
|
168
|
+
/** Throttled paint hook for HTML overlays (e.g. the live widgets laid over the cards). */
|
|
169
|
+
export let onAfterRender: CanvasHostProps['onAfterRender'] = DEFAULT_HOST_PROPS.onAfterRender;
|
|
170
|
+
|
|
171
|
+
// Widget name resolver: given a widgetId, returns the widget name (or null). Used for the name on a card and in the panel.
|
|
172
|
+
export let getWidgetName: CanvasHostProps['getWidgetName'] = DEFAULT_HOST_PROPS.getWidgetName;
|
|
173
|
+
/** Bumped when names change so the names are resolved again. */
|
|
174
|
+
export let widgetNameRevision: CanvasHostProps['widgetNameRevision'] = DEFAULT_HOST_PROPS.widgetNameRevision;
|
|
175
|
+
/** Returns true when widgetId still exists in the host widget list. */
|
|
176
|
+
export let isWidgetKnown: CanvasHostProps['isWidgetKnown'] = DEFAULT_HOST_PROPS.isWidgetKnown;
|
|
177
|
+
|
|
178
|
+
// Controls whether canvas debug/info logs are printed to the console.
|
|
179
|
+
// Set to false in production or when logs clutter the console.
|
|
180
|
+
export let showLogs: CanvasHostProps['showLogs'] = DEFAULT_HOST_PROPS.showLogs;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Whether a freehand stroke that is a clean shape (a circle, an oval, a rectangle, a triangle, a diamond, a hexagon)
|
|
184
|
+
* becomes that shape. Off unless a page passes true: the package's own flag turns it on for every page.
|
|
185
|
+
*/
|
|
186
|
+
export let shapeSnap: CanvasHostProps['shapeSnap'] = DEFAULT_HOST_PROPS.shapeSnap;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* The language of the canvas: `locale` ("de", "pt-BR") picks the plural rules, the number format and the language
|
|
190
|
+
* the page's own words are in; `messages` are the page's own words, keyed like CANVAS_MESSAGES (a key left out
|
|
191
|
+
* keeps its English text). Without them the canvas speaks English. Both can change while the canvas is open.
|
|
192
|
+
*/
|
|
193
|
+
export let locale: string | null = null;
|
|
194
|
+
export let messages: Readonly<Record<string, unknown>> | null = null;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* THE HOST AND ITS STORES
|
|
198
|
+
*/
|
|
199
|
+
// The one host of this canvas: it owns the engine, the autosave and the conversions. Made with the defaults; the first
|
|
200
|
+
// `setProps` below (it runs before the first paint) gives it what the page set.
|
|
201
|
+
const host = new CanvasHost();
|
|
202
|
+
const { engineStore, uiStore } = host;
|
|
203
|
+
|
|
204
|
+
// The language of everything on the canvas: the toolbar, the panels and the menus read their words from it, and the
|
|
205
|
+
// host reads the ones it says itself (the names on the widget cards).
|
|
206
|
+
const language = provideCanvasLanguage({ locale, messages });
|
|
207
|
+
const { t } = language;
|
|
208
|
+
$: language.update({ locale, messages });
|
|
209
|
+
$: host.setTranslator($t);
|
|
210
|
+
|
|
211
|
+
// Typed as the host's full set of props, so a prop that is added to the host and forgotten here does not compile.
|
|
212
|
+
let hostProps: CanvasHostProps;
|
|
213
|
+
$: hostProps = {
|
|
214
|
+
showContainerFrame,
|
|
215
|
+
widgetSelectionLayerTarget,
|
|
216
|
+
onObjectClick,
|
|
217
|
+
panZoomPosition,
|
|
218
|
+
toolbarPosition,
|
|
219
|
+
wireframeMode,
|
|
220
|
+
advancedFeatures,
|
|
221
|
+
showElementSelector,
|
|
222
|
+
showDrawingTools,
|
|
223
|
+
elementSelectorActive,
|
|
224
|
+
onToggleElementSelector,
|
|
225
|
+
selectorGuide,
|
|
226
|
+
showZoomPanel,
|
|
227
|
+
mediaBtsOnBar,
|
|
228
|
+
initialData,
|
|
229
|
+
onReady,
|
|
230
|
+
isExternalDataLoading,
|
|
231
|
+
onBeforeUnmount,
|
|
232
|
+
onAutoSave,
|
|
233
|
+
autosaveDelayMs,
|
|
234
|
+
autosaveMaxWaitMs,
|
|
235
|
+
suspendAutosave,
|
|
236
|
+
showSaveButton,
|
|
237
|
+
onCanvasDirty,
|
|
238
|
+
onCanvasCleared,
|
|
239
|
+
onWidgetImageClick,
|
|
240
|
+
onRecognizeStroke,
|
|
241
|
+
onNonWidgetSelected,
|
|
242
|
+
onWidgetShapeDuplicated,
|
|
243
|
+
onWidgetShapeDeleting,
|
|
244
|
+
onWidgetRename,
|
|
245
|
+
onRefreshScreenshot,
|
|
246
|
+
onSetPrimaryWidget,
|
|
247
|
+
onAfterRender,
|
|
248
|
+
getWidgetName,
|
|
249
|
+
widgetNameRevision,
|
|
250
|
+
isWidgetKnown,
|
|
251
|
+
showLogs,
|
|
252
|
+
shapeSnap
|
|
253
|
+
};
|
|
254
|
+
$: host.setProps(hostProps);
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* THE DOM
|
|
258
|
+
*/
|
|
259
|
+
let rootElement: HTMLElement | null = null;
|
|
260
|
+
let boardElement: HTMLElement | null = null;
|
|
261
|
+
// The layer menus, popovers and tooltips are drawn into. It exists a moment after the first render, and they open later:
|
|
262
|
+
// they ask for it through a store, so the one that opens first finds it.
|
|
263
|
+
let floatingLayerElement: HTMLElement | null = null;
|
|
264
|
+
const floatingLayer = writable<HTMLElement | null>(null);
|
|
265
|
+
provideFloatingLayer(floatingLayer);
|
|
266
|
+
$: floatingLayer.set(floatingLayerElement);
|
|
267
|
+
// The host starts listening once, when both elements exist (the board is made by the stage inside the root).
|
|
268
|
+
let attached = false;
|
|
269
|
+
$: if (!attached && rootElement && boardElement) {
|
|
270
|
+
attached = true;
|
|
271
|
+
host.attach(rootElement, boardElement);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// Only a canvas that was on a screen has a board to hand over: a page rendered on the server also runs this, and must
|
|
275
|
+
// not call `onBeforeUnmount` with nothing.
|
|
276
|
+
onDestroy(() => {
|
|
277
|
+
if (attached) host.destroy();
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* WHAT IS SHOWN
|
|
282
|
+
*/
|
|
283
|
+
$: engineState = $engineStore;
|
|
284
|
+
$: uiState = $uiStore;
|
|
285
|
+
// The board is loading, or the page says its data is: input waits and the loader shows.
|
|
286
|
+
$: loading = uiState.loadPhase !== 'ready' || isExternalDataLoading;
|
|
287
|
+
$: showEmptyBoardHint = shouldShowEmptyBoardHint({
|
|
288
|
+
showDrawingHint: showDrawingTools,
|
|
289
|
+
emptyHintGateOpen: uiState.emptyHintGateOpen,
|
|
290
|
+
loading,
|
|
291
|
+
sceneObjectCount: engineState.scene.length,
|
|
292
|
+
hasPreviewOverlay: engineState.overlay.preview !== null,
|
|
293
|
+
editingText: engineState.editingTextId !== null
|
|
294
|
+
});
|
|
295
|
+
// A live widget laid over a selected card hides the frame the board draws, so the page's own layer draws it instead.
|
|
296
|
+
$: frameElsewhere = widgetSelectionLayerTarget !== '' && onlyCardIsSelected(engineState);
|
|
297
|
+
$: showSelectorBar = !showDrawingTools && showElementSelector;
|
|
298
|
+
$: showZoomControl = showZoomPanel || showSaveButton;
|
|
299
|
+
// Where the two cards of the chrome stand. Each names one of eight anchors; two named for the same one share a slot, side by side.
|
|
300
|
+
$: toolbarAnchor = normalizeToolbarPosition(toolbarPosition);
|
|
301
|
+
$: zoomAnchor = normalizePanZoomPosition(panZoomPosition);
|
|
302
|
+
$: slots = chromeSlots(toolbarAnchor, zoomAnchor, { toolbar: showDrawingTools || showSelectorBar, zoom: showZoomControl });
|
|
303
|
+
$: zoomVisibleFrom = zoomVisibilityClasses(toolbarAnchor, zoomAnchor);
|
|
304
|
+
// The selection panel stands in the top corner at the end of the line: it keeps clear of the cards the page put there.
|
|
305
|
+
$: panelClearance = panelClearanceFor(slots);
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* THE FUNCTIONS THE PAGE CALLS
|
|
309
|
+
*
|
|
310
|
+
* Each one is the host's method of the same name, with its type. The list is `CANVAS_EXPORTED_FUNCTION_NAMES`.
|
|
311
|
+
*/
|
|
312
|
+
export const shapeFillColor = forwardToHost(host, 'shapeFillColor');
|
|
313
|
+
export const captureCanvasSketch = forwardToHost(host, 'captureCanvasSketch');
|
|
314
|
+
export const absorbCanvasSketchIntoWidget = forwardToHost(host, 'absorbCanvasSketchIntoWidget');
|
|
315
|
+
export const deselectAll = forwardToHost(host, 'deselectAll');
|
|
316
|
+
export const duplicateSelectedObjects = forwardToHost(host, 'duplicateSelectedObjects');
|
|
317
|
+
export const deleteSelectedObjects = forwardToHost(host, 'deleteSelectedObjects');
|
|
318
|
+
export const markSelectedAsDuplicating = forwardToHost(host, 'markSelectedAsDuplicating');
|
|
319
|
+
export const linkObjectToWidget = forwardToHost(host, 'linkObjectToWidget');
|
|
320
|
+
export const linkFrameToWidget = forwardToHost(host, 'linkFrameToWidget');
|
|
321
|
+
export const replaceObjectWithWidgetImage = forwardToHost(host, 'replaceObjectWithWidgetImage');
|
|
322
|
+
export const updateWidgetImage = forwardToHost(host, 'updateWidgetImage');
|
|
323
|
+
export const selectWidgetShape = forwardToHost(host, 'selectWidgetShape');
|
|
324
|
+
export const listWidgetShapeScreenRects = forwardToHost(host, 'listWidgetShapeScreenRects');
|
|
325
|
+
export const getWidgetShapeScreenRect = forwardToHost(host, 'getWidgetShapeScreenRect');
|
|
326
|
+
export const getObjectScreenRect = forwardToHost(host, 'getObjectScreenRect');
|
|
327
|
+
export const getWidgetShapeDataUrl = forwardToHost(host, 'getWidgetShapeDataUrl');
|
|
328
|
+
export const setWidgetShapeLivePreviewHiddenImage = forwardToHost(host, 'setWidgetShapeLivePreviewHiddenImage');
|
|
329
|
+
export const addWidgetShape = forwardToHost(host, 'addWidgetShape');
|
|
330
|
+
export const getLinkedWidgetIds = forwardToHost(host, 'getLinkedWidgetIds');
|
|
331
|
+
export const keepOnlyWidgetShape = forwardToHost(host, 'keepOnlyWidgetShape');
|
|
332
|
+
export const hydrateWidgetShapeMetadata = forwardToHost(host, 'hydrateWidgetShapeMetadata');
|
|
333
|
+
export const markOrphanedWidgetShapes = forwardToHost(host, 'markOrphanedWidgetShapes');
|
|
334
|
+
export const onSelectSelectTool = forwardToHost(host, 'onSelectSelectTool');
|
|
335
|
+
export const onSelectLibraryShapeTool = forwardToHost(host, 'onSelectLibraryShapeTool');
|
|
336
|
+
export const onSelectEraseTool = forwardToHost(host, 'onSelectEraseTool');
|
|
337
|
+
export const onSelectDrawTool = forwardToHost(host, 'onSelectDrawTool');
|
|
338
|
+
export const onSelectTextTool = forwardToHost(host, 'onSelectTextTool');
|
|
339
|
+
export const onSelectArrowTool = forwardToHost(host, 'onSelectArrowTool');
|
|
340
|
+
export const onSelectShapeTool = forwardToHost(host, 'onSelectShapeTool');
|
|
341
|
+
export const onSelectFrameTool = forwardToHost(host, 'onSelectFrameTool');
|
|
342
|
+
export const setPrimaryWidgetShape = forwardToHost(host, 'setPrimaryWidgetShape');
|
|
343
|
+
export const getPrimaryWidgetId = forwardToHost(host, 'getPrimaryWidgetId');
|
|
344
|
+
export const setWidgetShapeBodyDragAllowed = forwardToHost(host, 'setWidgetShapeBodyDragAllowed');
|
|
345
|
+
export const translateWidgetShapeByScreen = forwardToHost(host, 'translateWidgetShapeByScreen');
|
|
346
|
+
export const commitWidgetShapeTranslate = forwardToHost(host, 'commitWidgetShapeTranslate');
|
|
347
|
+
export const setWidgetShapeOverlayDragActive = forwardToHost(host, 'setWidgetShapeOverlayDragActive');
|
|
348
|
+
export const selectWidgetShapeById = forwardToHost(host, 'selectWidgetShapeById');
|
|
349
|
+
export const getSelectedWidgetShapeId = forwardToHost(host, 'getSelectedWidgetShapeId');
|
|
350
|
+
export const getSelectedObject = forwardToHost(host, 'getSelectedObject');
|
|
351
|
+
export const getHoveredWidgetShapeId = forwardToHost(host, 'getHoveredWidgetShapeId');
|
|
352
|
+
export const onSelectImageTool = forwardToHost(host, 'onSelectImageTool');
|
|
353
|
+
export const onSelectVideoTool = forwardToHost(host, 'onSelectVideoTool');
|
|
354
|
+
export const onSelectPanTool = forwardToHost(host, 'onSelectPanTool');
|
|
355
|
+
export const zoomIn = forwardToHost(host, 'zoomIn');
|
|
356
|
+
export const zoomOut = forwardToHost(host, 'zoomOut');
|
|
357
|
+
export const zoomTo = forwardToHost(host, 'zoomTo');
|
|
358
|
+
export const zoomReset = forwardToHost(host, 'zoomReset');
|
|
359
|
+
export const zoomFit = forwardToHost(host, 'zoomFit');
|
|
360
|
+
export const onGroupSelection = forwardToHost(host, 'onGroupSelection');
|
|
361
|
+
export const onUngroupSelection = forwardToHost(host, 'onUngroupSelection');
|
|
362
|
+
export const onSelectAllObjects = forwardToHost(host, 'onSelectAllObjects');
|
|
363
|
+
export const onDeselectAllObjects = forwardToHost(host, 'onDeselectAllObjects');
|
|
364
|
+
export const flushAutosave = forwardToHost(host, 'flushAutosave');
|
|
365
|
+
export const saveNow = forwardToHost(host, 'saveNow');
|
|
366
|
+
export const undo = forwardToHost(host, 'undo');
|
|
367
|
+
export const redo = forwardToHost(host, 'redo');
|
|
368
|
+
export const saveCanvas = forwardToHost(host, 'saveCanvas');
|
|
369
|
+
export const loadCanvas = forwardToHost(host, 'loadCanvas');
|
|
370
|
+
export const onClearAllObjects = forwardToHost(host, 'onClearAllObjects');
|
|
371
|
+
export const addText = forwardToHost(host, 'addText');
|
|
372
|
+
export const addTriangle = forwardToHost(host, 'addTriangle');
|
|
373
|
+
export const addRect = forwardToHost(host, 'addRect');
|
|
374
|
+
export const addCircle = forwardToHost(host, 'addCircle');
|
|
375
|
+
export const addFrame = forwardToHost(host, 'addFrame');
|
|
376
|
+
export const addImage = forwardToHost(host, 'addImage');
|
|
377
|
+
// Added to the contract. The widget creator's in-flight branches call it, and the simple-board branch
|
|
378
|
+
// (feat/shopify-feedback-canvas) adds the same function (same name, same answer).
|
|
379
|
+
export const removeSketchObjectsKeepingWidget = forwardToHost(host, 'removeSketchObjectsKeepingWidget');
|
|
380
|
+
</script>
|
|
381
|
+
|
|
382
|
+
<Tooltip.Provider delayDuration={400} skipDelayDuration={200}>
|
|
383
|
+
<div
|
|
384
|
+
bind:this={rootElement}
|
|
385
|
+
class="{className ? className + ' ' : ''}canvas-container @container relative isolate h-full w-full overflow-visible bg-muted text-foreground outline-hidden {showContainerFrame ? BOARD_FRAME_CLASSES : ''}"
|
|
386
|
+
{style}
|
|
387
|
+
data-canvas-root
|
|
388
|
+
>
|
|
389
|
+
<!-- The board: the pointer surface, with the objects, the selection, the text field and the loader. -->
|
|
390
|
+
<CanvasStage
|
|
391
|
+
{host}
|
|
392
|
+
state={engineState}
|
|
393
|
+
ui={uiState}
|
|
394
|
+
{advancedFeatures}
|
|
395
|
+
{loading}
|
|
396
|
+
{showEmptyBoardHint}
|
|
397
|
+
{frameElsewhere}
|
|
398
|
+
bind:board={boardElement}
|
|
399
|
+
/>
|
|
400
|
+
|
|
401
|
+
<!-- The chrome: siblings of the board, so a press on a button never reaches it. It waits while the board loads. -->
|
|
402
|
+
<div class="pointer-events-none absolute inset-0 z-10 transition-opacity duration-200 motion-reduce:transition-none {loading ? 'opacity-60' : ''}" inert={loading}>
|
|
403
|
+
<!-- One slot for each place that has a card: the toolbar (or the selector bar) and the zoom control, side by side when they share a place. -->
|
|
404
|
+
{#each slots as slot (slot.anchor)}
|
|
405
|
+
<div class={slot.classes} data-canvas-slot={slot.anchor}>
|
|
406
|
+
{#each slot.cards as card (card)}
|
|
407
|
+
{#if card === 'toolbar'}
|
|
408
|
+
{#if showDrawingTools}
|
|
409
|
+
<CanvasToolbar {host} state={engineState} ui={uiState} {showDrawingTools} anchor={toolbarAnchor} />
|
|
410
|
+
{:else}
|
|
411
|
+
<SelectorBar active={elementSelectorActive} guide={selectorGuide} anchor={toolbarAnchor} onToggle={() => onToggleElementSelector?.()} />
|
|
412
|
+
{/if}
|
|
413
|
+
{:else}
|
|
414
|
+
<ZoomControl {host} state={engineState} ui={uiState} anchor={zoomAnchor} visibleFrom={zoomVisibleFrom} showZoom={showZoomPanel} {showSaveButton} />
|
|
415
|
+
{/if}
|
|
416
|
+
{/each}
|
|
417
|
+
</div>
|
|
418
|
+
{/each}
|
|
419
|
+
</div>
|
|
420
|
+
|
|
421
|
+
<!-- The panel that edits the selection: a selection opens it, and its close button puts it away. -->
|
|
422
|
+
<SelectionPanel
|
|
423
|
+
{host}
|
|
424
|
+
state={engineState}
|
|
425
|
+
ui={uiState}
|
|
426
|
+
{wireframeMode}
|
|
427
|
+
canCapture={!!onObjectClick}
|
|
428
|
+
canConvert={!!(onWidgetRename || onRefreshScreenshot || onWidgetImageClick || onSetPrimaryWidget)}
|
|
429
|
+
canRename={!!onWidgetRename}
|
|
430
|
+
canRefresh={!!onRefreshScreenshot}
|
|
431
|
+
canOpenDetails={!!onWidgetImageClick}
|
|
432
|
+
clearance={panelClearance}
|
|
433
|
+
/>
|
|
434
|
+
|
|
435
|
+
<CanvasContextMenu {host} state={engineState} ui={uiState} board={boardElement} />
|
|
436
|
+
|
|
437
|
+
{#if uiState.shortcutsOpen}
|
|
438
|
+
<ShortcutsPanel {host} />
|
|
439
|
+
{/if}
|
|
440
|
+
|
|
441
|
+
<!-- The frame of a selected widget card, in the page's layer above its live widgets. -->
|
|
442
|
+
{#if frameElsewhere}
|
|
443
|
+
<WidgetChromeLayer {host} state={engineState} gestureKind={uiState.gestureKind} {advancedFeatures} target={widgetSelectionLayerTarget} />
|
|
444
|
+
{/if}
|
|
445
|
+
|
|
446
|
+
<!-- Where every menu, popover and tooltip is drawn: a layer without a size that is its own containing block. -->
|
|
447
|
+
<div bind:this={floatingLayerElement} class={FLOATING_LAYER_CLASSES} data-canvas-floating-layer></div>
|
|
448
|
+
</div>
|
|
449
|
+
</Tooltip.Provider>
|