@prosekit/react 0.1.4 → 0.1.6

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.
@@ -44,6 +44,10 @@ import { Priority } from '@prosekit/core';
44
44
  import { default as React_2 } from 'react';
45
45
  import { ReactNode } from 'react';
46
46
  import { ReactPortal } from 'react';
47
+ import { Resizable as Resizable_2 } from '@prosekit/lit/resizable';
48
+ import { ResizableHandle as ResizableHandle_2 } from '@prosekit/lit/resizable-handle';
49
+ import { ResizableHandleProps as ResizableHandleProps_2 } from '@prosekit/lit/resizable-handle';
50
+ import { ResizableProps as ResizableProps_2 } from '@prosekit/lit/resizable';
47
51
 
48
52
  declare const AutocompleteEmpty: React_2.ComponentType<AutocompleteEmptyProps & React_2.RefAttributes<AutocompleteEmpty_2>>;
49
53
  export { AutocompleteEmpty }
@@ -232,7 +236,26 @@ declare const ReactViewsProvider: FC<{
232
236
  export { ReactViewsProvider }
233
237
  export { ReactViewsProvider as ReactViewsProvider_alias_1 }
234
238
 
239
+ export declare const Resizable: React_2.ComponentType<ResizableProps & React_2.RefAttributes<Resizable_2>>;
240
+
241
+ export declare const ResizableHandle: React_2.ComponentType<ResizableHandleProps & React_2.RefAttributes<ResizableHandle_2>>;
242
+
243
+ export declare type ResizableHandleProps = React_2.PropsWithChildren<PropsWithClassName<ResizableHandleProps_2>>;
244
+
245
+ export declare type ResizableProps = React_2.PropsWithChildren<PropsWithClassName<ResizableProps_2>>;
246
+
247
+ /**
248
+ * Retrieves the editor instance from the nearest ProseKit component.
249
+ *
250
+ * @public
251
+ */
235
252
  declare function useEditor<E extends Extension = any>(options?: {
253
+ /**
254
+ * Whether to update the component when the editor is mounted or editor state
255
+ * is updated.
256
+ *
257
+ * @default false
258
+ */
236
259
  update?: boolean;
237
260
  }): Editor<E>;
238
261
  export { useEditor }
@@ -0,0 +1,2 @@
1
+ export { ResizableHandleProps } from './_tsup-dts-rollup';
2
+ export { ResizableHandle } from './_tsup-dts-rollup';
@@ -0,0 +1,17 @@
1
+ // src/components/resizable-handle.gen.ts
2
+ import { createComponent } from "@lit/react";
3
+ import { ResizableHandle as ResizableHandleElement } from "@prosekit/lit/resizable-handle";
4
+ import React from "react";
5
+ var ResizableHandleInner = createComponent({
6
+ tagName: "prosekit-resizable-handle",
7
+ elementClass: ResizableHandleElement,
8
+ react: React,
9
+ displayName: "ResizableHandleInner"
10
+ });
11
+ var ResizableHandle = React.forwardRef((props, ref) => {
12
+ return React.createElement(ResizableHandleInner, { ...props, ref });
13
+ });
14
+ ResizableHandle.displayName = "ResizableHandle";
15
+ export {
16
+ ResizableHandle
17
+ };
@@ -0,0 +1,2 @@
1
+ export { ResizableProps } from './_tsup-dts-rollup';
2
+ export { Resizable } from './_tsup-dts-rollup';
@@ -0,0 +1,17 @@
1
+ // src/components/resizable.gen.ts
2
+ import { createComponent } from "@lit/react";
3
+ import { Resizable as ResizableElement } from "@prosekit/lit/resizable";
4
+ import React from "react";
5
+ var ResizableInner = createComponent({
6
+ tagName: "prosekit-resizable",
7
+ elementClass: ResizableElement,
8
+ react: React,
9
+ displayName: "ResizableInner"
10
+ });
11
+ var Resizable = React.forwardRef((props, ref) => {
12
+ return React.createElement(ResizableInner, { ...props, ref });
13
+ });
14
+ Resizable.displayName = "Resizable";
15
+ export {
16
+ Resizable
17
+ };
@@ -35,7 +35,9 @@ import { useEffect as useEffect2 } from "react";
35
35
  // src/hooks/use-editor.ts
36
36
  import {
37
37
  ProseKitError,
38
- defineUpdateHandler
38
+ defineUpdateHandler,
39
+ union,
40
+ defineMountHandler
39
41
  } from "@prosekit/core";
40
42
  import { useContext, useEffect, useReducer } from "react";
41
43
  function useEditor(options) {
@@ -51,7 +53,11 @@ function useEditor(options) {
51
53
  const forceUpdate = useForceUpdate();
52
54
  useEffect(() => {
53
55
  if (update) {
54
- return editor.use(defineUpdateHandler(forceUpdate));
56
+ const extension = union([
57
+ defineMountHandler(forceUpdate),
58
+ defineUpdateHandler(forceUpdate)
59
+ ]);
60
+ return editor.use(extension);
55
61
  }
56
62
  }, [editor, update, forceUpdate]);
57
63
  return editor;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/react",
3
3
  "type": "module",
4
- "version": "0.1.4",
4
+ "version": "0.1.6",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -79,6 +79,16 @@
79
79
  "types": "./dist/prosekit-react-popover.d.ts",
80
80
  "import": "./dist/prosekit-react-popover.js",
81
81
  "default": "./dist/prosekit-react-popover.js"
82
+ },
83
+ "./resizable": {
84
+ "types": "./dist/prosekit-react-resizable.d.ts",
85
+ "import": "./dist/prosekit-react-resizable.js",
86
+ "default": "./dist/prosekit-react-resizable.js"
87
+ },
88
+ "./resizable-handle": {
89
+ "types": "./dist/prosekit-react-resizable-handle.d.ts",
90
+ "import": "./dist/prosekit-react-resizable-handle.js",
91
+ "default": "./dist/prosekit-react-resizable-handle.js"
82
92
  }
83
93
  },
84
94
  "files": [
@@ -86,8 +96,8 @@
86
96
  ],
87
97
  "dependencies": {
88
98
  "@lit/react": "^1.0.2",
89
- "@prosekit/core": "^0.2.0",
90
- "@prosekit/lit": "^0.1.5",
99
+ "@prosekit/core": "^0.2.5",
100
+ "@prosekit/lit": "^0.1.9",
91
101
  "@prosekit/pm": "^0.1.1",
92
102
  "@prosemirror-adapter/core": "^0.2.6"
93
103
  },
@@ -105,13 +115,13 @@
105
115
  },
106
116
  "devDependencies": {
107
117
  "@prosekit/dev": "*",
108
- "@types/react": "^18.2.45",
118
+ "@types/react": "^18.2.47",
109
119
  "@types/react-dom": "^18.2.18",
110
120
  "react": "^18.2.0",
111
121
  "react-dom": "^18.2.0",
112
122
  "tsup": "^8.0.1",
113
123
  "typescript": "^5.3.3",
114
- "vitest": "^1.1.0"
124
+ "vitest": "^1.2.0"
115
125
  },
116
126
  "scripts": {
117
127
  "build:tsup": "tsup",
@@ -152,6 +162,12 @@
152
162
  ],
153
163
  "popover": [
154
164
  "./dist/prosekit-react-popover.d.ts"
165
+ ],
166
+ "resizable": [
167
+ "./dist/prosekit-react-resizable.d.ts"
168
+ ],
169
+ "resizable-handle": [
170
+ "./dist/prosekit-react-resizable-handle.d.ts"
155
171
  ]
156
172
  }
157
173
  }