react-design-editor 0.0.33 → 0.0.37

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 (95) hide show
  1. package/README.md +37 -33
  2. package/dist/react-design-editor.js +20849 -11309
  3. package/dist/react-design-editor.min.js +1 -1
  4. package/dist/react-design-editor.min.js.LICENSE.txt +3 -10
  5. package/package.json +35 -31
  6. package/lib/Canvas.d.ts +0 -32
  7. package/lib/Canvas.js +0 -162
  8. package/lib/CanvasObject.d.ts +0 -10
  9. package/lib/CanvasObject.js +0 -96
  10. package/lib/constants/defaults.d.ts +0 -37
  11. package/lib/constants/defaults.js +0 -68
  12. package/lib/constants/index.d.ts +0 -2
  13. package/lib/constants/index.js +0 -24
  14. package/lib/handlers/AlignmentHandler.d.ts +0 -18
  15. package/lib/handlers/AlignmentHandler.js +0 -58
  16. package/lib/handlers/AnimationHandler.d.ts +0 -50
  17. package/lib/handlers/AnimationHandler.js +0 -320
  18. package/lib/handlers/ChartHandler.d.ts +0 -8
  19. package/lib/handlers/ChartHandler.js +0 -8
  20. package/lib/handlers/ContextmenuHandler.d.ts +0 -28
  21. package/lib/handlers/ContextmenuHandler.js +0 -65
  22. package/lib/handlers/CropHandler.d.ts +0 -43
  23. package/lib/handlers/CropHandler.js +0 -261
  24. package/lib/handlers/DrawingHandler.d.ts +0 -28
  25. package/lib/handlers/DrawingHandler.js +0 -318
  26. package/lib/handlers/ElementHandler.d.ts +0 -80
  27. package/lib/handlers/ElementHandler.js +0 -154
  28. package/lib/handlers/EventHandler.d.ts +0 -170
  29. package/lib/handlers/EventHandler.js +0 -877
  30. package/lib/handlers/GridHandler.d.ts +0 -19
  31. package/lib/handlers/GridHandler.js +0 -77
  32. package/lib/handlers/GuidelineHandler.d.ts +0 -61
  33. package/lib/handlers/GuidelineHandler.js +0 -314
  34. package/lib/handlers/Handler.d.ts +0 -603
  35. package/lib/handlers/Handler.js +0 -1612
  36. package/lib/handlers/ImageHandler.d.ts +0 -307
  37. package/lib/handlers/ImageHandler.js +0 -529
  38. package/lib/handlers/InteractionHandler.d.ts +0 -45
  39. package/lib/handlers/InteractionHandler.js +0 -159
  40. package/lib/handlers/LinkHandler.d.ts +0 -115
  41. package/lib/handlers/LinkHandler.js +0 -247
  42. package/lib/handlers/NodeHandler.d.ts +0 -50
  43. package/lib/handlers/NodeHandler.js +0 -274
  44. package/lib/handlers/PortHandler.d.ts +0 -22
  45. package/lib/handlers/PortHandler.js +0 -179
  46. package/lib/handlers/ShortcutHandler.d.ts +0 -119
  47. package/lib/handlers/ShortcutHandler.js +0 -150
  48. package/lib/handlers/TooltipHandler.d.ts +0 -33
  49. package/lib/handlers/TooltipHandler.js +0 -91
  50. package/lib/handlers/TransactionHandler.d.ts +0 -59
  51. package/lib/handlers/TransactionHandler.js +0 -139
  52. package/lib/handlers/WorkareaHandler.d.ts +0 -43
  53. package/lib/handlers/WorkareaHandler.js +0 -354
  54. package/lib/handlers/ZoomHandler.d.ts +0 -48
  55. package/lib/handlers/ZoomHandler.js +0 -143
  56. package/lib/handlers/index.d.ts +0 -21
  57. package/lib/handlers/index.js +0 -44
  58. package/lib/index.d.ts +0 -5
  59. package/lib/index.js +0 -19
  60. package/lib/objects/Arrow.d.ts +0 -2
  61. package/lib/objects/Arrow.js +0 -39
  62. package/lib/objects/Chart.d.ts +0 -10
  63. package/lib/objects/Chart.js +0 -123
  64. package/lib/objects/CirclePort.d.ts +0 -2
  65. package/lib/objects/CirclePort.js +0 -28
  66. package/lib/objects/Cube.d.ts +0 -5
  67. package/lib/objects/Cube.js +0 -71
  68. package/lib/objects/CurvedLink.d.ts +0 -2
  69. package/lib/objects/CurvedLink.js +0 -49
  70. package/lib/objects/Element.d.ts +0 -13
  71. package/lib/objects/Element.js +0 -83
  72. package/lib/objects/Gif.d.ts +0 -3
  73. package/lib/objects/Gif.js +0 -38
  74. package/lib/objects/Iframe.d.ts +0 -9
  75. package/lib/objects/Iframe.js +0 -69
  76. package/lib/objects/Line.d.ts +0 -2
  77. package/lib/objects/Line.js +0 -24
  78. package/lib/objects/Link.d.ts +0 -15
  79. package/lib/objects/Link.js +0 -104
  80. package/lib/objects/Node.d.ts +0 -59
  81. package/lib/objects/Node.js +0 -271
  82. package/lib/objects/OrthogonalLink.d.ts +0 -2
  83. package/lib/objects/OrthogonalLink.js +0 -52
  84. package/lib/objects/Port.d.ts +0 -12
  85. package/lib/objects/Port.js +0 -28
  86. package/lib/objects/Svg.d.ts +0 -8
  87. package/lib/objects/Svg.js +0 -59
  88. package/lib/objects/Video.d.ts +0 -14
  89. package/lib/objects/Video.js +0 -119
  90. package/lib/objects/index.d.ts +0 -15
  91. package/lib/objects/index.js +0 -32
  92. package/lib/utils/ObjectUtil.d.ts +0 -400
  93. package/lib/utils/ObjectUtil.js +0 -13
  94. package/lib/utils/index.d.ts +0 -1
  95. package/lib/utils/index.js +0 -13
