slate-vue3 0.0.7 → 0.0.8

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.
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,108 +1,108 @@
1
- [<img src="https://raw.githubusercontent.com/ianstormtaylor/slate/main/docs/images/banner.png" />](https://github.com/ianstormtaylor/slate/raw/main/docs/images/banner.png)
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/">vue</a>
5
- </p>
6
- <br/>
7
-
8
- # Why use it?
9
-
10
- 1. Use vue internal response implementation to reduce the number of re-renderings
11
- 2. You can easily use vue-devtools to debug in a vue project
12
- 3. This library provides the same usage as slate-react
13
-
14
- # Demo
15
-
16
- Check out the [**live demo**](https://guan-erjia.github.io/slate-vue3/) of all of the examples
17
-
18
- # Hooks
19
-
20
- ## [useComposing](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-composing.ts)
21
-
22
- ```
23
- const useFocused: () => Ref<boolean, boolean>
24
- ```
25
-
26
- Get the current composing state of the editor. It deals with compositionstart, compositionupdate, compositionend events.
27
-
28
- Composition events are triggered by typing (composing) with a language that uses a composition character (e.g. Chinese, Japanese, Korean, etc.) example.
29
- Some basic Git commands are:
30
-
31
- ## [useFocused](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-focus.ts)
32
-
33
- ```
34
- const useFocused: () => Ref<boolean, boolean>
35
- ```
36
-
37
- Get the current focused state of the editor.
38
-
39
- ## [useReadOnly](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-read-only.ts)
40
-
41
- ```
42
- const useReadOnly: () => Ref<boolean, boolean>
43
- ```
44
-
45
- Get the current readOnly state of the editor.
46
-
47
- ## [useSelected](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-selected.ts)
48
-
49
- ```
50
- const useSelected: () => ComputedRef<boolean>
51
- ```
52
-
53
- Get the current selected state of an element.
54
-
55
- ## [useEditor](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-editor.ts)
56
-
57
- ```
58
- const useSlate: () => Editor;
59
- ```
60
-
61
- Get the current editor object from the React context. Re-renders the context whenever changes occur in the editor.
62
-
63
- ## [useSelection](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-selection.ts)
64
-
65
- ```
66
- const useSelection: () => ComputedRef<boolean>
67
- ```
68
-
69
- Get the current editor selection from the React context.
70
-
71
- # Packages
72
-
73
- **slate's codebase is monorepo managed with pnpm workspace**
74
-
75
- - [slate](https://github.com/Guan-Erjia/slate-vue3/tree/master/packages/slate)
76
- slate core logic, update synchronously with slate
77
- - [slate-dom](https://github.com/Guan-Erjia/slate-vue3/tree/master/packages/slate-dom)
78
- Implementation of slate on dom, update synchronously with slate-dom
79
- - [slate-vue](https://github.com/Guan-Erjia/slate-vue3/tree/master/packages/slate-vue)
80
- Vue components for rendering slate editors
81
- - [share-tools](https://github.com/Guan-Erjia/slate-vue3/tree/master/packages/share-tools)
82
- for special processing of proxy type data, obtain the raw pointer, isPlainObject declare
83
-
84
- # compact files of slate
85
-
86
- **reactive implement**
87
-
88
- 1. packages/slate/src/interfaces/text.ts 115:115
89
- 2. packages/slate/src/create-editor.ts 94:94
90
- 3. packages/slate/src/transforms-node/set-nodes.ts 18:18
91
-
92
- **remove immer**
93
-
94
- 1. packages/slate/src/interfaces/node.ts 365:365
95
- 2. packages/slate/src/interfaces/point.ts 103:103
96
- 3. packages/slate/src/interfaces/range.ts 224:224
97
- 4. packages/slate/src/interfaces/transforms/general.ts 322:333
98
-
99
- **rewrite implement for WeakMap**
100
-
101
- 1. packages/un-proxy-weakmap/src/index.ts
102
- 2. packages/slate-dom/src/utils/weak-maps.ts
103
-
104
- **import types from globalThis in slate-dom**
105
- 1. packages/slate-dom/src/index.ts
106
- 2. packages/slate-dom/src/plugin/dom-editor.ts
107
- 3. packages/slate-dom/src/utils/dom.ts
108
-
1
+ [<img src="https://raw.githubusercontent.com/ianstormtaylor/slate/main/docs/images/banner.png" />](https://github.com/ianstormtaylor/slate/raw/main/docs/images/banner.png)
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/">vue</a>
5
+ </p>
6
+ <br/>
7
+
8
+ # Why use it?
9
+
10
+ 1. Use vue internal response implementation to reduce the number of re-renderings
11
+ 2. You can easily use vue-devtools to debug in a vue project
12
+ 3. This library provides the same usage as slate-react
13
+
14
+ # Demo
15
+
16
+ Check out the [**live demo**](https://guan-erjia.github.io/slate-vue3/) of all of the examples
17
+
18
+ # Hooks
19
+
20
+ ## [useComposing](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-composing.ts)
21
+
22
+ ```
23
+ const useFocused: () => Ref<boolean, boolean>
24
+ ```
25
+
26
+ Get the current composing state of the editor. It deals with compositionstart, compositionupdate, compositionend events.
27
+
28
+ Composition events are triggered by typing (composing) with a language that uses a composition character (e.g. Chinese, Japanese, Korean, etc.) example.
29
+ Some basic Git commands are:
30
+
31
+ ## [useFocused](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-focus.ts)
32
+
33
+ ```
34
+ const useFocused: () => Ref<boolean, boolean>
35
+ ```
36
+
37
+ Get the current focused state of the editor.
38
+
39
+ ## [useReadOnly](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-read-only.ts)
40
+
41
+ ```
42
+ const useReadOnly: () => Ref<boolean, boolean>
43
+ ```
44
+
45
+ Get the current readOnly state of the editor.
46
+
47
+ ## [useSelected](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-selected.ts)
48
+
49
+ ```
50
+ const useSelected: () => ComputedRef<boolean>
51
+ ```
52
+
53
+ Get the current selected state of an element.
54
+
55
+ ## [useEditor](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-editor.ts)
56
+
57
+ ```
58
+ const useSlate: () => Editor;
59
+ ```
60
+
61
+ Get the current editor object from the React context. Re-renders the context whenever changes occur in the editor.
62
+
63
+ ## [useSelection](https://github.com/Guan-Erjia/slate-vue3/blob/master/packages/slate-vue/src/hooks/use-selection.ts)
64
+
65
+ ```
66
+ const useSelection: () => ComputedRef<boolean>
67
+ ```
68
+
69
+ Get the current editor selection from the React context.
70
+
71
+ # Packages
72
+
73
+ **slate's codebase is monorepo managed with pnpm workspace**
74
+
75
+ - [slate](https://github.com/Guan-Erjia/slate-vue3/tree/master/packages/slate)
76
+ slate core logic, update synchronously with slate
77
+ - [slate-dom](https://github.com/Guan-Erjia/slate-vue3/tree/master/packages/slate-dom)
78
+ Implementation of slate on dom, update synchronously with slate-dom
79
+ - [slate-vue](https://github.com/Guan-Erjia/slate-vue3/tree/master/packages/slate-vue)
80
+ Vue components for rendering slate editors
81
+ - [share-tools](https://github.com/Guan-Erjia/slate-vue3/tree/master/packages/share-tools)
82
+ for special processing of proxy type data, obtain the raw pointer, isPlainObject declare
83
+
84
+ # compact files of slate
85
+
86
+ **reactive implement**
87
+
88
+ 1. packages/slate/src/interfaces/text.ts 115:115
89
+ 2. packages/slate/src/create-editor.ts 94:94
90
+ 3. packages/slate/src/transforms-node/set-nodes.ts 18:18
91
+
92
+ **remove immer**
93
+
94
+ 1. packages/slate/src/interfaces/node.ts 365:365
95
+ 2. packages/slate/src/interfaces/point.ts 103:103
96
+ 3. packages/slate/src/interfaces/range.ts 224:224
97
+ 4. packages/slate/src/interfaces/transforms/general.ts 322:333
98
+
99
+ **rewrite implement for WeakMap**
100
+
101
+ 1. packages/share-tools/index.ts
102
+ 2. packages/slate-dom/src/utils/weak-maps.ts
103
+
104
+ **import types from globalThis in slate-dom**
105
+ 1. packages/slate-dom/src/index.ts
106
+ 2. packages/slate-dom/src/plugin/dom-editor.ts
107
+ 3. packages/slate-dom/src/utils/dom.ts
108
+
package/dist/index.d.ts CHANGED
@@ -2871,44 +2871,6 @@ declare module 'slate' {
2871
2871
  }
2872
2872
 
2873
2873
 
2874
- declare global {
2875
- interface Window {
2876
- MSStream: boolean;
2877
- }
2878
- interface DocumentOrShadowRoot {
2879
- getSelection(): Selection | null;
2880
- }
2881
- interface CaretPosition {
2882
- readonly offsetNode: Node;
2883
- readonly offset: number;
2884
- getClientRect(): DOMRect | null;
2885
- }
2886
- interface Document {
2887
- caretPositionFromPoint(x: number, y: number): CaretPosition | null;
2888
- }
2889
- interface Node {
2890
- getRootNode(options?: GetRootNodeOptions): Document | ShadowRoot;
2891
- }
2892
- }
2893
-
2894
-
2895
- declare module 'slate' {
2896
- interface CustomTypes {
2897
- Editor: DOMEditor;
2898
- Text: BaseText & {
2899
- placeholder?: string;
2900
- onPlaceholderResize?: (node: HTMLElement | null) => void;
2901
- [key: string]: unknown;
2902
- };
2903
- Range: BaseRange & {
2904
- placeholder?: string;
2905
- onPlaceholderResize?: (node: HTMLElement | null) => void;
2906
- [key: string]: unknown;
2907
- };
2908
- }
2909
- }
2910
-
2911
-
2912
2874
  declare global {
2913
2875
  interface Window {
2914
2876
  MSStream: boolean;
@@ -4929,14 +4929,14 @@ function baseIsSet(value) {
4929
4929
  }
4930
4930
  var nodeIsSet = nodeUtil && nodeUtil.isSet;
4931
4931
  var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
4932
- var CLONE_DEEP_FLAG$1 = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG$1 = 4;
4932
+ var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG$1 = 4;
4933
4933
  var argsTag = "[object Arguments]", arrayTag = "[object Array]", boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", objectTag = "[object Object]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", weakMapTag = "[object WeakMap]";
4934
4934
  var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
4935
4935
  var cloneableTags = {};
4936
4936
  cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
4937
4937
  cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
4938
4938
  function baseClone(value, bitmask, customizer, key, object, stack2) {
4939
- var result, isDeep = bitmask & CLONE_DEEP_FLAG$1, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG$1;
4939
+ var result, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG$1;
4940
4940
  if (result !== void 0) {
4941
4941
  return result;
4942
4942
  }
@@ -4992,9 +4992,9 @@ function baseClone(value, bitmask, customizer, key, object, stack2) {
4992
4992
  });
4993
4993
  return result;
4994
4994
  }
4995
- var CLONE_DEEP_FLAG = 1, CLONE_SYMBOLS_FLAG = 4;
4996
- function cloneDeep(value) {
4997
- return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
4995
+ var CLONE_SYMBOLS_FLAG = 4;
4996
+ function clone(value) {
4997
+ return baseClone(value, CLONE_SYMBOLS_FLAG);
4998
4998
  }
4999
4999
  var now = function() {
5000
5000
  return root.Date.now();
@@ -5235,7 +5235,7 @@ const Node = {
5235
5235
  )}`
5236
5236
  );
5237
5237
  }
5238
- let r2 = { children: cloneDeep(root2.children) };
5238
+ let r2 = { children: clone(root2.children) };
5239
5239
  const [start2, end2] = Range.edges(range2);
5240
5240
  const nodeEntries = Node.nodes(root2, {
5241
5241
  reverse: true,
@@ -5742,7 +5742,7 @@ const Point = {
5742
5742
  return isPlainObject(value) && typeof value.offset === "number" && Path.isPath(value.path);
5743
5743
  },
5744
5744
  transform(point2, op, options = {}) {
5745
- let p = cloneDeep(point2);
5745
+ let p = clone(point2);
5746
5746
  if (p === null) {
5747
5747
  return null;
5748
5748
  }
@@ -8246,7 +8246,7 @@ const unwrapNodes = (editor, options = {}) => {
8246
8246
  const wrapNodes = (editor, element, options = {}) => {
8247
8247
  Editor.withoutNormalizing(editor, () => {
8248
8248
  const { mode = "lowest", split = false, voids = false } = options;
8249
- let { match, at = editor.selection } = options;
8249
+ let { match, at = clone(editor.selection) } = options;
8250
8250
  if (!at) {
8251
8251
  return;
8252
8252
  }
package/package.json CHANGED
@@ -1,73 +1,73 @@
1
- {
2
- "name": "slate-vue3",
3
- "version": "0.0.7",
4
- "type": "module",
5
- "main": "dist/index.js",
6
- "module": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "files": [
9
- "dist/"
10
- ],
11
- "scripts": {
12
- "dev": "vite",
13
- "build": "vite build",
14
- "preview": "vite preview",
15
- "build-all": "vite build --mode=lib"
16
- },
17
- "dependencies": {
18
- "direction": "^2.0.1",
19
- "is-hotkey": "^0.2.0",
20
- "lodash-es": "^4.17.21",
21
- "scroll-into-view-if-needed": "^3.1.0",
22
- "slate-history": "^0.110.3"
23
- },
24
- "peerDependencies": {
25
- "vue": "^3.5.13"
26
- },
27
- "devDependencies": {
28
- "@faker-js/faker": "^9.4.0",
29
- "@types/is-hotkey": "^0.1.10",
30
- "@types/is-url": "^1.2.32",
31
- "@types/lodash-es": "^4.17.12",
32
- "@types/prismjs": "^1.26.5",
33
- "@vitejs/plugin-vue": "^5.2.1",
34
- "@vitejs/plugin-vue-jsx": "^4.1.1",
35
- "@vue/tsconfig": "^0.7.0",
36
- "image-extensions": "^1.1.0",
37
- "is-url": "^1.2.4",
38
- "prismjs": "^1.29.0",
39
- "typescript": "~5.7.2",
40
- "vite": "^6.0.11",
41
- "vite-plugin-dts": "^4.5.0",
42
- "vue-tsc": "^2.2.0",
43
- "slate-hyperscript": "^0.100.0",
44
- "vue-router": "^4.5.0"
45
- },
46
- "keywords": [
47
- "canvas",
48
- "contenteditable",
49
- "docs",
50
- "document",
51
- "edit",
52
- "editor",
53
- "editable",
54
- "html",
55
- "immutable",
56
- "markdown",
57
- "medium",
58
- "paper",
59
- "react",
60
- "rich",
61
- "richtext",
62
- "richtext",
63
- "slate",
64
- "slate-vue3",
65
- "text",
66
- "wysiwyg",
67
- "wysiwym"
68
- ],
69
- "repository": {
70
- "type": "git",
71
- "url": "https://github.com/Guan-Erjia/slate-vue3"
72
- }
73
- }
1
+ {
2
+ "name": "slate-vue3",
3
+ "version": "0.0.8",
4
+ "type": "module",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist/"
10
+ ],
11
+ "scripts": {
12
+ "dev": "vite",
13
+ "build": "vite build",
14
+ "preview": "vite preview",
15
+ "build-all": "vite build --mode=lib"
16
+ },
17
+ "dependencies": {
18
+ "direction": "^2.0.1",
19
+ "is-hotkey": "^0.2.0",
20
+ "lodash-es": "^4.17.21",
21
+ "scroll-into-view-if-needed": "^3.1.0",
22
+ "slate-history": "^0.110.3"
23
+ },
24
+ "peerDependencies": {
25
+ "vue": "^3.5.13"
26
+ },
27
+ "devDependencies": {
28
+ "@faker-js/faker": "^9.4.0",
29
+ "@types/is-hotkey": "^0.1.10",
30
+ "@types/is-url": "^1.2.32",
31
+ "@types/lodash-es": "^4.17.12",
32
+ "@types/prismjs": "^1.26.5",
33
+ "@vitejs/plugin-vue": "^5.2.1",
34
+ "@vitejs/plugin-vue-jsx": "^4.1.1",
35
+ "@vue/tsconfig": "^0.7.0",
36
+ "image-extensions": "^1.1.0",
37
+ "is-url": "^1.2.4",
38
+ "prismjs": "^1.29.0",
39
+ "typescript": "~5.7.2",
40
+ "vite": "^6.0.11",
41
+ "vite-plugin-dts": "^4.5.0",
42
+ "vue-tsc": "^2.2.0",
43
+ "slate-hyperscript": "^0.100.0",
44
+ "vue-router": "^4.5.0"
45
+ },
46
+ "keywords": [
47
+ "canvas",
48
+ "contenteditable",
49
+ "docs",
50
+ "document",
51
+ "edit",
52
+ "editor",
53
+ "editable",
54
+ "html",
55
+ "immutable",
56
+ "markdown",
57
+ "medium",
58
+ "paper",
59
+ "react",
60
+ "rich",
61
+ "richtext",
62
+ "richtext",
63
+ "slate",
64
+ "slate-vue3",
65
+ "text",
66
+ "wysiwyg",
67
+ "wysiwym"
68
+ ],
69
+ "repository": {
70
+ "type": "git",
71
+ "url": "https://github.com/Guan-Erjia/slate-vue3"
72
+ }
73
+ }
package/dist/1.woff2 DELETED
Binary file
package/dist/favicon.ico DELETED
Binary file