@prosekit/vue 0.7.0-beta.1 → 0.7.0-beta.3
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 +23 -15
- 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/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
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { registerTooltipPositionerElement, type TooltipPositionerProps as TooltipPositionerElementProps } from '@prosekit/web/tooltip';
|
|
6
|
+
import { defineComponent, h, type DefineSetupFnComponent, type HTMLAttributes, shallowRef, computed, watchEffect } from 'vue';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Props for the {@link TooltipPositioner} Vue component.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export interface TooltipPositionerProps {
|
|
14
|
+
/**
|
|
15
|
+
* The strategy to use for positioning
|
|
16
|
+
*
|
|
17
|
+
* @default "absolute"
|
|
18
|
+
*/
|
|
19
|
+
strategy?: TooltipPositionerElementProps['strategy'];
|
|
20
|
+
/**
|
|
21
|
+
* The initial placement of the floating element
|
|
22
|
+
*
|
|
23
|
+
* @default "top"
|
|
24
|
+
*/
|
|
25
|
+
placement?: TooltipPositionerElementProps['placement'];
|
|
26
|
+
/**
|
|
27
|
+
* Options to activate auto-update listeners
|
|
28
|
+
*
|
|
29
|
+
* @see https://floating-ui.com/docs/autoUpdate
|
|
30
|
+
*
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
33
|
+
autoUpdate?: TooltipPositionerElementProps['autoUpdate'];
|
|
34
|
+
/**
|
|
35
|
+
* Whether to use the browser Popover API to place the floating element on
|
|
36
|
+
* top of other page content.
|
|
37
|
+
*
|
|
38
|
+
* @default true
|
|
39
|
+
*/
|
|
40
|
+
hoist?: TooltipPositionerElementProps['hoist'];
|
|
41
|
+
/**
|
|
42
|
+
* The distance between the reference and floating element.
|
|
43
|
+
*
|
|
44
|
+
* @default 6
|
|
45
|
+
*/
|
|
46
|
+
offset?: TooltipPositionerElementProps['offset'];
|
|
47
|
+
/**
|
|
48
|
+
* Whether to flip the `placement` in order to keep it in view when the
|
|
49
|
+
* preferred placement(s) will overflow the clipping boundary. You can also
|
|
50
|
+
* provide an array of placements to try sequentially if the preferred
|
|
51
|
+
* `placement` does not fit.
|
|
52
|
+
*
|
|
53
|
+
* @default true
|
|
54
|
+
*/
|
|
55
|
+
flip?: TooltipPositionerElementProps['flip'];
|
|
56
|
+
/**
|
|
57
|
+
* Whether the floating element should shift to keep it in view.
|
|
58
|
+
*
|
|
59
|
+
* @default true
|
|
60
|
+
*/
|
|
61
|
+
shift?: TooltipPositionerElementProps['shift'];
|
|
62
|
+
/**
|
|
63
|
+
* Whether the floating element can overlap the reference element to keep it
|
|
64
|
+
* in view.
|
|
65
|
+
*
|
|
66
|
+
* @default false
|
|
67
|
+
*/
|
|
68
|
+
overlap?: TooltipPositionerElementProps['overlap'];
|
|
69
|
+
/**
|
|
70
|
+
* Whether to constrain the floating element's width and height to not exceed
|
|
71
|
+
* the viewport.
|
|
72
|
+
*
|
|
73
|
+
* @default false
|
|
74
|
+
*/
|
|
75
|
+
fitViewport?: TooltipPositionerElementProps['fitViewport'];
|
|
76
|
+
/**
|
|
77
|
+
* Whether to constrain the floating element's width so that it matches the
|
|
78
|
+
* reference element.
|
|
79
|
+
*
|
|
80
|
+
* @default false
|
|
81
|
+
*/
|
|
82
|
+
sameWidth?: TooltipPositionerElementProps['sameWidth'];
|
|
83
|
+
/**
|
|
84
|
+
* Whether to constrain the floating element's height so that it matches the
|
|
85
|
+
* reference element.
|
|
86
|
+
*
|
|
87
|
+
* @default false
|
|
88
|
+
*/
|
|
89
|
+
sameHeight?: TooltipPositionerElementProps['sameHeight'];
|
|
90
|
+
/**
|
|
91
|
+
* Whether to improve positioning for inline reference elements that span over
|
|
92
|
+
* multiple lines.
|
|
93
|
+
*
|
|
94
|
+
* @default false
|
|
95
|
+
*/
|
|
96
|
+
inline?: TooltipPositionerElementProps['inline'];
|
|
97
|
+
/**
|
|
98
|
+
* Whether to hide the floating element when the reference element or the
|
|
99
|
+
* floating element is fully clipped.
|
|
100
|
+
*
|
|
101
|
+
* @default false
|
|
102
|
+
*/
|
|
103
|
+
hide?: TooltipPositionerElementProps['hide'];
|
|
104
|
+
/**
|
|
105
|
+
* Describes the clipping element(s) or area that overflow will be checked relative to.
|
|
106
|
+
* Please see https://floating-ui.com/docs/detectoverflow#boundary for more information.
|
|
107
|
+
*
|
|
108
|
+
* @default 'clippingAncestors'
|
|
109
|
+
*/
|
|
110
|
+
boundary?: TooltipPositionerElementProps['boundary'];
|
|
111
|
+
/**
|
|
112
|
+
* Describes the root boundary that the element will be checked for overflow relative to.
|
|
113
|
+
* Please see https://floating-ui.com/docs/detectoverflow#rootboundary for more information.
|
|
114
|
+
*
|
|
115
|
+
* @default 'viewport'
|
|
116
|
+
*/
|
|
117
|
+
rootBoundary?: TooltipPositionerElementProps['rootBoundary'];
|
|
118
|
+
/**
|
|
119
|
+
* Describes the virtual padding around the boundary to check for overflow.
|
|
120
|
+
* Please see https://floating-ui.com/docs/detectoverflow#padding for more information.
|
|
121
|
+
*
|
|
122
|
+
* @default 4
|
|
123
|
+
*/
|
|
124
|
+
overflowPadding?: TooltipPositionerElementProps['overflowPadding'];
|
|
125
|
+
/**
|
|
126
|
+
* The element that will be used to check for overflow. Please see
|
|
127
|
+
* https://floating-ui.com/docs/detectoverflow#elementcontext for more
|
|
128
|
+
* information.
|
|
129
|
+
*
|
|
130
|
+
* @default 'floating'
|
|
131
|
+
*/
|
|
132
|
+
elementContext?: TooltipPositionerElementProps['elementContext'];
|
|
133
|
+
/**
|
|
134
|
+
* Whether to check the alternate elementContext's boundary. Please see
|
|
135
|
+
* https://floating-ui.com/docs/detectoverflow#altboundary for more
|
|
136
|
+
* information.
|
|
137
|
+
*
|
|
138
|
+
* @default false
|
|
139
|
+
*/
|
|
140
|
+
altBoundary?: TooltipPositionerElementProps['altBoundary'];
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* A Vue component that renders an `prosekit-tooltip-positioner` custom element.
|
|
145
|
+
*
|
|
146
|
+
* @public
|
|
147
|
+
*/
|
|
148
|
+
export const TooltipPositioner: DefineSetupFnComponent<TooltipPositionerProps & HTMLAttributes> = /* @__PURE__ */ defineComponent<TooltipPositionerProps & HTMLAttributes>(
|
|
149
|
+
(props, { slots }) => {
|
|
150
|
+
registerTooltipPositionerElement();
|
|
151
|
+
|
|
152
|
+
const elementRef = shallowRef<HTMLElement | null>(null);
|
|
153
|
+
|
|
154
|
+
const splittedProps = computed(() => {
|
|
155
|
+
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;
|
|
156
|
+
return [[p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17], restProps] as const;
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
watchEffect(() => {
|
|
160
|
+
const element = elementRef.value;
|
|
161
|
+
if (!element) return;
|
|
162
|
+
|
|
163
|
+
const [p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17] = splittedProps.value[0];
|
|
164
|
+
|
|
165
|
+
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 });
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
return () => {
|
|
169
|
+
const restProps = splittedProps.value[1];
|
|
170
|
+
return h('prosekit-tooltip-positioner', { ...restProps, ref: elementRef }, slots.default?.());
|
|
171
|
+
};
|
|
172
|
+
},
|
|
173
|
+
{ props: ['altBoundary', 'autoUpdate', 'boundary', 'elementContext', 'fitViewport', 'flip', 'hide', 'hoist', 'inline', 'offset', 'overflowPadding', 'overlap', 'placement', 'rootBoundary', 'sameHeight', 'sameWidth', 'shift', 'strategy'] },
|
|
174
|
+
);
|
|
@@ -1,33 +1,88 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
type TooltipRootProps as Props,
|
|
5
|
-
type TooltipRootEvents as Events,
|
|
6
|
-
} from '@prosekit/web/tooltip'
|
|
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 { registerTooltipRootElement, type TooltipRootEvents, type TooltipRootProps as TooltipRootElementProps } from '@prosekit/web/tooltip';
|
|
6
|
+
import { defineComponent, h, type DefineSetupFnComponent, type HTMLAttributes, shallowRef, computed, watchEffect } from 'vue';
|
|
11
7
|
|
|
12
8
|
/**
|
|
13
|
-
* Props for the {@link TooltipRoot} component.
|
|
9
|
+
* Props for the {@link TooltipRoot} Vue component.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
14
12
|
*/
|
|
15
|
-
export interface TooltipRootProps
|
|
13
|
+
export interface TooltipRootProps {
|
|
14
|
+
/**
|
|
15
|
+
* Whether the overlay is initially open.
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
defaultOpen?: TooltipRootElementProps['defaultOpen'];
|
|
19
|
+
/**
|
|
20
|
+
* Whether the overlay is currently open.
|
|
21
|
+
* @default null
|
|
22
|
+
*/
|
|
23
|
+
open?: TooltipRootElementProps['open'];
|
|
24
|
+
/**
|
|
25
|
+
* Whether the component should ignore user interaction.
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
disabled?: TooltipRootElementProps['disabled'];
|
|
29
|
+
/** Emitted when the tooltip is opened or closed. */
|
|
30
|
+
onOpenChange?: (event: TooltipRootEvents['openChange']) => void;
|
|
31
|
+
}
|
|
16
32
|
|
|
17
33
|
/**
|
|
18
|
-
*
|
|
34
|
+
* A Vue component that renders an `prosekit-tooltip-root` custom element.
|
|
35
|
+
*
|
|
36
|
+
* @public
|
|
19
37
|
*/
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
)
|
|
38
|
+
export const TooltipRoot: DefineSetupFnComponent<TooltipRootProps & HTMLAttributes> = /* @__PURE__ */ defineComponent<TooltipRootProps & HTMLAttributes>(
|
|
39
|
+
(props, { slots }) => {
|
|
40
|
+
registerTooltipRootElement();
|
|
41
|
+
|
|
42
|
+
const elementRef = shallowRef<HTMLElement | null>(null);
|
|
43
|
+
|
|
44
|
+
const splittedProps = computed(() => {
|
|
45
|
+
const { defaultOpen: p0, disabled: p1, open: p2, onOpenChange: e0, ...restProps } = props;
|
|
46
|
+
return [[p0, p1, p2, e0], restProps] as const;
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const handlers: Array<((event: any) => void) | undefined> = [];
|
|
50
|
+
|
|
51
|
+
watchEffect(() => {
|
|
52
|
+
const element = elementRef.value;
|
|
53
|
+
if (!element) return;
|
|
54
|
+
|
|
55
|
+
const [p0, p1, p2, e0] = splittedProps.value[0];
|
|
56
|
+
|
|
57
|
+
Object.assign(element, { defaultOpen: p0, disabled: p1, open: p2 });
|
|
58
|
+
|
|
59
|
+
handlers.length = 0;
|
|
60
|
+
handlers.push(e0);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
watchEffect(() => {
|
|
64
|
+
const element = elementRef.value;
|
|
65
|
+
if (!element) return;
|
|
66
|
+
|
|
67
|
+
const ac = new AbortController();
|
|
68
|
+
for (const [index, eventName] of ['openChange'].entries()) {
|
|
69
|
+
element.addEventListener(
|
|
70
|
+
eventName,
|
|
71
|
+
(event: Event) => {
|
|
72
|
+
handlers[index]?.(event);
|
|
73
|
+
},
|
|
74
|
+
{ signal: ac.signal },
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
return () => ac.abort();
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
return () => {
|
|
81
|
+
const restProps = splittedProps.value[1];
|
|
82
|
+
return h('prosekit-tooltip-root', { ...restProps, ref: elementRef }, slots.default?.());
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
{ props: ['defaultOpen', 'disabled', 'open', 'onOpenChange'] },
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
export type { TooltipRootEvents };
|
|
@@ -1,33 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
type TooltipTriggerProps as Props,
|
|
5
|
-
type TooltipTriggerEvents as Events,
|
|
6
|
-
} from '@prosekit/web/tooltip'
|
|
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 { registerTooltipTriggerElement, type TooltipTriggerProps as TooltipTriggerElementProps } from '@prosekit/web/tooltip';
|
|
6
|
+
import { defineComponent, h, type DefineSetupFnComponent, type HTMLAttributes, shallowRef, computed, watchEffect } from 'vue';
|
|
11
7
|
|
|
12
8
|
/**
|
|
13
|
-
* Props for the {@link TooltipTrigger} component.
|
|
9
|
+
* Props for the {@link TooltipTrigger} Vue component.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
14
12
|
*/
|
|
15
|
-
export interface TooltipTriggerProps
|
|
13
|
+
export interface TooltipTriggerProps {
|
|
14
|
+
/**
|
|
15
|
+
* Whether the component should ignore user interaction.
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
disabled?: TooltipTriggerElementProps['disabled'];
|
|
19
|
+
/**
|
|
20
|
+
* The delay in milliseconds before opening the tooltip on hover.
|
|
21
|
+
* @default 600
|
|
22
|
+
*/
|
|
23
|
+
openDelay?: TooltipTriggerElementProps['openDelay'];
|
|
24
|
+
/**
|
|
25
|
+
* The delay in milliseconds before closing the tooltip when hover/focus ends.
|
|
26
|
+
* @default 0
|
|
27
|
+
*/
|
|
28
|
+
closeDelay?: TooltipTriggerElementProps['closeDelay'];
|
|
29
|
+
}
|
|
16
30
|
|
|
17
31
|
/**
|
|
18
|
-
*
|
|
32
|
+
* A Vue component that renders an `prosekit-tooltip-trigger` custom element.
|
|
33
|
+
*
|
|
34
|
+
* @public
|
|
19
35
|
*/
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
)
|
|
36
|
+
export const TooltipTrigger: DefineSetupFnComponent<TooltipTriggerProps & HTMLAttributes> = /* @__PURE__ */ defineComponent<TooltipTriggerProps & HTMLAttributes>(
|
|
37
|
+
(props, { slots }) => {
|
|
38
|
+
registerTooltipTriggerElement();
|
|
39
|
+
|
|
40
|
+
const elementRef = shallowRef<HTMLElement | null>(null);
|
|
41
|
+
|
|
42
|
+
const splittedProps = computed(() => {
|
|
43
|
+
const { closeDelay: p0, disabled: p1, openDelay: p2, ...restProps } = props;
|
|
44
|
+
return [[p0, p1, p2], restProps] as const;
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
watchEffect(() => {
|
|
48
|
+
const element = elementRef.value;
|
|
49
|
+
if (!element) return;
|
|
50
|
+
|
|
51
|
+
const [p0, p1, p2] = splittedProps.value[0];
|
|
52
|
+
|
|
53
|
+
Object.assign(element, { closeDelay: p0, disabled: p1, openDelay: p2 });
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
return () => {
|
|
57
|
+
const restProps = splittedProps.value[1];
|
|
58
|
+
return h('prosekit-tooltip-trigger', { ...restProps, ref: elementRef }, slots.default?.());
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
{ props: ['closeDelay', 'disabled', 'openDelay'] },
|
|
62
|
+
);
|
package/dist/create-component.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { n as useEditorContext } from "./editor-context.js";
|
|
2
|
-
import { defineComponent, h, onMounted, ref, watchEffect } from "vue";
|
|
3
|
-
//#region src/components/create-component.ts
|
|
4
|
-
function createComponent(tagName, displayName, propNames, eventNames) {
|
|
5
|
-
const hasEditor = propNames.includes("editor");
|
|
6
|
-
return defineComponent((props, { slots, emit }) => {
|
|
7
|
-
const editor = useEditorContext();
|
|
8
|
-
const mounted = ref(false);
|
|
9
|
-
onMounted(() => {
|
|
10
|
-
mounted.value = true;
|
|
11
|
-
});
|
|
12
|
-
const elementRef = ref(null);
|
|
13
|
-
watchEffect((onCleanup) => {
|
|
14
|
-
const element = elementRef.value;
|
|
15
|
-
if (!element) return;
|
|
16
|
-
const eventHandlers = {};
|
|
17
|
-
for (const eventName of eventNames) {
|
|
18
|
-
const extractDetail = eventName.endsWith("Change");
|
|
19
|
-
eventHandlers[eventName] = (event) => {
|
|
20
|
-
emit(eventName, extractDetail ? event.detail : event);
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
for (const [eventName, handler] of Object.entries(eventHandlers)) element.addEventListener(eventName, handler);
|
|
24
|
-
onCleanup(() => {
|
|
25
|
-
for (const [eventName, handler] of Object.entries(eventHandlers)) element.removeEventListener(eventName, handler);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
return () => {
|
|
29
|
-
const properties = {};
|
|
30
|
-
for (const [key, value] of Object.entries(props)) if (value !== void 0 && !key.startsWith(".")) properties[propNames.includes(key) ? "." + key : key] = value;
|
|
31
|
-
if (hasEditor && editor && !properties["editor"]) properties.editor = editor;
|
|
32
|
-
properties.key = mounted.value ? 1 : 0;
|
|
33
|
-
properties.ref = elementRef;
|
|
34
|
-
return h(tagName, properties, slots.default?.());
|
|
35
|
-
};
|
|
36
|
-
}, {
|
|
37
|
-
name: displayName,
|
|
38
|
-
props: propNames,
|
|
39
|
-
emits: eventNames
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
//#endregion
|
|
43
|
-
export { createComponent as t };
|
|
44
|
-
|
|
45
|
-
//# sourceMappingURL=create-component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-component.js","names":[],"sources":["../src/components/create-component.ts"],"sourcesContent":["import { defineComponent, h, onMounted, ref, watchEffect, type DefineSetupFnComponent, type EmitsOptions, type HTMLAttributes } from 'vue'\n\nimport { useEditorContext } from '../injection/editor-context.ts'\n\nexport function createComponent<\n Props extends { [PropName in keyof Props]: unknown },\n Emits extends EmitsOptions,\n>(\n tagName: string,\n displayName: string,\n propNames: string[],\n eventNames: string[],\n): DefineSetupFnComponent<Partial<Props> & HTMLAttributes, Emits> {\n const hasEditor = propNames.includes('editor')\n\n const Component = defineComponent<any, any>(\n (props: Record<string, unknown>, { slots, emit }) => {\n const editor = useEditorContext()\n\n const mounted = ref(false)\n\n onMounted(() => {\n mounted.value = true\n })\n\n const elementRef = ref<HTMLElement | null>(null)\n\n watchEffect((onCleanup) => {\n const element = elementRef.value\n if (!element) return\n\n const eventHandlers: Record<string, (event: Event) => void> = {}\n for (const eventName of eventNames) {\n const extractDetail = eventName.endsWith('Change')\n eventHandlers[eventName] = (event: Event) => {\n emit(\n eventName,\n extractDetail ? (event as CustomEvent).detail : event,\n )\n }\n }\n\n for (const [eventName, handler] of Object.entries(eventHandlers)) {\n element.addEventListener(eventName, handler)\n }\n\n onCleanup(() => {\n for (const [eventName, handler] of Object.entries(eventHandlers)) {\n element.removeEventListener(eventName, handler)\n }\n })\n })\n\n return () => {\n const properties: Record<string, unknown> = {}\n\n for (const [key, value] of Object.entries(props)) {\n if (value !== undefined && !key.startsWith('.')) {\n properties[propNames.includes(key) ? '.' + key : key] = value\n }\n }\n\n // Try to add the editor prop if it's missing.\n if (hasEditor && editor && !properties['editor']) {\n properties.editor = editor\n }\n\n // Ensure web components work after SSR hydration.\n properties.key = mounted.value ? 1 : 0\n\n properties.ref = elementRef\n\n return h(tagName, properties, slots.default?.())\n }\n },\n {\n name: displayName,\n props: propNames,\n emits: eventNames,\n },\n )\n\n return Component\n}\n"],"mappings":";;;AAIA,SAAgB,gBAId,SACA,aACA,WACA,YACgE;CAChE,MAAM,YAAY,UAAU,SAAS,SAAS;AAqE9C,QAnEkB,iBACf,OAAgC,EAAE,OAAO,WAAW;EACnD,MAAM,SAAS,kBAAkB;EAEjC,MAAM,UAAU,IAAI,MAAM;AAE1B,kBAAgB;AACd,WAAQ,QAAQ;IAChB;EAEF,MAAM,aAAa,IAAwB,KAAK;AAEhD,eAAa,cAAc;GACzB,MAAM,UAAU,WAAW;AAC3B,OAAI,CAAC,QAAS;GAEd,MAAM,gBAAwD,EAAE;AAChE,QAAK,MAAM,aAAa,YAAY;IAClC,MAAM,gBAAgB,UAAU,SAAS,SAAS;AAClD,kBAAc,cAAc,UAAiB;AAC3C,UACE,WACA,gBAAiB,MAAsB,SAAS,MACjD;;;AAIL,QAAK,MAAM,CAAC,WAAW,YAAY,OAAO,QAAQ,cAAc,CAC9D,SAAQ,iBAAiB,WAAW,QAAQ;AAG9C,mBAAgB;AACd,SAAK,MAAM,CAAC,WAAW,YAAY,OAAO,QAAQ,cAAc,CAC9D,SAAQ,oBAAoB,WAAW,QAAQ;KAEjD;IACF;AAEF,eAAa;GACX,MAAM,aAAsC,EAAE;AAE9C,QAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,CAC9C,KAAI,UAAU,KAAA,KAAa,CAAC,IAAI,WAAW,IAAI,CAC7C,YAAW,UAAU,SAAS,IAAI,GAAG,MAAM,MAAM,OAAO;AAK5D,OAAI,aAAa,UAAU,CAAC,WAAW,UACrC,YAAW,SAAS;AAItB,cAAW,MAAM,QAAQ,QAAQ,IAAI;AAErC,cAAW,MAAM;AAEjB,UAAO,EAAE,SAAS,YAAY,MAAM,WAAW,CAAC;;IAGpD;EACE,MAAM;EACN,OAAO;EACP,OAAO;EACR,CACF"}
|
package/dist/create-emits.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
//#region src/components/create-emits.d.ts
|
|
2
|
-
type CreateEmits<Events extends { [EventName in keyof Events]: CustomEvent }> = { [EventName in keyof Events]: (event: EventName extends `${string}Change` ? Events[EventName]['detail'] : Events[EventName]) => void };
|
|
3
|
-
//#endregion
|
|
4
|
-
export { CreateEmits as t };
|
|
5
|
-
//# sourceMappingURL=create-emits.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-emits.d.ts","names":[],"sources":["../src/components/create-emits.ts"],"mappings":";KAAY,WAAA,sCAC2B,MAAA,GAAS,WAAA,4BAE1B,MAAA,IAClB,KAAA,EAAO,SAAA,6BAAsC,MAAA,CAAO,SAAA,cAChD,MAAA,CAAO,SAAA"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
autocompleteListProps,
|
|
3
|
-
autocompleteListEvents,
|
|
4
|
-
type AutocompleteListProps as Props,
|
|
5
|
-
type AutocompleteListEvents as Events,
|
|
6
|
-
} from '@prosekit/web/autocomplete'
|
|
7
|
-
import type { DefineSetupFnComponent, HTMLAttributes } from 'vue'
|
|
8
|
-
|
|
9
|
-
import { createComponent } from '../create-component.ts'
|
|
10
|
-
import type { CreateEmits } from '../create-emits.ts'
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Props for the {@link AutocompleteList} component.
|
|
14
|
-
*/
|
|
15
|
-
export interface AutocompleteListProps extends Partial<Props> {}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Emits for the {@link AutocompleteList} component.
|
|
19
|
-
*/
|
|
20
|
-
export interface AutocompleteListEmits extends CreateEmits<Events> {}
|
|
21
|
-
|
|
22
|
-
export const AutocompleteList: DefineSetupFnComponent<
|
|
23
|
-
AutocompleteListProps & HTMLAttributes,
|
|
24
|
-
AutocompleteListEmits
|
|
25
|
-
> = createComponent<
|
|
26
|
-
AutocompleteListProps,
|
|
27
|
-
AutocompleteListEmits
|
|
28
|
-
>(
|
|
29
|
-
'prosekit-autocomplete-list',
|
|
30
|
-
'AutocompleteList',
|
|
31
|
-
Object.keys(autocompleteListProps),
|
|
32
|
-
Object.keys(autocompleteListEvents),
|
|
33
|
-
)
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
autocompletePopoverProps,
|
|
3
|
-
autocompletePopoverEvents,
|
|
4
|
-
type AutocompletePopoverProps as Props,
|
|
5
|
-
type AutocompletePopoverEvents as Events,
|
|
6
|
-
} from '@prosekit/web/autocomplete'
|
|
7
|
-
import type { DefineSetupFnComponent, HTMLAttributes } from 'vue'
|
|
8
|
-
|
|
9
|
-
import { createComponent } from '../create-component.ts'
|
|
10
|
-
import type { CreateEmits } from '../create-emits.ts'
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Props for the {@link AutocompletePopover} component.
|
|
14
|
-
*/
|
|
15
|
-
export interface AutocompletePopoverProps extends Partial<Props> {}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Emits for the {@link AutocompletePopover} component.
|
|
19
|
-
*/
|
|
20
|
-
export interface AutocompletePopoverEmits extends CreateEmits<Events> {}
|
|
21
|
-
|
|
22
|
-
export const AutocompletePopover: DefineSetupFnComponent<
|
|
23
|
-
AutocompletePopoverProps & HTMLAttributes,
|
|
24
|
-
AutocompletePopoverEmits
|
|
25
|
-
> = createComponent<
|
|
26
|
-
AutocompletePopoverProps,
|
|
27
|
-
AutocompletePopoverEmits
|
|
28
|
-
>(
|
|
29
|
-
'prosekit-autocomplete-popover',
|
|
30
|
-
'AutocompletePopover',
|
|
31
|
-
Object.keys(autocompletePopoverProps),
|
|
32
|
-
Object.keys(autocompletePopoverEvents),
|
|
33
|
-
)
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
blockHandlePopoverProps,
|
|
3
|
-
blockHandlePopoverEvents,
|
|
4
|
-
type BlockHandlePopoverProps as Props,
|
|
5
|
-
type BlockHandlePopoverEvents as Events,
|
|
6
|
-
} from '@prosekit/web/block-handle'
|
|
7
|
-
import type { DefineSetupFnComponent, HTMLAttributes } from 'vue'
|
|
8
|
-
|
|
9
|
-
import { createComponent } from '../create-component.ts'
|
|
10
|
-
import type { CreateEmits } from '../create-emits.ts'
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Props for the {@link BlockHandlePopover} component.
|
|
14
|
-
*/
|
|
15
|
-
export interface BlockHandlePopoverProps extends Partial<Props> {}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Emits for the {@link BlockHandlePopover} component.
|
|
19
|
-
*/
|
|
20
|
-
export interface BlockHandlePopoverEmits extends CreateEmits<Events> {}
|
|
21
|
-
|
|
22
|
-
export const BlockHandlePopover: DefineSetupFnComponent<
|
|
23
|
-
BlockHandlePopoverProps & HTMLAttributes,
|
|
24
|
-
BlockHandlePopoverEmits
|
|
25
|
-
> = createComponent<
|
|
26
|
-
BlockHandlePopoverProps,
|
|
27
|
-
BlockHandlePopoverEmits
|
|
28
|
-
>(
|
|
29
|
-
'prosekit-block-handle-popover',
|
|
30
|
-
'BlockHandlePopover',
|
|
31
|
-
Object.keys(blockHandlePopoverProps),
|
|
32
|
-
Object.keys(blockHandlePopoverEvents),
|
|
33
|
-
)
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h, onMounted, ref, watchEffect, type DefineSetupFnComponent, type EmitsOptions, type HTMLAttributes } from 'vue'
|
|
2
|
-
|
|
3
|
-
import { useEditorContext } from '../injection/editor-context.ts'
|
|
4
|
-
|
|
5
|
-
export function createComponent<
|
|
6
|
-
Props extends { [PropName in keyof Props]: unknown },
|
|
7
|
-
Emits extends EmitsOptions,
|
|
8
|
-
>(
|
|
9
|
-
tagName: string,
|
|
10
|
-
displayName: string,
|
|
11
|
-
propNames: string[],
|
|
12
|
-
eventNames: string[],
|
|
13
|
-
): DefineSetupFnComponent<Partial<Props> & HTMLAttributes, Emits> {
|
|
14
|
-
const hasEditor = propNames.includes('editor')
|
|
15
|
-
|
|
16
|
-
const Component = defineComponent<any, any>(
|
|
17
|
-
(props: Record<string, unknown>, { slots, emit }) => {
|
|
18
|
-
const editor = useEditorContext()
|
|
19
|
-
|
|
20
|
-
const mounted = ref(false)
|
|
21
|
-
|
|
22
|
-
onMounted(() => {
|
|
23
|
-
mounted.value = true
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
const elementRef = ref<HTMLElement | null>(null)
|
|
27
|
-
|
|
28
|
-
watchEffect((onCleanup) => {
|
|
29
|
-
const element = elementRef.value
|
|
30
|
-
if (!element) return
|
|
31
|
-
|
|
32
|
-
const eventHandlers: Record<string, (event: Event) => void> = {}
|
|
33
|
-
for (const eventName of eventNames) {
|
|
34
|
-
const extractDetail = eventName.endsWith('Change')
|
|
35
|
-
eventHandlers[eventName] = (event: Event) => {
|
|
36
|
-
emit(
|
|
37
|
-
eventName,
|
|
38
|
-
extractDetail ? (event as CustomEvent).detail : event,
|
|
39
|
-
)
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
for (const [eventName, handler] of Object.entries(eventHandlers)) {
|
|
44
|
-
element.addEventListener(eventName, handler)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
onCleanup(() => {
|
|
48
|
-
for (const [eventName, handler] of Object.entries(eventHandlers)) {
|
|
49
|
-
element.removeEventListener(eventName, handler)
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
return () => {
|
|
55
|
-
const properties: Record<string, unknown> = {}
|
|
56
|
-
|
|
57
|
-
for (const [key, value] of Object.entries(props)) {
|
|
58
|
-
if (value !== undefined && !key.startsWith('.')) {
|
|
59
|
-
properties[propNames.includes(key) ? '.' + key : key] = value
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Try to add the editor prop if it's missing.
|
|
64
|
-
if (hasEditor && editor && !properties['editor']) {
|
|
65
|
-
properties.editor = editor
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Ensure web components work after SSR hydration.
|
|
69
|
-
properties.key = mounted.value ? 1 : 0
|
|
70
|
-
|
|
71
|
-
properties.ref = elementRef
|
|
72
|
-
|
|
73
|
-
return h(tagName, properties, slots.default?.())
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
name: displayName,
|
|
78
|
-
props: propNames,
|
|
79
|
-
emits: eventNames,
|
|
80
|
-
},
|
|
81
|
-
)
|
|
82
|
-
|
|
83
|
-
return Component
|
|
84
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
inlinePopoverProps,
|
|
3
|
-
inlinePopoverEvents,
|
|
4
|
-
type InlinePopoverProps as Props,
|
|
5
|
-
type InlinePopoverEvents as Events,
|
|
6
|
-
} from '@prosekit/web/inline-popover'
|
|
7
|
-
import type { DefineSetupFnComponent, HTMLAttributes } from 'vue'
|
|
8
|
-
|
|
9
|
-
import { createComponent } from '../create-component.ts'
|
|
10
|
-
import type { CreateEmits } from '../create-emits.ts'
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Props for the {@link InlinePopover} component.
|
|
14
|
-
*/
|
|
15
|
-
export interface InlinePopoverProps extends Partial<Props> {}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Emits for the {@link InlinePopover} component.
|
|
19
|
-
*/
|
|
20
|
-
export interface InlinePopoverEmits extends CreateEmits<Events> {}
|
|
21
|
-
|
|
22
|
-
export const InlinePopover: DefineSetupFnComponent<
|
|
23
|
-
InlinePopoverProps & HTMLAttributes,
|
|
24
|
-
InlinePopoverEmits
|
|
25
|
-
> = createComponent<
|
|
26
|
-
InlinePopoverProps,
|
|
27
|
-
InlinePopoverEmits
|
|
28
|
-
>(
|
|
29
|
-
'prosekit-inline-popover',
|
|
30
|
-
'InlinePopover',
|
|
31
|
-
Object.keys(inlinePopoverProps),
|
|
32
|
-
Object.keys(inlinePopoverEvents),
|
|
33
|
-
)
|