@prosekit/preact 0.1.1 → 0.1.3

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.
@@ -16,16 +16,13 @@ import { Keymap } from '@prosekit/core';
16
16
  import { Options } from 'tsup';
17
17
  import { PopoverOptions } from '@prosekit/lit/autocomplete-popover';
18
18
  import type { PopoverProps as PopoverProps_2 } from '@prosekit/lit/popover';
19
- import { UserProjectConfigExport } from 'vitest/dist/config.js';
19
+ import { Priority } from '@prosekit/core';
20
20
 
21
21
  declare const AutocompleteEmpty: ComponentType<AutocompleteEmptyProps>;
22
22
  export { AutocompleteEmpty }
23
23
  export { AutocompleteEmpty as AutocompleteEmpty_alias_1 }
24
24
 
25
- declare type AutocompleteEmptyProps = {
26
- class?: string;
27
- children?: ComponentChildren;
28
- } & AutocompleteEmptyProps_2;
25
+ declare type AutocompleteEmptyProps = PropsWithChildren<PropsWithClass<AutocompleteEmptyProps_2>>;
29
26
  export { AutocompleteEmptyProps }
30
27
  export { AutocompleteEmptyProps as AutocompleteEmptyProps_alias_1 }
31
28
 
@@ -33,10 +30,7 @@ declare const AutocompleteItem: ComponentType<AutocompleteItemProps>;
33
30
  export { AutocompleteItem }
34
31
  export { AutocompleteItem as AutocompleteItem_alias_1 }
35
32
 
36
- declare type AutocompleteItemProps = {
37
- class?: string;
38
- children?: ComponentChildren;
39
- } & AutocompleteItemProps_2;
33
+ declare type AutocompleteItemProps = PropsWithChildren<PropsWithClass<AutocompleteItemProps_2>>;
40
34
  export { AutocompleteItemProps }
41
35
  export { AutocompleteItemProps as AutocompleteItemProps_alias_1 }
42
36
 
@@ -44,10 +38,7 @@ declare const AutocompleteList: ComponentType<AutocompleteListProps>;
44
38
  export { AutocompleteList }
45
39
  export { AutocompleteList as AutocompleteList_alias_1 }
46
40
 
47
- declare type AutocompleteListProps = {
48
- class?: string;
49
- children?: ComponentChildren;
50
- } & AutocompleteListProps_2;
41
+ declare type AutocompleteListProps = PropsWithChildren<PropsWithClass<AutocompleteListProps_2>>;
51
42
  export { AutocompleteListProps }
52
43
  export { AutocompleteListProps as AutocompleteListProps_alias_1 }
53
44
 
@@ -55,10 +46,7 @@ declare const AutocompletePopover: ComponentType<AutocompletePopoverProps>;
55
46
  export { AutocompletePopover }
56
47
  export { AutocompletePopover as AutocompletePopover_alias_1 }
57
48
 
58
- declare type AutocompletePopoverProps = {
59
- class?: string;
60
- children?: ComponentChildren;
61
- } & AutocompletePopoverProps_2;
49
+ declare type AutocompletePopoverProps = PropsWithChildren<PropsWithClass<AutocompletePopoverProps_2>>;
62
50
  export { AutocompletePopoverProps }
63
51
  export { AutocompletePopoverProps as AutocompletePopoverProps_alias_1 }
64
52
 
@@ -66,33 +54,25 @@ export declare const ComboBox: ComponentType<ComboBoxProps>;
66
54
 
67
55
  export declare const ComboBoxInput: ComponentType<ComboBoxInputProps>;
68
56
 
69
- export declare type ComboBoxInputProps = {
70
- class?: string;
71
- children?: ComponentChildren;
72
- } & ComboBoxInputProps_2;
57
+ export declare type ComboBoxInputProps = PropsWithChildren<PropsWithClass<ComboBoxInputProps_2>>;
73
58
 
74
59
  export declare const ComboBoxItem: ComponentType<ComboBoxItemProps>;
75
60
 
76
- export declare type ComboBoxItemProps = {
77
- class?: string;
78
- children?: ComponentChildren;
79
- } & ComboBoxItemProps_2;
61
+ export declare type ComboBoxItemProps = PropsWithChildren<PropsWithClass<ComboBoxItemProps_2>>;
80
62
 
81
63
  export declare const ComboBoxList: ComponentType<ComboBoxListProps>;
82
64
 
83
- export declare type ComboBoxListProps = {
84
- class?: string;
85
- children?: ComponentChildren;
86
- } & ComboBoxListProps_2;
65
+ export declare type ComboBoxListProps = PropsWithChildren<PropsWithClass<ComboBoxListProps_2>>;
87
66
 
88
- export declare type ComboBoxProps = {
89
- class?: string;
90
- children?: ComponentChildren;
91
- } & ComboBoxProps_2;
67
+ export declare type ComboBoxProps = PropsWithChildren<PropsWithClass<ComboBoxProps_2>>;
92
68
 
93
69
  export declare const default_alias: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
94
70
 
