@prosekit/vue 0.0.24 → 0.0.25

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.
@@ -2,7 +2,6 @@ import { AutocompleteEmptyProps as AutocompleteEmptyProps_2 } from '@prosekit/li
2
2
  import { AutocompleteItemProps as AutocompleteItemProps_2 } from '@prosekit/lit/autocomplete-item';
3
3
  import { AutocompleteListProps as AutocompleteListProps_2 } from '@prosekit/lit/autocomplete-list';
4
4
  import { AutocompletePopoverProps as AutocompletePopoverProps_2 } from '@prosekit/lit/autocomplete-popover';
5
- import { CodeBlockPopoverProps as CodeBlockPopoverProps_2 } from '@prosekit/lit/code-block-popover';
6
5
  import { ComboBoxInputProps as ComboBoxInputProps_2 } from '@prosekit/lit/combo-box-input';
7
6
  import { ComboBoxItemProps as ComboBoxItemProps_2 } from '@prosekit/lit/combo-box-item';
8
7
  import { ComboBoxListProps as ComboBoxListProps_2 } from '@prosekit/lit/combo-box-list';
@@ -15,6 +14,7 @@ import { Options } from 'tsup';
15
14
  import { PopoverOptions } from '@prosekit/lit/autocomplete-popover';
16
15
  import { PopoverOptions as PopoverOptions_alias_1 } from '@prosekit/lit/inline-popover';
17
16
  import { PopoverProps as PopoverProps_2 } from '@prosekit/lit/popover';
17
+ import { Ref } from 'vue';
18
18
  import { ShallowRef } from 'vue';
19
19
  import { UserProjectConfigExport } from 'vitest/dist/config.js';
20
20
 
