@merchi/product-editor 0.1.9
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/.turbo/turbo-build.log +1 -0
- package/README.md +174 -0
- package/dist/components/AlignMenu.d.ts +3 -0
- package/dist/components/AlignMenu.js +61 -0
- package/dist/components/FloatingToolbar.d.ts +4 -0
- package/dist/components/FloatingToolbar.js +97 -0
- package/dist/components/FormatButtons.d.ts +2 -0
- package/dist/components/FormatButtons.js +22 -0
- package/dist/components/ImageNavButton.d.ts +7 -0
- package/dist/components/ImageNavButton.js +14 -0
- package/dist/components/ImageZoomModal.d.ts +12 -0
- package/dist/components/ImageZoomModal.js +129 -0
- package/dist/components/LayerPanel.d.ts +4 -0
- package/dist/components/LayerPanel.js +223 -0
- package/dist/components/LoadingOverlay.d.ts +9 -0
- package/dist/components/LoadingOverlay.js +17 -0
- package/dist/components/ProductEditor.d.ts +4 -0
- package/dist/components/ProductEditor.js +67 -0
- package/dist/components/ProductImageGallery.d.ts +6 -0
- package/dist/components/ProductImageGallery.js +148 -0
- package/dist/components/ProductPreviews.d.ts +7 -0
- package/dist/components/ProductPreviews.js +281 -0
- package/dist/components/TextToolbar.d.ts +4 -0
- package/dist/components/TextToolbar.js +117 -0
- package/dist/components/Toolbar.d.ts +3 -0
- package/dist/components/Toolbar.js +47 -0
- package/dist/config/colorConfig.d.ts +1 -0
- package/dist/config/colorConfig.js +10 -0
- package/dist/config/fontConfig.d.ts +5 -0
- package/dist/config/fontConfig.js +21 -0
- package/dist/context/ProductEditorContext.d.ts +60 -0
- package/dist/context/ProductEditorContext.js +743 -0
- package/dist/hooks/useSwipeNavigate.d.ts +11 -0
- package/dist/hooks/useSwipeNavigate.js +35 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +30 -0
- package/dist/styles/BottomPreviewDisplay.css +65 -0
- package/dist/styles/FloatingToolbar.css +41 -0
- package/dist/styles/ImageGallery.css +147 -0
- package/dist/styles/ImageNavButton.css +35 -0
- package/dist/styles/ImageZoomModal.css +101 -0
- package/dist/styles/LayerPanel.css +179 -0
- package/dist/styles/LoadingOverlay.css +48 -0
- package/dist/styles/ProductEditor.css +192 -0
- package/dist/styles/TextToolbar.css +327 -0
- package/dist/styles/Toolbar.css +125 -0
- package/dist/styles/index.css +5 -0
- package/dist/styles/textToolbarSelectStyles.d.ts +3 -0
- package/dist/styles/textToolbarSelectStyles.js +30 -0
- package/dist/types.d.ts +228 -0
- package/dist/types.js +17 -0
- package/dist/utils/canvasAddText.d.ts +11 -0
- package/dist/utils/canvasAddText.js +66 -0
- package/dist/utils/canvasUtils.d.ts +37 -0
- package/dist/utils/canvasUtils.js +342 -0
- package/dist/utils/deviceUtils.d.ts +5 -0
- package/dist/utils/deviceUtils.js +33 -0
- package/dist/utils/draftTemplateUtils.d.ts +23 -0
- package/dist/utils/draftTemplateUtils.js +66 -0
- package/dist/utils/grid.d.ts +32 -0
- package/dist/utils/grid.js +151 -0
- package/dist/utils/imageUtils.d.ts +12 -0
- package/dist/utils/imageUtils.js +178 -0
- package/dist/utils/job.d.ts +40 -0
- package/dist/utils/job.js +115 -0
- package/dist/utils/keyboard.d.ts +1 -0
- package/dist/utils/keyboard.js +26 -0
- package/dist/utils/previewUtils.d.ts +9 -0
- package/dist/utils/previewUtils.js +39 -0
- package/dist/utils/psdConverter.d.ts +40 -0
- package/dist/utils/psdConverter.js +516 -0
- package/dist/utils/psdRenderUtils.d.ts +12 -0
- package/dist/utils/psdRenderUtils.js +465 -0
- package/dist/utils/renderUtils.d.ts +2 -0
- package/dist/utils/renderUtils.js +85 -0
- package/package.json +66 -0
- package/src/components/AlignMenu.tsx +49 -0
- package/src/components/FloatingToolbar.tsx +83 -0
- package/src/components/FormatButtons.tsx +31 -0
- package/src/components/ImageNavButton.tsx +23 -0
- package/src/components/ImageZoomModal.tsx +163 -0
- package/src/components/LayerPanel.tsx +256 -0
- package/src/components/LoadingOverlay.tsx +27 -0
- package/src/components/ProductEditor.tsx +104 -0
- package/src/components/ProductImageGallery.tsx +181 -0
- package/src/components/ProductPreviews.tsx +243 -0
- package/src/components/TextToolbar.tsx +164 -0
- package/src/components/Toolbar.tsx +86 -0
- package/src/config/colorConfig.ts +7 -0
- package/src/config/fontConfig.ts +23 -0
- package/src/context/ProductEditorContext.tsx +829 -0
- package/src/hooks/useSwipeNavigate.ts +40 -0
- package/src/index.ts +6 -0
- package/src/styles/BottomPreviewDisplay.css +65 -0
- package/src/styles/FloatingToolbar.css +41 -0
- package/src/styles/ImageGallery.css +147 -0
- package/src/styles/ImageNavButton.css +35 -0
- package/src/styles/ImageZoomModal.css +101 -0
- package/src/styles/LayerPanel.css +179 -0
- package/src/styles/LoadingOverlay.css +48 -0
- package/src/styles/ProductEditor.css +192 -0
- package/src/styles/TextToolbar.css +327 -0
- package/src/styles/Toolbar.css +125 -0
- package/src/styles/index.css +5 -0
- package/src/styles/textToolbarSelectStyles.ts +60 -0
- package/src/types/ag-psd/index.d.ts +1 -0
- package/src/types/fabric.d.ts +14 -0
- package/src/types/lodash/index.d.ts +1 -0
- package/src/types/psd.d.ts +53 -0
- package/src/types.ts +247 -0
- package/src/utils/canvasAddText.ts +72 -0
- package/src/utils/canvasUtils.ts +406 -0
- package/src/utils/deviceUtils.ts +31 -0
- package/src/utils/draftTemplateUtils.ts +70 -0
- package/src/utils/grid.ts +154 -0
- package/src/utils/imageUtils.ts +218 -0
- package/src/utils/job.ts +128 -0
- package/src/utils/keyboard.ts +28 -0
- package/src/utils/previewUtils.ts +43 -0
- package/src/utils/psdConverter.ts +595 -0
- package/src/utils/psdRenderUtils.ts +453 -0
- package/src/utils/renderUtils.ts +44 -0
- package/tsconfig.json +17 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
export declare enum FieldType {
|
|
2
|
+
TEXT_INPUT = 1,
|
|
3
|
+
SELECT = 2,
|
|
4
|
+
FILE_UPLOAD = 3,
|
|
5
|
+
TEXT_AREA = 4,
|
|
6
|
+
NUMBER_INPUT = 5,
|
|
7
|
+
CHECKBOX = 6,
|
|
8
|
+
RADIO = 7,
|
|
9
|
+
FIELD_INSTRUCTIONS = 8,
|
|
10
|
+
IMAGE_SELECT = 9,
|
|
11
|
+
COLOUR_PICKER = 10,
|
|
12
|
+
COLOUR_SELECT = 11
|
|
13
|
+
}
|
|
14
|
+
export interface Draft {
|
|
15
|
+
id?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface MerchiFile {
|
|
18
|
+
id?: number;
|
|
19
|
+
uploadId?: string;
|
|
20
|
+
name?: string | null;
|
|
21
|
+
mimetype?: string | null;
|
|
22
|
+
size?: number;
|
|
23
|
+
creationDate?: Date | null;
|
|
24
|
+
cachedViewUrl?: string | null;
|
|
25
|
+
viewUrlExpires?: Date | null;
|
|
26
|
+
cachedDownloadUrl?: string | null;
|
|
27
|
+
downloadUrlExpires?: Date | null;
|
|
28
|
+
viewUrl: string;
|
|
29
|
+
downloadUrl?: string;
|
|
30
|
+
thumbnailUrl?: string;
|
|
31
|
+
previewUrl?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface DraftTemplate {
|
|
34
|
+
id?: number;
|
|
35
|
+
name?: string;
|
|
36
|
+
description?: string;
|
|
37
|
+
width?: number;
|
|
38
|
+
height?: number;
|
|
39
|
+
file?: MerchiFile;
|
|
40
|
+
product?: Product | null;
|
|
41
|
+
editedByVariationFields?: VariationField[];
|
|
42
|
+
selectedByVariationFieldOptions?: VariationFieldsOption[];
|
|
43
|
+
draftPreviewLayers?: DraftPreviewLayer[];
|
|
44
|
+
}
|
|
45
|
+
export interface DraftPreview {
|
|
46
|
+
id?: number;
|
|
47
|
+
file?: MerchiFile;
|
|
48
|
+
product?: Product;
|
|
49
|
+
description?: string | null;
|
|
50
|
+
name?: string | null;
|
|
51
|
+
date?: Date | null;
|
|
52
|
+
height?: number;
|
|
53
|
+
width?: number;
|
|
54
|
+
draftPreviewLayers?: DraftPreviewLayer[];
|
|
55
|
+
}
|
|
56
|
+
export interface DraftPreviewLayer {
|
|
57
|
+
id?: number;
|
|
58
|
+
layerName?: string;
|
|
59
|
+
draftPreview?: DraftPreview;
|
|
60
|
+
draftTemplate?: DraftTemplate;
|
|
61
|
+
}
|
|
62
|
+
export interface VariationFieldsOption {
|
|
63
|
+
id?: number;
|
|
64
|
+
archived?: Date | null;
|
|
65
|
+
value?: string | null;
|
|
66
|
+
colour?: string | null;
|
|
67
|
+
currency?: string;
|
|
68
|
+
default?: boolean;
|
|
69
|
+
include?: boolean;
|
|
70
|
+
noInventory?: boolean;
|
|
71
|
+
position?: number;
|
|
72
|
+
variationCost?: number;
|
|
73
|
+
variationUnitCost?: number;
|
|
74
|
+
buyUnitCost?: number;
|
|
75
|
+
buyCost?: number;
|
|
76
|
+
variationField?: VariationField | null;
|
|
77
|
+
linkedFile?: MerchiFile | null;
|
|
78
|
+
selectedByVariations?: Variation[];
|
|
79
|
+
}
|
|
80
|
+
export interface VariationField {
|
|
81
|
+
id?: number;
|
|
82
|
+
archived?: Date | null;
|
|
83
|
+
position?: number;
|
|
84
|
+
required?: boolean;
|
|
85
|
+
independent?: boolean;
|
|
86
|
+
name?: string;
|
|
87
|
+
instructions?: string;
|
|
88
|
+
placeholder?: string | null;
|
|
89
|
+
defaultValue?: string;
|
|
90
|
+
currency?: string;
|
|
91
|
+
fieldType?: FieldType;
|
|
92
|
+
margin?: number;
|
|
93
|
+
variationCost?: number;
|
|
94
|
+
variationUnitCost?: number;
|
|
95
|
+
buyUnitCost?: number;
|
|
96
|
+
buyCost?: number;
|
|
97
|
+
rows?: number;
|
|
98
|
+
fieldMin?: number | null;
|
|
99
|
+
fieldMax?: number | null;
|
|
100
|
+
allowDecimal?: boolean;
|
|
101
|
+
sellerProductEditable?: boolean;
|
|
102
|
+
multipleSelect?: boolean;
|
|
103
|
+
showFilePreview?: boolean;
|
|
104
|
+
allowFileMultiple?: boolean;
|
|
105
|
+
allowFileJpeg?: boolean;
|
|
106
|
+
allowFileGif?: boolean;
|
|
107
|
+
allowFilePdf?: boolean;
|
|
108
|
+
allowFilePng?: boolean;
|
|
109
|
+
allowFileAi?: boolean;
|
|
110
|
+
product?: Product;
|
|
111
|
+
variations?: Variation[];
|
|
112
|
+
options?: VariationFieldsOption[];
|
|
113
|
+
}
|
|
114
|
+
export interface VariationOption {
|
|
115
|
+
optionId?: number;
|
|
116
|
+
value?: string | null;
|
|
117
|
+
colour?: string | null;
|
|
118
|
+
position?: number;
|
|
119
|
+
available?: boolean;
|
|
120
|
+
default?: boolean;
|
|
121
|
+
include?: boolean;
|
|
122
|
+
linkedFile?: MerchiFile | null;
|
|
123
|
+
fieldName?: string;
|
|
124
|
+
quantity?: number;
|
|
125
|
+
currency?: string;
|
|
126
|
+
onceOffCost?: number;
|
|
127
|
+
unitCost?: number;
|
|
128
|
+
unitCostTotal?: number;
|
|
129
|
+
totalCost?: number;
|
|
130
|
+
}
|
|
131
|
+
export interface Variation {
|
|
132
|
+
id?: number;
|
|
133
|
+
archived?: Date | null;
|
|
134
|
+
value?: string | null;
|
|
135
|
+
currency?: string;
|
|
136
|
+
cost?: number;
|
|
137
|
+
quantity?: number;
|
|
138
|
+
onceOffCost?: number;
|
|
139
|
+
unitCost?: number;
|
|
140
|
+
unitCostTotal?: number;
|
|
141
|
+
variationField?: VariationField;
|
|
142
|
+
variationsGroup?: VariationsGroup | null;
|
|
143
|
+
job?: Job | null;
|
|
144
|
+
variationFiles?: MerchiFile[];
|
|
145
|
+
selectedOptions?: VariationOption[];
|
|
146
|
+
selectableOptions?: VariationOption[];
|
|
147
|
+
}
|
|
148
|
+
export interface VariationsGroup {
|
|
149
|
+
id?: number;
|
|
150
|
+
archived?: Date | null;
|
|
151
|
+
quantity?: number;
|
|
152
|
+
groupCost?: number | null;
|
|
153
|
+
job?: Job | null;
|
|
154
|
+
variations?: Variation[];
|
|
155
|
+
inventoryCount?: number;
|
|
156
|
+
inventorySufficient?: boolean;
|
|
157
|
+
}
|
|
158
|
+
export interface Product {
|
|
159
|
+
id?: number;
|
|
160
|
+
name?: string;
|
|
161
|
+
description?: string | null;
|
|
162
|
+
draftTemplates?: DraftTemplate[];
|
|
163
|
+
draftPreviews?: DraftPreview[];
|
|
164
|
+
featureImage?: MerchiFile;
|
|
165
|
+
groupVariationFields?: VariationField[];
|
|
166
|
+
independentVariationFields?: VariationField[];
|
|
167
|
+
images?: MerchiFile[];
|
|
168
|
+
}
|
|
169
|
+
export interface Job {
|
|
170
|
+
id?: number;
|
|
171
|
+
quantity?: number;
|
|
172
|
+
currency?: string;
|
|
173
|
+
jobInfoApprovedByClient?: boolean;
|
|
174
|
+
costPerUnit?: number | null;
|
|
175
|
+
cost?: number | null;
|
|
176
|
+
taxAmount?: number | null;
|
|
177
|
+
totalCost?: number | null;
|
|
178
|
+
drafts?: Draft[];
|
|
179
|
+
sharedDrafts?: Draft[];
|
|
180
|
+
ownDrafts?: Draft[];
|
|
181
|
+
product?: Product;
|
|
182
|
+
variationsGroups?: VariationsGroup[];
|
|
183
|
+
variations?: Variation[];
|
|
184
|
+
}
|
|
185
|
+
export interface ProductEditorProps {
|
|
186
|
+
product: Product;
|
|
187
|
+
width?: number;
|
|
188
|
+
height?: number;
|
|
189
|
+
onSave?: (editedImage: string) => void;
|
|
190
|
+
onCancel?: () => void;
|
|
191
|
+
psdTemplateUrl?: string;
|
|
192
|
+
}
|
|
193
|
+
export interface SavedCanvasObject {
|
|
194
|
+
fieldId: string;
|
|
195
|
+
fileId?: string;
|
|
196
|
+
uniqueId?: string;
|
|
197
|
+
type: string;
|
|
198
|
+
left: number;
|
|
199
|
+
top: number;
|
|
200
|
+
scaleX: number;
|
|
201
|
+
scaleY: number;
|
|
202
|
+
angle: number;
|
|
203
|
+
text?: string;
|
|
204
|
+
fontSize?: number;
|
|
205
|
+
fontFamily?: string;
|
|
206
|
+
fill?: string;
|
|
207
|
+
width?: number;
|
|
208
|
+
height?: number;
|
|
209
|
+
src?: string;
|
|
210
|
+
[key: string]: any;
|
|
211
|
+
}
|
|
212
|
+
export interface DraftTemplateData {
|
|
213
|
+
template: DraftTemplate;
|
|
214
|
+
variationFieldIds: number[];
|
|
215
|
+
variationObjects: any[];
|
|
216
|
+
}
|
|
217
|
+
export interface RenderedDraftPreview {
|
|
218
|
+
templateId: number;
|
|
219
|
+
draft: string;
|
|
220
|
+
canvasPreview: string;
|
|
221
|
+
}
|
|
222
|
+
export interface MappedPreview {
|
|
223
|
+
draftPreview: DraftPreview;
|
|
224
|
+
draftPreviewLayers: {
|
|
225
|
+
layerName: string | undefined;
|
|
226
|
+
renderedLayer: RenderedDraftPreview | null;
|
|
227
|
+
}[];
|
|
228
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FieldType = void 0;
|
|
4
|
+
var FieldType;
|
|
5
|
+
(function (FieldType) {
|
|
6
|
+
FieldType[FieldType["TEXT_INPUT"] = 1] = "TEXT_INPUT";
|
|
7
|
+
FieldType[FieldType["SELECT"] = 2] = "SELECT";
|
|
8
|
+
FieldType[FieldType["FILE_UPLOAD"] = 3] = "FILE_UPLOAD";
|
|
9
|
+
FieldType[FieldType["TEXT_AREA"] = 4] = "TEXT_AREA";
|
|
10
|
+
FieldType[FieldType["NUMBER_INPUT"] = 5] = "NUMBER_INPUT";
|
|
11
|
+
FieldType[FieldType["CHECKBOX"] = 6] = "CHECKBOX";
|
|
12
|
+
FieldType[FieldType["RADIO"] = 7] = "RADIO";
|
|
13
|
+
FieldType[FieldType["FIELD_INSTRUCTIONS"] = 8] = "FIELD_INSTRUCTIONS";
|
|
14
|
+
FieldType[FieldType["IMAGE_SELECT"] = 9] = "IMAGE_SELECT";
|
|
15
|
+
FieldType[FieldType["COLOUR_PICKER"] = 10] = "COLOUR_PICKER";
|
|
16
|
+
FieldType[FieldType["COLOUR_SELECT"] = 11] = "COLOUR_SELECT";
|
|
17
|
+
})(FieldType = exports.FieldType || (exports.FieldType = {}));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { fabric } from 'fabric';
|
|
2
|
+
/**
|
|
3
|
+
* Adds an editable text object to the canvas
|
|
4
|
+
* @param canvas - The Fabric.js canvas instance
|
|
5
|
+
* @param width - The width of the canvas
|
|
6
|
+
* @param height - The height of the canvas
|
|
7
|
+
* @param defaultText - Optional default text (defaults to "Text")
|
|
8
|
+
* @param fontSize - Optional font size (defaults to 24)
|
|
9
|
+
* @param fontFamily - Optional font family (defaults to Arial)
|
|
10
|
+
*/
|
|
11
|
+
export declare const addText: (canvas: fabric.Canvas, width: number, height: number, defaultText?: string, fontSize?: number, fontFamily?: string) => fabric.IText | null;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addText = void 0;
|
|
4
|
+
// add text to the canvas
|
|
5
|
+
var fabric_1 = require("fabric");
|
|
6
|
+
/**
|
|
7
|
+
* Adds an editable text object to the canvas
|
|
8
|
+
* @param canvas - The Fabric.js canvas instance
|
|
9
|
+
* @param width - The width of the canvas
|
|
10
|
+
* @param height - The height of the canvas
|
|
11
|
+
* @param defaultText - Optional default text (defaults to "Text")
|
|
12
|
+
* @param fontSize - Optional font size (defaults to 24)
|
|
13
|
+
* @param fontFamily - Optional font family (defaults to Arial)
|
|
14
|
+
*/
|
|
15
|
+
var addText = function (canvas, width, height, defaultText, fontSize, fontFamily) {
|
|
16
|
+
if (defaultText === void 0) { defaultText = 'Text'; }
|
|
17
|
+
if (fontSize === void 0) { fontSize = 24; }
|
|
18
|
+
if (fontFamily === void 0) { fontFamily = 'Nunito'; }
|
|
19
|
+
if (!canvas)
|
|
20
|
+
return null;
|
|
21
|
+
try {
|
|
22
|
+
// Safe check if canvas is still valid
|
|
23
|
+
if (!canvas.getElement() || !canvas.getElement().parentNode) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
// Create a new text object with minimal options
|
|
27
|
+
var text_1 = new fabric_1.fabric.IText(defaultText, {
|
|
28
|
+
left: width / 2,
|
|
29
|
+
top: height / 2,
|
|
30
|
+
fontFamily: fontFamily,
|
|
31
|
+
fontSize: fontSize,
|
|
32
|
+
fill: '#000000',
|
|
33
|
+
originX: 'center',
|
|
34
|
+
originY: 'center',
|
|
35
|
+
selectable: true,
|
|
36
|
+
editable: false
|
|
37
|
+
});
|
|
38
|
+
// Add the text to the canvas
|
|
39
|
+
canvas.add(text_1);
|
|
40
|
+
// Ensure the text is rendered
|
|
41
|
+
canvas.renderAll();
|
|
42
|
+
// Make the text active - this is critical
|
|
43
|
+
var setActiveTextObject = function () {
|
|
44
|
+
try {
|
|
45
|
+
// Check if canvas is still valid
|
|
46
|
+
if (canvas && canvas.getElement() && canvas.getElement().parentNode) {
|
|
47
|
+
canvas.setActiveObject(text_1);
|
|
48
|
+
canvas.renderAll();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
console.error('Error setting active text object:', err);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
// Initial selection
|
|
56
|
+
setActiveTextObject();
|
|
57
|
+
// Delayed selection to ensure text becomes active
|
|
58
|
+
setTimeout(setActiveTextObject, 50);
|
|
59
|
+
return text_1;
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
console.error('Error adding text to canvas:', error);
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
exports.addText = addText;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { fabric } from 'fabric';
|
|
2
|
+
/**
|
|
3
|
+
* Adds an editable text object to the canvas
|
|
4
|
+
* @param canvas - The Fabric.js canvas instance
|
|
5
|
+
* @param width - The width of the canvas
|
|
6
|
+
* @param height - The height of the canvas
|
|
7
|
+
* @param defaultText - Optional default text (defaults to "Text")
|
|
8
|
+
* @param fontSize - Optional font size (defaults to 24)
|
|
9
|
+
* @param fontFamily - Optional font family (defaults to Arial)
|
|
10
|
+
*/
|
|
11
|
+
export declare const addTextToCanvas: (canvas: fabric.Canvas, width: number, height: number, defaultText?: string, fontSize?: number, fontFamily?: string) => fabric.IText | null;
|
|
12
|
+
/**
|
|
13
|
+
* Renders the entire canvas as an image without displaying grid elements
|
|
14
|
+
*
|
|
15
|
+
* @param canvas - The Fabric.js canvas instance
|
|
16
|
+
* @param options - Optional rendering options
|
|
17
|
+
* @returns A promise that resolves to the dataURL of the canvas without grid
|
|
18
|
+
*/
|
|
19
|
+
export declare const renderCanvasWithoutGrid: (canvas: fabric.Canvas, options?: {
|
|
20
|
+
format?: string;
|
|
21
|
+
quality?: number;
|
|
22
|
+
multiplier?: number;
|
|
23
|
+
backgroundColor?: string | null;
|
|
24
|
+
}) => Promise<string | null>;
|
|
25
|
+
/**
|
|
26
|
+
* Renders an image containing only what's visible inside a clipPath on the canvas
|
|
27
|
+
*
|
|
28
|
+
* @param canvas - The Fabric.js canvas instance
|
|
29
|
+
* @param options - Optional rendering options
|
|
30
|
+
* @returns A promise that resolves to the dataURL of the contents inside the clipPath, or null if no clipped object is found
|
|
31
|
+
*/
|
|
32
|
+
export declare const renderClippedImage: (canvas: fabric.Canvas, options?: {
|
|
33
|
+
format?: string;
|
|
34
|
+
quality?: number;
|
|
35
|
+
multiplier?: number;
|
|
36
|
+
backgroundColor?: string;
|
|
37
|
+
}) => Promise<string | null>;
|