@prosekit/preact 0.2.6 → 0.3.0

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.
Files changed (39) hide show
  1. package/dist/_tsup-dts-rollup.d.ts +73 -67
  2. package/dist/chunk-5LWA54E4.js +50 -0
  3. package/dist/chunk-V253IGNY.js +13 -0
  4. package/dist/prosekit-preact-autocomplete.d.ts +4 -0
  5. package/dist/prosekit-preact-autocomplete.js +50 -0
  6. package/dist/prosekit-preact-block-handle.d.ts +2 -0
  7. package/dist/prosekit-preact-block-handle.js +28 -0
  8. package/dist/prosekit-preact-inline-popover.d.ts +0 -1
  9. package/dist/prosekit-preact-inline-popover.js +14 -6
  10. package/dist/prosekit-preact-popover.d.ts +3 -2
  11. package/dist/prosekit-preact-popover.js +37 -7
  12. package/dist/prosekit-preact-resizable.d.ts +2 -2
  13. package/dist/prosekit-preact-resizable.js +26 -7
  14. package/dist/prosekit-preact-tooltip.d.ts +3 -0
  15. package/dist/prosekit-preact-tooltip.js +39 -0
  16. package/dist/prosekit-preact.js +7 -13
  17. package/package.json +26 -88
  18. package/dist/prosekit-preact-autocomplete-empty.d.ts +0 -2
  19. package/dist/prosekit-preact-autocomplete-empty.js +0 -9
  20. package/dist/prosekit-preact-autocomplete-item.d.ts +0 -2
  21. package/dist/prosekit-preact-autocomplete-item.js +0 -9
  22. package/dist/prosekit-preact-autocomplete-list.d.ts +0 -2
  23. package/dist/prosekit-preact-autocomplete-list.js +0 -9
  24. package/dist/prosekit-preact-autocomplete-popover.d.ts +0 -3
  25. package/dist/prosekit-preact-autocomplete-popover.js +0 -9
  26. package/dist/prosekit-preact-block-popover.d.ts +0 -2
  27. package/dist/prosekit-preact-block-popover.js +0 -9
  28. package/dist/prosekit-preact-combo-box-input.d.ts +0 -2
  29. package/dist/prosekit-preact-combo-box-input.js +0 -9
  30. package/dist/prosekit-preact-combo-box-item.d.ts +0 -2
  31. package/dist/prosekit-preact-combo-box-item.js +0 -9
  32. package/dist/prosekit-preact-combo-box-list.d.ts +0 -2
  33. package/dist/prosekit-preact-combo-box-list.js +0 -9
  34. package/dist/prosekit-preact-combo-box.d.ts +0 -2
  35. package/dist/prosekit-preact-combo-box.js +0 -9
  36. package/dist/prosekit-preact-drag-handle.d.ts +0 -2
  37. package/dist/prosekit-preact-drag-handle.js +0 -9
  38. package/dist/prosekit-preact-resizable-handle.d.ts +0 -2
  39. package/dist/prosekit-preact-resizable-handle.js +0 -9
@@ -1,80 +1,72 @@
1
- import type { AutocompleteEmptyProps as AutocompleteEmptyProps_2 } from '@prosekit/lit/autocomplete-empty';
2
- import type { AutocompleteItemProps as AutocompleteItemProps_2 } from '@prosekit/lit/autocomplete-item';
3
- import type { AutocompleteListProps as AutocompleteListProps_2 } from '@prosekit/lit/autocomplete-list';
4
- import type { AutocompletePopoverProps as AutocompletePopoverProps_2 } from '@prosekit/lit/autocomplete-popover';
5
- import type { BlockPopoverProps as BlockPopoverProps_2 } from '@prosekit/lit/block-popover';
6
- import type { ComboBoxInputProps as ComboBoxInputProps_2 } from '@prosekit/lit/combo-box-input';
7
- import type { ComboBoxItemProps as ComboBoxItemProps_2 } from '@prosekit/lit/combo-box-item';
8
- import type { ComboBoxListProps as ComboBoxListProps_2 } from '@prosekit/lit/combo-box-list';
9
- import type { ComboBoxProps as ComboBoxProps_2 } from '@prosekit/lit/combo-box';
1
+ import { AutocompleteEmptyElement } from '@prosekit/web/autocomplete';
2
+ import { AutocompleteEmptyProps } from '@prosekit/web/autocomplete';
3
+ import { AutocompleteItemElement } from '@prosekit/web/autocomplete';
4
+ import { AutocompleteItemProps } from '@prosekit/web/autocomplete';
5
+ import { AutocompleteListElement } from '@prosekit/web/autocomplete';
6
+ import { AutocompleteListProps } from '@prosekit/web/autocomplete';
7
+ import { AutocompletePopoverElement } from '@prosekit/web/autocomplete';
8
+ import { AutocompletePopoverProps } from '@prosekit/web/autocomplete';
9
+ import { BlockDragHandleElement } from '@prosekit/web/block-handle';
10
+ import { BlockDragHandleProps } from '@prosekit/web/block-handle';
11
+ import { BlockPopoverElement } from '@prosekit/web/block-handle';
12
+ import { BlockPopoverProps } from '@prosekit/web/block-handle';
10
13
  import { ComponentChildren } from 'preact';
11
14
  import { ComponentType } from 'preact';
12
- import type { DragHandleProps as DragHandleProps_2 } from '@prosekit/lit/drag-handle';
13
15
  import { Editor } from '@prosekit/core';
14
16
  import type { EditorState } from '@prosekit/pm/state';
15
17
  import { Extension } from '@prosekit/core';