@@ -25,6 +25,8 @@ object-assign
25
25
 
26
26
  /*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */
27
27
 
28
+ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
29
+
28
30
  /**
29
31
  * @license
30
32
  * Lodash <https://lodash.com/>
@@ -43,7 +45,7 @@ object-assign
43
45
  * LICENSE file in the root directory of this source tree.
44
46
  */
45
47
 
46
- /** @license React v16.13.1
48
+ /** @license React v16.14.0
47
49
  * react-dom.production.min.js
48
50
  *
49
51
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -51,12 +53,3 @@ object-assign
51
53
  * This source code is licensed under the MIT license found in the
52
54
  * LICENSE file in the root directory of this source tree.
53
55
  */
54
-
55
- /** @license React v16.13.1
56
- * react.production.min.js
57
- *
58
- * Copyright (c) Facebook, Inc. and its affiliates.
59
- *
60
- * This source code is licensed under the MIT license found in the
61
- * LICENSE file in the root directory of this source tree.
62
- */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-design-editor",
3
- "version": "0.0.33",
3
+ "version": "0.0.37",
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": "^3.6.3",
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,50 +58,55 @@
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",
71
69
  "resize-observer-polyfill": "^1.5.1",
72
70
  "store": "^2.0.12",
73
71
  "uuid": "^7.0.3",
72
+ "uuidv4": "^6.2.8",
74
73
  "warning": "^4.0.3"
75
74
  },
