@prosekit/react 0.0.0-next-20230709094459 → 0.0.0-next-20231120040948
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 +192 -0
- package/dist/prosekit-react-autocomplete-empty.d.ts +2 -0
- package/dist/prosekit-react-autocomplete-empty.js +17 -0
- package/dist/prosekit-react-autocomplete-item.d.ts +2 -0
- package/dist/prosekit-react-autocomplete-item.js +17 -0
- package/dist/prosekit-react-autocomplete-list.d.ts +2 -0
- package/dist/prosekit-react-autocomplete-list.js +17 -0
- package/dist/prosekit-react-autocomplete-popover.d.ts +3 -0
- package/dist/prosekit-react-autocomplete-popover.js +17 -0
- package/dist/prosekit-react-combo-box-input.d.ts +2 -0
- package/dist/prosekit-react-combo-box-input.js +17 -0
- package/dist/prosekit-react-combo-box-item.d.ts +2 -0
- package/dist/prosekit-react-combo-box-item.js +17 -0
- package/dist/prosekit-react-combo-box-list.d.ts +2 -0
- package/dist/prosekit-react-combo-box-list.js +17 -0
- package/dist/prosekit-react-combo-box.d.ts +2 -0
- package/dist/prosekit-react-combo-box.js +17 -0
- package/dist/prosekit-react-inline-popover.d.ts +2 -0
- package/dist/prosekit-react-inline-popover.js +17 -0
- package/dist/prosekit-react-popover.d.ts +2 -0
- package/dist/prosekit-react-popover.js +17 -0
- package/dist/prosekit-react.d.ts +10 -21
- package/dist/prosekit-react.js +109 -25
- package/package.json +82 -33
- package/src/index.ts +7 -5
- package/dist/prosekit-react-components-menu-item.d.ts +0 -6
- package/dist/prosekit-react-components-menu-item.js +0 -13
- package/dist/prosekit-react-components-menu.d.ts +0 -16
- package/dist/prosekit-react-components-menu.js +0 -16
- package/dist/prosekit-react-components-popover-suggestion.d.ts +0 -16
- package/dist/prosekit-react-components-popover-suggestion.js +0 -27
- package/dist/prosekit-react-components-popover.d.ts +0 -6
- package/dist/prosekit-react-components-popover.js +0 -13
@@ -0,0 +1,192 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
|
3
|
+
import { AutocompleteEmpty as AutocompleteEmpty_2 } from '@prosekit/lit/autocomplete-empty';
|
4
|
+
import { AutocompleteEmptyProps as AutocompleteEmptyProps_2 } from '@prosekit/lit/autocomplete-empty';
|
5
|
+
import { AutocompleteItem as AutocompleteItem_2 } from '@prosekit/lit/autocomplete-item';
|
6
|
+
import { AutocompleteItemProps as AutocompleteItemProps_2 } from '@prosekit/lit/autocomplete-item';
|
7
|
+
import { AutocompleteList as AutocompleteList_2 } from '@prosekit/lit/autocomplete-list';
|
8
|
+
import { AutocompleteListProps as AutocompleteListProps_2 } from '@prosekit/lit/autocomplete-list';
|
9
|
+
import { AutocompletePopover as AutocompletePopover_2 } from '@prosekit/lit/autocomplete-popover';
|
10
|
+
import { AutocompletePopoverProps as AutocompletePopoverProps_2 } from '@prosekit/lit/autocomplete-popover';
|
11
|
+
import { ComboBox as ComboBox_2 } from '@prosekit/lit/combo-box';
|
12
|
+
import { ComboBoxInput as ComboBoxInput_2 } from '@prosekit/lit/combo-box-input';
|
13
|
+
import { ComboBoxInputProps as ComboBoxInputProps_2 } from '@prosekit/lit/combo-box-input';
|
14
|
+
import { ComboBoxItem as ComboBoxItem_2 } from '@prosekit/lit/combo-box-item';
|
15
|
+
import { ComboBoxItemProps as ComboBoxItemProps_2 } from '@prosekit/lit/combo-box-item';
|
16
|
+
import { ComboBoxList as ComboBoxList_2 } from '@prosekit/lit/combo-box-list';
|
17
|
+
import { ComboBoxListProps as ComboBoxListProps_2 } from '@prosekit/lit/combo-box-list';
|
18
|
+
import { ComboBoxProps as ComboBoxProps_2 } from '@prosekit/lit/combo-box';
|
19
|
+
import { CommandArgs } from '@prosekit/core';
|
20
|
+
import { ComponentType } from 'react';
|
21
|
+
import { Context } from 'react';
|
22
|
+
import { Editor } from '@prosekit/core';
|
23
|
+
import { Extension } from '@prosekit/core';
|
24
|
+
import { ExtensionTyping } from '@prosekit/core';
|
25
|
+
import type { ForwardRefExoticComponent } from 'react';
|
26
|
+
import { InlinePopover as InlinePopover_2 } from '@prosekit/lit/inline-popover';
|
27
|
+
import { InlinePopoverProps as InlinePopoverProps_2 } from '@prosekit/lit/inline-popover';
|
28
|
+
import { Keymap } from '@prosekit/core';
|
29
|
+
import type { NodeViewContext } from '@prosemirror-adapter/react';
|
30
|
+
import { Options } from 'tsup';
|
31
|
+
import { Popover as Popover_2 } from '@prosekit/lit/popover';
|
32
|
+
import { PopoverOptions } from '@prosekit/lit/autocomplete-popover';
|
33
|
+
import { PopoverProps as PopoverProps_2 } from '@prosekit/lit/popover';
|
34
|
+
import type { PropsWithoutRef } from 'react';
|
35
|
+
import { default as React_2 } from 'react';
|
36
|
+
import type { RefAttributes } from 'react';
|
37
|
+
import type { SimplifyUnion } from '@prosekit/core';
|
38
|
+
import { useNodeViewContext } from '@prosemirror-adapter/react';
|
39
|
+
import { useNodeViewFactory } from '@prosemirror-adapter/react';
|
40
|
+
import { UserProjectConfigExport } from 'vitest/dist/config.js';
|
41
|
+
|
42
|
+
declare const AutocompleteEmpty: ForwardRefExoticComponent<PropsWithoutRef<AutocompleteEmptyProps> & RefAttributes<AutocompleteEmpty_2>>;
|
43
|
+
export { AutocompleteEmpty }
|
44
|
+
export { AutocompleteEmpty as AutocompleteEmpty_alias_1 }
|
45
|
+
|
46
|
+
declare type AutocompleteEmptyProps = SimplifyUnion<{
|
47
|
+
className?: string;
|
48
|
+
children?: React_2.ReactNode;
|
49
|
+
} & AutocompleteEmptyProps_2>;
|
50
|
+
export { AutocompleteEmptyProps }
|
51
|
+
export { AutocompleteEmptyProps as AutocompleteEmptyProps_alias_1 }
|
52
|
+
|
53
|
+
declare const AutocompleteItem: ForwardRefExoticComponent<PropsWithoutRef<AutocompleteItemProps> & RefAttributes<AutocompleteItem_2>>;
|
54
|
+
export { AutocompleteItem }
|
55
|
+
export { AutocompleteItem as AutocompleteItem_alias_1 }
|
56
|
+
|
57
|
+
declare type AutocompleteItemProps = SimplifyUnion<{
|
58
|
+
className?: string;
|
59
|
+
children?: React_2.ReactNode;
|
60
|
+
} & AutocompleteItemProps_2>;
|
61
|
+
export { AutocompleteItemProps }
|
62
|
+
export { AutocompleteItemProps as AutocompleteItemProps_alias_1 }
|
63
|
+
|
64
|
+
declare const AutocompleteList: ForwardRefExoticComponent<PropsWithoutRef<AutocompleteListProps> & RefAttributes<AutocompleteList_2>>;
|
65
|
+
export { AutocompleteList }
|
66
|
+
export { AutocompleteList as AutocompleteList_alias_1 }
|
67
|
+
|
68
|
+
declare type AutocompleteListProps = SimplifyUnion<{
|
69
|
+
className?: string;
|
70
|
+
children?: React_2.ReactNode;
|
71
|
+
} & AutocompleteListProps_2>;
|
72
|
+
export { AutocompleteListProps }
|
73
|
+
export { AutocompleteListProps as AutocompleteListProps_alias_1 }
|
74
|
+
|
75
|
+
declare const AutocompletePopover: ForwardRefExoticComponent<PropsWithoutRef<AutocompletePopoverProps> & RefAttributes<AutocompletePopover_2>>;
|
76
|
+
export { AutocompletePopover }
|
77
|
+
export { AutocompletePopover as AutocompletePopover_alias_1 }
|
78
|
+
|
79
|
+
declare type AutocompletePopoverProps = SimplifyUnion<{
|
80
|
+
className?: string;
|
81
|
+
children?: React_2.ReactNode;
|
82
|
+
} & AutocompletePopoverProps_2>;
|
83
|
+
export { AutocompletePopoverProps }
|
84
|
+
export { AutocompletePopoverProps as AutocompletePopoverProps_alias_1 }
|
85
|
+
|
86
|
+
export declare const ComboBox: ForwardRefExoticComponent<PropsWithoutRef<ComboBoxProps> & RefAttributes<ComboBox_2>>;
|
87
|
+
|
88
|
+
export declare const ComboBoxInput: ForwardRefExoticComponent<PropsWithoutRef<ComboBoxInputProps> & RefAttributes<ComboBoxInput_2>>;
|
89
|
+
|
90
|
+
export declare type ComboBoxInputProps = SimplifyUnion<{
|
91
|
+
className?: string;
|
92
|
+
children?: React_2.ReactNode;
|
93
|
+
} & ComboBoxInputProps_2>;
|
94
|
+
|
95
|
+
export declare const ComboBoxItem: ForwardRefExoticComponent<PropsWithoutRef<ComboBoxItemProps> & RefAttributes<ComboBoxItem_2>>;
|
96
|
+
|
97
|
+
export declare type ComboBoxItemProps = SimplifyUnion<{
|
98
|
+
className?: string;
|
99
|
+
children?: React_2.ReactNode;
|
100
|
+
} & ComboBoxItemProps_2>;
|
101
|
+
|
102
|
+
export declare const ComboBoxList: ForwardRefExoticComponent<PropsWithoutRef<ComboBoxListProps> & RefAttributes<ComboBoxList_2>>;
|
103
|
+
|
104
|
+
export declare type ComboBoxListProps = SimplifyUnion<{
|
105
|
+
className?: string;
|
106
|
+
children?: React_2.ReactNode;
|
107
|
+
} & ComboBoxListProps_2>;
|
108
|
+
|
109
|
+
export declare type ComboBoxProps = SimplifyUnion<{
|
110
|
+
className?: string;
|
111
|
+
children?: React_2.ReactNode;
|
112
|
+
} & ComboBoxProps_2>;
|
113
|
+
|
114
|
+
export declare const default_alias: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
|
115
|
+
|
116
|
+
export declare const default_alias_1: UserProjectConfigExport;
|
117
|
+
|
118
|
+
declare function defineReactNodeView(options: ReactNodeViewOptions): Extension;
|
119
|
+
export { defineReactNodeView }
|
120
|
+
export { defineReactNodeView as defineReactNodeView_alias_1 }
|
121
|
+
|
122
|
+
export declare function defineReactNodeViewRenderer({ nodeViewFactory, }: {
|
123
|
+
nodeViewFactory: ReturnType<typeof useNodeViewFactory>;
|
124
|
+
}): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
125
|
+
|
126
|
+
export declare interface EditorContext {
|
127
|
+
editor: Editor;
|
128
|
+
}
|
129
|
+
|
130
|
+
export declare const editorContext: Context<EditorContext | null>;
|
131
|
+
|
132
|
+
export declare const InlinePopover: ForwardRefExoticComponent<PropsWithoutRef<InlinePopoverProps> & RefAttributes<InlinePopover_2>>;
|
133
|
+
|
134
|
+
export declare type InlinePopoverProps = SimplifyUnion<{
|
135
|
+
className?: string;
|
136
|
+
children?: React_2.ReactNode;
|
137
|
+
} & InlinePopoverProps_2>;
|
138
|
+
|
139
|
+
export declare const Popover: ForwardRefExoticComponent<PropsWithoutRef<PopoverProps> & RefAttributes<Popover_2>>;
|
140
|
+
|
141
|
+
export { PopoverOptions }
|
142
|
+
|
143
|
+
export declare type PopoverProps = SimplifyUnion<{
|
144
|
+
className?: string;
|
145
|
+
children?: React_2.ReactNode;
|
146
|
+
} & PopoverProps_2>;
|
147
|
+
|
148
|
+
declare const ProseKit: ComponentType<ProseKitProps>;
|
149
|
+
export { ProseKit }
|
150
|
+
export { ProseKit as ProseKit_alias_1 }
|
151
|
+
|
152
|
+
declare interface ProseKitProps {
|
153
|
+
editor: Editor;
|
154
|
+
children?: React_2.ReactNode;
|
155
|
+
}
|
156
|
+
export { ProseKitProps }
|
157
|
+
export { ProseKitProps as ProseKitProps_alias_1 }
|
158
|
+
|
159
|
+
declare type ReactNodeViewComponentProps = NodeViewContext;
|
160
|
+
export { ReactNodeViewComponentProps }
|
161
|
+
export { ReactNodeViewComponentProps as ReactNodeViewComponentProps_alias_1 }
|
162
|
+
|
163
|
+
declare interface ReactNodeViewOptions {
|
164
|
+
name: string;
|
165
|
+
component: React.ComponentType<ReactNodeViewComponentProps>;
|
166
|
+
dom?: string | (() => HTMLElement);
|
167
|
+
contentDOM?: string | (() => HTMLElement);
|
168
|
+
}
|
169
|
+
export { ReactNodeViewOptions }
|
170
|
+
export { ReactNodeViewOptions as ReactNodeViewOptions_alias_1 }
|
171
|
+
|
172
|
+
declare function useEditor<E extends Extension = any>(options?: UseEditorOptions): Editor<E>;
|
173
|
+
export { useEditor }
|
174
|
+
export { useEditor as useEditor_alias_1 }
|
175
|
+
|
176
|
+
declare interface UseEditorOptions {
|
177
|
+
update?: boolean;
|
178
|
+
}
|
179
|
+
export { UseEditorOptions }
|
180
|
+
export { UseEditorOptions as UseEditorOptions_alias_1 }
|
181
|
+
|
182
|
+
declare function useExtension<T extends Extension = Extension>(extension: T): void;
|
183
|
+
export { useExtension }
|
184
|
+
export { useExtension as useExtension_alias_1 }
|
185
|
+
|
186
|
+
declare function useKeymap(keymap: Keymap): void;
|
187
|
+
export { useKeymap }
|
188
|
+
export { useKeymap as useKeymap_alias_1 }
|
189
|
+
|
190
|
+
export { useNodeViewContext }
|
191
|
+
|
192
|
+
export { }
|
@@ -0,0 +1,17 @@
|
|
1
|
+
// src/components/autocomplete-empty.gen.ts
|
2
|
+
import { createComponent } from "@lit/react";
|
3
|
+
import { AutocompleteEmpty as AutocompleteEmptyElement } from "@prosekit/lit/autocomplete-empty";
|
4
|
+
import React from "react";
|
5
|
+
var AutocompleteEmptyInner = createComponent({
|
6
|
+
tagName: "prosekit-autocomplete-empty",
|
7
|
+
elementClass: AutocompleteEmptyElement,
|
8
|
+
react: React,
|
9
|
+
displayName: "AutocompleteEmptyInner"
|
10
|
+
});
|
11
|
+
var AutocompleteEmpty = React.forwardRef((props, ref) => {
|
12
|
+
return React.createElement(AutocompleteEmptyInner, { ...props, ref });
|
13
|
+
});
|
14
|
+
AutocompleteEmpty.displayName = "AutocompleteEmpty";
|
15
|
+
export {
|
16
|
+
AutocompleteEmpty
|
17
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
// src/components/autocomplete-item.gen.ts
|
2
|
+
import { createComponent } from "@lit/react";
|
3
|
+
import { AutocompleteItem as AutocompleteItemElement } from "@prosekit/lit/autocomplete-item";
|
4
|
+
import React from "react";
|
5
|
+
var AutocompleteItemInner = createComponent({
|
6
|
+
tagName: "prosekit-autocomplete-item",
|
7
|
+
elementClass: AutocompleteItemElement,
|
8
|
+
react: React,
|
9
|
+
displayName: "AutocompleteItemInner"
|
10
|
+
});
|
11
|
+
var AutocompleteItem = React.forwardRef((props, ref) => {
|
12
|
+
return React.createElement(AutocompleteItemInner, { ...props, ref });
|
13
|
+
});
|
14
|
+
AutocompleteItem.displayName = "AutocompleteItem";
|
15
|
+
export {
|
16
|
+
AutocompleteItem
|
17
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
// src/components/autocomplete-list.gen.ts
|
2
|
+
import { createComponent } from "@lit/react";
|
3
|
+
import { AutocompleteList as AutocompleteListElement } from "@prosekit/lit/autocomplete-list";
|
4
|
+
import React from "react";
|
5
|
+
var AutocompleteListInner = createComponent({
|
6
|
+
tagName: "prosekit-autocomplete-list",
|
7
|
+
elementClass: AutocompleteListElement,
|
8
|
+
react: React,
|
9
|
+
displayName: "AutocompleteListInner"
|
10
|
+
});
|
11
|
+
var AutocompleteList = React.forwardRef((props, ref) => {
|
12
|
+
return React.createElement(AutocompleteListInner, { ...props, ref });
|
13
|
+
});
|
14
|
+
AutocompleteList.displayName = "AutocompleteList";
|
15
|
+
export {
|
16
|
+
AutocompleteList
|
17
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
// src/components/autocomplete-popover.gen.ts
|
2
|
+
import { createComponent } from "@lit/react";
|
3
|
+
import { AutocompletePopover as AutocompletePopoverElement } from "@prosekit/lit/autocomplete-popover";
|
4
|
+
import React from "react";
|
5
|
+
var AutocompletePopoverInner = createComponent({
|
6
|
+
tagName: "prosekit-autocomplete-popover",
|
7
|
+
elementClass: AutocompletePopoverElement,
|
8
|
+
react: React,
|
9
|
+
displayName: "AutocompletePopoverInner"
|
10
|
+
});
|
11
|
+
var AutocompletePopover = React.forwardRef((props, ref) => {
|
12
|
+
return React.createElement(AutocompletePopoverInner, { ...props, ref });
|
13
|
+
});
|
14
|
+
AutocompletePopover.displayName = "AutocompletePopover";
|
15
|
+
export {
|
16
|
+
AutocompletePopover
|
17
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
// src/components/combo-box-input.gen.ts
|
2
|
+
import { createComponent } from "@lit/react";
|
3
|
+
import { ComboBoxInput as ComboBoxInputElement } from "@prosekit/lit/combo-box-input";
|
4
|
+
import React from "react";
|
5
|
+
var ComboBoxInputInner = createComponent({
|
6
|
+
tagName: "prosekit-combo-box-input",
|
7
|
+
elementClass: ComboBoxInputElement,
|
8
|
+
react: React,
|
9
|
+
displayName: "ComboBoxInputInner"
|
10
|
+
});
|
11
|
+
var ComboBoxInput = React.forwardRef((props, ref) => {
|
12
|
+
return React.createElement(ComboBoxInputInner, { ...props, ref });
|
13
|
+
});
|
14
|
+
ComboBoxInput.displayName = "ComboBoxInput";
|
15
|
+
export {
|
16
|
+
ComboBoxInput
|
17
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
// src/components/combo-box-item.gen.ts
|
2
|
+
import { createComponent } from "@lit/react";
|
3
|
+
import { ComboBoxItem as ComboBoxItemElement } from "@prosekit/lit/combo-box-item";
|
4
|
+
import React from "react";
|
5
|
+
var ComboBoxItemInner = createComponent({
|
6
|
+
tagName: "prosekit-combo-box-item",
|
7
|
+
elementClass: ComboBoxItemElement,
|
8
|
+
react: React,
|
9
|
+
displayName: "ComboBoxItemInner"
|
10
|
+
});
|
11
|
+
var ComboBoxItem = React.forwardRef((props, ref) => {
|
12
|
+
return React.createElement(ComboBoxItemInner, { ...props, ref });
|
13
|
+
});
|
14
|
+
ComboBoxItem.displayName = "ComboBoxItem";
|
15
|
+
export {
|
16
|
+
ComboBoxItem
|
17
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
// src/components/combo-box-list.gen.ts
|
2
|
+
import { createComponent } from "@lit/react";
|
3
|
+
import { ComboBoxList as ComboBoxListElement } from "@prosekit/lit/combo-box-list";
|
4
|
+
import React from "react";
|
5
|
+
var ComboBoxListInner = createComponent({
|
6
|
+
tagName: "prosekit-combo-box-list",
|
7
|
+
elementClass: ComboBoxListElement,
|
8
|
+
react: React,
|
9
|
+
displayName: "ComboBoxListInner"
|
10
|
+
});
|
11
|
+
var ComboBoxList = React.forwardRef((props, ref) => {
|
12
|
+
return React.createElement(ComboBoxListInner, { ...props, ref });
|
13
|
+
});
|
14
|
+
ComboBoxList.displayName = "ComboBoxList";
|
15
|
+
export {
|
16
|
+
ComboBoxList
|
17
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
// src/components/combo-box.gen.ts
|
2
|
+
import { createComponent } from "@lit/react";
|
3
|
+
import { ComboBox as ComboBoxElement } from "@prosekit/lit/combo-box";
|
4
|
+
import React from "react";
|
5
|
+
var ComboBoxInner = createComponent({
|
6
|
+
tagName: "prosekit-combo-box",
|
7
|
+
elementClass: ComboBoxElement,
|
8
|
+
react: React,
|
9
|
+
displayName: "ComboBoxInner"
|
10
|
+
});
|
11
|
+
var ComboBox = React.forwardRef((props, ref) => {
|
12
|
+
return React.createElement(ComboBoxInner, { ...props, ref });
|
13
|
+
});
|
14
|
+
ComboBox.displayName = "ComboBox";
|
15
|
+
export {
|
16
|
+
ComboBox
|
17
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
// src/components/inline-popover.gen.ts
|
2
|
+
import { createComponent } from "@lit/react";
|
3
|
+
import { InlinePopover as InlinePopoverElement } from "@prosekit/lit/inline-popover";
|
4
|
+
import React from "react";
|
5
|
+
var InlinePopoverInner = createComponent({
|
6
|
+
tagName: "prosekit-inline-popover",
|
7
|
+
elementClass: InlinePopoverElement,
|
8
|
+
react: React,
|
9
|
+
displayName: "InlinePopoverInner"
|
10
|
+
});
|
11
|
+
var InlinePopover = React.forwardRef((props, ref) => {
|
12
|
+
return React.createElement(InlinePopoverInner, { ...props, ref });
|
13
|
+
});
|
14
|
+
InlinePopover.displayName = "InlinePopover";
|
15
|
+
export {
|
16
|
+
InlinePopover
|
17
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
// src/components/popover.gen.ts
|
2
|
+
import { createComponent } from "@lit/react";
|
3
|
+
import { Popover as PopoverElement } from "@prosekit/lit/popover";
|
4
|
+
import React from "react";
|
5
|
+
var PopoverInner = createComponent({
|
6
|
+
tagName: "prosekit-popover",
|
7
|
+
elementClass: PopoverElement,
|
8
|
+
react: React,
|
9
|
+
displayName: "PopoverInner"
|
10
|
+
});
|
11
|
+
var Popover = React.forwardRef((props, ref) => {
|
12
|
+
return React.createElement(PopoverInner, { ...props, ref });
|
13
|
+
});
|
14
|
+
Popover.displayName = "Popover";
|
15
|
+
export {
|
16
|
+
Popover
|
17
|
+
};
|
package/dist/prosekit-react.d.ts
CHANGED
@@ -1,21 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
}
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
interface UseExtensionProps<T extends Extension = Extension> {
|
13
|
-
extension: T;
|
14
|
-
}
|
15
|
-
declare function useExtension({ extension }: UseExtensionProps): void;
|
16
|
-
|
17
|
-
declare function useKeymap({ keymap }: {
|
18
|
-
keymap: Keymap;
|
19
|
-
}): void;
|
20
|
-
|
21
|
-
export { ProseKit, ProseKitProps, useEditor, useExtension, useKeymap };
|
1
|
+
export { useNodeViewContext } from './_tsup-dts-rollup';
|
2
|
+
export { ProseKit } from './_tsup-dts-rollup';
|
3
|
+
export { ProseKitProps } from './_tsup-dts-rollup';
|
4
|
+
export { defineReactNodeView } from './_tsup-dts-rollup';
|
5
|
+
export { ReactNodeViewComponentProps } from './_tsup-dts-rollup';
|
6
|
+
export { ReactNodeViewOptions } from './_tsup-dts-rollup';
|
7
|
+
export { useEditor } from './_tsup-dts-rollup';
|
8
|
+
export { UseEditorOptions } from './_tsup-dts-rollup';
|
9
|
+
export { useExtension } from './_tsup-dts-rollup';
|
10
|
+
export { useKeymap } from './_tsup-dts-rollup';
|
package/dist/prosekit-react.js
CHANGED
@@ -1,49 +1,133 @@
|
|
1
|
-
// src/
|
1
|
+
// src/index.ts
|
2
|
+
import { useNodeViewContext as useNodeViewContext2 } from "@prosemirror-adapter/react";
|
3
|
+
|
4
|
+
// src/components/prosekit.ts
|
5
|
+
import "@prosekit/core";
|
6
|
+
import {
|
7
|
+
ProsemirrorAdapterProvider,
|
8
|
+
useNodeViewFactory
|
9
|
+
} from "@prosemirror-adapter/react";
|
10
|
+
import { createElement as createElement2, useMemo } from "react";
|
11
|
+
|
12
|
+
// src/contexts/editor-context.ts
|
2
13
|
import { createContext } from "react";
|
3
14
|
var editorContext = createContext(null);
|
4
15
|
|
5
|
-
// src/
|
6
|
-
import {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
+
// src/extensions/react-node-view.ts
|
17
|
+
import { defineNodeViewEffect } from "@prosekit/core";
|
18
|
+
import {
|
19
|
+
useNodeViewContext
|
20
|
+
} from "@prosemirror-adapter/react";
|
21
|
+
import { createElement } from "react";
|
22
|
+
function defineReactNodeView(options) {
|
23
|
+
return defineNodeViewEffect({
|
24
|
+
group: "react",
|
25
|
+
name: options.name,
|
26
|
+
args: options
|
27
|
+
});
|
28
|
+
}
|
29
|
+
function defineReactNodeViewRenderer({
|
30
|
+
nodeViewFactory
|
31
|
+
}) {
|
32
|
+
return defineNodeViewEffect({
|
33
|
+
group: "react",
|
34
|
+
factory: (args) => {
|
35
|
+
const nodeViewOptions = args;
|
36
|
+
return nodeViewFactory({
|
37
|
+
component: function ReactNodeViewWrapper() {
|
38
|
+
const context = useNodeViewContext();
|
39
|
+
return createElement(nodeViewOptions.component, context);
|
40
|
+
},
|
41
|
+
// Optional: add some options
|
42
|
+
as: () => {
|
43
|
+
const dom = document.createElement("div");
|
44
|
+
dom.style.display = "contents";
|
45
|
+
return dom;
|
46
|
+
},
|
47
|
+
contentAs: "code"
|
48
|
+
});
|
49
|
+
}
|
50
|
+
});
|
51
|
+
}
|
52
|
+
|
53
|
+
// src/hooks/use-extension.ts
|
54
|
+
import "@prosekit/core";
|
55
|
+
import { useEffect as useEffect2 } from "react";
|
16
56
|
|
17
57
|
// src/hooks/use-editor.ts
|
18
|
-
import {
|
19
|
-
|
20
|
-
|
58
|
+
import {
|
59
|
+
ProseKitError,
|
60
|
+
defineUpdateHandler
|
61
|
+
} from "@prosekit/core";
|
62
|
+
import { useContext, useEffect, useReducer } from "react";
|
63
|
+
function useEditor(options) {
|
64
|
+
var _a;
|
65
|
+
const update = (_a = options == null ? void 0 : options.update) != null ? _a : false;
|
21
66
|
const value = useContext(editorContext);
|
22
67
|
if (!value) {
|
23
68
|
throw new ProseKitError(
|
24
69
|
"useEditor must be used within the ProseKit component"
|
25
70
|
);
|
26
71
|
}
|
27
|
-
|
72
|
+
const editor = value.editor;
|
73
|
+
const forceUpdate = useForceUpdate();
|
74
|
+
useEffect(() => {
|
75
|
+
if (update) {
|
76
|
+
return editor.use(defineUpdateHandler(forceUpdate));
|
77
|
+
}
|
78
|
+
}, [editor, update, forceUpdate]);
|
79
|
+
return editor;
|
80
|
+
}
|
81
|
+
function useForceUpdate() {
|
82
|
+
const [, dispatch] = useReducer((x) => x + 1, 0);
|
83
|
+
return dispatch;
|
28
84
|
}
|
29
85
|
|
30
86
|
// src/hooks/use-extension.ts
|
31
|
-
|
32
|
-
function useExtension({ extension }) {
|
87
|
+
function useExtension(extension) {
|
33
88
|
const editor = useEditor();
|
34
|
-
|
89
|
+
useEffect2(() => {
|
90
|
+
return editor.use(extension);
|
91
|
+
}, [editor, extension]);
|
35
92
|
}
|
36
93
|
|
94
|
+
// src/components/prosekit.ts
|
95
|
+
var ProseKit = (props) => {
|
96
|
+
const { editor, children } = props;
|
97
|
+
return createElement2(
|
98
|
+
ProsemirrorAdapterProvider,
|
99
|
+
null,
|
100
|
+
createElement2(
|
101
|
+
EditorContextProvider,
|
102
|
+
{ value: { editor } },
|
103
|
+
children,
|
104
|
+
createElement2(RendererRegister)
|
105
|
+
)
|
106
|
+
);
|
107
|
+
};
|
108
|
+
function RendererRegister() {
|
109
|
+
const nodeViewFactory = useNodeViewFactory();
|
110
|
+
const extension = useMemo(
|
111
|
+
() => defineReactNodeViewRenderer({ nodeViewFactory }),
|
112
|
+
[nodeViewFactory]
|
113
|
+
);
|
114
|
+
useExtension(extension);
|
115
|
+
return null;
|
116
|
+
}
|
117
|
+
var EditorContextProvider = editorContext.Provider;
|
118
|
+
|
37
119
|
// src/hooks/use-keymap.ts
|
38
|
-
import {
|
39
|
-
import { useMemo } from "react";
|
40
|
-
function useKeymap(
|
41
|
-
const extension =
|
42
|
-
useExtension(
|
120
|
+
import { defineKeymap } from "@prosekit/core";
|
121
|
+
import { useMemo as useMemo2 } from "react";
|
122
|
+
function useKeymap(keymap) {
|
123
|
+
const extension = useMemo2(() => defineKeymap(keymap), [keymap]);
|
124
|
+
useExtension(extension);
|
43
125
|
}
|
44
126
|
export {
|
45
127
|
ProseKit,
|
128
|
+
defineReactNodeView,
|
46
129
|
useEditor,
|
47
130
|
useExtension,
|
48
|
-
useKeymap
|
131
|
+
useKeymap,
|
132
|
+
useNodeViewContext2 as useNodeViewContext
|
49
133
|
};
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@prosekit/react",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.0.0-next-
|
4
|
+
"version": "0.0.0-next-20231120040948",
|
5
5
|
"private": false,
|
6
6
|
"author": {
|
7
7
|
"name": "ocavue",
|
@@ -30,34 +30,65 @@
|
|
30
30
|
"import": "./dist/prosekit-react.js",
|
31
31
|
"default": "./dist/prosekit-react.js"
|
32
32
|
},
|
33
|
-
"./
|
34
|
-
"types": "./dist/prosekit-react-
|
35
|
-
"import": "./dist/prosekit-react-
|
36
|
-
"default": "./dist/prosekit-react-
|
33
|
+
"./autocomplete-empty": {
|
34
|
+
"types": "./dist/prosekit-react-autocomplete-empty.d.ts",
|
35
|
+
"import": "./dist/prosekit-react-autocomplete-empty.js",
|
36
|
+
"default": "./dist/prosekit-react-autocomplete-empty.js"
|
37
37
|
},
|
38
|
-
"./
|
39
|
-
"types": "./dist/prosekit-react-
|
40
|
-
"import": "./dist/prosekit-react-
|
41
|
-
"default": "./dist/prosekit-react-
|
38
|
+
"./autocomplete-item": {
|
39
|
+
"types": "./dist/prosekit-react-autocomplete-item.d.ts",
|
40
|
+
"import": "./dist/prosekit-react-autocomplete-item.js",
|
41
|
+
"default": "./dist/prosekit-react-autocomplete-item.js"
|
42
42
|
},
|
43
|
-
"./
|
44
|
-
"types": "./dist/prosekit-react-
|
45
|
-
"import": "./dist/prosekit-react-
|
46
|
-
"default": "./dist/prosekit-react-
|
43
|
+
"./autocomplete-list": {
|
44
|
+
"types": "./dist/prosekit-react-autocomplete-list.d.ts",
|
45
|
+
"import": "./dist/prosekit-react-autocomplete-list.js",
|
46
|
+
"default": "./dist/prosekit-react-autocomplete-list.js"
|
47
47
|
},
|
48
|
-
"./
|
49
|
-
"types": "./dist/prosekit-react-
|
50
|
-
"import": "./dist/prosekit-react-
|
51
|
-
"default": "./dist/prosekit-react-
|
48
|
+
"./autocomplete-popover": {
|
49
|
+
"types": "./dist/prosekit-react-autocomplete-popover.d.ts",
|
50
|
+
"import": "./dist/prosekit-react-autocomplete-popover.js",
|
51
|
+
"default": "./dist/prosekit-react-autocomplete-popover.js"
|
52
|
+
},
|
53
|
+
"./combo-box": {
|
54
|
+
"types": "./dist/prosekit-react-combo-box.d.ts",
|
55
|
+
"import": "./dist/prosekit-react-combo-box.js",
|
56
|
+
"default": "./dist/prosekit-react-combo-box.js"
|
57
|
+
},
|
58
|
+
"./combo-box-input": {
|
59
|
+
"types": "./dist/prosekit-react-combo-box-input.d.ts",
|
60
|
+
"import": "./dist/prosekit-react-combo-box-input.js",
|
61
|
+
"default": "./dist/prosekit-react-combo-box-input.js"
|
62
|
+
},
|
63
|
+
"./combo-box-item": {
|
64
|
+
"types": "./dist/prosekit-react-combo-box-item.d.ts",
|
65
|
+
"import": "./dist/prosekit-react-combo-box-item.js",
|
66
|
+
"default": "./dist/prosekit-react-combo-box-item.js"
|
67
|
+
},
|
68
|
+
"./combo-box-list": {
|
69
|
+
"types": "./dist/prosekit-react-combo-box-list.d.ts",
|
70
|
+
"import": "./dist/prosekit-react-combo-box-list.js",
|
71
|
+
"default": "./dist/prosekit-react-combo-box-list.js"
|
72
|
+
},
|
73
|
+
"./inline-popover": {
|
74
|
+
"types": "./dist/prosekit-react-inline-popover.d.ts",
|
75
|
+
"import": "./dist/prosekit-react-inline-popover.js",
|
76
|
+
"default": "./dist/prosekit-react-inline-popover.js"
|
77
|
+
},
|
78
|
+
"./popover": {
|
79
|
+
"types": "./dist/prosekit-react-popover.d.ts",
|
80
|
+
"import": "./dist/prosekit-react-popover.js",
|
81
|
+
"default": "./dist/prosekit-react-popover.js"
|
52
82
|
}
|
53
83
|
},
|
54
84
|
"files": [
|
55
85
|
"dist"
|
56
86
|
],
|
57
87
|
"dependencies": {
|
58
|
-
"@lit
|
59
|
-
"@prosekit/core": "0.0.0-next-
|
60
|
-
"@prosekit/lit": "0.0.0-next-
|
88
|
+
"@lit/react": "^1.0.2",
|
89
|
+
"@prosekit/core": "0.0.0-next-20231120040948",
|
90
|
+
"@prosekit/lit": "0.0.0-next-20231120040948",
|
91
|
+
"@prosemirror-adapter/react": "^0.2.6"
|
61
92
|
},
|
62
93
|
"peerDependencies": {
|
63
94
|
"react": ">= 17.0.0",
|
@@ -73,13 +104,13 @@
|
|
73
104
|
},
|
74
105
|
"devDependencies": {
|
75
106
|
"@prosekit/dev": "*",
|
76
|
-
"@types/react": "^18.2.
|
77
|
-
"@types/react-dom": "^18.2.
|
107
|
+
"@types/react": "^18.2.37",
|
108
|
+
"@types/react-dom": "^18.2.15",
|
78
109
|
"react": "^18.2.0",
|
79
110
|
"react-dom": "^18.2.0",
|
80
|
-
"tsup": "^
|
81
|
-
"typescript": "^5.
|
82
|
-
"vitest": "^0.
|
111
|
+
"tsup": "^8.0.0",
|
112
|
+
"typescript": "^5.2.2",
|
113
|
+
"vitest": "^0.34.6"
|
83
114
|
},
|
84
115
|
"scripts": {
|
85
116
|
"build:tsup": "tsup",
|
@@ -91,17 +122,35 @@
|
|
91
122
|
".": [
|
92
123
|
"./dist/prosekit-react.d.ts"
|
93
124
|
],
|
94
|
-
"
|
95
|
-
"./dist/prosekit-react-
|
125
|
+
"autocomplete-empty": [
|
126
|
+
"./dist/prosekit-react-autocomplete-empty.d.ts"
|
127
|
+
],
|
128
|
+
"autocomplete-item": [
|
129
|
+
"./dist/prosekit-react-autocomplete-item.d.ts"
|
130
|
+
],
|
131
|
+
"autocomplete-list": [
|
132
|
+
"./dist/prosekit-react-autocomplete-list.d.ts"
|
133
|
+
],
|
134
|
+
"autocomplete-popover": [
|
135
|
+
"./dist/prosekit-react-autocomplete-popover.d.ts"
|
136
|
+
],
|
137
|
+
"combo-box": [
|
138
|
+
"./dist/prosekit-react-combo-box.d.ts"
|
139
|
+
],
|
140
|
+
"combo-box-input": [
|
141
|
+
"./dist/prosekit-react-combo-box-input.d.ts"
|
142
|
+
],
|
143
|
+
"combo-box-item": [
|
144
|
+
"./dist/prosekit-react-combo-box-item.d.ts"
|
96
145
|
],
|
97
|
-
"
|
98
|
-
"./dist/prosekit-react-
|
146
|
+
"combo-box-list": [
|
147
|
+
"./dist/prosekit-react-combo-box-list.d.ts"
|
99
148
|
],
|
100
|
-
"
|
101
|
-
"./dist/prosekit-react-
|
149
|
+
"inline-popover": [
|
150
|
+
"./dist/prosekit-react-inline-popover.d.ts"
|
102
151
|
],
|
103
|
-
"
|
104
|
-
"./dist/prosekit-react-
|
152
|
+
"popover": [
|
153
|
+
"./dist/prosekit-react-popover.d.ts"
|
105
154
|
]
|
106
155
|
}
|
107
156
|
}
|
package/src/index.ts
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
|
2
|
-
* @module @prosekit/react
|
3
|
-
*/
|
4
|
-
|
1
|
+
export { useNodeViewContext } from '@prosemirror-adapter/react'
|
5
2
|
export { ProseKit, type ProseKitProps } from './components/prosekit'
|
6
|
-
export {
|
3
|
+
export {
|
4
|
+
defineReactNodeView,
|
5
|
+
type ReactNodeViewComponentProps,
|
6
|
+
type ReactNodeViewOptions,
|
7
|
+
} from './extensions/react-node-view'
|
8
|
+
export { useEditor, type UseEditorOptions } from './hooks/use-editor'
|
7
9
|
export { useExtension } from './hooks/use-extension'
|
8
10
|
export { useKeymap } from './hooks/use-keymap'
|
@@ -1,13 +0,0 @@
|
|
1
|
-
// src/components/menu-item.gen.ts
|
2
|
-
import { createComponent } from "@lit-labs/react";
|
3
|
-
import { MenuItem as MenuItemElement } from "@prosekit/lit/elements/menu-item";
|
4
|
-
import React from "react";
|
5
|
-
var MenuItem = createComponent({
|
6
|
-
tagName: "prosekit-menu-item",
|
7
|
-
elementClass: MenuItemElement,
|
8
|
-
react: React,
|
9
|
-
displayName: "MenuItem"
|
10
|
-
});
|
11
|
-
export {
|
12
|
-
MenuItem
|
13
|
-
};
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import { Editor } from '@prosekit/core';
|
2
|
-
import { Menu as Menu$1 } from '@prosekit/lit/elements/menu';
|
3
|
-
import { ComponentType, ForwardedRef, ReactNode } from 'react';
|
4
|
-
|
5
|
-
/**
|
6
|
-
* @module @prosekit/react/components/menu
|
7
|
-
*/
|
8
|
-
|
9
|
-
declare const Menu: ComponentType<{
|
10
|
-
editor?: Editor;
|
11
|
-
ref?: ForwardedRef<Menu$1>;
|
12
|
-
children?: ReactNode | undefined;
|
13
|
-
className?: string;
|
14
|
-
}>;
|
15
|
-
|
16
|
-
export { Menu };
|
@@ -1,16 +0,0 @@
|
|
1
|
-
// src/components/menu.gen.ts
|
2
|
-
import { createComponent } from "@lit-labs/react";
|
3
|
-
import { Menu as MenuElement } from "@prosekit/lit/elements/menu";
|
4
|
-
import React from "react";
|
5
|
-
var Menu = createComponent({
|
6
|
-
tagName: "prosekit-menu",
|
7
|
-
elementClass: MenuElement,
|
8
|
-
react: React,
|
9
|
-
displayName: "Menu"
|
10
|
-
});
|
11
|
-
|
12
|
-
// src/components/menu.tsx
|
13
|
-
var Menu2 = Menu;
|
14
|
-
export {
|
15
|
-
Menu2 as Menu
|
16
|
-
};
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import { Editor } from '@prosekit/core';
|
2
|
-
import { PredictionRule, PopoverSuggestionContext } from '@prosekit/lit/elements/popover-suggestion';
|
3
|
-
export { PopoverSuggestionContext, PredictionRule } from '@prosekit/lit/elements/popover-suggestion';
|
4
|
-
import React, { FC } from 'react';
|
5
|
-
|
6
|
-
/**
|
7
|
-
* @module @prosekit/react/components/popover-slash
|
8
|
-
*/
|
9
|
-
|
10
|
-
declare const PopoverSuggestion: FC<{
|
11
|
-
editor: Editor;
|
12
|
-
rules: PredictionRule[];
|
13
|
-
render: (context: PopoverSuggestionContext) => React.ReactNode;
|
14
|
-
}>;
|
15
|
-
|
16
|
-
export { PopoverSuggestion };
|
@@ -1,27 +0,0 @@
|
|
1
|
-
// src/components/popover-suggestion.tsx
|
2
|
-
import { useState } from "react";
|
3
|
-
|
4
|
-
// src/components/popover-suggestion.gen.ts
|
5
|
-
import { createComponent } from "@lit-labs/react";
|
6
|
-
import { PopoverSuggestion as PopoverSuggestionElement } from "@prosekit/lit/elements/popover-suggestion";
|
7
|
-
import React from "react";
|
8
|
-
var PopoverSuggestion = createComponent({
|
9
|
-
tagName: "prosekit-popover-suggestion",
|
10
|
-
elementClass: PopoverSuggestionElement,
|
11
|
-
react: React,
|
12
|
-
displayName: "PopoverSuggestion"
|
13
|
-
});
|
14
|
-
|
15
|
-
// src/components/popover-suggestion.tsx
|
16
|
-
import { jsxDEV } from "react/jsx-dev-runtime";
|
17
|
-
var PopoverSuggestion2 = ({ editor, rules, render }) => {
|
18
|
-
const [context, setContext] = useState(null);
|
19
|
-
return /* @__PURE__ */ jsxDEV(PopoverSuggestion, { editor, rules, onContext: setContext, children: context ? render(context) : null }, void 0, false, {
|
20
|
-
fileName: "src/components/popover-suggestion.tsx",
|
21
|
-
lineNumber: 23,
|
22
|
-
columnNumber: 5
|
23
|
-
}, this);
|
24
|
-
};
|
25
|
-
export {
|
26
|
-
PopoverSuggestion2 as PopoverSuggestion
|
27
|
-
};
|
@@ -1,13 +0,0 @@
|
|
1
|
-
// src/components/popover.gen.ts
|
2
|
-
import { createComponent } from "@lit-labs/react";
|
3
|
-
import { Popover as PopoverElement } from "@prosekit/lit/elements/popover";
|
4
|
-
import React from "react";
|
5
|
-
var Popover = createComponent({
|
6
|
-
tagName: "prosekit-popover",
|
7
|
-
elementClass: PopoverElement,
|
8
|
-
react: React,
|
9
|
-
displayName: "Popover"
|
10
|
-
});
|
11
|
-
export {
|
12
|
-
Popover
|
13
|
-
};
|