mce 0.1.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.
Files changed (114) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +126 -0
  3. package/dist/components/Auxiliary.vue.d.ts +3 -0
  4. package/dist/components/Bottombar.vue.d.ts +13 -0
  5. package/dist/components/ContextMenu.vue.d.ts +25 -0
  6. package/dist/components/Drawboard.vue.d.ts +58 -0
  7. package/dist/components/Drawing.vue.d.ts +3 -0
  8. package/dist/components/Floatbar.vue.d.ts +54 -0
  9. package/dist/components/Frame.vue.d.ts +11 -0
  10. package/dist/components/Frames.vue.d.ts +3 -0
  11. package/dist/components/GoBackSelectedArea.vue.d.ts +3 -0
  12. package/dist/components/Hover.vue.d.ts +3 -0
  13. package/dist/components/Rulers.vue.d.ts +8 -0
  14. package/dist/components/Scrollbars.vue.d.ts +12 -0
  15. package/dist/components/Selector.vue.d.ts +197 -0
  16. package/dist/components/Starter.vue.d.ts +3 -0
  17. package/dist/components/Statusbar.vue.d.ts +3 -0
  18. package/dist/components/TextEditor.vue.d.ts +6 -0
  19. package/dist/components/shared/Dialog.vue.d.ts +58 -0
  20. package/dist/components/shared/Menu.vue.d.ts +71 -0
  21. package/dist/components/shared/Overlay.vue.d.ts +64 -0
  22. package/dist/components/shared/Ruler.vue.d.ts +17 -0
  23. package/dist/components/shared/Scrollbar.vue.d.ts +21 -0
  24. package/dist/components/shared/Tooltip.vue.d.ts +71 -0
  25. package/dist/components/shared/Transformable.vue.d.ts +79 -0
  26. package/dist/composables/editor.d.ts +3 -0
  27. package/dist/composables/index.d.ts +4 -0
  28. package/dist/composables/menu.d.ts +7 -0
  29. package/dist/composables/overlay.d.ts +60 -0
  30. package/dist/composables/strategy.d.ts +40 -0
  31. package/dist/editor.d.ts +29 -0
  32. package/dist/index.css +1 -0
  33. package/dist/index.d.ts +12 -0
  34. package/dist/index.js +5815 -0
  35. package/dist/indexeddb/IndexeddbProvider.d.ts +31 -0
  36. package/dist/indexeddb/index.d.ts +1 -0
  37. package/dist/indexeddb/indexeddb.d.ts +23 -0
  38. package/dist/models/Doc.d.ts +57 -0
  39. package/dist/models/Model.d.ts +32 -0
  40. package/dist/models/Workspace.d.ts +17 -0
  41. package/dist/models/index.d.ts +3 -0
  42. package/dist/plugins/0.command.d.ts +27 -0
  43. package/dist/plugins/0.config/base.d.ts +30 -0
  44. package/dist/plugins/0.config.d.ts +16 -0
  45. package/dist/plugins/0.context.d.ts +32 -0
  46. package/dist/plugins/0.element.d.ts +14 -0
  47. package/dist/plugins/0.font.d.ts +18 -0
  48. package/dist/plugins/0.i18n.d.ts +13 -0
  49. package/dist/plugins/1.frame.d.ts +24 -0
  50. package/dist/plugins/1.hotkey.d.ts +39 -0
  51. package/dist/plugins/1.upload.d.ts +13 -0
  52. package/dist/plugins/2.box.d.ts +20 -0
  53. package/dist/plugins/2.exporter/0.json.d.ts +10 -0
  54. package/dist/plugins/2.exporter/image.d.ts +11 -0
  55. package/dist/plugins/2.exporter/pdf.d.ts +9 -0
  56. package/dist/plugins/2.exporter/pptx.d.ts +9 -0
  57. package/dist/plugins/2.exporter/video.d.ts +10 -0
  58. package/dist/plugins/2.exporter.d.ts +27 -0
  59. package/dist/plugins/2.loader/0.url.d.ts +2 -0
  60. package/dist/plugins/2.loader/image.d.ts +2 -0
  61. package/dist/plugins/2.loader/json.d.ts +2 -0
  62. package/dist/plugins/2.loader/pptx.d.ts +2 -0
  63. package/dist/plugins/2.loader/txt.d.ts +2 -0
  64. package/dist/plugins/2.loader.d.ts +23 -0
  65. package/dist/plugins/3.view.d.ts +12 -0
  66. package/dist/plugins/4.0.text.d.ts +11 -0
  67. package/dist/plugins/4.1.lock.d.ts +20 -0
  68. package/dist/plugins/4.2.element.d.ts +45 -0
  69. package/dist/plugins/4.3.frame.d.ts +21 -0
  70. package/dist/plugins/4.4.doc.d.ts +23 -0
  71. package/dist/plugins/align.d.ts +16 -0
  72. package/dist/plugins/arrange.d.ts +19 -0
  73. package/dist/plugins/auxiliary.d.ts +14 -0
  74. package/dist/plugins/clipboard.d.ts +22 -0
  75. package/dist/plugins/flip.d.ts +10 -0
  76. package/dist/plugins/frame.d.ts +14 -0
  77. package/dist/plugins/group.d.ts +14 -0
  78. package/dist/plugins/history.d.ts +21 -0
  79. package/dist/plugins/import.d.ts +15 -0
  80. package/dist/plugins/insert/image.d.ts +13 -0
  81. package/dist/plugins/insert/text.d.ts +14 -0
  82. package/dist/plugins/menu.d.ts +12 -0
  83. package/dist/plugins/move.d.ts +20 -0
  84. package/dist/plugins/new.d.ts +12 -0
  85. package/dist/plugins/open.d.ts +12 -0
  86. package/dist/plugins/preference.d.ts +16 -0
  87. package/dist/plugins/saveAs.d.ts +15 -0
  88. package/dist/plugins/select.d.ts +20 -0
  89. package/dist/plugins/snapshot.d.ts +17 -0
  90. package/dist/plugins/theme.d.ts +8 -0
  91. package/dist/plugins/ui.d.ts +16 -0
  92. package/dist/plugins/visibility.d.ts +14 -0
  93. package/dist/plugins/zoom.d.ts +32 -0
  94. package/dist/preset-plugins.d.ts +1 -0
  95. package/dist/sw.d.ts +1 -0
  96. package/dist/typed-global.d.ts +26 -0
  97. package/dist/typed-plugins.d.ts +58 -0
  98. package/dist/types/box.d.ts +9 -0
  99. package/dist/types/index.d.ts +1 -0
  100. package/dist/utils/BSTree/BSTree.d.ts +18 -0
  101. package/dist/utils/BSTree/BSTreeKV.d.ts +210 -0
  102. package/dist/utils/BSTree/LinkedList.d.ts +179 -0
  103. package/dist/utils/BSTree/Queue.d.ts +81 -0
  104. package/dist/utils/BSTree/index.d.ts +1 -0
  105. package/dist/utils/BSTree/utils.d.ts +47 -0
  106. package/dist/utils/box.d.ts +7 -0
  107. package/dist/utils/constants.d.ts +4 -0
  108. package/dist/utils/create.d.ts +3 -0
  109. package/dist/utils/helper.d.ts +1 -0
  110. package/dist/utils/image.d.ts +26 -0
  111. package/dist/utils/index.d.ts +7 -0
  112. package/dist/utils/propsFactory.d.ts +57 -0
  113. package/dist/utils/random.d.ts +3 -0
  114. package/package.json +147 -0