76
75
  "devDependencies": {
77
- "@babel/core": "^7.9.0",
78
- "@babel/plugin-proposal-class-properties": "^7.8.3",
79
- "@babel/plugin-proposal-decorators": "^7.8.3",
80
- "@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",
81
82
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
82
- "@babel/plugin-transform-runtime": "^7.9.0",
83
- "@babel/polyfill": "^7.8.7",
84
- "@babel/preset-env": "^7.9.5",
85
- "@babel/preset-react": "^7.9.4",
86
- "@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",
87
89
  "@types/animejs": "^3.1.0",
88
90
  "@types/color": "^3.0.1",
89
91
  "@types/echarts": "^4.4.6",
90
- "@types/fabric": "^3.6.3",
92
+ "@types/fabric": "^4.2.6",
91
93
  "@types/lodash": "^4.14.150",
92
- "@types/react": "^16.9.34",
93
- "@types/react-dom": "^16.9.6",
94
+ "@types/react": "^16.14.21",
95
+ "@types/react-dom": "^16.9.14",
94
96
  "@types/react-helmet": "^5.0.15",
95
97
  "@types/uuid": "^7.0.2",
96
98
  "@types/warning": "^3.0.0",
99
+ "@types/webpack-env": "^1.16.0",
97
100
  "babel-eslint": "^10.1.0",
98
101
  "babel-loader": "^8.1.0",
99
102
  "babel-plugin-dynamic-import-webpack": "^1.1.0",
100
103
  "babel-plugin-import": "^1.13.0",
104
+ "core-js": "^3.19.1",
101
105
  "css-loader": "^3.5.2",
102
106
  "del": "^5.1.0",
103
- "eslint": "^6.8.0",
104
- "eslint-config-airbnb": "^17.1.0",
105
- "eslint-loader": "^4.0.0",
107
+ "eslint": "^8.3.0",
108
+ "eslint-config-airbnb": "^19.0.0",
109
+ "eslint-loader": "^4.0.2",
106
110
  "eslint-plugin-import": "^2.20.2",
107
111
  "eslint-plugin-jsx-a11y": "^6.2.3",
108
112
  "eslint-plugin-react": "^7.19.0",
@@ -115,15 +119,15 @@
115
119
  "path": "^0.12.7",
116
120
  "serve": "^11.3.0",
117
121
  "style-loader": "^1.1.4",
118
- "terser-webpack-plugin": "^2.3.5",
122
+ "terser-webpack-plugin": "^4.2.3",
119
123
  "tslint": "^6.1.1",
120
124
  "tslint-react": "^5.0.0",
121
125
  "typedoc": "^0.17.4",
122
126
  "typescript": "^3.9.3",
123
127
  "url-loader": "^4.1.0",
124
- "webpack": "^4.43.0",
125
- "webpack-cli": "^3.3.11",
126
- "webpack-dev-server": "^3.10.3",
128
+ "webpack": "^4.46.0",
129
+ "webpack-cli": "^4.9.1",
130
+ "webpack-dev-server": "^3.11.3",
127
131
  "webpack-merge": "^4.2.2",
128
132
  "workbox-webpack-plugin": "^5.1.2"
129
133
  }
