slate-vue3 0.0.22 → 0.0.23

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 (4) hide show
  1. package/License.md +21 -21
  2. package/README.md +174 -174
  3. package/dist/index.js +68 -227
  4. package/package.json +67 -67
package/License.md CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 Guan-Erjia
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Guan-Erjia
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,174 +1,174 @@
1
- [<img src="https://github.com/Guan-Erjia/slate-vue3/blob/master/public/banner.png" />](https://github.com/ianstormtaylor/slate)
2
-
3
- <p align="center">
4
- slate-<a style="color: #087ea4" href="https://react.dev/">react</a> library implemented with <a style="color: #42b883" href="https://vuejs.org/">vue3</a>
5
- </p>
6
- <br/>
7
-
8
- # How to use?
9
-
10
- ## 1. install slate-vue3
11
- ```
12
- npm install slate-vue3
13
- ```
14
- ## 2. now, you can use it in vue-sfc
15
- ```
16
- <script setup lang="ts">
17
- import { withDOM, Slate, Editable, defaultRenderLeaf, defaultRenderPlaceHolder, createEditor, withHistory } from "slate-vue3"
18
- import { h } from "vue";
19
-
20
- const initialValue = [{
21
- type: 'paragraph',
22
- children: [{ text: 'Let's start' }]
23
- }]
24
- const renderElement = ({ attributes, children }) => h('p', attributes, children)
25
- const editor = withHistory(withDOM(createEditor(initialValue)))
26
- </script>
27
-
28
- <template>
29
- <Slate :editor="editor" :render-element="renderElement" :render-leaf="defaultRenderLeaf"
30
- :render-placeholder="defaultRenderPlaceHolder">
31
- <Editable />
32
- </Slate>
33
- </template>
34
- ```
35
- ## 3. check out the :point_right:[**live demo**](https://guan-erjia.github.io/slate-vue3/) of all of the examples
36
- ![example](https://guan-erjia.github.io/slate-vue3/example.png)
37
-
38
- # Why use it?
39
- 1. :sparkles: Highly customizable features, use slate core at the bottom level
40
- 2. :zap: The latest version of the core, use vue to reduce the number of re-renderings
41
- 3. :coffee: This library provides the same usage as slate-react, design tends to be stable
42
-
43
- # Hooks
44
- ## [useComposing](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-composing.ts)
45
- > Get the current composing state of the editor. It deals with compositionstart, compositionupdate, compositionend events.
46
-
47
- const useComposing : ( ) => Ref<boolean>
48
- ```
49
- import { useComposing } from 'slate-vue3'
50
-
51
- const composing = useComposing()
52
- ```
53
-
54
- ## [useFocused](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-focus.ts)
55
- > Get the current focused state of the editor.
56
-
57
- const useFocused : ( ) => Ref<boolean>
58
- ```
59
- import { useFocused } from 'slate-vue3'
60
-
61
- const focused = useFocused()
62
- ```
63
-
64
- ## [useReadOnly](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-read-only.ts)
65
- > Get the current readOnly state of the editor.
66
-
67
- const useReadOnly : ( ) => Ref<boolean>
68
- ```
69
- import { useReadOnly } from 'slate-vue3'
70
-
71
- const readonly = useReadOnly()
72
- ```
73
-
74
- ## [useSelected](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-selected.ts)
75
- > Get the current selected state of an element.
76
-
77
- const useSelected : ( ) => ComputedRef<boolean>
78
- ```
79
- import { useSelected } from 'slate-vue3'
80
-
81
- const selected = useSelected()
82
- ```
83
-
84
- ## [useEditor](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-editor.ts)
85
- > Get the current editor object from the context. Context whenever changes occur in the editor.
86
-
87
- const useEditor : ( ) => Editor
88
- ```
89
- import { useEditor } from 'slate-vue3'
90
-
91
- const editor = useEditor()
92
- ```
93
-
94
- ## [useSelection](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-selection.ts)
95
- > Get the current editor selection from the context.
96
-
97
- const useSelection : ( ) => ComputedRef<Selection>
98
- ```
99
- import { useSelection } from 'slate-vue3'
100
-
101
- const selection = useSelection()
102
- ```
103
-
104
-
105
- ## [useInheritRef](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-inherit-ref.ts)
106
- > Automatically bind ref to the real node when the component is mounted,This is important when rendering element nodes directly
107
-
108
- const useInheritRef : ( attribute: HTMLAttributes ) => HTMLAttributes
109
- ```
110
- const renderElement = (props: RenderElementProps) => {
111
- const { attributes, children, element } = props
112
- switch (element.type) {
113
- case 'image':
114
- return h(ImageComp, { element, ...useInheritRef(attributes) }, () => children)
115
- default:
116
- return h('p', attributes, children)
117
- }
118
- }
119
- ```
120
-
121
- # FAQ
122
- ### 1. Why do I have to pass renderFunction into <Slate /> component ?
123
- This ensures that your rich text is as expected, and slave-vue3 provides some default rendering functions, you can directly use the default rendering behavior
124
-
125
- ### 2. Can I use jsx in slate-vue3 ?
126
- Of coures yes, but we do not recommend it unless you have already configured jsx in the project, as a branch, using the h function directly is already simple enough
127
-
128
- ### 3. Why do rendering functions not use Vue components ?
129
- Vue uses lazy updates, rendering with components generates additional state, which can cause unexpected results during updates, it would be better to use functions as branches directly
130
-
131
- # Directory Structure
132
-
133
- - [slate](https://github.com/Guan-Erjia/slate-vue3/tree/master/packages/slate)
134
- slate core logic, update synchronously with slate
135
- - [slate-dom](https://github.com/Guan-Erjia/slate-vue3/tree/master/packages/slate-dom)
136
- Implementation of slate on dom, update synchronously with slate-dom
137
- - [slate-vue](https://github.com/Guan-Erjia/slate-vue3/tree/master/packages/slate-vue)
138
- Vue components for rendering slate editors
139
- - [slate-history](https://github.com/Guan-Erjia/slate-vue3/tree/master/packages/slate-history)
140
- Provide undo redo functions, replace Weakmap to UnProxyWeakmap
141
- - [share-tools](https://github.com/Guan-Erjia/slate-vue3/tree/master/packages/share-tools)
142
- for special processing of Proxy data, obtain the raw pointer, isPlainObject declare
143
-
144
- # Compact Slate
145
-
146
- **reactive implement**
147
-
148
- 1. packages/slate/src/interfaces/text.ts 115:115
149
- 2. packages/slate/src/create-editor.ts 94:94
150
- 3. packages/slate/src/transforms-node/set-nodes.ts 18:18
151
- 4. packages/slate/src/interfaces/text.ts 116:116
152
-
153
- **remove immer**
154
-
155
- 1. packages/slate/src/interfaces/node.ts 365:365
156
- 2. packages/slate/src/interfaces/point.ts 103:103
157
- 3. packages/slate/src/interfaces/range.ts 224:224
158
- 4. packages/slate/src/interfaces/transforms/general.ts 322:333
159
-
160
- **rewrite implement for WeakMap**
161
-
162
- 1. packages/share-tools/index.ts
163
- 2. packages/slate-dom/src/utils/weak-maps.ts
164
-
165
- **import types from globalThis in slate-dom**
166
-
167
- 1. packages/slate-dom/src/index.ts
168
- 2. packages/slate-dom/src/plugin/dom-editor.ts
169
- 3. packages/slate-dom/src/utils/dom.ts
170
-
171
- **other compact**
172
-
173
- 1. packages/slate/src/core/normalize-node.ts
174
- 2. packages/slate-dom/src/plugin/dom-editor.ts 421:441
1
+ [<img src="https://github.com/Guan-Erjia/slate-vue3/blob/master/public/banner.png" />](https://github.com/ianstormtaylor/slate)
2
+
3
+ <p align="center">
4
+ slate-<a style="color: #087ea4" href="https://react.dev/">react</a> library implemented with <a style="color: #42b883" href="https://vuejs.org/">vue3</a>
5
+ </p>
6
+ <br/>
7
+
8
+ # How to use?
9
+
10
+ ## 1. install slate-vue3
11
+ ```
12
+ npm install slate-vue3
13
+ ```
14
+ ## 2. now, you can use it in vue-sfc
15
+ ```
16
+ <script setup lang="ts">
17
+ import { withDOM, Slate, Editable, defaultRenderLeaf, defaultRenderPlaceHolder, createEditor, withHistory } from "slate-vue3"
18
+ import { h } from "vue";
19
+
20
+ const initialValue = [{
21
+ type: 'paragraph',
22
+ children: [{ text: 'Let's start' }]
23
+ }]
24
+ const renderElement = ({ attributes, children }) => h('p', attributes, children)
25
+ const editor = withHistory(withDOM(createEditor(initialValue)))
26
+ </script>
27
+
28
+ <template>
29
+ <Slate :editor="editor" :render-element="renderElement" :render-leaf="defaultRenderLeaf"
30
+ :render-placeholder="defaultRenderPlaceHolder">
31
+ <Editable />
32
+ </Slate>
33
+ </template>
34
+ ```
35
+ ## 3. check out the :point_right:[**live demo**](https://guan-erjia.github.io/slate-vue3/) of all of the examples
36
+ ![example](https://guan-erjia.github.io/slate-vue3/example.png)
37
+
38
+ # Why use it?
39
+ 1. :sparkles: Highly customizable features, use slate core at the bottom level
40
+ 2. :zap: The latest version of the core, use vue to reduce the number of re-renderings
41
+ 3. :coffee: This library provides the same usage as slate-react, design tends to be stable
42
+
43
+ # Hooks
44
+ ## [useComposing](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-composing.ts)
45
+ > Get the current composing state of the editor. It deals with compositionstart, compositionupdate, compositionend events.
46
+
47
+ const useComposing : ( ) => Ref<boolean>
48
+ ```
49
+ import { useComposing } from 'slate-vue3'
50
+
51
+ const composing = useComposing()
52
+ ```
53
+
54
+ ## [useFocused](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-focus.ts)
55
+ > Get the current focused state of the editor.
56
+
57
+ const useFocused : ( ) => Ref<boolean>
58
+ ```
59
+ import { useFocused } from 'slate-vue3'
60
+
61
+ const focused = useFocused()
62
+ ```
63
+
64
+ ## [useReadOnly](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-read-only.ts)
65
+ > Get the current readOnly state of the editor.
66
+
67
+ const useReadOnly : ( ) => Ref<boolean>
68
+ ```
69
+ import { useReadOnly } from 'slate-vue3'
70
+
71
+ const readonly = useReadOnly()
72
+ ```
73
+
74
+ ## [useSelected](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-selected.ts)
75
+ > Get the current selected state of an element.
76
+
77
+ const useSelected : ( ) => ComputedRef<boolean>
78
+ ```
79
+ import { useSelected } from 'slate-vue3'
80
+
81
+ const selected = useSelected()
82
+ ```
83
+
84
+ ## [useEditor](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-editor.ts)
85
+ > Get the current editor object from the context. Context whenever changes occur in the editor.
86
+
87
+ const useEditor : ( ) => Editor
88
+ ```
89
+ import { useEditor } from 'slate-vue3'
90
+
91
+ const editor = useEditor()
92
+ ```
93
+
94
+ ## [useSelection](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-selection.ts)
95
+ > Get the current editor selection from the context.
96
+
97
+ const useSelection : ( ) => ComputedRef<Selection>
98
+ ```
99
+ import { useSelection } from 'slate-vue3'
100
+
101
+ const selection = useSelection()
102
+ ```
103
+
104
+
105
+ ## [useInheritRef](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-inherit-ref.ts)
106
+ > Automatically bind ref to the real node when the component is mounted,This is important when rendering element nodes directly
107
+
108
+ const useInheritRef : ( attribute: HTMLAttributes ) => HTMLAttributes
109
+ ```
110
+ const renderElement = (props: RenderElementProps) => {
111
+ const { attributes, children, element } = props
112
+ switch (element.type) {
113
+ case 'image':
114
+ return h(ImageComp, { element, ...useInheritRef(attributes) }, () => children)
115
+ default:
116
+ return h('p', attributes, children)
117
+ }
118
+ }
119
+ ```
120
+
121
+ # FAQ
122
+ ### 1. Why do I have to pass renderFunction into <Slate /> component ?
123
+ This ensures that your rich text is as expected, and slave-vue3 provides some default rendering functions, you can directly use the default rendering behavior
124
+
125
+ ### 2. Can I use jsx in slate-vue3 ?
126
+ Of coures yes, but we do not recommend it unless you have already configured jsx in the project, as a branch, using the h function directly is already simple enough
127
+
128
+ ### 3. Why do rendering functions not use Vue components ?
129
+ Vue uses lazy updates, rendering with components generates additional state, which can cause unexpected results during updates, it would be better to use functions as branches directly
130
+
131
+ # Directory Structure
132
+
133
+ - [slate](https://github.com/Guan-Erjia/slate-vue3/tree/master/packages/slate)
134
+ slate core logic, update synchronously with slate
135
+ - [slate-dom](https://github.com/Guan-Erjia/slate-vue3/tree/master/packages/slate-dom)
136
+ Implementation of slate on dom, update synchronously with slate-dom
137
+ - [slate-vue](https://github.com/Guan-Erjia/slate-vue3/tree/master/packages/slate-vue)
138
+ Vue components for rendering slate editors
139
+ - [slate-history](https://github.com/Guan-Erjia/slate-vue3/tree/master/packages/slate-history)
140
+ Provide undo redo functions, replace Weakmap to UnProxyWeakmap
141
+ - [share-tools](https://github.com/Guan-Erjia/slate-vue3/tree/master/packages/share-tools)
142
+ for special processing of Proxy data, obtain the raw pointer, isPlainObject declare
143
+
144
+ # Compact Slate
145
+
146
+ **reactive implement**
147
+
148
+ 1. packages/slate/src/interfaces/text.ts 115:115
149
+ 2. packages/slate/src/create-editor.ts 94:94
150
+ 3. packages/slate/src/transforms-node/set-nodes.ts 18:18
151
+ 4. packages/slate/src/interfaces/text.ts 116:116
152
+
153
+ **remove immer**
154
+
155
+ 1. packages/slate/src/interfaces/node.ts 365:365
156
+ 2. packages/slate/src/interfaces/point.ts 103:103
157
+ 3. packages/slate/src/interfaces/range.ts 224:224
158
+ 4. packages/slate/src/interfaces/transforms/general.ts 322:333
159
+
160
+ **rewrite implement for WeakMap**
161
+
162
+ 1. packages/share-tools/index.ts
163
+ 2. packages/slate-dom/src/utils/weak-maps.ts
164
+
165
+ **import types from globalThis in slate-dom**
166
+
167
+ 1. packages/slate-dom/src/index.ts
168
+ 2. packages/slate-dom/src/plugin/dom-editor.ts
169
+ 3. packages/slate-dom/src/utils/dom.ts
170
+
171
+ **other compact**
172
+
173
+ 1. packages/slate/src/core/normalize-node.ts
174
+ 2. packages/slate-dom/src/plugin/dom-editor.ts 421:441
package/dist/index.js CHANGED
@@ -857,44 +857,10 @@ function baseToString(value) {
857
857
  var result = value + "";
858
858
  return result == "0" && 1 / value == -Infinity ? "-0" : result;
859
859
  }
860
- var reWhitespace = /\s/;
861
- function trimmedEndIndex(string2) {
862
- var index = string2.length;
863
- while (index-- && reWhitespace.test(string2.charAt(index))) {
864
- }
865
- return index;
866
- }
867
- var reTrimStart = /^\s+/;
868
- function baseTrim(string2) {
869
- return string2 ? string2.slice(0, trimmedEndIndex(string2) + 1).replace(reTrimStart, "") : string2;
870
- }
871
860
  function isObject(value) {
872
861
  var type = typeof value;
873
862
  return value != null && (type == "object" || type == "function");
874
863
  }
875
- var NAN = 0 / 0;
876
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
877
- var reIsBinary = /^0b[01]+$/i;
878
- var reIsOctal = /^0o[0-7]+$/i;
879
- var freeParseInt = parseInt;
880
- function toNumber(value) {
881
- if (typeof value == "number") {
882
- return value;
883
- }
884
- if (isSymbol(value)) {
885
- return NAN;
886
- }
887
- if (isObject(value)) {
888
- var other = typeof value.valueOf == "function" ? value.valueOf() : value;
889
- value = isObject(other) ? other + "" : other;
890
- }
891
- if (typeof value != "string") {
892
- return value === 0 ? value : +value;
893
- }
894
- value = baseTrim(value);
895
- var isBinary = reIsBinary.test(value);
896
- return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
897
- }
898
864
  function identity(value) {
899
865
  return value;
900
866
  }
@@ -1086,11 +1052,11 @@ function copyObject(source, props, object, customizer) {
1086
1052
  }
1087
1053
  return object;
1088
1054
  }
1089
- var nativeMax$1 = Math.max;
1055
+ var nativeMax = Math.max;
1090
1056
  function overRest(func, start2, transform) {
1091
- start2 = nativeMax$1(start2 === void 0 ? func.length - 1 : start2, 0);
1057
+ start2 = nativeMax(start2 === void 0 ? func.length - 1 : start2, 0);
1092
1058
  return function() {
1093
- var args = arguments, index = -1, length = nativeMax$1(args.length - start2, 0), array = Array(length);
1059
+ var args = arguments, index = -1, length = nativeMax(args.length - start2, 0), array = Array(length);
1094
1060
  while (++index < length) {
1095
1061
  array[index] = args[start2 + index];
1096
1062
  }
@@ -1400,10 +1366,10 @@ MapCache.prototype["delete"] = mapCacheDelete;
1400
1366
  MapCache.prototype.get = mapCacheGet;
1401
1367
  MapCache.prototype.has = mapCacheHas;
1402
1368
  MapCache.prototype.set = mapCacheSet;
1403
- var FUNC_ERROR_TEXT$2 = "Expected a function";
1369
+ var FUNC_ERROR_TEXT = "Expected a function";
1404
1370
  function memoize(func, resolver) {
1405
1371
  if (typeof func != "function" || resolver != null && typeof resolver != "function") {
1406
- throw new TypeError(FUNC_ERROR_TEXT$2);
1372
+ throw new TypeError(FUNC_ERROR_TEXT);
1407
1373
  }
1408
1374
  var memoized = function() {
1409
1375
  var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
@@ -1822,92 +1788,6 @@ var CLONE_DEEP_FLAG$1 = 1, CLONE_SYMBOLS_FLAG$1 = 4;
1822
1788
  function cloneDeep(value) {
1823
1789
  return baseClone(value, CLONE_DEEP_FLAG$1 | CLONE_SYMBOLS_FLAG$1);
1824
1790
  }
1825
- var now = function() {
1826
- return root.Date.now();
1827
- };
1828
- var FUNC_ERROR_TEXT$1 = "Expected a function";
1829
- var nativeMax = Math.max, nativeMin = Math.min;
1830
- function debounce(func, wait, options) {
1831
- var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
1832
- if (typeof func != "function") {
1833
- throw new TypeError(FUNC_ERROR_TEXT$1);
1834
- }
1835
- wait = toNumber(wait) || 0;
1836
- if (isObject(options)) {
1837
- leading = !!options.leading;
1838
- maxing = "maxWait" in options;
1839
- maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
1840
- trailing = "trailing" in options ? !!options.trailing : trailing;
1841
- }
1842
- function invokeFunc(time) {
1843
- var args = lastArgs, thisArg = lastThis;
1844
- lastArgs = lastThis = void 0;
1845
- lastInvokeTime = time;
1846
- result = func.apply(thisArg, args);
1847
- return result;
1848
- }
1849
- function leadingEdge(time) {
1850
- lastInvokeTime = time;
1851
- timerId = setTimeout(timerExpired, wait);
1852
- return leading ? invokeFunc(time) : result;
1853
- }
1854
- function remainingWait(time) {
1855
- var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
1856
- return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
1857
- }
1858
- function shouldInvoke(time) {
1859
- var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
1860
- return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
1861
- }
1862
- function timerExpired() {
1863
- var time = now();
1864
- if (shouldInvoke(time)) {
1865
- return trailingEdge(time);
1866
- }
1867
- timerId = setTimeout(timerExpired, remainingWait(time));
1868
- }
1869
- function trailingEdge(time) {
1870
- timerId = void 0;
1871
- if (trailing && lastArgs) {
1872
- return invokeFunc(time);
1873
- }
1874
- lastArgs = lastThis = void 0;
1875
- return result;
1876
- }
1877
- function cancel() {
1878
- if (timerId !== void 0) {
1879
- clearTimeout(timerId);
1880
- }
1881
- lastInvokeTime = 0;
1882
- lastArgs = lastCallTime = lastThis = timerId = void 0;
1883
- }
1884
- function flush() {
1885
- return timerId === void 0 ? result : trailingEdge(now());
1886
- }
1887
- function debounced() {
1888
- var time = now(), isInvoking = shouldInvoke(time);
1889
- lastArgs = arguments;
1890
- lastThis = this;
1891
- lastCallTime = time;
1892
- if (isInvoking) {
1893
- if (timerId === void 0) {
1894
- return leadingEdge(lastCallTime);
1895
- }
1896
- if (maxing) {
1897
- clearTimeout(timerId);
1898
- timerId = setTimeout(timerExpired, wait);
1899
- return invokeFunc(lastCallTime);
1900
- }
1901
- }
1902
- if (timerId === void 0) {
1903
- timerId = setTimeout(timerExpired, wait);
1904
- }
1905
- return result;
1906
- }
1907
- debounced.cancel = cancel;
1908
- debounced.flush = flush;
1909
- return debounced;
1910
- }
1911
1791
  function last$1(array) {
1912
1792
  var length = array == null ? 0 : array.length;
1913
1793
  return length ? array[length - 1] : void 0;
@@ -1945,22 +1825,6 @@ var omit = flatRest(function(object, paths) {
1945
1825
  }
1946
1826
  return result;
1947
1827
  });
1948
- var FUNC_ERROR_TEXT = "Expected a function";
1949
- function throttle(func, wait, options) {
1950
- var leading = true, trailing = true;
1951
- if (typeof func != "function") {
1952
- throw new TypeError(FUNC_ERROR_TEXT);
1953
- }
1954
- if (isObject(options)) {
1955
- leading = "leading" in options ? !!options.leading : leading;
1956
- trailing = "trailing" in options ? !!options.trailing : trailing;
1957
- }
1958
- return debounce(func, wait, {
1959
- "leading": leading,
1960
- "maxWait": wait,
1961
- "trailing": trailing
1962
- });
1963
- }
1964
1828
  const isElement = (value) => {
1965
1829
  return isPlainObject$1(value) && Node.isNodeList(value.children) && !Editor.isEditor(value);
1966
1830
  };
@@ -5881,7 +5745,7 @@ const DOMEditor = {
5881
5745
  return { path: path2, offset };
5882
5746
  },
5883
5747
  toSlateRange: (editor, domRange, options) => {
5884
- var _a2, _b2, _c;
5748
+ var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
5885
5749
  const { exactMatch, suppressThrow } = options;
5886
5750
  const el = isDOMSelection(domRange) ? domRange.anchorNode : domRange.startContainer;
5887
5751
  let anchorNode;
@@ -5943,18 +5807,34 @@ const DOMEditor = {
5943
5807
  anchorOffset = domRange.anchorOffset;
5944
5808
  focusNode = domRange.focusNode;
5945
5809
  focusOffset = domRange.focusOffset;
5946
- if (IS_FIREFOX && ((_a2 = domRange.anchorNode) == null ? void 0 : _a2.role) === "textbox" && ((_b2 = domRange.focusNode) == null ? void 0 : _b2.role) === "textbox") {
5947
- while (anchorNode == null ? void 0 : anchorNode.firstElementChild) {
5948
- anchorNode = anchorNode.firstElementChild;
5949
- }
5950
- while (focusNode == null ? void 0 : focusNode.lastElementChild) {
5951
- focusNode = focusNode.lastElementChild;
5810
+ if (IS_FIREFOX) {
5811
+ if (((_a2 = domRange.anchorNode) == null ? void 0 : _a2.role) === "textbox" && ((_b2 = domRange.focusNode) == null ? void 0 : _b2.role) === "textbox") {
5812
+ while (anchorNode == null ? void 0 : anchorNode.firstElementChild) {
5813
+ anchorNode = anchorNode.firstElementChild;
5814
+ }
5815
+ while (focusNode == null ? void 0 : focusNode.lastElementChild) {
5816
+ focusNode = focusNode.lastElementChild;
5817
+ }
5818
+ anchorNode = anchorNode.firstChild;
5819
+ focusNode = focusNode.lastChild;
5820
+ focusOffset = focusNode.length;
5821
+ } else {
5822
+ const anchorEl = (_e = (_d = (_c = anchorNode == null ? void 0 : anchorNode.previousSibling) == null ? void 0 : _c.firstChild) == null ? void 0 : _d.firstChild) == null ? void 0 : _e.firstChild;
5823
+ if ((anchorNode == null ? void 0 : anchorNode.nodeType) === 3 && anchorNode.textContent === "" && anchorEl) {
5824
+ anchorNode = anchorEl;
5825
+ anchorOffset = ((_f = anchorEl.textContent) == null ? void 0 : _f.length) || 0;
5826
+ }
5827
+ const focusEl = (_i = (_h = (_g = focusNode == null ? void 0 : focusNode.previousSibling) == null ? void 0 : _g.lastChild) == null ? void 0 : _h.lastChild) == null ? void 0 : _i.lastChild;
5828
+ if ((focusNode == null ? void 0 : focusNode.nodeType) === 3 && focusNode.textContent === "" && ((_l = (_k = (_j = focusNode.previousSibling) == null ? void 0 : _j.lastChild) == null ? void 0 : _k.lastChild) == null ? void 0 : _l.lastChild)) {
5829
+ focusNode = focusEl;
5830
+ focusOffset = ((_m = focusEl == null ? void 0 : focusEl.textContent) == null ? void 0 : _m.length) || 0;
5831
+ }
5952
5832
  }
5953
- anchorNode = anchorNode.firstChild;
5954
- focusNode = focusNode.lastChild;
5955
- focusOffset = focusNode.length;
5956
5833
  }
5957
5834
  }
5835
+ if (!anchorNode || !focusNode) {
5836
+ return null;
5837
+ }
5958
5838
  if (IS_CHROME && hasShadowRoot(anchorNode) || IS_FIREFOX) {
5959
5839
  isCollapsed = domRange.anchorNode === domRange.focusNode && domRange.anchorOffset === domRange.focusOffset;
5960
5840
  } else {
@@ -5966,6 +5846,18 @@ const DOMEditor = {
5966
5846
  focusNode = domRange.endContainer;
5967
5847
  focusOffset = domRange.endOffset;
5968
5848
  isCollapsed = domRange.collapsed;
5849
+ if (IS_FIREFOX) {
5850
+ const anchorEl = (_p = (_o = (_n = anchorNode.previousSibling) == null ? void 0 : _n.firstChild) == null ? void 0 : _o.firstChild) == null ? void 0 : _p.firstChild;
5851
+ if (anchorNode.nodeType === 3 && anchorNode.textContent === "" && anchorEl) {
5852
+ anchorNode = anchorEl;
5853
+ anchorOffset = ((_q = anchorEl.textContent) == null ? void 0 : _q.length) || 0;
5854
+ }
5855
+ const focusEl = (_t = (_s = (_r = focusNode.previousSibling) == null ? void 0 : _r.lastChild) == null ? void 0 : _s.lastChild) == null ? void 0 : _t.lastChild;
5856
+ if (focusNode.nodeType === 3 && focusNode.textContent === "" && ((_w = (_v = (_u = focusNode.previousSibling) == null ? void 0 : _u.lastChild) == null ? void 0 : _v.lastChild) == null ? void 0 : _w.lastChild)) {
5857
+ focusNode = focusEl;
5858
+ focusOffset = ((_x = focusEl == null ? void 0 : focusEl.textContent) == null ? void 0 : _x.length) || 0;
5859
+ }
5860
+ }
5969
5861
  }
5970
5862
  }
5971
5863
  if (anchorNode == null || focusNode == null || anchorOffset == null || focusOffset == null) {
@@ -5973,7 +5865,7 @@ const DOMEditor = {
5973
5865
  `Cannot resolve a Slate range from DOM range: ${domRange}`
5974
5866
  );
5975
5867
  }
5976
- if (IS_FIREFOX && ((_c = focusNode.textContent) == null ? void 0 : _c.endsWith("\n\n")) && focusOffset === focusNode.textContent.length) {
5868
+ if (IS_FIREFOX && ((_y = focusNode.textContent) == null ? void 0 : _y.endsWith("\n\n")) && focusOffset === focusNode.textContent.length) {
5977
5869
  focusOffset--;
5978
5870
  }
5979
5871
  const anchor = DOMEditor.toSlatePoint(editor, [anchorNode, anchorOffset], {
@@ -6963,7 +6855,6 @@ const debug = (..._) => {
6963
6855
  const isDataTransfer = (value) => (value == null ? void 0 : value.constructor.name) === "DataTransfer";
6964
6856
  function createAndroidInputManager({
6965
6857
  editor,
6966
- scheduleOnDOMSelectionChange,
6967
6858
  onDOMSelectionChange
6968
6859
  }) {
6969
6860
  let flushing = false;
@@ -7001,7 +6892,7 @@ function createAndroidInputManager({
7001
6892
  }
7002
6893
  action.run();
7003
6894
  };
7004
- const flush = () => {
6895
+ const flush = async () => {
7005
6896
  var _a2, _b2;
7006
6897
  if (flushTimeoutId) {
7007
6898
  clearTimeout(flushTimeoutId);
@@ -7029,7 +6920,7 @@ function createAndroidInputManager({
7029
6920
  EDITOR_TO_PENDING_ACTION.get(editor),
7030
6921
  EDITOR_TO_PENDING_DIFFS.get(editor)
7031
6922
  );
7032
- let scheduleSelectionChange = hasPendingDiffs();
6923
+ hasPendingDiffs();
7033
6924
  let diff;
7034
6925
  while (diff = (_a2 = EDITOR_TO_PENDING_DIFFS.get(editor)) == null ? void 0 : _a2[0]) {
7035
6926
  const pendingMarks = EDITOR_TO_PENDING_INSERTION_MARKS.get(editor);
@@ -7056,13 +6947,10 @@ function createAndroidInputManager({
7056
6947
  )
7057
6948
  );
7058
6949
  if (!verifyDiffState(editor, diff)) {
7059
- scheduleSelectionChange = false;
7060
6950
  EDITOR_TO_PENDING_ACTION.delete(editor);
7061
6951
  EDITOR_TO_USER_MARKS.delete(editor);
7062
6952
  flushing = "action";
7063
6953
  EDITOR_TO_PENDING_SELECTION.delete(editor);
7064
- scheduleOnDOMSelectionChange.cancel();
7065
- onDOMSelectionChange.cancel();
7066
6954
  selectionRef == null ? void 0 : selectionRef.unref();
7067
6955
  }
7068
6956
  }
@@ -7074,11 +6962,7 @@ function createAndroidInputManager({
7074
6962
  performAction();
7075
6963
  return;
7076
6964
  }
7077
- if (scheduleSelectionChange) {
7078
- scheduleOnDOMSelectionChange();
7079
- }
7080
- scheduleOnDOMSelectionChange.flush();
7081
- onDOMSelectionChange.flush();
6965
+ await onDOMSelectionChange();
7082
6966
  applyPendingSelection();
7083
6967
  const userMarks = EDITOR_TO_USER_MARKS.get(editor);
7084
6968
  EDITOR_TO_USER_MARKS.delete(editor);
@@ -7140,18 +7024,16 @@ function createAndroidInputManager({
7140
7024
  diff: merged
7141
7025
  };
7142
7026
  };
7143
- const scheduleAction = (run, { at } = {}) => {
7027
+ const scheduleAction = async (run, { at } = {}) => {
7144
7028
  insertPositionHint = false;
7145
7029
  EDITOR_TO_PENDING_SELECTION.delete(editor);
7146
- scheduleOnDOMSelectionChange.cancel();
7147
- onDOMSelectionChange.cancel();
7148
7030
  if (hasPendingAction()) {
7149
- flush();
7031
+ await flush();
7150
7032
  }
7151
7033
  EDITOR_TO_PENDING_ACTION.set(editor, { at, run });
7152
7034
  actionTimeoutId = setTimeout(flush);
7153
7035
  };
7154
- const handleDOMBeforeInput = (event) => {
7036
+ const handleDOMBeforeInput = async (event) => {
7155
7037
  if (flushTimeoutId) {
7156
7038
  clearTimeout(flushTimeoutId);
7157
7039
  flushTimeoutId = null;
@@ -8173,33 +8055,31 @@ const Editable = defineComponent({
8173
8055
  );
8174
8056
  const state = reactive({
8175
8057
  isDraggingInternally: false,
8176
- isUpdatingSelection: false,
8177
8058
  latestElement: null
8178
8059
  });
8179
8060
  const placeholderHeight = ref();
8180
8061
  const onPlaceholderResize = (h2) => placeholderHeight.value = h2;
8181
8062
  const androidInputManagerRef = ref(null);
8182
- const processing = ref(false);
8183
- const onDOMSelectionChange = throttle(() => {
8184
- if (IS_NODE_MAP_DIRTY.get(editor)) {
8185
- onDOMSelectionChange();
8063
+ const onDOMSelectionChange = (event) => {
8064
+ const target = event == null ? void 0 : event.target;
8065
+ const targetElement = target instanceof HTMLElement ? target : null;
8066
+ const targetTagName = targetElement == null ? void 0 : targetElement.tagName;
8067
+ if (targetTagName === "INPUT" || targetTagName === "TEXTAREA") {
8186
8068
  return;
8187
8069
  }
8188
8070
  const el = DOMEditor.toDOMNode(editor, editor);
8189
8071
  const root2 = el.getRootNode();
8190
- if (!processing.value && IS_WEBKIT && root2 instanceof ShadowRoot) {
8191
- processing.value = true;
8072
+ if (IS_WEBKIT && root2 instanceof ShadowRoot) {
8192
8073
  const active = getActiveElement();
8193
8074
  if (active) {
8194
8075
  document.execCommand("indent");
8195
8076
  } else {
8196
8077
  Transforms.deselect(editor);
8197
8078
  }
8198
- processing.value = false;
8199
8079
  return;
8200
8080
  }
8201
8081
  const androidInputManager = androidInputManagerRef.value;
8202
- if ((IS_ANDROID || !DOMEditor.isComposing(editor)) && (!state.isUpdatingSelection || (androidInputManager == null ? void 0 : androidInputManager.isFlushing())) && !state.isDraggingInternally) {
8082
+ if ((IS_ANDROID || !DOMEditor.isComposing(editor)) && !state.isDraggingInternally) {
8203
8083
  const root22 = DOMEditor.findDocumentOrShadowRoot(editor);
8204
8084
  const { activeElement } = root22;
8205
8085
  const el2 = DOMEditor.toDOMNode(editor, editor);
@@ -8233,15 +8113,12 @@ const Editable = defineComponent({
8233
8113
  Transforms.deselect(editor);
8234
8114
  }
8235
8115
  }
8236
- }, 100);
8237
- const scheduleOnDOMSelectionChange = debounce(onDOMSelectionChange, 0);
8116
+ };
8238
8117
  const editableRef = ref();
8239
8118
  androidInputManagerRef.value = useAndroidInputManager({
8240
8119
  node: editableRef,
8241
- onDOMSelectionChange,
8242
- scheduleOnDOMSelectionChange
8120
+ onDOMSelectionChange
8243
8121
  });
8244
- const timeoutId = ref();
8245
8122
  const { onUserInput } = useRestoreDOM(editableRef, editor);
8246
8123
  onMounted(() => {
8247
8124
  let window2;
@@ -8253,8 +8130,6 @@ const Editable = defineComponent({
8253
8130
  }
8254
8131
  });
8255
8132
  onUnmounted(() => {
8256
- onDOMSelectionChange.cancel();
8257
- scheduleOnDOMSelectionChange.cancel();
8258
8133
  EDITOR_TO_ELEMENT.delete(editor);
8259
8134
  NODE_TO_ELEMENT.delete(editor);
8260
8135
  });
@@ -8269,7 +8144,7 @@ const Editable = defineComponent({
8269
8144
  return false;
8270
8145
  }
8271
8146
  });
8272
- const setDomSelection = (forceChange) => {
8147
+ const setDomSelection = () => {
8273
8148
  var _a2;
8274
8149
  const root2 = DOMEditor.findDocumentOrShadowRoot(editor);
8275
8150
  const domSelection = getSelection(root2);
@@ -8298,7 +8173,7 @@ const Editable = defineComponent({
8298
8173
  if (editorElement.contains(anchorNode) && editorElement.contains(focusNode)) {
8299
8174
  hasDomSelectionInEditor = true;
8300
8175
  }
8301
- if (hasDomSelection && hasDomSelectionInEditor && editor.selection && !forceChange) {
8176
+ if (hasDomSelection && hasDomSelectionInEditor && editor.selection) {
8302
8177
  const slateRange = DOMEditor.toSlateRange(editor, domSelection, {
8303
8178
  exactMatch: true,
8304
8179
  // domSelection is not necessarily a valid Slate range
@@ -8323,7 +8198,6 @@ const Editable = defineComponent({
8323
8198
  });
8324
8199
  return;
8325
8200
  }
8326
- state.isUpdatingSelection = true;
8327
8201
  let newDomRange = null;
8328
8202
  try {
8329
8203
  newDomRange = editor.selection && DOMEditor.toDOMRange(editor, editor.selection);
@@ -8353,16 +8227,7 @@ const Editable = defineComponent({
8353
8227
  }
8354
8228
  return newDomRange;
8355
8229
  };
8356
- const ensureDomSelection = (forceChange) => {
8357
- try {
8358
- const el = DOMEditor.toDOMNode(editor, editor);
8359
- el.focus();
8360
- setDomSelection(forceChange);
8361
- } catch (e2) {
8362
- }
8363
- };
8364
- const animationFrameId = ref();
8365
- const changeEffect = () => {
8230
+ useChangeEffect(() => {
8366
8231
  var _a2, _b2;
8367
8232
  const root2 = DOMEditor.findDocumentOrShadowRoot(editor);
8368
8233
  const domSelection = getSelection(root2);
@@ -8374,35 +8239,13 @@ const Editable = defineComponent({
8374
8239
  }
8375
8240
  const ensureSelection = ((_b2 = androidInputManagerRef.value) == null ? void 0 : _b2.isFlushing()) === "action";
8376
8241
  if (!IS_ANDROID || !ensureSelection) {
8377
- setTimeout(() => {
8378
- state.isUpdatingSelection = false;
8379
- });
8380
8242
  return;
8381
8243
  }
8382
- animationFrameId.value = requestAnimationFrame(() => {
8383
- if (ensureSelection) {
8384
- ensureDomSelection();
8385
- timeoutId.value = setTimeout(() => {
8386
- ensureDomSelection(true);
8387
- state.isUpdatingSelection = false;
8388
- });
8389
- }
8390
- });
8391
- };
8392
- useChangeEffect(changeEffect);
8393
- onUnmounted(() => {
8394
- animationFrameId.value && cancelAnimationFrame(animationFrameId.value);
8395
- if (timeoutId) {
8396
- clearTimeout(timeoutId.value);
8397
- }
8398
8244
  });
8399
8245
  const stoppedDragging = () => state.isDraggingInternally = false;
8400
8246
  onMounted(() => {
8401
8247
  const window2 = DOMEditor.getWindow(editor);
8402
- window2.document.addEventListener(
8403
- "selectionchange",
8404
- scheduleOnDOMSelectionChange
8405
- );
8248
+ window2.document.addEventListener("selectionchange", onDOMSelectionChange);
8406
8249
  window2.document.addEventListener("dragend", stoppedDragging);
8407
8250
  window2.document.addEventListener("drop", stoppedDragging);
8408
8251
  });
@@ -8410,12 +8253,12 @@ const Editable = defineComponent({
8410
8253
  const window2 = DOMEditor.getWindow(editor);
8411
8254
  window2.document.removeEventListener(
8412
8255
  "selectionchange",
8413
- scheduleOnDOMSelectionChange
8256
+ onDOMSelectionChange
8414
8257
  );
8415
8258
  window2.document.removeEventListener("dragend", stoppedDragging);
8416
8259
  window2.document.removeEventListener("drop", stoppedDragging);
8417
8260
  });
8418
- const onBeforeinput = (event) => {
8261
+ const onBeforeinput = async (event) => {
8419
8262
  var _a2, _b2, _c, _d;
8420
8263
  const isInputEvent = event instanceof InputEvent;
8421
8264
  if (!isInputEvent) {
@@ -8424,7 +8267,7 @@ const Editable = defineComponent({
8424
8267
  if (HAS_BEFORE_INPUT_SUPPORT) {
8425
8268
  const el = DOMEditor.toDOMNode(editor, editor);
8426
8269
  const root2 = el.getRootNode();
8427
- if ((processing == null ? void 0 : processing.value) && IS_WEBKIT && root2 instanceof ShadowRoot) {
8270
+ if (IS_WEBKIT && root2 instanceof ShadowRoot) {
8428
8271
  const ranges = event.getTargetRanges();
8429
8272
  const range2 = ranges[0];
8430
8273
  const newRange = new window.Range();
@@ -8444,8 +8287,6 @@ const Editable = defineComponent({
8444
8287
  if (androidInputManagerRef.value) {
8445
8288
  return androidInputManagerRef.value.handleDOMBeforeInput(event);
8446
8289
  }
8447
- scheduleOnDOMSelectionChange.flush();
8448
- onDOMSelectionChange.flush();
8449
8290
  const { selection } = editor;
8450
8291
  const { inputType } = event;
8451
8292
  const data = event.dataTransfer || event.data || void 0;
@@ -8632,7 +8473,7 @@ const Editable = defineComponent({
8632
8473
  }
8633
8474
  };
8634
8475
  const onBlur = (event) => {
8635
- if (readOnly || state.isUpdatingSelection || !DOMEditor.hasSelectableTarget(editor, event.target) || isEventHandled(event, attributes.onBlur)) {
8476
+ if (readOnly || !DOMEditor.hasSelectableTarget(editor, event.target) || isEventHandled(event, attributes.onBlur)) {
8636
8477
  return;
8637
8478
  }
8638
8479
  const root2 = DOMEditor.findDocumentOrShadowRoot(editor);
@@ -8814,7 +8655,7 @@ const Editable = defineComponent({
8814
8655
  }
8815
8656
  };
8816
8657
  const onFocus = (event) => {
8817
- if (!readOnly && !state.isUpdatingSelection && DOMEditor.hasEditableTarget(editor, event.target) && !isEventHandled(event, attributes.onFocus)) {
8658
+ if (!readOnly && DOMEditor.hasEditableTarget(editor, event.target) && !isEventHandled(event, attributes.onFocus)) {
8818
8659
  const el = DOMEditor.toDOMNode(editor, editor);
8819
8660
  const root2 = DOMEditor.findDocumentOrShadowRoot(editor);
8820
8661
  state.latestElement = root2.activeElement;
package/package.json CHANGED
@@ -1,67 +1,67 @@
1
- {
2
- "name": "slate-vue3",
3
- "version": "0.0.22",
4
- "type": "module",
5
- "main": "dist/index.js",
6
- "module": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "description": "slate-react library implemented with vue3",
9
- "files": [
10
- "dist/"
11
- ],
12
- "scripts": {
13
- "dev": "vite",
14
- "build": "vite build",
15
- "preview": "vite preview",
16
- "build-all": "vite build --mode=lib",
17
- "e2e": "playwright test",
18
- "e2e-ui": "playwright test --ui",
19
- "test": "vitest"
20
- },
21
- "dependencies": {
22
- "direction": "^2.0.1",
23
- "is-hotkey": "^0.2.0",
24
- "lodash-es": "^4.17.21",
25
- "scroll-into-view-if-needed": "^3.1.0"
26
- },
27
- "peerDependencies": {
28
- "vue": "^3.5.13"
29
- },
30
- "devDependencies": {
31
- "@faker-js/faker": "^9.4.0",
32
- "@playwright/test": "^1.50.1",
33
- "@testing-library/vue": "^8.1.0",
34
- "@types/is-hotkey": "^0.1.10",
35
- "@types/is-url": "^1.2.32",
36
- "@types/lodash-es": "^4.17.12",
37
- "@types/node": "^22.13.1",
38
- "@types/prismjs": "^1.26.5",
39
- "@vitejs/plugin-vue": "^5.2.1",
40
- "image-extensions": "^1.1.0",
41
- "is-url": "^1.2.4",
42
- "jsdom": "^26.0.0",
43
- "prismjs": "^1.29.0",
44
- "slate-hyperscript": "^0.100.0",
45
- "typescript": "~5.7.2",
46
- "vite": "^6.1.0",
47
- "vite-plugin-dts": "^4.5.0",
48
- "vitest": "^3.0.5",
49
- "vue-router": "^4.5.0"
50
- },
51
- "keywords": [
52
- "slate-vue3",
53
- "slate-vue",
54
- "slate",
55
- "editor",
56
- "contenteditable",
57
- "richtext",
58
- "rich",
59
- "editable",
60
- "markdown",
61
- "html"
62
- ],
63
- "repository": {
64
- "type": "git",
65
- "url": "https://github.com/Guan-Erjia/slate-vue3"
66
- }
67
- }
1
+ {
2
+ "name": "slate-vue3",
3
+ "version": "0.0.23",
4
+ "type": "module",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "description": "slate-react library implemented with vue3",
9
+ "files": [
10
+ "dist/"
11
+ ],
12
+ "scripts": {
13
+ "dev": "vite",
14
+ "build": "vite build",
15
+ "preview": "vite preview",
16
+ "build-all": "vite build --mode=lib",
17
+ "e2e": "playwright test",
18
+ "e2e-ui": "playwright test --ui",
19
+ "test": "vitest"
20
+ },
21
+ "dependencies": {
22
+ "direction": "^2.0.1",
23
+ "is-hotkey": "^0.2.0",
24
+ "lodash-es": "^4.17.21",
25
+ "scroll-into-view-if-needed": "^3.1.0"
26
+ },
27
+ "peerDependencies": {
28
+ "vue": "^3.5.13"
29
+ },
30
+ "devDependencies": {
31
+ "@faker-js/faker": "^9.4.0",
32
+ "@playwright/test": "^1.50.1",
33
+ "@testing-library/vue": "^8.1.0",
34
+ "@types/is-hotkey": "^0.1.10",
35
+ "@types/is-url": "^1.2.32",
36
+ "@types/lodash-es": "^4.17.12",
37
+ "@types/node": "^22.13.1",
38
+ "@types/prismjs": "^1.26.5",
39
+ "@vitejs/plugin-vue": "^5.2.1",
40
+ "image-extensions": "^1.1.0",
41
+ "is-url": "^1.2.4",
42
+ "jsdom": "^26.0.0",
43
+ "prismjs": "^1.29.0",
44
+ "slate-hyperscript": "^0.100.0",
45
+ "typescript": "~5.7.2",
46
+ "vite": "^6.1.0",
47
+ "vite-plugin-dts": "^4.5.0",
48
+ "vitest": "^3.0.5",
49
+ "vue-router": "^4.5.0"
50
+ },
51
+ "keywords": [
52
+ "slate-vue3",
53
+ "slate-vue",
54
+ "slate",
55
+ "editor",
56
+ "contenteditable",
57
+ "richtext",
58
+ "rich",
59
+ "editable",
60
+ "markdown",
61
+ "html"
62
+ ],
63
+ "repository": {
64
+ "type": "git",
65
+ "url": "https://github.com/Guan-Erjia/slate-vue3"
66
+ }
67
+ }