@@ -0,0 +1,210 @@
1
+ import * as util from './utils';
2
+ /**
3
+ * General binary search tree implementation.
4
+ *
5
+ * This interface allows one to search elements using a subset of their attributes (thus the
6
+ * tree can be used as an index for complex objects).
7
+ * The attributes required to define an ordering in the tree must be defined in the type K.
8
+ * Any additional attribute must be defined in the type V.
9
+ *
10
+ * @see BSTree
11
+ */
12
+ export default class BSTreeKV<K, V extends K> {
13
+ private root;
14
+ private compare;
15
+ private nElements;
16
+ /**
17
+ * Creates an empty binary search tree.
18
+ * @class <p>A binary search tree is a binary tree in which each
19
+ * internal node stores an element such that the elements stored in the
20
+ * left subtree are less than it and the elements
21
+ * stored in the right subtree are greater.</p>
22
+ * <p>Formally, a binary search tree is a node-based binary tree data structure which
23
+ * has the following properties:</p>
24
+ * <ul>
25
+ * <li>The left subtree of a node contains only nodes with elements less
26
+ * than the node's element</li>
27
+ * <li>The right subtree of a node contains only nodes with elements greater
28
+ * than the node's element</li>
29
+ * <li>Both the left and right subtrees must also be binary search trees.</li>
30
+ * </ul>
31
+ * <p>If the inserted elements are custom objects a compare function must
32
+ * be provided at construction time, otherwise the <=, === and >= operators are
33
+ * used to compare elements. Example:</p>
34
+ * <pre>
35
+ * function compare(a, b) {
36
+ * if (a is less than b by some ordering criterion) {
37
+ * return -1;
38
+ * } if (a is greater than b by the ordering criterion) {
39
+ * return 1;
40
+ * }
41
+ * // a must be equal to b
42
+ * return 0;
43
+ * }
44
+ * </pre>
45
+ * @constructor
46
+ * @param {function(Object,Object):number=} compareFunction optional
47
+ * function used to compare two elements. Must return a negative integer,
48
+ * zero, or a positive integer as the first argument is less than, equal to,
49
+ * or greater than the second.
50
+ */
51
+ constructor(compareFunction?: util.ICompareFunction<K>);
52
+ /**
53
+ * Adds the specified element to this tree if it is not already present.
54
+ * @param {Object} element the element to insert.
55
+ * @return {boolean} true if this tree did not already contain the specified element.
56
+ */
57
+ add(element: V): boolean;
58
+ /**
59
+ * Removes all of the elements from this tree.
60
+ */
61
+ clear(): void;
62
+ /**
63
+ * Returns true if this tree contains no elements.
64
+ * @return {boolean} true if this tree contains no elements.
65
+ */
66
+ isEmpty(): boolean;
67
+ /**
68
+ * Returns the number of elements in this tree.
69
+ * @return {number} the number of elements in this tree.
70
+ */
71
+ size(): number;
72
+ /**
73
+ * Returns true if this tree contains the specified element.
74
+ * @param {Object} element element to search for.
75
+ * @return {boolean} true if this tree contains the specified element,
76
+ * false otherwise.
77
+ */
78
+ contains(element: K): boolean;
79
+ /**
80
+ * 搜索元素
81
+ * @param {Object} element The key to look for
82
+ * @return {Object} The value found or undefined if it was not found.
83
+ */
84
+ search(element: K): V | undefined;
85
+ /**
86
+ * 搜索最接近的元素
87
+ */
88
+ searchClosest(element: K, closestCompareFn: util.IClosestCompareFunction<K>): V | undefined;
89
+ /**
90
+ * Removes the specified element from this tree if it is present.
91
+ * @return {boolean} true if this tree contained the specified element.
92
+ */
93
+ remove(element: K): boolean;
94
+ /**
95
+ * Executes the provided function once for each element present in this tree in
96
+ * in-order.
97
+ * @param {function(Object):*} callback function to execute, it is invoked with one
98
+ * argument: the element value, to break the iteration you can optionally return false.
99
+ */
100
+ inorderTraversal(callback: util.ILoopFunction<V>): void;
101
+ /**
102
+ * Executes the provided function once for each element present in this tree in
103
+ * out-order.
104
+ * @param {function(Object):*} callback function to execute, it is invoked with one
105
+ * argument: the element value, to break the iteration you can optionally return false.
106
+ */
107
+ outorderTraversal(callback: util.ILoopFunction<V>): void;
108
+ /**
109
+ * Executes the provided function once for each element present in this tree in pre-order.
110
+ * @param {function(Object):*} callback function to execute, it is invoked with one
111
+ * argument: the element value, to break the iteration you can optionally return false.
112
+ */
113
+ preorderTraversal(callback: util.ILoopFunction<V>): void;
114
+ /**
115
+ * Executes the provided function once for each element present in this tree in post-order.
116
+ * @param {function(Object):*} callback function to execute, it is invoked with one
117
+ * argument: the element value, to break the iteration you can optionally return false.
118
+ */
119
+ postorderTraversal(callback: util.ILoopFunction<V>): void;
120
+ /**
121
+ * Executes the provided function once for each element present in this tree in
122
+ * level-order.
123
+ * @param {function(Object):*} callback function to execute, it is invoked with one
124
+ * argument: the element value, to break the iteration you can optionally return false.
125
+ */
126
+ levelTraversal(callback: util.ILoopFunction<V>): void;
127
+ /**
128
+ * Returns the minimum element of this tree.
129
+ * @return {*} the minimum element of this tree or undefined if this tree is
130
+ * is empty.
131
+ */
132
+ minimum(): V | undefined;
133
+ /**
134
+ * Returns the maximum element of this tree.
135
+ * @return {*} the maximum element of this tree or undefined if this tree is
136
+ * is empty.
137
+ */
138
+ maximum(): V | undefined;
139
+ /**
140
+ * Executes the provided function once for each element present in this tree in inorder.
141
+ * Equivalent to inorderTraversal.
142
+ * @param {function(Object):*} callback function to execute, it is
143
+ * invoked with one argument: the element value, to break the iteration you can
144
+ * optionally return false.
145
+ */
146
+ forEach(callback: util.ILoopFunction<V>): void;
147
+ /**
148
+ * Returns an array containing all of the elements in this tree in in-order.
149
+ * @return {Array} an array containing all of the elements in this tree in in-order.
150
+ */
151
+ toArray(): V[];
152
+ /**
153
+ * Returns the height of this tree.
154
+ * @return {number} the height of this tree or -1 if is empty.
155
+ */
156
+ height(): number;
157
+ /**
158
+ * @private
159
+ */
160
+ private searchClosestNode;
161
+ /**
162
+ * @private
163
+ */
164
+ private searchNode;
165
+ /**
166
+ * @private
167
+ */
168
+ private transplant;
169
+ /**
170
+ * @private
171
+ */
172
+ private removeNode;
173
+ /**
174
+ * @private
175
+ */
176
+ private inorderTraversalAux;
177
+ /**
178
+ * @private
179
+ */
180
+ private outorderTraversalAux;
181
+ /**
182
+ * @private
183
+ */
184
+ private levelTraversalAux;
185
+ /**
186
+ * @private
187
+ */
188
+ private preorderTraversalAux;
189
+ /**
190
+ * @private
191
+ */
192
+ private postorderTraversalAux;
193
+ /**
194
+ * @private
195
+ */
196
+ private minimumAux;
197
+ /**
198
+ * @private
199
+ */
200
+ private maximumAux;
201
+ /**
202
+ * @private
203
+ */
204
+ private heightAux;
205
+ private insertNode;
206
+ /**
207
+ * @private
208
+ */
209
+ private createNode;
210
+ }
@@ -0,0 +1,179 @@
1
+ import * as util from './utils';
2
+ export interface ILinkedListNode<T> {
3
+ element: T;
4
+ next: ILinkedListNode<T> | null;
5
+ }
6
+ export default class LinkedList<T> {
7
+ /**
8
+ * First node in the list
9
+ * @type {Object}
10
+ * @private
11
+ */
12
+ firstNode: ILinkedListNode<T> | null;
13
+ /**
14
+ * Last node in the list
15
+ * @type {Object}
16
+ * @private
17
+ */
18
+ private lastNode;
19
+ /**
20
+ * Number of elements in the list
21
+ * @type {number}
22
+ * @private
23
+ */
24
+ private nElements;
25
+ /**
26
+ * Creates an empty Linked List.
27
+ * @class A linked list is a data structure consisting of a group of nodes
28
+ * which together represent a sequence.
29
+ * @constructor
30
+ */
31
+ constructor();
32
+ /**
33
+ * Adds an element to this list.
34
+ * @param {Object} item element to be added.
35
+ * @param {number=} index optional index to add the element. If no index is specified
36
+ * the element is added to the end of this list.
37
+ * @return {boolean} true if the element was added or false if the index is invalid
38
+ * or if the element is undefined.
39
+ */
40
+ add(item: T, index?: number): boolean;
41
+ /**
42
+ * Returns the first element in this list.
43
+ * @return {*} the first element of the list or undefined if the list is
44
+ * empty.
45
+ */
46
+ first(): T | undefined;
47
+ /**
48
+ * Returns the last element in this list.
49
+ * @return {*} the last element in the list or undefined if the list is
50
+ * empty.
51
+ */
52
+ last(): T | undefined;
53
+ /**
54
+ * Returns the element at the specified position in this list.
55
+ * @param {number} index desired index.
56
+ * @return {*} the element at the given index or undefined if the index is
57
+ * out of bounds.
58
+ */
59
+ elementAtIndex(index: number): T | undefined;
60
+ /**
61
+ * Returns the index in this list of the first occurrence of the
62
+ * specified element, or -1 if the List does not contain this element.
63
+ * <p>If the elements inside this list are
64
+ * not comparable with the === operator a custom equals function should be
65
+ * provided to perform searches, the function must receive two arguments and
66
+ * return true if they are equal, false otherwise. Example:</p>
67
+ *
68
+ * <pre>
69
+ * const petsAreEqualByName = function(pet1, pet2) {
70
+ * return pet1.name === pet2.name;
71
+ * }
72
+ * </pre>
73
+ * @param {Object} item element to search for.
74
+ * @param {function(Object,Object):boolean=} equalsFunction Optional
75
+ * function used to check if two elements are equal.
76
+ * @return {number} the index in this list of the first occurrence
77
+ * of the specified element, or -1 if this list does not contain the
78
+ * element.
79
+ */
80
+ indexOf(item: T, equalsFunction?: util.IEqualsFunction<T>): number;
81
+ /**
82
+ * Returns true if this list contains the specified element.
83
+ * <p>If the elements inside the list are
84
+ * not comparable with the === operator a custom equals function should be
85
+ * provided to perform searches, the function must receive two arguments and
86
+ * return true if they are equal, false otherwise. Example:</p>
87
+ *
88
+ * <pre>
89
+ * const petsAreEqualByName = function(pet1, pet2) {
90
+ * return pet1.name === pet2.name;
91
+ * }
92
+ * </pre>
93
+ * @param {Object} item element to search for.
94
+ * @param {function(Object,Object):boolean=} equalsFunction Optional
95
+ * function used to check if two elements are equal.
96
+ * @return {boolean} true if this list contains the specified element, false
97
+ * otherwise.
98
+ */
99
+ contains(item: T, equalsFunction?: util.IEqualsFunction<T>): boolean;
100
+ /**
101
+ * Removes the first occurrence of the specified element in this list.
102
+ * <p>If the elements inside the list are
103
+ * not comparable with the === operator a custom equals function should be
104
+ * provided to perform searches, the function must receive two arguments and
105
+ * return true if they are equal, false otherwise. Example:</p>
106
+ *
107
+ * <pre>
108
+ * const petsAreEqualByName = function(pet1, pet2) {
109
+ * return pet1.name === pet2.name;
110
+ * }
111
+ * </pre>
112
+ * @param {Object} item element to be removed from this list, if present.
113
+ * @return {boolean} true if the list contained the specified element.
114
+ */
115
+ remove(item: T, equalsFunction?: util.IEqualsFunction<T>): boolean;
116
+ /**
117
+ * Removes all of the elements from this list.
118
+ */
119
+ clear(): void;
120
+ /**
121
+ * Returns true if this list is equal to the given list.
122
+ * Two lists are equal if they have the same elements in the same order.
123
+ * @param {LinkedList} other the other list.
124
+ * @param {function(Object,Object):boolean=} equalsFunction optional
125
+ * function used to check if two elements are equal. If the elements in the lists
126
+ * are custom objects you should provide a function, otherwise
127
+ * the === operator is used to check equality between elements.
128
+ * @return {boolean} true if this list is equal to the given list.
129
+ */
130
+ equals(other: any, equalsFunction?: util.IEqualsFunction<T>): boolean;
131
+ /**
132
+ * @private
133
+ */
134
+ private equalsAux;
135
+ /**
136
+ * Removes the element at the specified position in this list.
137
+ * @param {number} index given index.
138
+ * @return {*} removed element or undefined if the index is out of bounds.
139
+ */
140
+ deleteElementAtIndex(index: number): T | undefined;
141
+ /**
142
+ * Executes the provided function once for each element present in this list in order.
143
+ * @param {function(Object):*} callback function to execute, it is
144
+ * invoked with one argument: the element value, to break the iteration you can
145
+ * optionally return false.
146
+ */
147
+ forEach(callback: util.ILoopFunction<T>): void;
148
+ /**
149
+ * Reverses the order of the elements in this linked list (makes the last
150
+ * element first, and the first element last).
151
+ */
152
+ reverse(): void;
153
+ /**
154
+ * Returns an array containing all of the elements in this list in proper
155
+ * sequence.
156
+ * @return {Array.<*>} an array containing all of the elements in this list,
157
+ * in proper sequence.
158
+ */
159
+ toArray(): T[];
160
+ /**
161
+ * Returns the number of elements in this list.
162
+ * @return {number} the number of elements in this list.
163
+ */
164
+ size(): number;
165
+ /**
166
+ * Returns true if this list contains no elements.
167
+ * @return {boolean} true if this list contains no elements.
168
+ */
169
+ isEmpty(): boolean;
170
+ toString(): string;
171
+ /**
172
+ * @private
173
+ */
174
+ private nodeAtIndex;
175
+ /**
176
+ * @private
177
+ */
178
+ private createNode;
179
+ }
@@ -0,0 +1,81 @@
1
+ import * as util from './utils';
2
+ export default class Queue<T> {
3
+ /**
4
+ * List containing the elements.
5
+ * @type collections.LinkedList
6
+ * @private
7
+ */
8
+ private list;
9
+ /**
10
+ * Creates an empty queue.
11
+ * @class A queue is a First-In-First-Out (FIFO) data structure, the first
12
+ * element added to the queue will be the first one to be removed. This
13
+ * implementation uses a linked list as a container.
14
+ * @constructor
15
+ */
16
+ constructor();
17
+ /**
18
+ * Inserts the specified element into the end of this queue.
19
+ * @param {Object} elem the element to insert.
20
+ * @return {boolean} true if the element was inserted, or false if it is undefined.
21
+ */
22
+ enqueue(elem: T): boolean;
23
+ /**
24
+ * Inserts the specified element into the end of this queue.
25
+ * @param {Object} elem the element to insert.
26
+ * @return {boolean} true if the element was inserted, or false if it is undefined.
27
+ */
28
+ add(elem: T): boolean;
29
+ /**
30
+ * Retrieves and removes the head of this queue.
31
+ * @return {*} the head of this queue, or undefined if this queue is empty.
32
+ */
33
+ dequeue(): T | undefined;
34
+ /**
35
+ * Retrieves, but does not remove, the head of this queue.
36
+ * @return {*} the head of this queue, or undefined if this queue is empty.
37
+ */
38
+ peek(): T | undefined;
39
+ /**
40
+ * Returns the number of elements in this queue.
41
+ * @return {number} the number of elements in this queue.
42
+ */
43
+ size(): number;
44
+ /**
45
+ * Returns true if this queue contains the specified element.
46
+ * <p>If the elements inside this stack are
47
+ * not comparable with the === operator, a custom equals function should be
48
+ * provided to perform searches, the function must receive two arguments and
49
+ * return true if they are equal, false otherwise. Example:</p>
50
+ *
51
+ * <pre>
52
+ * const petsAreEqualByName (pet1, pet2) {
53
+ * return pet1.name === pet2.name;
54
+ * }
55
+ * </pre>
56
+ * @param {Object} elem element to search for.
57
+ * @param {function(Object,Object):boolean=} equalsFunction optional
58
+ * function to check if two elements are equal.
59
+ * @return {boolean} true if this queue contains the specified element,
60
+ * false otherwise.
61
+ */
62
+ contains(elem: T, equalsFunction?: util.IEqualsFunction<T>): boolean;
63
+ /**
64
+ * Checks if this queue is empty.
65
+ * @return {boolean} true if and only if this queue contains no items; false
66
+ * otherwise.
67
+ */
68
+ isEmpty(): boolean;
69
+ /**
70
+ * Removes all of the elements from this queue.
71
+ */
72
+ clear(): void;
73
+ /**
74
+ * Executes the provided function once for each element present in this queue in
75
+ * FIFO order.
76
+ * @param {function(Object):*} callback function to execute, it is
77
+ * invoked with one argument: the element value, to break the iteration you can
78
+ * optionally return false.
79
+ */
80
+ forEach(callback: util.ILoopFunction<T>): void;
81
+ }
@@ -0,0 +1 @@
1
+ export { default as BSTree } from './BSTree';
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Function signature for comparing
3
+ * <0 means a is smaller
4
+ * = 0 means they are equal
5
+ * >0 means a is larger
6
+ */
7
+ export interface ICompareFunction<T> {
8
+ (a: T, b: T): number;
9
+ }
10
+ /**
11
+ * 相近元素比较函数
12
+ */
13
+ export interface IClosestCompareFunction<T> {
14
+ (currentElement: T, targetElement: T, closestElement: T | null): boolean;
15
+ }
16
+ /**
17
+ * Function signature for checking equality
18
+ */
19
+ export interface IEqualsFunction<T> {
20
+ (a: T, b: T): boolean;
21
+ }
22
+ /**
23
+ * Function signature for Iterations. Return false to break from loop
24
+ */
25
+ export interface ILoopFunction<T> {
26
+ (a: T): boolean | void;
27
+ }
28
+ /**
29
+ * Default function to compare element order.
30
+ * @function
31
+ */
32
+ export declare function defaultCompare<T>(a: T, b: T): number;
33
+ /**
34
+ * Default function to test equality.
35
+ * @function
36
+ */
37
+ export declare function defaultEquals<T>(a: T, b: T): boolean;
38
+ /**
39
+ * Checks if the given argument is a function.
40
+ * @function
41
+ */
42
+ export declare function isFunction(func: any): boolean;
43
+ /**
44
+ * Checks if the given argument is undefined.
45
+ * @function
46
+ */
47
+ export declare function isUndefined(obj: any): obj is undefined;
@@ -0,0 +1,7 @@
1
+ import type { Vector2Data } from 'modern-canvas';
2
+ import type { AxisAlignedBoundingBox, OrientedBoundingBox } from '../types';
3
+ export declare function boundingBoxToStyle(box: OrientedBoundingBox): Record<string, any>;
4
+ export declare function isPointInsideAabb(point: Vector2Data, box: AxisAlignedBoundingBox): boolean;
5
+ export declare function isOverlappingAabb(aabb1: AxisAlignedBoundingBox, aabb2: AxisAlignedBoundingBox, axis?: 'vertical' | 'horizontal'): boolean;
6
+ export declare function isOverlappingObb(box1: OrientedBoundingBox, box2: OrientedBoundingBox): boolean;
7
+ export declare function minBoundingBox(rects: OrientedBoundingBox[]): OrientedBoundingBox;
@@ -0,0 +1,4 @@
1
+ export declare const SUPPORTS_CLIPBOARD: boolean;
2
+ export declare const USER_AGENT: string;
3
+ export declare const isMac: boolean;
4
+ export declare const isWindows: boolean;
@@ -0,0 +1,3 @@
1
+ import type { NormalizedElement } from 'modern-idoc';
2
+ export declare function createTextElement(content: string, style?: Record<string, any>): NormalizedElement;
3
+ export declare function createImageElement(image: string): Promise<NormalizedElement>;
@@ -0,0 +1 @@
1
+ export declare function isClickInsideElement(event: MouseEvent, targetDiv: HTMLElement): boolean;
@@ -0,0 +1,26 @@
1
+ interface ImgSize {
2
+ width: number;
3
+ height: number;
4
+ }
5
+ interface Options {
6
+ useCrossOrigin?: boolean;
7
+ timeout?: number;
8
+ }
9
+ export declare function getImageSizeFromUrl(url: string, opts?: Options): Promise<ImgSize>;
10
+ export declare const imageMimeTypeExtMap: {
11
+ 'image/jpeg': string[];
12
+ 'image/png': string[];
13
+ 'image/gif': string[];
14
+ 'image/svg+xml': string[];
15
+ 'image/tiff': string[];
16
+ 'image/bmp': string[];
17
+ 'image/x-ms-bmp': string[];
18
+ 'image/vnd.microsoft.icon': string[];
19
+ 'image/webp': string[];
20
+ 'image/heif': string[];
21
+ 'image/heic': string[];
22
+ 'image/avif': string[];
23
+ };
24
+ export declare const imageExts: string[];
25
+ export declare const imageExtRe: RegExp;
26
+ export {};
@@ -0,0 +1,7 @@
1
+ export * from './box';
2
+ export * from './constants';
3
+ export * from './create';
4
+ export * from './helper';
5
+ export * from './image';
6
+ export * from './propsFactory';
7
+ export * from './random';
@@ -0,0 +1,57 @@
1
+ import type { ComponentObjectPropsOptions, Prop, PropType } from 'vue';
2
+ /**
3
+ * Creates a factory function for props definitions.
4
+ * This is used to define props in va composable then override
5
+ * default values in an implementing component.
6
+ *
7
+ * @example Simplified signature
8
+ * (props: Props) => (defaults?: Record<keyof props, any>) => Props
9
+ *
10
+ * @example Usage
11
+ * const makeProps = propsFactory({
12
+ * foo: String,
13
+ * })
14
+ *
15
+ * defineComponent({
16
+ * props: {
17
+ * ...makeProps({
18
+ * foo: 'a',
19
+ * }),
20
+ * },
21
+ * setup (props) {
22
+ * // would be "string | undefined", now "string" because a default has been provided
23
+ * props.foo
24
+ * },
25
+ * }
26
+ */
27
+ export declare function propsFactory<PropsOptions extends ComponentObjectPropsOptions>(props: PropsOptions, source: string): <Defaults extends PartialKeys<PropsOptions> = {}>(defaults?: Defaults) => AppendDefault<PropsOptions, Defaults>;
28
+ type AppendDefault<T extends ComponentObjectPropsOptions, D extends PartialKeys<T>> = {
29
+ [P in keyof T]-?: unknown extends D[P] ? T[P] : T[P] extends Record<string, unknown> ? Omit<T[P], 'type' | 'default'> & {
30
+ type: PropType<MergeTypeDefault<T[P], D[P]>>;
31
+ default: MergeDefault<T[P], D[P]>;
32
+ } : {
33
+ type: PropType<MergeTypeDefault<T[P], D[P]>>;
34
+ default: MergeDefault<T[P], D[P]>;
35
+ };
36
+ };
37
+ type MergeTypeDefault<T, D, P = InferPropType<T>> = unknown extends D ? P : (P | D);
38
+ type MergeDefault<T, D, P = InferPropType<T>> = unknown extends D ? P : (NonNullable<P> | D);
39
+ /**
40
+ * Like `Partial<T>` but doesn't care what the value is
41
+ */
42
+ type PartialKeys<T> = {
43
+ [P in keyof T]?: unknown;
44
+ };
45
+ type InferPropType<T> = [T] extends [null] ? any : [T] extends [{
46
+ type: null | true;
47
+ }] ? any : [T] extends [ObjectConstructor | {
48
+ type: ObjectConstructor;
49
+ }] ? Record<string, any> : [T] extends [BooleanConstructor | {
50
+ type: BooleanConstructor;
51
+ }] ? boolean : [T] extends [DateConstructor | {
52
+ type: DateConstructor;
53
+ }] ? Date : [T] extends [(infer U)[] | {
54
+ type: (infer U)[];
55
+ }] ? U extends DateConstructor ? Date | InferPropType<U> : InferPropType<U> : [T] extends [Prop<infer V, infer D>] ? unknown extends V ? IfAny<V, V, D> : V : T;
56
+ type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
57
+ export {};
@@ -0,0 +1,3 @@
1
+ export declare const getRandomValues: <T extends ArrayBufferView>(array: T) => T;
2
+ export declare const uint32: () => number;
3
+ export declare function uuidv4(): string;