@prosekit/vue 0.7.0-beta.0 → 0.7.0-beta.2
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/prosekit-vue-autocomplete.d.ts +216 -25
- package/dist/prosekit-vue-autocomplete.d.ts.map +1 -1
- package/dist/prosekit-vue-autocomplete.js +270 -9
- package/dist/prosekit-vue-autocomplete.js.map +1 -1
- package/dist/prosekit-vue-block-handle.d.ts +202 -19
- package/dist/prosekit-vue-block-handle.d.ts.map +1 -1
- package/dist/prosekit-vue-block-handle.js +211 -7
- package/dist/prosekit-vue-block-handle.js.map +1 -1
- package/dist/prosekit-vue-drop-indicator.d.ts +24 -8
- package/dist/prosekit-vue-drop-indicator.d.ts.map +1 -1
- package/dist/prosekit-vue-drop-indicator.js +36 -3
- package/dist/prosekit-vue-drop-indicator.js.map +1 -1
- package/dist/prosekit-vue-inline-popover.d.ts +200 -9
- package/dist/prosekit-vue-inline-popover.d.ts.map +1 -1
- package/dist/prosekit-vue-inline-popover.js +171 -5
- package/dist/prosekit-vue-inline-popover.js.map +1 -1
- package/dist/prosekit-vue-menu.d.ts +287 -0
- package/dist/prosekit-vue-menu.d.ts.map +1 -0
- package/dist/prosekit-vue-menu.js +313 -0
- package/dist/prosekit-vue-menu.js.map +1 -0
- package/dist/prosekit-vue-popover.d.ts +219 -19
- package/dist/prosekit-vue-popover.d.ts.map +1 -1
- package/dist/prosekit-vue-popover.js +222 -7
- package/dist/prosekit-vue-popover.js.map +1 -1
- package/dist/prosekit-vue-resizable.d.ts +50 -15
- package/dist/prosekit-vue-resizable.d.ts.map +1 -1
- package/dist/prosekit-vue-resizable.js +92 -7
- package/dist/prosekit-vue-resizable.js.map +1 -1
- package/dist/prosekit-vue-table-handle.d.ts +427 -55
- package/dist/prosekit-vue-table-handle.d.ts.map +1 -1
- package/dist/prosekit-vue-table-handle.js +455 -19
- package/dist/prosekit-vue-table-handle.js.map +1 -1
- package/dist/prosekit-vue-tooltip.d.ts +203 -19
- package/dist/prosekit-vue-tooltip.d.ts.map +1 -1
- package/dist/prosekit-vue-tooltip.js +202 -7
- package/dist/prosekit-vue-tooltip.js.map +1 -1
- package/package.json +27 -17
- package/src/components/autocomplete/autocomplete-empty.gen.ts +21 -25
- package/src/components/autocomplete/autocomplete-item.gen.ts +80 -26
- package/src/components/autocomplete/autocomplete-popup.gen.ts +80 -0
- package/src/components/autocomplete/autocomplete-positioner.gen.ts +149 -0
- package/src/components/autocomplete/autocomplete-root.gen.ts +112 -0
- package/src/components/autocomplete/index.gen.ts +12 -4
- package/src/components/autocomplete/index.ts +27 -0
- package/src/components/block-handle/block-handle-add.gen.ts +51 -26
- package/src/components/block-handle/block-handle-draggable.gen.ts +51 -26
- package/src/components/block-handle/block-handle-popup.gen.ts +29 -0
- package/src/components/block-handle/block-handle-positioner.gen.ts +167 -0
- package/src/components/block-handle/block-handle-root.gen.ts +84 -0
- package/src/components/block-handle/index.gen.ts +13 -3
- package/src/components/block-handle/index.ts +27 -0
- package/src/components/drop-indicator/drop-indicator.gen.ts +57 -26
- package/src/components/drop-indicator/index.gen.ts +5 -1
- package/src/components/drop-indicator/index.ts +14 -0
- package/src/components/inline-popover/index.gen.ts +11 -1
- package/src/components/inline-popover/index.ts +22 -0
- package/src/components/inline-popover/inline-popover-popup.gen.ts +29 -0
- package/src/components/inline-popover/inline-popover-positioner.gen.ts +173 -0
- package/src/components/inline-popover/inline-popover-root.gen.ts +108 -0
- package/src/components/menu/index.gen.ts +19 -0
- package/src/components/menu/index.ts +37 -0
- package/src/components/menu/menu-item.gen.ts +91 -0
- package/src/components/menu/menu-popup.gen.ts +54 -0
- package/src/components/menu/menu-positioner.gen.ts +174 -0
- package/src/components/menu/menu-root.gen.ts +88 -0
- package/src/components/menu/menu-submenu-root.gen.ts +29 -0
- package/src/components/menu/menu-submenu-trigger.gen.ts +29 -0
- package/src/components/menu/menu-trigger.gen.ts +79 -0
- package/src/components/popover/index.gen.ts +11 -3
- package/src/components/popover/index.ts +24 -0
- package/src/components/popover/popover-popup.gen.ts +29 -0
- package/src/components/popover/popover-positioner.gen.ts +174 -0
- package/src/components/popover/popover-root.gen.ts +88 -26
- package/src/components/popover/popover-trigger.gen.ts +88 -26
- package/src/components/resizable/index.gen.ts +8 -2
- package/src/components/resizable/index.ts +20 -0
- package/src/components/resizable/resizable-handle.gen.ts +46 -26
- package/src/components/resizable/resizable-root.gen.ts +87 -26
- package/src/components/table-handle/index.gen.ts +17 -9
- package/src/components/table-handle/index.ts +58 -0
- package/src/components/table-handle/table-handle-column-menu-root.gen.ts +62 -0
- package/src/components/table-handle/table-handle-column-menu-trigger.gen.ts +56 -0
- package/src/components/table-handle/table-handle-column-popup.gen.ts +29 -0
- package/src/components/table-handle/table-handle-column-positioner.gen.ts +197 -0
- package/src/components/table-handle/table-handle-drag-preview.gen.ts +49 -26
- package/src/components/table-handle/table-handle-drop-indicator.gen.ts +49 -26
- package/src/components/table-handle/table-handle-root.gen.ts +51 -26
- package/src/components/table-handle/table-handle-row-menu-root.gen.ts +62 -0
- package/src/components/table-handle/table-handle-row-menu-trigger.gen.ts +56 -0
- package/src/components/table-handle/table-handle-row-popup.gen.ts +29 -0
- package/src/components/table-handle/table-handle-row-positioner.gen.ts +197 -0
- package/src/components/tooltip/index.gen.ts +11 -3
- package/src/components/tooltip/index.ts +24 -0
- package/src/components/tooltip/tooltip-popup.gen.ts +29 -0
- package/src/components/tooltip/tooltip-positioner.gen.ts +174 -0
- package/src/components/tooltip/tooltip-root.gen.ts +81 -26
- package/src/components/tooltip/tooltip-trigger.gen.ts +55 -26
- package/src/extensions/vue-node-view.spec.ts +156 -0
- package/dist/create-component.js +0 -45
- package/dist/create-component.js.map +0 -1
- package/dist/create-emits.d.ts +0 -5
- package/dist/create-emits.d.ts.map +0 -1
- package/src/components/autocomplete/autocomplete-list.gen.ts +0 -33
- package/src/components/autocomplete/autocomplete-popover.gen.ts +0 -33
- package/src/components/block-handle/block-handle-popover.gen.ts +0 -33
- package/src/components/create-component.ts +0 -84
- package/src/components/create-emits.ts +0 -8
- package/src/components/inline-popover/inline-popover.gen.ts +0 -33
- package/src/components/popover/popover-content.gen.ts +0 -33
- package/src/components/table-handle/table-handle-column-root.gen.ts +0 -33
- package/src/components/table-handle/table-handle-column-trigger.gen.ts +0 -33
- package/src/components/table-handle/table-handle-popover-content.gen.ts +0 -33
- package/src/components/table-handle/table-handle-popover-item.gen.ts +0 -33
- package/src/components/table-handle/table-handle-row-root.gen.ts +0 -33
- package/src/components/table-handle/table-handle-row-trigger.gen.ts +0 -33
- package/src/components/tooltip/tooltip-content.gen.ts +0 -33
|
@@ -1,33 +1,87 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
type AutocompleteItemProps as Props,
|
|
5
|
-
type AutocompleteItemEvents as Events,
|
|
6
|
-
} from '@prosekit/web/autocomplete'
|
|
7
|
-
import type { DefineSetupFnComponent, HTMLAttributes } from 'vue'
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
|
|
3
|
+
*/
|
|
8
4
|
|
|
9
|
-
import {
|
|
10
|
-
import type
|
|
5
|
+
import { registerAutocompleteItemElement, type AutocompleteItemEvents, type AutocompleteItemProps as AutocompleteItemElementProps } from '@prosekit/web/autocomplete';
|
|
6
|
+
import { defineComponent, h, type DefineSetupFnComponent, type HTMLAttributes, shallowRef, computed, watchEffect } from 'vue';
|
|
11
7
|
|
|
12
8
|
/**
|
|
13
|
-
* Props for the {@link AutocompleteItem} component.
|
|
9
|
+
* Props for the {@link AutocompleteItem} Vue component.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
14
12
|
*/
|
|
15
|
-
export interface AutocompleteItemProps
|
|
13
|
+
export interface AutocompleteItemProps {
|
|
14
|
+
/**
|
|
15
|
+
* The value of the item, which will be matched against the query.
|
|
16
|
+
*
|
|
17
|
+
* If not provided, the value is the item's text content.
|
|
18
|
+
*
|
|
19
|
+
* @default ""
|
|
20
|
+
*/
|
|
21
|
+
value?: AutocompleteItemElementProps['value'];
|
|
22
|
+
/**
|
|
23
|
+
* Whether this option is disabled.
|
|
24
|
+
*
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
disabled?: AutocompleteItemElementProps['disabled'];
|
|
28
|
+
/** Emitted when the the item is selected. */
|
|
29
|
+
onSelect?: (event: AutocompleteItemEvents['select']) => void;
|
|
30
|
+
}
|
|
16
31
|
|
|
17
32
|
/**
|
|
18
|
-
*
|
|
33
|
+
* A Vue component that renders an `prosekit-autocomplete-item` custom element.
|
|
34
|
+
*
|
|
35
|
+
* @public
|
|
19
36
|
*/
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
)
|
|
37
|
+
export const AutocompleteItem: DefineSetupFnComponent<AutocompleteItemProps & HTMLAttributes> = /* @__PURE__ */ defineComponent<AutocompleteItemProps & HTMLAttributes>(
|
|
38
|
+
(props, { slots }) => {
|
|
39
|
+
registerAutocompleteItemElement();
|
|
40
|
+
|
|
41
|
+
const elementRef = shallowRef<HTMLElement | null>(null);
|
|
42
|
+
|
|
43
|
+
const splittedProps = computed(() => {
|
|
44
|
+
const { disabled: p0, value: p1, onSelect: e0, ...restProps } = props;
|
|
45
|
+
return [[p0, p1, e0], restProps] as const;
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const handlers: Array<((event: any) => void) | undefined> = [];
|
|
49
|
+
|
|
50
|
+
watchEffect(() => {
|
|
51
|
+
const element = elementRef.value;
|
|
52
|
+
if (!element) return;
|
|
53
|
+
|
|
54
|
+
const [p0, p1, e0] = splittedProps.value[0];
|
|
55
|
+
|
|
56
|
+
Object.assign(element, { disabled: p0, value: p1 });
|
|
57
|
+
|
|
58
|
+
handlers.length = 0;
|
|
59
|
+
handlers.push(e0);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
watchEffect(() => {
|
|
63
|
+
const element = elementRef.value;
|
|
64
|
+
if (!element) return;
|
|
65
|
+
|
|
66
|
+
const ac = new AbortController();
|
|
67
|
+
for (const [index, eventName] of ['select'].entries()) {
|
|
68
|
+
element.addEventListener(
|
|
69
|
+
eventName,
|
|
70
|
+
(event: Event) => {
|
|
71
|
+
handlers[index]?.(event);
|
|
72
|
+
},
|
|
73
|
+
{ signal: ac.signal },
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
return () => ac.abort();
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
return () => {
|
|
80
|
+
const restProps = splittedProps.value[1];
|
|
81
|
+
return h('prosekit-autocomplete-item', { ...restProps, ref: elementRef }, slots.default?.());
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
{ props: ['disabled', 'value', 'onSelect'] },
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
export type { AutocompleteItemEvents };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { registerAutocompletePopupElement, type AutocompletePopupEvents } from '@prosekit/web/autocomplete';
|
|
6
|
+
import { defineComponent, h, type DefineSetupFnComponent, type HTMLAttributes, shallowRef, computed, watchEffect } from 'vue';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Props for the {@link AutocompletePopup} Vue component.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export interface AutocompletePopupProps {
|
|
14
|
+
/**
|
|
15
|
+
* Emitted when the selected value changes. Only available when multiple is
|
|
16
|
+
* false.
|
|
17
|
+
*/
|
|
18
|
+
onValueChange?: (event: AutocompletePopupEvents['valueChange']) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Emitted when the selected values change. Only available when multiple is
|
|
21
|
+
* true.
|
|
22
|
+
*/
|
|
23
|
+
onValuesChange?: (event: AutocompletePopupEvents['valuesChange']) => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A Vue component that renders an `prosekit-autocomplete-popup` custom element.
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
export const AutocompletePopup: DefineSetupFnComponent<AutocompletePopupProps & HTMLAttributes> = /* @__PURE__ */ defineComponent<AutocompletePopupProps & HTMLAttributes>(
|
|
32
|
+
(props, { slots }) => {
|
|
33
|
+
registerAutocompletePopupElement();
|
|
34
|
+
|
|
35
|
+
const elementRef = shallowRef<HTMLElement | null>(null);
|
|
36
|
+
|
|
37
|
+
const splittedProps = computed(() => {
|
|
38
|
+
const { onValueChange: e0, onValuesChange: e1, ...restProps } = props;
|
|
39
|
+
return [[e0, e1], restProps] as const;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const handlers: Array<((event: any) => void) | undefined> = [];
|
|
43
|
+
|
|
44
|
+
watchEffect(() => {
|
|
45
|
+
const element = elementRef.value;
|
|
46
|
+
if (!element) return;
|
|
47
|
+
|
|
48
|
+
const [e0, e1] = splittedProps.value[0];
|
|
49
|
+
|
|
50
|
+
handlers.length = 0;
|
|
51
|
+
handlers.push(e0);
|
|
52
|
+
handlers.push(e1);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
watchEffect(() => {
|
|
56
|
+
const element = elementRef.value;
|
|
57
|
+
if (!element) return;
|
|
58
|
+
|
|
59
|
+
const ac = new AbortController();
|
|
60
|
+
for (const [index, eventName] of ['valueChange', 'valuesChange'].entries()) {
|
|
61
|
+
element.addEventListener(
|
|
62
|
+
eventName,
|
|
63
|
+
(event: Event) => {
|
|
64
|
+
handlers[index]?.(event);
|
|
65
|
+
},
|
|
66
|
+
{ signal: ac.signal },
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
return () => ac.abort();
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
return () => {
|
|
73
|
+
const restProps = splittedProps.value[1];
|
|
74
|
+
return h('prosekit-autocomplete-popup', { ...restProps, ref: elementRef }, slots.default?.());
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
{ props: ['onValueChange', 'onValuesChange'] },
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
export type { AutocompletePopupEvents };
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { registerAutocompletePositionerElement, type AutocompletePositionerProps as AutocompletePositionerElementProps } from '@prosekit/web/autocomplete';
|
|
6
|
+
import { defineComponent, h, type DefineSetupFnComponent, type HTMLAttributes, shallowRef, computed, watchEffect } from 'vue';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Props for the {@link AutocompletePositioner} Vue component.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export interface AutocompletePositionerProps {
|
|
14
|
+
/**
|
|
15
|
+
* The placement of the popover, relative to the text cursor.
|
|
16
|
+
*
|
|
17
|
+
* @default "bottom-start"
|
|
18
|
+
*/
|
|
19
|
+
placement?: AutocompletePositionerElementProps['placement'];
|
|
20
|
+
/**
|
|
21
|
+
* The distance between the popover and the hovered block.
|
|
22
|
+
*
|
|
23
|
+
* @default 4
|
|
24
|
+
*/
|
|
25
|
+
offset?: AutocompletePositionerElementProps['offset'];
|
|
26
|
+
/** @default true */
|
|
27
|
+
inline?: AutocompletePositionerElementProps['inline'];
|
|
28
|
+
/** @default true */
|
|
29
|
+
hoist?: AutocompletePositionerElementProps['hoist'];
|
|
30
|
+
/** @default true */
|
|
31
|
+
fitViewport?: AutocompletePositionerElementProps['fitViewport'];
|
|
32
|
+
/** @default "The body element" */
|
|
33
|
+
boundary?: AutocompletePositionerElementProps['boundary'];
|
|
34
|
+
/** @default 8 */
|
|
35
|
+
overflowPadding?: AutocompletePositionerElementProps['overflowPadding'];
|
|
36
|
+
/**
|
|
37
|
+
* The strategy to use for positioning
|
|
38
|
+
*
|
|
39
|
+
* @default "absolute"
|
|
40
|
+
*/
|
|
41
|
+
strategy?: AutocompletePositionerElementProps['strategy'];
|
|
42
|
+
/**
|
|
43
|
+
* Options to activate auto-update listeners
|
|
44
|
+
*
|
|
45
|
+
* @see https://floating-ui.com/docs/autoUpdate
|
|
46
|
+
*
|
|
47
|
+
* @default true
|
|
48
|
+
*/
|
|
49
|
+
autoUpdate?: AutocompletePositionerElementProps['autoUpdate'];
|
|
50
|
+
/**
|
|
51
|
+
* Whether to flip the `placement` in order to keep it in view when the
|
|
52
|
+
* preferred placement(s) will overflow the clipping boundary. You can also
|
|
53
|
+
* provide an array of placements to try sequentially if the preferred
|
|
54
|
+
* `placement` does not fit.
|
|
55
|
+
*
|
|
56
|
+
* @default true
|
|
57
|
+
*/
|
|
58
|
+
flip?: AutocompletePositionerElementProps['flip'];
|
|
59
|
+
/**
|
|
60
|
+
* Whether the floating element should shift to keep it in view.
|
|
61
|
+
*
|
|
62
|
+
* @default true
|
|
63
|
+
*/
|
|
64
|
+
shift?: AutocompletePositionerElementProps['shift'];
|
|
65
|
+
/**
|
|
66
|
+
* Whether the floating element can overlap the reference element to keep it
|
|
67
|
+
* in view.
|
|
68
|
+
*
|
|
69
|
+
* @default false
|
|
70
|
+
*/
|
|
71
|
+
overlap?: AutocompletePositionerElementProps['overlap'];
|
|
72
|
+
/**
|
|
73
|
+
* Whether to constrain the floating element's width so that it matches the
|
|
74
|
+
* reference element.
|
|
75
|
+
*
|
|
76
|
+
* @default false
|
|
77
|
+
*/
|
|
78
|
+
sameWidth?: AutocompletePositionerElementProps['sameWidth'];
|
|
79
|
+
/**
|
|
80
|
+
* Whether to constrain the floating element's height so that it matches the
|
|
81
|
+
* reference element.
|
|
82
|
+
*
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
85
|
+
sameHeight?: AutocompletePositionerElementProps['sameHeight'];
|
|
86
|
+
/**
|
|
87
|
+
* Whether to hide the floating element when the reference element or the
|
|
88
|
+
* floating element is fully clipped.
|
|
89
|
+
*
|
|
90
|
+
* @default false
|
|
91
|
+
*/
|
|
92
|
+
hide?: AutocompletePositionerElementProps['hide'];
|
|
93
|
+
/**
|
|
94
|
+
* Describes the root boundary that the element will be checked for overflow relative to.
|
|
95
|
+
* Please see https://floating-ui.com/docs/detectoverflow#rootboundary for more information.
|
|
96
|
+
*
|
|
97
|
+
* @default 'viewport'
|
|
98
|
+
*/
|
|
99
|
+
rootBoundary?: AutocompletePositionerElementProps['rootBoundary'];
|
|
100
|
+
/**
|
|
101
|
+
* The element that will be used to check for overflow. Please see
|
|
102
|
+
* https://floating-ui.com/docs/detectoverflow#elementcontext for more
|
|
103
|
+
* information.
|
|
104
|
+
*
|
|
105
|
+
* @default 'floating'
|
|
106
|
+
*/
|
|
107
|
+
elementContext?: AutocompletePositionerElementProps['elementContext'];
|
|
108
|
+
/**
|
|
109
|
+
* Whether to check the alternate elementContext's boundary. Please see
|
|
110
|
+
* https://floating-ui.com/docs/detectoverflow#altboundary for more
|
|
111
|
+
* information.
|
|
112
|
+
*
|
|
113
|
+
* @default false
|
|
114
|
+
*/
|
|
115
|
+
altBoundary?: AutocompletePositionerElementProps['altBoundary'];
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* A Vue component that renders an `prosekit-autocomplete-positioner` custom element.
|
|
120
|
+
*
|
|
121
|
+
* @public
|
|
122
|
+
*/
|
|
123
|
+
export const AutocompletePositioner: DefineSetupFnComponent<AutocompletePositionerProps & HTMLAttributes> = /* @__PURE__ */ defineComponent<AutocompletePositionerProps & HTMLAttributes>(
|
|
124
|
+
(props, { slots }) => {
|
|
125
|
+
registerAutocompletePositionerElement();
|
|
126
|
+
|
|
127
|
+
const elementRef = shallowRef<HTMLElement | null>(null);
|
|
128
|
+
|
|
129
|
+
const splittedProps = computed(() => {
|
|
130
|
+
const { altBoundary: p0, autoUpdate: p1, boundary: p2, elementContext: p3, fitViewport: p4, flip: p5, hide: p6, hoist: p7, inline: p8, offset: p9, overflowPadding: p10, overlap: p11, placement: p12, rootBoundary: p13, sameHeight: p14, sameWidth: p15, shift: p16, strategy: p17, ...restProps } = props;
|
|
131
|
+
return [[p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17], restProps] as const;
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
watchEffect(() => {
|
|
135
|
+
const element = elementRef.value;
|
|
136
|
+
if (!element) return;
|
|
137
|
+
|
|
138
|
+
const [p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17] = splittedProps.value[0];
|
|
139
|
+
|
|
140
|
+
Object.assign(element, { altBoundary: p0, autoUpdate: p1, boundary: p2, elementContext: p3, fitViewport: p4, flip: p5, hide: p6, hoist: p7, inline: p8, offset: p9, overflowPadding: p10, overlap: p11, placement: p12, rootBoundary: p13, sameHeight: p14, sameWidth: p15, shift: p16, strategy: p17 });
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
return () => {
|
|
144
|
+
const restProps = splittedProps.value[1];
|
|
145
|
+
return h('prosekit-autocomplete-positioner', { ...restProps, ref: elementRef }, slots.default?.());
|
|
146
|
+
};
|
|
147
|
+
},
|
|
148
|
+
{ props: ['altBoundary', 'autoUpdate', 'boundary', 'elementContext', 'fitViewport', 'flip', 'hide', 'hoist', 'inline', 'offset', 'overflowPadding', 'overlap', 'placement', 'rootBoundary', 'sameHeight', 'sameWidth', 'shift', 'strategy'] },
|
|
149
|
+
);
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { registerAutocompleteRootElement, type AutocompleteRootEvents, type AutocompleteRootProps as AutocompleteRootElementProps } from '@prosekit/web/autocomplete';
|
|
6
|
+
import { defineComponent, h, type DefineSetupFnComponent, type HTMLAttributes, shallowRef, computed, watchEffect } from 'vue';
|
|
7
|
+
|
|
8
|
+
import { useEditorContext } from '../../injection/editor-context.ts';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Props for the {@link AutocompleteRoot} Vue component.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export interface AutocompleteRootProps {
|
|
16
|
+
/**
|
|
17
|
+
* The ProseKit editor instance.
|
|
18
|
+
*
|
|
19
|
+
* @default null
|
|
20
|
+
* @hidden
|
|
21
|
+
*/
|
|
22
|
+
editor?: AutocompleteRootElementProps['editor'];
|
|
23
|
+
/**
|
|
24
|
+
* The regular expression to match the query text to autocomplete.
|
|
25
|
+
*
|
|
26
|
+
* @default null
|
|
27
|
+
*/
|
|
28
|
+
regex?: AutocompleteRootElementProps['regex'];
|
|
29
|
+
/**
|
|
30
|
+
* The filter function to determine if an item should be shown in the
|
|
31
|
+
* listbox.
|
|
32
|
+
*
|
|
33
|
+
* @default defaultItemFilter
|
|
34
|
+
*/
|
|
35
|
+
filter?: AutocompleteRootElementProps['filter'];
|
|
36
|
+
/** Fired when the open state changes. */
|
|
37
|
+
onOpenChange?: (event: AutocompleteRootEvents['openChange']) => void;
|
|
38
|
+
/** Fired when the query changes. */
|
|
39
|
+
onQueryChange?: (event: AutocompleteRootEvents['queryChange']) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Emitted when the selected value changes. Only available when multiple is
|
|
42
|
+
* false.
|
|
43
|
+
*/
|
|
44
|
+
onValueChange?: (event: AutocompleteRootEvents['valueChange']) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Emitted when the selected values change. Only available when multiple is
|
|
47
|
+
* true.
|
|
48
|
+
*/
|
|
49
|
+
onValuesChange?: (event: AutocompleteRootEvents['valuesChange']) => void;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A Vue component that renders an `prosekit-autocomplete-root` custom element.
|
|
54
|
+
*
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
|
+
export const AutocompleteRoot: DefineSetupFnComponent<AutocompleteRootProps & HTMLAttributes> = /* @__PURE__ */ defineComponent<AutocompleteRootProps & HTMLAttributes>(
|
|
58
|
+
(props, { slots }) => {
|
|
59
|
+
registerAutocompleteRootElement();
|
|
60
|
+
|
|
61
|
+
const elementRef = shallowRef<HTMLElement | null>(null);
|
|
62
|
+
|
|
63
|
+
const p0Fallback = useEditorContext();
|
|
64
|
+
|
|
65
|
+
const splittedProps = computed(() => {
|
|
66
|
+
const { editor: p0, filter: p1, regex: p2, onOpenChange: e0, onQueryChange: e1, onValueChange: e2, onValuesChange: e3, ...restProps } = props;
|
|
67
|
+
return [[p0, p1, p2, e0, e1, e2, e3], restProps] as const;
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const handlers: Array<((event: any) => void) | undefined> = [];
|
|
71
|
+
|
|
72
|
+
watchEffect(() => {
|
|
73
|
+
const element = elementRef.value;
|
|
74
|
+
if (!element) return;
|
|
75
|
+
|
|
76
|
+
const [p0, p1, p2, e0, e1, e2, e3] = splittedProps.value[0];
|
|
77
|
+
|
|
78
|
+
Object.assign(element, { editor: p0 ?? p0Fallback, filter: p1, regex: p2 });
|
|
79
|
+
|
|
80
|
+
handlers.length = 0;
|
|
81
|
+
handlers.push(e0);
|
|
82
|
+
handlers.push(e1);
|
|
83
|
+
handlers.push(e2);
|
|
84
|
+
handlers.push(e3);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
watchEffect(() => {
|
|
88
|
+
const element = elementRef.value;
|
|
89
|
+
if (!element) return;
|
|
90
|
+
|
|
91
|
+
const ac = new AbortController();
|
|
92
|
+
for (const [index, eventName] of ['openChange', 'queryChange', 'valueChange', 'valuesChange'].entries()) {
|
|
93
|
+
element.addEventListener(
|
|
94
|
+
eventName,
|
|
95
|
+
(event: Event) => {
|
|
96
|
+
handlers[index]?.(event);
|
|
97
|
+
},
|
|
98
|
+
{ signal: ac.signal },
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
return () => ac.abort();
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
return () => {
|
|
105
|
+
const restProps = splittedProps.value[1];
|
|
106
|
+
return h('prosekit-autocomplete-root', { ...restProps, ref: elementRef }, slots.default?.());
|
|
107
|
+
};
|
|
108
|
+
},
|
|
109
|
+
{ props: ['editor', 'filter', 'regex', 'onOpenChange', 'onQueryChange', 'onValueChange', 'onValuesChange'] },
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
export type { AutocompleteRootEvents };
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
|
|
3
|
+
*/
|
|
2
4
|
|
|
3
|
-
export {
|
|
5
|
+
export { AutocompleteEmpty, type AutocompleteEmptyProps } from './autocomplete-empty.gen.ts';
|
|
4
6
|
|
|
5
|
-
export {
|
|
7
|
+
export { AutocompleteItem, type AutocompleteItemProps, type AutocompleteItemEvents } from './autocomplete-item.gen.ts';
|
|
6
8
|
|
|
7
|
-
export {
|
|
9
|
+
export { AutocompletePopup, type AutocompletePopupProps, type AutocompletePopupEvents } from './autocomplete-popup.gen.ts';
|
|
10
|
+
|
|
11
|
+
export { AutocompletePositioner, type AutocompletePositionerProps } from './autocomplete-positioner.gen.ts';
|
|
12
|
+
|
|
13
|
+
export { AutocompleteRoot, type AutocompleteRootProps, type AutocompleteRootEvents } from './autocomplete-root.gen.ts';
|
|
14
|
+
|
|
15
|
+
export { OpenChangeEvent, QueryChangeEvent, SelectEvent, ValueChangeEvent, ValuesChangeEvent } from '@prosekit/web/autocomplete';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
|
|
3
|
+
@module
|
|
4
|
+
|
|
5
|
+
## Anatomy
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
import {
|
|
9
|
+
AutocompleteEmpty,
|
|
10
|
+
AutocompleteItem,
|
|
11
|
+
AutocompletePopup,
|
|
12
|
+
AutocompletePositioner,
|
|
13
|
+
AutocompleteRoot,
|
|
14
|
+
} from 'prosekit/vue/autocomplete'
|
|
15
|
+
|
|
16
|
+
<AutocompleteRoot>
|
|
17
|
+
<AutocompletePositioner>
|
|
18
|
+
<AutocompletePopup>
|
|
19
|
+
<AutocompleteItem>...</AutocompleteItem>
|
|
20
|
+
<AutocompleteEmpty>...</AutocompleteEmpty>
|
|
21
|
+
</AutocompletePopup>
|
|
22
|
+
</AutocompletePositioner>
|
|
23
|
+
</AutocompleteRoot>
|
|
24
|
+
```
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
export * from './index.gen.ts'
|
|
@@ -1,33 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from '
|
|
7
|
-
import type { DefineSetupFnComponent, HTMLAttributes } from 'vue'
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { registerBlockHandleAddElement, type BlockHandleAddProps as BlockHandleAddElementProps } from '@prosekit/web/block-handle';
|
|
6
|
+
import { defineComponent, h, type DefineSetupFnComponent, type HTMLAttributes, shallowRef, computed, watchEffect } from 'vue';
|
|
8
7
|
|
|
9
|
-
import {
|
|
10
|
-
import type { CreateEmits } from '../create-emits.ts'
|
|
8
|
+
import { useEditorContext } from '../../injection/editor-context.ts';
|
|
11
9
|
|
|
12
10
|
/**
|
|
13
|
-
* Props for the {@link BlockHandleAdd} component.
|
|
11
|
+
* Props for the {@link BlockHandleAdd} Vue component.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
14
|
*/
|
|
15
|
-
export interface BlockHandleAddProps
|
|
15
|
+
export interface BlockHandleAddProps {
|
|
16
|
+
/**
|
|
17
|
+
* The ProseKit editor instance.
|
|
18
|
+
*
|
|
19
|
+
* @default null
|
|
20
|
+
* @hidden
|
|
21
|
+
*/
|
|
22
|
+
editor?: BlockHandleAddElementProps['editor'];
|
|
23
|
+
}
|
|
16
24
|
|
|
17
25
|
/**
|
|
18
|
-
*
|
|
26
|
+
* A Vue component that renders an `prosekit-block-handle-add` custom element.
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
19
29
|
*/
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
)
|
|
30
|
+
export const BlockHandleAdd: DefineSetupFnComponent<BlockHandleAddProps & HTMLAttributes> = /* @__PURE__ */ defineComponent<BlockHandleAddProps & HTMLAttributes>(
|
|
31
|
+
(props, { slots }) => {
|
|
32
|
+
registerBlockHandleAddElement();
|
|
33
|
+
|
|
34
|
+
const elementRef = shallowRef<HTMLElement | null>(null);
|
|
35
|
+
|
|
36
|
+
const p0Fallback = useEditorContext();
|
|
37
|
+
|
|
38
|
+
const splittedProps = computed(() => {
|
|
39
|
+
const { editor: p0, ...restProps } = props;
|
|
40
|
+
return [[p0], restProps] as const;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
watchEffect(() => {
|
|
44
|
+
const element = elementRef.value;
|
|
45
|
+
if (!element) return;
|
|
46
|
+
|
|
47
|
+
const [p0] = splittedProps.value[0];
|
|
48
|
+
|
|
49
|
+
Object.assign(element, { editor: p0 ?? p0Fallback });
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
return () => {
|
|
53
|
+
const restProps = splittedProps.value[1];
|
|
54
|
+
return h('prosekit-block-handle-add', { ...restProps, ref: elementRef }, slots.default?.());
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
{ props: ['editor'] },
|
|
58
|
+
);
|
|
@@ -1,33 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from '
|
|
7
|
-
import type { DefineSetupFnComponent, HTMLAttributes } from 'vue'
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { registerBlockHandleDraggableElement, type BlockHandleDraggableProps as BlockHandleDraggableElementProps } from '@prosekit/web/block-handle';
|
|
6
|
+
import { defineComponent, h, type DefineSetupFnComponent, type HTMLAttributes, shallowRef, computed, watchEffect } from 'vue';
|
|
8
7
|
|
|
9
|
-
import {
|
|
10
|
-
import type { CreateEmits } from '../create-emits.ts'
|
|
8
|
+
import { useEditorContext } from '../../injection/editor-context.ts';
|
|
11
9
|
|
|
12
10
|
/**
|
|
13
|
-
* Props for the {@link BlockHandleDraggable} component.
|
|
11
|
+
* Props for the {@link BlockHandleDraggable} Vue component.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
14
|
*/
|
|
15
|
-
export interface BlockHandleDraggableProps
|
|
15
|
+
export interface BlockHandleDraggableProps {
|
|
16
|
+
/**
|
|
17
|
+
* The ProseKit editor instance.
|
|
18
|
+
*
|
|
19
|
+
* @default null
|
|
20
|
+
* @hidden
|
|
21
|
+
*/
|
|
22
|
+
editor?: BlockHandleDraggableElementProps['editor'];
|
|
23
|
+
}
|
|
16
24
|
|
|
17
25
|
/**
|
|
18
|
-
*
|
|
26
|
+
* A Vue component that renders an `prosekit-block-handle-draggable` custom element.
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
19
29
|
*/
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
)
|
|
30
|
+
export const BlockHandleDraggable: DefineSetupFnComponent<BlockHandleDraggableProps & HTMLAttributes> = /* @__PURE__ */ defineComponent<BlockHandleDraggableProps & HTMLAttributes>(
|
|
31
|
+
(props, { slots }) => {
|
|
32
|
+
registerBlockHandleDraggableElement();
|
|
33
|
+
|
|
34
|
+
const elementRef = shallowRef<HTMLElement | null>(null);
|
|
35
|
+
|
|
36
|
+
const p0Fallback = useEditorContext();
|
|
37
|
+
|
|
38
|
+
const splittedProps = computed(() => {
|
|
39
|
+
const { editor: p0, ...restProps } = props;
|
|
40
|
+
return [[p0], restProps] as const;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
watchEffect(() => {
|
|
44
|
+
const element = elementRef.value;
|
|
45
|
+
if (!element) return;
|
|
46
|
+
|
|
47
|
+
const [p0] = splittedProps.value[0];
|
|
48
|
+
|
|
49
|
+
Object.assign(element, { editor: p0 ?? p0Fallback });
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
return () => {
|
|
53
|
+
const restProps = splittedProps.value[1];
|
|
54
|
+
return h('prosekit-block-handle-draggable', { ...restProps, ref: elementRef }, slots.default?.());
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
{ props: ['editor'] },
|
|
58
|
+
);
|