react-design-editor 0.0.50 → 0.0.52

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 (100) hide show
  1. package/dist/react-design-editor.js +7739 -7114
  2. package/dist/react-design-editor.min.js +1 -1
  3. package/dist/react-design-editor.min.js.LICENSE.txt +2 -0
  4. package/lib/Canvas.d.ts +18 -18
  5. package/lib/Canvas.js +172 -172
  6. package/lib/CanvasObject.d.ts +10 -10
  7. package/lib/CanvasObject.js +96 -96
  8. package/lib/constants/code.d.ts +19 -19
  9. package/lib/constants/code.js +22 -22
  10. package/lib/constants/defaults.d.ts +38 -38
  11. package/lib/constants/defaults.js +69 -69
  12. package/lib/constants/index.d.ts +3 -3
  13. package/lib/constants/index.js +26 -26
  14. package/lib/handlers/AlignmentHandler.d.ts +18 -18
  15. package/lib/handlers/AlignmentHandler.js +58 -58
  16. package/lib/handlers/AnimationHandler.d.ts +50 -50
  17. package/lib/handlers/AnimationHandler.js +346 -346
  18. package/lib/handlers/ChartHandler.d.ts +8 -8
  19. package/lib/handlers/ChartHandler.js +8 -8
  20. package/lib/handlers/ContextmenuHandler.d.ts +28 -28
  21. package/lib/handlers/ContextmenuHandler.js +65 -65
  22. package/lib/handlers/CropHandler.d.ts +43 -43
  23. package/lib/handlers/CropHandler.js +261 -261
  24. package/lib/handlers/CustomHandler.d.ts +7 -7
  25. package/lib/handlers/CustomHandler.js +10 -10
  26. package/lib/handlers/DrawingHandler.d.ts +28 -28
  27. package/lib/handlers/DrawingHandler.js +318 -318
  28. package/lib/handlers/ElementHandler.d.ts +80 -80
  29. package/lib/handlers/ElementHandler.js +154 -154
  30. package/lib/handlers/EventHandler.d.ts +170 -170
  31. package/lib/handlers/EventHandler.js +880 -880
  32. package/lib/handlers/FiberHandler.d.ts +6 -6
  33. package/lib/handlers/FiberHandler.js +23 -23
  34. package/lib/handlers/GridHandler.d.ts +19 -19
  35. package/lib/handlers/GridHandler.js +77 -77
  36. package/lib/handlers/GuidelineHandler.d.ts +61 -61
  37. package/lib/handlers/GuidelineHandler.js +315 -315
  38. package/lib/handlers/Handler.d.ts +618 -618
  39. package/lib/handlers/Handler.js +1645 -1645
  40. package/lib/handlers/ImageHandler.d.ts +307 -307
  41. package/lib/handlers/ImageHandler.js +528 -528
  42. package/lib/handlers/InteractionHandler.d.ts +45 -45
  43. package/lib/handlers/InteractionHandler.js +168 -164
  44. package/lib/handlers/LinkHandler.d.ts +115 -115
  45. package/lib/handlers/LinkHandler.js +247 -247
  46. package/lib/handlers/NodeHandler.d.ts +50 -50
  47. package/lib/handlers/NodeHandler.js +274 -274
  48. package/lib/handlers/PortHandler.d.ts +22 -22
  49. package/lib/handlers/PortHandler.js +179 -179
  50. package/lib/handlers/ShortcutHandler.d.ts +119 -119
  51. package/lib/handlers/ShortcutHandler.js +151 -151
  52. package/lib/handlers/TooltipHandler.d.ts +33 -33
  53. package/lib/handlers/TooltipHandler.js +91 -91
  54. package/lib/handlers/TransactionHandler.d.ts +59 -59
  55. package/lib/handlers/TransactionHandler.js +137 -137
  56. package/lib/handlers/WorkareaHandler.d.ts +43 -43
  57. package/lib/handlers/WorkareaHandler.js +354 -354
  58. package/lib/handlers/ZoomHandler.d.ts +48 -48
  59. package/lib/handlers/ZoomHandler.js +143 -143
  60. package/lib/handlers/index.d.ts +23 -23
  61. package/lib/handlers/index.js +48 -48
  62. package/lib/index.d.ts +6 -6
  63. package/lib/index.js +20 -20
  64. package/lib/objects/Arrow.d.ts +2 -2
  65. package/lib/objects/Arrow.js +40 -40
  66. package/lib/objects/Chart.d.ts +10 -10
  67. package/lib/objects/Chart.js +117 -117
  68. package/lib/objects/CirclePort.d.ts +2 -2
  69. package/lib/objects/CirclePort.js +28 -28
  70. package/lib/objects/Cube.d.ts +5 -5
  71. package/lib/objects/Cube.js +71 -71
  72. package/lib/objects/CurvedLink.d.ts +2 -2
  73. package/lib/objects/CurvedLink.js +51 -51
  74. package/lib/objects/Element.d.ts +13 -13
  75. package/lib/objects/Element.js +77 -77
  76. package/lib/objects/Gif.d.ts +3 -3
  77. package/lib/objects/Gif.js +41 -41
  78. package/lib/objects/Iframe.d.ts +9 -9
  79. package/lib/objects/Iframe.js +63 -63
  80. package/lib/objects/Line.d.ts +2 -2
  81. package/lib/objects/Line.js +24 -24
  82. package/lib/objects/Link.d.ts +15 -15
  83. package/lib/objects/Link.js +107 -107
  84. package/lib/objects/Node.d.ts +59 -59
  85. package/lib/objects/Node.js +271 -271
  86. package/lib/objects/OrthogonalLink.d.ts +2 -2
  87. package/lib/objects/OrthogonalLink.js +54 -54
  88. package/lib/objects/Port.d.ts +12 -12
  89. package/lib/objects/Port.js +28 -28
  90. package/lib/objects/Svg.d.ts +12 -12
  91. package/lib/objects/Svg.js +93 -93
  92. package/lib/objects/Video.d.ts +14 -14
  93. package/lib/objects/Video.js +113 -113
  94. package/lib/objects/index.d.ts +15 -15
  95. package/lib/objects/index.js +32 -32
  96. package/lib/utils/ObjectUtil.d.ts +408 -408
  97. package/lib/utils/ObjectUtil.js +13 -13
  98. package/lib/utils/index.d.ts +1 -1
  99. package/lib/utils/index.js +13 -13
  100. package/package.json +1 -1