16
- import type { InlinePopoverProps as InlinePopoverProps_2 } from '@prosekit/lit/inline-popover';
18
+ import { ForwardRefExoticComponent } from 'preact/compat';
19
+ import { HTMLAttributes } from 'preact/compat';
20
+ import { InlinePopoverElement } from '@prosekit/web/inline-popover';
21
+ import { InlinePopoverProps } from '@prosekit/web/inline-popover';
17
22
  import { Keymap } from '@prosekit/core';
18
23
  import { Options } from 'tsup';
19
- import type { PopoverProps as PopoverProps_2 } from '@prosekit/lit/popover';
20
- import { PositioningOptions } from '@prosekit/lit/autocomplete-popover';
24
+ import { PopoverContentElement } from '@prosekit/web/popover';
25
+ import { PopoverContentProps } from '@prosekit/web/popover';
26
+ import { PopoverRootElement } from '@prosekit/web/popover';
27
+ import { PopoverRootProps } from '@prosekit/web/popover';
28
+ import { PopoverTriggerElement } from '@prosekit/web/popover';
29
+ import { PopoverTriggerProps } from '@prosekit/web/popover';
21
30
  import { Priority } from '@prosekit/core';
22
31
  import type { ProseMirrorNode } from '@prosekit/pm/model';
23
32
  import { Provider } from 'preact';
24
- import type { ResizableHandleProps as ResizableHandleProps_2 } from '@prosekit/lit/resizable-handle';
25
- import type { ResizableProps as ResizableProps_2 } from '@prosekit/lit/resizable';
26
-
27
- declare const AutocompleteEmpty: ComponentType<AutocompleteEmptyProps>;
33
+ import { RefAttributes } from 'preact/compat';
34
+ import { ResizableHandleElement } from '@prosekit/web/resizable';
35
+ import { ResizableHandleProps } from '@prosekit/web/resizable';
36
+ import { ResizableRootElement } from '@prosekit/web/resizable';
37
+ import { ResizableRootProps } from '@prosekit/web/resizable';
38
+ import { TooltipContentElement } from '@prosekit/web/tooltip';
39
+ import { TooltipContentProps } from '@prosekit/web/tooltip';
40
+ import { TooltipRootElement } from '@prosekit/web/tooltip';
41
+ import { TooltipRootProps } from '@prosekit/web/tooltip';
42
+ import { TooltipTriggerElement } from '@prosekit/web/tooltip';
43
+ import { TooltipTriggerProps } from '@prosekit/web/tooltip';
44
+
45
+ declare const AutocompleteEmpty: ForwardRefExoticComponent<Partial<AutocompleteEmptyProps> & RefAttributes<AutocompleteEmptyElement> & HTMLAttributes<AutocompleteEmptyElement>>;
28
46
  export { AutocompleteEmpty }
29
47
  export { AutocompleteEmpty as AutocompleteEmpty_alias_1 }
30
48
 
31
- declare type AutocompleteEmptyProps = PropsWithChildren<PropsWithClass<AutocompleteEmptyProps_2>>;
32
- export { AutocompleteEmptyProps }
33
- export { AutocompleteEmptyProps as AutocompleteEmptyProps_alias_1 }
34
-
35
- declare const AutocompleteItem: ComponentType<AutocompleteItemProps>;
49
+ declare const AutocompleteItem: ForwardRefExoticComponent<Partial<AutocompleteItemProps> & RefAttributes<AutocompleteItemElement> & HTMLAttributes<AutocompleteItemElement>>;
36
50
  export { AutocompleteItem }
37
51
  export { AutocompleteItem as AutocompleteItem_alias_1 }
38
52
 
39
- declare type AutocompleteItemProps = PropsWithChildren<PropsWithClass<AutocompleteItemProps_2>>;
40
- export { AutocompleteItemProps }
41
- export { AutocompleteItemProps as AutocompleteItemProps_alias_1 }
42
-
43
- declare const AutocompleteList: ComponentType<AutocompleteListProps>;
53
+ declare const AutocompleteList: ForwardRefExoticComponent<Partial<AutocompleteListProps> & RefAttributes<AutocompleteListElement> & HTMLAttributes<AutocompleteListElement>>;
44
54
  export { AutocompleteList }
45
55
  export { AutocompleteList as AutocompleteList_alias_1 }
46
56
 
47
- declare type AutocompleteListProps = PropsWithChildren<PropsWithClass<AutocompleteListProps_2>>;
48
- export { AutocompleteListProps }
49
- export { AutocompleteListProps as AutocompleteListProps_alias_1 }
50
-
51
- declare const AutocompletePopover: ComponentType<AutocompletePopoverProps>;
57
+ declare const AutocompletePopover: ForwardRefExoticComponent<Partial<AutocompletePopoverProps> & RefAttributes<AutocompletePopoverElement> & HTMLAttributes<AutocompletePopoverElement>>;
52
58
  export { AutocompletePopover }
53
59
  export { AutocompletePopover as AutocompletePopover_alias_1 }
54
60
 
55
- declare type AutocompletePopoverProps = PropsWithChildren<PropsWithClass<AutocompletePopoverProps_2>>;
56
- export { AutocompletePopoverProps }
57
- export { AutocompletePopoverProps as AutocompletePopoverProps_alias_1 }
58
-
59
- export declare const BlockPopover: ComponentType<BlockPopoverProps>;
60
-
61
- export declare type BlockPopoverProps = PropsWithChildren<PropsWithClass<BlockPopoverProps_2>>;
62
-
63
- export declare const ComboBox: ComponentType<ComboBoxProps>;
64
-
65
- export declare const ComboBoxInput: ComponentType<ComboBoxInputProps>;
61
+ declare const BlockDragHandle: ForwardRefExoticComponent<Partial<BlockDragHandleProps> & RefAttributes<BlockDragHandleElement> & HTMLAttributes<BlockDragHandleElement>>;
62
+ export { BlockDragHandle }
63
+ export { BlockDragHandle as BlockDragHandle_alias_1 }
66
64
 
