File tree Expand file tree Collapse file tree 5 files changed +16
-16
lines changed
Expand file tree Collapse file tree 5 files changed +16
-16
lines changed Original file line number Diff line number Diff line change 11import { Adhesive , type AdhesiveOptions } from "@adhesivejs/core" ;
22import { useEffect , useRef } from "react" ;
33import {
4- unrefElement ,
4+ unwrapElement ,
55 type MaybeElementOrSelectorRef ,
6- } from "../utils/unrefElement .js" ;
6+ } from "../utils/unwrapElement .js" ;
77
88/**
99 * Configuration options for the useAdhesive hook.
@@ -53,9 +53,9 @@ export function useAdhesive(
5353 options ?: UseAdhesiveOptions ,
5454) {
5555 function getValidatedOptions ( ) {
56- const targetEl = unrefElement ( target ) ;
56+ const targetEl = unwrapElement ( target ) ;
5757 const boundingEl =
58- unrefElement ( options ?. boundingRef ) ?? options ?. boundingEl ;
58+ unwrapElement ( options ?. boundingRef ) ?? options ?. boundingEl ;
5959
6060 if ( ! targetEl ) {
6161 throw new Error ( "@adhesivejs/react: sticky element is not defined" ) ;
Original file line number Diff line number Diff line change @@ -7,11 +7,11 @@ export type MaybeElementOrSelectorRef =
77 | null
88 | undefined ;
99
10- type UnRefElementReturn = HTMLElement | string | null | undefined ;
10+ type UnwrapElementReturn = HTMLElement | string | null | undefined ;
1111
12- export function unrefElement (
12+ export function unwrapElement (
1313 elOrSelectorRef : MaybeElementOrSelectorRef ,
14- ) : UnRefElementReturn {
14+ ) : UnwrapElementReturn {
1515 // Handle React ref objects by accessing their .current property
1616 // For non-ref values, return them as-is
1717 if (
@@ -21,5 +21,5 @@ export function unrefElement(
2121 ) {
2222 return elOrSelectorRef . current ;
2323 }
24- return elOrSelectorRef as UnRefElementReturn ;
24+ return elOrSelectorRef as UnwrapElementReturn ;
2525}
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import {
1010 useAdhesive ,
1111 type UseAdhesiveOptions ,
1212} from "../composables/useAdhesive.js" ;
13- import type { MaybeElementOrSelectorRef } from "../utils/unrefElement .js" ;
13+ import type { MaybeElementOrSelectorRef } from "../utils/unwrapElement .js" ;
1414
1515type BaseProps = Omit <
1616 Partial < UseAdhesiveOptions > ,
Original file line number Diff line number Diff line change 77 type MaybeRefOrGetter ,
88} from "vue" ;
99import {
10- unrefElement ,
10+ unwrapElement ,
1111 type MaybeElementOrSelectorRef ,
12- } from "../utils/unrefElement .js" ;
12+ } from "../utils/unwrapElement .js" ;
1313
1414/**
1515 * Configuration options for the useAdhesive composable.
@@ -80,9 +80,9 @@ export function useAdhesive(
8080 function getValidatedOptions ( ) {
8181 const optionsValue = toValue ( options ) ;
8282
83- const targetEl = unrefElement ( target ) ;
83+ const targetEl = unwrapElement ( target ) ;
8484 const boundingEl =
85- unrefElement ( optionsValue ?. boundingRef ) ?? optionsValue ?. boundingEl ;
85+ unwrapElement ( optionsValue ?. boundingRef ) ?? optionsValue ?. boundingEl ;
8686
8787 if ( ! targetEl ) {
8888 throw new Error ( "@adhesivejs/vue: sticky element is not defined" ) ;
Original file line number Diff line number Diff line change @@ -17,11 +17,11 @@ export type MaybeElementOrSelectorRef<
1717 T extends MaybeElementOrSelector = MaybeElementOrSelector ,
1818> = MaybeRefOrGetter < T > ;
1919
20- type UnRefElementReturn = HTMLElement | string | null | undefined ;
20+ type UnwrapElementReturn = HTMLElement | string | null | undefined ;
2121
22- export function unrefElement (
22+ export function unwrapElement (
2323 elOrSelectorRef : MaybeElementOrSelectorRef ,
24- ) : UnRefElementReturn {
24+ ) : UnwrapElementReturn {
2525 const elOrSelectorValue = toValue ( elOrSelectorRef ) ;
2626 return ( elOrSelectorValue as VueInstance ) ?. $el ?? elOrSelectorValue ;
2727}
You can’t perform that action at this time.
0 commit comments