@prosekit/vue 0.1.0 → 0.1.2
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 +55 -52
- package/dist/prosekit-vue.d.ts +3 -1
- package/dist/prosekit-vue.js +25 -12
- package/package.json +4 -4
- package/src/index.ts +5 -0
@@ -14,89 +14,74 @@ import { Options } from 'tsup';
|
|
14
14
|
import { PopoverOptions } from '@prosekit/lit/autocomplete-popover';
|
15
15
|
import { PopoverOptions as PopoverOptions_alias_1 } from '@prosekit/lit/inline-popover';
|
16
16
|
import { PopoverProps as PopoverProps_2 } from '@prosekit/lit/popover';
|
17
|
+
import { Priority } from '@prosekit/core';
|
17
18
|
import { Ref } from 'vue';
|
18
19
|
import { ShallowRef } from 'vue';
|
19
20
|
import { UserProjectConfigExport } from 'vitest/dist/config.js';
|
20
21
|
|
21
|
-
declare const AutocompleteEmpty: (props: {
|
22
|
+
declare const AutocompleteEmpty: (props: AutocompleteEmptyProps_2 & {
|
22
23
|
class?: string | undefined;
|
23
|
-
} &
|
24
|
+
} & {}) => any;
|
24
25
|
export { AutocompleteEmpty }
|
25
26
|
export { AutocompleteEmpty as AutocompleteEmpty_alias_1 }
|
26
27
|
|
27
|
-
declare type AutocompleteEmptyProps =
|
28
|
-
class?: string;
|
29
|
-
} & AutocompleteEmptyProps_2;
|
28
|
+
declare type AutocompleteEmptyProps = PropsWithClass<AutocompleteEmptyProps_2>;
|
30
29
|
export { AutocompleteEmptyProps }
|
31
30
|
export { AutocompleteEmptyProps as AutocompleteEmptyProps_alias_1 }
|
32
31
|
|
33
|
-
declare const AutocompleteItem: (props: {
|
32
|
+
declare const AutocompleteItem: (props: AutocompleteItemProps_2 & {
|
34
33
|
class?: string | undefined;
|
35
|
-
} &
|
34
|
+
} & {}) => any;
|
36
35
|
export { AutocompleteItem }
|
37
36
|
export { AutocompleteItem as AutocompleteItem_alias_1 }
|
38
37
|
|
39
|
-
declare type AutocompleteItemProps =
|
40
|
-
class?: string;
|
41
|
-
} & AutocompleteItemProps_2;
|
38
|
+
declare type AutocompleteItemProps = PropsWithClass<AutocompleteItemProps_2>;
|
42
39
|
export { AutocompleteItemProps }
|
43
40
|
export { AutocompleteItemProps as AutocompleteItemProps_alias_1 }
|
44
41
|
|
45
|
-
declare const AutocompleteList: (props: {
|
42
|
+
declare const AutocompleteList: (props: AutocompleteListProps_2 & {
|
46
43
|
class?: string | undefined;
|
47
|
-
} &
|
44
|
+
} & {}) => any;
|
48
45
|
export { AutocompleteList }
|
49
46
|
export { AutocompleteList as AutocompleteList_alias_1 }
|
50
47
|
|
51
|
-
declare type AutocompleteListProps =
|
52
|
-
class?: string;
|
53
|
-
} & AutocompleteListProps_2;
|
48
|
+
declare type AutocompleteListProps = PropsWithClass<AutocompleteListProps_2>;
|
54
49
|
export { AutocompleteListProps }
|
55
50
|
export { AutocompleteListProps as AutocompleteListProps_alias_1 }
|
56
51
|
|
57
|
-
declare const AutocompletePopover: (props: {
|
52
|
+
declare const AutocompletePopover: (props: AutocompletePopoverProps_2 & {
|
58
53
|
class?: string | undefined;
|
59
|
-
} &
|
54
|
+
} & {}) => any;
|
60
55
|
export { AutocompletePopover }
|
61
56
|
export { AutocompletePopover as AutocompletePopover_alias_1 }
|
62
57
|
|
63
|
-
declare type AutocompletePopoverProps =
|
64
|
-
class?: string;
|
65
|
-
} & AutocompletePopoverProps_2;
|
58
|
+
declare type AutocompletePopoverProps = PropsWithClass<AutocompletePopoverProps_2>;
|
66
59
|
export { AutocompletePopoverProps }
|
67
60
|
export { AutocompletePopoverProps as AutocompletePopoverProps_alias_1 }
|
68
61
|
|
69
|
-
export declare const ComboBox: (props: {
|
62
|
+
export declare const ComboBox: (props: ComboBoxProps_2 & {
|
70
63
|
class?: string | undefined;
|
71
|
-
} &
|
64
|
+
} & {}) => any;
|
72
65
|
|
73
|
-
export declare const ComboBoxInput: (props: {
|
66
|
+
export declare const ComboBoxInput: (props: ComboBoxInputProps_2 & {
|
74
67
|
class?: string | undefined;
|
75
|
-
} &
|
68
|
+
} & {}) => any;
|
76
69
|
|
77
|
-
export declare type ComboBoxInputProps =
|
78
|
-
class?: string;
|
79
|
-
} & ComboBoxInputProps_2;
|
70
|
+
export declare type ComboBoxInputProps = PropsWithClass<ComboBoxInputProps_2>;
|
80
71
|
|
81
|
-
export declare const ComboBoxItem: (props: {
|
72
|
+
export declare const ComboBoxItem: (props: ComboBoxItemProps_2 & {
|
82
73
|
class?: string | undefined;
|
83
|
-
} &
|
74
|
+
} & {}) => any;
|
84
75
|
|
85
|
-
export declare type ComboBoxItemProps =
|
86
|
-
class?: string;
|
87
|
-
} & ComboBoxItemProps_2;
|
76
|
+
export declare type ComboBoxItemProps = PropsWithClass<ComboBoxItemProps_2>;
|
88
77
|
|
89
|
-
export declare const ComboBoxList: (props: {
|
78
|
+
export declare const ComboBoxList: (props: ComboBoxListProps_2 & {
|
90
79
|
class?: string | undefined;
|
91
|
-
} &
|
80
|
+
} & {}) => any;
|
92
81
|
|
93
|
-
export declare type ComboBoxListProps =
|
94
|
-
class?: string;
|
95
|
-
} & ComboBoxListProps_2;
|
82
|
+
export declare type ComboBoxListProps = PropsWithClass<ComboBoxListProps_2>;
|
96
83
|
|
97
|
-
export declare type ComboBoxProps =
|
98
|
-
class?: string;
|
99
|
-
} & ComboBoxProps_2;
|
84
|
+
export declare type ComboBoxProps = PropsWithClass<ComboBoxProps_2>;
|
100
85
|
|
101
86
|
export declare const default_alias: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
|
102
87
|
|
@@ -104,29 +89,34 @@ export declare const default_alias_1: UserProjectConfigExport;
|
|
104
89
|
|
105
90
|
export declare function injectEditor(): Editor;
|
106
91
|
|
107
|
-
declare const InlinePopover: (props: {
|
92
|
+
declare const InlinePopover: (props: InlinePopoverProps_2 & {
|
108
93
|
class?: string | undefined;
|
109
|
-
} &
|
94
|
+
} & {}) => any;
|
110
95
|
export { InlinePopover }
|
111
96
|
export { InlinePopover as InlinePopover_alias_1 }
|
112
97
|
|
113
|
-
declare type InlinePopoverProps =
|
114
|
-
class?: string;
|
115
|
-
} & InlinePopoverProps_2;
|
98
|
+
declare type InlinePopoverProps = PropsWithClass<InlinePopoverProps_2>;
|
116
99
|
export { InlinePopoverProps }
|
117
100
|
export { InlinePopoverProps as InlinePopoverProps_alias_1 }
|
118
101
|
|
119
|
-
export declare const Popover: (props: {
|
102
|
+
export declare const Popover: (props: PopoverProps_2 & {
|
120
103
|
class?: string | undefined;
|
121
|
-
} &
|
104
|
+
} & {}) => any;
|
122
105
|
|
123
106
|
export { PopoverOptions }
|
124
107
|
|
125
108
|
export { PopoverOptions_alias_1 }
|
126
109
|
|
127
|
-
export declare type PopoverProps =
|
128
|
-
|
129
|
-
|
110
|
+
export declare type PopoverProps = PropsWithClass<PopoverProps_2>;
|
111
|
+
|
112
|
+
/**
|
113
|
+
* @internal
|
114
|
+
*/
|
115
|
+
declare type PropsWithClass<P = unknown> = P & {
|
116
|
+
class?: string | undefined;
|
117
|
+
};
|
118
|
+
export { PropsWithClass }
|
119
|
+
export { PropsWithClass as PropsWithClass_alias_1 }
|
130
120
|
|
131
121
|
declare const ProseKit: (props: ProseKitProps & {}) => any;
|
132
122
|
export { ProseKit }
|
@@ -150,10 +140,23 @@ declare function useEditor<E extends Extension = any>(options?: {
|
|
150
140
|
export { useEditor }
|
151
141
|
export { useEditor as useEditor_alias_1 }
|
152
142
|
|
153
|
-
|
143
|
+
/**
|
144
|
+
* Add an extension to the editor.
|
145
|
+
*
|
146
|
+
* It accepts a ref to an optional extension. If the extension is changed, the
|
147
|
+
* previous extension will be removed and the new one (if not null) will be
|
148
|
+
* added.
|
149
|
+
*/
|
150
|
+
declare function useExtension<T extends Extension = Extension>(extension: Ref<T | null>): void;
|
151
|
+
export { useExtension }
|
152
|
+
export { useExtension as useExtension_alias_1 }
|
154
153
|
|
155
|
-
declare function useKeymap(keymap: Ref<Keymap
|
154
|
+
declare function useKeymap(keymap: Ref<Keymap>, options?: {
|
155
|
+
priority?: Priority;
|
156
|
+
}): void;
|
156
157
|
export { useKeymap }
|
157
158
|
export { useKeymap as useKeymap_alias_1 }
|
158
159
|
|
160
|
+
export declare function usePriorityExtension<T extends Extension = Extension>(extension: Ref<T | null>, priority?: Priority | null): void;
|
161
|
+
|
159
162
|
export { }
|
package/dist/prosekit-vue.d.ts
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
export { ProseKit } from './_tsup-dts-rollup';
|
2
2
|
export { ProseKitProps } from './_tsup-dts-rollup';
|
3
|
-
export { useKeymap } from './_tsup-dts-rollup';
|
4
3
|
export { useEditor } from './_tsup-dts-rollup';
|
4
|
+
export { useExtension } from './_tsup-dts-rollup';
|
5
|
+
export { useKeymap } from './_tsup-dts-rollup';
|
6
|
+
export { PropsWithClass } from './_tsup-dts-rollup';
|
package/dist/prosekit-vue.js
CHANGED
@@ -29,14 +29,6 @@ var ProseKit = defineComponent(
|
|
29
29
|
{ props: ["editor"] }
|
30
30
|
);
|
31
31
|
|
32
|
-
// src/hooks/use-keymap.ts
|
33
|
-
import { defineKeymap } from "@prosekit/core";
|
34
|
-
import { computed, unref as unref2 } from "vue";
|
35
|
-
|
36
|
-
// src/hooks/use-extension.ts
|
37
|
-
import "@prosekit/core";
|
38
|
-
import { unref, watchPostEffect } from "vue";
|
39
|
-
|
40
32
|
// src/hooks/use-editor.ts
|
41
33
|
import { defineUpdateHandler } from "@prosekit/core";
|
42
34
|
import {
|
@@ -61,20 +53,41 @@ function useEditor(options) {
|
|
61
53
|
}
|
62
54
|
|
63
55
|
// src/hooks/use-extension.ts
|
56
|
+
import "@prosekit/core";
|
57
|
+
import { unref, watchPostEffect } from "vue";
|
64
58
|
function useExtension(extension) {
|
65
59
|
const editor = useEditor();
|
66
60
|
watchPostEffect((onCleanup) => {
|
67
|
-
|
61
|
+
const ext = unref(extension);
|
62
|
+
if (ext) {
|
63
|
+
onCleanup(editor.value.use(ext));
|
64
|
+
}
|
65
|
+
});
|
66
|
+
}
|
67
|
+
|
68
|
+
// src/hooks/use-keymap.ts
|
69
|
+
import { defineKeymap } from "@prosekit/core";
|
70
|
+
import { computed as computed2, unref as unref3 } from "vue";
|
71
|
+
|
72
|
+
// src/hooks/use-priority-extension.ts
|
73
|
+
import { withPriority } from "@prosekit/core";
|
74
|
+
import { computed, unref as unref2 } from "vue";
|
75
|
+
function usePriorityExtension(extension, priority) {
|
76
|
+
const extensionWithPriority = computed(() => {
|
77
|
+
const ext = unref2(extension);
|
78
|
+
return ext && priority ? withPriority(ext, priority) : ext;
|
68
79
|
});
|
80
|
+
return useExtension(extensionWithPriority);
|
69
81
|
}
|
70
82
|
|
71
83
|
// src/hooks/use-keymap.ts
|
72
|
-
function useKeymap(keymap) {
|
73
|
-
const extension =
|
74
|
-
|
84
|
+
function useKeymap(keymap, options) {
|
85
|
+
const extension = computed2(() => defineKeymap(unref3(keymap)));
|
86
|
+
usePriorityExtension(extension, options == null ? void 0 : options.priority);
|
75
87
|
}
|
76
88
|
export {
|
77
89
|
ProseKit,
|
78
90
|
useEditor,
|
91
|
+
useExtension,
|
79
92
|
useKeymap
|
80
93
|
};
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@prosekit/vue",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.1.
|
4
|
+
"version": "0.1.2",
|
5
5
|
"private": false,
|
6
6
|
"author": {
|
7
7
|
"name": "ocavue",
|
@@ -98,10 +98,10 @@
|
|
98
98
|
},
|
99
99
|
"devDependencies": {
|
100
100
|
"@prosekit/dev": "*",
|
101
|
-
"tsup": "^
|
102
|
-
"typescript": "^5.
|
101
|
+
"tsup": "^8.0.1",
|
102
|
+
"typescript": "^5.3.2",
|
103
103
|
"vitest": "^0.34.6",
|
104
|
-
"vue": "^3.3.
|
104
|
+
"vue": "^3.3.9"
|
105
105
|
},
|
106
106
|
"scripts": {
|
107
107
|
"build:tsup": "tsup",
|
package/src/index.ts
ADDED