v-float 0.7.2 → 0.8.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 +20 -20
- package/README.md +223 -204
- package/dist/composables/index.d.ts +1 -3
- package/dist/composables/index.d.ts.map +1 -1
- package/dist/composables/interactions/index.d.ts +0 -2
- package/dist/composables/interactions/index.d.ts.map +1 -1
- package/dist/composables/interactions/polygon.d.ts +2 -2
- package/dist/composables/interactions/polygon.d.ts.map +1 -1
- package/dist/composables/interactions/use-click.d.ts +2 -2
- package/dist/composables/interactions/use-click.d.ts.map +1 -1
- package/dist/composables/interactions/use-escape-key.d.ts +2 -2
- package/dist/composables/interactions/use-escape-key.d.ts.map +1 -1
- package/dist/composables/interactions/use-focus.d.ts +30 -25
- package/dist/composables/interactions/use-focus.d.ts.map +1 -1
- package/dist/composables/interactions/use-hover.d.ts +2 -2
- package/dist/composables/interactions/use-hover.d.ts.map +1 -1
- package/dist/composables/middlewares/arrow.d.ts +1 -2
- package/dist/composables/middlewares/arrow.d.ts.map +1 -1
- package/dist/composables/middlewares/index.d.ts +2 -1
- package/dist/composables/middlewares/index.d.ts.map +1 -1
- package/dist/composables/positioning/index.d.ts +5 -0
- package/dist/composables/positioning/index.d.ts.map +1 -0
- package/dist/composables/positioning/use-arrow.d.ts.map +1 -0
- package/dist/composables/{interactions → positioning}/use-client-point.d.ts +2 -2
- package/dist/composables/positioning/use-client-point.d.ts.map +1 -0
- package/dist/composables/{use-floating-tree.d.ts → positioning/use-floating-tree.d.ts} +134 -11
- package/dist/composables/positioning/use-floating-tree.d.ts.map +1 -0
- package/dist/composables/{use-floating.d.ts → positioning/use-floating.d.ts} +21 -6
- package/dist/composables/positioning/use-floating.d.ts.map +1 -0
- package/dist/types.d.ts +15 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +84 -7
- package/dist/utils.d.ts.map +1 -1
- package/dist/v-float.es.js +1732 -1620
- package/dist/v-float.umd.js +1 -1
- package/package.json +73 -76
- package/dist/composables/interactions/use-client-point.d.ts.map +0 -1
- package/dist/composables/interactions/utils/browser-detection.d.ts +0 -23
- package/dist/composables/interactions/utils/browser-detection.d.ts.map +0 -1
- package/dist/composables/interactions/utils/element-detection.d.ts +0 -53
- package/dist/composables/interactions/utils/element-detection.d.ts.map +0 -1
- package/dist/composables/interactions/utils/event-utils.d.ts +0 -30
- package/dist/composables/interactions/utils/event-utils.d.ts.map +0 -1
- package/dist/composables/interactions/utils/index.d.ts +0 -11
- package/dist/composables/interactions/utils/index.d.ts.map +0 -1
- package/dist/composables/interactions/utils/tree-context.d.ts +0 -32
- package/dist/composables/interactions/utils/tree-context.d.ts.map +0 -1
- package/dist/composables/use-arrow.d.ts.map +0 -1
- package/dist/composables/use-floating-tree.d.ts.map +0 -1
- package/dist/composables/use-floating.d.ts.map +0 -1
- /package/dist/composables/{use-arrow.d.ts → positioning/use-arrow.d.ts} +0 -0
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 V-Float
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 V-Float
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
# V-Float
|
|
1
|
+
# V-Float
|
|
2
|
+
|
|
3
|
+
[](#project-status)
|
|
4
|
+
|
|
5
|
+
> Work in progress: This library is under active development. APIs may change without notice and breaking changes can land without deprecation windows or warnings. Not recommended for production use yet.
|
|
2
6
|
|
|
3
7
|
A Vue 3 library for positioning floating UI elements like tooltips, popovers, dropdowns, and modals. Built on top
|
|
4
8
|
of [VFloat](https://vfloat.pages.com/) with Vue 3 Composition API.
|
|
@@ -9,7 +13,7 @@ of [VFloat](https://vfloat.pages.com/) with Vue 3 Composition API.
|
|
|
9
13
|
- **Vue 3 Composables**: Reactive composables designed for the Composition API
|
|
10
14
|
- **Interaction Handling**: Built-in hover, focus, click, and dismiss behaviors
|
|
11
15
|
- **Nested Elements**: Support for floating element trees and hierarchies
|
|
12
|
-
- **
|
|
16
|
+
- **Arrow Positioning**: `useArrow` composable for positioning arrow elements
|
|
13
17
|
- **Lightweight**: Tree-shakable with minimal bundle impact
|
|
14
18
|
- **Cross-platform**: Works on desktop, mobile, and touch devices
|
|
15
19
|
- **TypeScript**: Full TypeScript support with comprehensive type definitions
|
|
@@ -123,205 +127,220 @@ const { arrowStyles } = useArrow(arrowEl, context, {
|
|
|
123
127
|
>
|
|
124
128
|
This is a tooltip with an arrow
|
|
125
129
|
<div ref="arrowEl" class="arrow" :style="arrowStyles"></div>
|
|
126
|
-
</div>
|
|
127
|
-
</template>
|
|
128
|
-
|
|
129
|
-
<style scoped>
|
|
130
|
-
.tooltip {
|
|
131
|
-
background: white;
|
|
132
|
-
border: 1px solid #ddd;
|
|
133
|
-
border-radius: 4px;
|
|
134
|
-
padding: 8px 12px;
|
|
135
|
-
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.arrow {
|
|
139
|
-
position: absolute;
|
|
140
|
-
width: 8px;
|
|
141
|
-
height: 8px;
|
|
142
|
-
background: white;
|
|
143
|
-
border: 1px solid #ddd;
|
|
144
|
-
transform: rotate(45deg);
|
|
145
|
-
z-index: -1;
|
|
146
|
-
}
|
|
147
|
-
</style>
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
## Core Composables
|
|
151
|
-
|
|
152
|
-
### Positioning
|
|
153
|
-
|
|
154
|
-
- **`useFloating`**: Core positioning logic with middleware support
|
|
155
|
-
- **`useArrow`**: Position arrow elements pointing to the anchor
|
|
156
|
-
- **`useFloatingTree`**: Manage nested floating element hierarchies
|
|
157
|
-
|
|
158
|
-
### Interactions
|
|
159
|
-
|
|
160
|
-
- **`useHover`**: Hover interactions with configurable delays
|
|
161
|
-
- **`useFocus`**: Focus/blur event handling for keyboard navigation
|
|
162
|
-
- **`useClick`**: Click event handling with toggle and dismiss options
|
|
163
|
-
- **`useEscapeKey`**: Close on ESC key press with composition handling
|
|
164
|
-
- **`useClientPoint`**: Position floating elements at cursor/touch coordinates
|
|
165
|
-
|
|
166
|
-
### Middleware
|
|
167
|
-
|
|
168
|
-
All [Floating UI middleware](https://floating-ui.com/docs/middleware) are supported:
|
|
169
|
-
|
|
170
|
-
- **`offset`**: Add distance between anchor and floating element
|
|
171
|
-
- **`flip`**: Flip placement when there's insufficient space
|
|
172
|
-
- **`shift`**: Shift floating element to stay in view
|
|
173
|
-
- **`hide`**: Hide floating element when anchor is not visible
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
})
|
|
217
|
-
|
|
218
|
-
//
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
</
|
|
254
|
-
|
|
255
|
-
<
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
130
|
+
</div>
|
|
131
|
+
</template>
|
|
132
|
+
|
|
133
|
+
<style scoped>
|
|
134
|
+
.tooltip {
|
|
135
|
+
background: white;
|
|
136
|
+
border: 1px solid #ddd;
|
|
137
|
+
border-radius: 4px;
|
|
138
|
+
padding: 8px 12px;
|
|
139
|
+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.arrow {
|
|
143
|
+
position: absolute;
|
|
144
|
+
width: 8px;
|
|
145
|
+
height: 8px;
|
|
146
|
+
background: white;
|
|
147
|
+
border: 1px solid #ddd;
|
|
148
|
+
transform: rotate(45deg);
|
|
149
|
+
z-index: -1;
|
|
150
|
+
}
|
|
151
|
+
</style>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Core Composables
|
|
155
|
+
|
|
156
|
+
### Positioning
|
|
157
|
+
|
|
158
|
+
- **`useFloating`**: Core positioning logic with middleware support
|
|
159
|
+
- **`useArrow`**: Position arrow elements pointing to the anchor
|
|
160
|
+
- **`useFloatingTree`**: Manage nested floating element hierarchies
|
|
161
|
+
|
|
162
|
+
### Interactions
|
|
163
|
+
|
|
164
|
+
- **`useHover`**: Hover interactions with configurable delays
|
|
165
|
+
- **`useFocus`**: Focus/blur event handling for keyboard navigation
|
|
166
|
+
- **`useClick`**: Click event handling with toggle and dismiss options
|
|
167
|
+
- **`useEscapeKey`**: Close on ESC key press with composition handling
|
|
168
|
+
- **`useClientPoint`**: Position floating elements at cursor/touch coordinates
|
|
169
|
+
|
|
170
|
+
### Middleware
|
|
171
|
+
|
|
172
|
+
All [Floating UI middleware](https://floating-ui.com/docs/middleware) are supported:
|
|
173
|
+
|
|
174
|
+
- **`offset`**: Add distance between anchor and floating element
|
|
175
|
+
- **`flip`**: Flip placement when there's insufficient space
|
|
176
|
+
- **`shift`**: Shift floating element to stay in view
|
|
177
|
+
- **`hide`**: Hide floating element when anchor is not visible
|
|
178
|
+
- **`autoPlacement`**: Automatically choose the best placement
|
|
179
|
+
- **`size`**: Resize floating element to fit within viewport
|
|
180
|
+
|
|
181
|
+
**Arrow positioning** is handled by the [`useArrow`](/api/use-arrow) composable, which automatically registers the necessary middleware.
|
|
182
|
+
|
|
183
|
+
## Project Status
|
|
184
|
+
|
|
185
|
+
- WIP and evolving rapidly; expect breaking changes without deprecations.
|
|
186
|
+
- API, docs, and examples are subject to change and may be incomplete.
|
|
187
|
+
- Feedback and contributions are welcome while the API stabilizes.
|
|
188
|
+
|
|
189
|
+
## Advanced Features
|
|
190
|
+
|
|
191
|
+
### Floating Trees
|
|
192
|
+
|
|
193
|
+
For nested floating elements like submenus, use `useFloatingTree` to manage hierarchical structures with a streamlined API that eliminates redundant `useFloating` calls.
|
|
194
|
+
|
|
195
|
+
**Clear Separation of Concerns:**
|
|
196
|
+
|
|
197
|
+
- Use `useFloating` for isolated floating elements
|
|
198
|
+
- Use `useFloatingTree` for hierarchical structures
|
|
199
|
+
|
|
200
|
+
Here's how you can set up a parent menu with a submenu using the new API:
|
|
201
|
+
|
|
202
|
+
```vue
|
|
203
|
+
<script setup lang="ts">
|
|
204
|
+
import { useTemplateRef, ref } from "vue"
|
|
205
|
+
import { useFloatingTree, useHover, useClick, offset, flip, shift } from "v-float"
|
|
206
|
+
|
|
207
|
+
const parentTriggerEl = useTemplateRef("parentTriggerRef")
|
|
208
|
+
const parentMenuEl = useTemplateRef("parentMenuRef")
|
|
209
|
+
const isParentOpen = ref(false)
|
|
210
|
+
|
|
211
|
+
const submenuTriggerEl = useTemplateRef("submenuTriggerRef")
|
|
212
|
+
const submenuEl = useTemplateRef("submenuRef")
|
|
213
|
+
const isSubmenuOpen = ref(false)
|
|
214
|
+
|
|
215
|
+
// 1. Create the floating tree with root context automatically
|
|
216
|
+
const tree = useFloatingTree(parentTriggerEl, parentMenuEl, {
|
|
217
|
+
placement: "bottom-start",
|
|
218
|
+
open: isParentOpen,
|
|
219
|
+
middlewares: [offset(4), flip(), shift({ padding: 8 })],
|
|
220
|
+
})
|
|
221
|
+
|
|
222
|
+
// 2. Add submenu node - no separate useFloating call needed!
|
|
223
|
+
const submenuNode = tree.addNode(submenuTriggerEl, submenuEl, {
|
|
224
|
+
placement: "right-start",
|
|
225
|
+
open: isSubmenuOpen,
|
|
226
|
+
middlewares: [offset(4), flip(), shift({ padding: 8 })],
|
|
227
|
+
parentId: tree.root.id, // Link to parent using parentId in options
|
|
228
|
+
})
|
|
229
|
+
|
|
230
|
+
// 3. Add interactions
|
|
231
|
+
useClick(tree.root, { outsideClick: true })
|
|
232
|
+
useHover(submenuNode, { delay: { open: 100, close: 300 } })
|
|
233
|
+
|
|
234
|
+
// Access floating styles from the contexts
|
|
235
|
+
const { floatingStyles: parentStyles } = tree.rootContext
|
|
236
|
+
const { floatingStyles: submenuStyles } = submenuNode.data
|
|
237
|
+
</script>
|
|
238
|
+
|
|
239
|
+
<template>
|
|
240
|
+
<!-- Parent Menu Trigger -->
|
|
241
|
+
<button ref="parentTriggerEl" @click="isParentOpen = !isParentOpen">Open Menu</button>
|
|
242
|
+
|
|
243
|
+
<!-- Parent Menu -->
|
|
244
|
+
<div v-if="isParentOpen" ref="parentMenuEl" :style="parentStyles" class="menu">
|
|
245
|
+
<div class="menu-item">Menu Item 1</div>
|
|
246
|
+
|
|
247
|
+
<!-- Submenu Trigger -->
|
|
248
|
+
<div
|
|
249
|
+
ref="submenuTriggerEl"
|
|
250
|
+
class="menu-item menu-item--submenu"
|
|
251
|
+
@click="isSubmenuOpen = !isSubmenuOpen"
|
|
252
|
+
>
|
|
253
|
+
Menu Item 2 (Has Submenu)
|
|
254
|
+
|
|
255
|
+
<!-- Submenu -->
|
|
256
|
+
<div v-if="isSubmenuOpen" ref="submenuEl" :style="submenuStyles" class="menu submenu">
|
|
257
|
+
<div class="menu-item">Submenu Item A</div>
|
|
258
|
+
<div class="menu-item">Submenu Item B</div>
|
|
259
|
+
<div class="menu-item">Submenu Item C</div>
|
|
260
|
+
</div>
|
|
261
|
+
</div>
|
|
262
|
+
|
|
263
|
+
<div class="menu-item">Menu Item 3</div>
|
|
264
|
+
</div>
|
|
265
|
+
</template>
|
|
266
|
+
|
|
267
|
+
<style scoped>
|
|
268
|
+
.menu {
|
|
269
|
+
background: white;
|
|
270
|
+
border: 1px solid #ddd;
|
|
271
|
+
border-radius: 4px;
|
|
272
|
+
padding: 4px 0;
|
|
273
|
+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
|
274
|
+
min-width: 160px;
|
|
275
|
+
z-index: 1000;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.submenu {
|
|
279
|
+
margin-left: 8px;
|
|
280
|
+
z-index: 1010;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.menu-item {
|
|
284
|
+
padding: 8px 12px;
|
|
285
|
+
cursor: pointer;
|
|
286
|
+
user-select: none;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.menu-item:hover {
|
|
290
|
+
background-color: #f5f5f5;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.menu-item--submenu {
|
|
294
|
+
position: relative;
|
|
295
|
+
}
|
|
296
|
+
</style>
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
**API Benefits:**
|
|
300
|
+
|
|
301
|
+
```ts
|
|
302
|
+
// Before: Required separate useFloating calls
|
|
303
|
+
const parentContext = useFloating(parentEl, parentFloating, options)
|
|
304
|
+
const tree = useFloatingTree(parentContext)
|
|
305
|
+
const childContext = useFloating(childEl, childFloating, childOptions)
|
|
306
|
+
const childNode = tree.addNode(childContext, parentContext.nodeId)
|
|
307
|
+
|
|
308
|
+
// After: Streamlined API with internal context creation
|
|
309
|
+
const tree = useFloatingTree(parentEl, parentFloating, options)
|
|
310
|
+
const childNode = tree.addNode(childEl, childFloating, {
|
|
311
|
+
...childOptions,
|
|
312
|
+
parentId: tree.root.id,
|
|
313
|
+
})
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
This approach eliminates redundant calls and provides a clearer separation between isolated floating elements (`useFloating`) and hierarchical structures (`useFloatingTree`).
|
|
317
|
+
|
|
318
|
+
## TypeScript Support
|
|
319
|
+
|
|
320
|
+
V-Float is built with TypeScript and provides comprehensive type definitions:
|
|
321
|
+
|
|
322
|
+
## Browser Support
|
|
323
|
+
|
|
324
|
+
- **Modern browsers**: Chrome, Firefox, Safari, Edge
|
|
325
|
+
- **Mobile browsers**: iOS Safari, Chrome Mobile, Samsung Internet
|
|
326
|
+
- **Node.js**: SSR compatible (with proper hydration)
|
|
327
|
+
|
|
328
|
+
## Documentation
|
|
329
|
+
|
|
330
|
+
For complete documentation with interactive examples, visit the [V-Float Documentation](https://vfloat.pages.dev/).
|
|
331
|
+
|
|
332
|
+
## Contributing
|
|
333
|
+
|
|
334
|
+
Contributions are welcome! Please read our contributing guidelines and submit pull requests to
|
|
335
|
+
our [GitHub repository](https://github.com/sherif414/VFloat).
|
|
336
|
+
|
|
337
|
+
## Credits
|
|
338
|
+
|
|
339
|
+
V-Float is built on top of the excellent work of:
|
|
340
|
+
|
|
341
|
+
- [Floating UI](https://floating-ui.com/) - For the core positioning and collision detection algorithms
|
|
342
|
+
- [VueUse](https://vueuse.org/) - For Vue composition utilities and best practices
|
|
343
|
+
|
|
344
|
+
## License
|
|
345
|
+
|
|
346
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/composables/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/composables/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export * from './use-click';
|
|
2
|
-
export { type AxisConstraint, type Coordinates, type TrackingMode, type UseClientPointContext, type UseClientPointOptions, type UseClientPointReturn, useClientPoint, } from './use-client-point';
|
|
3
2
|
export * from './use-escape-key';
|
|
4
3
|
export * from './use-focus';
|
|
5
4
|
export * from './use-hover';
|
|
6
|
-
export * from './utils';
|
|
7
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composables/interactions/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composables/interactions/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TreeNode } from '../use-floating-tree';
|
|
2
|
-
import { AnchorElement, FloatingContext, FloatingElement } from '../use-floating';
|
|
1
|
+
import { TreeNode } from '../positioning/use-floating-tree';
|
|
2
|
+
import { AnchorElement, FloatingContext, FloatingElement } from '../positioning/use-floating';
|
|
3
3
|
type Point = [number, number];
|
|
4
4
|
type Polygon = Point[];
|
|
5
5
|
export interface SafePolygonOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polygon.d.ts","sourceRoot":"","sources":["../../../src/composables/interactions/polygon.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"polygon.d.ts","sourceRoot":"","sources":["../../../src/composables/interactions/polygon.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAA;AAE3E,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAGlG,KAAK,KAAK,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAC7B,KAAK,OAAO,GAAG,KAAK,EAAE,CAAA;AAoDtB,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;CAC7C;AAED,MAAM,WAAW,+BAA+B;IAC9C,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,SAAS,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAA;IAChD,QAAQ,EAAE;QACR,YAAY,EAAE,aAAa,GAAG,IAAI,CAAA;QAClC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAA;KACjC,CAAA;IACD,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE;QAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAA;KAAE,CAAA;CACzD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,GAAE,kBAAuB;cAsCJ,+BAA+B,WAehD,UAAU;;;;EAiVhD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MaybeRefOrGetter } from 'vue';
|
|
2
|
-
import { FloatingContext } from '
|
|
3
|
-
import { TreeNode } from '../use-floating-tree';
|
|
2
|
+
import { FloatingContext } from '../positioning/use-floating';
|
|
3
|
+
import { TreeNode } from '../positioning/use-floating-tree';
|
|
4
4
|
/**
|
|
5
5
|
* Enables showing/hiding the floating element when clicking the reference element
|
|
6
6
|
* and optionally when clicking outside both the reference and floating elements.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-click.d.ts","sourceRoot":"","sources":["../../../src/composables/interactions/use-click.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-click.d.ts","sourceRoot":"","sources":["../../../src/composables/interactions/use-click.ts"],"names":[],"mappings":"AAEE,OAAO,EAAY,KAAK,gBAAgB,EAA8C,MAAM,KAAK,CAAA;AACjG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AAC7E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAA;AAkB7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,QAAQ,CACtB,OAAO,EAAE,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAC,EACpD,OAAO,GAAE,eAAoB,GAC5B,IAAI,CAoQN;AA0CD;;GAEG;AACH,MAAM,WAAW,eAAe;IAG9B;;;OAGG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAA;IAEnC;;;;OAIG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC,OAAO,GAAG,WAAW,CAAC,CAAA;IAE/C;;;OAGG;IACH,MAAM,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAA;IAElC;;;OAGG;IACH,WAAW,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAA;IAEvC;;;OAGG;IACH,cAAc,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAA;IAE1C;;;OAGG;IACH,WAAW,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAA;IAIvC;;;OAGG;IACH,YAAY,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAA;IAExC;;;OAGG;IACH,YAAY,CAAC,EAAE,gBAAgB,CAAC,aAAa,GAAG,WAAW,GAAG,OAAO,CAAC,CAAA;IAEtE;;;OAGG;IACH,cAAc,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAA;IAE1C;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,eAAe,KAAK,IAAI,CAAA;IAEtE;;;OAGG;IACH,qBAAqB,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAA;IAEjD;;;OAGG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAA;CAC7C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MaybeRefOrGetter } from 'vue';
|
|
2
|
-
import { FloatingContext } from '
|
|
3
|
-
import { TreeNode } from '../use-floating-tree';
|
|
2
|
+
import { FloatingContext } from '../positioning/use-floating';
|
|
3
|
+
import { TreeNode } from '../positioning/use-floating-tree';
|
|
4
4
|
export interface UseEscapeKeyOptions {
|
|
5
5
|
/**
|
|
6
6
|
* Condition to enable the escape key listener.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-escape-key.d.ts","sourceRoot":"","sources":["../../../src/composables/interactions/use-escape-key.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAgB,MAAM,KAAK,CAAA;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"use-escape-key.d.ts","sourceRoot":"","sources":["../../../src/composables/interactions/use-escape-key.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAgB,MAAM,KAAK,CAAA;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AAC7E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAA;AAO3E,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAA;IAEnC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;CAC1C;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAC,EACpD,OAAO,GAAE,mBAAwB,GAChC,IAAI,CAiCN"}
|