95
- export declare const default_alias_1: UserProjectConfigExport;
71
+ export declare const default_alias_1: {
72
+ test: {
73
+ environment: "jsdom";
74
+ };
75
+ };
96
76
 
97
77
  export declare interface EditorContext {
98
78
  editor: Editor;
@@ -102,19 +82,32 @@ export declare const editorContext: Context<EditorContext | null>;
102
82
 
103
83
  export declare const InlinePopover: ComponentType<InlinePopoverProps>;
104
84
 
105
- export declare type InlinePopoverProps = {
106
- class?: string;
107
- children?: ComponentChildren;
108
- } & InlinePopoverProps_2;
85
+ export declare type InlinePopoverProps = PropsWithChildren<PropsWithClass<InlinePopoverProps_2>>;
109
86
 
110
87
  export declare const Popover: ComponentType<PopoverProps>;
111
88
 
112
89
  export { PopoverOptions }
113
90
 
114
- export declare type PopoverProps = {
115
- class?: string;
116
- children?: ComponentChildren;
117
- } & PopoverProps_2;
91
+ export declare type PopoverProps = PropsWithChildren<PropsWithClass<PopoverProps_2>>;
92
+
93
+ /**
94
+ * @internal
95
+ */
96
+ declare type PropsWithChildren<P = unknown> = P & {
97
+ children?: ComponentChildren | undefined;
98
+ };
99
+ export { PropsWithChildren }
100
+ export { PropsWithChildren as PropsWithChildren_alias_1 }
101
+
102
+ /**
103
+ * @internal
104
+ */
105
+ declare type PropsWithClass<P = unknown> = P & {
106
+ class?: string | undefined;
107
+ className?: string | undefined;
108
+ };
109
+ export { PropsWithClass }
110
+ export { PropsWithClass as PropsWithClass_alias_1 }
118
111
 
119
112
  declare const ProseKit: ComponentType<ProseKitProps>;
120
113
  export { ProseKit }
@@ -141,8 +134,12 @@ declare function useExtension<T extends Extension = Extension>(extension: T | nu
141
134
  export { useExtension }
142
135
  export { useExtension as useExtension_alias_1 }
143
136
 
144
- declare function useKeymap(keymap: Keymap): void;
137
+ declare function useKeymap(keymap: Keymap, options?: {
138
+ priority?: Priority;
139
+ }): void;
145
140
  export { useKeymap }
146
141
  export { useKeymap as useKeymap_alias_1 }
147
142
 
143
+ export declare function usePriorityExtension<T extends Extension = Extension>(extension: T | null, priority?: Priority | null): void;
144
+
148
145
  export { }
@@ -3,3 +3,5 @@ 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 { PropsWithChildren } from './_tsup-dts-rollup';
7
+ export { PropsWithClass } from './_tsup-dts-rollup';
@@ -39,10 +39,22 @@ function useExtension(extension) {
39
39
 
40
40
  // src/hooks/use-keymap.ts
41
41
  import { defineKeymap } from "@prosekit/core";
42
+ import { useMemo as useMemo2 } from "preact/hooks";
43
+
44
+ // src/hooks/use-priority-extension.ts
45
+ import { withPriority } from "@prosekit/core";
42
46
  import { useMemo } from "preact/hooks";
43
- function useKeymap(keymap) {
44
- const extension = useMemo(() => defineKeymap(keymap), [keymap]);
45
- useExtension(extension);
47
+ function usePriorityExtension(extension, priority) {
48
+ const extensionWithPriority = useMemo(() => {
49
+ return extension && priority ? withPriority(extension, priority) : extension;
50
+ }, [extension, priority]);
51
+ return useExtension(extensionWithPriority);
52
+ }
53
+
54
+ // src/hooks/use-keymap.ts
55
+ function useKeymap(keymap, options) {
56
+ const extension = useMemo2(() => defineKeymap(keymap), [keymap]);
57
+ usePriorityExtension(extension, options == null ? void 0 : options.priority);
46
58
  }
47
59
  export {
48
60
  ProseKit,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/preact",
3
3
  "type": "module",
4
- "version": "0.1.1",
4
+ "version": "0.1.3",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -85,8 +85,8 @@
85
85
  "dist"
86
86
  ],
87
87
  "dependencies": {
88
- "@prosekit/core": "^0.1.0",
89
- "@prosekit/lit": "^0.1.0"
88
+ "@prosekit/core": "^0.2.0",
89
+ "@prosekit/lit": "^0.1.5"
90
90
  },
91
91
  "peerDependencies": {
92
92
  "preact": ">= 9.0.0"
@@ -98,10 +98,10 @@
98
98
  },
99
99
  "devDependencies": {
100
100
  "@prosekit/dev": "*",
101
- "preact": "^10.19.2",
101
+ "preact": "^10.19.3",
102
102
  "tsup": "^8.0.1",
103
- "typescript": "^5.3.2",
104
- "vitest": "^0.34.6"
103
+ "typescript": "^5.3.3",
104
+ "vitest": "^1.1.0"
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 { PropsWithChildren, PropsWithClass } from './types'