@prosekit/react 0.1.2 → 0.1.4

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.
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
 
3
+ import type { Attrs } from '@prosekit/pm/model';
3
4
  import { AutocompleteEmpty as AutocompleteEmpty_2 } from '@prosekit/lit/autocomplete-empty';
4
5
  import { AutocompleteEmptyProps as AutocompleteEmptyProps_2 } from '@prosekit/lit/autocomplete-empty';
5
6
  import { AutocompleteItem as AutocompleteItem_2 } from '@prosekit/lit/autocomplete-item';
@@ -8,6 +9,7 @@ import { AutocompleteList as AutocompleteList_2 } from '@prosekit/lit/autocomple
8
9
  import { AutocompleteListProps as AutocompleteListProps_2 } from '@prosekit/lit/autocomplete-list';
9
10
  import { AutocompletePopover as AutocompletePopover_2 } from '@prosekit/lit/autocomplete-popover';
10
11
  import { AutocompletePopoverProps as AutocompletePopoverProps_2 } from '@prosekit/lit/autocomplete-popover';
12
+ import { BaseNodeViewOptions } from '@prosekit/core';
11
13
  import { ComboBox as ComboBox_2 } from '@prosekit/lit/combo-box';
12
14
  import { ComboBoxInput as ComboBoxInput_2 } from '@prosekit/lit/combo-box-input';
13
15
  import { ComboBoxInputProps as ComboBoxInputProps_2 } from '@prosekit/lit/combo-box-input';
@@ -19,22 +21,29 @@ import { ComboBoxProps as ComboBoxProps_2 } from '@prosekit/lit/combo-box';
19
21
  import { CommandArgs } from '@prosekit/core';
20
22
  import { ComponentType } from 'react';
21
23
  import { Context } from 'react';
24
+ import { CoreNodeView } from '@prosemirror-adapter/core';
25
+ import type { CoreNodeViewSpec } from '@prosemirror-adapter/core';
26
+ import type { CoreNodeViewUserOptions } from '@prosemirror-adapter/core';
27
+ import type { Decoration } from '@prosekit/pm/view';
28
+ import type { DecorationSource } from '@prosekit/pm/view';
22
29
  import { Editor } from '@prosekit/core';
30
+ import type { EditorView } from '@prosekit/pm/view';
23
31
  import { Extension } from '@prosekit/core';
24
32
  import { ExtensionTyping } from '@prosekit/core';
33
+ import { FC } from 'react';
25
34
  import { InlinePopover as InlinePopover_2 } from '@prosekit/lit/inline-popover';
26
35
  import { InlinePopoverProps as InlinePopoverProps_2 } from '@prosekit/lit/inline-popover';
27
36
  import { Keymap } from '@prosekit/core';
28
- import type { NodeViewContext } from '@prosemirror-adapter/react';
37
+ import type { Node as Node_2 } from '@prosekit/pm/model';
38
+ import type { NodeViewConstructor } from '@prosekit/pm/view';
29
39
  import { Options } from 'tsup';
30
40
  import { Popover as Popover_2 } from '@prosekit/lit/popover';
31
41
  import { PopoverOptions } from '@prosekit/lit/autocomplete-popover';
32
42
  import { PopoverProps as PopoverProps_2 } from '@prosekit/lit/popover';
33
43
  import { Priority } from '@prosekit/core';
34
44
  import { default as React_2 } from 'react';
35
- import { useNodeViewContext } from '@prosemirror-adapter/react';
36
- import { useNodeViewFactory } from '@prosemirror-adapter/react';
37
- import { UserProjectConfigExport } from 'vitest/dist/config.js';
45
+ import { ReactNode } from 'react';
46
+ import { ReactPortal } from 'react';
38
47
 
39
48
  declare const AutocompleteEmpty: React_2.ComponentType<AutocompleteEmptyProps & React_2.RefAttributes<AutocompleteEmpty_2>>;
40
49
  export { AutocompleteEmpty }
@@ -84,17 +93,33 @@ export declare type ComboBoxListProps = React_2.PropsWithChildren<PropsWithClass
84
93
 
85
94
  export declare type ComboBoxProps = React_2.PropsWithChildren<PropsWithClassName<ComboBoxProps_2>>;
86
95
 
