@prosekit/web 0.0.0
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/LICENSE +21 -0
- package/README.md +0 -0
- package/dist/_tsup-dts-rollup.d.ts +664 -0
- package/dist/chunk-LJ7LCZM7.js +26 -0
- package/dist/chunk-VJEVDINM.js +14 -0
- package/dist/prosekit-web-autocomplete.d.ts +12 -0
- package/dist/prosekit-web-autocomplete.js +354 -0
- package/dist/prosekit-web-block-handle.d.ts +6 -0
- package/dist/prosekit-web-block-handle.js +242 -0
- package/dist/prosekit-web-inline-popover.d.ts +3 -0
- package/dist/prosekit-web-inline-popover.js +161 -0
- package/dist/prosekit-web-popover.d.ts +9 -0
- package/dist/prosekit-web-popover.js +79 -0
- package/dist/prosekit-web-resizable.d.ts +6 -0
- package/dist/prosekit-web-resizable.js +286 -0
- package/dist/prosekit-web-tooltip.d.ts +9 -0
- package/dist/prosekit-web-tooltip.js +73 -0
- package/dist/prosekit-web.d.ts +1 -0
- package/dist/prosekit-web.js +0 -0
- package/package.json +116 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useEditorExtension
|
|
3
|
+
} from "./chunk-VJEVDINM.js";
|
|
4
|
+
import {
|
|
5
|
+
defineCustomElement,
|
|
6
|
+
defineProperties
|
|
7
|
+
} from "./chunk-LJ7LCZM7.js";
|
|
8
|
+
|
|
9
|
+
// src/components/inline-popover/inline-popover/element.gen.ts
|
|
10
|
+
import { BaseElement } from "@aria-ui/core";
|
|
11
|
+
|
|
12
|
+
// src/components/inline-popover/inline-popover/props.ts
|
|
13
|
+
import { defaultOverlayPositionerProps } from "@aria-ui/overlay";
|
|
14
|
+
var defaultInlinePopoverProps = Object.freeze({
|
|
15
|
+
...defaultOverlayPositionerProps,
|
|
16
|
+
editor: null,
|
|
17
|
+
open: true,
|
|
18
|
+
onOpenChange: null,
|
|
19
|
+
placement: "top",
|
|
20
|
+
offset: 12,
|
|
21
|
+
flip: true,
|
|
22
|
+
hide: true,
|
|
23
|
+
overlap: true,
|
|
24
|
+
inline: true,
|
|
25
|
+
hoist: true
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// src/components/inline-popover/inline-popover/state.ts
|
|
29
|
+
import {
|
|
30
|
+
assignProps,
|
|
31
|
+
createComputed,
|
|
32
|
+
createSignal,
|
|
33
|
+
mapSignals,
|
|
34
|
+
useAttribute,
|
|
35
|
+
useEffect
|
|
36
|
+
} from "@aria-ui/core";
|
|
37
|
+
import { useOverlayPositionerState } from "@aria-ui/overlay";
|
|
38
|
+
import { usePresence } from "@aria-ui/presence";
|
|
39
|
+
|
|
40
|
+
// src/hooks/use-editor-focus-event.ts
|
|
41
|
+
import {
|
|
42
|
+
defineFocusChangeHandler
|
|
43
|
+
} from "@prosekit/core";
|
|
44
|
+
function useEditorFocusChangeEvent(host, editor, handler) {
|
|
45
|
+
const extension = defineFocusChangeHandler(handler);
|
|
46
|
+
useEditorExtension(host, editor, extension);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// src/hooks/use-editor-update-event.ts
|
|
50
|
+
import { defineUpdateHandler } from "@prosekit/core";
|
|
51
|
+
function useEditorUpdateEvent(host, editor, handler) {
|
|
52
|
+
const extension = defineUpdateHandler(handler);
|
|
53
|
+
useEditorExtension(host, editor, extension);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// src/components/inline-popover/inline-popover/virtual-selection-element.ts
|
|
57
|
+
import { isNodeSelection, isTextSelection } from "@prosekit/core";
|
|
58
|
+
|
|
59
|
+
// src/utils/is-in-code-block.ts
|
|
60
|
+
function isInCodeBlock(selection) {
|
|
61
|
+
const type = selection.$from.parent.type;
|
|
62
|
+
return type.spec.code && type.isBlock;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// src/components/inline-popover/inline-popover/virtual-selection-element.ts
|
|
66
|
+
function getVirtualSelectionElement(view) {
|
|
67
|
+
if (typeof window === "undefined" || view.isDestroyed) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
const selection = view.state.selection;
|
|
71
|
+
if (!selection.empty && !isInCodeBlock(selection) && (isTextSelection(selection) || isNodeSelection(selection))) {
|
|
72
|
+
const decoration = getInlineDecoration(view);
|
|
73
|
+
if (decoration) {
|
|
74
|
+
return decoration;
|
|
75
|
+
}
|
|
76
|
+
const range = getDomRange();
|
|
77
|
+
if (range) {
|
|
78
|
+
return {
|
|
79
|
+
contextElement: view.dom,
|
|
80
|
+
getBoundingClientRect: () => range.getBoundingClientRect(),
|
|
81
|
+
getClientRects: () => range.getClientRects()
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
function getDomRange() {
|
|
88
|
+
const selection = window.getSelection();
|
|
89
|
+
if (!selection || selection.isCollapsed) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const range = typeof selection.rangeCount === "number" && selection.rangeCount > 0 && selection.getRangeAt(0);
|
|
93
|
+
if (!range) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
return range;
|
|
97
|
+
}
|
|
98
|
+
function getInlineDecoration(view) {
|
|
99
|
+
const match = view.dom.querySelectorAll(".prosekit-virtual-selection");
|
|
100
|
+
if (match.length === 0) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (match.length === 1) {
|
|
104
|
+
return match[0];
|
|
105
|
+
}
|
|
106
|
+
const items = Array.from(match);
|
|
107
|
+
return {
|
|
108
|
+
contextElement: items[0],
|
|
109
|
+
getBoundingClientRect: () => items[0].getBoundingClientRect(),
|
|
110
|
+
getClientRects: () => items.map((item) => item.getBoundingClientRect())
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// src/components/inline-popover/inline-popover/state.ts
|
|
115
|
+
function useInlinePopover(host, props) {
|
|
116
|
+
const state = mapSignals(assignProps(defaultInlinePopoverProps, props));
|
|
117
|
+
useInlinePopoverState(host, state);
|
|
118
|
+
return state;
|
|
119
|
+
}
|
|
120
|
+
function useInlinePopoverState(host, state) {
|
|
121
|
+
const { editor, open, onOpenChange, ...overlayState } = state;
|
|
122
|
+
const reference = useInlinePopoverReference(host, editor);
|
|
123
|
+
useOverlayPositionerState(host, overlayState, { reference });
|
|
124
|
+
const presence = createComputed(() => !!reference.value && open.value);
|
|
125
|
+
useAttribute(host, "data-state", () => presence.value ? "open" : "closed");
|
|
126
|
+
usePresence(host, presence);
|
|
127
|
+
useEffect(host, () => {
|
|
128
|
+
var _a;
|
|
129
|
+
const presenceValue = presence.value;
|
|
130
|
+
(_a = onOpenChange.peek()) == null ? void 0 : _a(presenceValue);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
function useInlinePopoverReference(host, editor) {
|
|
134
|
+
const reference = createSignal(null);
|
|
135
|
+
let editorFocused = false;
|
|
136
|
+
useEditorFocusChangeEvent(host, editor, (focus) => {
|
|
137
|
+
editorFocused = focus;
|
|
138
|
+
});
|
|
139
|
+
useEditorUpdateEvent(host, editor, (view) => {
|
|
140
|
+
const isPopoverFocused = !editorFocused && host.contains(host.ownerDocument.activeElement);
|
|
141
|
+
if (isPopoverFocused) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
reference.value = getVirtualSelectionElement(view);
|
|
145
|
+
});
|
|
146
|
+
return reference;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// src/components/inline-popover/inline-popover/element.gen.ts
|
|
150
|
+
var InlinePopoverElement = class extends BaseElement {
|
|
151
|
+
constructor() {
|
|
152
|
+
super();
|
|
153
|
+
this._s = useInlinePopover(this);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
defineProperties(InlinePopoverElement, defaultInlinePopoverProps);
|
|
157
|
+
defineCustomElement("prosekit-inline-popover", InlinePopoverElement);
|
|
158
|
+
export {
|
|
159
|
+
InlinePopoverElement,
|
|
160
|
+
defaultInlinePopoverProps
|
|
161
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { PopoverContentElement } from './_tsup-dts-rollup';
|
|
2
|
+
export { defaultPopoverContentProps } from './_tsup-dts-rollup';
|
|
3
|
+
export { PopoverContentProps } from './_tsup-dts-rollup';
|
|
4
|
+
export { PopoverRootElement } from './_tsup-dts-rollup';
|
|
5
|
+
export { defaultPopoverRootProps } from './_tsup-dts-rollup';
|
|
6
|
+
export { PopoverRootProps } from './_tsup-dts-rollup';
|
|
7
|
+
export { PopoverTriggerElement } from './_tsup-dts-rollup';
|
|
8
|
+
export { defaultPopoverTriggerProps } from './_tsup-dts-rollup';
|
|
9
|
+
export { PopoverTriggerProps } from './_tsup-dts-rollup';
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineCustomElement,
|
|
3
|
+
defineProperties
|
|
4
|
+
} from "./chunk-LJ7LCZM7.js";
|
|
5
|
+
|
|
6
|
+
// src/components/popover/popover-content/element.gen.ts
|
|
7
|
+
import { BaseElement } from "@aria-ui/core";
|
|
8
|
+
|
|
9
|
+
// src/components/popover/popover-content/props.ts
|
|
10
|
+
import {
|
|
11
|
+
defaultPopoverContentProps
|
|
12
|
+
} from "@aria-ui/popover";
|
|
13
|
+
|
|
14
|
+
// src/components/popover/popover-content/state.ts
|
|
15
|
+
import { usePopoverContent } from "@aria-ui/popover";
|
|
16
|
+
|
|
17
|
+
// src/components/popover/popover-content/element.gen.ts
|
|
18
|
+
var PopoverContentElement = class extends BaseElement {
|
|
19
|
+
constructor() {
|
|
20
|
+
super();
|
|
21
|
+
this._s = usePopoverContent(this);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
defineProperties(PopoverContentElement, defaultPopoverContentProps);
|
|
25
|
+
defineCustomElement("prosekit-popover-content", PopoverContentElement);
|
|
26
|
+
|
|
27
|
+
// src/components/popover/popover-root/element.gen.ts
|
|
28
|
+
import { BaseElement as BaseElement2 } from "@aria-ui/core";
|
|
29
|
+
|
|
30
|
+
// src/components/popover/popover-root/props.ts
|
|
31
|
+
import {
|
|
32
|
+
defaultPopoverRootProps
|
|
33
|
+
} from "@aria-ui/popover";
|
|
34
|
+
|
|
35
|
+
// src/components/popover/popover-root/state.ts
|
|
36
|
+
import { usePopoverRoot } from "@aria-ui/popover";
|
|
37
|
+
|
|
38
|
+
// src/components/popover/popover-root/element.gen.ts
|
|
39
|
+
var PopoverRootElement = class extends BaseElement2 {
|
|
40
|
+
constructor() {
|
|
41
|
+
super();
|
|
42
|
+
this._s = usePopoverRoot(this);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
defineProperties(PopoverRootElement, defaultPopoverRootProps);
|
|
46
|
+
defineCustomElement("prosekit-popover-root", PopoverRootElement);
|
|
47
|
+
|
|
48
|
+
// src/components/popover/popover-trigger/element.gen.ts
|
|
49
|
+
import { BaseElement as BaseElement3 } from "@aria-ui/core";
|
|
50
|
+
|
|
51
|
+
// src/components/popover/popover-trigger/props.ts
|
|
52
|
+
import {
|
|
53
|
+
defaultPopoverTriggerProps
|
|
54
|
+
} from "@aria-ui/popover";
|
|
55
|
+
|
|
56
|
+
// src/components/popover/popover-trigger/state.ts
|
|
57
|
+
import { usePopoverTrigger as _usePopoverTrigger } from "@aria-ui/popover";
|
|
58
|
+
function usePopoverTrigger(host) {
|
|
59
|
+
_usePopoverTrigger(host);
|
|
60
|
+
return {};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// src/components/popover/popover-trigger/element.gen.ts
|
|
64
|
+
var PopoverTriggerElement = class extends BaseElement3 {
|
|
65
|
+
constructor() {
|
|
66
|
+
super();
|
|
67
|
+
this._s = usePopoverTrigger(this);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
defineProperties(PopoverTriggerElement, defaultPopoverTriggerProps);
|
|
71
|
+
defineCustomElement("prosekit-popover-trigger", PopoverTriggerElement);
|
|
72
|
+
export {
|
|
73
|
+
PopoverContentElement,
|
|
74
|
+
PopoverRootElement,
|
|
75
|
+
PopoverTriggerElement,
|
|
76
|
+
defaultPopoverContentProps,
|
|
77
|
+
defaultPopoverRootProps,
|
|
78
|
+
defaultPopoverTriggerProps
|
|
79
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { ResizableHandleElement } from './_tsup-dts-rollup';
|
|
2
|
+
export { defaultResizableHandleProps } from './_tsup-dts-rollup';
|
|
3
|
+
export { ResizableHandleProps } from './_tsup-dts-rollup';
|
|
4
|
+
export { ResizableRootElement } from './_tsup-dts-rollup';
|
|
5
|
+
export { defaultResizableRootProps } from './_tsup-dts-rollup';
|
|
6
|
+
export { ResizableRootProps } from './_tsup-dts-rollup';
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineCustomElement,
|
|
3
|
+
defineProperties
|
|
4
|
+
} from "./chunk-LJ7LCZM7.js";
|
|
5
|
+
|
|
6
|
+
// src/components/resizable/resizable-handle/element.gen.ts
|
|
7
|
+
import { BaseElement } from "@aria-ui/core";
|
|
8
|
+
|
|
9
|
+
// src/components/resizable/resizable-handle/props.ts
|
|
10
|
+
var defaultResizableHandleProps = {
|
|
11
|
+
position: "bottom-right"
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// src/components/resizable/resizable-handle/state.ts
|
|
15
|
+
import {
|
|
16
|
+
assignProps,
|
|
17
|
+
createSignal,
|
|
18
|
+
mapSignals,
|
|
19
|
+
useEffect
|
|
20
|
+
} from "@aria-ui/core";
|
|
21
|
+
import { getWindow } from "@zag-js/dom-query";
|
|
22
|
+
|
|
23
|
+
// src/components/resizable/context.ts
|
|
24
|
+
import { createContext } from "@aria-ui/core";
|
|
25
|
+
var onResizeContext = createContext(
|
|
26
|
+
"prosekit/resizable/onResize",
|
|
27
|
+
null
|
|
28
|
+
);
|
|
29
|
+
var onResizeStartContext = createContext(
|
|
30
|
+
"prosekit/resizable/onResizeStart",
|
|
31
|
+
null
|
|
32
|
+
);
|
|
33
|
+
var onResizeEndContext = createContext(
|
|
34
|
+
"prosekit/resizable/onResizeEnd",
|
|
35
|
+
null
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
// src/utils/is-finite-positive-number.ts
|
|
39
|
+
function isFinitePositiveNumber(value) {
|
|
40
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// src/components/resizable/resizable-handle/calc-resize.ts
|
|
44
|
+
function calcResize(position, w, h, dx, dy, aspectRatio) {
|
|
45
|
+
aspectRatio = aspectRatio ? aspectRatio : w / h;
|
|
46
|
+
aspectRatio = isFinitePositiveNumber(aspectRatio) ? aspectRatio : 1;
|
|
47
|
+
switch (position) {
|
|
48
|
+
case "bottom-right":
|
|
49
|
+
return calcBottomRightResize(w, h, dx, dy, aspectRatio);
|
|
50
|
+
case "bottom-left":
|
|
51
|
+
return calcBottomLeftResize(w, h, dx, dy, aspectRatio);
|
|
52
|
+
case "top-right":
|
|
53
|
+
return calcTopRightResize(w, h, dx, dy, aspectRatio);
|
|
54
|
+
case "top-left":
|
|
55
|
+
return calcTopLeftResize(w, h, dx, dy, aspectRatio);
|
|
56
|
+
case "top":
|
|
57
|
+
return calcTopResize(w, h, dx, dy, aspectRatio);
|
|
58
|
+
case "right":
|
|
59
|
+
return calcRightResize(w, h, dx, dy, aspectRatio);
|
|
60
|
+
case "bottom":
|
|
61
|
+
return calcBottomResize(w, h, dx, dy, aspectRatio);
|
|
62
|
+
case "left":
|
|
63
|
+
return calcLeftResize(w, h, dx, dy, aspectRatio);
|
|
64
|
+
default:
|
|
65
|
+
throw new RangeError(`Invalid position: ${position}`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
var calcBottomRightResize = (w, h, dx, dy, r) => {
|
|
69
|
+
w += dx;
|
|
70
|
+
h += dy;
|
|
71
|
+
const sum = w + h;
|
|
72
|
+
h = sum / (r + 1);
|
|
73
|
+
w = sum - h;
|
|
74
|
+
return [w, h];
|
|
75
|
+
};
|
|
76
|
+
var calcBottomLeftResize = (w, h, dx, dy, r) => {
|
|
77
|
+
w -= dx;
|
|
78
|
+
h += dy;
|
|
79
|
+
const sum = w + h;
|
|
80
|
+
h = sum / (r + 1);
|
|
81
|
+
w = sum - h;
|
|
82
|
+
return [w, h];
|
|
83
|
+
};
|
|
84
|
+
var calcTopRightResize = (w, h, dx, dy, r) => {
|
|
85
|
+
w += dx;
|
|
86
|
+
h -= dy;
|
|
87
|
+
const sum = w + h;
|
|
88
|
+
h = sum / (r + 1);
|
|
89
|
+
w = sum - h;
|
|
90
|
+
return [w, h];
|
|
91
|
+
};
|
|
92
|
+
var calcTopLeftResize = (w, h, dx, dy, r) => {
|
|
93
|
+
w -= dx;
|
|
94
|
+
h -= dy;
|
|
95
|
+
const sum = w + h;
|
|
96
|
+
h = sum / (r + 1);
|
|
97
|
+
w = sum - h;
|
|
98
|
+
return [w, h];
|
|
99
|
+
};
|
|
100
|
+
var calcTopResize = (w, h, dx, dy, r) => {
|
|
101
|
+
h -= dy;
|
|
102
|
+
w = h * r;
|
|
103
|
+
return [w, h];
|
|
104
|
+
};
|
|
105
|
+
var calcRightResize = (w, h, dx, dy, r) => {
|
|
106
|
+
w += dx;
|
|
107
|
+
h = w / r;
|
|
108
|
+
return [w, h];
|
|
109
|
+
};
|
|
110
|
+
var calcBottomResize = (w, h, dx, dy, r) => {
|
|
111
|
+
h += dy;
|
|
112
|
+
w = h * r;
|
|
113
|
+
return [w, h];
|
|
114
|
+
};
|
|
115
|
+
var calcLeftResize = (w, h, dx, dy, r) => {
|
|
116
|
+
w -= dx;
|
|
117
|
+
h = w / r;
|
|
118
|
+
return [w, h];
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
// src/components/resizable/resizable-handle/state.ts
|
|
122
|
+
function useResizableHandle(host, props) {
|
|
123
|
+
const state = mapSignals(assignProps(defaultResizableHandleProps, props));
|
|
124
|
+
const onResize = onResizeContext.consume(host);
|
|
125
|
+
const onResizeStart = onResizeStartContext.consume(host);
|
|
126
|
+
const onResizeEnd = onResizeEndContext.consume(host);
|
|
127
|
+
useResizableHandleState(host, state, { onResize, onResizeStart, onResizeEnd });
|
|
128
|
+
return state;
|
|
129
|
+
}
|
|
130
|
+
function useResizableHandleState(host, state, context) {
|
|
131
|
+
let startX = 0;
|
|
132
|
+
let startY = 0;
|
|
133
|
+
let width = 0;
|
|
134
|
+
let height = 0;
|
|
135
|
+
let aspectRatio = 1;
|
|
136
|
+
const pointerPressing = createSignal(false);
|
|
137
|
+
const handlePointerDown = (event) => {
|
|
138
|
+
var _a, _b;
|
|
139
|
+
event.preventDefault();
|
|
140
|
+
pointerPressing.value = true;
|
|
141
|
+
startX = event.x;
|
|
142
|
+
startY = event.y;
|
|
143
|
+
const size = (_b = (_a = context.onResizeStart).value) == null ? void 0 : _b.call(_a);
|
|
144
|
+
if (size) {
|
|
145
|
+
;
|
|
146
|
+
[width, height, aspectRatio] = size;
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
const handlePointerMove = (event) => {
|
|
150
|
+
var _a, _b;
|
|
151
|
+
event.preventDefault();
|
|
152
|
+
const dx = event.x - startX;
|
|
153
|
+
const dy = event.y - startY;
|
|
154
|
+
const [w, h] = calcResize(
|
|
155
|
+
state.position.peek(),
|
|
156
|
+
width,
|
|
157
|
+
height,
|
|
158
|
+
dx,
|
|
159
|
+
dy,
|
|
160
|
+
aspectRatio
|
|
161
|
+
);
|
|
162
|
+
(_b = (_a = context.onResize).value) == null ? void 0 : _b.call(_a, w, h);
|
|
163
|
+
};
|
|
164
|
+
const handlePointerUp = (event) => {
|
|
165
|
+
var _a, _b;
|
|
166
|
+
event.preventDefault();
|
|
167
|
+
pointerPressing.value = false;
|
|
168
|
+
(_b = (_a = context.onResizeEnd).value) == null ? void 0 : _b.call(_a);
|
|
169
|
+
};
|
|
170
|
+
useEffect(host, () => {
|
|
171
|
+
host.addEventListener("pointerdown", handlePointerDown);
|
|
172
|
+
return () => {
|
|
173
|
+
host.removeEventListener("pointerdown", handlePointerDown);
|
|
174
|
+
};
|
|
175
|
+
});
|
|
176
|
+
useEffect(host, () => {
|
|
177
|
+
if (!pointerPressing.value) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
const win = getWindow(host);
|
|
181
|
+
win.addEventListener("pointermove", handlePointerMove);
|
|
182
|
+
win.addEventListener("pointerup", handlePointerUp);
|
|
183
|
+
return () => {
|
|
184
|
+
win.removeEventListener("pointermove", handlePointerMove);
|
|
185
|
+
win.removeEventListener("pointerup", handlePointerUp);
|
|
186
|
+
};
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// src/components/resizable/resizable-handle/element.gen.ts
|
|
191
|
+
var ResizableHandleElement = class extends BaseElement {
|
|
192
|
+
constructor() {
|
|
193
|
+
super();
|
|
194
|
+
this._s = useResizableHandle(this);
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
defineProperties(ResizableHandleElement, defaultResizableHandleProps);
|
|
198
|
+
defineCustomElement("prosekit-resizable-handle", ResizableHandleElement);
|
|
199
|
+
|
|
200
|
+
// src/components/resizable/resizable-root/element.gen.ts
|
|
201
|
+
import { BaseElement as BaseElement2 } from "@aria-ui/core";
|
|
202
|
+
|
|
203
|
+
// src/components/resizable/resizable-root/props.ts
|
|
204
|
+
var defaultResizableRootProps = {
|
|
205
|
+
width: null,
|
|
206
|
+
height: null,
|
|
207
|
+
aspectRatio: null,
|
|
208
|
+
onSizeChangeStart: null,
|
|
209
|
+
onSizeChange: null,
|
|
210
|
+
onSizeChangeEnd: null
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
// src/components/resizable/resizable-root/state.ts
|
|
214
|
+
import {
|
|
215
|
+
assignProps as assignProps2,
|
|
216
|
+
createSignal as createSignal2,
|
|
217
|
+
mapSignals as mapSignals2,
|
|
218
|
+
useEffect as useEffect2
|
|
219
|
+
} from "@aria-ui/core";
|
|
220
|
+
function useResizableRoot(host, props) {
|
|
221
|
+
const state = mapSignals2(assignProps2(defaultResizableRootProps, props));
|
|
222
|
+
useResizableRootState(host, state);
|
|
223
|
+
return state;
|
|
224
|
+
}
|
|
225
|
+
function useResizableRootState(host, state) {
|
|
226
|
+
const onResizeStart = () => {
|
|
227
|
+
var _a, _b;
|
|
228
|
+
const { width, height } = host.getBoundingClientRect();
|
|
229
|
+
let aspectRatio = (_a = state.aspectRatio.peek()) != null ? _a : width / height;
|
|
230
|
+
if (!isFinitePositiveNumber(aspectRatio)) {
|
|
231
|
+
aspectRatio = 0;
|
|
232
|
+
}
|
|
233
|
+
(_b = state.onSizeChangeStart.peek()) == null ? void 0 : _b({ width, height });
|
|
234
|
+
return [width, height, aspectRatio];
|
|
235
|
+
};
|
|
236
|
+
const onResize = (width, height) => {
|
|
237
|
+
var _a;
|
|
238
|
+
(_a = state.onSizeChange.peek()) == null ? void 0 : _a({ width, height });
|
|
239
|
+
state.width.value = width;
|
|
240
|
+
state.height.value = height;
|
|
241
|
+
};
|
|
242
|
+
const onResizeEnd = () => {
|
|
243
|
+
var _a;
|
|
244
|
+
const { width, height } = host.getBoundingClientRect();
|
|
245
|
+
(_a = state.onSizeChangeEnd.peek()) == null ? void 0 : _a({ width, height });
|
|
246
|
+
};
|
|
247
|
+
onResizeStartContext.provide(host, createSignal2(onResizeStart));
|
|
248
|
+
onResizeContext.provide(host, createSignal2(onResize));
|
|
249
|
+
onResizeEndContext.provide(host, createSignal2(onResizeEnd));
|
|
250
|
+
useEffect2(host, () => {
|
|
251
|
+
updateResizableRootStyles(
|
|
252
|
+
host,
|
|
253
|
+
state.width.value,
|
|
254
|
+
state.height.value,
|
|
255
|
+
state.aspectRatio.value
|
|
256
|
+
);
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
function updateResizableRootStyles(host, width, height, aspectRatio) {
|
|
260
|
+
host.style.width = isFinitePositiveNumber(width) ? `${width}px` : "";
|
|
261
|
+
host.style.height = isFinitePositiveNumber(height) ? `${height}px` : "";
|
|
262
|
+
if (isFinitePositiveNumber(aspectRatio)) {
|
|
263
|
+
host.style.aspectRatio = `${aspectRatio}`;
|
|
264
|
+
if (width && width > 0 && aspectRatio >= 1) {
|
|
265
|
+
host.style.height = "auto";
|
|
266
|
+
} else if (height && height > 0 && aspectRatio <= 1) {
|
|
267
|
+
host.style.width = "auto";
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// src/components/resizable/resizable-root/element.gen.ts
|
|
273
|
+
var ResizableRootElement = class extends BaseElement2 {
|
|
274
|
+
constructor() {
|
|
275
|
+
super();
|
|
276
|
+
this._s = useResizableRoot(this);
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
defineProperties(ResizableRootElement, defaultResizableRootProps);
|
|
280
|
+
defineCustomElement("prosekit-resizable-root", ResizableRootElement);
|
|
281
|
+
export {
|
|
282
|
+
ResizableHandleElement,
|
|
283
|
+
ResizableRootElement,
|
|
284
|
+
defaultResizableHandleProps,
|
|
285
|
+
defaultResizableRootProps
|
|
286
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { TooltipContentElement } from './_tsup-dts-rollup';
|
|
2
|
+
export { defaultTooltipContentProps } from './_tsup-dts-rollup';
|
|
3
|
+
export { TooltipContentProps } from './_tsup-dts-rollup';
|
|
4
|
+
export { TooltipRootElement } from './_tsup-dts-rollup';
|
|
5
|
+
export { defaultTooltipRootProps } from './_tsup-dts-rollup';
|
|
6
|
+
export { TooltipRootProps } from './_tsup-dts-rollup';
|
|
7
|
+
export { TooltipTriggerElement } from './_tsup-dts-rollup';
|
|
8
|
+
export { defaultTooltipTriggerProps } from './_tsup-dts-rollup';
|
|
9
|
+
export { TooltipTriggerProps } from './_tsup-dts-rollup';
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineCustomElement,
|
|
3
|
+
defineProperties
|
|
4
|
+
} from "./chunk-LJ7LCZM7.js";
|
|
5
|
+
|
|
6
|
+
// src/components/tooltip/tooltip-content/element.gen.ts
|
|
7
|
+
import { BaseElement } from "@aria-ui/core";
|
|
8
|
+
|
|
9
|
+
// src/components/tooltip/tooltip-content/props.ts
|
|
10
|
+
import { defaultTooltipContentProps } from "@aria-ui/tooltip";
|
|
11
|
+
|
|
12
|
+
// src/components/tooltip/tooltip-content/state.ts
|
|
13
|
+
import { useTooltipContent } from "@aria-ui/tooltip";
|
|
14
|
+
|
|
15
|
+
// src/components/tooltip/tooltip-content/element.gen.ts
|
|
16
|
+
var TooltipContentElement = class extends BaseElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super();
|
|
19
|
+
this._s = useTooltipContent(this);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
defineProperties(TooltipContentElement, defaultTooltipContentProps);
|
|
23
|
+
defineCustomElement("prosekit-tooltip-content", TooltipContentElement);
|
|
24
|
+
|
|
25
|
+
// src/components/tooltip/tooltip-root/element.gen.ts
|
|
26
|
+
import { BaseElement as BaseElement2 } from "@aria-ui/core";
|
|
27
|
+
|
|
28
|
+
// src/components/tooltip/tooltip-root/props.ts
|
|
29
|
+
import { defaultTooltipRootProps } from "@aria-ui/tooltip";
|
|
30
|
+
|
|
31
|
+
// src/components/tooltip/tooltip-root/state.ts
|
|
32
|
+
import { useTooltipRoot } from "@aria-ui/tooltip";
|
|
33
|
+
|
|
34
|
+
// src/components/tooltip/tooltip-root/element.gen.ts
|
|
35
|
+
var TooltipRootElement = class extends BaseElement2 {
|
|
36
|
+
constructor() {
|
|
37
|
+
super();
|
|
38
|
+
this._s = useTooltipRoot(this);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
defineProperties(TooltipRootElement, defaultTooltipRootProps);
|
|
42
|
+
defineCustomElement("prosekit-tooltip-root", TooltipRootElement);
|
|
43
|
+
|
|
44
|
+
// src/components/tooltip/tooltip-trigger/element.gen.ts
|
|
45
|
+
import { BaseElement as BaseElement3 } from "@aria-ui/core";
|
|
46
|
+
|
|
47
|
+
// src/components/tooltip/tooltip-trigger/props.ts
|
|
48
|
+
var defaultTooltipTriggerProps = {};
|
|
49
|
+
|
|
50
|
+
// src/components/tooltip/tooltip-trigger/state.ts
|
|
51
|
+
import { useTooltipTrigger as _useTooltipTrigger } from "@aria-ui/tooltip";
|
|
52
|
+
function useTooltipTrigger(host) {
|
|
53
|
+
_useTooltipTrigger(host);
|
|
54
|
+
return {};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// src/components/tooltip/tooltip-trigger/element.gen.ts
|
|
58
|
+
var TooltipTriggerElement = class extends BaseElement3 {
|
|
59
|
+
constructor() {
|
|
60
|
+
super();
|
|
61
|
+
this._s = useTooltipTrigger(this);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
defineProperties(TooltipTriggerElement, defaultTooltipTriggerProps);
|
|
65
|
+
defineCustomElement("prosekit-tooltip-trigger", TooltipTriggerElement);
|
|
66
|
+
export {
|
|
67
|
+
TooltipContentElement,
|
|
68
|
+
TooltipRootElement,
|
|
69
|
+
TooltipTriggerElement,
|
|
70
|
+
defaultTooltipContentProps,
|
|
71
|
+
defaultTooltipRootProps,
|
|
72
|
+
defaultTooltipTriggerProps
|
|
73
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
File without changes
|