@prosekit/vue 0.4.4 → 0.4.6
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/dist/_tsup-dts-rollup.d.ts +50 -21
- package/dist/{chunk-YWS6VK6K.js → chunk-BD3KKHO6.js} +4 -1
- package/dist/{chunk-PDO4DKNH.js → chunk-VTKZWBOS.js} +1 -1
- package/dist/prosekit-vue-autocomplete.js +2 -2
- package/dist/prosekit-vue-block-handle.js +2 -2
- package/dist/prosekit-vue-inline-popover.js +2 -2
- package/dist/prosekit-vue-popover.js +2 -2
- package/dist/prosekit-vue-resizable.js +2 -2
- package/dist/prosekit-vue-table-handle.js +2 -2
- package/dist/prosekit-vue-tooltip.js +2 -2
- package/dist/prosekit-vue.d.ts +4 -0
- package/dist/prosekit-vue.js +93 -22
- package/package.json +9 -8
@@ -1,4 +1,3 @@
|
|
1
|
-
import type { Attrs } from '@prosekit/pm/model';
|
2
1
|
import { AutocompleteEmptyEvents } from '@prosekit/web/autocomplete';
|
3
2
|
import { AutocompleteEmptyProps as AutocompleteEmptyProps_2 } from '@prosekit/web/autocomplete';
|
4
3
|
import { AutocompleteItemEvents } from '@prosekit/web/autocomplete';
|
@@ -7,7 +6,6 @@ import { AutocompleteListEvents } from '@prosekit/web/autocomplete';
|
|
7
6
|
import { AutocompleteListProps as AutocompleteListProps_2 } from '@prosekit/web/autocomplete';
|
8
7
|
import { AutocompletePopoverEvents } from '@prosekit/web/autocomplete';
|
9
8
|
import { AutocompletePopoverProps as AutocompletePopoverProps_2 } from '@prosekit/web/autocomplete';
|
10
|
-
import { BaseNodeViewOptions } from '@prosekit/core';
|
11
9
|
import { BlockHandleAddEvents } from '@prosekit/web/block-handle';
|
12
10
|
import { BlockHandleAddProps as BlockHandleAddProps_2 } from '@prosekit/web/block-handle';
|
13
11
|
import { BlockHandleDraggableEvents } from '@prosekit/web/block-handle';
|
@@ -17,21 +15,22 @@ import { BlockHandlePopoverProps as BlockHandlePopoverProps_2 } from '@prosekit/
|
|
17
15
|
import { ComponentOptionsMixin } from 'vue';
|
18
16
|
import { ComponentProvideOptions } from 'vue';
|
19
17
|
import { ComputedRef } from 'vue';
|
20
|
-
import type {
|
21
|
-
import type {
|
18
|
+
import type { CoreMarkViewUserOptions } from '@prosemirror-adapter/core';
|
19
|
+
import type { CoreNodeViewUserOptions } from '@prosemirror-adapter/core';
|
22
20
|
import { config as default_alias_1 } from '@prosekit/dev/config-vitest';
|
23
21
|
import { DefineComponent } from 'vue';
|
24
22
|
import { DefineSetupFnComponent } from 'vue';
|
25
23
|
import { Editor } from '@prosekit/core';
|
26
24
|
import type { EditorState } from '@prosekit/pm/state';
|
27
|
-
import type { EditorView } from '@prosekit/pm/view';
|
28
25
|
import { EmitsOptions } from 'vue';
|
29
26
|
import { Extension } from '@prosekit/core';
|
30
27
|
import { HTMLAttributes } from 'vue';
|
31
28
|
import { InlinePopoverEvents } from '@prosekit/web/inline-popover';
|
32
29
|
import { InlinePopoverProps as InlinePopoverProps_2 } from '@prosekit/web/inline-popover';
|
33
30
|
import { Keymap } from '@prosekit/core';
|
31
|
+
import { MarkViewContext } from '@prosemirror-adapter/vue';
|
34
32
|
import { MaybeRefOrGetter } from 'vue';
|
33
|
+
import { NodeViewContext } from '@prosemirror-adapter/vue';
|
35
34
|
import { Options } from 'tsup';
|
36
35
|
import { PopoverContentEvents } from '@prosekit/web/popover';
|
37
36
|
import { PopoverContentProps as PopoverContentProps_2 } from '@prosekit/web/popover';
|
@@ -67,7 +66,6 @@ import { TooltipRootEvents } from '@prosekit/web/tooltip';
|
|
67
66
|
import { TooltipRootProps as TooltipRootProps_2 } from '@prosekit/web/tooltip';
|
68
67
|
import { TooltipTriggerEvents } from '@prosekit/web/tooltip';
|
69
68
|
import { TooltipTriggerProps as TooltipTriggerProps_2 } from '@prosekit/web/tooltip';
|
70
|
-
import { VNodeRef } from 'vue';
|
71
69
|
|
72
70
|
declare const AutocompleteEmpty: DefineSetupFnComponent<AutocompleteEmptyProps & HTMLAttributes, AutocompleteEmptyEmits>;
|
73
71
|
export { AutocompleteEmpty }
|
@@ -223,6 +221,15 @@ export declare const default_alias: Options | Options[] | ((overrideOptions: Opt
|
|
223
221
|
|
224
222
|
export { default_alias_1 }
|
225
223
|
|
224
|
+
/**
|
225
|
+
* Defines a mark view using a Vue component.
|
226
|
+
*
|
227
|
+
* @public
|
228
|
+
*/
|
229
|
+
declare function defineVueMarkView(options: VueMarkViewOptions): Extension;
|
230
|
+
export { defineVueMarkView }
|
231
|
+
export { defineVueMarkView as defineVueMarkView_alias_1 }
|
232
|
+
|
226
233
|
/**
|
227
234
|
* Defines a node view using a Vue component.
|
228
235
|
*
|
@@ -661,6 +668,40 @@ declare function useStateUpdate(handler: (state: EditorState) => void, options?:
|
|
661
668
|
export { useStateUpdate }
|
662
669
|
export { useStateUpdate as useStateUpdate_alias_1 }
|
663
670
|
|
671
|
+
/**
|
672
|
+
* @public
|
673
|
+
*/
|
674
|
+
declare type VueMarkViewComponent = DefineComponent<VueMarkViewProps, any, any>;
|
675
|
+
export { VueMarkViewComponent }
|
676
|
+
export { VueMarkViewComponent as VueMarkViewComponent_alias_1 }
|
677
|
+
|
678
|
+
/**
|
679
|
+
* Options for {@link defineVueMarkView}.
|
680
|
+
*
|
681
|
+
* @public
|
682
|
+
*/
|
683
|
+
declare interface VueMarkViewOptions extends CoreMarkViewUserOptions<VueMarkViewComponent> {
|
684
|
+
/**
|
685
|
+
* The name of the mark type.
|
686
|
+
*/
|
687
|
+
name: string;
|
688
|
+
}
|
689
|
+
export { VueMarkViewOptions }
|
690
|
+
export { VueMarkViewOptions as VueMarkViewOptions_alias_1 }
|
691
|
+
|
692
|
+
/**
|
693
|
+
* @public
|
694
|
+
*/
|
695
|
+
declare interface VueMarkViewProps extends MarkViewContext {
|
696
|
+
}
|
697
|
+
export { VueMarkViewProps }
|
698
|
+
export { VueMarkViewProps as VueMarkViewProps_alias_1 }
|
699
|
+
|
700
|
+
/**
|
701
|
+
* @internal
|
702
|
+
*/
|
703
|
+
export declare const VueMarkViewsConsumer: DefineComponent<{}, () => null, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
704
|
+
|
664
705
|
/**
|
665
706
|
* @public
|
666
707
|
*/
|
@@ -673,15 +714,11 @@ export { VueNodeViewComponent as VueNodeViewComponent_alias_1 }
|
|
673
714
|
*
|
674
715
|
* @public
|
675
716
|
*/
|
676
|
-
declare interface VueNodeViewOptions extends
|
717
|
+
declare interface VueNodeViewOptions extends CoreNodeViewUserOptions<VueNodeViewComponent> {
|
677
718
|
/**
|
678
719
|
* The name of the node type.
|
679
720
|
*/
|
680
721
|
name: string;
|
681
|
-
/**
|
682
|
-
* The Vue component to render the node.
|
683
|
-
*/
|
684
|
-
component: VueNodeViewComponent;
|
685
722
|
}
|
686
723
|
export { VueNodeViewOptions }
|
687
724
|
export { VueNodeViewOptions as VueNodeViewOptions_alias_1 }
|
@@ -689,15 +726,7 @@ export { VueNodeViewOptions as VueNodeViewOptions_alias_1 }
|
|
689
726
|
/**
|
690
727
|
* @public
|
691
728
|
*/
|
692
|
-
declare interface VueNodeViewProps {
|
693
|
-
contentRef: VNodeRef;
|
694
|
-
view: EditorView;
|
695
|
-
getPos: () => number | undefined;
|
696
|
-
setAttrs: (attrs: Attrs) => void;
|
697
|
-
node: ShallowRef<ProseMirrorNode>;
|
698
|
-
selected: ShallowRef<boolean>;
|
699
|
-
decorations: ShallowRef<readonly Decoration[]>;
|
700
|
-
innerDecorations: ShallowRef<DecorationSource>;
|
729
|
+
declare interface VueNodeViewProps extends NodeViewContext {
|
701
730
|
}
|
702
731
|
export { VueNodeViewProps }
|
703
732
|
export { VueNodeViewProps as VueNodeViewProps_alias_1 }
|
@@ -705,6 +734,6 @@ export { VueNodeViewProps as VueNodeViewProps_alias_1 }
|
|
705
734
|
/**
|
706
735
|
* @internal
|
707
736
|
*/
|
708
|
-
export declare const
|
737
|
+
export declare const VueNodeViewsConsumer: DefineComponent<{}, () => null, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
709
738
|
|
710
739
|
export { }
|
package/dist/prosekit-vue.d.ts
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
export { ProseKit } from './_tsup-dts-rollup.js';
|
2
2
|
export { ProseKitProps } from './_tsup-dts-rollup.js';
|
3
|
+
export { defineVueMarkView } from './_tsup-dts-rollup.js';
|
4
|
+
export { VueMarkViewComponent } from './_tsup-dts-rollup.js';
|
5
|
+
export { VueMarkViewOptions } from './_tsup-dts-rollup.js';
|
6
|
+
export { VueMarkViewProps } from './_tsup-dts-rollup.js';
|
3
7
|
export { defineVueNodeView } from './_tsup-dts-rollup.js';
|
4
8
|
export { VueNodeViewComponent } from './_tsup-dts-rollup.js';
|
5
9
|
export { VueNodeViewOptions } from './_tsup-dts-rollup.js';
|
package/dist/prosekit-vue.js
CHANGED
@@ -1,20 +1,23 @@
|
|
1
1
|
import {
|
2
2
|
provideEditor,
|
3
3
|
useEditorContext
|
4
|
-
} from "./chunk-
|
4
|
+
} from "./chunk-BD3KKHO6.js";
|
5
5
|
|
6
6
|
// src/components/prosekit.ts
|
7
7
|
import { ProsemirrorAdapterProvider } from "@prosemirror-adapter/vue";
|
8
|
-
import {
|
8
|
+
import {
|
9
|
+
defineComponent as defineComponent3,
|
10
|
+
h as h3
|
11
|
+
} from "vue";
|
9
12
|
|
10
|
-
// src/extensions/vue-
|
13
|
+
// src/extensions/vue-mark-view.ts
|
11
14
|
import {
|
12
|
-
|
13
|
-
|
15
|
+
defineMarkViewComponent,
|
16
|
+
defineMarkViewFactory
|
14
17
|
} from "@prosekit/core";
|
15
18
|
import {
|
16
|
-
|
17
|
-
|
19
|
+
useMarkViewContext,
|
20
|
+
useMarkViewFactory
|
18
21
|
} from "@prosemirror-adapter/vue";
|
19
22
|
import {
|
20
23
|
computed as computed2,
|
@@ -26,7 +29,10 @@ import {
|
|
26
29
|
import {
|
27
30
|
EditorNotFoundError
|
28
31
|
} from "@prosekit/core";
|
29
|
-
import {
|
32
|
+
import {
|
33
|
+
toValue,
|
34
|
+
watchPostEffect
|
35
|
+
} from "vue";
|
30
36
|
function useEditorExtension(editorRef, extensionRef) {
|
31
37
|
const editorContext = useEditorContext();
|
32
38
|
watchPostEffect((onCleanup) => {
|
@@ -42,8 +48,13 @@ function useEditorExtension(editorRef, extensionRef) {
|
|
42
48
|
}
|
43
49
|
|
44
50
|
// src/hooks/use-priority-extension.ts
|
45
|
-
import {
|
46
|
-
|
51
|
+
import {
|
52
|
+
withPriority
|
53
|
+
} from "@prosekit/core";
|
54
|
+
import {
|
55
|
+
computed,
|
56
|
+
toValue as toValue2
|
57
|
+
} from "vue";
|
47
58
|
function usePriorityExtension(extension, priority) {
|
48
59
|
return computed(() => {
|
49
60
|
const ext = toValue2(extension);
|
@@ -59,21 +70,74 @@ function useExtension(extension, options) {
|
|
59
70
|
);
|
60
71
|
}
|
61
72
|
|
73
|
+
// src/extensions/vue-mark-view.ts
|
74
|
+
function withMarkViewProps(component) {
|
75
|
+
return defineComponent({
|
76
|
+
name: "MarkViewPropsWrapper",
|
77
|
+
setup: () => {
|
78
|
+
const props = useMarkViewContext();
|
79
|
+
return () => h(component, props);
|
80
|
+
}
|
81
|
+
});
|
82
|
+
}
|
83
|
+
var VueMarkViewsConsumer = /* @__PURE__ */ defineComponent({
|
84
|
+
name: "VueMarkViewsConsumer",
|
85
|
+
setup: () => {
|
86
|
+
const markViewFactory = useMarkViewFactory();
|
87
|
+
const extension = computed2(() => {
|
88
|
+
return defineVueMarkViewFactory(markViewFactory);
|
89
|
+
});
|
90
|
+
useExtension(extension);
|
91
|
+
return () => null;
|
92
|
+
}
|
93
|
+
});
|
94
|
+
function defineVueMarkView(options) {
|
95
|
+
const { name, component, ...userOptions } = options;
|
96
|
+
const args = {
|
97
|
+
...userOptions,
|
98
|
+
component: withMarkViewProps(component)
|
99
|
+
};
|
100
|
+
return defineMarkViewComponent({
|
101
|
+
group: "vue",
|
102
|
+
name,
|
103
|
+
args
|
104
|
+
});
|
105
|
+
}
|
106
|
+
function defineVueMarkViewFactory(factory) {
|
107
|
+
return defineMarkViewFactory({
|
108
|
+
group: "vue",
|
109
|
+
factory
|
110
|
+
});
|
111
|
+
}
|
112
|
+
|
62
113
|
// src/extensions/vue-node-view.ts
|
114
|
+
import {
|
115
|
+
defineNodeViewComponent,
|
116
|
+
defineNodeViewFactory
|
117
|
+
} from "@prosekit/core";
|
118
|
+
import {
|
119
|
+
useNodeViewContext,
|
120
|
+
useNodeViewFactory
|
121
|
+
} from "@prosemirror-adapter/vue";
|
122
|
+
import {
|
123
|
+
computed as computed3,
|
124
|
+
defineComponent as defineComponent2,
|
125
|
+
h as h2
|
126
|
+
} from "vue";
|
63
127
|
function withNodeViewProps(component) {
|
64
|
-
return
|
128
|
+
return defineComponent2({
|
65
129
|
name: "NodeViewPropsWrapper",
|
66
130
|
setup: () => {
|
67
131
|
const props = useNodeViewContext();
|
68
|
-
return () =>
|
132
|
+
return () => h2(component, props);
|
69
133
|
}
|
70
134
|
});
|
71
135
|
}
|
72
|
-
var
|
73
|
-
name: "
|
136
|
+
var VueNodeViewsConsumer = /* @__PURE__ */ defineComponent2({
|
137
|
+
name: "VueNodeViewsConsumer",
|
74
138
|
setup: () => {
|
75
139
|
const nodeViewFactory = useNodeViewFactory();
|
76
|
-
const extension =
|
140
|
+
const extension = computed3(() => {
|
77
141
|
return defineVueNodeViewFactory(nodeViewFactory);
|
78
142
|
});
|
79
143
|
useExtension(extension);
|
@@ -100,14 +164,15 @@ function defineVueNodeViewFactory(factory) {
|
|
100
164
|
}
|
101
165
|
|
102
166
|
// src/components/prosekit.ts
|
103
|
-
var ProseKit =
|
167
|
+
var ProseKit = defineComponent3(
|
104
168
|
(props, { slots }) => {
|
105
169
|
provideEditor(props.editor);
|
106
170
|
return () => {
|
107
|
-
return
|
171
|
+
return h3(ProsemirrorAdapterProvider, null, () => {
|
108
172
|
var _a;
|
109
173
|
return [
|
110
|
-
|
174
|
+
h3(VueNodeViewsConsumer),
|
175
|
+
h3(VueMarkViewsConsumer),
|
111
176
|
(_a = slots.default) == null ? void 0 : _a.call(slots)
|
112
177
|
];
|
113
178
|
});
|
@@ -125,9 +190,9 @@ function useDocChange(handler, options) {
|
|
125
190
|
|
126
191
|
// src/hooks/use-editor.ts
|
127
192
|
import {
|
128
|
-
ProseKitError,
|
129
193
|
defineMountHandler,
|
130
194
|
defineUpdateHandler,
|
195
|
+
ProseKitError,
|
131
196
|
union
|
132
197
|
} from "@prosekit/core";
|
133
198
|
import {
|
@@ -161,10 +226,15 @@ function useEditor(options) {
|
|
161
226
|
}
|
162
227
|
|
163
228
|
// src/hooks/use-keymap.ts
|
164
|
-
import {
|
165
|
-
|
229
|
+
import {
|
230
|
+
defineKeymap
|
231
|
+
} from "@prosekit/core";
|
232
|
+
import {
|
233
|
+
computed as computed4,
|
234
|
+
toValue as toValue3
|
235
|
+
} from "vue";
|
166
236
|
function useKeymap(keymap, options) {
|
167
|
-
const extension =
|
237
|
+
const extension = computed4(() => defineKeymap(toValue3(keymap)));
|
168
238
|
return useExtension(extension, options);
|
169
239
|
}
|
170
240
|
|
@@ -176,6 +246,7 @@ function useStateUpdate(handler, options) {
|
|
176
246
|
}
|
177
247
|
export {
|
178
248
|
ProseKit,
|
249
|
+
defineVueMarkView,
|
179
250
|
defineVueNodeView,
|
180
251
|
useDocChange,
|
181
252
|
useEditor,
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@prosekit/vue",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.4.
|
4
|
+
"version": "0.4.6",
|
5
5
|
"private": false,
|
6
6
|
"author": {
|
7
7
|
"name": "ocavue",
|
@@ -70,10 +70,11 @@
|
|
70
70
|
"dist"
|
71
71
|
],
|
72
72
|
"dependencies": {
|
73
|
-
"@prosemirror-adapter/
|
74
|
-
"@
|
75
|
-
"@prosekit/
|
76
|
-
"@prosekit/
|
73
|
+
"@prosemirror-adapter/core": "^0.4.0",
|
74
|
+
"@prosemirror-adapter/vue": "^0.4.0",
|
75
|
+
"@prosekit/core": "^0.7.13",
|
76
|
+
"@prosekit/web": "^0.5.1",
|
77
|
+
"@prosekit/pm": "^0.1.9"
|
77
78
|
},
|
78
79
|
"peerDependencies": {
|
79
80
|
"vue": ">= 3.0.0"
|
@@ -86,9 +87,9 @@
|
|
86
87
|
"devDependencies": {
|
87
88
|
"@vue/test-utils": "^2.4.6",
|
88
89
|
"tsup": "^8.3.5",
|
89
|
-
"typescript": "
|
90
|
-
"vitest": "^2.1.
|
91
|
-
"vue": "^3.5.
|
90
|
+
"typescript": "~5.6.3",
|
91
|
+
"vitest": "^2.1.8",
|
92
|
+
"vue": "^3.5.13",
|
92
93
|
"@prosekit/dev": "0.0.0"
|
93
94
|
},
|
94
95
|
"scripts": {
|