96
+ export declare const createNodeViewContext: Context<NodeViewFactory | null>;
97
+
98
+ declare type CreateReactNodeView = ReturnType<typeof useReactNodeViewCreator>;
99
+ export { CreateReactNodeView }
100
+ export { CreateReactNodeView as CreateReactNodeView_alias_1 }
101
+
87
102
  export declare const default_alias: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
88
103
 
89
- export declare const default_alias_1: UserProjectConfigExport;
104
+ export declare const default_alias_1: {
105
+ test: {
106
+ environment: "jsdom";
107
+ };
108
+ };
90
109
 
110
+ /**
111
+ * Defines a node view using a React component.
112
+ *
113
+ * @public
114
+ */
91
115
  declare function defineReactNodeView(options: ReactNodeViewOptions): Extension;
92
116
  export { defineReactNodeView }
93
117
  export { defineReactNodeView as defineReactNodeView_alias_1 }
94
118
 
95
- export declare function defineReactNodeViewRenderer({ nodeViewFactory, }: {
96
- nodeViewFactory: ReturnType<typeof useNodeViewFactory>;
97
- }): Extension<ExtensionTyping<string, string, CommandArgs>>;
119
+ /**
120
+ * @internal
121
+ */
122
+ export declare function defineReactNodeViewFactory(nodeViewFactory: NodeViewFactory): Extension<ExtensionTyping<string, string, CommandArgs>>;
98
123
 
