@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,37 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
canPaste?: boolean;
|
|
12
|
-
onCut?: () => void;
|
|
13
|
-
onCopy?: () => void;
|
|
14
|
-
onPaste?: () => void;
|
|
15
|
-
onDuplicate?: () => void;
|
|
16
|
-
onDelete?: () => void;
|
|
17
|
-
onGroup?: () => void;
|
|
18
|
-
onUngroup?: () => void;
|
|
19
|
-
onBringToFront?: () => void;
|
|
20
|
-
onSendToBack?: () => void;
|
|
21
|
-
onBringForward?: () => void;
|
|
22
|
-
onSendBackward?: () => void;
|
|
23
|
-
onSelectAll?: () => void;
|
|
24
|
-
onClose?: () => 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;
|
|
25
11
|
};
|
|
26
|
-
|
|
27
|
-
[evt: string]: CustomEvent<any>;
|
|
28
|
-
};
|
|
29
|
-
slots: {};
|
|
30
|
-
};
|
|
31
|
-
export type ContextMenuProps = typeof __propDef.props;
|
|
32
|
-
export type ContextMenuEvents = typeof __propDef.events;
|
|
33
|
-
export type ContextMenuSlots = typeof __propDef.slots;
|
|
34
|
-
export default class ContextMenu extends SvelteComponentTyped<ContextMenuProps, ContextMenuEvents, ContextMenuSlots> {
|
|
35
|
-
get selectionCount(): number;
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
36
13
|
}
|
|
37
|
-
|
|
14
|
+
declare const ContextMenu: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
x?: number;
|
|
16
|
+
y?: number;
|
|
17
|
+
visible?: boolean;
|
|
18
|
+
hasSelection?: boolean;
|
|
19
|
+
selectionCount?: number;
|
|
20
|
+
canGroup?: boolean;
|
|
21
|
+
canUngroup?: boolean;
|
|
22
|
+
canPaste?: boolean;
|
|
23
|
+
onCut?: () => void;
|
|
24
|
+
onCopy?: () => void;
|
|
25
|
+
onPaste?: () => void;
|
|
26
|
+
onDuplicate?: () => void;
|
|
27
|
+
onDelete?: () => void;
|
|
28
|
+
onGroup?: () => void;
|
|
29
|
+
onUngroup?: () => void;
|
|
30
|
+
onBringToFront?: () => void;
|
|
31
|
+
onSendToBack?: () => void;
|
|
32
|
+
onBringForward?: () => void;
|
|
33
|
+
onSendBackward?: () => void;
|
|
34
|
+
onSelectAll?: () => void;
|
|
35
|
+
onClose?: () => void;
|
|
36
|
+
}, {
|
|
37
|
+
[evt: string]: CustomEvent<any>;
|
|
38
|
+
}, {}, {
|
|
39
|
+
selectionCount: number;
|
|
40
|
+
}, string>;
|
|
41
|
+
type ContextMenu = InstanceType<typeof ContextMenu>;
|
|
42
|
+
export default ContextMenu;
|
|
@@ -1,33 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
onZoomOut?: () => void;
|
|
12
|
-
onZoomReset?: () => void;
|
|
13
|
-
onZoomFit?: () => void;
|
|
14
|
-
onZoomChange?: (percent: number) => void;
|
|
15
|
-
onGridToggle?: () => void;
|
|
16
|
-
onShortcutsToggle?: () => void;
|
|
17
|
-
shortcutsOpen?: boolean;
|
|
18
|
-
/** Extra view controls (grid, pan, 1:1, fit, shortcuts). Zoom ± / % and save stay available. */ advancedFeatures?: boolean;
|
|
19
|
-
showSaveButton?: boolean;
|
|
20
|
-
hasUnsavedChanges?: boolean;
|
|
21
|
-
onSave?: (() => void) | null;
|
|
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;
|
|
22
11
|
};
|
|
23
|
-
|
|
24
|
-
[evt: string]: CustomEvent<any>;
|
|
25
|
-
};
|
|
26
|
-
slots: {};
|
|
27
|
-
};
|
|
28
|
-
export type PanZoomPanelProps = typeof __propDef.props;
|
|
29
|
-
export type PanZoomPanelEvents = typeof __propDef.events;
|
|
30
|
-
export type PanZoomPanelSlots = typeof __propDef.slots;
|
|
31
|
-
export default class PanZoomPanel extends SvelteComponentTyped<PanZoomPanelProps, PanZoomPanelEvents, PanZoomPanelSlots> {
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
32
13
|
}
|
|
33
|
-
|
|
14
|
+
declare const PanZoomPanel: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
class?: string;
|
|
16
|
+
style?: string;
|
|
17
|
+
zoomLevel?: number;
|
|
18
|
+
isPanActive?: boolean;
|
|
19
|
+
showGrid?: boolean;
|
|
20
|
+
onPanToggle?: () => void;
|
|
21
|
+
onZoomIn?: () => void;
|
|
22
|
+
onZoomOut?: () => void;
|
|
23
|
+
onZoomReset?: () => void;
|
|
24
|
+
onZoomFit?: () => void;
|
|
25
|
+
onZoomChange?: (percent: number) => void;
|
|
26
|
+
onGridToggle?: () => void;
|
|
27
|
+
onShortcutsToggle?: () => void;
|
|
28
|
+
shortcutsOpen?: boolean;
|
|
29
|
+
/** Extra view controls (grid, pan, 1:1, fit, shortcuts). Zoom ± / % and save stay available. */ advancedFeatures?: boolean;
|
|
30
|
+
showSaveButton?: boolean;
|
|
31
|
+
hasUnsavedChanges?: boolean;
|
|
32
|
+
onSave?: (() => void) | null;
|
|
33
|
+
}, {
|
|
34
|
+
[evt: string]: CustomEvent<any>;
|
|
35
|
+
}, {}, {}, string>;
|
|
36
|
+
type PanZoomPanel = InstanceType<typeof PanZoomPanel>;
|
|
37
|
+
export default PanZoomPanel;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
slots: {};
|
|
1
|
+
import type { Canvas } from 'fabric';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
fabricCanvas: Canvas;
|
|
4
|
+
target: string;
|
|
5
|
+
class?: string;
|
|
6
|
+
style?: string;
|
|
8
7
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export
|
|
12
|
-
export default class WidgetSelectionLayer extends SvelteComponentTyped<WidgetSelectionLayerProps, WidgetSelectionLayerEvents, WidgetSelectionLayerSlots> {
|
|
13
|
-
}
|
|
14
|
-
export {};
|
|
8
|
+
declare const WidgetSelectionLayer: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
9
|
+
type WidgetSelectionLayer = ReturnType<typeof WidgetSelectionLayer>;
|
|
10
|
+
export default WidgetSelectionLayer;
|
|
@@ -319,7 +319,9 @@
|
|
|
319
319
|
const curId = selectedObject;
|
|
320
320
|
if (curId !== prevSelectedId) {
|
|
321
321
|
prevSelectedId = curId;
|
|
322
|
-
|
|
322
|
+
// Read the flag on this object. dimensionLocked can still be the previous
|
|
323
|
+
// selection's value in the same update, which left text looking unlocked.
|
|
324
|
+
userDimensionLock = !!(curId as any)?._lockAspectRatio;
|
|
323
325
|
}
|
|
324
326
|
}
|
|
325
327
|
$: effectiveDimensionLock = forcedLock || userDimensionLock;
|
|
@@ -355,10 +357,13 @@
|
|
|
355
357
|
userDimensionLock = !userDimensionLock;
|
|
356
358
|
if (selectedObject) {
|
|
357
359
|
(selectedObject as any)._lockAspectRatio = userDimensionLock;
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
360
|
+
// Text keeps its side handles. The lock only decides whether a resize may stretch the letters.
|
|
361
|
+
if (selectedObject.type !== 'textbox') {
|
|
362
|
+
if (userDimensionLock) {
|
|
363
|
+
selectedObject.setControlsVisibility?.({ ml: false, mr: false, mt: false, mb: false });
|
|
364
|
+
} else {
|
|
365
|
+
selectedObject.setControlsVisibility?.({ ml: true, mr: true, mt: true, mb: true });
|
|
366
|
+
}
|
|
362
367
|
}
|
|
363
368
|
selectedObject.canvas?.requestRenderAll?.();
|
|
364
369
|
}
|
|
@@ -864,7 +869,7 @@
|
|
|
864
869
|
{#if !wireframeMode}
|
|
865
870
|
<ColorIC
|
|
866
871
|
label={$t('canvas.field.fillColor')}
|
|
867
|
-
value={textboxBoxFill === 'transparent' ? '#FFFFFF' : textboxBoxFill}
|
|
872
|
+
value={!textboxBoxFill || textboxBoxFill === 'transparent' ? '#FFFFFF' : textboxBoxFill}
|
|
868
873
|
onChange={onTextboxBoxFillChange}
|
|
869
874
|
/>
|
|
870
875
|
{/if}
|
|
@@ -1,80 +1,84 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
onRoundnessChange?: (roundness: number) => void;
|
|
12
|
-
onStrokeTypeChange?: (type: "solid" | "dashed" | "dotted") => void;
|
|
13
|
-
onOpacityChange?: (opacity: number) => void;
|
|
14
|
-
onFillOpacityChange?: (opacity: number) => void;
|
|
15
|
-
onGroupFillChange?: (color: string) => void;
|
|
16
|
-
onGroupFillOpacityChange?: (opacity: number) => void;
|
|
17
|
-
onGroupStrokeChange?: (color: string) => void;
|
|
18
|
-
onGroupStrokeWidthChange?: (width: number) => void;
|
|
19
|
-
onGroupStrokeTypeChange?: (type: "solid" | "dashed" | "dotted") => void;
|
|
20
|
-
onBackgroundColorChange?: (color: string) => void;
|
|
21
|
-
onBackgroundOpacityChange?: (opacity: number) => void;
|
|
22
|
-
onFontSizeChange?: (size: number) => void;
|
|
23
|
-
onFontFamilyChange?: (family: string) => void;
|
|
24
|
-
onFontWeightChange?: (weight: "normal" | "bold") => void;
|
|
25
|
-
onFontStyleChange?: (style: "normal" | "italic") => void;
|
|
26
|
-
onUnderlineChange?: (underline: boolean) => void;
|
|
27
|
-
onTextAlignChange?: (align: "left" | "center" | "right") => void;
|
|
28
|
-
onTextPaddingChange?: (padding: number) => void;
|
|
29
|
-
onTextColorChange?: (color: string) => void;
|
|
30
|
-
onFrameLabelChange?: (label: string) => void;
|
|
31
|
-
onFrameLabelFontSizeChange?: (size: number) => void;
|
|
32
|
-
onFrameLabelFontFamilyChange?: (family: string) => void;
|
|
33
|
-
onFrameLabelTextAlignChange?: (align: "left" | "center" | "right") => void;
|
|
34
|
-
onFrameLabelTextColorChange?: (color: string) => void;
|
|
35
|
-
onFrameLabelFontWeightChange?: (weight: "normal" | "bold") => void;
|
|
36
|
-
onFrameLabelFontStyleChange?: (style: "normal" | "italic") => void;
|
|
37
|
-
onFrameLabelUnderlineChange?: (underline: boolean) => void;
|
|
38
|
-
onFrameLabelBackgroundColorChange?: (color: string) => void;
|
|
39
|
-
onTextboxBoxFillChange?: (color: string) => void;
|
|
40
|
-
onTextboxBoxStrokeChange?: (color: string) => void;
|
|
41
|
-
onTextboxBoxStrokeWidthChange?: (width: number) => void;
|
|
42
|
-
onTextboxBoxStrokeTypeChange?: (type: "solid" | "dashed" | "dotted") => void;
|
|
43
|
-
onTextStrokeColorChange?: (color: string) => void;
|
|
44
|
-
onTextStrokeWidthChange?: (width: number) => void;
|
|
45
|
-
onImageUrlLoad?: (url: string) => void;
|
|
46
|
-
onImageSourceChange?: () => void;
|
|
47
|
-
onCapture?: (() => void) | null;
|
|
48
|
-
onConvertToWidget?: (() => void) | null;
|
|
49
|
-
onWidgetClick?: ((widgetId: string) => void) | null;
|
|
50
|
-
onWidgetRename?: ((widgetId: string, newName: string) => void) | null;
|
|
51
|
-
onRefreshScreenshot?: ((widgetId: string) => void) | null;
|
|
52
|
-
onSetAsPrimary?: ((widgetId: string) => void) | null;
|
|
53
|
-
getWidgetName?: ((widgetId: string) => string | null) | null;
|
|
54
|
-
/** Bumped when names change so PropsPanel re-reads getWidgetName. */ widgetNameRevision?: number;
|
|
55
|
-
/** Returns false when the linked widget was deleted or moved off this canvas. */ isWidgetKnown?: ((widgetId: string) => boolean) | null;
|
|
56
|
-
/** Remove the selected orphaned widget shape from the canvas. */ onRemoveOrphanedShape?: (() => void) | null;
|
|
57
|
-
onBringToFront?: () => void;
|
|
58
|
-
onBringForward?: () => void;
|
|
59
|
-
onSendBackward?: () => void;
|
|
60
|
-
onSendToBack?: () => void;
|
|
61
|
-
onAlignLeft?: () => void;
|
|
62
|
-
onAlignCenterH?: () => void;
|
|
63
|
-
onAlignRight?: () => void;
|
|
64
|
-
onAlignTop?: () => void;
|
|
65
|
-
onAlignMiddleV?: () => void;
|
|
66
|
-
onAlignBottom?: () => void;
|
|
67
|
-
onWidthChange?: (width: number) => void;
|
|
68
|
-
onHeightChange?: (height: number) => 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;
|
|
69
11
|
};
|
|
70
|
-
|
|
71
|
-
[evt: string]: CustomEvent<any>;
|
|
72
|
-
};
|
|
73
|
-
slots: {};
|
|
74
|
-
};
|
|
75
|
-
export type PropsPanelProps = typeof __propDef.props;
|
|
76
|
-
export type PropsPanelEvents = typeof __propDef.events;
|
|
77
|
-
export type PropsPanelSlots = typeof __propDef.slots;
|
|
78
|
-
export default class PropsPanel extends SvelteComponentTyped<PropsPanelProps, PropsPanelEvents, PropsPanelSlots> {
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
79
13
|
}
|
|
80
|
-
|
|
14
|
+
declare const PropsPanel: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
class?: string;
|
|
16
|
+
style?: string;
|
|
17
|
+
selectedObject?: any;
|
|
18
|
+
wireframeMode?: boolean;
|
|
19
|
+
onFillChange?: (color: string) => void;
|
|
20
|
+
onStrokeChange?: (color: string) => void;
|
|
21
|
+
onStrokeWidthChange?: (width: number) => void;
|
|
22
|
+
onRoundnessChange?: (roundness: number) => void;
|
|
23
|
+
onStrokeTypeChange?: (type: "solid" | "dashed" | "dotted") => void;
|
|
24
|
+
onOpacityChange?: (opacity: number) => void;
|
|
25
|
+
onFillOpacityChange?: (opacity: number) => void;
|
|
26
|
+
onGroupFillChange?: (color: string) => void;
|
|
27
|
+
onGroupFillOpacityChange?: (opacity: number) => void;
|
|
28
|
+
onGroupStrokeChange?: (color: string) => void;
|
|
29
|
+
onGroupStrokeWidthChange?: (width: number) => void;
|
|
30
|
+
onGroupStrokeTypeChange?: (type: "solid" | "dashed" | "dotted") => void;
|
|
31
|
+
onBackgroundColorChange?: (color: string) => void;
|
|
32
|
+
onBackgroundOpacityChange?: (opacity: number) => void;
|
|
33
|
+
onFontSizeChange?: (size: number) => void;
|
|
34
|
+
onFontFamilyChange?: (family: string) => void;
|
|
35
|
+
onFontWeightChange?: (weight: "normal" | "bold") => void;
|
|
36
|
+
onFontStyleChange?: (style: "normal" | "italic") => void;
|
|
37
|
+
onUnderlineChange?: (underline: boolean) => void;
|
|
38
|
+
onTextAlignChange?: (align: "left" | "center" | "right") => void;
|
|
39
|
+
onTextPaddingChange?: (padding: number) => void;
|
|
40
|
+
onTextColorChange?: (color: string) => void;
|
|
41
|
+
onFrameLabelChange?: (label: string) => void;
|
|
42
|
+
onFrameLabelFontSizeChange?: (size: number) => void;
|
|
43
|
+
onFrameLabelFontFamilyChange?: (family: string) => void;
|
|
44
|
+
onFrameLabelTextAlignChange?: (align: "left" | "center" | "right") => void;
|
|
45
|
+
onFrameLabelTextColorChange?: (color: string) => void;
|
|
46
|
+
onFrameLabelFontWeightChange?: (weight: "normal" | "bold") => void;
|
|
47
|
+
onFrameLabelFontStyleChange?: (style: "normal" | "italic") => void;
|
|
48
|
+
onFrameLabelUnderlineChange?: (underline: boolean) => void;
|
|
49
|
+
onFrameLabelBackgroundColorChange?: (color: string) => void;
|
|
50
|
+
onTextboxBoxFillChange?: (color: string) => void;
|
|
51
|
+
onTextboxBoxStrokeChange?: (color: string) => void;
|
|
52
|
+
onTextboxBoxStrokeWidthChange?: (width: number) => void;
|
|
53
|
+
onTextboxBoxStrokeTypeChange?: (type: "solid" | "dashed" | "dotted") => void;
|
|
54
|
+
onTextStrokeColorChange?: (color: string) => void;
|
|
55
|
+
onTextStrokeWidthChange?: (width: number) => void;
|
|
56
|
+
onImageUrlLoad?: (url: string) => void;
|
|
57
|
+
onImageSourceChange?: () => void;
|
|
58
|
+
onCapture?: (() => void) | null;
|
|
59
|
+
onConvertToWidget?: (() => void) | null;
|
|
60
|
+
onWidgetClick?: ((widgetId: string) => void) | null;
|
|
61
|
+
onWidgetRename?: ((widgetId: string, newName: string) => void) | null;
|
|
62
|
+
onRefreshScreenshot?: ((widgetId: string) => void) | null;
|
|
63
|
+
onSetAsPrimary?: ((widgetId: string) => void) | null;
|
|
64
|
+
getWidgetName?: ((widgetId: string) => string | null) | null;
|
|
65
|
+
/** Bumped when names change so PropsPanel re-reads getWidgetName. */ widgetNameRevision?: number;
|
|
66
|
+
/** Returns false when the linked widget was deleted or moved off this canvas. */ isWidgetKnown?: ((widgetId: string) => boolean) | null;
|
|
67
|
+
/** Remove the selected orphaned widget shape from the canvas. */ onRemoveOrphanedShape?: (() => void) | null;
|
|
68
|
+
onBringToFront?: () => void;
|
|
69
|
+
onBringForward?: () => void;
|
|
70
|
+
onSendBackward?: () => void;
|
|
71
|
+
onSendToBack?: () => void;
|
|
72
|
+
onAlignLeft?: () => void;
|
|
73
|
+
onAlignCenterH?: () => void;
|
|
74
|
+
onAlignRight?: () => void;
|
|
75
|
+
onAlignTop?: () => void;
|
|
76
|
+
onAlignMiddleV?: () => void;
|
|
77
|
+
onAlignBottom?: () => void;
|
|
78
|
+
onWidthChange?: (width: number) => void;
|
|
79
|
+
onHeightChange?: (height: number) => void;
|
|
80
|
+
}, {
|
|
81
|
+
[evt: string]: CustomEvent<any>;
|
|
82
|
+
}, {}, {}, string>;
|
|
83
|
+
type PropsPanel = InstanceType<typeof PropsPanel>;
|
|
84
|
+
export default PropsPanel;
|
|
@@ -1,36 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
textAlign?: "left" | "center" | "right";
|
|
12
|
-
textColor?: string;
|
|
13
|
-
onFontSizeChange?: (size: number) => void;
|
|
14
|
-
onFontFamilyChange?: (family: string) => void;
|
|
15
|
-
onFontWeightChange?: (weight: "normal" | "bold") => void;
|
|
16
|
-
onFontStyleChange?: (style: "normal" | "italic") => void;
|
|
17
|
-
onUnderlineChange?: (underline: boolean) => void;
|
|
18
|
-
onTextAlignChange?: (align: "left" | "center" | "right") => void;
|
|
19
|
-
onTextColorChange?: (color: string) => void;
|
|
20
|
-
showFontSize?: boolean;
|
|
21
|
-
showFontFamily?: boolean;
|
|
22
|
-
showTextStyle?: boolean;
|
|
23
|
-
showTextAlign?: boolean;
|
|
24
|
-
showTextColor?: boolean;
|
|
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;
|
|
25
11
|
};
|
|
26
|
-
|
|
27
|
-
[evt: string]: CustomEvent<any>;
|
|
28
|
-
};
|
|
29
|
-
slots: {};
|
|
30
|
-
};
|
|
31
|
-
export type TextPropsICSectionProps = typeof __propDef.props;
|
|
32
|
-
export type TextPropsICSectionEvents = typeof __propDef.events;
|
|
33
|
-
export type TextPropsICSectionSlots = typeof __propDef.slots;
|
|
34
|
-
export default class TextPropsICSection extends SvelteComponentTyped<TextPropsICSectionProps, TextPropsICSectionEvents, TextPropsICSectionSlots> {
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
35
13
|
}
|
|
36
|
-
|
|
14
|
+
declare const TextPropsICSection: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
class?: string;
|
|
16
|
+
style?: string;
|
|
17
|
+
fontSize?: number;
|
|
18
|
+
fontFamily?: string;
|
|
19
|
+
fontWeight?: "normal" | "bold";
|
|
20
|
+
fontStyle?: "normal" | "italic";
|
|
21
|
+
underline?: boolean;
|
|
22
|
+
textAlign?: "left" | "center" | "right";
|
|
23
|
+
textColor?: string;
|
|
24
|
+
onFontSizeChange?: (size: number) => void;
|
|
25
|
+
onFontFamilyChange?: (family: string) => void;
|
|
26
|
+
onFontWeightChange?: (weight: "normal" | "bold") => void;
|
|
27
|
+
onFontStyleChange?: (style: "normal" | "italic") => void;
|
|
28
|
+
onUnderlineChange?: (underline: boolean) => void;
|
|
29
|
+
onTextAlignChange?: (align: "left" | "center" | "right") => void;
|
|
30
|
+
onTextColorChange?: (color: string) => void;
|
|
31
|
+
showFontSize?: boolean;
|
|
32
|
+
showFontFamily?: boolean;
|
|
33
|
+
showTextStyle?: boolean;
|
|
34
|
+
showTextAlign?: boolean;
|
|
35
|
+
showTextColor?: boolean;
|
|
36
|
+
}, {
|
|
37
|
+
[evt: string]: CustomEvent<any>;
|
|
38
|
+
}, {}, {}, string>;
|
|
39
|
+
type TextPropsICSection = InstanceType<typeof TextPropsICSection>;
|
|
40
|
+
export default TextPropsICSection;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
/** Colour of an empty board. Canvas.svelte paints Fabric with the same value. */
|
|
3
|
+
export const CANVAS_BOARD_BACKGROUND = '#f0f0f0';
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<script lang="ts">
|
|
7
|
+
import { provideCanvasLanguage, useCanvasLanguage } from '../i18n/language.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The empty board, drawn without Fabric.
|
|
11
|
+
*
|
|
12
|
+
* A host shows it while the canvas code is still downloading, so the page
|
|
13
|
+
* has its board at first paint. The real canvas replaces it with the same
|
|
14
|
+
* surface, so the swap is not visible.
|
|
15
|
+
*/
|
|
16
|
+
interface Props {
|
|
17
|
+
showLoadingLabel?: boolean;
|
|
18
|
+
/** False draws only the loading label, over a board that is already painted. */
|
|
19
|
+
showSurface?: boolean;
|
|
20
|
+
/** Same as Canvas: give these outside a canvas so the label speaks the page's language. */
|
|
21
|
+
locale?: string | null;
|
|
22
|
+
messages?: Readonly<Record<string, unknown>> | null;
|
|
23
|
+
class?: string;
|
|
24
|
+
style?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let {
|
|
28
|
+
showLoadingLabel = true,
|
|
29
|
+
showSurface = true,
|
|
30
|
+
locale = undefined,
|
|
31
|
+
messages = undefined,
|
|
32
|
+
class: className = '',
|
|
33
|
+
style = ''
|
|
34
|
+
}: Props = $props();
|
|
35
|
+
|
|
36
|
+
// Inside a canvas the root already set the language; on its own, the page passes it.
|
|
37
|
+
// svelte-ignore state_referenced_locally
|
|
38
|
+
const ownsLanguage = locale !== undefined || messages !== undefined;
|
|
39
|
+
// svelte-ignore state_referenced_locally
|
|
40
|
+
const languageHandle = ownsLanguage
|
|
41
|
+
? provideCanvasLanguage({ locale: locale ?? null, messages: messages ?? null })
|
|
42
|
+
: null;
|
|
43
|
+
const { t } = languageHandle ?? useCanvasLanguage();
|
|
44
|
+
|
|
45
|
+
$effect(() => {
|
|
46
|
+
languageHandle?.update({ locale: locale ?? null, messages: messages ?? null });
|
|
47
|
+
});
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<div
|
|
51
|
+
class="canvas-board-placeholder relative h-full w-full overflow-hidden {className}"
|
|
52
|
+
style="{showSurface ? `background-color: ${CANVAS_BOARD_BACKGROUND};` : ''} {style}"
|
|
53
|
+
aria-busy={showLoadingLabel}
|
|
54
|
+
>
|
|
55
|
+
{#if showLoadingLabel}
|
|
56
|
+
<div class="canvas-board-placeholder-status absolute inset-0 flex items-center justify-center pointer-events-none">
|
|
57
|
+
<div class="canvas-board-placeholder-status-inner flex items-center gap-2 text-sm font-medium text-gray-500">
|
|
58
|
+
<span class="canvas-board-placeholder-spinner h-4 w-4 rounded-full border-2 border-gray-300 border-t-gray-600 animate-spin"></span>
|
|
59
|
+
<span>{$t('canvas.state.loading')}</span>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
{/if}
|
|
63
|
+
</div>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Colour of an empty board. Canvas.svelte paints Fabric with the same value. */
|
|
2
|
+
export declare const CANVAS_BOARD_BACKGROUND = "#f0f0f0";
|
|
3
|
+
/**
|
|
4
|
+
* The empty board, drawn without Fabric.
|
|
5
|
+
*
|
|
6
|
+
* A host shows it while the canvas code is still downloading, so the page
|
|
7
|
+
* has its board at first paint. The real canvas replaces it with the same
|
|
8
|
+
* surface, so the swap is not visible.
|
|
9
|
+
*/
|
|
10
|
+
interface Props {
|
|
11
|
+
showLoadingLabel?: boolean;
|
|
12
|
+
/** False draws only the loading label, over a board that is already painted. */
|
|
13
|
+
showSurface?: boolean;
|
|
14
|
+
/** Same as Canvas: give these outside a canvas so the label speaks the page's language. */
|
|
15
|
+
locale?: string | null;
|
|
16
|
+
messages?: Readonly<Record<string, unknown>> | null;
|
|
17
|
+
class?: string;
|
|
18
|
+
style?: string;
|
|
19
|
+
}
|
|
20
|
+
declare const CanvasBoardPlaceholder: import("svelte").Component<Props, {}, "">;
|
|
21
|
+
type CanvasBoardPlaceholder = ReturnType<typeof CanvasBoardPlaceholder>;
|
|
22
|
+
export default CanvasBoardPlaceholder;
|
|
@@ -1,21 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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;
|
|
8
11
|
};
|
|
9
|
-
|
|
10
|
-
[evt: string]: CustomEvent<any>;
|
|
11
|
-
};
|
|
12
|
-
slots: {
|
|
13
|
-
default: {};
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
export type TooltipProps = typeof __propDef.props;
|
|
17
|
-
export type TooltipEvents = typeof __propDef.events;
|
|
18
|
-
export type TooltipSlots = typeof __propDef.slots;
|
|
19
|
-
export default class Tooltip extends SvelteComponentTyped<TooltipProps, TooltipEvents, TooltipSlots> {
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
20
13
|
}
|
|
21
|
-
|
|
14
|
+
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
15
|
+
default: any;
|
|
16
|
+
} ? Props extends Record<string, never> ? any : {
|
|
17
|
+
children?: any;
|
|
18
|
+
} : {});
|
|
19
|
+
declare const Tooltip: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
|
|
20
|
+
text?: string;
|
|
21
|
+
position?: "above" | "below";
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
offsetY?: number;
|
|
24
|
+
}, {
|
|
25
|
+
default: {};
|
|
26
|
+
}>, {
|
|
27
|
+
[evt: string]: CustomEvent<any>;
|
|
28
|
+
}, {
|
|
29
|
+
default: {};
|
|
30
|
+
}, {}, string>;
|
|
31
|
+
type Tooltip = InstanceType<typeof Tooltip>;
|
|
32
|
+
export default Tooltip;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Import: import { Tooltip, ColorIC } from '@widgetic/canvas/components';
|
|
5
5
|
*/
|
|
6
6
|
export { default as Tooltip } from './Tooltip.svelte';
|
|
7
|
+
export { default as CanvasBoardPlaceholder, CANVAS_BOARD_BACKGROUND } from './CanvasBoardPlaceholder.svelte';
|
|
7
8
|
export { setCanvasPreferenceStorage, getCanvasPreferenceStorage } from './preferenceStorage';
|
|
8
9
|
export type { CanvasPreferenceStorage } from './preferenceStorage';
|
|
9
10
|
export { default as ColorIC } from './input-controls/ColorIC.svelte';
|
package/dist/components/index.js
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
// General Components
|
|
7
7
|
export { default as Tooltip } from './Tooltip.svelte';
|
|
8
|
+
// The empty board without Fabric: shown while the canvas code downloads
|
|
9
|
+
export { default as CanvasBoardPlaceholder, CANVAS_BOARD_BACKGROUND } from './CanvasBoardPlaceholder.svelte';
|
|
8
10
|
// Where the canvas keeps a visitor's choices (the host can install a store of its own)
|
|
9
11
|
export { setCanvasPreferenceStorage, getCanvasPreferenceStorage } from './preferenceStorage';
|
|
10
12
|
// Input Controllers
|
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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;
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
[evt: string]: CustomEvent<any>;
|
|
14
|
-
};
|
|
15
|
-
slots: {};
|
|
16
|
-
};
|
|
17
|
-
export type ColorICProps = typeof __propDef.props;
|
|
18
|
-
export type ColorICEvents = typeof __propDef.events;
|
|
19
|
-
export type ColorICSlots = typeof __propDef.slots;
|
|
20
|
-
export default class ColorIC extends SvelteComponentTyped<ColorICProps, ColorICEvents, ColorICSlots> {
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
21
13
|
}
|
|
22
|
-
|
|
14
|
+
declare const ColorIC: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
class?: string;
|
|
16
|
+
style?: string;
|
|
17
|
+
value?: string;
|
|
18
|
+
label?: string | null;
|
|
19
|
+
onChange?: (color: string) => void;
|
|
20
|
+
presets?: string[] | null;
|
|
21
|
+
showPicker?: boolean;
|
|
22
|
+
}, {
|
|
23
|
+
[evt: string]: CustomEvent<any>;
|
|
24
|
+
}, {}, {}, string>;
|
|
25
|
+
type ColorIC = InstanceType<typeof ColorIC>;
|
|
26
|
+
export default ColorIC;
|