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
@@ -1,154 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class ElementHandler {
4
- constructor(handler) {
5
- /**
6
- * Set element by id
7
- * @param {string} id
8
- * @param {*} source
9
- * @returns {void}
10
- */
11
- this.setById = (id, source) => {
12
- const obj = this.handler.findById(id);
13
- if (!obj) {
14
- return;
15
- }
16
- this.set(obj, source);
17
- };
18
- /**
19
- * Set element
20
- * @param {ElementObjectType} obj
21
- * @param {*} source
22
- */
23
- this.set = (obj, source) => {
24
- obj.setSource(source);
25
- };
26
- /**
27
- * Find element by id with type
28
- * @param {string} id
29
- * @param {ElementType} [type='container']
30
- * @returns
31
- */
32
- this.findById = (id, type = 'container') => {
33
- return document.getElementById(`${id}_${type}`);
34
- };
35
- /**
36
- * Remove element
37
- * @param {HTMLElement} el
38
- * @returns
39
- */
40
- this.remove = (el) => {
41
- if (!el) {
42
- return;
43
- }
44
- this.handler.container.removeChild(el);
45
- };
46
- /**
47
- * Remove element by id
48
- * @param {string} id
49
- */
50
- this.removeById = (id) => {
51
- const el = this.findById(id);
52
- const scriptEl = this.findById(id, 'script');
53
- const styleEl = this.findById(id, 'style');
54
- if (el) {
55
- if (el.remove) {
56
- el.remove();
57
- }
58
- else {
59
- this.remove(el);
60
- }
61
- }
62
- if (scriptEl) {
63
- if (scriptEl.remove) {
64
- scriptEl.remove();
65
- }
66
- else {
67
- document.head.removeChild(scriptEl);
68
- }
69
- }
70
- if (styleEl) {
71
- if (styleEl.remove) {
72
- styleEl.remove();
73
- }
74
- else {
75
- document.head.removeChild(styleEl);
76
- }
77
- }
78
- };
79
- /**
80
- * Remove element by ids
81
- * @param {string[]} ids
82
- */
83
- this.removeByIds = (ids) => {
84
- ids.forEach(id => {
85
- this.removeById(id);
86
- });
87
- };
88
- /**
89
- * Set position
90
- * @param {HTMLElement} el
91
- * @param {number} left
92
- * @param {number} top
93
- * @returns
94
- */
95
- this.setPosition = (el, obj) => {
96
- if (!el) {
97
- return;
98
- }
99
- obj.setCoords();
100
- const zoom = this.handler.canvas.getZoom();
101
- const { scaleX, scaleY, width, height } = obj;
102
- const { left, top } = obj.getBoundingRect(false);
103
- const padLeft = ((width * scaleX * zoom) - width) / 2;
104
- const padTop = ((height * scaleY * zoom) - height) / 2;
105
- el.style.left = `${left + padLeft}px`;
106
- el.style.top = `${top + padTop}px`;
107
- };
108
- this.setPositionByOrigin = (el, obj, left, top) => {
109
- if (!el) {
110
- return;
111
- }
112
- obj.setCoords();
113
- const zoom = this.handler.canvas.getZoom();
114
- const { scaleX, scaleY, width, height } = obj;
115
- const padLeft = ((width * scaleX * zoom) - width) / 2;
116
- const padTop = ((height * scaleY * zoom) - height) / 2;
117
- el.style.left = `${left + padLeft}px`;
118
- el.style.top = `${top + padTop}px`;
119
- };
120
- /**
121
- * Set size
122
- * @param {HTMLElement} el
123
- * @param {number} width
124
- * @param {number} height
125
- * @returns
126
- */
127
- this.setSize = (el, obj) => {
128
- if (!el) {
129
- return;
130
- }
131
- const { width, height } = obj;
132
- el.style.width = `${width}px`;
133
- el.style.height = `${height}px`;
134
- };
135
- /**
136
- * Set scale or angle
137
- * @param {HTMLElement} el
138
- * @param {number} scaleX
139
- * @param {number} scaleY
140
- * @param {number} angle
141
- * @returns
142
- */
143
- this.setScaleOrAngle = (el, obj) => {
144
- if (!el) {
145
- return;
146
- }
147
- const zoom = this.handler.canvas.getZoom();
148
- const { scaleX, scaleY, angle } = obj;
149
- el.style.transform = `rotate(${angle}deg) scale(${scaleX * zoom}, ${scaleY * zoom})`;
150
- };
151
- this.handler = handler;
152
- }
153
- }
154
- exports.default = ElementHandler;
@@ -1,170 +0,0 @@
1
- import Handler from './Handler';
2
- import { FabricEvent } from '../utils';
3
- /**
4
- * Event Handler Class
5
- * @author salgum1114
6
- * @class EventHandler
7
- */
8
- declare class EventHandler {
9
- handler: Handler;
10
- keyCode: number;
11
- panning: boolean;
12
- constructor(handler: Handler);
13
- /**
14
- * Attch event on document
15
- *
16
- */
17
- initialize(): void;
18
- /**
19
- * Detach event on document
20
- *
21
- */
22
- destroy: () => void;
23
- /**
24
- * Individual object event
25
- *
26
- */
27
- object: {
28
- /**
29
- * Mouse down event on object
30
- * @param {FabricEvent} opt
31
- */
32
- mousedown: (opt: FabricEvent) => void;
33
- /**
34
- * Mouse double click event on object
35
- * @param {FabricEvent} opt
36
- */
37
- mousedblclick: (opt: FabricEvent) => void;
38
- };
39
- /**
40
- * Modified event object
41
- *
42
- * @param {FabricEvent} opt
43
- * @returns
44
- */
45
- modified: (opt: FabricEvent) => void;
46
- /**
47
- * Moving event object
48
- *
49
- * @param {FabricEvent} opt
50
- * @returns
51
- */
52
- moving: (opt: FabricEvent) => void;
53
- /**
54
- * Moved event object
55
- *
56
- * @param {FabricEvent} opt
57
- */
58
- moved: (opt: FabricEvent) => void;
59
- /**
60
- * Scaling event object
61
- *
62
- * @param {FabricEvent} opt
63
- */
64
- scaling: (opt: FabricEvent) => void;
65
- /**
66
- * Scaled event object
67
- *
68
- * @param {FabricEvent} opt
69
- */
70
- scaled: (_opt: FabricEvent) => void;
71
- /**
72
- * Rotating event object
73
- *
74
- * @param {FabricEvent} opt
75
- */
76
- rotating: (opt: FabricEvent) => void;
77
- /**
78
- * Rotated event object
79
- *
80
- * @param {FabricEvent} opt
81
- */
82
- rotated: (_opt: FabricEvent) => void;
83
- /**
84
- * Moing object at keyboard arrow key down event
85
- *
86
- * @param {KeyboardEvent} e
87
- * @returns
88
- */
89
- arrowmoving: (e: KeyboardEvent) => boolean;
90
- /**
91
- * Zoom at mouse wheel event
92
- *
93
- * @param {FabricEvent<WheelEvent>} opt
94
- * @returns
95
- */
96
- mousewheel: (opt: FabricEvent) => void;
97
- /**
98
- * Mouse down event on object
99
- *
100
- * @param {FabricEvent<MouseEvent>} opt
101
- * @returns
102
- */
103
- mousedown: (opt: FabricEvent) => void;
104
- /**
105
- * Mouse move event on canvas
106
- *
107
- * @param {FabricEvent<MouseEvent>} opt
108
- * @returns
109
- */
110
- mousemove: (opt: FabricEvent) => void;
111
- /**
112
- * Mouse up event on canvas
113
- *
114
- * @param {FabricEvent<MouseEvent>} opt
115
- * @returns
116
- */
117
- mouseup: (opt: FabricEvent) => void;
118
- /**
119
- * Mouse out event on canvas
120
- *
121
- * @param {FabricEvent<MouseEvent>} opt
122
- */
123
- mouseout: (opt: FabricEvent) => void;
124
- /**
125
- * Selection event event on canvas
126
- *
127
- * @param {FabricEvent} opt
128
- */
129
- selection: (opt: FabricEvent) => void;
130
- /**
131
- * Called resize event on canvas
132
- *
133
- * @param {number} nextWidth
134
- * @param {number} nextHeight
135
- * @returns
136
- */
137
- resize: (nextWidth: number, nextHeight: number) => void;
138
- /**
139
- * Paste event on canvas
140
- *
141
- * @param {ClipboardEvent} e
142
- * @returns
143
- */
144
- paste: (e: ClipboardEvent) => boolean;
145
- /**
146
- * Keydown event on document
147
- *
148
- * @param {KeyboardEvent} e
149
- */
150
- keydown: (e: KeyboardEvent) => void;
151
- /**
152
- * Key up event on canvas
153
- *
154
- * @param {KeyboardEvent} _e
155
- */
156
- keyup: (e: KeyboardEvent) => void;
157
- /**
158
- * Context menu event on canvas
159
- *
160
- * @param {MouseEvent} e
161
- */
162
- contextmenu: (e: MouseEvent) => void;
163
- /**
164
- * Mouse down event on canvas
165
- *
166
- * @param {MouseEvent} _e
167
- */
168
- onmousedown: (_e: MouseEvent) => void;
169
- }
170
- export default EventHandler;