@widgetic/canvas 0.5.26 → 0.5.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas/Canvas.svelte +545 -141
- package/dist/canvas/Canvas.svelte.d.ts +224 -218
- package/dist/canvas/CanvasToolbar.svelte.d.ts +66 -60
- package/dist/canvas/ContextMenu.svelte.d.ts +40 -35
- package/dist/canvas/PanZoomPanel.svelte.d.ts +35 -31
- package/dist/canvas/WidgetSelectionLayer.svelte.d.ts +9 -13
- package/dist/canvas/props-panel/PropsPanel.svelte +11 -6
- package/dist/canvas/props-panel/PropsPanel.svelte.d.ts +82 -78
- package/dist/canvas/props-panel/TextPropsICSection.svelte.d.ts +38 -34
- package/dist/components/CanvasBoardPlaceholder.svelte +63 -0
- package/dist/components/CanvasBoardPlaceholder.svelte.d.ts +22 -0
- package/dist/components/Tooltip.svelte.d.ts +30 -19
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +2 -0
- package/dist/components/input-controls/ColorIC.svelte.d.ts +24 -20
- package/dist/components/input-controls/FontSelectorIC.svelte.d.ts +19 -15
- package/dist/components/input-controls/SliderUnitIC.svelte.d.ts +26 -22
- package/dist/components/input-controls/TextAlignIC.svelte.d.ts +19 -15
- package/dist/components/input-controls/TextStyleIC.svelte.d.ts +23 -19
- package/dist/i18n/messages.d.ts +1 -1
- package/dist/i18n/messages.js +1 -1
- package/package.json +3 -2
|
@@ -1,174 +1,83 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Canvas } from 'fabric';
|
|
2
2
|
import type { WidgetConversionPayload, StrokeRecognizer } from './types';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
initialData?: string | null;
|
|
29
|
-
onReady?: (() => void) | null;
|
|
30
|
-
isExternalDataLoading?: boolean;
|
|
31
|
-
onBeforeUnmount?: ((json: string | null) => void) | null;
|
|
32
|
-
onAutoSave?: ((json: string | null) => void) | null;
|
|
33
|
-
autosaveDelayMs?: number;
|
|
34
|
-
suspendAutosave?: boolean;
|
|
35
|
-
showSaveButton?: boolean;
|
|
36
|
-
onCanvasDirty?: (() => void) | null;
|
|
37
|
-
onCanvasCleared?: (() => void) | null;
|
|
38
|
-
onConvertToWidget?: ((data: WidgetConversionPayload) => void) | null;
|
|
39
|
-
onWidgetImageClick?: ((widgetId: string) => void) | null;
|
|
40
|
-
onRecognizeStroke?: StrokeRecognizer | null;
|
|
41
|
-
onNonWidgetSelected?: (() => void) | null;
|
|
42
|
-
onWidgetShapeDuplicated?: ((sourceWidgetId: string, clonedObject: any) => void) | null;
|
|
43
|
-
onWidgetShapeDeleting?: ((widgetId: string) => Promise<boolean>) | null;
|
|
44
|
-
onWidgetRename?: ((widgetId: string, newName: string) => void) | null;
|
|
45
|
-
onRefreshScreenshot?: ((widgetId: string) => void) | null;
|
|
46
|
-
/** Host persists canvases.primary_widget_id after Canvas paints the red stroke. */ onSetPrimaryWidget?: ((widgetId: string) => void) | null;
|
|
47
|
-
/** Throttled paint hook for HTML overlays (e.g. live WidgetShape iframes). */ onAfterRender?: (() => void) | null;
|
|
48
|
-
getWidgetName?: ((widgetId: string) => string | null) | null;
|
|
49
|
-
/** Bumped when names change so PropsPanel re-resolves getWidgetName. */ widgetNameRevision?: number;
|
|
50
|
-
/** Returns true when widgetId still exists in the host widget list. */ isWidgetKnown?: ((widgetId: string) => boolean) | null;
|
|
51
|
-
showLogs?: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* The language of the canvas: `locale` ("de", "pt-BR") picks the plural rules, the number format and the language
|
|
54
|
-
* the page's own words are in; `messages` are the page's own words, keyed like CANVAS_MESSAGES (a key left out
|
|
55
|
-
* keeps its English text). Without them the canvas speaks English. Both can change while the canvas is open.
|
|
56
|
-
*/ locale?: string | null;
|
|
57
|
-
messages?: Readonly<Record<string, unknown>> | null;
|
|
58
|
-
shapeFillColor?: () => string;
|
|
59
|
-
deselectAll?: () => void;
|
|
60
|
-
duplicateSelectedObjects?: () => Promise<void>;
|
|
61
|
-
deleteSelectedObjects?: () => Promise<void>;
|
|
62
|
-
markSelectedAsDuplicating?: () => void;
|
|
63
|
-
linkObjectToWidget?: (fabricObject: any, widgetId: string, widgetName?: string | null) => void;
|
|
64
|
-
linkFrameToWidget?: (objectId: string, widgetId: string) => void;
|
|
65
|
-
replaceObjectWithWidgetImage?: (objectId: string, widgetId: string, screenshotDataUrl: string) => Promise<string | null>;
|
|
66
|
-
updateWidgetImage?: (widgetId: string, newScreenshotDataUrl: string) => void;
|
|
67
|
-
selectWidgetShape?: (widgetId: string) => boolean;
|
|
68
|
-
listWidgetShapeScreenRects?: () => {
|
|
69
|
-
left: number;
|
|
70
|
-
top: number;
|
|
71
|
-
width: number;
|
|
72
|
-
height: number;
|
|
73
|
-
localWidth: number;
|
|
74
|
-
localHeight: number;
|
|
75
|
-
matrix: number[];
|
|
76
|
-
widgetId: string;
|
|
77
|
-
hovered: boolean;
|
|
78
|
-
}[];
|
|
79
|
-
getWidgetShapeScreenRect?: (widgetId: string) => {
|
|
80
|
-
left: number;
|
|
81
|
-
top: number;
|
|
82
|
-
width: number;
|
|
83
|
-
height: number;
|
|
84
|
-
viewportLeft: number;
|
|
85
|
-
viewportTop: number;
|
|
86
|
-
viewportWidth: number;
|
|
87
|
-
viewportHeight: number;
|
|
88
|
-
} | null;
|
|
89
|
-
getObjectScreenRect?: (objectId: string) => {
|
|
3
|
+
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
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
5
|
+
$$bindings?: Bindings;
|
|
6
|
+
} & Exports;
|
|
7
|
+
(internal: unknown, props: Props & {
|
|
8
|
+
$$events?: Events;
|
|
9
|
+
$$slots?: Slots;
|
|
10
|
+
}): Exports & {
|
|
11
|
+
$set?: any;
|
|
12
|
+
$on?: any;
|
|
13
|
+
};
|
|
14
|
+
z_$$bindings?: Bindings;
|
|
15
|
+
}
|
|
16
|
+
declare const Canvas: $$__sveltets_2_IsomorphicComponent<{
|
|
17
|
+
/**
|
|
18
|
+
* COMPONENT PROPS
|
|
19
|
+
*/ class?: string;
|
|
20
|
+
style?: string;
|
|
21
|
+
/** Site /canvas embed sits flush under AppHeader — skip the 2px frame (double stroke). */ showContainerFrame?: boolean;
|
|
22
|
+
/** Mount native widget controls alongside host HTML previews, never over their entire body. */ widgetSelectionLayerTarget?: string;
|
|
23
|
+
onObjectClick?: ((data: {
|
|
24
|
+
screenshot: string;
|
|
25
|
+
objectType: string;
|
|
26
|
+
customType?: string;
|
|
27
|
+
bounds: {
|
|
90
28
|
left: number;
|
|
91
29
|
top: number;
|
|
92
30
|
width: number;
|
|
93
31
|
height: number;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
loadCanvas?: (jsonString: string) => Promise<void>;
|
|
144
|
-
onClearAllObjects?: () => void;
|
|
145
|
-
addText?: () => void;
|
|
146
|
-
addTriangle?: () => void;
|
|
147
|
-
addRect?: () => void;
|
|
148
|
-
addCircle?: () => void;
|
|
149
|
-
addFrame?: () => void;
|
|
150
|
-
addImage?: () => void;
|
|
151
|
-
};
|
|
152
|
-
events: {
|
|
153
|
-
[evt: string]: CustomEvent<any>;
|
|
154
|
-
};
|
|
155
|
-
slots: {};
|
|
156
|
-
};
|
|
157
|
-
export type CanvasProps = typeof __propDef.props;
|
|
158
|
-
export type CanvasEvents = typeof __propDef.events;
|
|
159
|
-
export type CanvasSlots = typeof __propDef.slots;
|
|
160
|
-
export default class Canvas extends SvelteComponentTyped<CanvasProps, CanvasEvents, CanvasSlots> {
|
|
161
|
-
get shapeFillColor(): () => string;
|
|
162
|
-
get deselectAll(): () => void;
|
|
163
|
-
get duplicateSelectedObjects(): () => Promise<void>;
|
|
164
|
-
get deleteSelectedObjects(): () => Promise<void>;
|
|
165
|
-
get markSelectedAsDuplicating(): () => void;
|
|
166
|
-
get linkObjectToWidget(): (fabricObject: any, widgetId: string, widgetName?: string | null) => void;
|
|
167
|
-
get linkFrameToWidget(): (objectId: string, widgetId: string) => void;
|
|
168
|
-
get replaceObjectWithWidgetImage(): (objectId: string, widgetId: string, screenshotDataUrl: string) => Promise<string | null>;
|
|
169
|
-
get updateWidgetImage(): (widgetId: string, newScreenshotDataUrl: string) => void;
|
|
170
|
-
get selectWidgetShape(): (widgetId: string) => boolean;
|
|
171
|
-
get listWidgetShapeScreenRects(): () => {
|
|
32
|
+
};
|
|
33
|
+
objectId: string;
|
|
34
|
+
metadata: Record<string, any>;
|
|
35
|
+
}) => void) | null;
|
|
36
|
+
panZoomPosition?: "TL" | "TC" | "TR" | "BL" | "BC" | "BR";
|
|
37
|
+
wireframeMode?: boolean;
|
|
38
|
+
advancedFeatures?: boolean;
|
|
39
|
+
/** When true and advanced is on, Frame/Image/Video stay on the toolbar. Default true. */ mediaBtsOnBar?: boolean;
|
|
40
|
+
initialData?: string | null;
|
|
41
|
+
onReady?: (() => void) | null;
|
|
42
|
+
isExternalDataLoading?: boolean;
|
|
43
|
+
onBeforeUnmount?: ((json: string | null) => void) | null;
|
|
44
|
+
onAutoSave?: ((json: string | null) => void) | null;
|
|
45
|
+
autosaveDelayMs?: number;
|
|
46
|
+
suspendAutosave?: boolean;
|
|
47
|
+
showSaveButton?: boolean;
|
|
48
|
+
onCanvasDirty?: (() => void) | null;
|
|
49
|
+
onCanvasCleared?: (() => void) | null;
|
|
50
|
+
onConvertToWidget?: ((data: WidgetConversionPayload) => void) | null;
|
|
51
|
+
onWidgetImageClick?: ((widgetId: string) => void) | null;
|
|
52
|
+
onRecognizeStroke?: StrokeRecognizer | null;
|
|
53
|
+
onNonWidgetSelected?: (() => void) | null;
|
|
54
|
+
onWidgetShapeDuplicated?: ((sourceWidgetId: string, clonedObject: any) => void) | null;
|
|
55
|
+
onWidgetShapeDeleting?: ((widgetId: string) => Promise<boolean>) | null;
|
|
56
|
+
onWidgetRename?: ((widgetId: string, newName: string) => void) | null;
|
|
57
|
+
onRefreshScreenshot?: ((widgetId: string) => void) | null;
|
|
58
|
+
/** Host persists canvases.primary_widget_id after Canvas paints the red stroke. */ onSetPrimaryWidget?: ((widgetId: string) => void) | null;
|
|
59
|
+
/** Throttled paint hook for HTML overlays (e.g. live WidgetShape iframes). */ onAfterRender?: (() => void) | null;
|
|
60
|
+
getWidgetName?: ((widgetId: string) => string | null) | null;
|
|
61
|
+
/** Bumped when names change so PropsPanel re-resolves getWidgetName. */ widgetNameRevision?: number;
|
|
62
|
+
/** Returns true when widgetId still exists in the host widget list. */ isWidgetKnown?: ((widgetId: string) => boolean) | null;
|
|
63
|
+
showLogs?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* The language of the canvas: `locale` ("de", "pt-BR") picks the plural rules, the number format and the language
|
|
66
|
+
* the page's own words are in; `messages` are the page's own words, keyed like CANVAS_MESSAGES (a key left out
|
|
67
|
+
* keeps its English text). Without them the canvas speaks English. Both can change while the canvas is open.
|
|
68
|
+
*/ locale?: string | null;
|
|
69
|
+
messages?: Readonly<Record<string, unknown>> | null;
|
|
70
|
+
shapeFillColor?: () => string;
|
|
71
|
+
deselectAll?: () => void;
|
|
72
|
+
duplicateSelectedObjects?: () => Promise<void>;
|
|
73
|
+
deleteSelectedObjects?: () => Promise<void>;
|
|
74
|
+
markSelectedAsDuplicating?: () => void;
|
|
75
|
+
linkObjectToWidget?: (fabricObject: any, widgetId: string, widgetName?: string | null) => void;
|
|
76
|
+
linkFrameToWidget?: (objectId: string, widgetId: string) => void;
|
|
77
|
+
replaceObjectWithWidgetImage?: (objectId: string, widgetId: string, screenshotDataUrl: string) => Promise<string | null>;
|
|
78
|
+
updateWidgetImage?: (widgetId: string, newScreenshotDataUrl: string) => void;
|
|
79
|
+
selectWidgetShape?: (widgetId: string) => boolean;
|
|
80
|
+
listWidgetShapeScreenRects?: () => {
|
|
172
81
|
left: number;
|
|
173
82
|
top: number;
|
|
174
83
|
width: number;
|
|
@@ -179,7 +88,7 @@ export default class Canvas extends SvelteComponentTyped<CanvasProps, CanvasEven
|
|
|
179
88
|
widgetId: string;
|
|
180
89
|
hovered: boolean;
|
|
181
90
|
}[];
|
|
182
|
-
|
|
91
|
+
getWidgetShapeScreenRect?: (widgetId: string) => {
|
|
183
92
|
left: number;
|
|
184
93
|
top: number;
|
|
185
94
|
width: number;
|
|
@@ -189,7 +98,7 @@ export default class Canvas extends SvelteComponentTyped<CanvasProps, CanvasEven
|
|
|
189
98
|
viewportWidth: number;
|
|
190
99
|
viewportHeight: number;
|
|
191
100
|
} | null;
|
|
192
|
-
|
|
101
|
+
getObjectScreenRect?: (objectId: string) => {
|
|
193
102
|
left: number;
|
|
194
103
|
top: number;
|
|
195
104
|
width: number;
|
|
@@ -199,57 +108,154 @@ export default class Canvas extends SvelteComponentTyped<CanvasProps, CanvasEven
|
|
|
199
108
|
viewportWidth: number;
|
|
200
109
|
viewportHeight: number;
|
|
201
110
|
} | null;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
111
|
+
getWidgetShapeDataUrl?: (widgetId: string) => string | null;
|
|
112
|
+
setWidgetShapeLivePreviewHiddenImage?: (widgetId: string, hidden: boolean) => void;
|
|
113
|
+
addWidgetShape?: (widgetId: string, widgetName?: string, gridIndex?: number, totalCount?: number, previewImageUrl?: string | null) => string | null;
|
|
114
|
+
getLinkedWidgetIds?: () => Set<string>;
|
|
115
|
+
hydrateWidgetShapeMetadata?: (widgetsById: Map<string, {
|
|
207
116
|
name?: string | null;
|
|
208
117
|
thumbnailUrl?: string | null;
|
|
209
118
|
thumbnail_url?: string | null;
|
|
210
119
|
}>) => number;
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
}
|
|
255
|
-
|
|
120
|
+
markOrphanedWidgetShapes?: (validWidgetIds: Set<string>) => number;
|
|
121
|
+
onSelectSelectTool?: () => void;
|
|
122
|
+
onSelectLibraryShapeTool?: (shapeKey: string, pathData: string) => void;
|
|
123
|
+
onSelectEraseTool?: () => void;
|
|
124
|
+
onSelectDrawTool?: () => void;
|
|
125
|
+
onSelectTextTool?: () => void;
|
|
126
|
+
onSelectArrowTool?: () => void;
|
|
127
|
+
onSelectShapeTool?: (shapeType: "rect" | "circle" | "circle-true" | "triangle" | "arrow") => void;
|
|
128
|
+
onSelectFrameTool?: () => void;
|
|
129
|
+
setPrimaryWidgetShape?: (widgetId: string) => boolean;
|
|
130
|
+
getPrimaryWidgetId?: () => string | null;
|
|
131
|
+
setWidgetShapeBodyDragAllowed?: (widgetId: string, allowed: boolean) => void;
|
|
132
|
+
translateWidgetShapeByScreen?: (widgetId: string, dxScreen: number, dyScreen: number) => boolean;
|
|
133
|
+
commitWidgetShapeTranslate?: (widgetId?: string | null) => void;
|
|
134
|
+
setWidgetShapeOverlayDragActive?: (active: boolean) => void;
|
|
135
|
+
selectWidgetShapeById?: (widgetId: string) => boolean;
|
|
136
|
+
getSelectedWidgetShapeId?: () => string | null;
|
|
137
|
+
getSelectedObject?: () => any;
|
|
138
|
+
getHoveredWidgetShapeId?: () => string | null;
|
|
139
|
+
onSelectImageTool?: () => void;
|
|
140
|
+
onSelectVideoTool?: () => void;
|
|
141
|
+
onSelectPanTool?: () => void;
|
|
142
|
+
zoomIn?: () => void;
|
|
143
|
+
zoomOut?: () => void;
|
|
144
|
+
zoomTo?: (percent: number) => void;
|
|
145
|
+
zoomReset?: () => void;
|
|
146
|
+
zoomFit?: () => void;
|
|
147
|
+
onGroupSelection?: () => string | null;
|
|
148
|
+
onUngroupSelection?: () => void;
|
|
149
|
+
onSelectAllObjects?: () => void;
|
|
150
|
+
onDeselectAllObjects?: () => void;
|
|
151
|
+
saveNow?: () => void;
|
|
152
|
+
undo?: () => Promise<void>;
|
|
153
|
+
redo?: () => Promise<void>;
|
|
154
|
+
saveCanvas?: () => string | null;
|
|
155
|
+
loadCanvas?: (jsonString: string) => Promise<void>;
|
|
156
|
+
onClearAllObjects?: () => void;
|
|
157
|
+
addText?: () => void;
|
|
158
|
+
addTriangle?: () => void;
|
|
159
|
+
addRect?: () => void;
|
|
160
|
+
addCircle?: () => void;
|
|
161
|
+
addFrame?: () => void;
|
|
162
|
+
addImage?: () => void;
|
|
163
|
+
}, {
|
|
164
|
+
[evt: string]: CustomEvent<any>;
|
|
165
|
+
}, {}, {
|
|
166
|
+
shapeFillColor: () => string;
|
|
167
|
+
deselectAll: () => void;
|
|
168
|
+
duplicateSelectedObjects: () => Promise<void>;
|
|
169
|
+
deleteSelectedObjects: () => Promise<void>;
|
|
170
|
+
markSelectedAsDuplicating: () => void;
|
|
171
|
+
linkObjectToWidget: (fabricObject: any, widgetId: string, widgetName?: string | null) => void;
|
|
172
|
+
linkFrameToWidget: (objectId: string, widgetId: string) => void;
|
|
173
|
+
replaceObjectWithWidgetImage: (objectId: string, widgetId: string, screenshotDataUrl: string) => Promise<string | null>;
|
|
174
|
+
updateWidgetImage: (widgetId: string, newScreenshotDataUrl: string) => void;
|
|
175
|
+
selectWidgetShape: (widgetId: string) => boolean;
|
|
176
|
+
listWidgetShapeScreenRects: () => {
|
|
177
|
+
left: number;
|
|
178
|
+
top: number;
|
|
179
|
+
width: number;
|
|
180
|
+
height: number;
|
|
181
|
+
localWidth: number;
|
|
182
|
+
localHeight: number;
|
|
183
|
+
matrix: number[];
|
|
184
|
+
widgetId: string;
|
|
185
|
+
hovered: boolean;
|
|
186
|
+
}[];
|
|
187
|
+
getWidgetShapeScreenRect: (widgetId: string) => {
|
|
188
|
+
left: number;
|
|
189
|
+
top: number;
|
|
190
|
+
width: number;
|
|
191
|
+
height: number;
|
|
192
|
+
viewportLeft: number;
|
|
193
|
+
viewportTop: number;
|
|
194
|
+
viewportWidth: number;
|
|
195
|
+
viewportHeight: number;
|
|
196
|
+
} | null;
|
|
197
|
+
getObjectScreenRect: (objectId: string) => {
|
|
198
|
+
left: number;
|
|
199
|
+
top: number;
|
|
200
|
+
width: number;
|
|
201
|
+
height: number;
|
|
202
|
+
viewportLeft: number;
|
|
203
|
+
viewportTop: number;
|
|
204
|
+
viewportWidth: number;
|
|
205
|
+
viewportHeight: number;
|
|
206
|
+
} | null;
|
|
207
|
+
getWidgetShapeDataUrl: (widgetId: string) => string | null;
|
|
208
|
+
setWidgetShapeLivePreviewHiddenImage: (widgetId: string, hidden: boolean) => void;
|
|
209
|
+
addWidgetShape: (widgetId: string, widgetName?: string, gridIndex?: number, totalCount?: number, previewImageUrl?: string | null) => string | null;
|
|
210
|
+
getLinkedWidgetIds: () => Set<string>;
|
|
211
|
+
hydrateWidgetShapeMetadata: (widgetsById: Map<string, {
|
|
212
|
+
name?: string | null;
|
|
213
|
+
thumbnailUrl?: string | null;
|
|
214
|
+
thumbnail_url?: string | null;
|
|
215
|
+
}>) => number;
|
|
216
|
+
markOrphanedWidgetShapes: (validWidgetIds: Set<string>) => number;
|
|
217
|
+
onSelectSelectTool: () => void;
|
|
218
|
+
onSelectLibraryShapeTool: (shapeKey: string, pathData: string) => void;
|
|
219
|
+
onSelectEraseTool: () => void;
|
|
220
|
+
onSelectDrawTool: () => void;
|
|
221
|
+
onSelectTextTool: () => void;
|
|
222
|
+
onSelectArrowTool: () => void;
|
|
223
|
+
onSelectShapeTool: (shapeType: "rect" | "circle" | "circle-true" | "triangle" | "arrow") => void;
|
|
224
|
+
onSelectFrameTool: () => void;
|
|
225
|
+
setPrimaryWidgetShape: (widgetId: string) => boolean;
|
|
226
|
+
getPrimaryWidgetId: () => string | null;
|
|
227
|
+
setWidgetShapeBodyDragAllowed: (widgetId: string, allowed: boolean) => void;
|
|
228
|
+
translateWidgetShapeByScreen: (widgetId: string, dxScreen: number, dyScreen: number) => boolean;
|
|
229
|
+
commitWidgetShapeTranslate: (widgetId?: string | null) => void;
|
|
230
|
+
setWidgetShapeOverlayDragActive: (active: boolean) => void;
|
|
231
|
+
selectWidgetShapeById: (widgetId: string) => boolean;
|
|
232
|
+
getSelectedWidgetShapeId: () => string | null;
|
|
233
|
+
getSelectedObject: () => any;
|
|
234
|
+
getHoveredWidgetShapeId: () => string | null;
|
|
235
|
+
onSelectImageTool: () => void;
|
|
236
|
+
onSelectVideoTool: () => void;
|
|
237
|
+
onSelectPanTool: () => void;
|
|
238
|
+
zoomIn: () => void;
|
|
239
|
+
zoomOut: () => void;
|
|
240
|
+
zoomTo: (percent: number) => void;
|
|
241
|
+
zoomReset: () => void;
|
|
242
|
+
zoomFit: () => void;
|
|
243
|
+
onGroupSelection: () => string | null;
|
|
244
|
+
onUngroupSelection: () => void;
|
|
245
|
+
onSelectAllObjects: () => void;
|
|
246
|
+
onDeselectAllObjects: () => void;
|
|
247
|
+
saveNow: () => void;
|
|
248
|
+
undo: () => Promise<void>;
|
|
249
|
+
redo: () => Promise<void>;
|
|
250
|
+
saveCanvas: () => string | null;
|
|
251
|
+
loadCanvas: (jsonString: string) => Promise<void>;
|
|
252
|
+
onClearAllObjects: () => void;
|
|
253
|
+
addText: () => void;
|
|
254
|
+
addTriangle: () => void;
|
|
255
|
+
addRect: () => void;
|
|
256
|
+
addCircle: () => void;
|
|
257
|
+
addFrame: () => void;
|
|
258
|
+
addImage: () => void;
|
|
259
|
+
}, string>;
|
|
260
|
+
type Canvas = InstanceType<typeof Canvas>;
|
|
261
|
+
export default Canvas;
|
|
@@ -1,62 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
onSelectEraseTool?: () => void;
|
|
12
|
-
onSelectDrawTool?: () => void;
|
|
13
|
-
onSelectShapeTool?: (shapeType: "rect" | "circle" | "triangle" | "arrow" | "circle-true") => void;
|
|
14
|
-
onSelectFrameTool?: () => void;
|
|
15
|
-
onSelectTextTool?: () => void;
|
|
16
|
-
onSelectPanTool?: () => void;
|
|
17
|
-
onSelectImageTool?: () => void;
|
|
18
|
-
onSelectVideoTool?: () => void;
|
|
19
|
-
onZoomIn?: () => void;
|
|
20
|
-
onZoomOut?: () => void;
|
|
21
|
-
onZoomReset?: () => void;
|
|
22
|
-
onZoomFit?: () => void;
|
|
23
|
-
onGroupSelection?: () => void;
|
|
24
|
-
onUngroupSelection?: () => void;
|
|
25
|
-
onDuplicateSelection?: () => void;
|
|
26
|
-
onSelectAllObjects?: () => void;
|
|
27
|
-
onClearAllObjects?: () => void;
|
|
28
|
-
onUndo?: () => void;
|
|
29
|
-
onRedo?: () => void;
|
|
30
|
-
/** Disables the Undo button when there is no prior state to go back to. */ canUndo?: boolean;
|
|
31
|
-
/** Disables the Redo button when there is no future state to redo to. */ canRedo?: boolean;
|
|
32
|
-
/** When true, the drawing tool stays active after placing a shape. */ stickyToolEnabled?: boolean;
|
|
33
|
-
onToggleStickyTool?: () => void;
|
|
34
|
-
/** Passed by Canvas.svelte but never read here — export const keeps the
|
|
35
|
-
* init-set contract without the unused-reactive warning. */ onInsertLibraryShape?: (shapeKey: string, pathData: string) => void;
|
|
36
|
-
/** Draw-to-place: activates library shape tool so user clicks-and-drags to size it. */ onSelectLibraryShapeTool?: (shapeKey: string, pathData: string) => void;
|
|
37
|
-
/** Extra tools (undo/redo/lock). Code stays; UI is gated. */ advancedFeatures?: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* When true (default) and advancedFeatures is on, Frame / Image / Video sit on the toolbar.
|
|
40
|
-
* When false, they leave the bar and appear under More Shapes → Media Shapes.
|
|
41
|
-
*/ mediaBtsOnBar?: boolean;
|
|
42
|
-
addText?: () => void;
|
|
43
|
-
addRect?: () => void;
|
|
44
|
-
addTriangle?: () => void;
|
|
45
|
-
addCircle?: () => void;
|
|
46
|
-
addFrame?: () => void;
|
|
47
|
-
addImage?: () => void;
|
|
48
|
-
shortcutsPanelOpen?: boolean;
|
|
49
|
-
onShortcutsToggle?: () => void;
|
|
1
|
+
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> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: Props & {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
50
11
|
};
|
|
51
|
-
|
|
52
|
-
[evt: string]: CustomEvent<any>;
|
|
53
|
-
};
|
|
54
|
-
slots: {};
|
|
55
|
-
};
|
|
56
|
-
export type CanvasToolbarProps = typeof __propDef.props;
|
|
57
|
-
export type CanvasToolbarEvents = typeof __propDef.events;
|
|
58
|
-
export type CanvasToolbarSlots = typeof __propDef.slots;
|
|
59
|
-
export default class CanvasToolbar extends SvelteComponentTyped<CanvasToolbarProps, CanvasToolbarEvents, CanvasToolbarSlots> {
|
|
60
|
-
get onInsertLibraryShape(): (shapeKey: string, pathData: string) => void;
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
61
13
|
}
|
|
62
|
-
|
|
14
|
+
declare const CanvasToolbar: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
class?: string;
|
|
16
|
+
style?: string;
|
|
17
|
+
activeTool?: "select" | "video" | "text" | "rect" | "circle" | "triangle" | "frame" | "arrow" | "image" | "erase" | "draw" | "circle-true" | "pan" | "library-shape";
|
|
18
|
+
activeClass?: string;
|
|
19
|
+
inactiveClass?: string;
|
|
20
|
+
buttonClass?: string;
|
|
21
|
+
onSelectSelectTool?: () => void;
|
|
22
|
+
onSelectEraseTool?: () => void;
|
|
23
|
+
onSelectDrawTool?: () => void;
|
|
24
|
+
onSelectShapeTool?: (shapeType: "rect" | "circle" | "triangle" | "arrow" | "circle-true") => void;
|
|
25
|
+
onSelectFrameTool?: () => void;
|
|
26
|
+
onSelectTextTool?: () => void;
|
|
27
|
+
onSelectPanTool?: () => void;
|
|
28
|
+
onSelectImageTool?: () => void;
|
|
29
|
+
onSelectVideoTool?: () => void;
|
|
30
|
+
onZoomIn?: () => void;
|
|
31
|
+
onZoomOut?: () => void;
|
|
32
|
+
onZoomReset?: () => void;
|
|
33
|
+
onZoomFit?: () => void;
|
|
34
|
+
onGroupSelection?: () => void;
|
|
35
|
+
onUngroupSelection?: () => void;
|
|
36
|
+
onDuplicateSelection?: () => void;
|
|
37
|
+
onSelectAllObjects?: () => void;
|
|
38
|
+
onClearAllObjects?: () => void;
|
|
39
|
+
onUndo?: () => void;
|
|
40
|
+
onRedo?: () => void;
|
|
41
|
+
/** Disables the Undo button when there is no prior state to go back to. */ canUndo?: boolean;
|
|
42
|
+
/** Disables the Redo button when there is no future state to redo to. */ canRedo?: boolean;
|
|
43
|
+
/** When true, the drawing tool stays active after placing a shape. */ stickyToolEnabled?: boolean;
|
|
44
|
+
onToggleStickyTool?: () => void;
|
|
45
|
+
/** Passed by Canvas.svelte but never read here — export const keeps the
|
|
46
|
+
* init-set contract without the unused-reactive warning. */ onInsertLibraryShape?: (shapeKey: string, pathData: string) => void;
|
|
47
|
+
/** Draw-to-place: activates library shape tool so user clicks-and-drags to size it. */ onSelectLibraryShapeTool?: (shapeKey: string, pathData: string) => void;
|
|
48
|
+
/** Extra tools (undo/redo/lock). Code stays; UI is gated. */ advancedFeatures?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* When true (default) and advancedFeatures is on, Frame / Image / Video sit on the toolbar.
|
|
51
|
+
* When false, they leave the bar and appear under More Shapes → Media Shapes.
|
|
52
|
+
*/ mediaBtsOnBar?: boolean;
|
|
53
|
+
addText?: () => void;
|
|
54
|
+
addRect?: () => void;
|
|
55
|
+
addTriangle?: () => void;
|
|
56
|
+
addCircle?: () => void;
|
|
57
|
+
addFrame?: () => void;
|
|
58
|
+
addImage?: () => void;
|
|
59
|
+
shortcutsPanelOpen?: boolean;
|
|
60
|
+
onShortcutsToggle?: () => void;
|
|
61
|
+
}, {
|
|
62
|
+
[evt: string]: CustomEvent<any>;
|
|
63
|
+
}, {}, {
|
|
64
|
+
/** Passed by Canvas.svelte but never read here — export const keeps the
|
|
65
|
+
* init-set contract without the unused-reactive warning. */ onInsertLibraryShape: (shapeKey: string, pathData: string) => void;
|
|
66
|
+
}, string>;
|
|
67
|
+
type CanvasToolbar = InstanceType<typeof CanvasToolbar>;
|
|
68
|
+
export default CanvasToolbar;
|