67
- export declare type ComboBoxInputProps = PropsWithChildren<PropsWithClass<ComboBoxInputProps_2>>;
65
+ declare const BlockPopover: ForwardRefExoticComponent<Partial<BlockPopoverProps> & RefAttributes<BlockPopoverElement> & HTMLAttributes<BlockPopoverElement>>;
66
+ export { BlockPopover }
67
+ export { BlockPopover as BlockPopover_alias_1 }
68
68
 
69
- export declare const ComboBoxItem: ComponentType<ComboBoxItemProps>;
70
-
71
- export declare type ComboBoxItemProps = PropsWithChildren<PropsWithClass<ComboBoxItemProps_2>>;
72
-
73
- export declare const ComboBoxList: ComponentType<ComboBoxListProps>;
74
-
75
- export declare type ComboBoxListProps = PropsWithChildren<PropsWithClass<ComboBoxListProps_2>>;
76
-
77
- export declare type ComboBoxProps = PropsWithChildren<PropsWithClass<ComboBoxProps_2>>;
69
+ export declare function createComponent<Props extends object, CustomElement extends HTMLElement>(tagName: string, displayName: string, defaultProps: Props): ForwardRefExoticComponent<Partial<Props> & RefAttributes<CustomElement> & HTMLAttributes<CustomElement>>;
78
70
 
79
71
  export declare const default_alias: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
80
72
 
@@ -84,24 +76,26 @@ export declare const default_alias_1: {
84
76
  };
85
77
  };
86
78
 
87
- export declare const DragHandle: ComponentType<DragHandleProps>;
88
-
89
- export declare type DragHandleProps = PropsWithChildren<PropsWithClass<DragHandleProps_2>>;
90
-
91
79
  /**
92
80
  * @internal
93
81
  */
94
82
  export declare const EditorContextProvider: Provider<Editor<any> | null>;
95
83
 
96
- export declare const InlinePopover: ComponentType<InlinePopoverProps>;
84
+ declare const InlinePopover: ForwardRefExoticComponent<Partial<InlinePopoverProps> & RefAttributes<InlinePopoverElement> & HTMLAttributes<InlinePopoverElement>>;
85
+ export { InlinePopover }
86
+ export { InlinePopover as InlinePopover_alias_1 }
97
87
 
98
- export declare type InlinePopoverProps = PropsWithChildren<PropsWithClass<InlinePopoverProps_2>>;
88
+ declare const PopoverContent: ForwardRefExoticComponent<Partial<PopoverContentProps> & RefAttributes<PopoverContentElement> & HTMLAttributes<PopoverContentElement>>;
89
+ export { PopoverContent }
90
+ export { PopoverContent as PopoverContent_alias_1 }
99
91
 
100
- export declare const Popover: ComponentType<PopoverProps>;
92
+ declare const PopoverRoot: ForwardRefExoticComponent<Partial<PopoverRootProps> & RefAttributes<PopoverRootElement> & HTMLAttributes<PopoverRootElement>>;
93
+ export { PopoverRoot }
94
+ export { PopoverRoot as PopoverRoot_alias_1 }
101
95
 
102
- export declare type PopoverProps = PropsWithChildren<PropsWithClass<PopoverProps_2>>;
103
-
104
- export { PositioningOptions }
96
+ declare const PopoverTrigger: ForwardRefExoticComponent<Partial<PopoverTriggerProps> & RefAttributes<PopoverTriggerElement> & HTMLAttributes<PopoverTriggerElement>>;
97
+ export { PopoverTrigger }
98
+ export { PopoverTrigger as PopoverTrigger_alias_1 }
105
99
 
