@widgetic/canvas 0.5.27 → 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.
@@ -1,174 +1,83 @@
1
- import { SvelteComponentTyped } from "svelte";
1
+ import { Canvas } from 'fabric';
2
2
  import type { WidgetConversionPayload, StrokeRecognizer } from './types';
3
- declare const __propDef: {
4
- props: {
5
- /**
6
- * COMPONENT PROPS
7
- */ class?: string;
8
- style?: string;
9
- /** Site /canvas embed sits flush under AppHeader — skip the 2px frame (double stroke). */ showContainerFrame?: boolean;
10
- /** Mount native widget controls alongside host HTML previews, never over their entire body. */ widgetSelectionLayerTarget?: string;
11
- onObjectClick?: ((data: {
12
- screenshot: string;
13
- objectType: string;
14
- customType?: string;
15
- bounds: {
16
- left: number;
17
- top: number;
18
- width: number;
19
- height: number;
20
- };
21
- objectId: string;
22
- metadata: Record<string, any>;
23
- }) => void) | null;
24
- panZoomPosition?: "TL" | "TC" | "TR" | "BL" | "BC" | "BR";
25
- wireframeMode?: boolean;
26
- advancedFeatures?: boolean;
27
- /** When true and advanced is on, Frame/Image/Video stay on the toolbar. Default true. */ mediaBtsOnBar?: boolean;
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
- viewportLeft: number;
95
- viewportTop: number;
96
- viewportWidth: number;
97
- viewportHeight: number;
98
- } | null;
99
- getWidgetShapeDataUrl?: (widgetId: string) => string | null;
100
- setWidgetShapeLivePreviewHiddenImage?: (widgetId: string, hidden: boolean) => void;
101
- addWidgetShape?: (widgetId: string, widgetName?: string, gridIndex?: number, totalCount?: number, previewImageUrl?: string | null) => string | null;
102
- getLinkedWidgetIds?: () => Set<string>;
103
- hydrateWidgetShapeMetadata?: (widgetsById: Map<string, {
104
- name?: string | null;
105
- thumbnailUrl?: string | null;
106
- thumbnail_url?: string | null;
107
- }>) => number;
108
- markOrphanedWidgetShapes?: (validWidgetIds: Set<string>) => number;
109
- onSelectSelectTool?: () => void;
110
- onSelectLibraryShapeTool?: (shapeKey: string, pathData: string) => void;
111
- onSelectEraseTool?: () => void;
112
- onSelectDrawTool?: () => void;
113
- onSelectTextTool?: () => void;
114
- onSelectArrowTool?: () => void;
115
- onSelectShapeTool?: (shapeType: "rect" | "circle" | "circle-true" | "triangle" | "arrow") => void;
116
- onSelectFrameTool?: () => void;
117
- setPrimaryWidgetShape?: (widgetId: string) => boolean;
118
- getPrimaryWidgetId?: () => string | null;
119
- setWidgetShapeBodyDragAllowed?: (widgetId: string, allowed: boolean) => void;
120
- translateWidgetShapeByScreen?: (widgetId: string, dxScreen: number, dyScreen: number) => boolean;
121
- commitWidgetShapeTranslate?: (widgetId?: string | null) => void;
122
- setWidgetShapeOverlayDragActive?: (active: boolean) => void;
123
- selectWidgetShapeById?: (widgetId: string) => boolean;
124
- getSelectedWidgetShapeId?: () => string | null;
125
- getSelectedObject?: () => any;
126
- getHoveredWidgetShapeId?: () => string | null;
127
- onSelectImageTool?: () => void;
128
- onSelectVideoTool?: () => void;
129
- onSelectPanTool?: () => void;
130
- zoomIn?: () => void;
131
- zoomOut?: () => void;
132
- zoomTo?: (percent: number) => void;
133
- zoomReset?: () => void;
134
- zoomFit?: () => void;
135
- onGroupSelection?: () => string | null;
136
- onUngroupSelection?: () => void;
137
- onSelectAllObjects?: () => void;
138
- onDeselectAllObjects?: () => void;
139
- saveNow?: () => void;
140
- undo?: () => Promise<void>;
141
- redo?: () => Promise<void>;
142
- saveCanvas?: () => string | null;
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
- get getWidgetShapeScreenRect(): (widgetId: string) => {
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
- get getObjectScreenRect(): (objectId: string) => {
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
- get getWidgetShapeDataUrl(): (widgetId: string) => string | null;
203
- get setWidgetShapeLivePreviewHiddenImage(): (widgetId: string, hidden: boolean) => void;
204
- get addWidgetShape(): (widgetId: string, widgetName?: string, gridIndex?: number, totalCount?: number, previewImageUrl?: string | null) => string | null;
205
- get getLinkedWidgetIds(): () => Set<string>;
206
- get hydrateWidgetShapeMetadata(): (widgetsById: Map<string, {
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
- get markOrphanedWidgetShapes(): (validWidgetIds: Set<string>) => number;
212
- get onSelectSelectTool(): () => void;
213
- get onSelectLibraryShapeTool(): (shapeKey: string, pathData: string) => void;
214
- get onSelectEraseTool(): () => void;
215
- get onSelectDrawTool(): () => void;
216
- get onSelectTextTool(): () => void;
217
- get onSelectArrowTool(): () => void;
218
- get onSelectShapeTool(): (shapeType: "rect" | "circle" | "circle-true" | "triangle" | "arrow") => void;
219
- get onSelectFrameTool(): () => void;
220
- get setPrimaryWidgetShape(): (widgetId: string) => boolean;
221
- get getPrimaryWidgetId(): () => string | null;
222
- get setWidgetShapeBodyDragAllowed(): (widgetId: string, allowed: boolean) => void;
223
- get translateWidgetShapeByScreen(): (widgetId: string, dxScreen: number, dyScreen: number) => boolean;
224
- get commitWidgetShapeTranslate(): (widgetId?: string | null) => void;
225
- get setWidgetShapeOverlayDragActive(): (active: boolean) => void;
226
- get selectWidgetShapeById(): (widgetId: string) => boolean;
227
- get getSelectedWidgetShapeId(): () => string | null;
228
- get getSelectedObject(): () => any;
229
- get getHoveredWidgetShapeId(): () => string | null;
230
- get onSelectImageTool(): () => void;
231
- get onSelectVideoTool(): () => void;
232
- get onSelectPanTool(): () => void;
233
- get zoomIn(): () => void;
234
- get zoomOut(): () => void;
235
- get zoomTo(): (percent: number) => void;
236
- get zoomReset(): () => void;
237
- get zoomFit(): () => void;
238
- get onGroupSelection(): () => string | null;
239
- get onUngroupSelection(): () => void;
240
- get onSelectAllObjects(): () => void;
241
- get onDeselectAllObjects(): () => void;
242
- get saveNow(): () => void;
243
- get undo(): () => Promise<void>;
244
- get redo(): () => Promise<void>;
245
- get saveCanvas(): () => string | null;
246
- get loadCanvas(): (jsonString: string) => Promise<void>;
247
- get onClearAllObjects(): () => void;
248
- get addText(): () => void;
249
- get addTriangle(): () => void;
250
- get addRect(): () => void;
251
- get addCircle(): () => void;
252
- get addFrame(): () => void;
253
- get addImage(): () => void;
254
- }
255
- export {};
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
- import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- class?: string;
5
- style?: string;
6
- activeTool?: "select" | "video" | "rect" | "circle" | "triangle" | "frame" | "arrow" | "image" | "text" | "erase" | "draw" | "circle-true" | "pan" | "library-shape";
7
- activeClass?: string;
8
- inactiveClass?: string;
9
- buttonClass?: string;
10
- onSelectSelectTool?: () => void;
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
- events: {
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
- export {};
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;