99
124
  export declare interface EditorContext {
100
125
  editor: Editor;
@@ -106,6 +131,8 @@ export declare const InlinePopover: React_2.ComponentType<InlinePopoverProps & R
106
131
 
107
132
  export declare type InlinePopoverProps = React_2.PropsWithChildren<PropsWithClassName<InlinePopoverProps_2>>;
108
133
 
134
+ export declare type NodeViewFactory = (options: ReactNodeViewUserOptions) => NodeViewConstructor;
135
+
109
136
  export declare const Popover: React_2.ComponentType<PopoverProps & React_2.RefAttributes<Popover_2>>;
110
137
 
111
138
  export { PopoverOptions }
@@ -127,33 +154,89 @@ export { ProseKit as ProseKit_alias_1 }
127
154
 
128
155
  declare interface ProseKitProps {
129
156
  editor: Editor;
130
- children?: React_2.ReactNode;
157
+ children?: ReactNode;
131
158
  }
132
159
  export { ProseKitProps }
133
160
  export { ProseKitProps as ProseKitProps_alias_1 }
134
161
 
135
- declare type ReactNodeViewComponentProps = NodeViewContext;
136
- export { ReactNodeViewComponentProps }
137
- export { ReactNodeViewComponentProps as ReactNodeViewComponentProps_alias_1 }
162
+ export declare class ReactNodeView extends CoreNodeView<ReactNodeViewComponent> implements ReactRenderer<ReactNodeViewProps> {
163
+ key: string;
164
+ context: ReactNodeViewProps;
165
+ updateContext: () => void;
166
+ render: () => ReactPortal;
167
+ }
168
+
169
+ /**
170
+ * @public
171
+ */
172
+ declare type ReactNodeViewComponent = ComponentType<ReactNodeViewProps>;
173
+ export { ReactNodeViewComponent }
174
+ export { ReactNodeViewComponent as ReactNodeViewComponent_alias_1 }
138
175
 
139
- declare interface ReactNodeViewOptions {
176
+ /**
177
+ * Options for {@link defineReactNodeView}.
178
+ *
179
+ * @public
180
+ */
181
+ declare interface ReactNodeViewOptions extends BaseNodeViewOptions {
182
+ /**
183
+ * The name of the node type.
184
+ */
140
185
  name: string;
141
- component: React.ComponentType<ReactNodeViewComponentProps>;
142
- dom?: string | (() => HTMLElement);
143
- contentDOM?: string | (() => HTMLElement);
186
+ /**
187
+ * The React component to render the node.
188
+ */
189
+ component: ReactNodeViewComponent;
144
190
  }
145
191
  export { ReactNodeViewOptions }
146
192
  export { ReactNodeViewOptions as ReactNodeViewOptions_alias_1 }
147
193
 
148
- declare function useEditor<E extends Extension = any>(options?: UseEditorOptions): Editor<E>;
149
- export { useEditor }
150
- export { useEditor as useEditor_alias_1 }
194
+ /**
195
+ * @public
196
+ */
197
+ declare interface ReactNodeViewProps {
198
+ contentRef: (node: HTMLElement | null) => void;
199
+ view: EditorView;
200
+ getPos: () => number | undefined;
201
+ setAttrs: (attrs: Attrs) => void;
202
+ node: Node_2;
203
+ selected: boolean;
204
+ decorations: readonly Decoration[];
205
+ innerDecorations: DecorationSource;
206
+ }
207
+ export { ReactNodeViewProps }
208
+ export { ReactNodeViewProps as ReactNodeViewProps_alias_1 }
151
209
 
152
- declare interface UseEditorOptions {
153
- update?: boolean;
210
+ export declare type ReactNodeViewSpec = CoreNodeViewSpec<ReactNodeViewComponent>;
211
+
212
+ export declare type ReactNodeViewUserOptions = CoreNodeViewUserOptions<ReactNodeViewComponent>;
213
+
214
+ export declare interface ReactRenderer<Context> {
215
+ key: string;
216
+ context: Context;
217
+ render: () => ReactPortal;
218
+ updateContext: () => void;
219
+ }
220
+
221
+ export declare interface ReactRendererResult {
222
+ readonly portals: Record<string, ReactPortal>;
223
+ readonly renderReactRenderer: (nodeView: ReactRenderer<unknown>, update?: boolean) => void;
224
+ readonly removeReactRenderer: (nodeView: ReactRenderer<unknown>) => void;
154
225
  }
155
- export { UseEditorOptions }
156
- export { UseEditorOptions as UseEditorOptions_alias_1 }
226
+
227
+ export declare const ReactViewsConsumer: FC;
228
+
229
+ declare const ReactViewsProvider: FC<{
230
+ children: ReactNode;
231
+ }>;
232
+ export { ReactViewsProvider }
233
+ export { ReactViewsProvider as ReactViewsProvider_alias_1 }
234
+
235
+ declare function useEditor<E extends Extension = any>(options?: {
236
+ update?: boolean;
237
+ }): Editor<E>;
238
+ export { useEditor }
239
+ export { useEditor as useEditor_alias_1 }
157
240
 
158
241
  /**
159
242
  * Add an extension to the editor.
@@ -171,8 +254,12 @@ declare function useKeymap(keymap: Keymap, options?: {
171
254
  export { useKeymap }
172
255
  export { useKeymap as useKeymap_alias_1 }
173
256
 
174
- export { useNodeViewContext }
257
+ export declare function useNodeViewFactory(): NodeViewFactory;
175
258
 
176
259
  export declare function usePriorityExtension<T extends Extension = Extension>(extension: T | null, priority?: Priority | null): void;
177
260
 
261
+ export declare function useReactNodeViewCreator(renderReactRenderer: ReactRendererResult['renderReactRenderer'], removeReactRenderer: ReactRendererResult['removeReactRenderer']): (options: ReactNodeViewUserOptions) => NodeViewConstructor;
262
+
263
+ export declare function useReactRenderer(): ReactRendererResult;
264
+
178
265
  export { }
@@ -1,11 +1,10 @@
1
- export { useNodeViewContext } from './_tsup-dts-rollup';
1
+ export { ReactNodeViewComponent } from './_tsup-dts-rollup';
2
2
  export { ProseKit } from './_tsup-dts-rollup';
3
3
  export { ProseKitProps } from './_tsup-dts-rollup';
4
4
  export { defineReactNodeView } from './_tsup-dts-rollup';
5
- export { ReactNodeViewComponentProps } from './_tsup-dts-rollup';
6
5
  export { ReactNodeViewOptions } from './_tsup-dts-rollup';
7
6
  export { useEditor } from './_tsup-dts-rollup';
8
- export { UseEditorOptions } from './_tsup-dts-rollup';
9
7
  export { useExtension } from './_tsup-dts-rollup';
10
8
  export { useKeymap } from './_tsup-dts-rollup';
11
9
  export { PropsWithClassName } from './_tsup-dts-rollup';
10
+ export { ReactNodeViewProps } from './_tsup-dts-rollup';
@@ -1,52 +1,30 @@
1
- // src/index.ts
2
- import { useNodeViewContext as useNodeViewContext2 } from "@prosemirror-adapter/react";
3
-
4
1
  // src/components/prosekit.ts
5
2
  import "@prosekit/core";
6
- import {
7
- ProsemirrorAdapterProvider,
8
- useNodeViewFactory
9
- } from "@prosemirror-adapter/react";
10
- import { createElement as createElement2, useMemo } from "react";
3
+ import { createElement as createElement3 } from "react";
11
4
 
12
5
  // src/contexts/editor-context.ts
13
6
  import { createContext } from "react";
14
7
  var editorContext = createContext(null);
15
8
 
9
+ // src/views/react-views-consumer.ts
10
+ import { useMemo } from "react";
11
+
16
12
  // src/extensions/react-node-view.ts
17
- import { defineNodeViewEffect } from "@prosekit/core";
18
13
  import {
19
- useNodeViewContext
20
- } from "@prosemirror-adapter/react";
21
- import { createElement } from "react";
14
+ defineNodeViewFactory
15
+ } from "@prosekit/core";
22
16
  function defineReactNodeView(options) {
23
- return defineNodeViewEffect({
17
+ const { name, ...userOptions } = options;
18
+ return defineNodeViewFactory({
24
19
  group: "react",
25
- name: options.name,
26
- args: options
20
+ name,
21
+ args: userOptions
27
22
  });
28
23
  }
29
- function defineReactNodeViewRenderer({
30
- nodeViewFactory
31
- }) {
32
- return defineNodeViewEffect({
24
+ function defineReactNodeViewFactory(nodeViewFactory) {
25
+ return defineNodeViewFactory({
33
26
  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
- }
27
+ factory: nodeViewFactory
50
28
  });
51
29
  }
52
30
 
@@ -93,40 +71,212 @@ function useExtension(extension) {
93
71
  }, [editor, extension]);
94
72
  }
95
73
 
74
+ // src/views/node-view/node-view-context.ts
75
+ import { ProseKitError as ProseKitError2 } from "@prosekit/core";
76
+ import { createContext as createContext2, useContext as useContext2 } from "react";
77
+ var createNodeViewContext = createContext2(null);
78
+ function useNodeViewFactory() {
79
+ const nodeViewFactory = useContext2(createNodeViewContext);
80
+ if (!nodeViewFactory) {
81
+ throw new ProseKitError2("Cannot find node view factory context.");
82
+ }
83
+ return nodeViewFactory;
84
+ }
85
+
86
+ // src/views/react-views-consumer.ts
87
+ var ReactViewsConsumer = () => {
88
+ const nodeViewFactory = useNodeViewFactory();
89
+ const extension = useMemo(
90
+ () => defineReactNodeViewFactory(nodeViewFactory),
91
+ [nodeViewFactory]
92
+ );
93
+ useExtension(extension);
94
+ return null;
95
+ };
96
+
97
+ // src/views/react-views-provider.ts
98
+ import { createElement as createElement2, useMemo as useMemo2 } from "react";
99
+
100
+ // src/views/node-view/use-react-node-view-creator.ts
101
+ import { useCallback } from "react";
102
+
103
+ // src/views/node-view/react-node-view.ts
104
+ import { _getId } from "@prosekit/core";
105
+ import { CoreNodeView } from "@prosemirror-adapter/core";
106
+ import { createElement } from "react";
107
+ import { createPortal } from "react-dom";
108
+ var ReactNodeView = class extends CoreNodeView {
109
+ constructor() {
110
+ super(...arguments);
111
+ this.key = _getId();
112
+ this.context = {
113
+ contentRef: (element) => {
114
+ if (element && this.contentDOM && element.firstChild !== this.contentDOM)
115
+ element.appendChild(this.contentDOM);
116
+ },
117
+ view: this.view,
118
+ getPos: this.getPos,
119
+ setAttrs: this.setAttrs,
120
+ node: this.node,
121
+ selected: this.selected,
122
+ decorations: this.decorations,
123
+ innerDecorations: this.innerDecorations
124
+ };
125
+ this.updateContext = () => {
126
+ Object.assign(this.context, {
127
+ node: this.node,
128
+ selected: this.selected,
129
+ decorations: this.decorations,
130
+ innerDecorations: this.innerDecorations
131
+ });
132
+ };
133
+ this.render = () => {
134
+ const UserComponent = this.component;
135
+ return createPortal(
136
+ createElement(UserComponent, this.context),
137
+ this.dom,
138
+ this.key
139
+ );
140
+ };
141
+ }
142
+ };
143
+
144
+ // src/views/node-view/use-react-node-view-creator.ts
145
+ function useReactNodeViewCreator(renderReactRenderer, removeReactRenderer) {
146
+ const createReactNodeView = useCallback(
147
+ (options) => (node, view, getPos, decorations, innerDecorations) => {
148
+ const nodeView = new ReactNodeView({
149
+ node,
150
+ view,
151
+ getPos,
152
+ decorations,
153
+ innerDecorations,
154
+ options: {
155
+ ...options,
156
+ onUpdate() {
157
+ var _a;
158
+ (_a = options.onUpdate) == null ? void 0 : _a.call(options);
159
+ renderReactRenderer(nodeView);
160
+ },
161
+ selectNode() {
162
+ var _a;
163
+ (_a = options.selectNode) == null ? void 0 : _a.call(options);
164
+ renderReactRenderer(nodeView);
165
+ },
166
+ deselectNode() {
167
+ var _a;
168
+ (_a = options.deselectNode) == null ? void 0 : _a.call(options);
169
+ renderReactRenderer(nodeView);
170
+ },
171
+ destroy() {
172
+ var _a;
173
+ (_a = options.destroy) == null ? void 0 : _a.call(options);
174
+ removeReactRenderer(nodeView);
175
+ }
176
+ }
177
+ });
178
+ renderReactRenderer(nodeView, false);
179
+ return nodeView;
180
+ },
181
+ [removeReactRenderer, renderReactRenderer]
182
+ );
183
+ return createReactNodeView;
184
+ }
185
+
186
+ // src/views/react-renderer.ts
187
+ import { useCallback as useCallback2, useEffect as useEffect3, useRef, useState } from "react";
188
+ import { flushSync } from "react-dom";
189
+ function useReactRenderer() {
190
+ const [portals, setPortals] = useState({});
191
+ const mountedRef = useRef(false);
192
+ useEffect3(() => {
193
+ requestAnimationFrame(() => {
194
+ mountedRef.current = true;
195
+ });
196
+ return () => {
197
+ mountedRef.current = false;
198
+ };
199
+ }, []);
200
+ const maybeFlushSync = useCallback2((fn) => {
201
+ if (mountedRef.current)
202
+ flushSync(fn);
203
+ else
204
+ fn();
205
+ }, []);
206
+ const renderReactRenderer = useCallback2(
207
+ (nodeView, update = true) => {
208
+ maybeFlushSync(() => {
209
+ if (update)
210
+ nodeView.updateContext();
211
+ setPortals((prev) => ({
212
+ ...prev,
213
+ [nodeView.key]: nodeView.render()
214
+ }));
215
+ });
216
+ },
217
+ [maybeFlushSync]
218
+ );
219
+ const removeReactRenderer = useCallback2(
220
+ (nodeView) => {
221
+ maybeFlushSync(() => {
222
+ setPortals((prev) => {
223
+ const next = { ...prev };
224
+ delete next[nodeView.key];
225
+ return next;
226
+ });
227
+ });
228
+ },
229
+ [maybeFlushSync]
230
+ );
231
+ return {
232
+ portals,
233
+ renderReactRenderer,
234
+ removeReactRenderer
235
+ };
236
+ }
237
+
238
+ // src/views/react-views-provider.ts
239
+ var ReactViewsProvider = ({
240
+ children
241
+ }) => {
242
+ const { renderReactRenderer, removeReactRenderer, portals } = useReactRenderer();
243
+ const createReactNodeView = useReactNodeViewCreator(
244
+ renderReactRenderer,
245
+ removeReactRenderer
246
+ );
247
+ const memoizedPortals = useMemo2(() => Object.values(portals), [portals]);
248
+ return createElement2(
249
+ createNodeViewContext.Provider,
250
+ { value: createReactNodeView },
251
+ children,
252
+ memoizedPortals
253
+ );
254
+ };
255
+
96
256
  // src/components/prosekit.ts
97
257
  var ProseKit = (props) => {
98
258
  const { editor, children } = props;
99
- return createElement2(
100
- ProsemirrorAdapterProvider,
259
+ return createElement3(
260
+ ReactViewsProvider,
101
261
  null,
102
- createElement2(
103
- EditorContextProvider,
262
+ createElement3(
263
+ editorContext.Provider,
104
264
  { value: { editor } },
105
- children,
106
- createElement2(RendererRegister)
265
+ createElement3(ReactViewsConsumer),
266
+ children
107
267
  )
108
268
  );
109
269
  };
110
- function RendererRegister() {
111
- const nodeViewFactory = useNodeViewFactory();
112
- const extension = useMemo(
113
- () => defineReactNodeViewRenderer({ nodeViewFactory }),
114
- [nodeViewFactory]
115
- );
116
- useExtension(extension);
117
- return null;
118
- }
119
- var EditorContextProvider = editorContext.Provider;
120
270
 
121
271
  // src/hooks/use-keymap.ts
122
272
  import { defineKeymap } from "@prosekit/core";
123
- import { useMemo as useMemo3 } from "react";
273
+ import { useMemo as useMemo4 } from "react";
124
274
 
125
275
  // src/hooks/use-priority-extension.ts
126
276
  import { withPriority } from "@prosekit/core";
127
- import { useMemo as useMemo2 } from "react";
277
+ import { useMemo as useMemo3 } from "react";
128
278
  function usePriorityExtension(extension, priority) {
129
- const extensionWithPriority = useMemo2(() => {
279
+ const extensionWithPriority = useMemo3(() => {
130
280
  return extension && priority ? withPriority(extension, priority) : extension;
131
281
  }, [extension, priority]);
132
282
  return useExtension(extensionWithPriority);
@@ -134,7 +284,7 @@ function usePriorityExtension(extension, priority) {
134
284
 
135
285
  // src/hooks/use-keymap.ts
136
286
  function useKeymap(keymap, options) {
137
- const extension = useMemo3(() => defineKeymap(keymap), [keymap]);
287
+ const extension = useMemo4(() => defineKeymap(keymap), [keymap]);
138
288
  usePriorityExtension(extension, options == null ? void 0 : options.priority);
139
289
  }
140
290
  export {
@@ -142,6 +292,5 @@ export {
142
292
  defineReactNodeView,
143
293
  useEditor,
144
294
  useExtension,
145
- useKeymap,
146
- useNodeViewContext2 as useNodeViewContext
295
+ useKeymap
147
296
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/react",
3
3
  "type": "module",
4
- "version": "0.1.2",
4
+ "version": "0.1.4",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -86,9 +86,10 @@
86
86
  ],
87
87
  "dependencies": {
88
88
  "@lit/react": "^1.0.2",
89
- "@prosekit/core": "^0.1.0",
90
- "@prosekit/lit": "^0.1.0",
91
- "@prosemirror-adapter/react": "^0.2.6"
89
+ "@prosekit/core": "^0.2.0",
90
+ "@prosekit/lit": "^0.1.5",
91
+ "@prosekit/pm": "^0.1.1",
92
+ "@prosemirror-adapter/core": "^0.2.6"
92
93
  },
93
94
  "peerDependencies": {
94
95
  "react": ">= 17.0.0",
@@ -104,13 +105,13 @@
104
105
  },
105
106
  "devDependencies": {
106
107
  "@prosekit/dev": "*",
107
- "@types/react": "^18.2.39",
108
- "@types/react-dom": "^18.2.17",
108
+ "@types/react": "^18.2.45",
109
+ "@types/react-dom": "^18.2.18",
109
110
  "react": "^18.2.0",
110
111
  "react-dom": "^18.2.0",
111
112
  "tsup": "^8.0.1",
112
- "typescript": "^5.3.2",
113
- "vitest": "^0.34.6"
113
+ "typescript": "^5.3.3",
114
+ "vitest": "^1.1.0"
114
115
  },
115
116
  "scripts": {
116
117
  "build:tsup": "tsup",
package/src/index.ts CHANGED
@@ -1,11 +1,11 @@
1
- export { useNodeViewContext } from '@prosemirror-adapter/react'
1
+ export type { ReactNodeViewComponent } from './views/node-view/react-node-view-options'
2
2
  export { ProseKit, type ProseKitProps } from './components/prosekit'
3
3
  export {
4
4
  defineReactNodeView,
5
- type ReactNodeViewComponentProps,
6
5
  type ReactNodeViewOptions,
7
6
  } from './extensions/react-node-view'
8
- export { useEditor, type UseEditorOptions } from './hooks/use-editor'
7
+ export { useEditor } from './hooks/use-editor'
9
8
  export { useExtension } from './hooks/use-extension'
10
9
  export { useKeymap } from './hooks/use-keymap'
11
10
  export { type PropsWithClassName } from './types'
11
+ export type { ReactNodeViewProps } from './views/node-view/react-node-view-props'