@prosekit/vue 0.1.1 → 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.
@@ -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
- } & AutocompleteEmptyProps_2 & {}) => any;
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
- } & AutocompleteItemProps_2 & {}) => any;
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
- } & AutocompleteListProps_2 & {}) => any;
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
- } & AutocompletePopoverProps_2 & {}) => any;
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
- } & ComboBoxProps_2 & {}) => any;
64
+ } & {}) => any;
72
65
 
73
- export declare const ComboBoxInput: (props: {
66
+ export declare const ComboBoxInput: (props: ComboBoxInputProps_2 & {
74
67
  class?: string | undefined;
75
- } & ComboBoxInputProps_2 & {}) => any;
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
- } & ComboBoxItemProps_2 & {}) => any;
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
- } & ComboBoxListProps_2 & {}) => any;
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
- } & InlinePopoverProps_2 & {}) => any;
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
- } & PopoverProps_2 & {}) => any;
104
+ } & {}) => any;
122
105
 
123
106
  export { PopoverOptions }
124
107
 
125
108
  export { PopoverOptions_alias_1 }
126
109
 
127
- export declare type PopoverProps = {
128
- class?: string;
129
- } & PopoverProps_2;
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 }
@@ -161,8 +151,12 @@ declare function useExtension<T extends Extension = Extension>(extension: Ref<T
161
151
  export { useExtension }
162
152
  export { useExtension as useExtension_alias_1 }
163
153
 
164
- declare function useKeymap(keymap: Ref<Keymap>): void;
154
+ declare function useKeymap(keymap: Ref<Keymap>, options?: {
155
+ priority?: Priority;
156
+ }): void;
165
157
  export { useKeymap }
166
158
  export { useKeymap as useKeymap_alias_1 }
167
159
 
160
+ export declare function usePriorityExtension<T extends Extension = Extension>(extension: Ref<T | null>, priority?: Priority | null): void;
161
+
168
162
  export { }
@@ -3,3 +3,4 @@ export { ProseKitProps } from './_tsup-dts-rollup';
3
3
  export { useEditor } from './_tsup-dts-rollup';
4
4
  export { useExtension } from './_tsup-dts-rollup';
5
5
  export { useKeymap } from './_tsup-dts-rollup';
6
+ export { PropsWithClass } from './_tsup-dts-rollup';
@@ -67,10 +67,23 @@ function useExtension(extension) {
67
67
 
68
68
  // src/hooks/use-keymap.ts
69
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";
70
74
  import { computed, unref as unref2 } from "vue";
71
- function useKeymap(keymap) {
72
- const extension = computed(() => defineKeymap(unref2(keymap)));
73
- useExtension(extension);
75
+ function usePriorityExtension(extension, priority) {
76
+ const extensionWithPriority = computed(() => {
77
+ const ext = unref2(extension);
78
+ return ext && priority ? withPriority(ext, priority) : ext;
79
+ });
80
+ return useExtension(extensionWithPriority);
81
+ }
82
+
83
+ // src/hooks/use-keymap.ts
84
+ function useKeymap(keymap, options) {
85
+ const extension = computed2(() => defineKeymap(unref3(keymap)));
86
+ usePriorityExtension(extension, options == null ? void 0 : options.priority);
74
87
  }
75
88
  export {
76
89
  ProseKit,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/vue",
3
3
  "type": "module",
4
- "version": "0.1.1",
4
+ "version": "0.1.2",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -101,7 +101,7 @@
101
101
  "tsup": "^8.0.1",
102
102
  "typescript": "^5.3.2",
103
103
  "vitest": "^0.34.6",
104
- "vue": "^3.3.8"
104
+ "vue": "^3.3.9"
105
105
  },
106
106
  "scripts": {
107
107
  "build:tsup": "tsup",
package/src/index.ts CHANGED
@@ -2,3 +2,4 @@ export { ProseKit, type ProseKitProps } from './components/prosekit'
2
2
  export { useEditor } from './hooks/use-editor'
3
3
  export { useExtension } from './hooks/use-extension'
4
4
  export { useKeymap } from './hooks/use-keymap'
5
+ export type { PropsWithClass } from './types'