@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.
Files changed (57) hide show
  1. package/README.md +2 -0
  2. package/dist/components/App.js +224 -384
  3. package/dist/components/Canvas.js +104 -114
  4. package/dist/components/common/Button.js +41 -50
  5. package/dist/components/common/Loading.js +21 -33
  6. package/dist/components/common/Modal.js +18 -17
  7. package/dist/components/common/Panel.js +20 -24
  8. package/dist/components/common/Snackbar.js +27 -34
  9. package/dist/components/settings/ColorField.js +59 -68
  10. package/dist/components/settings/DeleteButton.js +10 -9
  11. package/dist/components/settings/FontFamilyField.js +24 -19
  12. package/dist/components/settings/LayoutButton.js +11 -9
  13. package/dist/components/settings/Layouts.js +93 -103
  14. package/dist/components/settings/LineArrowField.js +25 -22
  15. package/dist/components/settings/LineTypeField.js +23 -20
  16. package/dist/components/settings/PointsNumberField.js +14 -13
  17. package/dist/components/settings/RangeField.js +35 -47
  18. package/dist/components/settings/SelectField.js +34 -43
  19. package/dist/components/settings/SettingsBar.js +95 -118
  20. package/dist/components/settings/ToggleField.js +18 -25
  21. package/dist/components/toolbox/EditTextBox.js +53 -42
  22. package/dist/components/toolbox/LoadFileTool.js +19 -21
  23. package/dist/components/toolbox/MenuGroup.js +60 -96
  24. package/dist/components/toolbox/PictureUrlInput.js +33 -62
  25. package/dist/components/toolbox/Tool.js +13 -13
  26. package/dist/components/toolbox/Toolbar.js +74 -106
  27. package/dist/components/toolbox/ToolbarGroup.js +41 -57
  28. package/dist/constants/icons.js +43 -43
  29. package/dist/constants/shapes.js +6 -6
  30. package/dist/constants/snackbar.js +3 -3
  31. package/dist/constants/style.js +13 -13
  32. package/dist/constants/tools.js +80 -80
  33. package/dist/hooks/useComponent.js +12 -19
  34. package/dist/hooks/useDoubleClick.js +12 -12
  35. package/dist/hooks/useDrag.js +24 -32
  36. package/dist/hooks/useDrawableCanvas.js +86 -100
  37. package/dist/hooks/useKeyboard.js +26 -36
  38. package/dist/hooks/useResizeObserver.js +18 -16
  39. package/dist/hooks/useShapes.js +91 -143
  40. package/dist/hooks/useSnackbar.js +28 -58
  41. package/dist/styles.css +55 -55
  42. package/dist/types/Mode.js +1 -1
  43. package/dist/types/Shapes.js +1 -1
  44. package/dist/types/keyboard.js +2 -2
  45. package/dist/types/tools.js +1 -1
  46. package/dist/utils/data.js +91 -107
  47. package/dist/utils/draw.js +116 -146
  48. package/dist/utils/file.js +69 -119
  49. package/dist/utils/intersect.js +57 -97
  50. package/dist/utils/selection.js +12 -12
  51. package/dist/utils/shapeData.js +33 -51
  52. package/dist/utils/string.js +10 -16
  53. package/dist/utils/style.js +1 -1
  54. package/dist/utils/toolbar.js +26 -38
  55. package/dist/utils/transform.js +183 -239
  56. package/package.json +6 -5
  57. package/Changelog.md +0 -123
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.SelectionModeLib = void 0;
7
- var SelectionModeLib;
7
+ let SelectionModeLib;
8
8
  exports.SelectionModeLib = SelectionModeLib;
9
9
 
