@yorab/react-paint 0.4.2 → 0.5.0
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 +1 -0
- package/dist/components/App.js +58 -71
- package/dist/components/Canvas.js +9 -9
- package/dist/components/common/Button.js +4 -4
- package/dist/components/common/Loading.js +3 -3
- package/dist/components/common/Modal.js +3 -3
- package/dist/components/common/Panel.js +2 -2
- package/dist/components/common/Snackbar.js +2 -2
- package/dist/components/settings/ColorField.js +9 -9
- package/dist/components/settings/FontFamilyField.js +7 -5
- package/dist/components/settings/LayoutButton.js +1 -1
- package/dist/components/settings/Layouts.js +9 -9
- package/dist/components/settings/LineArrowField.js +8 -6
- package/dist/components/settings/LineTypeField.js +7 -5
- package/dist/components/settings/PointsNumberField.js +19 -29
- package/dist/components/settings/RangeField.js +2 -1
- package/dist/components/settings/SelectField.js +2 -1
- package/dist/components/settings/SettingsBar.js +107 -80
- package/dist/components/toolbox/EditTextBox.js +6 -6
- package/dist/components/toolbox/LoadFileTool.js +5 -3
- package/dist/components/toolbox/MenuGroup.js +31 -40
- package/dist/components/toolbox/PictureUrlInput.js +1 -1
- package/dist/components/toolbox/Tool.js +4 -4
- package/dist/components/toolbox/Toolbar.js +77 -73
- package/dist/components/toolbox/ToolbarGroup.js +22 -26
- package/dist/constants/style.js +3 -1
- package/dist/constants/tools.js +420 -0
- package/dist/hooks/useDrawableCanvas.js +22 -17
- package/dist/styles.css +51 -52
- package/dist/types/Shapes.js +2 -16
- package/dist/types/tools.js +22 -0
- package/dist/utils/data.js +81 -25
- package/dist/utils/style.js +4 -2
- package/dist/utils/toolbar.js +66 -11
- package/dist/utils/transform.js +3 -3
- package/package.json +1 -1
- package/Changelog.md +0 -75
package/README.md
CHANGED
package/dist/components/App.js
CHANGED
|
@@ -19,10 +19,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
19
19
|
|
|
20
20
|
var _react = _interopRequireWildcard(require("react"));
|
|
21
21
|
|
|
22
|
-
var _fp = _interopRequireDefault(require("lodash/fp"));
|
|
23
|
-
|
|
24
|
-
var _Shapes = require("../types/Shapes");
|
|
25
|
-
|
|
26
22
|
var _Canvas = _interopRequireDefault(require("./Canvas"));
|
|
27
23
|
|
|
28
24
|
var _Layouts = _interopRequireDefault(require("./settings/Layouts"));
|
|
@@ -59,6 +55,10 @@ var _useResizeObserver = _interopRequireDefault(require("../hooks/useResizeObser
|
|
|
59
55
|
|
|
60
56
|
var _shapes = require("../constants/shapes");
|
|
61
57
|
|
|
58
|
+
var _toolbar = require("../utils/toolbar");
|
|
59
|
+
|
|
60
|
+
var _tools = require("../constants/tools");
|
|
61
|
+
|
|
62
62
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
63
63
|
|
|
64
64
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -69,49 +69,49 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
69
69
|
|
|
70
70
|
var StyledApp = /*#__PURE__*/(0, _react2.styled)("div")({
|
|
71
71
|
name: "StyledApp",
|
|
72
|
-
"class": "
|
|
72
|
+
"class": "sdhgr8u",
|
|
73
73
|
vars: {
|
|
74
|
-
"
|
|
74
|
+
"sdhgr8u-0": [function (props) {
|
|
75
75
|
return props.toolbarBackgroundColor;
|
|
76
76
|
}],
|
|
77
|
-
"
|
|
77
|
+
"sdhgr8u-1": [function (props) {
|
|
78
78
|
return props.dividerColor;
|
|
79
79
|
}],
|
|
80
|
-
"
|
|
80
|
+
"sdhgr8u-2": [function (props) {
|
|
81
81
|
return props.fontRadius;
|
|
82
82
|
}, "px"],
|
|
83
|
-
"
|
|
83
|
+
"sdhgr8u-3": [function (props) {
|
|
84
84
|
return props.fontDisabledColor;
|
|
85
85
|
}],
|
|
86
|
-
"
|
|
86
|
+
"sdhgr8u-4": [function (props) {
|
|
87
87
|
return props.fontDisabledBackgroundColor;
|
|
88
88
|
}],
|
|
89
|
-
"
|
|
89
|
+
"sdhgr8u-5": [function (props) {
|
|
90
90
|
return props.fontColor;
|
|
91
91
|
}],
|
|
92
|
-
"
|
|
92
|
+
"sdhgr8u-6": [function (props) {
|
|
93
93
|
return props.fontBackgroundColor;
|
|
94
94
|
}],
|
|
95
|
-
"
|
|
95
|
+
"sdhgr8u-7": [function (props) {
|
|
96
96
|
return props.fontSelectedColor;
|
|
97
97
|
}],
|
|
98
|
-
"
|
|
98
|
+
"sdhgr8u-8": [function (props) {
|
|
99
99
|
return props.fontSelectedBackgroundColor;
|
|
100
100
|
}],
|
|
101
|
-
"
|
|
101
|
+
"sdhgr8u-9": [function (props) {
|
|
102
102
|
return props.fontHoverColor;
|
|
103
103
|
}],
|
|
104
|
-
"
|
|
104
|
+
"sdhgr8u-10": [function (props) {
|
|
105
105
|
return props.fontHoverBackgroundColor;
|
|
106
106
|
}],
|
|
107
|
-
"
|
|
107
|
+
"sdhgr8u-11": [function (props) {
|
|
108
108
|
return props.canvasBackgroundColor;
|
|
109
109
|
}],
|
|
110
|
-
"
|
|
110
|
+
"sdhgr8u-12": [function (_ref) {
|
|
111
111
|
var canvasWidth = _ref.canvasWidth;
|
|
112
112
|
return "min(100%, ".concat(canvasWidth, "px)");
|
|
113
113
|
}],
|
|
114
|
-
"
|
|
114
|
+
"sdhgr8u-13": [function (_ref2) {
|
|
115
115
|
var canvasWidth = _ref2.canvasWidth;
|
|
116
116
|
return canvasWidth;
|
|
117
117
|
}, "px"]
|
|
@@ -119,19 +119,18 @@ var StyledApp = /*#__PURE__*/(0, _react2.styled)("div")({
|
|
|
119
119
|
});
|
|
120
120
|
var StyledRow = /*#__PURE__*/(0, _react2.styled)("div")({
|
|
121
121
|
name: "StyledRow",
|
|
122
|
-
"class": "
|
|
122
|
+
"class": "sm24hcl",
|
|
123
123
|
vars: {
|
|
124
|
-
"
|
|
124
|
+
"sm24hcl-1": [function (_ref3) {
|
|
125
125
|
var width = _ref3.width;
|
|
126
126
|
return width;
|
|
127
127
|
}, "px"],
|
|
128
|
-
"
|
|
128
|
+
"sm24hcl-2": [function (_ref4) {
|
|
129
129
|
var aspectRatio = _ref4.aspectRatio;
|
|
130
130
|
return aspectRatio;
|
|
131
131
|
}]
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
|
-
var DEFAULT_TOOLS = [_Shapes.ShapeEnum.brush, _Shapes.ShapeEnum.line, _Shapes.ShapeEnum.polygon, _Shapes.ShapeEnum.curve, _Shapes.ShapeEnum.rect, _Shapes.ShapeEnum.square, _Shapes.ShapeEnum.circle, _Shapes.ShapeEnum.ellipse, _Shapes.ShapeEnum.text, _Shapes.ShapeEnum.picture];
|
|
135
134
|
var DEFAULT_OPTIONS = {
|
|
136
135
|
layersManipulation: true,
|
|
137
136
|
gridVisible: false,
|
|
@@ -139,7 +138,9 @@ var DEFAULT_OPTIONS = {
|
|
|
139
138
|
canShrink: true,
|
|
140
139
|
withExport: true,
|
|
141
140
|
withLoadAndSave: true,
|
|
142
|
-
|
|
141
|
+
withUploadPicture: true,
|
|
142
|
+
withUrlPicture: false,
|
|
143
|
+
availableTools: _tools.DEFAULT_SHAPE_TOOLS,
|
|
143
144
|
uiStyle: {
|
|
144
145
|
toolbarBackgroundColor: 'white',
|
|
145
146
|
dividerColor: '#36418129',
|
|
@@ -183,6 +184,8 @@ var App = function App(_ref5) {
|
|
|
183
184
|
canShrink = _DEFAULT_OPTIONS$opti.canShrink,
|
|
184
185
|
withExport = _DEFAULT_OPTIONS$opti.withExport,
|
|
185
186
|
withLoadAndSave = _DEFAULT_OPTIONS$opti.withLoadAndSave,
|
|
187
|
+
withUploadPicture = _DEFAULT_OPTIONS$opti.withUploadPicture,
|
|
188
|
+
withUrlPicture = _DEFAULT_OPTIONS$opti.withUrlPicture,
|
|
186
189
|
availableToolsFromProps = _DEFAULT_OPTIONS$opti.availableTools;
|
|
187
190
|
|
|
188
191
|
var _DEFAULT_OPTIONS$uiSt = _objectSpread(_objectSpread({}, DEFAULT_OPTIONS.uiStyle), (_options$uiStyle = options === null || options === void 0 ? void 0 : options.uiStyle) !== null && _options$uiStyle !== void 0 ? _options$uiStyle : {}),
|
|
@@ -216,7 +219,7 @@ var App = function App(_ref5) {
|
|
|
216
219
|
canvasSize = _useState2[0],
|
|
217
220
|
setCanvasSize = _useState2[1];
|
|
218
221
|
|
|
219
|
-
var availableTools =
|
|
222
|
+
var availableTools = (0, _toolbar.sanitizeTools)(availableToolsFromProps, withUploadPicture || withUrlPicture);
|
|
220
223
|
|
|
221
224
|
var _useComponent = (0, _useComponent2["default"])({
|
|
222
225
|
disabled: disabled,
|
|
@@ -224,58 +227,42 @@ var App = function App(_ref5) {
|
|
|
224
227
|
}),
|
|
225
228
|
isInsideComponent = _useComponent.isInsideComponent;
|
|
226
229
|
|
|
227
|
-
var _useState3 = (0, _react.useState)(
|
|
228
|
-
style: {
|
|
229
|
-
fillColor: 'transparent',
|
|
230
|
-
strokeColor: 'black',
|
|
231
|
-
globalAlpha: 100,
|
|
232
|
-
lineWidth: 1,
|
|
233
|
-
lineDash: 0,
|
|
234
|
-
lineArrow: 0,
|
|
235
|
-
pointsCount: 3,
|
|
236
|
-
fontFamily: _style.STYLE_FONT_DEFAULT
|
|
237
|
-
}
|
|
238
|
-
}),
|
|
230
|
+
var _useState3 = (0, _react.useState)(false),
|
|
239
231
|
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
240
|
-
|
|
241
|
-
|
|
232
|
+
isLoading = _useState4[0],
|
|
233
|
+
setIsLoading = _useState4[1];
|
|
242
234
|
|
|
243
235
|
var _useState5 = (0, _react.useState)(false),
|
|
244
236
|
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
245
|
-
|
|
246
|
-
|
|
237
|
+
isLayoutPanelShown = _useState6[0],
|
|
238
|
+
setIsLayoutPanelShown = _useState6[1];
|
|
247
239
|
|
|
248
|
-
var _useState7 = (0, _react.useState)(
|
|
240
|
+
var _useState7 = (0, _react.useState)([0, 0]),
|
|
249
241
|
_useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
|
|
250
|
-
|
|
251
|
-
|
|
242
|
+
canvasOffset = _useState8[0],
|
|
243
|
+
setCanvasOffset = _useState8[1];
|
|
252
244
|
|
|
253
|
-
var _useState9 = (0, _react.useState)(
|
|
245
|
+
var _useState9 = (0, _react.useState)(undefined),
|
|
254
246
|
_useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
|
|
255
|
-
|
|
256
|
-
|
|
247
|
+
canvasOffsetStartPosition = _useState10[0],
|
|
248
|
+
setCanvasOffsetStartPosition = _useState10[1];
|
|
257
249
|
|
|
258
|
-
var _useState11 = (0, _react.useState)(
|
|
250
|
+
var _useState11 = (0, _react.useState)(_tools.SELECTION_TOOL),
|
|
259
251
|
_useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
|
|
260
|
-
|
|
261
|
-
|
|
252
|
+
activeTool = _useState12[0],
|
|
253
|
+
setActiveTool = _useState12[1];
|
|
262
254
|
|
|
263
|
-
var _useState13 = (0, _react.useState)(
|
|
264
|
-
_useState14 = (0, _slicedToArray2["default"])(_useState13, 2),
|
|
265
|
-
activeTool = _useState14[0],
|
|
266
|
-
setActiveTool = _useState14[1];
|
|
267
|
-
|
|
268
|
-
var _useState15 = (0, _react.useState)({
|
|
255
|
+
var _useState13 = (0, _react.useState)({
|
|
269
256
|
mode: _Mode.SelectionModeLib["default"]
|
|
270
257
|
}),
|
|
271
|
-
|
|
272
|
-
selectionMode =
|
|
273
|
-
setSelectionMode =
|
|
258
|
+
_useState14 = (0, _slicedToArray2["default"])(_useState13, 2),
|
|
259
|
+
selectionMode = _useState14[0],
|
|
260
|
+
setSelectionMode = _useState14[1];
|
|
274
261
|
|
|
275
|
-
var
|
|
276
|
-
|
|
277
|
-
withGrid =
|
|
278
|
-
setWithGrid =
|
|
262
|
+
var _useState15 = (0, _react.useState)(gridVisible),
|
|
263
|
+
_useState16 = (0, _slicedToArray2["default"])(_useState15, 2),
|
|
264
|
+
withGrid = _useState16[0],
|
|
265
|
+
setWithGrid = _useState16[1];
|
|
279
266
|
|
|
280
267
|
var _useShapes = (0, _useShapes2["default"])(onDataChanged),
|
|
281
268
|
shapesRef = _useShapes.shapesRef,
|
|
@@ -305,22 +292,22 @@ var App = function App(_ref5) {
|
|
|
305
292
|
setActiveTool(tool);
|
|
306
293
|
}, [setSelectedShape]);
|
|
307
294
|
var undoAction = (0, _react.useCallback)(function () {
|
|
308
|
-
selectTool(
|
|
295
|
+
selectTool(_tools.SELECTION_TOOL);
|
|
309
296
|
backwardShape();
|
|
310
297
|
}, [selectTool, backwardShape]);
|
|
311
298
|
var redoAction = (0, _react.useCallback)(function () {
|
|
312
|
-
selectTool(
|
|
299
|
+
selectTool(_tools.SELECTION_TOOL);
|
|
313
300
|
forwardShape();
|
|
314
301
|
}, [selectTool, forwardShape]);
|
|
315
302
|
var clearCanvas = (0, _react.useCallback)(function () {
|
|
316
303
|
var shapesToInit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
317
304
|
var clearHistory = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
318
305
|
clearShapes(shapesToInit, clearHistory);
|
|
319
|
-
selectTool(
|
|
306
|
+
selectTool(_tools.SELECTION_TOOL);
|
|
320
307
|
setCanvasOffset([0, 0]);
|
|
321
308
|
}, [selectTool, clearShapes]);
|
|
322
309
|
var selectShape = (0, _react.useCallback)(function (shape) {
|
|
323
|
-
setActiveTool(
|
|
310
|
+
setActiveTool(_tools.SELECTION_TOOL);
|
|
324
311
|
setSelectedShape(shape);
|
|
325
312
|
}, [setSelectedShape]);
|
|
326
313
|
var pasteShape = (0, _react.useCallback)(function (shape) {
|
|
@@ -584,7 +571,9 @@ var App = function App(_ref5) {
|
|
|
584
571
|
redoAction: redoAction,
|
|
585
572
|
availableTools: availableTools,
|
|
586
573
|
withExport: withExport,
|
|
587
|
-
withLoadAndSave: withLoadAndSave
|
|
574
|
+
withLoadAndSave: withLoadAndSave,
|
|
575
|
+
withUploadPicture: withUploadPicture,
|
|
576
|
+
withUrlPicture: withUrlPicture
|
|
588
577
|
}), /*#__PURE__*/_react["default"].createElement(StyledRow, {
|
|
589
578
|
"data-grow": canGrow,
|
|
590
579
|
width: canvasSize.width,
|
|
@@ -605,7 +594,6 @@ var App = function App(_ref5) {
|
|
|
605
594
|
setSelectedShape: setSelectedShape,
|
|
606
595
|
canvasOffset: canvasOffset,
|
|
607
596
|
setCanvasOffset: setCanvasOffset,
|
|
608
|
-
defaultConf: defaultConf,
|
|
609
597
|
saveShapes: saveShapes,
|
|
610
598
|
ref: canvasRef,
|
|
611
599
|
canvasSize: canvasSize,
|
|
@@ -630,11 +618,10 @@ var App = function App(_ref5) {
|
|
|
630
618
|
})), isEditMode && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_SettingsBar["default"], {
|
|
631
619
|
disabled: disabled,
|
|
632
620
|
activeTool: activeTool,
|
|
621
|
+
availableTools: availableTools,
|
|
633
622
|
selectedShape: selectedShape,
|
|
634
623
|
removeShape: removeShape,
|
|
635
624
|
updateShape: updateShape,
|
|
636
|
-
defaultConf: defaultConf,
|
|
637
|
-
setDefaultConf: setDefaultConf,
|
|
638
625
|
canvas: canvasRef.current,
|
|
639
626
|
layersManipulation: layersManipulation,
|
|
640
627
|
toggleLayoutPanel: function toggleLayoutPanel() {
|
|
@@ -31,6 +31,8 @@ var _useDrawableCanvas2 = _interopRequireDefault(require("../hooks/useDrawableCa
|
|
|
31
31
|
|
|
32
32
|
var _icons = require("../constants/icons");
|
|
33
33
|
|
|
34
|
+
var _tools = require("../types/tools");
|
|
35
|
+
|
|
34
36
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
35
37
|
|
|
36
38
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -57,7 +59,7 @@ var renderSelectionCanvas = function renderSelectionCanvas(selectionCtx, selecti
|
|
|
57
59
|
height = canvasSize.height,
|
|
58
60
|
scaleRatio = canvasSize.scaleRatio;
|
|
59
61
|
selectionCtx.clearRect(0, 0, width, height);
|
|
60
|
-
selectedShape && activeTool !== _Shapes.ShapeEnum.brush && (0, _draw.drawSelection)({
|
|
62
|
+
selectedShape && activeTool.type !== _Shapes.ShapeEnum.brush && (0, _draw.drawSelection)({
|
|
61
63
|
ctx: selectionCtx,
|
|
62
64
|
shape: selectedShape,
|
|
63
65
|
scaleRatio: scaleRatio,
|
|
@@ -71,21 +73,21 @@ var renderSelectionCanvas = function renderSelectionCanvas(selectionCtx, selecti
|
|
|
71
73
|
|
|
72
74
|
var StyledCanvasBox = /*#__PURE__*/(0, _react2.styled)("div")({
|
|
73
75
|
name: "StyledCanvasBox",
|
|
74
|
-
"class": "
|
|
76
|
+
"class": "s14cny8z"
|
|
75
77
|
});
|
|
76
78
|
var StyledCanvasContainer = /*#__PURE__*/(0, _react2.styled)("div")({
|
|
77
79
|
name: "StyledCanvasContainer",
|
|
78
|
-
"class": "
|
|
80
|
+
"class": "s16bxms6"
|
|
79
81
|
});
|
|
80
82
|
var StyledDrawCanvas = /*#__PURE__*/(0, _react2.styled)("canvas")({
|
|
81
83
|
name: "StyledDrawCanvas",
|
|
82
|
-
"class": "
|
|
84
|
+
"class": "spzzsat"
|
|
83
85
|
});
|
|
84
86
|
var StyledSelectionCanvas = /*#__PURE__*/(0, _react2.styled)("canvas")({
|
|
85
87
|
name: "StyledSelectionCanvas",
|
|
86
|
-
"class": "
|
|
88
|
+
"class": "s1egrskk",
|
|
87
89
|
vars: {
|
|
88
|
-
"
|
|
90
|
+
"s1egrskk-0": [function (_ref) {
|
|
89
91
|
var cursor = _ref.cursor;
|
|
90
92
|
return cursor;
|
|
91
93
|
}]
|
|
@@ -110,7 +112,6 @@ var Canvas = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, ref) {
|
|
|
110
112
|
setCanvasOffsetStartPosition = _ref2.setCanvasOffsetStartPosition,
|
|
111
113
|
canvasOffset = _ref2.canvasOffset,
|
|
112
114
|
setCanvasOffset = _ref2.setCanvasOffset,
|
|
113
|
-
defaultConf = _ref2.defaultConf,
|
|
114
115
|
isInsideComponent = _ref2.isInsideComponent,
|
|
115
116
|
selectionMode = _ref2.selectionMode,
|
|
116
117
|
setSelectionMode = _ref2.setSelectionMode,
|
|
@@ -132,7 +133,6 @@ var Canvas = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, ref) {
|
|
|
132
133
|
drawCanvasRef: drawCanvasRef,
|
|
133
134
|
setActiveTool: setActiveTool,
|
|
134
135
|
shapes: shapes,
|
|
135
|
-
defaultConf: defaultConf,
|
|
136
136
|
selectionMode: selectionMode,
|
|
137
137
|
activeTool: activeTool,
|
|
138
138
|
isInsideComponent: isInsideComponent,
|
|
@@ -197,7 +197,7 @@ var Canvas = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, ref) {
|
|
|
197
197
|
width: canvasSize.width,
|
|
198
198
|
height: canvasSize.height,
|
|
199
199
|
"data-grow": canGrow,
|
|
200
|
-
cursor: activeTool !==
|
|
200
|
+
cursor: activeTool.type !== _tools.ActionsEnum.selection && activeTool.type !== _tools.ActionsEnum.move || hoverMode.mode === _Mode.SelectionModeLib.resize ? 'crosshair' : activeTool.type === _tools.ActionsEnum.move || hoverMode.mode === _Mode.SelectionModeLib.translate ? 'move' : hoverMode.mode === _Mode.SelectionModeLib.rotate ? 'grab' : 'default'
|
|
201
201
|
}), isEditMode && selectionMode.mode === _Mode.SelectionModeLib.textedition && (selectedShape === null || selectedShape === void 0 ? void 0 : selectedShape.type) === _Shapes.ShapeEnum.text && /*#__PURE__*/_react["default"].createElement(_EditTextBox["default"], {
|
|
202
202
|
scaleRatio: canvasSize.scaleRatio,
|
|
203
203
|
disabled: disabled,
|
|
@@ -19,19 +19,19 @@ var _excluded = ["hidden", "disabled", "selected", "icon", "children", "classNam
|
|
|
19
19
|
_excluded2 = ["hidden", "disabled", "selected", "icon", "children", "type"];
|
|
20
20
|
var StyledButton = /*#__PURE__*/(0, _react2.styled)("button")({
|
|
21
21
|
name: "StyledButton",
|
|
22
|
-
"class": "
|
|
22
|
+
"class": "sc6yefj"
|
|
23
23
|
});
|
|
24
24
|
var StyledButtonContent = /*#__PURE__*/(0, _react2.styled)("span")({
|
|
25
25
|
name: "StyledButtonContent",
|
|
26
|
-
"class": "
|
|
26
|
+
"class": "s2aizej"
|
|
27
27
|
});
|
|
28
28
|
var StyledIcon = /*#__PURE__*/(0, _react2.styled)("span")({
|
|
29
29
|
name: "StyledIcon",
|
|
30
|
-
"class": "
|
|
30
|
+
"class": "s13rkw3s"
|
|
31
31
|
});
|
|
32
32
|
var StyledChildren = /*#__PURE__*/(0, _react2.styled)("span")({
|
|
33
33
|
name: "StyledChildren",
|
|
34
|
-
"class": "
|
|
34
|
+
"class": "s1qkcrgj"
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
var Button = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
@@ -24,15 +24,15 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
24
24
|
var TRANSITION_DURATION = 300;
|
|
25
25
|
var StyledLoading = /*#__PURE__*/(0, _react.styled)("div")({
|
|
26
26
|
name: "StyledLoading",
|
|
27
|
-
"class": "
|
|
27
|
+
"class": "s15r7ba"
|
|
28
28
|
});
|
|
29
29
|
var StyledLoader = /*#__PURE__*/(0, _react.styled)("div")({
|
|
30
30
|
name: "StyledLoader",
|
|
31
|
-
"class": "
|
|
31
|
+
"class": "s19n4ela"
|
|
32
32
|
});
|
|
33
33
|
var StyledShape = /*#__PURE__*/(0, _react.styled)("div")({
|
|
34
34
|
name: "StyledShape",
|
|
35
|
-
"class": "
|
|
35
|
+
"class": "ssemdwq"
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
var Loading = function Loading(_ref) {
|
|
@@ -15,15 +15,15 @@ var _style = require("../../constants/style");
|
|
|
15
15
|
|
|
16
16
|
var StyledModal = /*#__PURE__*/(0, _react2.styled)("div")({
|
|
17
17
|
name: "StyledModal",
|
|
18
|
-
"class": "
|
|
18
|
+
"class": "s1hezj2d"
|
|
19
19
|
});
|
|
20
20
|
var StyledPanel = /*#__PURE__*/(0, _react2.styled)("div")({
|
|
21
21
|
name: "StyledPanel",
|
|
22
|
-
"class": "
|
|
22
|
+
"class": "spuj31h"
|
|
23
23
|
});
|
|
24
24
|
var StyledMask = /*#__PURE__*/(0, _react2.styled)("div")({
|
|
25
25
|
name: "StyledMask",
|
|
26
|
-
"class": "
|
|
26
|
+
"class": "s1ulcd40"
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
var Modal = function Modal(_ref) {
|
|
@@ -19,11 +19,11 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
19
19
|
|
|
20
20
|
var StyledPanel = /*#__PURE__*/(0, _react2.styled)("div")({
|
|
21
21
|
name: "StyledPanel",
|
|
22
|
-
"class": "
|
|
22
|
+
"class": "s2dsyaf"
|
|
23
23
|
});
|
|
24
24
|
var StyledTitle = /*#__PURE__*/(0, _react2.styled)("h3")({
|
|
25
25
|
name: "StyledTitle",
|
|
26
|
-
"class": "
|
|
26
|
+
"class": "s1f032bv"
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
var Panel = function Panel(_ref) {
|
|
@@ -27,11 +27,11 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
27
27
|
|
|
28
28
|
var StyledSnackbar = /*#__PURE__*/(0, _react2.styled)("div")({
|
|
29
29
|
name: "StyledSnackbar",
|
|
30
|
-
"class": "
|
|
30
|
+
"class": "s1xg1lj6"
|
|
31
31
|
});
|
|
32
32
|
var StyledSnackbarContainer = /*#__PURE__*/(0, _react2.styled)("div")({
|
|
33
33
|
name: "StyledSnackbarContainer",
|
|
34
|
-
"class": "
|
|
34
|
+
"class": "sg1lk71"
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
var Snackbar = function Snackbar(_ref) {
|
|
@@ -21,8 +21,6 @@ var _Button = _interopRequireDefault(require("../common/Button"));
|
|
|
21
21
|
|
|
22
22
|
var _Panel = _interopRequireDefault(require("../common/Panel"));
|
|
23
23
|
|
|
24
|
-
var _style = require("../../constants/style");
|
|
25
|
-
|
|
26
24
|
var _icons = require("../../constants/icons");
|
|
27
25
|
|
|
28
26
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -31,9 +29,9 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
31
29
|
|
|
32
30
|
var StyledColor = /*#__PURE__*/(0, _react2.styled)("div")({
|
|
33
31
|
name: "StyledColor",
|
|
34
|
-
"class": "
|
|
32
|
+
"class": "s1dqu4j7",
|
|
35
33
|
vars: {
|
|
36
|
-
"
|
|
34
|
+
"s1dqu4j7-0": [function (_ref) {
|
|
37
35
|
var color = _ref.color;
|
|
38
36
|
return color;
|
|
39
37
|
}]
|
|
@@ -41,9 +39,9 @@ var StyledColor = /*#__PURE__*/(0, _react2.styled)("div")({
|
|
|
41
39
|
});
|
|
42
40
|
var StyledCustomColor = /*#__PURE__*/(0, _react2.styled)("div")({
|
|
43
41
|
name: "StyledCustomColor",
|
|
44
|
-
"class": "
|
|
42
|
+
"class": "s1j0ldko",
|
|
45
43
|
vars: {
|
|
46
|
-
"
|
|
44
|
+
"s1j0ldko-0": [function (_ref2) {
|
|
47
45
|
var color = _ref2.color;
|
|
48
46
|
return color;
|
|
49
47
|
}]
|
|
@@ -57,6 +55,7 @@ var ColorField = function ColorField(_ref3) {
|
|
|
57
55
|
title = _ref3$title === void 0 ? 'Choisissez une couleur' : _ref3$title,
|
|
58
56
|
_ref3$disabled = _ref3.disabled,
|
|
59
57
|
disabled = _ref3$disabled === void 0 ? false : _ref3$disabled,
|
|
58
|
+
values = _ref3.values,
|
|
60
59
|
field = _ref3.field,
|
|
61
60
|
_ref3$value = _ref3.value,
|
|
62
61
|
value = _ref3$value === void 0 ? '' : _ref3$value,
|
|
@@ -83,6 +82,7 @@ var ColorField = function ColorField(_ref3) {
|
|
|
83
82
|
};
|
|
84
83
|
|
|
85
84
|
var isPanelVisible = selectedSettings === customKey;
|
|
85
|
+
if (_fp["default"].isEmpty(values)) return null;
|
|
86
86
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
87
87
|
selected: isPanelVisible,
|
|
88
88
|
title: title,
|
|
@@ -93,7 +93,7 @@ var ColorField = function ColorField(_ref3) {
|
|
|
93
93
|
})), isPanelVisible && /*#__PURE__*/_react["default"].createElement(_Panel["default"], {
|
|
94
94
|
title: title,
|
|
95
95
|
alignment: "left"
|
|
96
|
-
}, /*#__PURE__*/_react["default"].createElement("div", null,
|
|
96
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, values.map(function (color, index) {
|
|
97
97
|
return /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
98
98
|
title: color,
|
|
99
99
|
key: index,
|
|
@@ -108,11 +108,11 @@ var ColorField = function ColorField(_ref3) {
|
|
|
108
108
|
}), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
109
109
|
type: "color",
|
|
110
110
|
title: "Custom color",
|
|
111
|
-
selected: !_fp["default"].includes(value,
|
|
111
|
+
selected: !_fp["default"].includes(value, values),
|
|
112
112
|
value: value,
|
|
113
113
|
onChange: handleChange
|
|
114
114
|
}, /*#__PURE__*/_react["default"].createElement(StyledCustomColor, {
|
|
115
|
-
color: _fp["default"].includes(value,
|
|
115
|
+
color: _fp["default"].includes(value, values) ? 'var(--font-color)' : value
|
|
116
116
|
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
117
117
|
dangerouslySetInnerHTML: {
|
|
118
118
|
__html: _icons.paletteIcon
|
|
@@ -11,15 +11,15 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
11
11
|
|
|
12
12
|
var _SelectField = _interopRequireDefault(require("./SelectField"));
|
|
13
13
|
|
|
14
|
-
var _style = require("../../constants/style");
|
|
15
|
-
|
|
16
14
|
var _react2 = require("@linaria/react");
|
|
17
15
|
|
|
16
|
+
var _fp = _interopRequireDefault(require("lodash/fp"));
|
|
17
|
+
|
|
18
18
|
var StyledOption = /*#__PURE__*/(0, _react2.styled)("span")({
|
|
19
19
|
name: "StyledOption",
|
|
20
|
-
"class": "
|
|
20
|
+
"class": "s16o63ah",
|
|
21
21
|
vars: {
|
|
22
|
-
"
|
|
22
|
+
"s16o63ah-0": [function (_ref) {
|
|
23
23
|
var family = _ref.family;
|
|
24
24
|
return family;
|
|
25
25
|
}]
|
|
@@ -38,8 +38,10 @@ var FontFamilyField = function FontFamilyField(_ref3) {
|
|
|
38
38
|
setSelectedSettings = _ref3.setSelectedSettings,
|
|
39
39
|
_ref3$disabled = _ref3.disabled,
|
|
40
40
|
disabled = _ref3$disabled === void 0 ? false : _ref3$disabled,
|
|
41
|
+
values = _ref3.values,
|
|
41
42
|
defaultValue = _ref3.defaultValue,
|
|
42
43
|
valueChanged = _ref3.valueChanged;
|
|
44
|
+
if (_fp["default"].isEmpty(values)) return null;
|
|
43
45
|
return /*#__PURE__*/_react["default"].createElement(_SelectField["default"], {
|
|
44
46
|
selectedSettings: selectedSettings,
|
|
45
47
|
setSelectedSettings: setSelectedSettings,
|
|
@@ -47,7 +49,7 @@ var FontFamilyField = function FontFamilyField(_ref3) {
|
|
|
47
49
|
title: "Font",
|
|
48
50
|
disabled: disabled,
|
|
49
51
|
field: "style.fontFamily",
|
|
50
|
-
values:
|
|
52
|
+
values: values,
|
|
51
53
|
defaultValue: defaultValue,
|
|
52
54
|
valueChanged: valueChanged
|
|
53
55
|
});
|
|
@@ -17,7 +17,7 @@ var _Button = _interopRequireDefault(require("../common/Button"));
|
|
|
17
17
|
|
|
18
18
|
var StyleToggleLayoutButton = /*#__PURE__*/(0, _react2.styled)(_Button["default"])({
|
|
19
19
|
name: "StyleToggleLayoutButton",
|
|
20
|
-
"class": "
|
|
20
|
+
"class": "sb1jkk3"
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
var LayoutButton = function LayoutButton(_ref) {
|
|
@@ -33,39 +33,39 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
33
33
|
|
|
34
34
|
var StyledLayouts = /*#__PURE__*/(0, _react2.styled)("div")({
|
|
35
35
|
name: "StyledLayouts",
|
|
36
|
-
"class": "
|
|
36
|
+
"class": "sw61axo"
|
|
37
37
|
});
|
|
38
38
|
var StyledLayout = /*#__PURE__*/(0, _react2.styled)("div")({
|
|
39
39
|
name: "StyledLayout",
|
|
40
|
-
"class": "
|
|
40
|
+
"class": "s1shoasi"
|
|
41
41
|
});
|
|
42
42
|
var StyledVisibleButton = /*#__PURE__*/(0, _react2.styled)(_Button["default"])({
|
|
43
43
|
name: "StyledVisibleButton",
|
|
44
|
-
"class": "
|
|
44
|
+
"class": "s1adt0vs"
|
|
45
45
|
});
|
|
46
46
|
var StyledLockedButton = /*#__PURE__*/(0, _react2.styled)(_Button["default"])({
|
|
47
47
|
name: "StyledLockedButton",
|
|
48
|
-
"class": "
|
|
48
|
+
"class": "svyjq0t"
|
|
49
49
|
});
|
|
50
50
|
var StyledGridButton = /*#__PURE__*/(0, _react2.styled)(_Button["default"])({
|
|
51
51
|
name: "StyledGridButton",
|
|
52
|
-
"class": "
|
|
52
|
+
"class": "s1vztggb"
|
|
53
53
|
});
|
|
54
54
|
var StyledSeparator = /*#__PURE__*/(0, _react2.styled)("div")({
|
|
55
55
|
name: "StyledSeparator",
|
|
56
|
-
"class": "
|
|
56
|
+
"class": "s1fgf9tg"
|
|
57
57
|
});
|
|
58
58
|
var StyledPanelLayouts = /*#__PURE__*/(0, _react2.styled)(_Panel["default"])({
|
|
59
59
|
name: "StyledPanelLayouts",
|
|
60
|
-
"class": "
|
|
60
|
+
"class": "s1rl6big"
|
|
61
61
|
});
|
|
62
62
|
var StyledScrollingContent = /*#__PURE__*/(0, _react2.styled)("div")({
|
|
63
63
|
name: "StyledScrollingContent",
|
|
64
|
-
"class": "
|
|
64
|
+
"class": "sbpkotp"
|
|
65
65
|
});
|
|
66
66
|
var StyledPlaceholder = /*#__PURE__*/(0, _react2.styled)("div")({
|
|
67
67
|
name: "StyledPlaceholder",
|
|
68
|
-
"class": "
|
|
68
|
+
"class": "s12cgrwn"
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
var Layout = function Layout(_ref) {
|