@yorab/react-paint 0.6.5 → 0.6.6
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 +2 -0
- package/dist/components/App.js +224 -384
- package/dist/components/Canvas.js +104 -114
- package/dist/components/common/Button.js +41 -50
- package/dist/components/common/Loading.js +21 -33
- package/dist/components/common/Modal.js +18 -17
- package/dist/components/common/Panel.js +20 -24
- package/dist/components/common/Snackbar.js +27 -34
- package/dist/components/settings/ColorField.js +59 -68
- package/dist/components/settings/DeleteButton.js +10 -9
- package/dist/components/settings/FontFamilyField.js +24 -19
- package/dist/components/settings/LayoutButton.js +11 -9
- package/dist/components/settings/Layouts.js +93 -103
- package/dist/components/settings/LineArrowField.js +25 -22
- package/dist/components/settings/LineTypeField.js +23 -20
- package/dist/components/settings/PointsNumberField.js +14 -13
- package/dist/components/settings/RangeField.js +35 -47
- package/dist/components/settings/SelectField.js +34 -43
- package/dist/components/settings/SettingsBar.js +95 -118
- package/dist/components/settings/ToggleField.js +18 -25
- package/dist/components/toolbox/EditTextBox.js +53 -42
- package/dist/components/toolbox/LoadFileTool.js +19 -21
- package/dist/components/toolbox/MenuGroup.js +60 -96
- package/dist/components/toolbox/PictureUrlInput.js +33 -62
- package/dist/components/toolbox/Tool.js +13 -13
- package/dist/components/toolbox/Toolbar.js +74 -106
- package/dist/components/toolbox/ToolbarGroup.js +41 -57
- package/dist/constants/icons.js +43 -43
- package/dist/constants/shapes.js +6 -6
- package/dist/constants/snackbar.js +3 -3
- package/dist/constants/style.js +13 -13
- package/dist/constants/tools.js +80 -80
- package/dist/hooks/useComponent.js +12 -19
- package/dist/hooks/useDoubleClick.js +12 -12
- package/dist/hooks/useDrag.js +24 -32
- package/dist/hooks/useDrawableCanvas.js +86 -100
- package/dist/hooks/useKeyboard.js +26 -36
- package/dist/hooks/useResizeObserver.js +18 -16
- package/dist/hooks/useShapes.js +91 -143
- package/dist/hooks/useSnackbar.js +28 -58
- package/dist/styles.css +55 -55
- package/dist/types/Mode.js +1 -1
- package/dist/types/Shapes.js +1 -1
- package/dist/types/keyboard.js +2 -2
- package/dist/types/tools.js +1 -1
- package/dist/utils/data.js +91 -107
- package/dist/utils/draw.js +116 -146
- package/dist/utils/file.js +69 -119
- package/dist/utils/intersect.js +57 -97
- package/dist/utils/selection.js +12 -12
- package/dist/utils/shapeData.js +33 -51
- package/dist/utils/string.js +10 -16
- package/dist/utils/style.js +1 -1
- package/dist/utils/toolbar.js +26 -38
- package/dist/utils/transform.js +183 -239
- package/package.json +6 -5
- package/Changelog.md +0 -123
package/dist/types/Mode.js
CHANGED
package/dist/types/Shapes.js
CHANGED
package/dist/types/keyboard.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.KeyboardCommand = exports.KeyboardCode = void 0;
|
|
7
|
-
|
|
7
|
+
let KeyboardCode;
|
|
8
8
|
exports.KeyboardCode = KeyboardCode;
|
|
9
9
|
|
|
10
10
|
(function (KeyboardCode) {
|
|
@@ -19,7 +19,7 @@ exports.KeyboardCode = KeyboardCode;
|
|
|
19
19
|
KeyboardCode["Y"] = "y";
|
|
20
20
|
})(KeyboardCode || (exports.KeyboardCode = KeyboardCode = {}));
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
let KeyboardCommand;
|
|
23
23
|
exports.KeyboardCommand = KeyboardCommand;
|
|
24
24
|
|
|
25
25
|
(function (KeyboardCommand) {
|
package/dist/types/tools.js
CHANGED
package/dist/utils/data.js
CHANGED
|
@@ -7,10 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.roundValues = exports.createShape = exports.createPicture = exports.copyShape = exports.cleanShapesBeforeExport = exports.buildDataToExport = exports.addDefaultAndTempShapeProps = void 0;
|
|
9
9
|
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
-
|
|
14
10
|
var _fp = _interopRequireDefault(require("lodash/fp"));
|
|
15
11
|
|
|
16
12
|
var _transform = require("./transform");
|
|
@@ -21,55 +17,47 @@ var _file = require("./file");
|
|
|
21
17
|
|
|
22
18
|
var _tools = require("../constants/tools");
|
|
23
19
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var createPicture = function createPicture(fileOrUrl, maxPictureWidth, maxPictureHeight) {
|
|
29
|
-
return new Promise(function (resolve, reject) {
|
|
30
|
-
var img = new Image();
|
|
31
|
-
|
|
32
|
-
img.onload = function () {
|
|
33
|
-
var _fitContentInsideCont = (0, _transform.fitContentInsideContainer)(img.width, img.height, maxPictureWidth, maxPictureHeight, true),
|
|
34
|
-
_fitContentInsideCont2 = (0, _slicedToArray2["default"])(_fitContentInsideCont, 2),
|
|
35
|
-
width = _fitContentInsideCont2[0],
|
|
36
|
-
height = _fitContentInsideCont2[1];
|
|
20
|
+
const createPicture = (fileOrUrl, maxPictureWidth, maxPictureHeight) => {
|
|
21
|
+
return new Promise((resolve, reject) => {
|
|
22
|
+
const img = new Image();
|
|
37
23
|
|
|
38
|
-
|
|
24
|
+
img.onload = () => {
|
|
25
|
+
const [width, height] = (0, _transform.fitContentInsideContainer)(img.width, img.height, maxPictureWidth, maxPictureHeight, true);
|
|
26
|
+
const pictureShape = {
|
|
39
27
|
toolId: _tools.DEFAULT_SHAPE_PICTURE.id,
|
|
40
28
|
type: _Shapes.ShapeEnum.picture,
|
|
41
|
-
id: _fp
|
|
29
|
+
id: _fp.default.uniqueId("".concat(_Shapes.ShapeEnum.picture, "_")),
|
|
42
30
|
x: (maxPictureWidth - width) / 2,
|
|
43
31
|
y: (maxPictureHeight - height) / 2,
|
|
44
|
-
width
|
|
45
|
-
height
|
|
32
|
+
width,
|
|
33
|
+
height,
|
|
46
34
|
src: fileOrUrl instanceof File ? img.src : fileOrUrl,
|
|
47
|
-
img
|
|
35
|
+
img,
|
|
48
36
|
translation: [0, 0],
|
|
49
37
|
rotation: 0
|
|
50
38
|
};
|
|
51
39
|
resolve(pictureShape);
|
|
52
40
|
};
|
|
53
41
|
|
|
54
|
-
img.onerror =
|
|
42
|
+
img.onerror = () => {
|
|
55
43
|
reject(new Error('Some images could not be loaded'));
|
|
56
44
|
};
|
|
57
45
|
|
|
58
46
|
if (fileOrUrl instanceof File) {
|
|
59
47
|
img.src = URL.createObjectURL(fileOrUrl);
|
|
60
48
|
} else {
|
|
61
|
-
(0, _file.fetchAndStringify)(fileOrUrl).then(
|
|
49
|
+
(0, _file.fetchAndStringify)(fileOrUrl).then(picData => {
|
|
62
50
|
img.src = picData;
|
|
63
|
-
})
|
|
51
|
+
}).catch(() => {
|
|
64
52
|
img.src = ''; // to trigger onerror
|
|
65
53
|
});
|
|
66
54
|
}
|
|
67
55
|
|
|
68
|
-
img.onerror =
|
|
56
|
+
img.onerror = () => {
|
|
69
57
|
reject(new Error('Error while loading the src'));
|
|
70
58
|
};
|
|
71
59
|
|
|
72
|
-
setTimeout(
|
|
60
|
+
setTimeout(() => {
|
|
73
61
|
reject(new Error('Timeout while loading the src'));
|
|
74
62
|
}, 4000);
|
|
75
63
|
});
|
|
@@ -77,7 +65,7 @@ var createPicture = function createPicture(fileOrUrl, maxPictureWidth, maxPictur
|
|
|
77
65
|
|
|
78
66
|
exports.createPicture = createPicture;
|
|
79
67
|
|
|
80
|
-
|
|
68
|
+
const createShape = (ctx, shape, cursorPosition) => {
|
|
81
69
|
var _shape$settings$fontB, _shape$settings, _shape$settings$fontI, _shape$settings2;
|
|
82
70
|
|
|
83
71
|
switch (shape.type) {
|
|
@@ -86,15 +74,15 @@ var createShape = function createShape(ctx, shape, cursorPosition) {
|
|
|
86
74
|
return {
|
|
87
75
|
toolId: shape.id,
|
|
88
76
|
type: _Shapes.ShapeEnum.brush,
|
|
89
|
-
id: _fp
|
|
77
|
+
id: _fp.default.uniqueId("".concat(shape.type, "_")),
|
|
90
78
|
points: [[cursorPosition]],
|
|
91
79
|
translation: [0, 0],
|
|
92
80
|
rotation: 0,
|
|
93
81
|
style: {
|
|
94
|
-
globalAlpha: shape.settings.opacity
|
|
95
|
-
strokeColor: shape.settings.strokeColor
|
|
96
|
-
lineWidth: shape.settings.lineWidth
|
|
97
|
-
lineDash: shape.settings.lineDash
|
|
82
|
+
globalAlpha: shape.settings.opacity.default,
|
|
83
|
+
strokeColor: shape.settings.strokeColor.default,
|
|
84
|
+
lineWidth: shape.settings.lineWidth.default,
|
|
85
|
+
lineDash: shape.settings.lineDash.default
|
|
98
86
|
}
|
|
99
87
|
};
|
|
100
88
|
|
|
@@ -102,16 +90,16 @@ var createShape = function createShape(ctx, shape, cursorPosition) {
|
|
|
102
90
|
return {
|
|
103
91
|
toolId: shape.id,
|
|
104
92
|
type: _Shapes.ShapeEnum.line,
|
|
105
|
-
id: _fp
|
|
93
|
+
id: _fp.default.uniqueId("".concat(shape.type, "_")),
|
|
106
94
|
points: [cursorPosition, cursorPosition],
|
|
107
95
|
translation: [0, 0],
|
|
108
96
|
rotation: 0,
|
|
109
97
|
style: {
|
|
110
|
-
globalAlpha: shape.settings.opacity
|
|
111
|
-
strokeColor: shape.settings.strokeColor
|
|
112
|
-
lineWidth: shape.settings.lineWidth
|
|
113
|
-
lineDash: shape.settings.lineDash
|
|
114
|
-
lineArrow: shape.settings.lineArrow
|
|
98
|
+
globalAlpha: shape.settings.opacity.default,
|
|
99
|
+
strokeColor: shape.settings.strokeColor.default,
|
|
100
|
+
lineWidth: shape.settings.lineWidth.default,
|
|
101
|
+
lineDash: shape.settings.lineDash.default,
|
|
102
|
+
lineArrow: shape.settings.lineArrow.default
|
|
115
103
|
}
|
|
116
104
|
};
|
|
117
105
|
|
|
@@ -119,19 +107,17 @@ var createShape = function createShape(ctx, shape, cursorPosition) {
|
|
|
119
107
|
return {
|
|
120
108
|
toolId: shape.id,
|
|
121
109
|
type: _Shapes.ShapeEnum.polygon,
|
|
122
|
-
id: _fp
|
|
123
|
-
points: _fp
|
|
124
|
-
return cursorPosition;
|
|
125
|
-
}))(shape.settings.pointsCount["default"]),
|
|
110
|
+
id: _fp.default.uniqueId("".concat(shape.type, "_")),
|
|
111
|
+
points: _fp.default.flow(_fp.default.range(0), _fp.default.map(() => cursorPosition))(shape.settings.pointsCount.default),
|
|
126
112
|
translation: [0, 0],
|
|
127
113
|
rotation: 0,
|
|
128
114
|
style: {
|
|
129
|
-
globalAlpha: shape.settings.opacity
|
|
130
|
-
fillColor: shape.settings.fillColor
|
|
131
|
-
strokeColor: shape.settings.strokeColor
|
|
132
|
-
lineWidth: shape.settings.lineWidth
|
|
133
|
-
lineDash: shape.settings.lineDash
|
|
134
|
-
pointsCount: shape.settings.pointsCount
|
|
115
|
+
globalAlpha: shape.settings.opacity.default,
|
|
116
|
+
fillColor: shape.settings.fillColor.default,
|
|
117
|
+
strokeColor: shape.settings.strokeColor.default,
|
|
118
|
+
lineWidth: shape.settings.lineWidth.default,
|
|
119
|
+
lineDash: shape.settings.lineDash.default,
|
|
120
|
+
pointsCount: shape.settings.pointsCount.default
|
|
135
121
|
}
|
|
136
122
|
};
|
|
137
123
|
|
|
@@ -139,19 +125,17 @@ var createShape = function createShape(ctx, shape, cursorPosition) {
|
|
|
139
125
|
return {
|
|
140
126
|
toolId: shape.id,
|
|
141
127
|
type: _Shapes.ShapeEnum.curve,
|
|
142
|
-
id: _fp
|
|
143
|
-
points: _fp
|
|
144
|
-
return cursorPosition;
|
|
145
|
-
}))(shape.settings.pointsCount["default"]),
|
|
128
|
+
id: _fp.default.uniqueId("".concat(shape.type, "_")),
|
|
129
|
+
points: _fp.default.flow(_fp.default.range(0), _fp.default.map(() => cursorPosition))(shape.settings.pointsCount.default),
|
|
146
130
|
translation: [0, 0],
|
|
147
131
|
rotation: 0,
|
|
148
132
|
style: {
|
|
149
|
-
globalAlpha: shape.settings.opacity
|
|
150
|
-
fillColor: shape.settings.fillColor
|
|
151
|
-
strokeColor: shape.settings.strokeColor
|
|
152
|
-
lineWidth: shape.settings.lineWidth
|
|
153
|
-
lineDash: shape.settings.lineDash
|
|
154
|
-
pointsCount: shape.settings.pointsCount
|
|
133
|
+
globalAlpha: shape.settings.opacity.default,
|
|
134
|
+
fillColor: shape.settings.fillColor.default,
|
|
135
|
+
strokeColor: shape.settings.strokeColor.default,
|
|
136
|
+
lineWidth: shape.settings.lineWidth.default,
|
|
137
|
+
lineDash: shape.settings.lineDash.default,
|
|
138
|
+
pointsCount: shape.settings.pointsCount.default
|
|
155
139
|
}
|
|
156
140
|
};
|
|
157
141
|
|
|
@@ -160,7 +144,7 @@ var createShape = function createShape(ctx, shape, cursorPosition) {
|
|
|
160
144
|
return {
|
|
161
145
|
toolId: shape.id,
|
|
162
146
|
type: shape.type,
|
|
163
|
-
id: _fp
|
|
147
|
+
id: _fp.default.uniqueId("".concat(shape.type, "_")),
|
|
164
148
|
x: cursorPosition[0],
|
|
165
149
|
y: cursorPosition[1],
|
|
166
150
|
width: 1,
|
|
@@ -168,33 +152,33 @@ var createShape = function createShape(ctx, shape, cursorPosition) {
|
|
|
168
152
|
translation: [0, 0],
|
|
169
153
|
rotation: 0,
|
|
170
154
|
style: {
|
|
171
|
-
globalAlpha: shape.settings.opacity
|
|
172
|
-
fillColor: shape.settings.fillColor
|
|
173
|
-
strokeColor: shape.settings.strokeColor
|
|
174
|
-
lineWidth: shape.settings.lineWidth
|
|
175
|
-
lineDash: shape.settings.lineDash
|
|
155
|
+
globalAlpha: shape.settings.opacity.default,
|
|
156
|
+
fillColor: shape.settings.fillColor.default,
|
|
157
|
+
strokeColor: shape.settings.strokeColor.default,
|
|
158
|
+
lineWidth: shape.settings.lineWidth.default,
|
|
159
|
+
lineDash: shape.settings.lineDash.default
|
|
176
160
|
}
|
|
177
161
|
};
|
|
178
162
|
|
|
179
163
|
case _Shapes.ShapeEnum.text:
|
|
180
|
-
|
|
181
|
-
|
|
164
|
+
const defaultValue = ['Texte'];
|
|
165
|
+
const fontSize = (0, _transform.calculateTextFontSize)(ctx, defaultValue, 50, (_shape$settings$fontB = (_shape$settings = shape.settings) === null || _shape$settings === void 0 ? void 0 : _shape$settings.fontBold.default) !== null && _shape$settings$fontB !== void 0 ? _shape$settings$fontB : false, (_shape$settings$fontI = (_shape$settings2 = shape.settings) === null || _shape$settings2 === void 0 ? void 0 : _shape$settings2.fontItalic.default) !== null && _shape$settings$fontI !== void 0 ? _shape$settings$fontI : false, shape.settings.fontFamily.default);
|
|
182
166
|
return {
|
|
183
167
|
toolId: shape.id,
|
|
184
168
|
type: _Shapes.ShapeEnum.text,
|
|
185
|
-
id: _fp
|
|
169
|
+
id: _fp.default.uniqueId("".concat(shape.type, "_")),
|
|
186
170
|
x: cursorPosition[0],
|
|
187
171
|
y: cursorPosition[1],
|
|
188
172
|
value: defaultValue,
|
|
189
|
-
fontSize
|
|
173
|
+
fontSize,
|
|
190
174
|
width: 50,
|
|
191
175
|
height: fontSize * (defaultValue.length || 1),
|
|
192
176
|
translation: [0, 0],
|
|
193
177
|
rotation: 0,
|
|
194
178
|
style: {
|
|
195
|
-
globalAlpha: shape.settings.opacity
|
|
196
|
-
strokeColor: shape.settings.strokeColor
|
|
197
|
-
fontFamily: shape.settings.fontFamily
|
|
179
|
+
globalAlpha: shape.settings.opacity.default,
|
|
180
|
+
strokeColor: shape.settings.strokeColor.default,
|
|
181
|
+
fontFamily: shape.settings.fontFamily.default
|
|
198
182
|
}
|
|
199
183
|
};
|
|
200
184
|
|
|
@@ -202,7 +186,7 @@ var createShape = function createShape(ctx, shape, cursorPosition) {
|
|
|
202
186
|
return {
|
|
203
187
|
toolId: shape.id,
|
|
204
188
|
type: _Shapes.ShapeEnum.ellipse,
|
|
205
|
-
id: _fp
|
|
189
|
+
id: _fp.default.uniqueId("".concat(shape.type, "_")),
|
|
206
190
|
x: cursorPosition[0],
|
|
207
191
|
y: cursorPosition[1],
|
|
208
192
|
radiusX: 0,
|
|
@@ -210,11 +194,11 @@ var createShape = function createShape(ctx, shape, cursorPosition) {
|
|
|
210
194
|
translation: [0, 0],
|
|
211
195
|
rotation: 0,
|
|
212
196
|
style: {
|
|
213
|
-
globalAlpha: shape.settings.opacity
|
|
214
|
-
fillColor: shape.settings.fillColor
|
|
215
|
-
strokeColor: shape.settings.strokeColor
|
|
216
|
-
lineWidth: shape.settings.lineWidth
|
|
217
|
-
lineDash: shape.settings.lineDash
|
|
197
|
+
globalAlpha: shape.settings.opacity.default,
|
|
198
|
+
fillColor: shape.settings.fillColor.default,
|
|
199
|
+
strokeColor: shape.settings.strokeColor.default,
|
|
200
|
+
lineWidth: shape.settings.lineWidth.default,
|
|
201
|
+
lineDash: shape.settings.lineDash.default
|
|
218
202
|
}
|
|
219
203
|
};
|
|
220
204
|
|
|
@@ -222,18 +206,18 @@ var createShape = function createShape(ctx, shape, cursorPosition) {
|
|
|
222
206
|
return {
|
|
223
207
|
toolId: shape.id,
|
|
224
208
|
type: _Shapes.ShapeEnum.circle,
|
|
225
|
-
id: _fp
|
|
209
|
+
id: _fp.default.uniqueId("".concat(shape.type, "_")),
|
|
226
210
|
x: cursorPosition[0],
|
|
227
211
|
y: cursorPosition[1],
|
|
228
212
|
radius: 0,
|
|
229
213
|
translation: [0, 0],
|
|
230
214
|
rotation: 0,
|
|
231
215
|
style: {
|
|
232
|
-
globalAlpha: shape.settings.opacity
|
|
233
|
-
fillColor: shape.settings.fillColor
|
|
234
|
-
strokeColor: shape.settings.strokeColor
|
|
235
|
-
lineWidth: shape.settings.lineWidth
|
|
236
|
-
lineDash: shape.settings.lineDash
|
|
216
|
+
globalAlpha: shape.settings.opacity.default,
|
|
217
|
+
fillColor: shape.settings.fillColor.default,
|
|
218
|
+
strokeColor: shape.settings.strokeColor.default,
|
|
219
|
+
lineWidth: shape.settings.lineWidth.default,
|
|
220
|
+
lineDash: shape.settings.lineDash.default
|
|
237
221
|
}
|
|
238
222
|
};
|
|
239
223
|
}
|
|
@@ -241,27 +225,27 @@ var createShape = function createShape(ctx, shape, cursorPosition) {
|
|
|
241
225
|
|
|
242
226
|
exports.createShape = createShape;
|
|
243
227
|
|
|
244
|
-
|
|
245
|
-
return
|
|
246
|
-
id: _fp
|
|
228
|
+
const copyShape = shape => {
|
|
229
|
+
return { ...shape,
|
|
230
|
+
id: _fp.default.uniqueId("".concat(shape.type, "_")),
|
|
247
231
|
translation: [shape.translation[0] + 20, shape.translation[1] + 20]
|
|
248
|
-
}
|
|
232
|
+
};
|
|
249
233
|
};
|
|
250
234
|
|
|
251
235
|
exports.copyShape = copyShape;
|
|
252
236
|
|
|
253
|
-
|
|
254
|
-
|
|
237
|
+
const roundValues = function (prop) {
|
|
238
|
+
let precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
255
239
|
|
|
256
|
-
if (_fp
|
|
240
|
+
if (_fp.default.isArray(prop)) {
|
|
257
241
|
return prop.map(roundValues);
|
|
258
242
|
}
|
|
259
243
|
|
|
260
|
-
if (_fp
|
|
261
|
-
return _fp
|
|
244
|
+
if (_fp.default.isObject(prop)) {
|
|
245
|
+
return _fp.default.mapValues(roundValues, prop);
|
|
262
246
|
}
|
|
263
247
|
|
|
264
|
-
if (_fp
|
|
248
|
+
if (_fp.default.isNumber(prop)) {
|
|
265
249
|
return +prop.toFixed(precision);
|
|
266
250
|
}
|
|
267
251
|
|
|
@@ -270,39 +254,39 @@ var roundValues = function roundValues(prop) {
|
|
|
270
254
|
|
|
271
255
|
exports.roundValues = roundValues;
|
|
272
256
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
return shapes.map(
|
|
257
|
+
const cleanShapesBeforeExport = shapes => {
|
|
258
|
+
const propsToOmit = ['img', 'id'];
|
|
259
|
+
return shapes.map(shape => {
|
|
276
260
|
if (shape.type === _Shapes.ShapeEnum.picture) {
|
|
277
261
|
if (!shape.src.startsWith('http')) {
|
|
278
|
-
return roundValues(_fp
|
|
262
|
+
return roundValues(_fp.default.omit(propsToOmit, { ...shape,
|
|
279
263
|
src: (0, _file.getBase64Image)(shape.img)
|
|
280
|
-
}))
|
|
264
|
+
}));
|
|
281
265
|
}
|
|
282
266
|
}
|
|
283
267
|
|
|
284
|
-
return roundValues(_fp
|
|
268
|
+
return roundValues(_fp.default.omit(propsToOmit, shape));
|
|
285
269
|
});
|
|
286
270
|
};
|
|
287
271
|
|
|
288
272
|
exports.cleanShapesBeforeExport = cleanShapesBeforeExport;
|
|
289
273
|
|
|
290
|
-
|
|
274
|
+
const buildDataToExport = (shapes, width, height) => {
|
|
291
275
|
return {
|
|
292
276
|
shapes: cleanShapesBeforeExport(shapes),
|
|
293
277
|
config: {
|
|
294
|
-
width
|
|
295
|
-
height
|
|
278
|
+
width,
|
|
279
|
+
height
|
|
296
280
|
}
|
|
297
281
|
};
|
|
298
282
|
};
|
|
299
283
|
|
|
300
284
|
exports.buildDataToExport = buildDataToExport;
|
|
301
285
|
|
|
302
|
-
|
|
303
|
-
return
|
|
304
|
-
id: _fp
|
|
305
|
-
}
|
|
286
|
+
const addDefaultAndTempShapeProps = shape => {
|
|
287
|
+
return { ...shape,
|
|
288
|
+
id: _fp.default.uniqueId("".concat(shape.type, "_"))
|
|
289
|
+
};
|
|
306
290
|
};
|
|
307
291
|
|
|
308
292
|
exports.addDefaultAndTempShapeProps = addDefaultAndTempShapeProps;
|