@prosekit/vue 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.
@@ -35,6 +35,8 @@ import { PublicProps } from 'vue';
35
35
  import { Ref } from 'vue';
36
36
  import { RendererElement } from 'vue';
37
37
  import { RendererNode } from 'vue';
38
+ import { ResizableHandleProps as ResizableHandleProps_2 } from '@prosekit/lit/resizable-handle';
39
+ import { ResizableProps as ResizableProps_2 } from '@prosekit/lit/resizable';
38
40
  import { ShallowRef } from 'vue';
39
41
  import { VNode } from 'vue';
40
42
  import type { VNodeRef } from 'vue';
@@ -172,11 +174,30 @@ export { ProseKitProps as ProseKitProps_alias_1 }
172
174
 
173
175
  export declare function provideEditor(editor: Editor): void;
174
176
 
177
+ export declare const Resizable: (props: ResizableProps_2 & {
178
+ class?: string | undefined;
179
+ } & {}) => any;
180
+
181
+ export declare const ResizableHandle: (props: ResizableHandleProps_2 & {
182
+ class?: string | undefined;
183
+ } & {}) => any;
184
+
185
+ export declare type ResizableHandleProps = PropsWithClass<ResizableHandleProps_2>;
186
+
187
+ export declare type ResizableProps = PropsWithClass<ResizableProps_2>;
188
+
175
189
  /**
176
- * Returns a shallow ref to the editor. If `update` is `true`, any editor update
177
- * will trigger an effect.
190
+ * Retrieves the editor instance from the nearest ProseKit component.
191
+ *
192
+ * @public
178
193
  */
179
194
  declare function useEditor<E extends Extension = any>(options?: {
195
+ /**
196
+ * Whether to update the component when the editor is mounted or editor state
197
+ * is updated.
198
+ *
199
+ * @default false
200
+ */
180
201
  update?: boolean;
181
202
  }): ShallowRef<Editor<E>>;
182
203
  export { useEditor }
@@ -0,0 +1,2 @@
1
+ export { ResizableHandleProps } from './_tsup-dts-rollup';
2
+ export { ResizableHandle } from './_tsup-dts-rollup';
@@ -0,0 +1,19 @@
1
+ // src/components/resizable-handle.gen.ts
2
+ import "@prosekit/lit/resizable-handle";
3
+ import { propNames } from "@prosekit/lit/resizable-handle";
4
+ import { defineComponent, h } from "vue";
5
+ var ResizableHandle = defineComponent(
6
+ (props, { slots }) => {
7
+ return () => {
8
+ var _a;
9
+ const webComponentProps = Object.fromEntries(
10
+ Object.entries(props).filter((entry) => entry[1] !== void 0).map(([key, value]) => [(key === "class" ? "" : ".") + key, value])
11
+ );
12
+ return h("prosekit-resizable-handle", webComponentProps, (_a = slots.default) == null ? void 0 : _a.call(slots));
13
+ };
14
+ },
15
+ { props: ["class", ...propNames] }
16
+ );
17
+ export {
18
+ ResizableHandle
19
+ };
@@ -0,0 +1,2 @@
1
+ export { ResizableProps } from './_tsup-dts-rollup';
2
+ export { Resizable } from './_tsup-dts-rollup';
@@ -0,0 +1,19 @@
1
+ // src/components/resizable.gen.ts
2
+ import "@prosekit/lit/resizable";
3
+ import { propNames } from "@prosekit/lit/resizable";
4
+ import { defineComponent, h } from "vue";
5
+ var Resizable = defineComponent(
6
+ (props, { slots }) => {
7
+ return () => {
8
+ var _a;
9
+ const webComponentProps = Object.fromEntries(
10
+ Object.entries(props).filter((entry) => entry[1] !== void 0).map(([key, value]) => [(key === "class" ? "" : ".") + key, value])
11
+ );
12
+ return h("prosekit-resizable", webComponentProps, (_a = slots.default) == null ? void 0 : _a.call(slots));
13
+ };
14
+ },
15
+ { props: ["class", ...propNames] }
16
+ );
17
+ export {
18
+ Resizable
19
+ };
@@ -209,7 +209,11 @@ import "@prosekit/core";
209
209
  import { unref, watchPostEffect } from "vue";
210
210
 
211
211
  // src/hooks/use-editor.ts
212
- import { defineUpdateHandler } from "@prosekit/core";
212
+ import {
213
+ defineMountHandler,
214
+ defineUpdateHandler,
215
+ union
216
+ } from "@prosekit/core";
213
217
  import {
214
218
  onMounted,
215
219
  onUnmounted as onUnmounted2,
@@ -224,7 +228,11 @@ function useEditor(options) {
224
228
  if (update) {
225
229
  onMounted(() => {
226
230
  const forceUpdate = () => triggerRef(editorRef);
227
- const dispose = editor.use(defineUpdateHandler(forceUpdate));
231
+ const extension = union([
232
+ defineMountHandler(forceUpdate),
233
+ defineUpdateHandler(forceUpdate)
234
+ ]);
235
+ const dispose = editor.use(extension);
228
236
  onUnmounted2(dispose);
229
237
  });
230
238
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/vue",
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,14 +79,24 @@
79
79
  "types": "./dist/prosekit-vue-popover.d.ts",
80
80
  "import": "./dist/prosekit-vue-popover.js",
81
81
  "default": "./dist/prosekit-vue-popover.js"
82
+ },
83
+ "./resizable": {
84
+ "types": "./dist/prosekit-vue-resizable.d.ts",
85
+ "import": "./dist/prosekit-vue-resizable.js",
86
+ "default": "./dist/prosekit-vue-resizable.js"
87
+ },
88
+ "./resizable-handle": {
89
+ "types": "./dist/prosekit-vue-resizable-handle.d.ts",
90
+ "import": "./dist/prosekit-vue-resizable-handle.js",
91
+ "default": "./dist/prosekit-vue-resizable-handle.js"
82
92
  }
83
93
  },
84
94
  "files": [
85
95
  "dist"
86
96
  ],
87
97
  "dependencies": {
88
- "@prosekit/core": "^0.2.0",
89
- "@prosekit/lit": "^0.1.5",
98
+ "@prosekit/core": "^0.2.5",
99
+ "@prosekit/lit": "^0.1.9",
90
100
  "@prosekit/pm": "^0.1.1",
91
101
  "@prosemirror-adapter/core": "^0.2.6"
92
102
  },
@@ -102,8 +112,8 @@
102
112
  "@prosekit/dev": "*",
103
113
  "tsup": "^8.0.1",
104
114
  "typescript": "^5.3.3",
105
- "vitest": "^1.1.0",
106
- "vue": "^3.4.0-rc.2"
115
+ "vitest": "^1.2.0",
116
+ "vue": "^3.4.13"
107
117
  },
108
118
  "scripts": {
109
119
  "build:tsup": "tsup",
@@ -144,6 +154,12 @@
144
154
  ],
145
155
  "popover": [
146
156
  "./dist/prosekit-vue-popover.d.ts"
157
+ ],
158
+ "resizable": [
159
+ "./dist/prosekit-vue-resizable.d.ts"
160
+ ],
161
+ "resizable-handle": [
162
+ "./dist/prosekit-vue-resizable-handle.d.ts"
147
163
  ]
148
164
  }
149
165
  }