package/lib/Canvas.d.ts DELETED
@@ -1,32 +0,0 @@
1
- import React, { Component } from 'react';
2
- import Handler, { HandlerOptions } from './handlers/Handler';
3
- 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
- export declare type CanvasProps = HandlerOptions & {
9
- responsive?: boolean;
10
- style?: React.CSSProperties;
11
- ref?: React.RefAttributes<Handler>;
12
- };
13
- interface IState {
14
- id: string;
15
- loaded: boolean;
16
- }
17
- declare class Canvas extends Component<CanvasProps, IState> {
18
- handler: Handler;
19
- canvas: FabricCanvas;
20
- container: React.RefObject<HTMLDivElement>;
21
- private resizeObserver;
22
- static defaultProps: CanvasProps;
23
- state: IState;
24
- componentDidMount(): void;
25
- componentDidUpdate(prevProps: CanvasProps): void;
26
- componentWillUnmount(): void;
27
- createObserver: () => void;
28
- destroyObserver: () => void;
29
- handleLoad: () => void;
30
- render(): JSX.Element;
31
- }
32
- export default Canvas;
package/lib/Canvas.js DELETED
@@ -1,162 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- var __importDefault = (this && this.__importDefault) || function (mod) {
22
- return (mod && mod.__esModule) ? mod : { "default": mod };
23
- };
24
- Object.defineProperty(exports, "__esModule", { value: true });
25
- const react_1 = __importStar(require("react"));
26
- const fabric_1 = require("fabric");
27
- const uuid_1 = require("uuid");
28
- const resize_observer_polyfill_1 = __importDefault(require("resize-observer-polyfill"));
29
- const Handler_1 = __importDefault(require("./handlers/Handler"));
30
- const constants_1 = require("./constants");
31
- require("../../styles/core/canvas.less");
32
- require("../../styles/core/tooltip.less");
33
- require("../../styles/core/contextmenu.less");
34
- require("../../styles/fabricjs/fabricjs.less");
35
- class Canvas extends react_1.Component {
36
- constructor() {
37
- super(...arguments);
38
- this.container = react_1.default.createRef();
39
- this.state = {
40
- id: uuid_1.v4(),
41
- loaded: false,
42
- };
43
- this.createObserver = () => {
44
- this.resizeObserver = new resize_observer_polyfill_1.default((entries) => {
45
- const { width = 0, height = 0 } = (entries[0] && entries[0].contentRect) || {};
46
- this.handler.eventHandler.resize(width, height);
47
- if (!this.state.loaded) {
48
- this.handleLoad();
49
- }
50
- });
51
- this.resizeObserver.observe(this.container.current);
52
- };
53
- this.destroyObserver = () => {
54
- if (this.resizeObserver) {
55
- this.resizeObserver.disconnect();
56
- this.resizeObserver = null;
57
- }
58
- };
59
- this.handleLoad = () => {
60
- this.setState({
61
- loaded: true,
62
- }, () => {
63
- if (this.props.onLoad) {
64
- this.props.onLoad(this.handler, this.canvas);
65
- }
66
- });
67
- };
68
- }
69
- componentDidMount() {
70
- const { editable, canvasOption, width, height, responsive, ...other } = this.props;
71
- const { id } = this.state;
72
- const mergedCanvasOption = Object.assign({}, constants_1.defaults.canvasOption, canvasOption, {
73
- width,
74
- height,
75
- selection: editable,
76
- });
77
- this.canvas = new fabric_1.fabric.Canvas(`canvas_${id}`, mergedCanvasOption);
78
- this.canvas.setBackgroundColor(mergedCanvasOption.backgroundColor, this.canvas.renderAll.bind(this.canvas));
79
- this.canvas.renderAll();
80
- this.handler = new Handler_1.default({
81
- id,
82
- width,
83
- height,
84
- editable,
85
- canvas: this.canvas,
86
- container: this.container.current,
87
- canvasOption: mergedCanvasOption,
88
- ...other,
89
- });
90
- if (this.props.responsive) {
91
- this.createObserver();
92
- }
93
- else {
94
- this.handleLoad();
95
- }
96
- }
97
- componentDidUpdate(prevProps) {
98
- if (this.props.width !== prevProps.width || this.props.height !== prevProps.height) {
99
- this.handler.eventHandler.resize(this.props.width, this.props.height);
100
- }
101
- if (this.props.editable !== prevProps.editable) {
102
- this.handler.editable = this.props.editable;
103
- }
104
- if (this.props.responsive !== prevProps.responsive) {
105
- if (!this.props.responsive) {
106
- this.destroyObserver();
107
- }
108
- else {
109
- this.destroyObserver();
110
- this.createObserver();
111
- }
112
- }
113
- if (JSON.stringify(this.props.canvasOption) !== JSON.stringify(prevProps.canvasOption)) {
114
- this.handler.setCanvasOption(this.props.canvasOption);
115
- }
116
- if (JSON.stringify(this.props.keyEvent) !== JSON.stringify(prevProps.keyEvent)) {
117
- this.handler.setKeyEvent(this.props.keyEvent);
118
- }
119
- if (JSON.stringify(this.props.fabricObjects) !== JSON.stringify(prevProps.fabricObjects)) {
120
- this.handler.setFabricObjects(this.props.fabricObjects);
121
- }
122
- if (JSON.stringify(this.props.workareaOption) !== JSON.stringify(prevProps.workareaOption)) {
123
- this.handler.setWorkareaOption(this.props.workareaOption);
124
- }
125
- if (JSON.stringify(this.props.guidelineOption) !== JSON.stringify(prevProps.guidelineOption)) {
126
- this.handler.setGuidelineOption(this.props.guidelineOption);
127
- }
128
- if (JSON.stringify(this.props.objectOption) !== JSON.stringify(prevProps.objectOption)) {
129
- this.handler.setObjectOption(this.props.objectOption);
130
- }
131
- if (JSON.stringify(this.props.gridOption) !== JSON.stringify(prevProps.gridOption)) {
132
- this.handler.setGridOption(this.props.gridOption);
133
- }
134
- if (JSON.stringify(this.props.propertiesToInclude) !== JSON.stringify(prevProps.propertiesToInclude)) {
135
- this.handler.setPropertiesToInclude(this.props.propertiesToInclude);
136
- }
137
- if (JSON.stringify(this.props.activeSelectionOption) !== JSON.stringify(prevProps.activeSelectionOption)) {
138
- this.handler.setActiveSelectionOption(this.props.activeSelectionOption);
139
- }
140
- }
141
- componentWillUnmount() {
142
- this.destroyObserver();
143
- this.handler.destroy();
144
- }
145
- render() {
146
- const { style } = this.props;
147
- const { id } = this.state;
148
- return (react_1.default.createElement("div", { ref: this.container, id: id, className: "rde-canvas", style: { width: '100%', height: '100%', ...style } },
149
- react_1.default.createElement("canvas", { id: `canvas_${id}` })));
150
- }
151
- }
152
- Canvas.defaultProps = {
153
- id: uuid_1.v4(),
154
- editable: true,
155
- zoomEnabled: true,
156
- minZoom: 30,
157
- maxZoom: 300,
158
- responsive: true,
159
- width: 0,
160
- height: 0,
161
- };
162
- exports.default = Canvas;
@@ -1,10 +0,0 @@
1
- import { fabric } from 'fabric';
2
- export interface ObjectSchema {
3
- create: (...option: any) => fabric.Object;
4
- }
5
- export interface CanvasObjectSchema {
6
- [key: string]: ObjectSchema;
7
- }
8
- export declare const createCanvasObject: (objectSchema: CanvasObjectSchema) => CanvasObjectSchema;
9
- declare const CanvasObject: CanvasObjectSchema;
10
- export default CanvasObject;
@@ -1,96 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createCanvasObject = void 0;
7
- const fabric_1 = require("fabric");
8
- const objects_1 = require("./objects");
9
- const Svg_1 = __importDefault(require("./objects/Svg"));
10
- exports.createCanvasObject = (objectSchema) => objectSchema;
11
- const CanvasObject = {
12
- group: {
13
- create: ({ objects, ...option }) => new fabric_1.fabric.Group(objects, option),
14
- },
15
- 'i-text': {
16
- create: ({ text, ...option }) => new fabric_1.fabric.IText(text, option),
17
- },
18
- textbox: {
19
- create: ({ text, ...option }) => new fabric_1.fabric.Textbox(text, option),
20
- },
21
- triangle: {
22
- create: (option) => new fabric_1.fabric.Triangle(option),
23
- },
24
- circle: {
25
- create: (option) => new fabric_1.fabric.Circle(option),
26
- },
27
- rect: {
28
- create: (option) => new fabric_1.fabric.Rect(option),
29
- },
30
- cube: {
31
- create: (option) => new objects_1.Cube(option),
32
- },
33
- image: {
34
- create: ({ element = new Image(), ...option }) => new fabric_1.fabric.Image(element, {
35
- ...option,
36
- crossOrigin: 'anonymous',
37
- }),
38
- },
39
- polygon: {
40
- create: ({ points, ...option }) => new fabric_1.fabric.Polygon(points, {
41
- ...option,
42
- perPixelTargetFind: true,
43
- }),
44
- },
45
- line: {
46
- create: ({ points, ...option }) => new objects_1.Line(points, option),
47
- },
48
- arrow: {
49
- create: ({ points, ...option }) => new objects_1.Arrow(points, option),
50
- },
51
- chart: {
52
- create: (option) => new objects_1.Chart(option.chartOption || {
53
- xAxis: {},
54
- yAxis: {},
55
- series: [
56
- {
57
- type: 'line',
58
- data: [
59
- [0, 1],
60
- [1, 2],
61
- [2, 3],
62
- [3, 4],
63
- ],
64
- },
65
- ],
66
- }, option),
67
- },
68
- element: {
69
- create: ({ code, ...option }) => new objects_1.Element(code, option),
70
- },
71
- iframe: {
72
- create: ({ src, ...option }) => new objects_1.Iframe(src, option),
73
- },
74
- video: {
75
- create: ({ src, file, ...option }) => new objects_1.Video(src || file, option),
76
- },
77
- gif: {
78
- create: (option) => new objects_1.Gif(option),
79
- },
80
- node: {
81
- create: (option) => new objects_1.Node(option),
82
- },
83
- link: {
84
- create: (fromNode, fromPort, toNode, toPort, option) => new objects_1.Link(fromNode, fromPort, toNode, toPort, option),
85
- },
86
- curvedLink: {
87
- create: (fromNode, fromPort, toNode, toPort, option) => new objects_1.CurvedLink(fromNode, fromPort, toNode, toPort, option),
88
- },
89
- orthogonalLink: {
90
- create: (fromNode, fromPort, toNode, toPort, option) => new objects_1.OrthogonalLink(fromNode, fromPort, toNode, toPort, option),
91
- },
92
- svg: {
93
- create: (option) => new Svg_1.default(option),
94
- },
95
- };
96
- exports.default = CanvasObject;
@@ -1,37 +0,0 @@
1
- import { WorkareaObject, FabricObjectOption } from '../utils';
2
- export declare const canvasOption: {
3
- preserveObjectStacking: boolean;
4
- width: number;
5
- height: number;
6
- selection: boolean;
7
- defaultCursor: string;
8
- backgroundColor: string;
9
- };
10
- export declare const keyEvent: {
11
- move: boolean;
12
- all: boolean;
13
- copy: boolean;
14
- paste: boolean;
15
- esc: boolean;
16
- del: boolean;
17
- clipboard: boolean;
18
- transaction: boolean;
19
- zoom: boolean;
20
- cut: boolean;
21
- };
22
- export declare const gridOption: {
23
- enabled: boolean;
24
- grid: number;
25
- snapToGrid: boolean;
26
- lineColor: string;
27
- borderColor: string;
28
- };
29
- export declare const workareaOption: Partial<WorkareaObject>;
30
- export declare const objectOption: Partial<FabricObjectOption>;
31
- export declare const guidelineOption: {
32
- enabled: boolean;
33
- };
34
- export declare const activeSelectionOption: {
35
- hasControls: boolean;
36
- };
37
- export declare const propertiesToInclude: string[];
@@ -1,68 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.propertiesToInclude = exports.activeSelectionOption = exports.guidelineOption = exports.objectOption = exports.workareaOption = exports.gridOption = exports.keyEvent = exports.canvasOption = void 0;
4
- exports.canvasOption = {
5
- preserveObjectStacking: true,
6
- width: 300,
7
- height: 150,
8
- selection: true,
9
- defaultCursor: 'default',
10
- backgroundColor: '#f3f3f3',
11
- };
12
- exports.keyEvent = {
13
- move: true,
14
- all: true,
15
- copy: true,
16
- paste: true,
17
- esc: true,
18
- del: true,
19
- clipboard: false,
20
- transaction: true,
21
- zoom: true,
22
- cut: true,
23
- };
24
- exports.gridOption = {
25
- enabled: false,
26
- grid: 10,
27
- snapToGrid: false,
28
- lineColor: '#ebebeb',
29
- borderColor: '#cccccc',
30
- };
31
- exports.workareaOption = {
32
- width: 600,
33
- height: 400,
34
- workareaWidth: 600,
35
- workareaHeight: 400,
36
- lockScalingX: true,
37
- lockScalingY: true,
38
- scaleX: 1,
39
- scaleY: 1,
40
- backgroundColor: '#fff',
41
- hasBorders: false,
42
- hasControls: false,
43
- selectable: false,
44
- lockMovementX: true,
45
- lockMovementY: true,
46
- hoverCursor: 'default',
47
- name: '',
48
- id: 'workarea',
49
- type: 'image',
50
- layout: 'fixed',
51
- link: {},
52
- tooltip: {
53
- enabled: false,
54
- },
55
- isElement: false,
56
- };
57
- exports.objectOption = {
58
- rotation: 0,
59
- centeredRotation: true,
60
- strokeUniform: true,
61
- };
62
- exports.guidelineOption = {
63
- enabled: true,
64
- };
65
- exports.activeSelectionOption = {
66
- hasControls: true,
67
- };
68
- exports.propertiesToInclude = ['id', 'name', 'locked', 'editable'];
@@ -1,2 +0,0 @@
1
- import * as defaults from './defaults';
2
- export { defaults };
@@ -1,24 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.defaults = void 0;
23
- const defaults = __importStar(require("./defaults"));
24
- exports.defaults = defaults;
@@ -1,18 +0,0 @@
1
- import Handler from './Handler';
2
- declare class AlignmentHandler {
3
- handler: Handler;
4
- constructor(handler: Handler);
5
- /**
6
- * Align left at selection
7
- */
8
- left: () => void;
9
- /**
10
- * Align center at selection
11
- */
12
- center: () => void;
13
- /**
14
- * Align right at selection
15
- */
16
- right: () => void;
17
- }
18
- export default AlignmentHandler;