@widgetic/canvas 0.5.34 → 0.5.36
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 +454 -0
- package/dist/canvas/DomCanvas.svelte.d.ts +222 -0
- package/dist/canvas/autosaveScheduler.d.ts +58 -0
- package/dist/canvas/autosaveScheduler.js +157 -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 +351 -0
- package/dist/canvas/host/CanvasHost.js +1740 -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 +51 -0
- package/dist/canvas/host/conversion.js +123 -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 +9 -7
- package/dist/canvas/index.js +9 -7
- 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 +24 -0
- package/dist/canvas/toolbarPosition.js +24 -0
- 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 +20 -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 +155 -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 +152 -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 +51 -122
- package/dist/i18n/messages.js +58 -131
- package/dist/i18n/shortcuts.d.ts +0 -1
- package/dist/i18n/shortcuts.js +2 -11
- package/dist/index.d.ts +6 -2
- package/dist/index.js +6 -2
- package/package.json +30 -5
- package/dist/canvas/Canvas.svelte +0 -13299
- package/dist/canvas/Canvas.svelte.d.ts +0 -281
- 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
|
@@ -1,84 +0,0 @@
|
|
|
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
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
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,242 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import ColorIC from '../../components/input-controls/ColorIC.svelte';
|
|
3
|
-
import SliderUnitIC from '../../components/input-controls/SliderUnitIC.svelte';
|
|
4
|
-
import { useCanvasLanguage } from '../../i18n/language.js';
|
|
5
|
-
|
|
6
|
-
// The words of the section, in the language of the canvas it is on (English when it is used on its own)
|
|
7
|
-
const { t } = useCanvasLanguage();
|
|
8
|
-
|
|
9
|
-
let className = '';
|
|
10
|
-
export { className as class };
|
|
11
|
-
export let style = '';
|
|
12
|
-
|
|
13
|
-
// Current values
|
|
14
|
-
export let fontSize: number = 28;
|
|
15
|
-
export let fontFamily: string = 'Arial';
|
|
16
|
-
export let fontWeight: 'normal' | 'bold' = 'normal';
|
|
17
|
-
export let fontStyle: 'normal' | 'italic' = 'normal';
|
|
18
|
-
export let underline: boolean = false;
|
|
19
|
-
export let textAlign: 'left' | 'center' | 'right' = 'left';
|
|
20
|
-
export let textColor: string = '#000000';
|
|
21
|
-
|
|
22
|
-
// Callbacks
|
|
23
|
-
export let onFontSizeChange: (size: number) => void = () => {};
|
|
24
|
-
export let onFontFamilyChange: (family: string) => void = () => {};
|
|
25
|
-
export let onFontWeightChange: (weight: 'normal' | 'bold') => void = () => {};
|
|
26
|
-
export let onFontStyleChange: (style: 'normal' | 'italic') => void = () => {};
|
|
27
|
-
export let onUnderlineChange: (underline: boolean) => void = () => {};
|
|
28
|
-
export let onTextAlignChange: (align: 'left' | 'center' | 'right') => void = () => {};
|
|
29
|
-
export let onTextColorChange: (color: string) => void = () => {};
|
|
30
|
-
|
|
31
|
-
// Show/hide certain controls
|
|
32
|
-
export let showFontSize: boolean = true;
|
|
33
|
-
export let showFontFamily: boolean = true;
|
|
34
|
-
export let showTextStyle: boolean = true;
|
|
35
|
-
export let showTextAlign: boolean = true;
|
|
36
|
-
export let showTextColor: boolean = true;
|
|
37
|
-
|
|
38
|
-
// Font presets
|
|
39
|
-
const fontFamilies = [
|
|
40
|
-
'Arial',
|
|
41
|
-
'Helvetica',
|
|
42
|
-
'Times New Roman',
|
|
43
|
-
'Georgia',
|
|
44
|
-
'Verdana',
|
|
45
|
-
'Courier New',
|
|
46
|
-
'Impact',
|
|
47
|
-
'Comic Sans MS'
|
|
48
|
-
];
|
|
49
|
-
|
|
50
|
-
function handleFontFamilyChange(e: Event) {
|
|
51
|
-
const select = e.target as HTMLSelectElement;
|
|
52
|
-
onFontFamilyChange(select.value);
|
|
53
|
-
}
|
|
54
|
-
</script>
|
|
55
|
-
|
|
56
|
-
<div class="{className ? className + ' ' : ''}text-props-component" style={style}>
|
|
57
|
-
|
|
58
|
-
{#if showFontSize}
|
|
59
|
-
<SliderUnitIC
|
|
60
|
-
label={$t('canvas.field.fontSize')}
|
|
61
|
-
value={fontSize}
|
|
62
|
-
min={8}
|
|
63
|
-
max={120}
|
|
64
|
-
step={1}
|
|
65
|
-
unit="px"
|
|
66
|
-
onChange={onFontSizeChange}
|
|
67
|
-
/>
|
|
68
|
-
{/if}
|
|
69
|
-
|
|
70
|
-
{#if showFontFamily}
|
|
71
|
-
<div class="prop-section">
|
|
72
|
-
<span class="prop-label">{$t('canvas.control.fontFamily')}</span>
|
|
73
|
-
<select
|
|
74
|
-
value={fontFamily}
|
|
75
|
-
onchange={handleFontFamilyChange}
|
|
76
|
-
class="font-select"
|
|
77
|
-
>
|
|
78
|
-
{#each fontFamilies as font}
|
|
79
|
-
<option value={font} style="font-family: {font}">{font}</option>
|
|
80
|
-
{/each}
|
|
81
|
-
</select>
|
|
82
|
-
</div>
|
|
83
|
-
{/if}
|
|
84
|
-
|
|
85
|
-
{#if showTextStyle}
|
|
86
|
-
<div class="prop-section">
|
|
87
|
-
<span class="prop-label">{$t('canvas.control.textStyle')}</span>
|
|
88
|
-
<div class="text-style-buttons">
|
|
89
|
-
<button
|
|
90
|
-
class="style-btn {fontWeight === 'bold' ? 'active' : ''}"
|
|
91
|
-
onclick={() => onFontWeightChange(fontWeight === 'bold' ? 'normal' : 'bold')}
|
|
92
|
-
title={$t('canvas.control.bold')}
|
|
93
|
-
>
|
|
94
|
-
<strong>{$t('canvas.control.boldMark')}</strong>
|
|
95
|
-
</button>
|
|
96
|
-
<button
|
|
97
|
-
class="style-btn {fontStyle === 'italic' ? 'active' : ''}"
|
|
98
|
-
onclick={() => onFontStyleChange(fontStyle === 'italic' ? 'normal' : 'italic')}
|
|
99
|
-
title={$t('canvas.control.italic')}
|
|
100
|
-
>
|
|
101
|
-
<em>{$t('canvas.control.italicMark')}</em>
|
|
102
|
-
</button>
|
|
103
|
-
<button
|
|
104
|
-
class="style-btn {underline ? 'active' : ''}"
|
|
105
|
-
onclick={() => onUnderlineChange(!underline)}
|
|
106
|
-
title={$t('canvas.control.underline')}
|
|
107
|
-
>
|
|
108
|
-
<span style="text-decoration: underline">{$t('canvas.control.underlineMark')}</span>
|
|
109
|
-
</button>
|
|
110
|
-
</div>
|
|
111
|
-
</div>
|
|
112
|
-
{/if}
|
|
113
|
-
|
|
114
|
-
{#if showTextAlign}
|
|
115
|
-
<div class="prop-section">
|
|
116
|
-
<span class="prop-label">{$t('canvas.control.textAlign')}</span>
|
|
117
|
-
<div class="align-buttons">
|
|
118
|
-
<button
|
|
119
|
-
class="align-btn {textAlign === 'left' ? 'active' : ''}"
|
|
120
|
-
onclick={() => onTextAlignChange('left')}
|
|
121
|
-
title={$t('canvas.control.alignLeft')}
|
|
122
|
-
>⫷</button>
|
|
123
|
-
<button
|
|
124
|
-
class="align-btn {textAlign === 'center' ? 'active' : ''}"
|
|
125
|
-
onclick={() => onTextAlignChange('center')}
|
|
126
|
-
title={$t('canvas.control.alignCenter')}
|
|
127
|
-
>☰</button>
|
|
128
|
-
<button
|
|
129
|
-
class="align-btn {textAlign === 'right' ? 'active' : ''}"
|
|
130
|
-
onclick={() => onTextAlignChange('right')}
|
|
131
|
-
title={$t('canvas.control.alignRight')}
|
|
132
|
-
>⫸</button>
|
|
133
|
-
</div>
|
|
134
|
-
</div>
|
|
135
|
-
{/if}
|
|
136
|
-
|
|
137
|
-
{#if showTextColor}
|
|
138
|
-
<ColorIC
|
|
139
|
-
label={$t('canvas.field.textColor')}
|
|
140
|
-
value={textColor}
|
|
141
|
-
onChange={onTextColorChange}
|
|
142
|
-
/>
|
|
143
|
-
{/if}
|
|
144
|
-
</div>
|
|
145
|
-
|
|
146
|
-
<style>
|
|
147
|
-
.text-props-component {
|
|
148
|
-
display: flex;
|
|
149
|
-
flex-direction: column;
|
|
150
|
-
gap: 10px;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.prop-section {
|
|
154
|
-
display: flex;
|
|
155
|
-
flex-direction: column;
|
|
156
|
-
gap: 6px;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
.prop-label {
|
|
160
|
-
font-size: 11px;
|
|
161
|
-
font-weight: 600;
|
|
162
|
-
color: #6b7280;
|
|
163
|
-
text-transform: uppercase;
|
|
164
|
-
letter-spacing: 0.5px;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/* Font select */
|
|
168
|
-
.font-select {
|
|
169
|
-
width: 100%;
|
|
170
|
-
padding: 6px 8px;
|
|
171
|
-
border: 1px solid #d1d5db;
|
|
172
|
-
border-radius: 4px;
|
|
173
|
-
font-size: 12px;
|
|
174
|
-
cursor: pointer;
|
|
175
|
-
background: white;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.font-select:focus {
|
|
179
|
-
outline: none;
|
|
180
|
-
border-color: var(--accent, #314F2F);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/* Text style buttons */
|
|
184
|
-
.text-style-buttons {
|
|
185
|
-
display: flex;
|
|
186
|
-
gap: 4px;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
.style-btn {
|
|
190
|
-
width: 32px;
|
|
191
|
-
height: 32px;
|
|
192
|
-
display: flex;
|
|
193
|
-
align-items: center;
|
|
194
|
-
justify-content: center;
|
|
195
|
-
border: 1px solid #d1d5db;
|
|
196
|
-
border-radius: 4px;
|
|
197
|
-
background: white;
|
|
198
|
-
font-size: 14px;
|
|
199
|
-
cursor: pointer;
|
|
200
|
-
transition: all 0.15s ease;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
.style-btn:hover {
|
|
204
|
-
background: #f3f4f6;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
.style-btn.active {
|
|
208
|
-
background: var(--accent, #314F2F);
|
|
209
|
-
color: white;
|
|
210
|
-
border-color: var(--accent, #314F2F);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/* Align buttons */
|
|
214
|
-
.align-buttons {
|
|
215
|
-
display: flex;
|
|
216
|
-
gap: 4px;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
.align-btn {
|
|
220
|
-
flex: 1;
|
|
221
|
-
height: 32px;
|
|
222
|
-
display: flex;
|
|
223
|
-
align-items: center;
|
|
224
|
-
justify-content: center;
|
|
225
|
-
border: 1px solid #d1d5db;
|
|
226
|
-
border-radius: 4px;
|
|
227
|
-
background: white;
|
|
228
|
-
font-size: 14px;
|
|
229
|
-
cursor: pointer;
|
|
230
|
-
transition: all 0.15s ease;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
.align-btn:hover {
|
|
234
|
-
background: #f3f4f6;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
.align-btn.active {
|
|
238
|
-
background: var(--accent, #314F2F);
|
|
239
|
-
color: white;
|
|
240
|
-
border-color: var(--accent, #314F2F);
|
|
241
|
-
}
|
|
242
|
-
</style>
|
|
@@ -1,40 +0,0 @@
|
|
|
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
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
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;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { IText } from 'fabric';
|
|
2
|
-
import { canvasLog } from './canvasLogger';
|
|
3
|
-
import { getShadowRootOf } from './eventScope';
|
|
4
|
-
let isInstalled = false;
|
|
5
|
-
/**
|
|
6
|
-
* Teaches the text objects of Fabric to keep their hidden text area inside the shadow root their canvas is in.
|
|
7
|
-
* Safe to call again: it only changes Fabric once.
|
|
8
|
-
*/
|
|
9
|
-
export function installTextareaInShadowRoot() {
|
|
10
|
-
if (isInstalled)
|
|
11
|
-
return;
|
|
12
|
-
isInstalled = true;
|
|
13
|
-
const textPrototype = IText.prototype;
|
|
14
|
-
const originalInitHiddenTextarea = textPrototype.initHiddenTextarea;
|
|
15
|
-
const originalCalcTextareaPosition = textPrototype._calcTextareaPosition;
|
|
16
|
-
/** Whether the hidden text area of this text is the one the canvas keeps in its own wrapper. */
|
|
17
|
-
const keptInWrapper = (text) => !!text.canvas?.wrapperEl && text.hiddenTextareaContainer === text.canvas.wrapperEl;
|
|
18
|
-
textPrototype.initHiddenTextarea = function () {
|
|
19
|
-
try {
|
|
20
|
-
const canvas = this.canvas;
|
|
21
|
-
if (!this.hiddenTextareaContainer && canvas?.wrapperEl && getShadowRootOf(canvas.getElement?.())) {
|
|
22
|
-
this.hiddenTextareaContainer = canvas.wrapperEl;
|
|
23
|
-
canvasLog('Canvas: the text being edited keeps its hidden text area inside the shadow root');
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
catch (error) {
|
|
27
|
-
console.warn('Canvas: could not choose a place for the hidden text area, Fabric will use the page', error);
|
|
28
|
-
}
|
|
29
|
-
originalInitHiddenTextarea.call(this);
|
|
30
|
-
};
|
|
31
|
-
textPrototype._calcTextareaPosition = function () {
|
|
32
|
-
const position = originalCalcTextareaPosition.call(this);
|
|
33
|
-
// Fabric adds the canvas's offset on the document to the position; the wrapper has its own origin, so it comes off again.
|
|
34
|
-
const offset = this.canvas?._offset;
|
|
35
|
-
if (!keptInWrapper(this) || !offset)
|
|
36
|
-
return position;
|
|
37
|
-
const left = Number.parseFloat(position.left);
|
|
38
|
-
const top = Number.parseFloat(position.top);
|
|
39
|
-
if (!Number.isFinite(left) || !Number.isFinite(top))
|
|
40
|
-
return position;
|
|
41
|
-
return { ...position, left: `${left - offset.left}px`, top: `${top - offset.top}px` };
|
|
42
|
-
};
|
|
43
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FrameShape - A container shape extending Fabric.js Group
|
|
3
|
-
*
|
|
4
|
-
* Features:
|
|
5
|
-
* - Extends fabric.Group to act as a container for child objects
|
|
6
|
-
* - interactive: true — children can be selected/edited directly (tldraw-like)
|
|
7
|
-
* - Click on a child → selects that child for individual editing
|
|
8
|
-
* - Click on frame background → selects the frame itself
|
|
9
|
-
* - ClipPath for bounding/clipping content inside frame boundaries
|
|
10
|
-
* - Customizable label drawn above the frame (with text wrapping, rotation support)
|
|
11
|
-
* - Custom controls: corner resize only, no rotation handle
|
|
12
|
-
* - Minimum size enforcement
|
|
13
|
-
* - Serialization support with custom properties
|
|
14
|
-
* - addObjectToFrame / removeObjectFromFrame with automatic coordinate conversion
|
|
15
|
-
* (Fabric's native _enterGroup/_exitGroup handles absolute ↔ group-relative transforms)
|
|
16
|
-
*
|
|
17
|
-
* Containment detection (drag in/out) is handled by Canvas.svelte's
|
|
18
|
-
* object:modified handler since it requires canvas-level access.
|
|
19
|
-
*/
|
|
20
|
-
import { Group, Rect, type FabricObject, type Canvas as FabricCanvas } from 'fabric';
|
|
21
|
-
export declare const MIN_FRAME_WIDTH = 50;
|
|
22
|
-
export declare const MIN_FRAME_HEIGHT = 30;
|
|
23
|
-
export declare const DEFAULT_STROKE = "#2563eb";
|
|
24
|
-
export declare const FRAME_HOVER_STROKE = "#1d4ed8";
|
|
25
|
-
export interface FrameShapeOptions {
|
|
26
|
-
left?: number;
|
|
27
|
-
top?: number;
|
|
28
|
-
width?: number;
|
|
29
|
-
height?: number;
|
|
30
|
-
fill?: string;
|
|
31
|
-
stroke?: string;
|
|
32
|
-
strokeWidth?: number;
|
|
33
|
-
labelText?: string;
|
|
34
|
-
labelFontSize?: number;
|
|
35
|
-
labelFontFamily?: string;
|
|
36
|
-
labelColor?: string;
|
|
37
|
-
labelBackgroundColor?: string;
|
|
38
|
-
labelTextAlign?: 'left' | 'center' | 'right';
|
|
39
|
-
labelFontWeight?: string;
|
|
40
|
-
labelFontStyle?: string;
|
|
41
|
-
labelUnderline?: boolean;
|
|
42
|
-
}
|
|
43
|
-
export declare class FrameShape extends Group {
|
|
44
|
-
static type: string;
|
|
45
|
-
/**
|
|
46
|
-
* Serialise the frame with type = 'FrameShape' plus all custom label/style
|
|
47
|
-
* props so they survive a canvas.toJSON() → loadFromJSON() round-trip.
|
|
48
|
-
* FRAME_CUSTOM_PROPS and _objectId are always included regardless of what
|
|
49
|
-
* the canvas passes as propertiesToInclude.
|
|
50
|
-
*/
|
|
51
|
-
toObject(propertiesToInclude?: any[]): any;
|
|
52
|
-
/**
|
|
53
|
-
* Deserialise a saved FrameShape.
|
|
54
|
-
* Delegates to Group.fromObject (handles enlivenObjects, FixedLayout setup,
|
|
55
|
-
* and subscribeTargets) then upgrades the plain Group to a proper FrameShape
|
|
56
|
-
* instance via Object.setPrototypeOf before re-applying the custom render.
|
|
57
|
-
*
|
|
58
|
-
* WHY setPrototypeOf:
|
|
59
|
-
* Group.fromObject always returns `new Group(...)` whose prototype is Group.prototype.
|
|
60
|
-
* After setPrototypeOf → FrameShape.prototype, the instance:
|
|
61
|
-
* • reports type === 'FrameShape' (via FrameShape.prototype.type)
|
|
62
|
-
* • calls FrameShape.prototype.toObject() on save → emits type:'FrameShape' + custom props
|
|
63
|
-
* • classRegistry dispatches FrameShape.fromObject on next reload
|
|
64
|
-
*/
|
|
65
|
-
static fromObject(object: any, options?: any): Promise<FrameShape>;
|
|
66
|
-
}
|
|
67
|
-
export declare function createFrameShape(options?: FrameShapeOptions): Group;
|
|
68
|
-
export declare function setupClipPath(frame: Group): void;
|
|
69
|
-
export declare function updateClipPath(frame: Group): void;
|
|
70
|
-
export declare function updateFrameCornerRadius(frame: Group, radiusPixels: number): void;
|
|
71
|
-
export declare function addObjectToFrame(frame: Group, object: FabricObject, canvas: FabricCanvas): void;
|
|
72
|
-
export declare function removeObjectFromFrame(frame: Group, object: FabricObject, canvas: FabricCanvas): void;
|
|
73
|
-
export declare function isPointInFrameLabel(frame: Group, point: {
|
|
74
|
-
x: number;
|
|
75
|
-
y: number;
|
|
76
|
-
}): boolean;
|
|
77
|
-
export declare function isPointInsideFrame(frame: Group, point: {
|
|
78
|
-
x: number;
|
|
79
|
-
y: number;
|
|
80
|
-
}): boolean;
|
|
81
|
-
export declare function isPointOnFrameBorder(frame: Group, point: {
|
|
82
|
-
x: number;
|
|
83
|
-
y: number;
|
|
84
|
-
}): boolean;
|
|
85
|
-
export declare function applyFrameHitTest(frame: Group): void;
|
|
86
|
-
export declare function getFrameChildren(frame: Group): FabricObject[];
|
|
87
|
-
export declare function getFrameBackground(frame: Group): Rect | null;
|
|
88
|
-
export declare function updateFrameBackground(frame: Group, props: {
|
|
89
|
-
fill?: string;
|
|
90
|
-
stroke?: string;
|
|
91
|
-
strokeWidth?: number;
|
|
92
|
-
}): void;
|
|
93
|
-
export declare function normalizeFrameAfterScaling(frame: Group, preserveChildren?: boolean): void;
|
|
94
|
-
export declare function enforceFrameMinSize(frame: Group): void;
|
|
95
|
-
export declare const FRAME_CUSTOM_PROPS: string[];
|
|
96
|
-
export declare function isFrameShape(obj: any): boolean;
|
|
97
|
-
export declare function reapplyFrameRender(frame: Group): void;
|