@@ -11,10 +11,8 @@ import {
1111 type MaybeElementOrSelectorRef ,
1212} from "../utils/unrefElement.js" ;
1313
14- export type UseAdhesiveOptions = Partial <
15- Omit < AdhesiveOptions , "targetEl" | "boundingEl" >
16- > & {
17- boundingEl ?: AdhesiveOptions [ "boundingEl" ] | MaybeElementOrSelectorRef ;
14+ export type UseAdhesiveOptions = Partial < Omit < AdhesiveOptions , "targetEl" > > & {
15+ boundingRef ?: MaybeElementOrSelectorRef ;
1816} ;
1917
2018/**
@@ -33,12 +31,12 @@ export type UseAdhesiveOptions = Partial<
3331 * import { useTemplateRef } from 'vue';
3432 * import { useAdhesive } from '@adhesivejs/vue';
3533 *
36- * const targetEl = useTemplateRef('target');
37- * const boundingEl = useTemplateRef('bounding');
34+ * const targetRef = useTemplateRef('target');
35+ * const boundingRef = useTemplateRef('bounding');
3836 *
3937 * useAdhesive(
40- * targetEl ,
41- * () => ({ boundingEl: boundingEl .value, position: 'top' })
38+ * targetRef ,
39+ * () => ({ boundingRef: boundingRef .value, position: 'top' })
4240 * );
4341 * </script>
4442 *
@@ -55,12 +53,12 @@ export type UseAdhesiveOptions = Partial<
5553 * import { ref } from 'vue';
5654 * import { useAdhesive } from '@adhesivejs/vue';
5755 *
58- * const targetEl = useTemplateRef('target');
56+ * const targetRef = useTemplateRef('target');
5957 * const enabled = ref(true);
6058 * const offset = ref(10);
6159 *
6260 * // Reactive options
63- * useAdhesive(targetEl , () => ({
61+ * useAdhesive(targetRef , () => ({
6462 * position: 'top',
6563 * enabled: enabled.value,
6664 * offset: offset.value,
@@ -76,7 +74,8 @@ export function useAdhesive(
7674 const optionsValue = toValue ( options ) ;
7775
7876 const targetEl = unrefElement ( target ) ;
79- const boundingEl = unrefElement ( optionsValue ?. boundingEl ) ;
77+ const boundingEl =
78+ unrefElement ( optionsValue ?. boundingRef ) ?? optionsValue ?. boundingEl ;
8079
8180 if ( ! targetEl ) {
8281 throw new Error ( "@adhesivejs/vue: sticky element is not defined" ) ;
0 commit comments