@prosekit/vue 0.4.11 → 0.4.13
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/create-component-wOxhYs6n.js +46 -0
- package/dist/create-emits-fip0zdCA.d.ts +5 -0
- package/dist/editor-context-DKYvJpUt.js +19 -0
- package/dist/prosekit-vue-autocomplete.d.ts +56 -12
- package/dist/prosekit-vue-autocomplete.js +17 -54
- package/dist/prosekit-vue-block-handle.d.ts +44 -9
- package/dist/prosekit-vue-block-handle.js +14 -42
- package/dist/prosekit-vue-inline-popover.d.ts +20 -3
- package/dist/prosekit-vue-inline-popover.js +8 -18
- package/dist/prosekit-vue-popover.d.ts +44 -9
- package/dist/prosekit-vue-popover.js +14 -42
- package/dist/prosekit-vue-resizable.d.ts +32 -6
- package/dist/prosekit-vue-resizable.js +11 -30
- package/dist/prosekit-vue-table-handle.d.ts +92 -21
- package/dist/prosekit-vue-table-handle.js +26 -90
- package/dist/prosekit-vue-tooltip.d.ts +44 -9
- package/dist/prosekit-vue-tooltip.js +14 -42
- package/dist/prosekit-vue.d.ts +143 -16
- package/dist/prosekit-vue.js +181 -214
- package/package.json +26 -17
- package/dist/_tsup-dts-rollup.d.ts +0 -733
- package/dist/chunk-BD3KKHO6.js +0 -17
- package/dist/chunk-PTYQOFHO.js +0 -71
package/dist/chunk-BD3KKHO6.js
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
// src/injection/editor-context.ts
|
2
|
-
import {
|
3
|
-
inject,
|
4
|
-
provide
|
5
|
-
} from "vue";
|
6
|
-
var symbol = Symbol("prosekit-vue-editor-context");
|
7
|
-
function provideEditor(editor) {
|
8
|
-
provide(symbol, editor);
|
9
|
-
}
|
10
|
-
function useEditorContext() {
|
11
|
-
return inject(symbol, void 0);
|
12
|
-
}
|
13
|
-
|
14
|
-
export {
|
15
|
-
provideEditor,
|
16
|
-
useEditorContext
|
17
|
-
};
|
package/dist/chunk-PTYQOFHO.js
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
useEditorContext
|
3
|
-
} from "./chunk-BD3KKHO6.js";
|
4
|
-
|
5
|
-
// src/components/create-component.ts
|
6
|
-
import {
|
7
|
-
defineComponent,
|
8
|
-
h,
|
9
|
-
onMounted,
|
10
|
-
ref,
|
11
|
-
watchEffect
|
12
|
-
} from "vue";
|
13
|
-
function createComponent(tagName, displayName, propNames, eventNames) {
|
14
|
-
const hasEditor = propNames.includes("editor");
|
15
|
-
const Component = defineComponent(
|
16
|
-
(props, { slots, emit }) => {
|
17
|
-
const editor = useEditorContext();
|
18
|
-
const mounted = ref(false);
|
19
|
-
onMounted(() => {
|
20
|
-
mounted.value = true;
|
21
|
-
});
|
22
|
-
const elementRef = ref(null);
|
23
|
-
watchEffect((onCleanup) => {
|
24
|
-
const element = elementRef.value;
|
25
|
-
if (!element) return;
|
26
|
-
const eventHandlers = {};
|
27
|
-
for (const eventName of eventNames) {
|
28
|
-
const extractDetail = eventName.endsWith("Change");
|
29
|
-
eventHandlers[eventName] = (event) => {
|
30
|
-
emit(
|
31
|
-
eventName,
|
32
|
-
extractDetail ? event.detail : event
|
33
|
-
);
|
34
|
-
};
|
35
|
-
}
|
36
|
-
for (const [eventName, handler] of Object.entries(eventHandlers)) {
|
37
|
-
element.addEventListener(eventName, handler);
|
38
|
-
}
|
39
|
-
onCleanup(() => {
|
40
|
-
for (const [eventName, handler] of Object.entries(eventHandlers)) {
|
41
|
-
element.removeEventListener(eventName, handler);
|
42
|
-
}
|
43
|
-
});
|
44
|
-
});
|
45
|
-
return () => {
|
46
|
-
const properties = {};
|
47
|
-
for (const [key, value] of Object.entries(props)) {
|
48
|
-
if (value !== void 0 && !key.startsWith(".")) {
|
49
|
-
properties[propNames.includes(key) ? "." + key : key] = value;
|
50
|
-
}
|
51
|
-
}
|
52
|
-
if (hasEditor && editor && !properties["editor"]) {
|
53
|
-
properties.editor = editor;
|
54
|
-
}
|
55
|
-
properties.key = mounted.value ? 1 : 0;
|
56
|
-
properties.ref = elementRef;
|
57
|
-
return h(tagName, properties, slots.default?.());
|
58
|
-
};
|
59
|
-
},
|
60
|
-
{
|
61
|
-
name: displayName,
|
62
|
-
props: propNames,
|
63
|
-
emits: eventNames
|
64
|
-
}
|
65
|
-
);
|
66
|
-
return Component;
|
67
|
-
}
|
68
|
-
|
69
|
-
export {
|
70
|
-
createComponent
|
71
|
-
};
|