106
100
  /**
107
101
  * @internal
@@ -138,13 +132,25 @@ declare interface ProseKitProps {
138
132
  export { ProseKitProps }
139
133
  export { ProseKitProps as ProseKitProps_alias_1 }
140
134
 
141
- export declare const Resizable: ComponentType<ResizableProps>;
135
+ declare const ResizableHandle: ForwardRefExoticComponent<Partial<ResizableHandleProps> & RefAttributes<ResizableHandleElement> & HTMLAttributes<ResizableHandleElement>>;
136
+ export { ResizableHandle }
137
+ export { ResizableHandle as ResizableHandle_alias_1 }
138
+
139
+ declare const ResizableRoot: ForwardRefExoticComponent<Partial<ResizableRootProps> & RefAttributes<ResizableRootElement> & HTMLAttributes<ResizableRootElement>>;
140
+ export { ResizableRoot }
141
+ export { ResizableRoot as ResizableRoot_alias_1 }
142
142
 
143
- export declare const ResizableHandle: ComponentType<ResizableHandleProps>;
143
+ declare const TooltipContent: ForwardRefExoticComponent<Partial<TooltipContentProps> & RefAttributes<TooltipContentElement> & HTMLAttributes<TooltipContentElement>>;
144
+ export { TooltipContent }
145
+ export { TooltipContent as TooltipContent_alias_1 }
144
146
 
145
- export declare type ResizableHandleProps = PropsWithChildren<PropsWithClass<ResizableHandleProps_2>>;
147
+ declare const TooltipRoot: ForwardRefExoticComponent<Partial<TooltipRootProps> & RefAttributes<TooltipRootElement> & HTMLAttributes<TooltipRootElement>>;
148
+ export { TooltipRoot }
149
+ export { TooltipRoot as TooltipRoot_alias_1 }
146
150
 
147
- export declare type ResizableProps = PropsWithChildren<PropsWithClass<ResizableProps_2>>;
151
+ declare const TooltipTrigger: ForwardRefExoticComponent<Partial<TooltipTriggerProps> & RefAttributes<TooltipTriggerElement> & HTMLAttributes<TooltipTriggerElement>>;
152
+ export { TooltipTrigger }
153
+ export { TooltipTrigger as TooltipTrigger_alias_1 }
148
154
 
149
155
  /**
150
156
  * Calls the given handler whenever the editor document changes.
@@ -0,0 +1,50 @@
1
+ import {
2
+ useEditorContext
3
+ } from "./chunk-V253IGNY.js";
4
+
5
+ // src/components/create-component.ts
6
+ import { createElement } from "preact";
7
+ import {
8
+ forwardRef
9
+ } from "preact/compat";
10
+ import { useLayoutEffect, useState } from "preact/hooks";
11
+ import { mergeRefs } from "react-merge-refs";
12
+ function createComponent(tagName, displayName, defaultProps) {
13
+ const propertyNames = Object.keys(defaultProps);
14
+ const hasEditor = Object.hasOwn(defaultProps, "editor");
15
+ const Component = forwardRef((props, ref) => {
16
+ const [el, setEl] = useState(null);
17
+ const properties = {};
18
+ const attributes = {};
19
+ for (const [name, value] of Object.entries(props)) {
20
+ if (propertyNames.includes(name)) {
21
+ properties[name] = value;
22
+ } else {
23
+ attributes[name === "className" ? "class" : name] = value;
24
+ }
25
+ }
26
+ const editor = useEditorContext();
27
+ if (hasEditor && editor && !properties["editor"]) {
28
+ properties["editor"] = editor;
29
+ }
30
+ useLayoutEffect(() => {
31
+ if (el) {
32
+ for (const [name, value] of Object.entries(properties)) {
33
+ if (value !== void 0) {
34
+ el[name] = value;
35
+ }
36
+ }
37
+ }
38
+ }, [el, ...propertyNames.map((name) => properties[name])]);
39
+ return createElement(tagName, {
40
+ ...attributes,
41
+ ref: mergeRefs([ref, setEl])
42
+ });
43
+ });
44
+ Component.displayName = displayName;
45
+ return Component;
46
+ }
47
+
48
+ export {
49
+ createComponent
50
+ };
@@ -0,0 +1,13 @@
1
+ // src/contexts/editor-context.ts
2
+ import { createContext } from "preact";
3
+ import { useContext } from "preact/hooks";
4
+ var editorContext = createContext(null);
5
+ function useEditorContext() {
6
+ return useContext(editorContext);
7
+ }
8
+ var EditorContextProvider = editorContext.Provider;
9
+
10
+ export {
11
+ useEditorContext,
12
+ EditorContextProvider
13
+ };
@@ -0,0 +1,4 @@
1
+ export { AutocompleteEmpty_alias_1 as AutocompleteEmpty } from './_tsup-dts-rollup';
2
+ export { AutocompleteItem_alias_1 as AutocompleteItem } from './_tsup-dts-rollup';
3
+ export { AutocompleteList_alias_1 as AutocompleteList } from './_tsup-dts-rollup';
4
+ export { AutocompletePopover_alias_1 as AutocompletePopover } from './_tsup-dts-rollup';
@@ -0,0 +1,50 @@
1
+ import {
2
+ createComponent
3
+ } from "./chunk-5LWA54E4.js";
4
+ import "./chunk-V253IGNY.js";
5
+
6
+ // src/components/autocomplete/autocomplete-empty.gen.ts
7
+ import {
8
+ defaultAutocompleteEmptyProps
9
+ } from "@prosekit/web/autocomplete";
10
+ var AutocompleteEmpty = createComponent(
11
+ "prosekit-autocomplete-empty",
12
+ "AutocompleteEmpty",
13
+ defaultAutocompleteEmptyProps
14
+ );
15
+
16
+ // src/components/autocomplete/autocomplete-item.gen.ts
17
+ import {
18
+ defaultAutocompleteItemProps
19
+ } from "@prosekit/web/autocomplete";
20
+ var AutocompleteItem = createComponent(
21
+ "prosekit-autocomplete-item",
22
+ "AutocompleteItem",
23
+ defaultAutocompleteItemProps
24
+ );
25
+
26
+ // src/components/autocomplete/autocomplete-list.gen.ts
27
+ import {
28
+ defaultAutocompleteListProps
29
+ } from "@prosekit/web/autocomplete";
30
+ var AutocompleteList = createComponent(
31
+ "prosekit-autocomplete-list",
32
+ "AutocompleteList",
33
+ defaultAutocompleteListProps
34
+ );
35
+
36
+ // src/components/autocomplete/autocomplete-popover.gen.ts
37
+ import {
38
+ defaultAutocompletePopoverProps
39
+ } from "@prosekit/web/autocomplete";
40
+ var AutocompletePopover = createComponent(
41
+ "prosekit-autocomplete-popover",
42
+ "AutocompletePopover",
43
+ defaultAutocompletePopoverProps
44
+ );
45
+ export {
46
+ AutocompleteEmpty,
47
+ AutocompleteItem,
48
+ AutocompleteList,
49
+ AutocompletePopover
50
+ };
@@ -0,0 +1,2 @@
1
+ export { BlockDragHandle_alias_1 as BlockDragHandle } from './_tsup-dts-rollup';
2
+ export { BlockPopover_alias_1 as BlockPopover } from './_tsup-dts-rollup';
@@ -0,0 +1,28 @@
1
+ import {
2
+ createComponent
3
+ } from "./chunk-5LWA54E4.js";
4
+ import "./chunk-V253IGNY.js";
5
+
6
+ // src/components/block-handle/block-drag-handle.gen.ts
7
+ import {
8
+ defaultBlockDragHandleProps
9
+ } from "@prosekit/web/block-handle";
10
+ var BlockDragHandle = createComponent(
11
+ "prosekit-block-drag-handle",
12
+ "BlockDragHandle",
13
+ defaultBlockDragHandleProps
14
+ );
15
+
16
+ // src/components/block-handle/block-popover.gen.ts
17
+ import {
18
+ defaultBlockPopoverProps
19
+ } from "@prosekit/web/block-handle";
20
+ var BlockPopover = createComponent(
21
+ "prosekit-block-popover",
22
+ "BlockPopover",
23
+ defaultBlockPopoverProps
24
+ );
25
+ export {
26
+ BlockDragHandle,
27
+ BlockPopover
28
+ };
@@ -1,2 +1 @@
1
- export { InlinePopoverProps } from './_tsup-dts-rollup';
2
1
  export { InlinePopover } from './_tsup-dts-rollup';
@@ -1,9 +1,17 @@
1
- // src/components/inline-popover.gen.ts
2
- import "@prosekit/lit/inline-popover";
3
- import { h } from "preact";
4
- var InlinePopover = (props) => {
5
- return h("prosekit-inline-popover", props);
6
- };
1
+ import {
2
+ createComponent
3
+ } from "./chunk-5LWA54E4.js";
4
+ import "./chunk-V253IGNY.js";
5
+
6
+ // src/components/inline-popover/inline-popover.gen.ts
7
+ import {
8
+ defaultInlinePopoverProps
9
+ } from "@prosekit/web/inline-popover";
10
+ var InlinePopover = createComponent(
11
+ "prosekit-inline-popover",
12
+ "InlinePopover",
13
+ defaultInlinePopoverProps
14
+ );
7
15
  export {
8
16
  InlinePopover
9
17
  };
@@ -1,2 +1,3 @@
1
- export { PopoverProps } from './_tsup-dts-rollup';
2
- export { Popover } from './_tsup-dts-rollup';
1
+ export { PopoverContent } from './_tsup-dts-rollup';
2
+ export { PopoverRoot } from './_tsup-dts-rollup';
3
+ export { PopoverTrigger } from './_tsup-dts-rollup';
@@ -1,9 +1,39 @@
1
- // src/components/popover.gen.ts
2
- import "@prosekit/lit/popover";
3
- import { h } from "preact";
4
- var Popover = (props) => {
5
- return h("prosekit-popover", props);
6
- };
1
+ import {
2
+ createComponent
3
+ } from "./chunk-5LWA54E4.js";
4
+ import "./chunk-V253IGNY.js";
5
+
6
+ // src/components/popover/popover-content.gen.ts
7
+ import {
8
+ defaultPopoverContentProps
9
+ } from "@prosekit/web/popover";
10
+ var PopoverContent = createComponent(
11
+ "prosekit-popover-content",
12
+ "PopoverContent",
13
+ defaultPopoverContentProps
14
+ );
15
+
16
+ // src/components/popover/popover-root.gen.ts
17
+ import {
18
+ defaultPopoverRootProps
19
+ } from "@prosekit/web/popover";
20
+ var PopoverRoot = createComponent(
21
+ "prosekit-popover-root",
22
+ "PopoverRoot",
23
+ defaultPopoverRootProps
24
+ );
25
+
26
+ // src/components/popover/popover-trigger.gen.ts
27
+ import {
28
+ defaultPopoverTriggerProps
29
+ } from "@prosekit/web/popover";
30
+ var PopoverTrigger = createComponent(
31
+ "prosekit-popover-trigger",
32
+ "PopoverTrigger",
33
+ defaultPopoverTriggerProps
34
+ );
7
35
  export {
8
- Popover
36
+ PopoverContent,
37
+ PopoverRoot,
38
+ PopoverTrigger
9
39
  };
@@ -1,2 +1,2 @@
1
- export { ResizableProps } from './_tsup-dts-rollup';
2
- export { Resizable } from './_tsup-dts-rollup';
1
+ export { ResizableHandle } from './_tsup-dts-rollup';
2
+ export { ResizableRoot } from './_tsup-dts-rollup';
@@ -1,9 +1,28 @@
1
- // src/components/resizable.gen.ts
2
- import "@prosekit/lit/resizable";
3
- import { h } from "preact";
4
- var Resizable = (props) => {
5
- return h("prosekit-resizable", props);
6
- };
1
+ import {
2
+ createComponent
3
+ } from "./chunk-5LWA54E4.js";
4
+ import "./chunk-V253IGNY.js";
5
+
6
+ // src/components/resizable/resizable-handle.gen.ts
7
+ import {
8
+ defaultResizableHandleProps
9
+ } from "@prosekit/web/resizable";
10
+ var ResizableHandle = createComponent(
11
+ "prosekit-resizable-handle",
12
+ "ResizableHandle",
13
+ defaultResizableHandleProps
14
+ );
15
+
16
+ // src/components/resizable/resizable-root.gen.ts
17
+ import {
18
+ defaultResizableRootProps
19
+ } from "@prosekit/web/resizable";
20
+ var ResizableRoot = createComponent(
21
+ "prosekit-resizable-root",
22
+ "ResizableRoot",
23
+ defaultResizableRootProps
24
+ );
7
25
  export {
8
- Resizable
26
+ ResizableHandle,
27
+ ResizableRoot
9
28
  };
@@ -0,0 +1,3 @@
1
+ export { TooltipContent } from './_tsup-dts-rollup';
2
+ export { TooltipRoot } from './_tsup-dts-rollup';
3
+ export { TooltipTrigger } from './_tsup-dts-rollup';
@@ -0,0 +1,39 @@
1
+ import {
2
+ createComponent
3
+ } from "./chunk-5LWA54E4.js";
4
+ import "./chunk-V253IGNY.js";
5
+
6
+ // src/components/tooltip/tooltip-content.gen.ts
7
+ import {
8
+ defaultTooltipContentProps
9
+ } from "@prosekit/web/tooltip";
10
+ var TooltipContent = createComponent(
11
+ "prosekit-tooltip-content",
12
+ "TooltipContent",
13
+ defaultTooltipContentProps
14
+ );
15
+
16
+ // src/components/tooltip/tooltip-root.gen.ts
17
+ import {
18
+ defaultTooltipRootProps
19
+ } from "@prosekit/web/tooltip";
20
+ var TooltipRoot = createComponent(
21
+ "prosekit-tooltip-root",
22
+ "TooltipRoot",
23
+ defaultTooltipRootProps
24
+ );
25
+
26
+ // src/components/tooltip/tooltip-trigger.gen.ts
27
+ import {
28
+ defaultTooltipTriggerProps
29
+ } from "@prosekit/web/tooltip";
30
+ var TooltipTrigger = createComponent(
31
+ "prosekit-tooltip-trigger",
32
+ "TooltipTrigger",
33
+ defaultTooltipTriggerProps
34
+ );
35
+ export {
36
+ TooltipContent,
37
+ TooltipRoot,
38
+ TooltipTrigger
39
+ };
@@ -1,16 +1,10 @@
1
- // src/components/prosekit.ts
2
- import { h } from "preact";
3
-
4
- // src/contexts/editor-context.ts
5
- import { createContext } from "preact";
6
- import { useContext } from "preact/hooks";
7
- var editorContext = createContext(null);
8
- function useEditorContext() {
9
- return useContext(editorContext);
10
- }
11
- var EditorContextProvider = editorContext.Provider;
1
+ import {
2
+ EditorContextProvider,
3
+ useEditorContext
4
+ } from "./chunk-V253IGNY.js";
12
5
 
13
6
  // src/components/prosekit.ts
7
+ import { h } from "preact";
14
8
  var ProseKit = (props) => {
15
9
  const { editor, children } = props;
16
10
  return h(EditorContextProvider, { value: editor, children });
@@ -78,9 +72,9 @@ function usePriorityExtension(extension, priority) {
78
72
 
79
73
  // src/hooks/use-extension.ts
80
74
  function useExtension(extension, options) {
81
- const editorContext2 = useEditorContext();
75
+ const editorContext = useEditorContext();
82
76
  useEditorExtension(
83
- (options == null ? void 0 : options.editor) || editorContext2,
77
+ (options == null ? void 0 : options.editor) || editorContext,
84
78
  usePriorityExtension(extension, options == null ? void 0 : options.priority)
85
79
  );
86
80
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/preact",
3
3
  "type": "module",
4
- "version": "0.2.6",
4
+ "version": "0.3.0",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -30,55 +30,15 @@
30
30
  "import": "./dist/prosekit-preact.js",
31
31
  "default": "./dist/prosekit-preact.js"
32
32
  },
33
- "./autocomplete-empty": {
34
- "types": "./dist/prosekit-preact-autocomplete-empty.d.ts",
35
- "import": "./dist/prosekit-preact-autocomplete-empty.js",
36
- "default": "./dist/prosekit-preact-autocomplete-empty.js"
33
+ "./autocomplete": {
34
+ "types": "./dist/prosekit-preact-autocomplete.d.ts",
35
+ "import": "./dist/prosekit-preact-autocomplete.js",
36
+ "default": "./dist/prosekit-preact-autocomplete.js"
37
37
  },
38
- "./autocomplete-item": {
39
- "types": "./dist/prosekit-preact-autocomplete-item.d.ts",
40
- "import": "./dist/prosekit-preact-autocomplete-item.js",
41
- "default": "./dist/prosekit-preact-autocomplete-item.js"
42
- },
43
- "./autocomplete-list": {
44
- "types": "./dist/prosekit-preact-autocomplete-list.d.ts",
45
- "import": "./dist/prosekit-preact-autocomplete-list.js",
46
- "default": "./dist/prosekit-preact-autocomplete-list.js"
47
- },
48
- "./autocomplete-popover": {
49
- "types": "./dist/prosekit-preact-autocomplete-popover.d.ts",
50
- "import": "./dist/prosekit-preact-autocomplete-popover.js",
51
- "default": "./dist/prosekit-preact-autocomplete-popover.js"
52
- },
53
- "./block-popover": {
54
- "types": "./dist/prosekit-preact-block-popover.d.ts",
55
- "import": "./dist/prosekit-preact-block-popover.js",
56
- "default": "./dist/prosekit-preact-block-popover.js"
57
- },
58
- "./combo-box": {
59
- "types": "./dist/prosekit-preact-combo-box.d.ts",
60
- "import": "./dist/prosekit-preact-combo-box.js",
61
- "default": "./dist/prosekit-preact-combo-box.js"
62
- },
63
- "./combo-box-input": {
64
- "types": "./dist/prosekit-preact-combo-box-input.d.ts",
65
- "import": "./dist/prosekit-preact-combo-box-input.js",
66
- "default": "./dist/prosekit-preact-combo-box-input.js"
67
- },
68
- "./combo-box-item": {
69
- "types": "./dist/prosekit-preact-combo-box-item.d.ts",
70
- "import": "./dist/prosekit-preact-combo-box-item.js",
71
- "default": "./dist/prosekit-preact-combo-box-item.js"
72
- },
73
- "./combo-box-list": {
74
- "types": "./dist/prosekit-preact-combo-box-list.d.ts",
75
- "import": "./dist/prosekit-preact-combo-box-list.js",
76
- "default": "./dist/prosekit-preact-combo-box-list.js"
77
- },
78
- "./drag-handle": {
79
- "types": "./dist/prosekit-preact-drag-handle.d.ts",
80
- "import": "./dist/prosekit-preact-drag-handle.js",
81
- "default": "./dist/prosekit-preact-drag-handle.js"
38
+ "./block-handle": {
39
+ "types": "./dist/prosekit-preact-block-handle.d.ts",
40
+ "import": "./dist/prosekit-preact-block-handle.js",
41
+ "default": "./dist/prosekit-preact-block-handle.js"
82
42
  },
83
43
  "./inline-popover": {
84
44
  "types": "./dist/prosekit-preact-inline-popover.d.ts",
@@ -95,10 +55,10 @@
95
55
  "import": "./dist/prosekit-preact-resizable.js",
96
56
  "default": "./dist/prosekit-preact-resizable.js"
97
57
  },
98
- "./resizable-handle": {
99
- "types": "./dist/prosekit-preact-resizable-handle.d.ts",
100
- "import": "./dist/prosekit-preact-resizable-handle.js",
101
- "default": "./dist/prosekit-preact-resizable-handle.js"
58
+ "./tooltip": {
59
+ "types": "./dist/prosekit-preact-tooltip.d.ts",
60
+ "import": "./dist/prosekit-preact-tooltip.js",
61
+ "default": "./dist/prosekit-preact-tooltip.js"
102
62
  }
103
63
  },
104
64
  "files": [
@@ -106,8 +66,10 @@
106
66
  ],
107
67
  "dependencies": {
108
68
  "@prosekit/core": "^0.4.0",
109
- "@prosekit/lit": "^0.2.6",
110
- "@prosekit/pm": "^0.1.1"
69
+ "@prosekit/lit": "^0.3.0",
70
+ "@prosekit/pm": "^0.1.2",
71
+ "@prosekit/web": "^0.1.0",
72
+ "react-merge-refs": "^2.1.1"
111
73
  },
112
74
  "peerDependencies": {
113
75
  "preact": ">= 9.0.0"
@@ -119,10 +81,10 @@
119
81
  },
120
82
  "devDependencies": {
121
83
  "@prosekit/dev": "*",
122
- "preact": "^10.19.4",
84
+ "preact": "^10.20.2",
123
85
  "tsup": "^8.0.2",
124
- "typescript": "^5.3.3",
125
- "vitest": "^1.2.2"
86
+ "typescript": "^5.4.5",
87
+ "vitest": "^1.5.0"
126
88
  },
127
89
  "scripts": {
128
90
  "build:tsup": "tsup",
@@ -134,35 +96,11 @@
134
96
  ".": [
135
97
  "./dist/prosekit-preact.d.ts"
136
98
  ],
137
- "autocomplete-empty": [
138
- "./dist/prosekit-preact-autocomplete-empty.d.ts"
139
- ],
140
- "autocomplete-item": [
141
- "./dist/prosekit-preact-autocomplete-item.d.ts"
142
- ],
143
- "autocomplete-list": [
144
- "./dist/prosekit-preact-autocomplete-list.d.ts"
145
- ],
146
- "autocomplete-popover": [
147
- "./dist/prosekit-preact-autocomplete-popover.d.ts"
148
- ],
149
- "block-popover": [
150
- "./dist/prosekit-preact-block-popover.d.ts"
151
- ],
152
- "combo-box": [
153
- "./dist/prosekit-preact-combo-box.d.ts"
154
- ],
155
- "combo-box-input": [
156
- "./dist/prosekit-preact-combo-box-input.d.ts"
157
- ],
158
- "combo-box-item": [
159
- "./dist/prosekit-preact-combo-box-item.d.ts"
160
- ],
161
- "combo-box-list": [
162
- "./dist/prosekit-preact-combo-box-list.d.ts"
99
+ "autocomplete": [
100
+ "./dist/prosekit-preact-autocomplete.d.ts"
163
101
  ],
164
- "drag-handle": [
165
- "./dist/prosekit-preact-drag-handle.d.ts"
102
+ "block-handle": [
103
+ "./dist/prosekit-preact-block-handle.d.ts"
166
104
  ],
167
105
  "inline-popover": [
168
106
  "./dist/prosekit-preact-inline-popover.d.ts"
@@ -173,8 +111,8 @@
173
111
  "resizable": [
174
112
  "./dist/prosekit-preact-resizable.d.ts"
175
113
  ],
176
- "resizable-handle": [
177
- "./dist/prosekit-preact-resizable-handle.d.ts"
114
+ "tooltip": [
115
+ "./dist/prosekit-preact-tooltip.d.ts"
178
116
  ]
179
117
  }
180
118
  }
@@ -1,2 +0,0 @@
1
- export { AutocompleteEmpty_alias_1 as AutocompleteEmpty } from './_tsup-dts-rollup';
2
- export { AutocompleteEmptyProps_alias_1 as AutocompleteEmptyProps } from './_tsup-dts-rollup';
@@ -1,9 +0,0 @@
1
- // src/components/autocomplete-empty.gen.ts
2
- import "@prosekit/lit/autocomplete-empty";
3
- import { h } from "preact";
4
- var AutocompleteEmpty = (props) => {
5
- return h("prosekit-autocomplete-empty", props);
6
- };
7
- export {
8
- AutocompleteEmpty
9
- };
@@ -1,2 +0,0 @@
1
- export { AutocompleteItem_alias_1 as AutocompleteItem } from './_tsup-dts-rollup';
2
- export { AutocompleteItemProps_alias_1 as AutocompleteItemProps } from './_tsup-dts-rollup';
@@ -1,9 +0,0 @@
1
- // src/components/autocomplete-item.gen.ts
2
- import "@prosekit/lit/autocomplete-item";
3
- import { h } from "preact";
4
- var AutocompleteItem = (props) => {
5
- return h("prosekit-autocomplete-item", props);
6
- };
7
- export {
8
- AutocompleteItem
9
- };
@@ -1,2 +0,0 @@
1
- export { AutocompleteList_alias_1 as AutocompleteList } from './_tsup-dts-rollup';
2
- export { AutocompleteListProps_alias_1 as AutocompleteListProps } from './_tsup-dts-rollup';
@@ -1,9 +0,0 @@
1
- // src/components/autocomplete-list.gen.ts
2
- import "@prosekit/lit/autocomplete-list";
3
- import { h } from "preact";
4
- var AutocompleteList = (props) => {
5
- return h("prosekit-autocomplete-list", props);
6
- };
7
- export {
8
- AutocompleteList
9
- };
@@ -1,3 +0,0 @@
1
- export { PositioningOptions } from './_tsup-dts-rollup';
2
- export { AutocompletePopover_alias_1 as AutocompletePopover } from './_tsup-dts-rollup';
3
- export { AutocompletePopoverProps_alias_1 as AutocompletePopoverProps } from './_tsup-dts-rollup';
@@ -1,9 +0,0 @@
1
- // src/components/autocomplete-popover.gen.ts
2
- import "@prosekit/lit/autocomplete-popover";
3
- import { h } from "preact";
4
- var AutocompletePopover = (props) => {
5
- return h("prosekit-autocomplete-popover", props);
6
- };
7
- export {
8
- AutocompletePopover
9
- };
@@ -1,2 +0,0 @@
1
- export { BlockPopoverProps } from './_tsup-dts-rollup';
2
- export { BlockPopover } from './_tsup-dts-rollup';
@@ -1,9 +0,0 @@
1
- // src/components/block-popover.gen.ts
2
- import "@prosekit/lit/block-popover";
3
- import { h } from "preact";
4
- var BlockPopover = (props) => {
5
- return h("prosekit-block-popover", props);
6
- };
7
- export {
8
- BlockPopover
9
- };
@@ -1,2 +0,0 @@
1
- export { ComboBoxInputProps } from './_tsup-dts-rollup';
2
- export { ComboBoxInput } from './_tsup-dts-rollup';
@@ -1,9 +0,0 @@
1
- // src/components/combo-box-input.gen.ts
2
- import "@prosekit/lit/combo-box-input";
3
- import { h } from "preact";
4
- var ComboBoxInput = (props) => {
5
- return h("prosekit-combo-box-input", props);
6
- };
7
- export {
8
- ComboBoxInput
9
- };
@@ -1,2 +0,0 @@
1
- export { ComboBoxItemProps } from './_tsup-dts-rollup';
2
- export { ComboBoxItem } from './_tsup-dts-rollup';
@@ -1,9 +0,0 @@
1
- // src/components/combo-box-item.gen.ts
2
- import "@prosekit/lit/combo-box-item";
3
- import { h } from "preact";
4
- var ComboBoxItem = (props) => {
5
- return h("prosekit-combo-box-item", props);
6
- };
7
- export {
8
- ComboBoxItem
9
- };
@@ -1,2 +0,0 @@
1
- export { ComboBoxListProps } from './_tsup-dts-rollup';
2
- export { ComboBoxList } from './_tsup-dts-rollup';
@@ -1,9 +0,0 @@
1
- // src/components/combo-box-list.gen.ts
2
- import "@prosekit/lit/combo-box-list";
3
- import { h } from "preact";
4
- var ComboBoxList = (props) => {
5
- return h("prosekit-combo-box-list", props);
6
- };
7
- export {
8
- ComboBoxList
9
- };
@@ -1,2 +0,0 @@
1
- export { ComboBoxProps } from './_tsup-dts-rollup';
2
- export { ComboBox } from './_tsup-dts-rollup';
@@ -1,9 +0,0 @@
1
- // src/components/combo-box.gen.ts
2
- import "@prosekit/lit/combo-box";
3
- import { h } from "preact";
4
- var ComboBox = (props) => {
5
- return h("prosekit-combo-box", props);
6
- };
7
- export {
8
- ComboBox
9
- };
@@ -1,2 +0,0 @@
1
- export { DragHandleProps } from './_tsup-dts-rollup';
2
- export { DragHandle } from './_tsup-dts-rollup';
@@ -1,9 +0,0 @@
1
- // src/components/drag-handle.gen.ts
2
- import "@prosekit/lit/drag-handle";
3
- import { h } from "preact";
4
- var DragHandle = (props) => {
5
- return h("prosekit-drag-handle", props);
6
- };
7
- export {
8
- DragHandle
9
- };
@@ -1,2 +0,0 @@
1
- export { ResizableHandleProps } from './_tsup-dts-rollup';
2
- export { ResizableHandle } from './_tsup-dts-rollup';
@@ -1,9 +0,0 @@
1
- // src/components/resizable-handle.gen.ts
2
- import "@prosekit/lit/resizable-handle";
3
- import { h } from "preact";
4
- var ResizableHandle = (props) => {
5
- return h("prosekit-resizable-handle", props);
6
- };
7
- export {
8
- ResizableHandle
9
- };