@iris-ui-kit/vue 0.1.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/dist/admin.cjs +1869 -0
- package/dist/admin.cjs.map +1 -0
- package/dist/admin.d.cts +376 -0
- package/dist/admin.d.ts +376 -0
- package/dist/admin.js +10 -0
- package/dist/admin.js.map +1 -0
- package/dist/async.cjs +76 -0
- package/dist/async.cjs.map +1 -0
- package/dist/async.d.cts +59 -0
- package/dist/async.d.ts +59 -0
- package/dist/async.js +3 -0
- package/dist/async.js.map +1 -0
- package/dist/behaviors.cjs +659 -0
- package/dist/behaviors.cjs.map +1 -0
- package/dist/behaviors.d.cts +441 -0
- package/dist/behaviors.d.ts +441 -0
- package/dist/behaviors.js +3 -0
- package/dist/behaviors.js.map +1 -0
- package/dist/chunk-3FJUCHCC.js +146 -0
- package/dist/chunk-3FJUCHCC.js.map +1 -0
- package/dist/chunk-3R3QDLJC.js +172 -0
- package/dist/chunk-3R3QDLJC.js.map +1 -0
- package/dist/chunk-4FLIW67H.js +137 -0
- package/dist/chunk-4FLIW67H.js.map +1 -0
- package/dist/chunk-4FQ7XF52.js +3 -0
- package/dist/chunk-4FQ7XF52.js.map +1 -0
- package/dist/chunk-72PZMU6R.js +99 -0
- package/dist/chunk-72PZMU6R.js.map +1 -0
- package/dist/chunk-75GSYEJS.js +17 -0
- package/dist/chunk-75GSYEJS.js.map +1 -0
- package/dist/chunk-7IOJADZC.js +38 -0
- package/dist/chunk-7IOJADZC.js.map +1 -0
- package/dist/chunk-CIZGSGXN.js +651 -0
- package/dist/chunk-CIZGSGXN.js.map +1 -0
- package/dist/chunk-F77KIPOH.js +103 -0
- package/dist/chunk-F77KIPOH.js.map +1 -0
- package/dist/chunk-FJBYAIL4.js +1318 -0
- package/dist/chunk-FJBYAIL4.js.map +1 -0
- package/dist/chunk-H7HVVPYR.js +66 -0
- package/dist/chunk-H7HVVPYR.js.map +1 -0
- package/dist/chunk-I6D5VXQK.js +167 -0
- package/dist/chunk-I6D5VXQK.js.map +1 -0
- package/dist/chunk-PPYNXNGZ.js +73 -0
- package/dist/chunk-PPYNXNGZ.js.map +1 -0
- package/dist/chunk-QLUIKEMJ.js +1197 -0
- package/dist/chunk-QLUIKEMJ.js.map +1 -0
- package/dist/chunk-ROJV6RON.js +3 -0
- package/dist/chunk-ROJV6RON.js.map +1 -0
- package/dist/chunk-S43IHHBU.js +82 -0
- package/dist/chunk-S43IHHBU.js.map +1 -0
- package/dist/chunk-TCAXRWT6.js +108 -0
- package/dist/chunk-TCAXRWT6.js.map +1 -0
- package/dist/chunk-TQB5LVOH.js +17 -0
- package/dist/chunk-TQB5LVOH.js.map +1 -0
- package/dist/chunk-VM2CXEUA.js +46 -0
- package/dist/chunk-VM2CXEUA.js.map +1 -0
- package/dist/chunk-W2JVHGFR.js +103 -0
- package/dist/chunk-W2JVHGFR.js.map +1 -0
- package/dist/chunk-WL67XCH5.js +59 -0
- package/dist/chunk-WL67XCH5.js.map +1 -0
- package/dist/chunk-XCNCIG2I.js +165 -0
- package/dist/chunk-XCNCIG2I.js.map +1 -0
- package/dist/chunk-XSLBANUV.js +16 -0
- package/dist/chunk-XSLBANUV.js.map +1 -0
- package/dist/chunk-ZY4NLITM.js +73 -0
- package/dist/chunk-ZY4NLITM.js.map +1 -0
- package/dist/data.cjs +59 -0
- package/dist/data.cjs.map +1 -0
- package/dist/data.d.cts +46 -0
- package/dist/data.d.ts +46 -0
- package/dist/data.js +4 -0
- package/dist/data.js.map +1 -0
- package/dist/error-boundary.cjs +115 -0
- package/dist/error-boundary.cjs.map +1 -0
- package/dist/error-boundary.d.cts +60 -0
- package/dist/error-boundary.d.ts +60 -0
- package/dist/error-boundary.js +4 -0
- package/dist/error-boundary.js.map +1 -0
- package/dist/floating.cjs +149 -0
- package/dist/floating.cjs.map +1 -0
- package/dist/floating.d.cts +106 -0
- package/dist/floating.d.ts +106 -0
- package/dist/floating.js +4 -0
- package/dist/floating.js.map +1 -0
- package/dist/form.cjs +144 -0
- package/dist/form.cjs.map +1 -0
- package/dist/form.d.cts +128 -0
- package/dist/form.d.ts +128 -0
- package/dist/form.js +3 -0
- package/dist/form.js.map +1 -0
- package/dist/i18n.cjs +112 -0
- package/dist/i18n.cjs.map +1 -0
- package/dist/i18n.d.cts +99 -0
- package/dist/i18n.d.ts +99 -0
- package/dist/i18n.js +3 -0
- package/dist/i18n.js.map +1 -0
- package/dist/index.cjs +18673 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +8087 -0
- package/dist/index.d.ts +8087 -0
- package/dist/index.js +13525 -0
- package/dist/index.js.map +1 -0
- package/dist/layouts.cjs +392 -0
- package/dist/layouts.cjs.map +1 -0
- package/dist/layouts.d.cts +406 -0
- package/dist/layouts.d.ts +406 -0
- package/dist/layouts.js +5 -0
- package/dist/layouts.js.map +1 -0
- package/dist/machine.cjs +19 -0
- package/dist/machine.cjs.map +1 -0
- package/dist/machine.d.cts +18 -0
- package/dist/machine.d.ts +18 -0
- package/dist/machine.js +4 -0
- package/dist/machine.js.map +1 -0
- package/dist/modal-utils.cjs +170 -0
- package/dist/modal-utils.cjs.map +1 -0
- package/dist/modal-utils.d.cts +43 -0
- package/dist/modal-utils.d.ts +43 -0
- package/dist/modal-utils.js +3 -0
- package/dist/modal-utils.js.map +1 -0
- package/dist/motion.cjs +88 -0
- package/dist/motion.cjs.map +1 -0
- package/dist/motion.d.cts +43 -0
- package/dist/motion.d.ts +43 -0
- package/dist/motion.js +3 -0
- package/dist/motion.js.map +1 -0
- package/dist/provider.cjs +272 -0
- package/dist/provider.cjs.map +1 -0
- package/dist/provider.d.cts +130 -0
- package/dist/provider.d.ts +130 -0
- package/dist/provider.js +6 -0
- package/dist/provider.js.map +1 -0
- package/dist/resource.cjs +25 -0
- package/dist/resource.cjs.map +1 -0
- package/dist/resource.d.cts +17 -0
- package/dist/resource.d.ts +17 -0
- package/dist/resource.js +3 -0
- package/dist/resource.js.map +1 -0
- package/dist/skeletons.cjs +1659 -0
- package/dist/skeletons.cjs.map +1 -0
- package/dist/skeletons.d.cts +179 -0
- package/dist/skeletons.d.ts +179 -0
- package/dist/skeletons.js +7 -0
- package/dist/skeletons.js.map +1 -0
- package/dist/skins.cjs +138 -0
- package/dist/skins.cjs.map +1 -0
- package/dist/skins.d.cts +67 -0
- package/dist/skins.d.ts +67 -0
- package/dist/skins.js +3 -0
- package/dist/skins.js.map +1 -0
- package/dist/theme.cjs +106 -0
- package/dist/theme.cjs.map +1 -0
- package/dist/theme.d.cts +103 -0
- package/dist/theme.d.ts +103 -0
- package/dist/theme.js +3 -0
- package/dist/theme.js.map +1 -0
- package/dist/undo.cjs +51 -0
- package/dist/undo.cjs.map +1 -0
- package/dist/undo.d.cts +48 -0
- package/dist/undo.d.ts +48 -0
- package/dist/undo.js +3 -0
- package/dist/undo.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { PropType, VNode, Ref } from 'vue';
|
|
3
|
+
|
|
4
|
+
type IrisResizableHandle = 'top' | 'right' | 'bottom' | 'left' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
5
|
+
interface IrisResizableSize {
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Behavior wrapper: makes its child resizable via 8-direction handles. The
|
|
11
|
+
* wrapper itself is `display: inline-block; position: relative` so the child
|
|
12
|
+
* can be ANY element. Handles overlay the wrapper's edges.
|
|
13
|
+
*
|
|
14
|
+
* Composable with `IrisMovable`, `IrisHotkey`, `IrisClickOutside`.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* <IrisResizable :defaultSize="{ width: 400, height: 300 }">
|
|
18
|
+
* <IrisList :items="rows" />
|
|
19
|
+
* </IrisResizable>
|
|
20
|
+
*/
|
|
21
|
+
declare const IrisResizable: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
22
|
+
size: {
|
|
23
|
+
type: PropType<IrisResizableSize>;
|
|
24
|
+
default: undefined;
|
|
25
|
+
};
|
|
26
|
+
defaultSize: {
|
|
27
|
+
type: PropType<IrisResizableSize>;
|
|
28
|
+
default: () => {
|
|
29
|
+
width: number;
|
|
30
|
+
height: number;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
handles: {
|
|
34
|
+
type: PropType<IrisResizableHandle[]>;
|
|
35
|
+
default: () => IrisResizableHandle[];
|
|
36
|
+
};
|
|
37
|
+
minWidth: {
|
|
38
|
+
type: NumberConstructor;
|
|
39
|
+
default: number;
|
|
40
|
+
};
|
|
41
|
+
minHeight: {
|
|
42
|
+
type: NumberConstructor;
|
|
43
|
+
default: number;
|
|
44
|
+
};
|
|
45
|
+
maxWidth: {
|
|
46
|
+
type: NumberConstructor;
|
|
47
|
+
default: number;
|
|
48
|
+
};
|
|
49
|
+
maxHeight: {
|
|
50
|
+
type: NumberConstructor;
|
|
51
|
+
default: number;
|
|
52
|
+
};
|
|
53
|
+
keepAspect: {
|
|
54
|
+
type: BooleanConstructor;
|
|
55
|
+
default: boolean;
|
|
56
|
+
};
|
|
57
|
+
disabled: {
|
|
58
|
+
type: BooleanConstructor;
|
|
59
|
+
default: boolean;
|
|
60
|
+
};
|
|
61
|
+
}>, () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
62
|
+
[key: string]: any;
|
|
63
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
|
|
64
|
+
'update:size': (_v: IrisResizableSize) => true;
|
|
65
|
+
resizeStart: (_v: IrisResizableSize) => true;
|
|
66
|
+
resizeEnd: (_v: IrisResizableSize) => true;
|
|
67
|
+
}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
68
|
+
size: {
|
|
69
|
+
type: PropType<IrisResizableSize>;
|
|
70
|
+
default: undefined;
|
|
71
|
+
};
|
|
72
|
+
defaultSize: {
|
|
73
|
+
type: PropType<IrisResizableSize>;
|
|
74
|
+
default: () => {
|
|
75
|
+
width: number;
|
|
76
|
+
height: number;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
handles: {
|
|
80
|
+
type: PropType<IrisResizableHandle[]>;
|
|
81
|
+
default: () => IrisResizableHandle[];
|
|
82
|
+
};
|
|
83
|
+
minWidth: {
|
|
84
|
+
type: NumberConstructor;
|
|
85
|
+
default: number;
|
|
86
|
+
};
|
|
87
|
+
minHeight: {
|
|
88
|
+
type: NumberConstructor;
|
|
89
|
+
default: number;
|
|
90
|
+
};
|
|
91
|
+
maxWidth: {
|
|
92
|
+
type: NumberConstructor;
|
|
93
|
+
default: number;
|
|
94
|
+
};
|
|
95
|
+
maxHeight: {
|
|
96
|
+
type: NumberConstructor;
|
|
97
|
+
default: number;
|
|
98
|
+
};
|
|
99
|
+
keepAspect: {
|
|
100
|
+
type: BooleanConstructor;
|
|
101
|
+
default: boolean;
|
|
102
|
+
};
|
|
103
|
+
disabled: {
|
|
104
|
+
type: BooleanConstructor;
|
|
105
|
+
default: boolean;
|
|
106
|
+
};
|
|
107
|
+
}>> & Readonly<{
|
|
108
|
+
onResizeStart?: ((_v: IrisResizableSize) => any) | undefined;
|
|
109
|
+
onResizeEnd?: ((_v: IrisResizableSize) => any) | undefined;
|
|
110
|
+
"onUpdate:size"?: ((_v: IrisResizableSize) => any) | undefined;
|
|
111
|
+
}>, {
|
|
112
|
+
size: IrisResizableSize;
|
|
113
|
+
minWidth: number;
|
|
114
|
+
disabled: boolean;
|
|
115
|
+
maxHeight: number;
|
|
116
|
+
minHeight: number;
|
|
117
|
+
handles: IrisResizableHandle[];
|
|
118
|
+
maxWidth: number;
|
|
119
|
+
keepAspect: boolean;
|
|
120
|
+
defaultSize: IrisResizableSize;
|
|
121
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
122
|
+
|
|
123
|
+
interface IrisMovablePosition {
|
|
124
|
+
x: number;
|
|
125
|
+
y: number;
|
|
126
|
+
}
|
|
127
|
+
interface IrisMovableBounds {
|
|
128
|
+
minX?: number;
|
|
129
|
+
maxX?: number;
|
|
130
|
+
minY?: number;
|
|
131
|
+
maxY?: number;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Behavior wrapper: makes its child draggable via `transform`. The whole
|
|
135
|
+
* wrapper drags by default; pass `byHandle` + put `data-iris-movable-handle`
|
|
136
|
+
* on a descendant to restrict the drag origin.
|
|
137
|
+
*
|
|
138
|
+
* Renders `position: absolute` — wrap inside a `position: relative`
|
|
139
|
+
* container for predictable layout.
|
|
140
|
+
*/
|
|
141
|
+
declare const IrisMovable: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
142
|
+
position: {
|
|
143
|
+
type: PropType<IrisMovablePosition>;
|
|
144
|
+
default: undefined;
|
|
145
|
+
};
|
|
146
|
+
defaultPosition: {
|
|
147
|
+
type: PropType<IrisMovablePosition>;
|
|
148
|
+
default: () => {
|
|
149
|
+
x: number;
|
|
150
|
+
y: number;
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
bounds: {
|
|
154
|
+
type: PropType<IrisMovableBounds>;
|
|
155
|
+
default: () => {};
|
|
156
|
+
};
|
|
157
|
+
byHandle: {
|
|
158
|
+
type: BooleanConstructor;
|
|
159
|
+
default: boolean;
|
|
160
|
+
};
|
|
161
|
+
disabled: {
|
|
162
|
+
type: BooleanConstructor;
|
|
163
|
+
default: boolean;
|
|
164
|
+
};
|
|
165
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
166
|
+
[key: string]: any;
|
|
167
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
|
|
168
|
+
'update:position': (_v: IrisMovablePosition) => true;
|
|
169
|
+
dragStart: (_v: IrisMovablePosition) => true;
|
|
170
|
+
dragEnd: (_v: IrisMovablePosition) => true;
|
|
171
|
+
}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
172
|
+
position: {
|
|
173
|
+
type: PropType<IrisMovablePosition>;
|
|
174
|
+
default: undefined;
|
|
175
|
+
};
|
|
176
|
+
defaultPosition: {
|
|
177
|
+
type: PropType<IrisMovablePosition>;
|
|
178
|
+
default: () => {
|
|
179
|
+
x: number;
|
|
180
|
+
y: number;
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
bounds: {
|
|
184
|
+
type: PropType<IrisMovableBounds>;
|
|
185
|
+
default: () => {};
|
|
186
|
+
};
|
|
187
|
+
byHandle: {
|
|
188
|
+
type: BooleanConstructor;
|
|
189
|
+
default: boolean;
|
|
190
|
+
};
|
|
191
|
+
disabled: {
|
|
192
|
+
type: BooleanConstructor;
|
|
193
|
+
default: boolean;
|
|
194
|
+
};
|
|
195
|
+
}>> & Readonly<{
|
|
196
|
+
onDragStart?: ((_v: IrisMovablePosition) => any) | undefined;
|
|
197
|
+
onDragEnd?: ((_v: IrisMovablePosition) => any) | undefined;
|
|
198
|
+
"onUpdate:position"?: ((_v: IrisMovablePosition) => any) | undefined;
|
|
199
|
+
}>, {
|
|
200
|
+
disabled: boolean;
|
|
201
|
+
position: IrisMovablePosition;
|
|
202
|
+
bounds: IrisMovableBounds;
|
|
203
|
+
defaultPosition: IrisMovablePosition;
|
|
204
|
+
byHandle: boolean;
|
|
205
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Behavior wrapper: binds a global keyboard shortcut while children are
|
|
209
|
+
* mounted. Renderless — returns children verbatim via a Fragment.
|
|
210
|
+
*
|
|
211
|
+
* `shortcut` format: `'Escape'`, `'Mod+s'` (Mod = Ctrl on Win/Linux, Cmd on
|
|
212
|
+
* macOS), `'Shift+/'`. Accepts a single string or array of strings.
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* <IrisHotkey shortcut="Escape" @trigger="close">
|
|
216
|
+
* <IrisDialog>…</IrisDialog>
|
|
217
|
+
* </IrisHotkey>
|
|
218
|
+
*/
|
|
219
|
+
declare const IrisHotkey: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
220
|
+
shortcut: {
|
|
221
|
+
type: PropType<string | string[]>;
|
|
222
|
+
required: true;
|
|
223
|
+
};
|
|
224
|
+
disabled: {
|
|
225
|
+
type: BooleanConstructor;
|
|
226
|
+
default: boolean;
|
|
227
|
+
};
|
|
228
|
+
allowInInputs: {
|
|
229
|
+
type: BooleanConstructor;
|
|
230
|
+
default: boolean;
|
|
231
|
+
};
|
|
232
|
+
scope: {
|
|
233
|
+
type: PropType<"document" | "window">;
|
|
234
|
+
default: string;
|
|
235
|
+
};
|
|
236
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
237
|
+
[key: string]: any;
|
|
238
|
+
}>[] | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
|
|
239
|
+
trigger: (_event: KeyboardEvent) => true;
|
|
240
|
+
}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
241
|
+
shortcut: {
|
|
242
|
+
type: PropType<string | string[]>;
|
|
243
|
+
required: true;
|
|
244
|
+
};
|
|
245
|
+
disabled: {
|
|
246
|
+
type: BooleanConstructor;
|
|
247
|
+
default: boolean;
|
|
248
|
+
};
|
|
249
|
+
allowInInputs: {
|
|
250
|
+
type: BooleanConstructor;
|
|
251
|
+
default: boolean;
|
|
252
|
+
};
|
|
253
|
+
scope: {
|
|
254
|
+
type: PropType<"document" | "window">;
|
|
255
|
+
default: string;
|
|
256
|
+
};
|
|
257
|
+
}>> & Readonly<{
|
|
258
|
+
onTrigger?: ((_event: KeyboardEvent) => any) | undefined;
|
|
259
|
+
}>, {
|
|
260
|
+
disabled: boolean;
|
|
261
|
+
allowInInputs: boolean;
|
|
262
|
+
scope: "document" | "window";
|
|
263
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Behavior wrapper: fires `outside` when a `pointerdown` happens outside the
|
|
267
|
+
* wrapped child tree. Wraps children in a `<span style="display:contents">`
|
|
268
|
+
* to capture the bounding box without affecting layout.
|
|
269
|
+
*
|
|
270
|
+
* Pass `ignore` (refs to additional "inside" elements) for trigger buttons
|
|
271
|
+
* that live outside the wrapper but should still count as inside.
|
|
272
|
+
*/
|
|
273
|
+
declare const IrisClickOutside: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
274
|
+
disabled: {
|
|
275
|
+
type: BooleanConstructor;
|
|
276
|
+
default: boolean;
|
|
277
|
+
};
|
|
278
|
+
ignore: {
|
|
279
|
+
type: PropType<Ref<HTMLElement | null | undefined>[]>;
|
|
280
|
+
default: () => never[];
|
|
281
|
+
};
|
|
282
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
283
|
+
[key: string]: any;
|
|
284
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
|
|
285
|
+
outside: (_event: PointerEvent) => true;
|
|
286
|
+
}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
287
|
+
disabled: {
|
|
288
|
+
type: BooleanConstructor;
|
|
289
|
+
default: boolean;
|
|
290
|
+
};
|
|
291
|
+
ignore: {
|
|
292
|
+
type: PropType<Ref<HTMLElement | null | undefined>[]>;
|
|
293
|
+
default: () => never[];
|
|
294
|
+
};
|
|
295
|
+
}>> & Readonly<{
|
|
296
|
+
onOutside?: ((_event: PointerEvent) => any) | undefined;
|
|
297
|
+
}>, {
|
|
298
|
+
disabled: boolean;
|
|
299
|
+
ignore: Ref<HTMLElement | null | undefined, HTMLElement | null | undefined>[];
|
|
300
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
301
|
+
|
|
302
|
+
/** The data attribute on each sortable item for the collision system. */
|
|
303
|
+
declare const SORTABLE_ITEM_ATTR = "data-iris-sortable-item";
|
|
304
|
+
/**
|
|
305
|
+
* Behavior wrapper: makes a list of items sortable via drag-and-drop. Wraps
|
|
306
|
+
* each direct child in a sortable item context. The consumer supplies the
|
|
307
|
+
* `items` array and an `onReorder` callback. Items render through the default
|
|
308
|
+
* slot; each item is wrapped with drag detection from `createSortable`.
|
|
309
|
+
*
|
|
310
|
+
* Composable: stack with `IrisResizable` / `IrisMovable` / `IrisHotkey` for
|
|
311
|
+
* richer interactions on the same wrapped UI.
|
|
312
|
+
*
|
|
313
|
+
* @example
|
|
314
|
+
* <IrisSortable :items="items" @reorder="items = $event">
|
|
315
|
+
* <div v-for="(label, i) in items" :key="i">{{ label }}</div>
|
|
316
|
+
* </IrisSortable>
|
|
317
|
+
*/
|
|
318
|
+
declare const IrisSortable: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
319
|
+
/** The ordered items. Used to detect which item is at which position. */
|
|
320
|
+
items: {
|
|
321
|
+
type: PropType<readonly unknown[]>;
|
|
322
|
+
required: true;
|
|
323
|
+
};
|
|
324
|
+
/** Called when the user drops an item in a new position. */
|
|
325
|
+
onReorder: {
|
|
326
|
+
type: PropType<(next: unknown[]) => void>;
|
|
327
|
+
default: undefined;
|
|
328
|
+
};
|
|
329
|
+
/** Optional item key getter. Defaults to `String(index)`. */
|
|
330
|
+
getKey: {
|
|
331
|
+
type: PropType<(item: unknown, index: number) => string>;
|
|
332
|
+
default: undefined;
|
|
333
|
+
};
|
|
334
|
+
disabled: {
|
|
335
|
+
type: BooleanConstructor;
|
|
336
|
+
default: boolean;
|
|
337
|
+
};
|
|
338
|
+
class: {
|
|
339
|
+
type: StringConstructor;
|
|
340
|
+
default: undefined;
|
|
341
|
+
};
|
|
342
|
+
style: {
|
|
343
|
+
type: PropType<Record<string, string | number>>;
|
|
344
|
+
default: undefined;
|
|
345
|
+
};
|
|
346
|
+
}>, () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
347
|
+
[key: string]: any;
|
|
348
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
|
|
349
|
+
reorder: (_next: unknown[]) => true;
|
|
350
|
+
}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
351
|
+
/** The ordered items. Used to detect which item is at which position. */
|
|
352
|
+
items: {
|
|
353
|
+
type: PropType<readonly unknown[]>;
|
|
354
|
+
required: true;
|
|
355
|
+
};
|
|
356
|
+
/** Called when the user drops an item in a new position. */
|
|
357
|
+
onReorder: {
|
|
358
|
+
type: PropType<(next: unknown[]) => void>;
|
|
359
|
+
default: undefined;
|
|
360
|
+
};
|
|
361
|
+
/** Optional item key getter. Defaults to `String(index)`. */
|
|
362
|
+
getKey: {
|
|
363
|
+
type: PropType<(item: unknown, index: number) => string>;
|
|
364
|
+
default: undefined;
|
|
365
|
+
};
|
|
366
|
+
disabled: {
|
|
367
|
+
type: BooleanConstructor;
|
|
368
|
+
default: boolean;
|
|
369
|
+
};
|
|
370
|
+
class: {
|
|
371
|
+
type: StringConstructor;
|
|
372
|
+
default: undefined;
|
|
373
|
+
};
|
|
374
|
+
style: {
|
|
375
|
+
type: PropType<Record<string, string | number>>;
|
|
376
|
+
default: undefined;
|
|
377
|
+
};
|
|
378
|
+
}>> & Readonly<{
|
|
379
|
+
onReorder?: ((_next: unknown[]) => any) | undefined;
|
|
380
|
+
}>, {
|
|
381
|
+
style: Record<string, string | number>;
|
|
382
|
+
disabled: boolean;
|
|
383
|
+
class: string;
|
|
384
|
+
onReorder: (next: unknown[]) => void;
|
|
385
|
+
getKey: (item: unknown, index: number) => string;
|
|
386
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Behavior wrapper: fires `onLongPress` once the pointer has been held down
|
|
390
|
+
* for `holdDelay` ms without an intervening pointerup/pointerleave. Wraps
|
|
391
|
+
* children in a `<span data-iris-long-press style="display:contents">` so it
|
|
392
|
+
* doesn't affect layout. Backed by `createLongPress`'s statechart timer.
|
|
393
|
+
*
|
|
394
|
+
* @example
|
|
395
|
+
* <IrisLongPress :hold-delay="500" @longpress="onLongPress">
|
|
396
|
+
* <IrisButton>Hold me</IrisButton>
|
|
397
|
+
* </IrisLongPress>
|
|
398
|
+
*/
|
|
399
|
+
declare const IrisLongPress: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
400
|
+
/** Time the pointer must be held before `onLongPress` fires, in ms. */
|
|
401
|
+
holdDelay: {
|
|
402
|
+
type: NumberConstructor;
|
|
403
|
+
default: number;
|
|
404
|
+
};
|
|
405
|
+
/** Called once when the hold reaches `holdDelay` without an intervening release. */
|
|
406
|
+
onLongPress: {
|
|
407
|
+
type: PropType<() => void>;
|
|
408
|
+
default: undefined;
|
|
409
|
+
};
|
|
410
|
+
disabled: {
|
|
411
|
+
type: BooleanConstructor;
|
|
412
|
+
default: boolean;
|
|
413
|
+
};
|
|
414
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
415
|
+
[key: string]: any;
|
|
416
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
|
|
417
|
+
longpress: () => true;
|
|
418
|
+
}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
419
|
+
/** Time the pointer must be held before `onLongPress` fires, in ms. */
|
|
420
|
+
holdDelay: {
|
|
421
|
+
type: NumberConstructor;
|
|
422
|
+
default: number;
|
|
423
|
+
};
|
|
424
|
+
/** Called once when the hold reaches `holdDelay` without an intervening release. */
|
|
425
|
+
onLongPress: {
|
|
426
|
+
type: PropType<() => void>;
|
|
427
|
+
default: undefined;
|
|
428
|
+
};
|
|
429
|
+
disabled: {
|
|
430
|
+
type: BooleanConstructor;
|
|
431
|
+
default: boolean;
|
|
432
|
+
};
|
|
433
|
+
}>> & Readonly<{
|
|
434
|
+
onLongpress?: (() => any) | undefined;
|
|
435
|
+
}>, {
|
|
436
|
+
disabled: boolean;
|
|
437
|
+
holdDelay: number;
|
|
438
|
+
onLongPress: () => void;
|
|
439
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
440
|
+
|
|
441
|
+
export { IrisClickOutside, IrisHotkey, IrisLongPress, IrisMovable, type IrisMovableBounds, type IrisMovablePosition, IrisResizable, type IrisResizableHandle, type IrisResizableSize, IrisSortable, SORTABLE_ITEM_ATTR };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"behaviors.js"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { ref, shallowRef, watch, onScopeDispose, computed } from 'vue';
|
|
2
|
+
import { offset, flip, shift, size, arrow, autoUpdate, computePosition } from '@floating-ui/dom';
|
|
3
|
+
|
|
4
|
+
// src/primitives/floating/useFloating.ts
|
|
5
|
+
function useFloating(options) {
|
|
6
|
+
const x = ref(0);
|
|
7
|
+
const y = ref(0);
|
|
8
|
+
const strategy = ref(options.strategy ?? "absolute");
|
|
9
|
+
const finalPlacement = ref(options.placement ?? "bottom");
|
|
10
|
+
const arrowX = ref();
|
|
11
|
+
const arrowY = ref();
|
|
12
|
+
const middleware = shallowRef([]);
|
|
13
|
+
rebuildMiddleware();
|
|
14
|
+
function rebuildMiddleware() {
|
|
15
|
+
const mw = [];
|
|
16
|
+
if (options.offset !== void 0) mw.push(offset(options.offset));
|
|
17
|
+
if (options.flip !== false) mw.push(flip());
|
|
18
|
+
if (options.shift !== false) mw.push(shift({ padding: 8 }));
|
|
19
|
+
if (options.size) {
|
|
20
|
+
const padding = typeof options.size === "number" ? options.size : 8;
|
|
21
|
+
mw.push(
|
|
22
|
+
size({
|
|
23
|
+
padding,
|
|
24
|
+
apply({ availableWidth, availableHeight, elements }) {
|
|
25
|
+
Object.assign(elements.floating.style, {
|
|
26
|
+
maxWidth: `${Math.max(0, Math.floor(availableWidth))}px`,
|
|
27
|
+
maxHeight: `${Math.max(0, Math.floor(availableHeight))}px`
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
if (options.arrow?.value) mw.push(arrow({ element: options.arrow.value }));
|
|
34
|
+
if (options.middleware) mw.push(...options.middleware);
|
|
35
|
+
middleware.value = mw;
|
|
36
|
+
}
|
|
37
|
+
let cleanupAutoUpdate = null;
|
|
38
|
+
let epoch = 0;
|
|
39
|
+
async function update() {
|
|
40
|
+
const a = options.anchor.value;
|
|
41
|
+
const f = options.floating.value;
|
|
42
|
+
if (!a || !f) return;
|
|
43
|
+
rebuildMiddleware();
|
|
44
|
+
const token = ++epoch;
|
|
45
|
+
const result = await computePosition(a, f, {
|
|
46
|
+
placement: options.placement ?? "bottom",
|
|
47
|
+
strategy: strategy.value,
|
|
48
|
+
middleware: middleware.value
|
|
49
|
+
});
|
|
50
|
+
if (token !== epoch) return;
|
|
51
|
+
x.value = result.x;
|
|
52
|
+
y.value = result.y;
|
|
53
|
+
finalPlacement.value = result.placement;
|
|
54
|
+
const arrowData = result.middlewareData.arrow;
|
|
55
|
+
arrowX.value = arrowData?.x;
|
|
56
|
+
arrowY.value = arrowData?.y;
|
|
57
|
+
}
|
|
58
|
+
watch(
|
|
59
|
+
[options.open, options.anchor, options.floating],
|
|
60
|
+
([isOpen, anchorEl, floatingEl]) => {
|
|
61
|
+
cleanupAutoUpdate?.();
|
|
62
|
+
cleanupAutoUpdate = null;
|
|
63
|
+
epoch++;
|
|
64
|
+
if (isOpen && anchorEl && floatingEl) {
|
|
65
|
+
cleanupAutoUpdate = autoUpdate(anchorEl, floatingEl, () => {
|
|
66
|
+
void update();
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{ flush: "post", immediate: true }
|
|
71
|
+
);
|
|
72
|
+
onScopeDispose(() => {
|
|
73
|
+
cleanupAutoUpdate?.();
|
|
74
|
+
cleanupAutoUpdate = null;
|
|
75
|
+
epoch++;
|
|
76
|
+
});
|
|
77
|
+
const OPPOSITE = {
|
|
78
|
+
top: "bottom",
|
|
79
|
+
bottom: "top",
|
|
80
|
+
left: "right",
|
|
81
|
+
right: "left"
|
|
82
|
+
};
|
|
83
|
+
const arrowSide = computed(
|
|
84
|
+
() => OPPOSITE[finalPlacement.value.split("-")[0]]
|
|
85
|
+
);
|
|
86
|
+
const floatingStyles = computed(() => ({
|
|
87
|
+
position: strategy.value,
|
|
88
|
+
top: "0",
|
|
89
|
+
left: "0",
|
|
90
|
+
transform: `translate3d(${Math.round(x.value)}px, ${Math.round(y.value)}px, 0)`,
|
|
91
|
+
width: "max-content"
|
|
92
|
+
}));
|
|
93
|
+
return { x, y, strategy, finalPlacement, floatingStyles, update, arrowX, arrowY, arrowSide };
|
|
94
|
+
}
|
|
95
|
+
function useDismiss(options) {
|
|
96
|
+
const escape = options.escape !== false;
|
|
97
|
+
const outsidePointerDown = options.outsidePointerDown !== false;
|
|
98
|
+
const isExcluded = (target) => {
|
|
99
|
+
if (!target || !(target instanceof Node)) return false;
|
|
100
|
+
for (const r of options.exclude) {
|
|
101
|
+
const el = r.value;
|
|
102
|
+
if (!el) continue;
|
|
103
|
+
if (el === target || el.contains(target)) return true;
|
|
104
|
+
}
|
|
105
|
+
return false;
|
|
106
|
+
};
|
|
107
|
+
const onPointerDown = (event) => {
|
|
108
|
+
if (!options.enabled.value) return;
|
|
109
|
+
if (isExcluded(event.target)) return;
|
|
110
|
+
options.onDismiss();
|
|
111
|
+
};
|
|
112
|
+
const onKeyDown = (event) => {
|
|
113
|
+
if (!options.enabled.value) return;
|
|
114
|
+
if (event.key === "Escape") {
|
|
115
|
+
event.stopPropagation();
|
|
116
|
+
options.onDismiss();
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
const attach = () => {
|
|
120
|
+
if (typeof document === "undefined") return;
|
|
121
|
+
if (outsidePointerDown) {
|
|
122
|
+
document.addEventListener("pointerdown", onPointerDown, true);
|
|
123
|
+
}
|
|
124
|
+
if (escape) {
|
|
125
|
+
document.addEventListener("keydown", onKeyDown);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const detach = () => {
|
|
129
|
+
if (typeof document === "undefined") return;
|
|
130
|
+
document.removeEventListener("pointerdown", onPointerDown, true);
|
|
131
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
132
|
+
};
|
|
133
|
+
watch(
|
|
134
|
+
options.enabled,
|
|
135
|
+
(enabled) => {
|
|
136
|
+
detach();
|
|
137
|
+
if (enabled) attach();
|
|
138
|
+
},
|
|
139
|
+
{ immediate: true, flush: "post" }
|
|
140
|
+
);
|
|
141
|
+
onScopeDispose(detach);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export { useDismiss, useFloating };
|
|
145
|
+
//# sourceMappingURL=chunk-3FJUCHCC.js.map
|
|
146
|
+
//# sourceMappingURL=chunk-3FJUCHCC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/primitives/floating/useFloating.ts","../src/primitives/floating/useDismiss.ts"],"names":["offsetMiddleware","flipMiddleware","shiftMiddleware","sizeMiddleware","arrowMiddleware","watch","onScopeDispose"],"mappings":";;;;AA6FO,SAAS,YAAY,OAAA,EAAgD;AAC1E,EAAA,MAAM,CAAA,GAAI,IAAI,CAAC,CAAA;AACf,EAAA,MAAM,CAAA,GAAI,IAAI,CAAC,CAAA;AACf,EAAA,MAAM,QAAA,GAAW,GAAA,CAAc,OAAA,CAAQ,QAAA,IAAY,UAAU,CAAA;AAC7D,EAAA,MAAM,cAAA,GAAiB,GAAA,CAAe,OAAA,CAAQ,SAAA,IAAa,QAAQ,CAAA;AACnE,EAAA,MAAM,SAAS,GAAA,EAAwB;AACvC,EAAA,MAAM,SAAS,GAAA,EAAwB;AAEvC,EAAA,MAAM,UAAA,GAAa,UAAA,CAAyB,EAAE,CAAA;AAC9C,EAAA,iBAAA,EAAkB;AAElB,EAAA,SAAS,iBAAA,GAAoB;AAC3B,IAAA,MAAM,KAAmB,EAAC;AAC1B,IAAA,IAAI,OAAA,CAAQ,WAAW,MAAA,EAAW,EAAA,CAAG,KAAKA,MAAA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AAI,OAAO,aAAa,WAAA,EAAa;AACrC,IAAA,QAAA,CAAS,mBAAA,CAAoB,aAAA,EAAe,aAAA,EAAe,IAAI,CAAA;AAC/D,IAAA,QAAA,CAAS,mBAAA,CAAoB,WAAW,SAAS,CAAA;AAAA,EACnD,CAAA;AAEA,EAAAC,KAAAA;AAAA,IACE,OAAA,CAAQ,OAAA;AAAA,IACR,CAAC,OAAA,KAAY;AACX,MAAA,MAAA,EAAO;AACP,MAAA,IAAI,SAAS,MAAA,EAAO;AAAA,IACtB,CAAA;AAAA,IACA,EAAE,SAAA,EAAW,IAAA,EAAM,KAAA,EAAO,MAAA;AAAO,GACnC;AAEA,EAAAC,eAAe,MAAM,CAAA;AACvB","file":"chunk-3FJUCHCC.js","sourcesContent":["import { computed, onScopeDispose, ref, shallowRef, watch, type ComputedRef, type Ref } from 'vue'\nimport {\n autoUpdate,\n computePosition,\n arrow as arrowMiddleware,\n flip as flipMiddleware,\n offset as offsetMiddleware,\n shift as shiftMiddleware,\n size as sizeMiddleware,\n type Middleware,\n type Placement,\n type Strategy,\n} from '@floating-ui/dom'\n\nexport interface UseFloatingOptions {\n /** Element the floating panel is positioned relative to. */\n anchor: Ref<HTMLElement | null | undefined>\n /** The floating element itself. */\n floating: Ref<HTMLElement | null | undefined>\n /** Whether the floating element is visible. Controls `autoUpdate` lifecycle. */\n open: Ref<boolean>\n /** Default placement. Floating UI may flip it if `flip` is true. */\n placement?: Placement\n /** CSS position strategy. */\n strategy?: Strategy\n /** Pixel offset between anchor and floating element. */\n offset?: number\n /** Flip to the opposite side when the requested side overflows. Default `true`. */\n flip?: boolean\n /** Shift along the cross-axis to stay in view. Default `true`. */\n shift?: boolean\n /**\n * Constrain the floating element to the available viewport space — sets\n * `maxWidth`/`maxHeight` (minus 8px padding) on it so a long dropdown/popover\n * never overflows the screen (pair with `overflow:auto` for scroll). Off by\n * default. Pass a number to override the viewport padding.\n */\n size?: boolean | number\n /** Extra Floating UI middleware to append. */\n middleware?: Middleware[]\n /**\n * Optional ref to an arrow element inside the floating panel. When provided,\n * `arrowX`, `arrowY`, and `arrowSide` in the return value are populated.\n */\n arrow?: Ref<HTMLElement | null | undefined>\n}\n\nexport interface UseFloatingReturn {\n /** Computed x coordinate (px). */\n x: Ref<number>\n /** Computed y coordinate (px). */\n y: Ref<number>\n /** Final strategy (echo of input). */\n strategy: Ref<Strategy>\n /** Final placement, possibly flipped from the input placement. */\n finalPlacement: Ref<Placement>\n /** Ready-to-bind inline style object for the floating element. */\n floatingStyles: ComputedRef<Record<string, string>>\n /** Trigger a manual recompute. Usually not needed — `autoUpdate` handles scrolling/resizing. */\n update: () => Promise<void>\n /** Arrow x offset (px). Present when `arrow` option is set. */\n arrowX: Ref<number | undefined>\n /** Arrow y offset (px). Present when `arrow` option is set. */\n arrowY: Ref<number | undefined>\n /**\n * Side of the floating element the arrow is on.\n * E.g. `'bottom'` placement → `'top'` (arrow at top pointing up).\n */\n arrowSide: ComputedRef<'top' | 'right' | 'bottom' | 'left' | undefined>\n}\n\n/**\n * Reactive Floating UI integration. Subscribes `autoUpdate` whenever\n * `open === true` and both refs are populated; tears it down on close,\n * unmount, or ref clearing. Returns `floatingStyles` ready to be spread onto\n * the floating element.\n *\n * Pure positioning — does NOT render anything, does NOT manage focus,\n * does NOT handle dismiss behavior. Those concerns live in the consuming\n * primitive (Popover, Tooltip, Dialog, Menu, ...).\n *\n * @example\n * const triggerEl = ref<HTMLElement | null>(null)\n * const contentEl = ref<HTMLElement | null>(null)\n * const open = ref(false)\n * const { floatingStyles } = useFloating({\n * anchor: triggerEl,\n * floating: contentEl,\n * open,\n * placement: 'bottom-start',\n * offset: 8,\n * })\n */\nexport function useFloating(options: UseFloatingOptions): UseFloatingReturn {\n const x = ref(0)\n const y = ref(0)\n const strategy = ref<Strategy>(options.strategy ?? 'absolute')\n const finalPlacement = ref<Placement>(options.placement ?? 'bottom')\n const arrowX = ref<number | undefined>()\n const arrowY = ref<number | undefined>()\n\n const middleware = shallowRef<Middleware[]>([])\n rebuildMiddleware()\n\n function rebuildMiddleware() {\n const mw: Middleware[] = []\n if (options.offset !== undefined) mw.push(offsetMiddleware(options.offset))\n if (options.flip !== false) mw.push(flipMiddleware())\n if (options.shift !== false) mw.push(shiftMiddleware({ padding: 8 }))\n if (options.size) {\n const padding = typeof options.size === 'number' ? options.size : 8\n mw.push(\n sizeMiddleware({\n padding,\n apply({ availableWidth, availableHeight, elements }) {\n Object.assign(elements.floating.style, {\n maxWidth: `${Math.max(0, Math.floor(availableWidth))}px`,\n maxHeight: `${Math.max(0, Math.floor(availableHeight))}px`,\n })\n },\n }),\n )\n }\n if (options.arrow?.value) mw.push(arrowMiddleware({ element: options.arrow.value }))\n if (options.middleware) mw.push(...options.middleware)\n middleware.value = mw\n }\n\n let cleanupAutoUpdate: (() => void) | null = null\n // Monotonic token bumped on every new positioning cycle and on teardown, so a\n // computePosition() that resolves after the panel closed/re-opened (or after a\n // newer update started) drops its result instead of applying stale coords.\n let epoch = 0\n\n async function update() {\n const a = options.anchor.value\n const f = options.floating.value\n if (!a || !f) return\n rebuildMiddleware()\n const token = ++epoch\n const result = await computePosition(a, f, {\n placement: options.placement ?? 'bottom',\n strategy: strategy.value,\n middleware: middleware.value,\n })\n if (token !== epoch) return\n x.value = result.x\n y.value = result.y\n finalPlacement.value = result.placement\n const arrowData = result.middlewareData.arrow as { x?: number; y?: number } | undefined\n arrowX.value = arrowData?.x\n arrowY.value = arrowData?.y\n }\n\n watch(\n [options.open, options.anchor, options.floating],\n ([isOpen, anchorEl, floatingEl]) => {\n cleanupAutoUpdate?.()\n cleanupAutoUpdate = null\n epoch++\n if (isOpen && anchorEl && floatingEl) {\n cleanupAutoUpdate = autoUpdate(anchorEl, floatingEl, () => {\n void update()\n })\n }\n },\n { flush: 'post', immediate: true },\n )\n\n onScopeDispose(() => {\n cleanupAutoUpdate?.()\n cleanupAutoUpdate = null\n epoch++\n })\n\n const OPPOSITE: Record<string, 'top' | 'right' | 'bottom' | 'left'> = {\n top: 'bottom',\n bottom: 'top',\n left: 'right',\n right: 'left',\n }\n const arrowSide = computed(\n () =>\n OPPOSITE[finalPlacement.value.split('-')[0]] as\n | 'top'\n | 'right'\n | 'bottom'\n | 'left'\n | undefined,\n )\n\n const floatingStyles = computed<Record<string, string>>(() => ({\n position: strategy.value,\n top: '0',\n left: '0',\n transform: `translate3d(${Math.round(x.value)}px, ${Math.round(y.value)}px, 0)`,\n width: 'max-content',\n }))\n\n return { x, y, strategy, finalPlacement, floatingStyles, update, arrowX, arrowY, arrowSide }\n}\n","import { onScopeDispose, watch, type Ref } from 'vue'\n\nexport interface UseDismissOptions {\n /** While true, the dismiss listeners are active. */\n enabled: Ref<boolean>\n /** Elements that, if clicked, should NOT trigger dismiss (typically trigger + content). */\n exclude: Array<Ref<HTMLElement | null | undefined>>\n /** Called when the user attempts to dismiss the surface. */\n onDismiss: () => void\n /** Close on Escape key. Default `true`. */\n escape?: boolean\n /** Close on pointerdown outside the excluded elements. Default `true`. */\n outsidePointerDown?: boolean\n}\n\n/**\n * Listen for the universal \"dismiss\" gestures: Escape key and outside\n * pointer-down. Used by Popover / Dialog / Menu / Combobox. Tooltip does\n * NOT use this — it dismisses on mouseleave/blur instead.\n *\n * Listeners are attached to `document` only while `enabled` is true, and\n * removed on disable / unmount. SSR-safe (no-op without `document`).\n */\nexport function useDismiss(options: UseDismissOptions): void {\n const escape = options.escape !== false\n const outsidePointerDown = options.outsidePointerDown !== false\n\n const isExcluded = (target: EventTarget | null): boolean => {\n if (!target || !(target instanceof Node)) return false\n for (const r of options.exclude) {\n const el = r.value\n if (!el) continue\n if (el === target || el.contains(target)) return true\n }\n return false\n }\n\n const onPointerDown = (event: PointerEvent) => {\n if (!options.enabled.value) return\n if (isExcluded(event.target)) return\n options.onDismiss()\n }\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (!options.enabled.value) return\n if (event.key === 'Escape') {\n event.stopPropagation()\n options.onDismiss()\n }\n }\n\n const attach = () => {\n if (typeof document === 'undefined') return\n if (outsidePointerDown) {\n document.addEventListener('pointerdown', onPointerDown, true)\n }\n if (escape) {\n document.addEventListener('keydown', onKeyDown)\n }\n }\n\n const detach = () => {\n if (typeof document === 'undefined') return\n document.removeEventListener('pointerdown', onPointerDown, true)\n document.removeEventListener('keydown', onKeyDown)\n }\n\n watch(\n options.enabled,\n (enabled) => {\n detach()\n if (enabled) attach()\n },\n { immediate: true, flush: 'post' },\n )\n\n onScopeDispose(detach)\n}\n"]}
|