@@ -66,14 +66,6 @@ declare type AutocompletePopoverProps = {
66
66
  export { AutocompletePopoverProps }
67
67
  export { AutocompletePopoverProps as AutocompletePopoverProps_alias_1 }
68
68
 
69
- export declare const CodeBlockPopover: (props: {
70
- class?: string | undefined;
71
- } & CodeBlockPopoverProps_2 & {}) => any;
72
-
73
- export declare type CodeBlockPopoverProps = {
74
- class?: string;
75
- } & CodeBlockPopoverProps_2;
76
-
77
69
  export declare const ComboBox: (props: {
78
70
  class?: string | undefined;
79
71
  } & ComboBoxProps_2 & {}) => any;
@@ -158,15 +150,9 @@ declare function useEditor<E extends Extension = any>(options?: {
158
150
  export { useEditor }
159
151
  export { useEditor as useEditor_alias_1 }
160
152
 
161
- export declare function useExtension({ extension }: UseExtensionProps): void;
162
-
163
- declare interface UseExtensionProps<T extends Extension = Extension> {
164
- extension: T;
165
- }
153
+ export declare function useExtension<T extends Extension = Extension>(extension: Ref<T>): void;
166
154
 
167
- declare function useKeymap({ keymap }: {
168
- keymap: Keymap;
169
- }): void;
155
+ declare function useKeymap(keymap: Ref<Keymap>): void;
170
156
  export { useKeymap }
171
157
  export { useKeymap as useKeymap_alias_1 }
172
158
 
@@ -31,14 +31,14 @@ var ProseKit = defineComponent(
31
31
 
32
32
  // src/hooks/use-keymap.ts
33
33
  import { defineKeymap } from "@prosekit/core";
34
- import { computed } from "vue";
34
+ import { computed, unref as unref2 } from "vue";
35
35
 
36
36
  // src/hooks/use-extension.ts
37
37
  import "@prosekit/core";
38
- import { onMounted as onMounted2, onUnmounted as onUnmounted2 } from "vue";
38
+ import { unref, watchPostEffect } from "vue";
39
39
 
40
40
  // src/hooks/use-editor.ts
41
- import { defineEventHandler } from "@prosekit/core";
41
+ import { defineUpdateHandler } from "@prosekit/core";
42
42
  import {
43
43
  onMounted,
44
44
  onUnmounted,
@@ -53,7 +53,7 @@ function useEditor(options) {
53
53
  if (update) {
54
54
  onMounted(() => {
55
55
  const forceUpdate = () => triggerRef(editorRef);
56
- const dispose = editor.use(defineEventHandler({ update: forceUpdate }));
56
+ const dispose = editor.use(defineUpdateHandler(forceUpdate));
57
57
  onUnmounted(dispose);
58
58
  });
59
59
  }
@@ -61,18 +61,17 @@ function useEditor(options) {
61
61
  }
62
62
 
63
63
  // src/hooks/use-extension.ts
64
- function useExtension({ extension }) {
64
+ function useExtension(extension) {
65
65
  const editor = useEditor();
66
- onMounted2(() => {
67
- const dispose = editor.value.use(extension);
68
- onUnmounted2(dispose);
66
+ watchPostEffect((onCleanup) => {
67
+ onCleanup(editor.value.use(unref(extension)));
69
68
  });
70
69
  }
71
70
 
72
71
  // src/hooks/use-keymap.ts
73
- function useKeymap({ keymap }) {
74
- const extension = computed(() => defineKeymap(keymap));
75
- useExtension({ extension: extension.value });
72
+ function useKeymap(keymap) {
73
+ const extension = computed(() => defineKeymap(unref2(keymap)));
74
+ useExtension(extension);
76
75
  }
77
76
  export {
78
77
  ProseKit,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/vue",
3
3
  "type": "module",
4
- "version": "0.0.24",
4
+ "version": "0.0.25",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -50,11 +50,6 @@
50
50
  "import": "./dist/prosekit-vue-autocomplete-popover.js",
51
51
  "default": "./dist/prosekit-vue-autocomplete-popover.js"
52
52
  },
53
- "./code-block-popover": {
54
- "types": "./dist/prosekit-vue-code-block-popover.d.ts",
55
- "import": "./dist/prosekit-vue-code-block-popover.js",
56
- "default": "./dist/prosekit-vue-code-block-popover.js"
57
- },
58
53
  "./combo-box": {
59
54
  "types": "./dist/prosekit-vue-combo-box.d.ts",
60
55
  "import": "./dist/prosekit-vue-combo-box.js",
@@ -90,8 +85,8 @@
90
85
  "dist"
91
86
  ],
92
87
  "dependencies": {
93
- "@prosekit/core": "^0.0.19",
94
- "@prosekit/lit": "^0.0.23"
88
+ "@prosekit/core": "^0.0.20",
89
+ "@prosekit/lit": "^0.0.24"
95
90
  },
96
91
  "peerDependencies": {
97
92
  "vue": ">= 3.0.0"
@@ -106,7 +101,7 @@
106
101
  "tsup": "^7.2.0",
107
102
  "typescript": "^5.2.2",
108
103
  "vitest": "^0.34.6",
109
- "vue": "^3.3.7"
104
+ "vue": "^3.3.8"
110
105
  },
111
106
  "scripts": {
112
107
  "build:tsup": "tsup",
@@ -130,9 +125,6 @@
130
125
  "autocomplete-popover": [
131
126
  "./dist/prosekit-vue-autocomplete-popover.d.ts"
132
127
  ],
133
- "code-block-popover": [
134
- "./dist/prosekit-vue-code-block-popover.d.ts"
135
- ],
136
128
  "combo-box": [
137
129
  "./dist/prosekit-vue-combo-box.d.ts"
138
130
  ],
@@ -1,2 +0,0 @@
1
- export { CodeBlockPopoverProps } from './_tsup-dts-rollup';
2
- export { CodeBlockPopover } from './_tsup-dts-rollup';
@@ -1,19 +0,0 @@
1
- // src/components/code-block-popover.gen.ts
2
- import "@prosekit/lit/code-block-popover";
3
- import { propNames } from "@prosekit/lit/code-block-popover";
4
- import { defineComponent, h } from "vue";
5
- var CodeBlockPopover = 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-code-block-popover", webComponentProps, (_a = slots.default) == null ? void 0 : _a.call(slots));
13
- };
14
- },
15
- { props: ["class", ...propNames] }
16
- );
17
- export {
18
- CodeBlockPopover
19
- };