react-design-editor 0.0.35 → 0.0.39

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.
@@ -53,12 +53,3 @@ object-assign
53
53
  * This source code is licensed under the MIT license found in the
54
54
  * LICENSE file in the root directory of this source tree.
55
55
  */
56
-
57
- /** @license React v16.14.0
58
- * react.production.min.js
59
- *
60
- * Copyright (c) Facebook, Inc. and its affiliates.
61
- *
62
- * This source code is licensed under the MIT license found in the
63
- * LICENSE file in the root directory of this source tree.
64
- */
package/lib/Canvas.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
2
  import Handler, { HandlerOptions } from './handlers/Handler';
3
+ import './styles/canvas.less';
4
+ import './styles/contextmenu.less';
5
+ import './styles/fabricjs.less';
6
+ import './styles/tooltip.less';
3
7
  import { FabricCanvas } from './utils';
4
- import '../styles/core/canvas.less';
5
- import '../styles/core/tooltip.less';
6
- import '../styles/core/contextmenu.less';
7
- import '../styles/fabricjs/fabricjs.less';
8
8
  export interface CanvasInstance {
9
9
  handler: Handler;
10
10
  canvas: FabricCanvas;
package/lib/Canvas.js CHANGED
@@ -22,16 +22,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
22
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- const react_1 = __importStar(require("react"));
26
25
  const fabric_1 = require("fabric");
26
+ const react_1 = __importStar(require("react"));
27
27
  const resize_observer_polyfill_1 = __importDefault(require("resize-observer-polyfill"));
28
- const Handler_1 = __importDefault(require("./handlers/Handler"));
29
- const constants_1 = require("./constants");
30
28
  const uuidv4_1 = require("uuidv4");
31
- require("../styles/core/canvas.less");
32
- require("../styles/core/tooltip.less");
33
- require("../styles/core/contextmenu.less");
34
- require("../styles/fabricjs/fabricjs.less");
29
+ const constants_1 = require("./constants");
30
+ const Handler_1 = __importDefault(require("./handlers/Handler"));
31
+ require("./styles/canvas.less");
32
+ require("./styles/contextmenu.less");
33
+ require("./styles/fabricjs.less");
34
+ require("./styles/tooltip.less");
35
35
  class InternalCanvas extends react_1.Component {
36
36
  constructor() {
37
37
  super(...arguments);
@@ -141,7 +141,9 @@ class Handler {
141
141
  return;
142
142
  }
143
143
  if ((activeObject.type === 'svg' && key === 'fill') || key === 'stroke') {
144
+ activeObject.set(key, value);
144
145
  activeObject._objects.forEach(obj => obj.set(key, value));
146
+ activeObject.setCoords();
145
147
  }
146
148
  else {
147
149
  activeObject.set(key, value);
package/lib/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
+ export * from './Canvas';
1
2
  export { default as Canvas } from './Canvas';
2
3
  export { default as CanvasObject } from './CanvasObject';
3
4
  export * from './handlers';
4
- export * from './utils';
5
5
  export * from './objects';
6
+ export * from './utils';
package/lib/index.js CHANGED
@@ -10,10 +10,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
10
  for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./Canvas"), exports);
13
14
  var Canvas_1 = require("./Canvas");
14
15
  Object.defineProperty(exports, "Canvas", { enumerable: true, get: function () { return Canvas_1.default; } });
15
16
  var CanvasObject_1 = require("./CanvasObject");
16
17
  Object.defineProperty(exports, "CanvasObject", { enumerable: true, get: function () { return CanvasObject_1.default; } });
17
18
  __exportStar(require("./handlers"), exports);
18
- __exportStar(require("./utils"), exports);
19
19
  __exportStar(require("./objects"), exports);
20
+ __exportStar(require("./utils"), exports);
@@ -5,20 +5,25 @@ const utils_1 = require("../utils");
5
5
  const Svg = fabric_1.fabric.util.createClass(fabric_1.fabric.Group, {
6
6
  type: 'svg',
7
7
  initialize(option = {}) {
8
- const { svg, loadType } = option;
9
8
  this.callSuper('initialize', [], option);
10
- this.loadSvg(svg, loadType);
9
+ this.loadSvg(option);
11
10
  },
12
11
  addSvgElements(objects, options, path) {
13
12
  const createdObj = fabric_1.fabric.util.groupSVGElements(objects, options, path);
14
13
  this.set(options);
15
14
  if (createdObj.getObjects) {
16
- createdObj.getObjects().forEach(obj => this.add(obj));
15
+ createdObj.getObjects().forEach(obj => {
16
+ this.add(obj);
17
+ obj.set('fill', options.fill);
18
+ obj.set('stroke', options.stroke);
19
+ });
17
20
  }
18
21
  else {
19
22
  createdObj.set({
20
23
  originX: 'center',
21
24
  originY: 'center',
25
+ fill: options.fill,
26
+ stroke: options.stroke,
22
27
  });
23
28
  this.add(createdObj);
24
29
  }
@@ -27,16 +32,17 @@ const Svg = fabric_1.fabric.util.createClass(fabric_1.fabric.Group, {
27
32
  this.canvas.requestRenderAll();
28
33
  }
29
34
  },
30
- loadSvg(svg, loadType) {
35
+ loadSvg(option) {
36
+ const { svg, loadType, fill, stroke } = option;
31
37
  return new Promise(resolve => {
32
38
  if (loadType === 'svg') {
33
39
  fabric_1.fabric.loadSVGFromString(svg, (objects, options) => {
34
- resolve(this.addSvgElements(objects, options, svg));
40
+ resolve(this.addSvgElements(objects, { ...options, fill, stroke }, svg));
35
41
  });
36
42
  }
37
43
  else {
38
44
  fabric_1.fabric.loadSVGFromURL(svg, (objects, options) => {
39
- resolve(this.addSvgElements(objects, options, svg));
45
+ resolve(this.addSvgElements(objects, { ...options, fill, stroke }, svg));
40
46
  });
41
47
  }
42
48
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-design-editor",
3
- "version": "0.0.35",
3
+ "version": "0.0.39",
4
4
  "description": "Design Editor Tools with React.js + ant.design + fabric.js",
5
5
  "main": "dist/react-design-editor.min.js",
6
6
  "typings": "lib/index.d.ts",
@@ -10,10 +10,10 @@
10
10
  ],
11
11
  "scripts": {
12
12
  "test": "echo \"Error: no test specified\" && exit 1",
13
- "build": "npm run clean && webpack -p --config webpack.prod.js && typedoc",
14
- "build:lib": "npm run tsc && webpack -p --config webpack.lib.js",
13
+ "build": "npm run clean && webpack --node-env production --config webpack.prod.js && typedoc",
14
+ "build:lib": "npm run tsc && webpack --node-env production --config webpack.lib.js",
15
15
  "start": "npm install && npm run start:dev",
16
- "start:dev": "webpack-dev-server --config webpack.dev.js --inline",
16
+ "start:dev": "webpack serve --config webpack.dev.js",
17
17
  "ghpages": "npm run build && node scripts/ghpages",
18
18
  "deploy": "npm run build:lib && npm publish",
19
19
  "lint": "npm run tsc",
@@ -40,10 +40,9 @@
40
40
  "homepage": "https://salgum1114.github.io/react-design-editor",
41
41
  "peerDependencies": {
42
42
  "animejs": "^3.0.0",
43
- "fabric": "^3.4.0",
44
- "react": "^16.4.1",
45
- "react-dom": "^16.4.1",
46
- "react-dom-factories": "^1.0.2"
43
+ "fabric": "^3.6.6",
44
+ "react": "^16.14.0",
45
+ "react-dom": "^16.14.0"
47
46
  },
48
47
  "dependencies": {
49
48
  "animejs": "^3.0.0",
@@ -51,7 +50,7 @@
51
50
  "classnames": "^2.2.6",
52
51
  "color": "^3.1.2",
53
52
  "echarts": "^4.7.0",
54
- "fabric": "^4.5.0",
53
+ "fabric": "^3.6.6",
55
54
  "gifler": "^0.1.0",
56
55
  "honeycomb-grid": "^3.1.7",
57
56
  "i18next": "^19.0.0",
@@ -59,12 +58,11 @@
59
58
  "lodash": "^4.17.10",
60
59
  "mediaelement": "^4.2.9",
61
60
  "prop-types": "^15.6.2",
62
- "react": "^16.13.1",
61
+ "react": "^16.14.0",
63
62
  "react-ace": "^8.1.0",
64
63
  "react-color": "^2.14.1",
65
64
  "react-custom-scrollbars": "^4.2.1",
66
- "react-dom": "^16.13.1",
67
- "react-dom-factories": "^1.0.2",
65
+ "react-dom": "^16.14.0",
68
66
  "react-helmet": "^5.2.0",
69
67
  "react-hot-loader": "^4.12.20",
70
68
  "react-json-view": "^1.19.1",
@@ -75,23 +73,26 @@
75
73
  "warning": "^4.0.3"
76
74
  },
77
75
  "devDependencies": {
78
- "@babel/core": "^7.9.0",
79
- "@babel/plugin-proposal-class-properties": "^7.8.3",
80
- "@babel/plugin-proposal-decorators": "^7.8.3",
81
- "@babel/plugin-proposal-object-rest-spread": "^7.9.5",
76
+ "@babel/core": "^7.16.0",
77
+ "@babel/plugin-proposal-class-properties": "^7.16.0",
78
+ "@babel/plugin-proposal-decorators": "^7.16.4",
79
+ "@babel/plugin-proposal-object-rest-spread": "^7.16.0",
80
+ "@babel/plugin-proposal-private-methods": "^7.16.0",
81
+ "@babel/plugin-proposal-private-property-in-object": "^7.16.0",
82
82
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
83
- "@babel/plugin-transform-runtime": "^7.9.0",
84
- "@babel/polyfill": "^7.8.7",
85
- "@babel/preset-env": "^7.9.5",
86
- "@babel/preset-react": "^7.9.4",
87
- "@babel/preset-typescript": "^7.9.0",
83
+ "@babel/plugin-transform-runtime": "^7.16.4",
84
+ "@babel/plugin-transform-typescript": "^7.16.1",
85
+ "@babel/preset-env": "^7.16.4",
86
+ "@babel/preset-react": "^7.16.0",
87
+ "@babel/preset-typescript": "^7.16.0",
88
+ "@hot-loader/react-dom": "^17.0.1",
88
89
  "@types/animejs": "^3.1.0",
89
90
  "@types/color": "^3.0.1",
90
91
  "@types/echarts": "^4.4.6",
91
92
  "@types/fabric": "^4.2.6",
92
93
  "@types/lodash": "^4.14.150",
93
- "@types/react": "^16.9.34",
94
- "@types/react-dom": "^16.9.6",
94
+ "@types/react": "^16.14.21",
95
+ "@types/react-dom": "^16.9.14",
95
96
  "@types/react-helmet": "^5.0.15",
96
97
  "@types/uuid": "^7.0.2",
97
98
  "@types/warning": "^3.0.0",
@@ -100,11 +101,12 @@
100
101
  "babel-loader": "^8.1.0",
101
102
  "babel-plugin-dynamic-import-webpack": "^1.1.0",
102
103
  "babel-plugin-import": "^1.13.0",
104
+ "core-js": "^3.19.1",
103
105
  "css-loader": "^3.5.2",
104
106
  "del": "^5.1.0",
105
- "eslint": "^6.8.0",
106
- "eslint-config-airbnb": "^17.1.0",
107
- "eslint-loader": "^4.0.0",
107
+ "eslint": "^8.3.0",
108
+ "eslint-config-airbnb": "^19.0.0",
109
+ "eslint-loader": "^4.0.2",
108
110
  "eslint-plugin-import": "^2.20.2",
109
111
  "eslint-plugin-jsx-a11y": "^6.2.3",
110
112
  "eslint-plugin-react": "^7.19.0",
@@ -117,15 +119,15 @@
117
119
  "path": "^0.12.7",
118
120
  "serve": "^11.3.0",
119
121
  "style-loader": "^1.1.4",
120
- "terser-webpack-plugin": "^2.3.5",
122
+ "terser-webpack-plugin": "^4.2.3",
121
123
  "tslint": "^6.1.1",
122
124
  "tslint-react": "^5.0.0",
123
125
  "typedoc": "^0.17.4",
124
126
  "typescript": "^3.9.3",
125
127
  "url-loader": "^4.1.0",
126
- "webpack": "^4.43.0",
127
- "webpack-cli": "^3.3.11",
128
- "webpack-dev-server": "^3.10.3",
128
+ "webpack": "^4.46.0",
129
+ "webpack-cli": "^4.9.1",
130
+ "webpack-dev-server": "^3.11.3",
129
131
  "webpack-merge": "^4.2.2",
130
132
  "workbox-webpack-plugin": "^5.1.2"
131
133
  }