@@ -21,6 +21,8 @@
21
21
 
22
22
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
23
23
 
24
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
25
+
24
26
  /**
25
27
  * @license
26
28
  * Lodash <https://lodash.com/>
package/lib/Canvas.d.ts CHANGED
@@ -1,18 +1,18 @@
1
- import React from 'react';
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';
7
- import { FabricCanvas } from './utils';
8
- export interface CanvasInstance {
9
- handler: Handler;
10
- canvas: FabricCanvas;
11
- container: HTMLDivElement;
12
- }
13
- export declare type CanvasProps = HandlerOptions & {
14
- responsive?: boolean;
15
- style?: React.CSSProperties;
16
- };
17
- declare const Canvas: React.FC<CanvasProps>;
18
- export default Canvas;
1
+ import React from 'react';
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';
7
+ import { FabricCanvas } from './utils';
8
+ export interface CanvasInstance {
9
+ handler: Handler;
10
+ canvas: FabricCanvas;
11
+ container: HTMLDivElement;
12
+ }
13
+ export declare type CanvasProps = HandlerOptions & {
14
+ responsive?: boolean;
15
+ style?: React.CSSProperties;
16
+ };
17
+ declare const Canvas: React.FC<CanvasProps>;
18
+ export default Canvas;
package/lib/Canvas.js CHANGED
@@ -1,172 +1,172 @@
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 fabric_1 = require("fabric");
26
- const react_1 = __importStar(require("react"));
27
- const resize_observer_polyfill_1 = __importDefault(require("resize-observer-polyfill"));
28
- const uuidv4_1 = require("uuidv4");
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
- class InternalCanvas extends react_1.Component {
36
- constructor() {
37
- super(...arguments);
38
- this.containerRef = react_1.default.createRef();
39
- this.state = {
40
- id: uuidv4_1.uuid(),
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.containerRef.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.container = this.containerRef.current;
81
- this.handler = new Handler_1.default({
82
- id,
83
- width,
84
- height,
85
- editable,
86
- canvas: this.canvas,
87
- container: this.containerRef.current,
88
- canvasOption: mergedCanvasOption,
89
- ...other,
90
- });
91
- if (this.props.responsive) {
92
- this.createObserver();
93
- }
94
- else {
95
- this.handleLoad();
96
- }
97
- }
98
- componentDidUpdate(prevProps) {
99
- if (this.props.width !== prevProps.width || this.props.height !== prevProps.height) {
100
- this.handler.eventHandler.resize(this.props.width, this.props.height);
101
- }
102
- if (this.props.editable !== prevProps.editable) {
103
- this.handler.editable = this.props.editable;
104
- }
105
- if (this.props.responsive !== prevProps.responsive) {
106
- if (!this.props.responsive) {
107
- this.destroyObserver();
108
- }
109
- else {
110
- this.destroyObserver();
111
- this.createObserver();
112
- }
113
- }
114
- if (JSON.stringify(this.props.canvasOption) !== JSON.stringify(prevProps.canvasOption)) {
115
- this.handler.setCanvasOption(this.props.canvasOption);
116
- }
117
- if (JSON.stringify(this.props.keyEvent) !== JSON.stringify(prevProps.keyEvent)) {
118
- this.handler.setKeyEvent(this.props.keyEvent);
119
- }
120
- if (JSON.stringify(this.props.fabricObjects) !== JSON.stringify(prevProps.fabricObjects)) {
121
- this.handler.setFabricObjects(this.props.fabricObjects);
122
- }
123
- if (JSON.stringify(this.props.workareaOption) !== JSON.stringify(prevProps.workareaOption)) {
124
- this.handler.setWorkareaOption(this.props.workareaOption);
125
- }
126
- if (JSON.stringify(this.props.guidelineOption) !== JSON.stringify(prevProps.guidelineOption)) {
127
- this.handler.setGuidelineOption(this.props.guidelineOption);
128
- }
129
- if (JSON.stringify(this.props.objectOption) !== JSON.stringify(prevProps.objectOption)) {
130
- this.handler.setObjectOption(this.props.objectOption);
131
- }
132
- if (JSON.stringify(this.props.gridOption) !== JSON.stringify(prevProps.gridOption)) {
133
- this.handler.setGridOption(this.props.gridOption);
134
- }
135
- if (JSON.stringify(this.props.propertiesToInclude) !== JSON.stringify(prevProps.propertiesToInclude)) {
136
- this.handler.setPropertiesToInclude(this.props.propertiesToInclude);
137
- }
138
- if (JSON.stringify(this.props.activeSelectionOption) !== JSON.stringify(prevProps.activeSelectionOption)) {
139
- this.handler.setActiveSelectionOption(this.props.activeSelectionOption);
140
- }
141
- }
142
- componentWillUnmount() {
143
- this.destroyObserver();
144
- this.handler.destroy();
145
- }
146
- render() {
147
- const { style } = this.props;
148
- const { id } = this.state;
149
- return (react_1.default.createElement("div", { ref: this.containerRef, id: id, className: "rde-canvas", style: { width: '100%', height: '100%', ...style } },
150
- react_1.default.createElement("canvas", { id: `canvas_${id}` })));
151
- }
152
- }
153
- InternalCanvas.defaultProps = {
154
- id: uuidv4_1.uuid(),
155
- editable: true,
156
- zoomEnabled: true,
157
- minZoom: 30,
158
- maxZoom: 300,
159
- responsive: true,
160
- width: 0,
161
- height: 0,
162
- };
163
- const Canvas = react_1.default.forwardRef((props, ref) => {
164
- const canvasRef = react_1.useRef();
165
- react_1.default.useImperativeHandle(ref, () => ({
166
- handler: canvasRef.current.handler,
167
- canvas: canvasRef.current.canvas,
168
- container: canvasRef.current.container,
169
- }));
170
- return react_1.default.createElement(InternalCanvas, Object.assign({ ref: canvasRef }, props));
171
- });
172
- exports.default = Canvas;
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 fabric_1 = require("fabric");
26
+ const react_1 = __importStar(require("react"));
27
+ const resize_observer_polyfill_1 = __importDefault(require("resize-observer-polyfill"));
28
+ const uuidv4_1 = require("uuidv4");
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
+ class InternalCanvas extends react_1.Component {
36
+ constructor() {
37
+ super(...arguments);
38
+ this.containerRef = react_1.default.createRef();
39
+ this.state = {
40
+ id: uuidv4_1.uuid(),
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.containerRef.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: (typeof canvasOption?.selection !== 'undefined' && canvasOption?.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.container = this.containerRef.current;
81
+ this.handler = new Handler_1.default({
82
+ id,
83
+ width,
84
+ height,
85
+ editable,
86
+ canvas: this.canvas,
87
+ container: this.containerRef.current,
88
+ canvasOption: mergedCanvasOption,
89
+ ...other,
90
+ });
91
+ if (this.props.responsive) {
92
+ this.createObserver();
93
+ }
94
+ else {
95
+ this.handleLoad();
96
+ }
97
+ }
98
+ componentDidUpdate(prevProps) {
99
+ if (this.props.width !== prevProps.width || this.props.height !== prevProps.height) {
100
+ this.handler.eventHandler.resize(this.props.width, this.props.height);
101
+ }
102
+ if (this.props.editable !== prevProps.editable) {
103
+ this.handler.editable = this.props.editable;
104
+ }
105
+ if (this.props.responsive !== prevProps.responsive) {
106
+ if (!this.props.responsive) {
107
+ this.destroyObserver();
108
+ }
109
+ else {
110
+ this.destroyObserver();
111
+ this.createObserver();
112
+ }
113
+ }
114
+ if (JSON.stringify(this.props.canvasOption) !== JSON.stringify(prevProps.canvasOption)) {
115
+ this.handler.setCanvasOption(this.props.canvasOption);
116
+ }
117
+ if (JSON.stringify(this.props.keyEvent) !== JSON.stringify(prevProps.keyEvent)) {
118
+ this.handler.setKeyEvent(this.props.keyEvent);
119
+ }
120
+ if (JSON.stringify(this.props.fabricObjects) !== JSON.stringify(prevProps.fabricObjects)) {
121
+ this.handler.setFabricObjects(this.props.fabricObjects);
122
+ }
123
+ if (JSON.stringify(this.props.workareaOption) !== JSON.stringify(prevProps.workareaOption)) {
124
+ this.handler.setWorkareaOption(this.props.workareaOption);
125
+ }
126
+ if (JSON.stringify(this.props.guidelineOption) !== JSON.stringify(prevProps.guidelineOption)) {
127
+ this.handler.setGuidelineOption(this.props.guidelineOption);
128
+ }
129
+ if (JSON.stringify(this.props.objectOption) !== JSON.stringify(prevProps.objectOption)) {
130
+ this.handler.setObjectOption(this.props.objectOption);
131
+ }
132
+ if (JSON.stringify(this.props.gridOption) !== JSON.stringify(prevProps.gridOption)) {
133
+ this.handler.setGridOption(this.props.gridOption);
134
+ }
135
+ if (JSON.stringify(this.props.propertiesToInclude) !== JSON.stringify(prevProps.propertiesToInclude)) {
136
+ this.handler.setPropertiesToInclude(this.props.propertiesToInclude);
137
+ }
138
+ if (JSON.stringify(this.props.activeSelectionOption) !== JSON.stringify(prevProps.activeSelectionOption)) {
139
+ this.handler.setActiveSelectionOption(this.props.activeSelectionOption);
140
+ }
141
+ }
142
+ componentWillUnmount() {
143
+ this.destroyObserver();
144
+ this.handler.destroy();
145
+ }
146
+ render() {
147
+ const { style } = this.props;
148
+ const { id } = this.state;
149
+ return (react_1.default.createElement("div", { ref: this.containerRef, id: id, className: "rde-canvas", style: { width: '100%', height: '100%', ...style } },
150
+ react_1.default.createElement("canvas", { id: `canvas_${id}` })));
151
+ }
152
+ }
153
+ InternalCanvas.defaultProps = {
154
+ id: uuidv4_1.uuid(),
155
+ editable: true,
156
+ zoomEnabled: true,
157
+ minZoom: 30,
158
+ maxZoom: 300,
159
+ responsive: true,
160
+ width: 0,
161
+ height: 0,
162
+ };
163
+ const Canvas = react_1.default.forwardRef((props, ref) => {
164
+ const canvasRef = react_1.useRef();
165
+ react_1.default.useImperativeHandle(ref, () => ({
166
+ handler: canvasRef.current.handler,
167
+ canvas: canvasRef.current.canvas,
168
+ container: canvasRef.current.container,
169
+ }));
170
+ return react_1.default.createElement(InternalCanvas, Object.assign({ ref: canvasRef }, props));
171
+ });
172
+ exports.default = Canvas;
@@ -1,10 +1,10 @@
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
+ 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 +1,96 @@
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
+ "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,19 +1,19 @@
1
- export declare const ESCAPE = "Escape";
2
- export declare const DELETE = "Delete";
3
- export declare const BACKSPACE = "Backspace";
4
- export declare const EQUAL = "Equal";
5
- export declare const MINUS = "Minus";
6
- export declare const KEY_A = "KeyA";
7
- export declare const KEY_Q = "KeyQ";
8
- export declare const KEY_W = "KeyW";
9
- export declare const KEY_C = "KeyC";
10
- export declare const KEY_V = "KeyV";
11
- export declare const KEY_Z = "KeyZ";
12
- export declare const KEY_Y = "KeyY";
13
- export declare const KEY_O = "KeyO";
14
- export declare const KEY_P = "KeyP";
15
- export declare const KEY_X = "KeyX";
16
- export declare const ARROW_UP = "ArrowUp";
17
- export declare const ARROW_DOWN = "ArrowDown";
18
- export declare const ARROW_LEFT = "ArrowLeft";
19
- export declare const ARROW_RIGHT = "ArrowRight";
1
+ export declare const ESCAPE = "Escape";
2
+ export declare const DELETE = "Delete";
3
+ export declare const BACKSPACE = "Backspace";
4
+ export declare const EQUAL = "Equal";
5
+ export declare const MINUS = "Minus";
6
+ export declare const KEY_A = "KeyA";
7
+ export declare const KEY_Q = "KeyQ";
8
+ export declare const KEY_W = "KeyW";
9
+ export declare const KEY_C = "KeyC";
10
+ export declare const KEY_V = "KeyV";
11
+ export declare const KEY_Z = "KeyZ";
12
+ export declare const KEY_Y = "KeyY";
13
+ export declare const KEY_O = "KeyO";
14
+ export declare const KEY_P = "KeyP";
15
+ export declare const KEY_X = "KeyX";
16
+ export declare const ARROW_UP = "ArrowUp";
17
+ export declare const ARROW_DOWN = "ArrowDown";
18
+ export declare const ARROW_LEFT = "ArrowLeft";
19
+ export declare const ARROW_RIGHT = "ArrowRight";