10
10
  (function (SelectionModeLib) {
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ShapeEnum = void 0;
7
- var ShapeEnum;
7
+ let ShapeEnum;
8
8
  exports.ShapeEnum = ShapeEnum;
9
9
 
10
10
  (function (ShapeEnum) {
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.KeyboardCommand = exports.KeyboardCode = void 0;
7
- var KeyboardCode;
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
- var KeyboardCommand;
22
+ let KeyboardCommand;
23
23
  exports.KeyboardCommand = KeyboardCommand;
24
24
 
25
25
  (function (KeyboardCommand) {
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.ActionsEnum = void 0;
7
7
  // default
8
- var ActionsEnum;
8
+ let ActionsEnum;
9
9
  exports.ActionsEnum = ActionsEnum;
10
10
 
11
11
  (function (ActionsEnum) {
@@ -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
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
25
-
26
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
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
- var pictureShape = {
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["default"].uniqueId("".concat(_Shapes.ShapeEnum.picture, "_")),
29
+ id: _fp.default.uniqueId("".concat(_Shapes.ShapeEnum.picture, "_")),
42
30
  x: (maxPictureWidth - width) / 2,
43
31
  y: (maxPictureHeight - height) / 2,
44
- width: width,
45
- height: height,
32
+ width,
33
+ height,
46
34
  src: fileOrUrl instanceof File ? img.src : fileOrUrl,
47
- img: 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 = function () {
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(function (picData) {
49
+ (0, _file.fetchAndStringify)(fileOrUrl).then(picData => {
62
50
  img.src = picData;
63
- })["catch"](function () {
51
+ }).catch(() => {
64
52
  img.src = ''; // to trigger onerror
65
53
  });
66
54
  }
67
55
 
68
- img.onerror = function () {
56
+ img.onerror = () => {
69
57
  reject(new Error('Error while loading the src'));
70
58
  };
71
59
 
72
- setTimeout(function () {
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
- var createShape = function createShape(ctx, shape, cursorPosition) {
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["default"].uniqueId("".concat(shape.type, "_")),
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["default"],
95
- strokeColor: shape.settings.strokeColor["default"],
96
- lineWidth: shape.settings.lineWidth["default"],
97
- lineDash: shape.settings.lineDash["default"]
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["default"].uniqueId("".concat(shape.type, "_")),
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["default"],
111
- strokeColor: shape.settings.strokeColor["default"],
112
- lineWidth: shape.settings.lineWidth["default"],
113
- lineDash: shape.settings.lineDash["default"],
114
- lineArrow: shape.settings.lineArrow["default"]
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["default"].uniqueId("".concat(shape.type, "_")),
123
- points: _fp["default"].flow(_fp["default"].range(0), _fp["default"].map(function () {
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["default"],
130
- fillColor: shape.settings.fillColor["default"],
131
- strokeColor: shape.settings.strokeColor["default"],
132
- lineWidth: shape.settings.lineWidth["default"],
133
- lineDash: shape.settings.lineDash["default"],
134
- pointsCount: shape.settings.pointsCount["default"]
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["default"].uniqueId("".concat(shape.type, "_")),
143
- points: _fp["default"].flow(_fp["default"].range(0), _fp["default"].map(function () {
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["default"],
150
- fillColor: shape.settings.fillColor["default"],
151
- strokeColor: shape.settings.strokeColor["default"],
152
- lineWidth: shape.settings.lineWidth["default"],
153
- lineDash: shape.settings.lineDash["default"],
154
- pointsCount: shape.settings.pointsCount["default"]
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["default"].uniqueId("".concat(shape.type, "_")),
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["default"],
172
- fillColor: shape.settings.fillColor["default"],
173
- strokeColor: shape.settings.strokeColor["default"],
174
- lineWidth: shape.settings.lineWidth["default"],
175
- lineDash: shape.settings.lineDash["default"]
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
- var defaultValue = ['Texte'];
181
- var 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"]);
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["default"].uniqueId("".concat(shape.type, "_")),
169
+ id: _fp.default.uniqueId("".concat(shape.type, "_")),
186
170
  x: cursorPosition[0],
187
171
  y: cursorPosition[1],
188
172
  value: defaultValue,
189
- fontSize: 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["default"],
196
- strokeColor: shape.settings.strokeColor["default"],
197
- fontFamily: shape.settings.fontFamily["default"]
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["default"].uniqueId("".concat(shape.type, "_")),
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["default"],
214
- fillColor: shape.settings.fillColor["default"],
215
- strokeColor: shape.settings.strokeColor["default"],
216
- lineWidth: shape.settings.lineWidth["default"],
217
- lineDash: shape.settings.lineDash["default"]
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["default"].uniqueId("".concat(shape.type, "_")),
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["default"],
233
- fillColor: shape.settings.fillColor["default"],
234
- strokeColor: shape.settings.strokeColor["default"],
235
- lineWidth: shape.settings.lineWidth["default"],
236
- lineDash: shape.settings.lineDash["default"]
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
- var copyShape = function copyShape(shape) {
245
- return _objectSpread(_objectSpread({}, shape), {}, {
246
- id: _fp["default"].uniqueId("".concat(shape.type, "_")),
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
- var roundValues = function roundValues(prop) {
254
- var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
237
+ const roundValues = function (prop) {
238
+ let precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
255
239
 
256
- if (_fp["default"].isArray(prop)) {
240
+ if (_fp.default.isArray(prop)) {
257
241
  return prop.map(roundValues);
258
242
  }
259
243
 
260
- if (_fp["default"].isObject(prop)) {
261
- return _fp["default"].mapValues(roundValues, prop);
244
+ if (_fp.default.isObject(prop)) {
245
+ return _fp.default.mapValues(roundValues, prop);
262
246
  }
263
247
 
264
- if (_fp["default"].isNumber(prop)) {
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
- var cleanShapesBeforeExport = function cleanShapesBeforeExport(shapes) {
274
- var propsToOmit = ['img', 'id'];
275
- return shapes.map(function (shape) {
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["default"].omit(propsToOmit, _objectSpread(_objectSpread({}, shape), {}, {
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["default"].omit(propsToOmit, shape));
268
+ return roundValues(_fp.default.omit(propsToOmit, shape));
285
269
  });
286
270
  };
287
271
 
288
272
  exports.cleanShapesBeforeExport = cleanShapesBeforeExport;
289
273
 
290
- var buildDataToExport = function buildDataToExport(shapes, width, height) {
274
+ const buildDataToExport = (shapes, width, height) => {
291
275
  return {
292
276
  shapes: cleanShapesBeforeExport(shapes),
293
277
  config: {
294
- width: width,
295
- height: height
278
+ width,
279
+ height
296
280
  }
297
281
  };
298
282
  };
299
283
 
300
284
  exports.buildDataToExport = buildDataToExport;
301
285
 
302
- var addDefaultAndTempShapeProps = function addDefaultAndTempShapeProps(shape) {
303
- return _objectSpread(_objectSpread({}, shape), {}, {
304
- id: _fp["default"].uniqueId("".concat(shape.type, "_"))
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;