index.d.ts 150 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471
  1. import * as _vueuse_shared from '@vueuse/shared';
  2. import { Fn, MaybeRef, MaybeComputedRef, Awaitable, ConfigurableEventFilter, ConfigurableFlush, RemovableRef, EventHookOn, Arrayable, MaybeReadonlyRef, UseIntervalFnOptions, Pausable, UseTimeoutFnOptions, EventHook } from '@vueuse/shared';
  3. export * from '@vueuse/shared';
  4. import * as vue_demi from 'vue-demi';
  5. import { Ref, InjectionKey, ComputedRef, ComponentPublicInstance, Component, UnwrapRef, WatchOptions, UnwrapNestedRefs, WatchSource, ToRefs, StyleValue, ShallowRef } from 'vue-demi';
  6. import * as vue from 'vue-demi';
  7. /**
  8. * Handle overlapping async evaluations.
  9. *
  10. * @param cancelCallback The provided callback is invoked when a re-evaluation of the computed value is triggered before the previous one finished
  11. */
  12. declare type AsyncComputedOnCancel = (cancelCallback: Fn) => void;
  13. interface AsyncComputedOptions {
  14. /**
  15. * Should value be evaluated lazily
  16. *
  17. * @default false
  18. */
  19. lazy?: boolean;
  20. /**
  21. * Ref passed to receive the updated of async evaluation
  22. */
  23. evaluating?: Ref<boolean>;
  24. /**
  25. * Callback when error is caught.
  26. */
  27. onError?: (e: unknown) => void;
  28. }
  29. /**
  30. * Create an asynchronous computed dependency.
  31. *
  32. * @see https://vueuse.org/computedAsync
  33. * @param evaluationCallback The promise-returning callback which generates the computed value
  34. * @param initialState The initial state, used until the first evaluation finishes
  35. * @param optionsOrRef Additional options or a ref passed to receive the updates of the async evaluation
  36. */
  37. declare function computedAsync<T>(evaluationCallback: (onCancel: AsyncComputedOnCancel) => T | Promise<T>, initialState?: T, optionsOrRef?: Ref<boolean> | AsyncComputedOptions): Ref<T>;
  38. declare type ComputedInjectGetter<T, K> = (source: T | undefined, ctx?: any) => K;
  39. declare type ComputedInjectGetterWithDefault<T, K> = (source: T, ctx?: any) => K;
  40. declare type ComputedInjectSetter<T> = (v: T) => void;
  41. interface WritableComputedInjectOptions<T, K> {
  42. get: ComputedInjectGetter<T, K>;
  43. set: ComputedInjectSetter<K>;
  44. }
  45. interface WritableComputedInjectOptionsWithDefault<T, K> {
  46. get: ComputedInjectGetterWithDefault<T, K>;
  47. set: ComputedInjectSetter<K>;
  48. }
  49. declare function computedInject<T, K = any>(key: InjectionKey<T> | string, getter: ComputedInjectGetter<T, K>): ComputedRef<K | undefined>;
  50. declare function computedInject<T, K = any>(key: InjectionKey<T> | string, options: WritableComputedInjectOptions<T, K>): ComputedRef<K | undefined>;
  51. declare function computedInject<T, K = any>(key: InjectionKey<T> | string, getter: ComputedInjectGetterWithDefault<T, K>, defaultSource: T, treatDefaultAsFactory?: false): ComputedRef<K>;
  52. declare function computedInject<T, K = any>(key: InjectionKey<T> | string, options: WritableComputedInjectOptionsWithDefault<T, K>, defaultSource: T | (() => T), treatDefaultAsFactory: true): ComputedRef<K>;
  53. declare type UnrefFn<T> = T extends (...args: infer A) => infer R ? (...args: {
  54. [K in keyof A]: MaybeRef<A[K]>;
  55. }) => R : never;
  56. /**
  57. * Make a plain function accepting ref and raw values as arguments.
  58. * Returns the same value the unconverted function returns, with proper typing.
  59. */
  60. declare const createUnrefFn: <T extends Function>(fn: T) => UnrefFn<T>;
  61. declare type VueInstance = ComponentPublicInstance;
  62. declare type MaybeElementRef<T extends MaybeElement = MaybeElement> = MaybeRef<T>;
  63. declare type MaybeComputedElementRef<T extends MaybeElement = MaybeElement> = MaybeComputedRef<T>;
  64. declare type MaybeElement = HTMLElement | SVGElement | VueInstance | undefined | null;
  65. declare type UnRefElementReturn<T extends MaybeElement = MaybeElement> = T extends VueInstance ? Exclude<MaybeElement, VueInstance> : T | undefined;
  66. /**
  67. * Get the dom element of a ref of element or Vue component instance
  68. *
  69. * @param elRef
  70. */
  71. declare function unrefElement<T extends MaybeElement>(elRef: MaybeComputedElementRef<T>): UnRefElementReturn<T>;
  72. interface ConfigurableWindow {
  73. window?: Window;
  74. }
  75. interface ConfigurableDocument {
  76. document?: Document;
  77. }
  78. interface ConfigurableNavigator {
  79. navigator?: Navigator;
  80. }
  81. interface ConfigurableLocation {
  82. location?: Location;
  83. }
  84. declare const defaultWindow: (Window & typeof globalThis) | undefined;
  85. declare const defaultDocument: Document | undefined;
  86. declare const defaultNavigator: Navigator | undefined;
  87. declare const defaultLocation: Location | undefined;
  88. interface OnClickOutsideOptions extends ConfigurableWindow {
  89. /**
  90. * List of elements that should not trigger the event.
  91. */
  92. ignore?: (MaybeElementRef | string)[];
  93. /**
  94. * Use capturing phase for internal event listener.
  95. * @default true
  96. */
  97. capture?: boolean;
  98. /**
  99. * Run handler function if focus moves to an iframe.
  100. * @default false
  101. */
  102. detectIframe?: boolean;
  103. }
  104. declare type OnClickOutsideHandler<T extends {
  105. detectIframe: OnClickOutsideOptions['detectIframe'];
  106. } = {
  107. detectIframe: false;
  108. }> = (evt: T['detectIframe'] extends true ? PointerEvent | FocusEvent : PointerEvent) => void;
  109. /**
  110. * Listen for clicks outside of an element.
  111. *
  112. * @see https://vueuse.org/onClickOutside
  113. * @param target
  114. * @param handler
  115. * @param options
  116. */
  117. declare function onClickOutside<T extends OnClickOutsideOptions>(target: MaybeElementRef, handler: OnClickOutsideHandler<{
  118. detectIframe: T['detectIframe'];
  119. }>, options?: T): (() => void) | undefined;
  120. declare type KeyPredicate = (event: KeyboardEvent) => boolean;
  121. declare type KeyFilter = true | string | string[] | KeyPredicate;
  122. declare type KeyStrokeEventName = 'keydown' | 'keypress' | 'keyup';
  123. interface OnKeyStrokeOptions {
  124. eventName?: KeyStrokeEventName;
  125. target?: MaybeComputedRef<EventTarget>;
  126. passive?: boolean;
  127. }
  128. declare function onKeyStroke(key: KeyFilter, handler: (event: KeyboardEvent) => void, options?: OnKeyStrokeOptions): () => void;
  129. declare function onKeyStroke(handler: (event: KeyboardEvent) => void, options?: OnKeyStrokeOptions): () => void;
  130. /**
  131. * Listen for keyboard keys being stroked.
  132. *
  133. * @see https://vueuse.org/onKeyStroke
  134. */
  135. declare function onKeyStroke(key: KeyFilter, handler: (event: KeyboardEvent) => void, options?: OnKeyStrokeOptions): () => void;
  136. declare function onKeyStroke(handler: (event: KeyboardEvent) => void, options?: OnKeyStrokeOptions): () => void;
  137. /**
  138. * Listen to the keydown event of the given key.
  139. *
  140. * @see https://vueuse.org/onKeyStroke
  141. * @param key
  142. * @param handler
  143. * @param options
  144. */
  145. declare function onKeyDown(key: KeyFilter, handler: (event: KeyboardEvent) => void, options?: Omit<OnKeyStrokeOptions, 'eventName'>): () => void;
  146. /**
  147. * Listen to the keypress event of the given key.
  148. *
  149. * @see https://vueuse.org/onKeyStroke
  150. * @param key
  151. * @param handler
  152. * @param options
  153. */
  154. declare function onKeyPressed(key: KeyFilter, handler: (event: KeyboardEvent) => void, options?: Omit<OnKeyStrokeOptions, 'eventName'>): () => void;
  155. /**
  156. * Listen to the keyup event of the given key.
  157. *
  158. * @see https://vueuse.org/onKeyStroke
  159. * @param key
  160. * @param handler
  161. * @param options
  162. */
  163. declare function onKeyUp(key: KeyFilter, handler: (event: KeyboardEvent) => void, options?: Omit<OnKeyStrokeOptions, 'eventName'>): () => void;
  164. interface OnLongPressOptions {
  165. /**
  166. * Time in ms till `longpress` gets called
  167. *
  168. * @default 500
  169. */
  170. delay?: number;
  171. modifiers?: OnLongPressModifiers;
  172. }
  173. interface OnLongPressModifiers {
  174. stop?: boolean;
  175. once?: boolean;
  176. prevent?: boolean;
  177. capture?: boolean;
  178. self?: boolean;
  179. }
  180. declare function onLongPress(target: MaybeElementRef, handler: (evt: PointerEvent) => void, options?: OnLongPressOptions): void;
  181. /**
  182. * Fires when users start typing on non-editable elements.
  183. *
  184. * @see https://vueuse.org/onStartTyping
  185. * @param callback
  186. * @param options
  187. */
  188. declare function onStartTyping(callback: (event: KeyboardEvent) => void, options?: ConfigurableDocument): void;
  189. /**
  190. * Shorthand for binding ref to template element.
  191. *
  192. * @see https://vueuse.org/templateRef
  193. * @param key
  194. * @param initialValue
  195. */
  196. declare function templateRef<T extends HTMLElement | SVGElement | Component | null>(key: string, initialValue?: T | null): Readonly<Ref<T>>;
  197. /**
  198. * Reactive `document.activeElement`
  199. *
  200. * @see https://vueuse.org/useActiveElement
  201. * @param options
  202. */
  203. declare function useActiveElement<T extends HTMLElement>(options?: ConfigurableWindow): _vueuse_shared.ComputedRefWithControl<T | null | undefined>;
  204. declare type UseAsyncQueueTask<T> = (...args: any[]) => T | Promise<T>;
  205. interface UseAsyncQueueResult<T> {
  206. state: 'pending' | 'fulfilled' | 'rejected';
  207. data: T | null;
  208. }
  209. interface UseAsyncQueueReturn<T> {
  210. activeIndex: Ref<number>;
  211. result: T;
  212. }
  213. interface UseAsyncQueueOptions {
  214. /**
  215. * Interrupt tasks when current task fails.
  216. *
  217. * @default true
  218. */
  219. interrupt?: boolean;
  220. /**
  221. * Trigger it when the tasks fails.
  222. *
  223. */
  224. onError?: () => void;
  225. /**
  226. * Trigger it when the tasks ends.
  227. *
  228. */
  229. onFinished?: () => void;
  230. }
  231. /**
  232. * Asynchronous queue task controller.
  233. *
  234. * @see https://vueuse.org/useAsyncQueue
  235. * @param tasks
  236. * @param options
  237. */
  238. declare function useAsyncQueue<T1>(tasks: [UseAsyncQueueTask<T1>], options?: UseAsyncQueueOptions): UseAsyncQueueReturn<[UseAsyncQueueResult<T1>]>;
  239. declare function useAsyncQueue<T1, T2>(tasks: [UseAsyncQueueTask<T1>, UseAsyncQueueTask<T2>], options?: UseAsyncQueueOptions): UseAsyncQueueReturn<[UseAsyncQueueResult<T1>, UseAsyncQueueResult<T2>]>;
  240. declare function useAsyncQueue<T1, T2, T3>(tasks: [UseAsyncQueueTask<T1>, UseAsyncQueueTask<T2>, UseAsyncQueueTask<T3>], options?: UseAsyncQueueOptions): UseAsyncQueueReturn<[UseAsyncQueueResult<T1>, UseAsyncQueueResult<T2>, UseAsyncQueueResult<T3>]>;
  241. declare function useAsyncQueue<T1, T2, T3, T4>(tasks: [UseAsyncQueueTask<T1>, UseAsyncQueueTask<T2>, UseAsyncQueueTask<T3>, UseAsyncQueueTask<T4>], options?: UseAsyncQueueOptions): UseAsyncQueueReturn<[UseAsyncQueueResult<T1>, UseAsyncQueueResult<T2>, UseAsyncQueueResult<T3>, UseAsyncQueueResult<T4>]>;
  242. declare function useAsyncQueue<T1, T2, T3, T4, T5>(tasks: [UseAsyncQueueTask<T1>, UseAsyncQueueTask<T2>, UseAsyncQueueTask<T3>, UseAsyncQueueTask<T4>, UseAsyncQueueTask<T5>], options?: UseAsyncQueueOptions): UseAsyncQueueReturn<[UseAsyncQueueResult<T1>, UseAsyncQueueResult<T2>, UseAsyncQueueResult<T3>, UseAsyncQueueResult<T4>, UseAsyncQueueResult<T5>]>;
  243. declare function useAsyncQueue<T>(tasks: UseAsyncQueueTask<T>[], options?: UseAsyncQueueOptions): UseAsyncQueueReturn<UseAsyncQueueResult<T>[]>;
  244. interface UseAsyncStateReturn<Data, Shallow extends boolean> {
  245. state: Shallow extends true ? Ref<Data> : Ref<UnwrapRef<Data>>;
  246. isReady: Ref<boolean>;
  247. isLoading: Ref<boolean>;
  248. error: Ref<unknown>;
  249. execute: (delay?: number, ...args: any[]) => Promise<Data>;
  250. }
  251. interface UseAsyncStateOptions<Shallow extends boolean, D = any> {
  252. /**
  253. * Delay for executing the promise. In milliseconds.
  254. *
  255. * @default 0
  256. */
  257. delay?: number;
  258. /**
  259. * Execute the promise right after the function is invoked.
  260. * Will apply the delay if any.
  261. *
  262. * When set to false, you will need to execute it manually.
  263. *
  264. * @default true
  265. */
  266. immediate?: boolean;
  267. /**
  268. * Callback when error is caught.
  269. */
  270. onError?: (e: unknown) => void;
  271. /**
  272. * Callback when success is caught.
  273. * @param {D} data
  274. */
  275. onSuccess?: (data: D) => void;
  276. /**
  277. * Sets the state to initialState before executing the promise.
  278. *
  279. * This can be useful when calling the execute function more than once (for
  280. * example, to refresh data). When set to false, the current state remains
  281. * unchanged until the promise resolves.
  282. *
  283. * @default true
  284. */
  285. resetOnExecute?: boolean;
  286. /**
  287. * Use shallowRef.
  288. *
  289. * @default true
  290. */
  291. shallow?: Shallow;
  292. /**
  293. *
  294. * An error is thrown when executing the execute function
  295. *
  296. * @default false
  297. */
  298. throwError?: boolean;
  299. }
  300. /**
  301. * Reactive async state. Will not block your setup function and will trigger changes once
  302. * the promise is ready.
  303. *
  304. * @see https://vueuse.org/useAsyncState
  305. * @param promise The promise / async function to be resolved
  306. * @param initialState The initial state, used until the first evaluation finishes
  307. * @param options
  308. */
  309. declare function useAsyncState<Data, Shallow extends boolean = true>(promise: Promise<Data> | ((...args: any[]) => Promise<Data>), initialState: Data, options?: UseAsyncStateOptions<Shallow, Data>): UseAsyncStateReturn<Data, Shallow>;
  310. interface ToDataURLOptions {
  311. /**
  312. * MIME type
  313. */
  314. type?: string | undefined;
  315. /**
  316. * Image quality of jpeg or webp
  317. */
  318. quality?: any;
  319. }
  320. interface UseBase64ObjectOptions<T> {
  321. serializer: (v: T) => string;
  322. }
  323. interface UseBase64Return {
  324. base64: Ref<string>;
  325. promise: Ref<Promise<string>>;
  326. execute: () => Promise<string>;
  327. }
  328. declare function useBase64(target: MaybeComputedRef<string>): UseBase64Return;
  329. declare function useBase64(target: MaybeComputedRef<Blob>): UseBase64Return;
  330. declare function useBase64(target: MaybeComputedRef<ArrayBuffer>): UseBase64Return;
  331. declare function useBase64(target: MaybeComputedRef<HTMLCanvasElement>, options?: ToDataURLOptions): UseBase64Return;
  332. declare function useBase64(target: MaybeComputedRef<HTMLImageElement>, options?: ToDataURLOptions): UseBase64Return;
  333. declare function useBase64<T extends Record<string, unknown>>(target: MaybeComputedRef<T>, options?: UseBase64ObjectOptions<T>): UseBase64Return;
  334. declare function useBase64<T extends Map<string, unknown>>(target: MaybeComputedRef<T>, options?: UseBase64ObjectOptions<T>): UseBase64Return;
  335. declare function useBase64<T extends Set<unknown>>(target: MaybeComputedRef<T>, options?: UseBase64ObjectOptions<T>): UseBase64Return;
  336. declare function useBase64<T>(target: MaybeComputedRef<T[]>, options?: UseBase64ObjectOptions<T[]>): UseBase64Return;
  337. interface BatteryManager extends EventTarget {
  338. charging: boolean;
  339. chargingTime: number;
  340. dischargingTime: number;
  341. level: number;
  342. }
  343. /**
  344. * Reactive Battery Status API.
  345. *
  346. * @see https://vueuse.org/useBattery
  347. * @param options
  348. */
  349. declare function useBattery({ navigator }?: ConfigurableNavigator): {
  350. isSupported: vue_demi.Ref<boolean>;
  351. charging: vue_demi.Ref<boolean>;
  352. chargingTime: vue_demi.Ref<number>;
  353. dischargingTime: vue_demi.Ref<number>;
  354. level: vue_demi.Ref<number>;
  355. };
  356. declare type UseBatteryReturn = ReturnType<typeof useBattery>;
  357. interface UseBluetoothRequestDeviceOptions {
  358. /**
  359. *
  360. * An array of BluetoothScanFilters. This filter consists of an array
  361. * of BluetoothServiceUUIDs, a name parameter, and a namePrefix parameter.
  362. *
  363. */
  364. filters?: BluetoothLEScanFilter[] | undefined;
  365. /**
  366. *
  367. * An array of BluetoothServiceUUIDs.
  368. *
  369. * @see https://developer.mozilla.org/en-US/docs/Web/API/BluetoothRemoteGATTService/uuid
  370. *
  371. */
  372. optionalServices?: BluetoothServiceUUID[] | undefined;
  373. }
  374. interface UseBluetoothOptions extends UseBluetoothRequestDeviceOptions, ConfigurableNavigator {
  375. /**
  376. *
  377. * A boolean value indicating that the requesting script can accept all Bluetooth
  378. * devices. The default is false.
  379. *
  380. * !! This may result in a bunch of unrelated devices being shown
  381. * in the chooser and energy being wasted as there are no filters.
  382. *
  383. *
  384. * Use it with caution.
  385. *
  386. * @default false
  387. *
  388. */
  389. acceptAllDevices?: boolean;
  390. }
  391. declare function useBluetooth(options?: UseBluetoothOptions): UseBluetoothReturn;
  392. interface UseBluetoothReturn {
  393. isSupported: Ref<boolean>;
  394. isConnected: ComputedRef<boolean>;
  395. device: Ref<BluetoothDevice | undefined>;
  396. requestDevice: () => Promise<void>;
  397. server: Ref<BluetoothRemoteGATTServer | undefined>;
  398. error: Ref<unknown | null>;
  399. }
  400. /**
  401. * Breakpoints from Tailwind V2
  402. *
  403. * @see https://tailwindcss.com/docs/breakpoints
  404. */
  405. declare const breakpointsTailwind: {
  406. sm: number;
  407. md: number;
  408. lg: number;
  409. xl: number;
  410. '2xl': number;
  411. };
  412. /**
  413. * Breakpoints from Bootstrap V5
  414. *
  415. * @see https://getbootstrap.com/docs/5.0/layout/breakpoints
  416. */
  417. declare const breakpointsBootstrapV5: {
  418. sm: number;
  419. md: number;
  420. lg: number;
  421. xl: number;
  422. xxl: number;
  423. };
  424. /**
  425. * Breakpoints from Vuetify V2
  426. *
  427. * @see https://vuetifyjs.com/en/features/breakpoints
  428. */
  429. declare const breakpointsVuetify: {
  430. xs: number;
  431. sm: number;
  432. md: number;
  433. lg: number;
  434. };
  435. /**
  436. * Breakpoints from Ant Design
  437. *
  438. * @see https://ant.design/components/layout/#breakpoint-width
  439. */
  440. declare const breakpointsAntDesign: {
  441. xs: number;
  442. sm: number;
  443. md: number;
  444. lg: number;
  445. xl: number;
  446. xxl: number;
  447. };
  448. /**
  449. * Breakpoints from Quasar V2
  450. *
  451. * @see https://quasar.dev/style/breakpoints
  452. */
  453. declare const breakpointsQuasar: {
  454. xs: number;
  455. sm: number;
  456. md: number;
  457. lg: number;
  458. };
  459. /**
  460. * Sematic Breakpoints
  461. */
  462. declare const breakpointsSematic: {
  463. mobileS: number;
  464. mobileM: number;
  465. mobileL: number;
  466. tablet: number;
  467. laptop: number;
  468. laptopL: number;
  469. desktop4K: number;
  470. };
  471. /**
  472. * Breakpoints from Master CSS
  473. *
  474. * @see https://docs.master.co/css/breakpoints
  475. */
  476. declare const breakpointsMasterCss: {
  477. '3xs': number;
  478. '2xs': number;
  479. xs: number;
  480. sm: number;
  481. md: number;
  482. lg: number;
  483. xl: number;
  484. '2xl': number;
  485. '3xl': number;
  486. '4xl': number;
  487. };
  488. declare type Breakpoints<K extends string = string> = Record<K, number | string>;
  489. /**
  490. * Reactively viewport breakpoints
  491. *
  492. * @see https://vueuse.org/useBreakpoints
  493. * @param options
  494. */
  495. declare function useBreakpoints<K extends string>(breakpoints: Breakpoints<K>, options?: ConfigurableWindow): {
  496. greater(k: K): Ref<boolean>;
  497. greaterOrEqual: (k: K) => Ref<boolean>;
  498. smaller(k: K): Ref<boolean>;
  499. smallerOrEqual(k: K): Ref<boolean>;
  500. between(a: K, b: K): Ref<boolean>;
  501. isGreater(k: K): boolean;
  502. isGreaterOrEqual(k: K): boolean;
  503. isSmaller(k: K): boolean;
  504. isSmallerOrEqual(k: K): boolean;
  505. isInBetween(a: K, b: K): boolean;
  506. } & Record<K, Ref<boolean>>;
  507. declare type UseBreakpointsReturn<K extends string = string> = {
  508. greater: (k: K) => Ref<boolean>;
  509. greaterOrEqual: (k: K) => Ref<boolean>;
  510. smaller(k: K): Ref<boolean>;
  511. smallerOrEqual: (k: K) => Ref<boolean>;
  512. between(a: K, b: K): Ref<boolean>;
  513. isGreater(k: K): boolean;
  514. isGreaterOrEqual(k: K): boolean;
  515. isSmaller(k: K): boolean;
  516. isSmallerOrEqual(k: K): boolean;
  517. isInBetween(a: K, b: K): boolean;
  518. } & Record<K, Ref<boolean>>;
  519. interface UseBroadcastChannelOptions extends ConfigurableWindow {
  520. /**
  521. * The name of the channel.
  522. */
  523. name: string;
  524. }
  525. /**
  526. * Reactive BroadcastChannel
  527. *
  528. * @see https://vueuse.org/useBroadcastChannel
  529. * @see https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel
  530. * @param options
  531. *
  532. */
  533. declare const useBroadcastChannel: <D, P>(options: UseBroadcastChannelOptions) => UseBroadcastChannelReturn<D, P>;
  534. interface UseBroadcastChannelReturn<D, P> {
  535. isSupported: Ref<boolean>;
  536. channel: Ref<BroadcastChannel | undefined>;
  537. data: Ref<D>;
  538. post: (data: P) => void;
  539. close: () => void;
  540. error: Ref<Event | null>;
  541. isClosed: Ref<boolean>;
  542. }
  543. interface BrowserLocationState {
  544. trigger: string;
  545. state?: any;
  546. length?: number;
  547. hash?: string;
  548. host?: string;
  549. hostname?: string;
  550. href?: string;
  551. origin?: string;
  552. pathname?: string;
  553. port?: string;
  554. protocol?: string;
  555. search?: string;
  556. }
  557. /**
  558. * Reactive browser location.
  559. *
  560. * @see https://vueuse.org/useBrowserLocation
  561. * @param options
  562. */
  563. declare function useBrowserLocation({ window }?: ConfigurableWindow): vue_demi.Ref<{
  564. trigger: string;
  565. state?: any;
  566. length?: number | undefined;
  567. hash?: string | undefined;
  568. host?: string | undefined;
  569. hostname?: string | undefined;
  570. href?: string | undefined;
  571. origin?: string | undefined;
  572. pathname?: string | undefined;
  573. port?: string | undefined;
  574. protocol?: string | undefined;
  575. search?: string | undefined;
  576. }>;
  577. declare type UseBrowserLocationReturn = ReturnType<typeof useBrowserLocation>;
  578. declare function useCached<T>(refValue: Ref<T>, comparator?: (a: T, b: T) => boolean, watchOptions?: WatchOptions): Ref<T>;
  579. interface UseClipboardOptions<Source> extends ConfigurableNavigator {
  580. /**
  581. * Enabled reading for clipboard
  582. *
  583. * @default false
  584. */
  585. read?: boolean;
  586. /**
  587. * Copy source
  588. */
  589. source?: Source;
  590. /**
  591. * Milliseconds to reset state of `copied` ref
  592. *
  593. * @default 1500
  594. */
  595. copiedDuring?: number;
  596. /**
  597. * Whether fallback to document.execCommand('copy') if clipboard is undefined.
  598. *
  599. * @default false
  600. */
  601. legacy?: boolean;
  602. }
  603. interface UseClipboardReturn<Optional> {
  604. isSupported: Ref<boolean>;
  605. text: ComputedRef<string>;
  606. copied: ComputedRef<boolean>;
  607. copy: Optional extends true ? (text?: string) => Promise<void> : (text: string) => Promise<void>;
  608. }
  609. /**
  610. * Reactive Clipboard API.
  611. *
  612. * @see https://vueuse.org/useClipboard
  613. * @param options
  614. */
  615. declare function useClipboard(options?: UseClipboardOptions<undefined>): UseClipboardReturn<false>;
  616. declare function useClipboard(options: UseClipboardOptions<MaybeComputedRef<string>>): UseClipboardReturn<true>;
  617. interface UseClonedOptions<T = any> extends WatchOptions {
  618. /**
  619. * Custom clone function.
  620. *
  621. * By default, it use `JSON.parse(JSON.stringify(value))` to clone.
  622. */
  623. clone?: (source: T) => T;
  624. /**
  625. * Manually sync the ref
  626. *
  627. * @default false
  628. */
  629. manual?: boolean;
  630. }
  631. interface UseClonedReturn<T> {
  632. /**
  633. * Cloned ref
  634. */
  635. cloned: ComputedRef<T>;
  636. /**
  637. * Sync cloned data with source manually
  638. */
  639. sync: () => void;
  640. }
  641. declare type CloneFn<F, T = F> = (x: F) => T;
  642. declare function cloneFnJSON<T>(source: T): T;
  643. declare function useCloned<T>(source: MaybeComputedRef<T>, options?: UseClonedOptions): {
  644. cloned: vue_demi.Ref<vue_demi.UnwrapRef<T>>;
  645. sync: () => void;
  646. };
  647. interface StorageLikeAsync {
  648. getItem(key: string): Awaitable<string | null>;
  649. setItem(key: string, value: string): Awaitable<void>;
  650. removeItem(key: string): Awaitable<void>;
  651. }
  652. interface StorageLike {
  653. getItem(key: string): string | null;
  654. setItem(key: string, value: string): void;
  655. removeItem(key: string): void;
  656. }
  657. /**
  658. * @experimental The API is not finalized yet. It might not follow semver.
  659. */
  660. interface SSRHandlersMap {
  661. getDefaultStorage: () => StorageLike | undefined;
  662. getDefaultStorageAsync: () => StorageLikeAsync | undefined;
  663. updateHTMLAttrs: (selector: string, attribute: string, value: string) => void;
  664. }
  665. declare function getSSRHandler<T extends keyof SSRHandlersMap>(key: T, fallback: SSRHandlersMap[T]): SSRHandlersMap[T];
  666. declare function getSSRHandler<T extends keyof SSRHandlersMap>(key: T, fallback: SSRHandlersMap[T] | undefined): SSRHandlersMap[T] | undefined;
  667. declare function setSSRHandler<T extends keyof SSRHandlersMap>(key: T, fn: SSRHandlersMap[T]): void;
  668. interface Serializer<T> {
  669. read(raw: string): T;
  670. write(value: T): string;
  671. }
  672. interface SerializerAsync<T> {
  673. read(raw: string): Awaitable<T>;
  674. write(value: T): Awaitable<string>;
  675. }
  676. declare const StorageSerializers: Record<'boolean' | 'object' | 'number' | 'any' | 'string' | 'map' | 'set' | 'date', Serializer<any>>;
  677. interface UseStorageOptions<T> extends ConfigurableEventFilter, ConfigurableWindow, ConfigurableFlush {
  678. /**
  679. * Watch for deep changes
  680. *
  681. * @default true
  682. */
  683. deep?: boolean;
  684. /**
  685. * Listen to storage changes, useful for multiple tabs application
  686. *
  687. * @default true
  688. */
  689. listenToStorageChanges?: boolean;
  690. /**
  691. * Write the default value to the storage when it does not exist
  692. *
  693. * @default true
  694. */
  695. writeDefaults?: boolean;
  696. /**
  697. * Merge the default value with the value read from the storage.
  698. *
  699. * When setting it to true, it will perform a **shallow merge** for objects.
  700. * You can pass a function to perform custom merge (e.g. deep merge), for example:
  701. *
  702. * @default false
  703. */
  704. mergeDefaults?: boolean | ((storageValue: T, defaults: T) => T);
  705. /**
  706. * Custom data serialization
  707. */
  708. serializer?: Serializer<T>;
  709. /**
  710. * On error callback
  711. *
  712. * Default log error to `console.error`
  713. */
  714. onError?: (error: unknown) => void;
  715. /**
  716. * Use shallow ref as reference
  717. *
  718. * @default false
  719. */
  720. shallow?: boolean;
  721. }
  722. declare function useStorage(key: string, defaults: MaybeComputedRef<string>, storage?: StorageLike, options?: UseStorageOptions<string>): RemovableRef<string>;
  723. declare function useStorage(key: string, defaults: MaybeComputedRef<boolean>, storage?: StorageLike, options?: UseStorageOptions<boolean>): RemovableRef<boolean>;
  724. declare function useStorage(key: string, defaults: MaybeComputedRef<number>, storage?: StorageLike, options?: UseStorageOptions<number>): RemovableRef<number>;
  725. declare function useStorage<T>(key: string, defaults: MaybeComputedRef<T>, storage?: StorageLike, options?: UseStorageOptions<T>): RemovableRef<T>;
  726. declare function useStorage<T = unknown>(key: string, defaults: MaybeComputedRef<null>, storage?: StorageLike, options?: UseStorageOptions<T>): RemovableRef<T>;
  727. declare type BasicColorSchema = 'light' | 'dark' | 'auto';
  728. interface UseColorModeOptions<T extends string = BasicColorSchema> extends UseStorageOptions<T | BasicColorSchema> {
  729. /**
  730. * CSS Selector for the target element applying to
  731. *
  732. * @default 'html'
  733. */
  734. selector?: string;
  735. /**
  736. * HTML attribute applying the target element
  737. *
  738. * @default 'class'
  739. */
  740. attribute?: string;
  741. /**
  742. * The initial color mode
  743. *
  744. * @default 'auto'
  745. */
  746. initialValue?: T | BasicColorSchema;
  747. /**
  748. * Prefix when adding value to the attribute
  749. */
  750. modes?: Partial<Record<T | BasicColorSchema, string>>;
  751. /**
  752. * A custom handler for handle the updates.
  753. * When specified, the default behavior will be overridden.
  754. *
  755. * @default undefined
  756. */
  757. onChanged?: (mode: T | BasicColorSchema, defaultHandler: ((mode: T | BasicColorSchema) => void)) => void;
  758. /**
  759. * Custom storage ref
  760. *
  761. * When provided, `useStorage` will be skipped
  762. */
  763. storageRef?: Ref<T | BasicColorSchema>;
  764. /**
  765. * Key to persist the data into localStorage/sessionStorage.
  766. *
  767. * Pass `null` to disable persistence
  768. *
  769. * @default 'vueuse-color-scheme'
  770. */
  771. storageKey?: string | null;
  772. /**
  773. * Storage object, can be localStorage or sessionStorage
  774. *
  775. * @default localStorage
  776. */
  777. storage?: StorageLike;
  778. /**
  779. * Emit `auto` mode from state
  780. *
  781. * When set to `true`, preferred mode won't be translated into `light` or `dark`.
  782. * This is useful when the fact that `auto` mode was selected needs to be known.
  783. *
  784. * @default undefined
  785. */
  786. emitAuto?: boolean;
  787. }
  788. /**
  789. * Reactive color mode with auto data persistence.
  790. *
  791. * @see https://vueuse.org/useColorMode
  792. * @param options
  793. */
  794. declare function useColorMode<T extends string = BasicColorSchema>(options?: UseColorModeOptions<T>): vue_demi.WritableComputedRef<BasicColorSchema | T>;
  795. declare type UseConfirmDialogRevealResult<C, D> = {
  796. data?: C;
  797. isCanceled: false;
  798. } | {
  799. data?: D;
  800. isCanceled: true;
  801. };
  802. interface UseConfirmDialogReturn<RevealData, ConfirmData, CancelData> {
  803. /**
  804. * Revealing state
  805. */
  806. isRevealed: ComputedRef<boolean>;
  807. /**
  808. * Opens the dialog.
  809. * Create promise and return it. Triggers `onReveal` hook.
  810. */
  811. reveal: (data?: RevealData) => Promise<UseConfirmDialogRevealResult<ConfirmData, CancelData>>;
  812. /**
  813. * Confirms and closes the dialog. Triggers a callback inside `onConfirm` hook.
  814. * Resolves promise from `reveal()` with `data` and `isCanceled` ref with `false` value.
  815. * Can accept any data and to pass it to `onConfirm` hook.
  816. */
  817. confirm: (data?: ConfirmData) => void;
  818. /**
  819. * Cancels and closes the dialog. Triggers a callback inside `onCancel` hook.
  820. * Resolves promise from `reveal()` with `data` and `isCanceled` ref with `true` value.
  821. * Can accept any data and to pass it to `onCancel` hook.
  822. */
  823. cancel: (data?: CancelData) => void;
  824. /**
  825. * Event Hook to be triggered right before dialog creating.
  826. */
  827. onReveal: EventHookOn<RevealData>;
  828. /**
  829. * Event Hook to be called on `confirm()`.
  830. * Gets data object from `confirm` function.
  831. */
  832. onConfirm: EventHookOn<ConfirmData>;
  833. /**
  834. * Event Hook to be called on `cancel()`.
  835. * Gets data object from `cancel` function.
  836. */
  837. onCancel: EventHookOn<CancelData>;
  838. }
  839. /**
  840. * Hooks for creating confirm dialogs. Useful for modal windows, popups and logins.
  841. *
  842. * @see https://vueuse.org/useConfirmDialog/
  843. * @param revealed `boolean` `ref` that handles a modal window
  844. */
  845. declare function useConfirmDialog<RevealData = any, ConfirmData = any, CancelData = any>(revealed?: Ref<boolean>): UseConfirmDialogReturn<RevealData, ConfirmData, CancelData>;
  846. interface UseCssVarOptions extends ConfigurableWindow {
  847. initialValue?: string;
  848. }
  849. /**
  850. * Manipulate CSS variables.
  851. *
  852. * @see https://vueuse.org/useCssVar
  853. * @param prop
  854. * @param target
  855. * @param initialValue
  856. * @param options
  857. */
  858. declare function useCssVar(prop: MaybeComputedRef<string>, target?: MaybeElementRef, { window, initialValue }?: UseCssVarOptions): vue_demi.Ref<string>;
  859. declare function useCurrentElement<T extends Element = Element>(): _vueuse_shared.ComputedRefWithControl<T>;
  860. interface UseCycleListOptions<T> {
  861. /**
  862. * The initial value of the state.
  863. * A ref can be provided to reuse.
  864. */
  865. initialValue?: MaybeRef<T>;
  866. /**
  867. * The default index when
  868. */
  869. fallbackIndex?: number;
  870. /**
  871. * Custom function to get the index of the current value.
  872. */
  873. getIndexOf?: (value: T, list: T[]) => number;
  874. }
  875. /**
  876. * Cycle through a list of items
  877. *
  878. * @see https://vueuse.org/useCycleList
  879. */
  880. declare function useCycleList<T>(list: T[], options?: UseCycleListOptions<T>): UseCycleListReturn<T>;
  881. interface UseCycleListReturn<T> {
  882. state: Ref<T>;
  883. index: Ref<number>;
  884. next: (n?: number) => T;
  885. prev: (n?: number) => T;
  886. }
  887. interface UseDarkOptions extends Omit<UseColorModeOptions<BasicColorSchema>, 'modes' | 'onChanged'> {
  888. /**
  889. * Value applying to the target element when isDark=true
  890. *
  891. * @default 'dark'
  892. */
  893. valueDark?: string;
  894. /**
  895. * Value applying to the target element when isDark=false
  896. *
  897. * @default ''
  898. */
  899. valueLight?: string;
  900. /**
  901. * A custom handler for handle the updates.
  902. * When specified, the default behavior will be overridden.
  903. *
  904. * @default undefined
  905. */
  906. onChanged?: (isDark: boolean) => void;
  907. }
  908. /**
  909. * Reactive dark mode with auto data persistence.
  910. *
  911. * @see https://vueuse.org/useDark
  912. * @param options
  913. */
  914. declare function useDark(options?: UseDarkOptions): vue_demi.WritableComputedRef<boolean>;
  915. interface UseRefHistoryRecord<T> {
  916. snapshot: T;
  917. timestamp: number;
  918. }
  919. interface UseManualRefHistoryOptions<Raw, Serialized = Raw> {
  920. /**
  921. * Maximum number of history to be kept. Default to unlimited.
  922. */
  923. capacity?: number;
  924. /**
  925. * Clone when taking a snapshot, shortcut for dump: JSON.parse(JSON.stringify(value)).
  926. * Default to false
  927. *
  928. * @default false
  929. */
  930. clone?: boolean | CloneFn<Raw>;
  931. /**
  932. * Serialize data into the history
  933. */
  934. dump?: (v: Raw) => Serialized;
  935. /**
  936. * Deserialize data from the history
  937. */
  938. parse?: (v: Serialized) => Raw;
  939. /**
  940. * Deserialize data from the history
  941. */
  942. setSource?: (source: Ref<Raw>, v: Raw) => void;
  943. }
  944. interface UseManualRefHistoryReturn<Raw, Serialized> {
  945. /**
  946. * Bypassed tracking ref from the argument
  947. */
  948. source: Ref<Raw>;
  949. /**
  950. * An array of history records for undo, newest comes to first
  951. */
  952. history: Ref<UseRefHistoryRecord<Serialized>[]>;
  953. /**
  954. * Last history point, source can be different if paused
  955. */
  956. last: Ref<UseRefHistoryRecord<Serialized>>;
  957. /**
  958. * Same as {@link UseManualRefHistoryReturn.history | history}
  959. */
  960. undoStack: Ref<UseRefHistoryRecord<Serialized>[]>;
  961. /**
  962. * Records array for redo
  963. */
  964. redoStack: Ref<UseRefHistoryRecord<Serialized>[]>;
  965. /**
  966. * A ref representing if undo is possible (non empty undoStack)
  967. */
  968. canUndo: Ref<boolean>;
  969. /**
  970. * A ref representing if redo is possible (non empty redoStack)
  971. */
  972. canRedo: Ref<boolean>;
  973. /**
  974. * Undo changes
  975. */
  976. undo: () => void;
  977. /**
  978. * Redo changes
  979. */
  980. redo: () => void;
  981. /**
  982. * Clear all the history
  983. */
  984. clear: () => void;
  985. /**
  986. * Create new a new history record
  987. */
  988. commit: () => void;
  989. /**
  990. * Reset ref's value with latest history
  991. */
  992. reset: () => void;
  993. }
  994. /**
  995. * Track the change history of a ref, also provides undo and redo functionality.
  996. *
  997. * @see https://vueuse.org/useManualRefHistory
  998. * @param source
  999. * @param options
  1000. */
  1001. declare function useManualRefHistory<Raw, Serialized = Raw>(source: Ref<Raw>, options?: UseManualRefHistoryOptions<Raw, Serialized>): UseManualRefHistoryReturn<Raw, Serialized>;
  1002. interface UseRefHistoryOptions<Raw, Serialized = Raw> extends ConfigurableEventFilter {
  1003. /**
  1004. * Watch for deep changes, default to false
  1005. *
  1006. * When set to true, it will also create clones for values store in the history
  1007. *
  1008. * @default false
  1009. */
  1010. deep?: boolean;
  1011. /**
  1012. * The flush option allows for greater control over the timing of a history point, default to 'pre'
  1013. *
  1014. * Possible values: 'pre', 'post', 'sync'
  1015. * It works in the same way as the flush option in watch and watch effect in vue reactivity
  1016. *
  1017. * @default 'pre'
  1018. */
  1019. flush?: 'pre' | 'post' | 'sync';
  1020. /**
  1021. * Maximum number of history to be kept. Default to unlimited.
  1022. */
  1023. capacity?: number;
  1024. /**
  1025. * Clone when taking a snapshot, shortcut for dump: JSON.parse(JSON.stringify(value)).
  1026. * Default to false
  1027. *
  1028. * @default false
  1029. */
  1030. clone?: boolean | CloneFn<Raw>;
  1031. /**
  1032. * Serialize data into the history
  1033. */
  1034. dump?: (v: Raw) => Serialized;
  1035. /**
  1036. * Deserialize data from the history
  1037. */
  1038. parse?: (v: Serialized) => Raw;
  1039. }
  1040. interface UseRefHistoryReturn<Raw, Serialized> extends UseManualRefHistoryReturn<Raw, Serialized> {
  1041. /**
  1042. * A ref representing if the tracking is enabled
  1043. */
  1044. isTracking: Ref<boolean>;
  1045. /**
  1046. * Pause change tracking
  1047. */
  1048. pause(): void;
  1049. /**
  1050. * Resume change tracking
  1051. *
  1052. * @param [commit] if true, a history record will be create after resuming
  1053. */
  1054. resume(commit?: boolean): void;
  1055. /**
  1056. * A sugar for auto pause and auto resuming within a function scope
  1057. *
  1058. * @param fn
  1059. */
  1060. batch(fn: (cancel: Fn) => void): void;
  1061. /**
  1062. * Clear the data and stop the watch
  1063. */
  1064. dispose(): void;
  1065. }
  1066. /**
  1067. * Track the change history of a ref, also provides undo and redo functionality.
  1068. *
  1069. * @see https://vueuse.org/useRefHistory
  1070. * @param source
  1071. * @param options
  1072. */
  1073. declare function useRefHistory<Raw, Serialized = Raw>(source: Ref<Raw>, options?: UseRefHistoryOptions<Raw, Serialized>): UseRefHistoryReturn<Raw, Serialized>;
  1074. /**
  1075. * Shorthand for [useRefHistory](https://vueuse.org/useRefHistory) with debounce filter.
  1076. *
  1077. * @see https://vueuse.org/useDebouncedRefHistory
  1078. * @param source
  1079. * @param options
  1080. */
  1081. declare function useDebouncedRefHistory<Raw, Serialized = Raw>(source: Ref<Raw>, options?: Omit<UseRefHistoryOptions<Raw, Serialized>, 'eventFilter'> & {
  1082. debounce?: MaybeComputedRef<number>;
  1083. }): UseRefHistoryReturn<Raw, Serialized>;
  1084. interface DeviceMotionOptions extends ConfigurableWindow, ConfigurableEventFilter {
  1085. }
  1086. /**
  1087. * Reactive DeviceMotionEvent.
  1088. *
  1089. * @see https://vueuse.org/useDeviceMotion
  1090. * @param options
  1091. */
  1092. declare function useDeviceMotion(options?: DeviceMotionOptions): {
  1093. acceleration: Ref<DeviceMotionEventAcceleration | null>;
  1094. accelerationIncludingGravity: Ref<DeviceMotionEventAcceleration | null>;
  1095. rotationRate: Ref<DeviceMotionEventRotationRate | null>;
  1096. interval: Ref<number>;
  1097. };
  1098. declare type UseDeviceMotionReturn = ReturnType<typeof useDeviceMotion>;
  1099. /**
  1100. * Reactive DeviceOrientationEvent.
  1101. *
  1102. * @see https://vueuse.org/useDeviceOrientation
  1103. * @param options
  1104. */
  1105. declare function useDeviceOrientation(options?: ConfigurableWindow): {
  1106. isSupported: Ref<boolean>;
  1107. isAbsolute: Ref<boolean>;
  1108. alpha: Ref<number | null>;
  1109. beta: Ref<number | null>;
  1110. gamma: Ref<number | null>;
  1111. };
  1112. declare type UseDeviceOrientationReturn = ReturnType<typeof useDeviceOrientation>;
  1113. /**
  1114. * Reactively track `window.devicePixelRatio`.
  1115. *
  1116. * @see https://vueuse.org/useDevicePixelRatio
  1117. * @param options
  1118. */
  1119. declare function useDevicePixelRatio({ window, }?: ConfigurableWindow): {
  1120. pixelRatio: vue_demi.Ref<number>;
  1121. };
  1122. declare type UseDevicePixelRatioReturn = ReturnType<typeof useDevicePixelRatio>;
  1123. interface UseDevicesListOptions extends ConfigurableNavigator {
  1124. onUpdated?: (devices: MediaDeviceInfo[]) => void;
  1125. /**
  1126. * Request for permissions immediately if it's not granted,
  1127. * otherwise label and deviceIds could be empty
  1128. *
  1129. * @default false
  1130. */
  1131. requestPermissions?: boolean;
  1132. /**
  1133. * Request for types of media permissions
  1134. *
  1135. * @default { audio: true, video: true }
  1136. */
  1137. constraints?: MediaStreamConstraints;
  1138. }
  1139. interface UseDevicesListReturn {
  1140. /**
  1141. * All devices
  1142. */
  1143. devices: Ref<MediaDeviceInfo[]>;
  1144. videoInputs: ComputedRef<MediaDeviceInfo[]>;
  1145. audioInputs: ComputedRef<MediaDeviceInfo[]>;
  1146. audioOutputs: ComputedRef<MediaDeviceInfo[]>;
  1147. permissionGranted: Ref<boolean>;
  1148. ensurePermissions: () => Promise<boolean>;
  1149. isSupported: Ref<boolean>;
  1150. }
  1151. /**
  1152. * Reactive `enumerateDevices` listing available input/output devices
  1153. *
  1154. * @see https://vueuse.org/useDevicesList
  1155. * @param options
  1156. */
  1157. declare function useDevicesList(options?: UseDevicesListOptions): UseDevicesListReturn;
  1158. interface UseDisplayMediaOptions extends ConfigurableNavigator {
  1159. /**
  1160. * If the stream is enabled
  1161. * @default false
  1162. */
  1163. enabled?: MaybeRef<boolean>;
  1164. /**
  1165. * If the stream video media constraints
  1166. */
  1167. video?: boolean | MediaTrackConstraints | undefined;
  1168. /**
  1169. * If the stream audio media constraints
  1170. */
  1171. audio?: boolean | MediaTrackConstraints | undefined;
  1172. }
  1173. /**
  1174. * Reactive `mediaDevices.getDisplayMedia` streaming
  1175. *
  1176. * @see https://vueuse.org/useDisplayMedia
  1177. * @param options
  1178. */
  1179. declare function useDisplayMedia(options?: UseDisplayMediaOptions): {
  1180. isSupported: Ref<boolean>;
  1181. stream: Ref<MediaStream | undefined>;
  1182. start: () => Promise<MediaStream | undefined>;
  1183. stop: () => void;
  1184. enabled: Ref<boolean>;
  1185. };
  1186. declare type UseDisplayMediaReturn = ReturnType<typeof useDisplayMedia>;
  1187. /**
  1188. * Reactively track `document.visibilityState`.
  1189. *
  1190. * @see https://vueuse.org/useDocumentVisibility
  1191. * @param options
  1192. */
  1193. declare function useDocumentVisibility({ document }?: ConfigurableDocument): Ref<DocumentVisibilityState>;
  1194. interface Position {
  1195. x: number;
  1196. y: number;
  1197. }
  1198. interface RenderableComponent {
  1199. /**
  1200. * The element that the component should be rendered as
  1201. *
  1202. * @default 'div'
  1203. */
  1204. as?: Object | string;
  1205. }
  1206. declare type PointerType = 'mouse' | 'touch' | 'pen';
  1207. interface UseDraggableOptions {
  1208. /**
  1209. * Only start the dragging when click on the element directly
  1210. *
  1211. * @default false
  1212. */
  1213. exact?: MaybeComputedRef<boolean>;
  1214. /**
  1215. * Prevent events defaults
  1216. *
  1217. * @default false
  1218. */
  1219. preventDefault?: MaybeComputedRef<boolean>;
  1220. /**
  1221. * Prevent events propagation
  1222. *
  1223. * @default false
  1224. */
  1225. stopPropagation?: MaybeComputedRef<boolean>;
  1226. /**
  1227. * Element to attach `pointermove` and `pointerup` events to.
  1228. *
  1229. * @default window
  1230. */
  1231. draggingElement?: MaybeComputedRef<HTMLElement | SVGElement | Window | Document | null | undefined>;
  1232. /**
  1233. * Handle that triggers the drag event
  1234. *
  1235. * @default target
  1236. */
  1237. handle?: MaybeComputedRef<HTMLElement | SVGElement | null | undefined>;
  1238. /**
  1239. * Pointer types that listen to.
  1240. *
  1241. * @default ['mouse', 'touch', 'pen']
  1242. */
  1243. pointerTypes?: PointerType[];
  1244. /**
  1245. * Initial position of the element.
  1246. *
  1247. * @default { x: 0, y: 0 }
  1248. */
  1249. initialValue?: MaybeComputedRef<Position>;
  1250. /**
  1251. * Callback when the dragging starts. Return `false` to prevent dragging.
  1252. */
  1253. onStart?: (position: Position, event: PointerEvent) => void | false;
  1254. /**
  1255. * Callback during dragging.
  1256. */
  1257. onMove?: (position: Position, event: PointerEvent) => void;
  1258. /**
  1259. * Callback when dragging end.
  1260. */
  1261. onEnd?: (position: Position, event: PointerEvent) => void;
  1262. }
  1263. /**
  1264. * Make elements draggable.
  1265. *
  1266. * @see https://vueuse.org/useDraggable
  1267. * @param target
  1268. * @param options
  1269. */
  1270. declare function useDraggable(target: MaybeComputedRef<HTMLElement | SVGElement | null | undefined>, options?: UseDraggableOptions): {
  1271. position: vue_demi.Ref<{
  1272. x: number;
  1273. y: number;
  1274. }>;
  1275. isDragging: vue_demi.ComputedRef<boolean>;
  1276. style: vue_demi.ComputedRef<string>;
  1277. x: vue_demi.Ref<number>;
  1278. y: vue_demi.Ref<number>;
  1279. };
  1280. declare type UseDraggableReturn = ReturnType<typeof useDraggable>;
  1281. interface UseDropZoneReturn {
  1282. isOverDropZone: Ref<boolean>;
  1283. }
  1284. declare function useDropZone(target: MaybeComputedRef<HTMLElement | null | undefined>, onDrop?: (files: File[] | null) => void): UseDropZoneReturn;
  1285. interface UseElementBoundingOptions {
  1286. /**
  1287. * Reset values to 0 on component unmounted
  1288. *
  1289. * @default true
  1290. */
  1291. reset?: boolean;
  1292. /**
  1293. * Listen to window resize event
  1294. *
  1295. * @default true
  1296. */
  1297. windowResize?: boolean;
  1298. /**
  1299. * Listen to window scroll event
  1300. *
  1301. * @default true
  1302. */
  1303. windowScroll?: boolean;
  1304. /**
  1305. * Immediately call update on component mounted
  1306. *
  1307. * @default true
  1308. */
  1309. immediate?: boolean;
  1310. }
  1311. /**
  1312. * Reactive bounding box of an HTML element.
  1313. *
  1314. * @see https://vueuse.org/useElementBounding
  1315. * @param target
  1316. */
  1317. declare function useElementBounding(target: MaybeComputedElementRef, options?: UseElementBoundingOptions): {
  1318. height: vue_demi.Ref<number>;
  1319. bottom: vue_demi.Ref<number>;
  1320. left: vue_demi.Ref<number>;
  1321. right: vue_demi.Ref<number>;
  1322. top: vue_demi.Ref<number>;
  1323. width: vue_demi.Ref<number>;
  1324. x: vue_demi.Ref<number>;
  1325. y: vue_demi.Ref<number>;
  1326. update: () => void;
  1327. };
  1328. declare type UseElementBoundingReturn = ReturnType<typeof useElementBounding>;
  1329. interface UseElementByPointOptions {
  1330. x: MaybeComputedRef<number>;
  1331. y: MaybeComputedRef<number>;
  1332. }
  1333. /**
  1334. * Reactive element by point.
  1335. *
  1336. * @see https://vueuse.org/useElementByPoint
  1337. * @param options - UseElementByPointOptions
  1338. */
  1339. declare function useElementByPoint(options: UseElementByPointOptions): {
  1340. isActive: vue_demi.Ref<boolean>;
  1341. pause: _vueuse_shared.Fn;
  1342. resume: _vueuse_shared.Fn;
  1343. element: vue_demi.Ref<HTMLElement | null>;
  1344. };
  1345. declare type UseElementByPointReturn = ReturnType<typeof useElementByPoint>;
  1346. declare function useElementHover(el: MaybeComputedRef<EventTarget | null | undefined>): Ref<boolean>;
  1347. interface ResizeObserverSize {
  1348. readonly inlineSize: number;
  1349. readonly blockSize: number;
  1350. }
  1351. interface ResizeObserverEntry {
  1352. readonly target: Element;
  1353. readonly contentRect: DOMRectReadOnly;
  1354. readonly borderBoxSize?: ReadonlyArray<ResizeObserverSize>;
  1355. readonly contentBoxSize?: ReadonlyArray<ResizeObserverSize>;
  1356. readonly devicePixelContentBoxSize?: ReadonlyArray<ResizeObserverSize>;
  1357. }
  1358. declare type ResizeObserverCallback = (entries: ReadonlyArray<ResizeObserverEntry>, observer: ResizeObserver) => void;
  1359. interface UseResizeObserverOptions extends ConfigurableWindow {
  1360. /**
  1361. * Sets which box model the observer will observe changes to. Possible values
  1362. * are `content-box` (the default), `border-box` and `device-pixel-content-box`.
  1363. *
  1364. * @default 'content-box'
  1365. */
  1366. box?: ResizeObserverBoxOptions;
  1367. }
  1368. declare class ResizeObserver {
  1369. constructor(callback: ResizeObserverCallback);
  1370. disconnect(): void;
  1371. observe(target: Element, options?: UseResizeObserverOptions): void;
  1372. unobserve(target: Element): void;
  1373. }
  1374. /**
  1375. * Reports changes to the dimensions of an Element's content or the border-box
  1376. *
  1377. * @see https://vueuse.org/useResizeObserver
  1378. * @param target
  1379. * @param callback
  1380. * @param options
  1381. */
  1382. declare function useResizeObserver(target: MaybeComputedElementRef, callback: ResizeObserverCallback, options?: UseResizeObserverOptions): {
  1383. isSupported: vue_demi.Ref<boolean>;
  1384. stop: () => void;
  1385. };
  1386. declare type UseResizeObserverReturn = ReturnType<typeof useResizeObserver>;
  1387. interface ElementSize {
  1388. width: number;
  1389. height: number;
  1390. }
  1391. /**
  1392. * Reactive size of an HTML element.
  1393. *
  1394. * @see https://vueuse.org/useElementSize
  1395. * @param target
  1396. * @param callback
  1397. * @param options
  1398. */
  1399. declare function useElementSize(target: MaybeComputedElementRef, initialSize?: ElementSize, options?: UseResizeObserverOptions): {
  1400. width: vue_demi.Ref<number>;
  1401. height: vue_demi.Ref<number>;
  1402. };
  1403. declare type UseElementSizeReturn = ReturnType<typeof useElementSize>;
  1404. interface UseElementVisibilityOptions extends ConfigurableWindow {
  1405. scrollTarget?: MaybeComputedRef<HTMLElement | undefined | null>;
  1406. }
  1407. /**
  1408. * Tracks the visibility of an element within the viewport.
  1409. *
  1410. * @see https://vueuse.org/useElementVisibility
  1411. * @param element
  1412. * @param options
  1413. */
  1414. declare function useElementVisibility(element: MaybeComputedElementRef, { window, scrollTarget }?: UseElementVisibilityOptions): vue_demi.Ref<boolean>;
  1415. declare type EventBusListener<T = unknown, P = any> = (event: T, payload?: P) => void;
  1416. declare type EventBusEvents<T, P = any> = EventBusListener<T, P>[];
  1417. interface EventBusKey<T> extends Symbol {
  1418. }
  1419. declare type EventBusIdentifier<T = unknown> = EventBusKey<T> | string | number;
  1420. interface UseEventBusReturn<T, P> {
  1421. /**
  1422. * Subscribe to an event. When calling emit, the listeners will execute.
  1423. * @param listener watch listener.
  1424. * @returns a stop function to remove the current callback.
  1425. */
  1426. on: (listener: EventBusListener<T, P>) => Fn;
  1427. /**
  1428. * Similar to `on`, but only fires once
  1429. * @param listener watch listener.
  1430. * @returns a stop function to remove the current callback.
  1431. */
  1432. once: (listener: EventBusListener<T, P>) => Fn;
  1433. /**
  1434. * Emit an event, the corresponding event listeners will execute.
  1435. * @param event data sent.
  1436. */
  1437. emit: (event?: T, payload?: P) => void;
  1438. /**
  1439. * Remove the corresponding listener.
  1440. * @param listener watch listener.
  1441. */
  1442. off: (listener: EventBusListener<T>) => void;
  1443. /**
  1444. * Clear all events
  1445. */
  1446. reset: () => void;
  1447. }
  1448. declare function useEventBus<T = unknown, P = any>(key: EventBusIdentifier<T>): UseEventBusReturn<T, P>;
  1449. interface InferEventTarget<Events> {
  1450. addEventListener(event: Events, fn?: any, options?: any): any;
  1451. removeEventListener(event: Events, fn?: any, options?: any): any;
  1452. }
  1453. declare type WindowEventName = keyof WindowEventMap;
  1454. declare type DocumentEventName = keyof DocumentEventMap;
  1455. interface GeneralEventListener<E = Event> {
  1456. (evt: E): void;
  1457. }
  1458. /**
  1459. * Register using addEventListener on mounted, and removeEventListener automatically on unmounted.
  1460. *
  1461. * Overload 1: Omitted Window target
  1462. *
  1463. * @see https://vueuse.org/useEventListener
  1464. * @param event
  1465. * @param listener
  1466. * @param options
  1467. */
  1468. declare function useEventListener<E extends keyof WindowEventMap>(event: Arrayable<E>, listener: Arrayable<(this: Window, ev: WindowEventMap[E]) => any>, options?: boolean | AddEventListenerOptions): Fn;
  1469. /**
  1470. * Register using addEventListener on mounted, and removeEventListener automatically on unmounted.
  1471. *
  1472. * Overload 2: Explicitly Window target
  1473. *
  1474. * @see https://vueuse.org/useEventListener
  1475. * @param target
  1476. * @param event
  1477. * @param listener
  1478. * @param options
  1479. */
  1480. declare function useEventListener<E extends keyof WindowEventMap>(target: Window, event: Arrayable<E>, listener: Arrayable<(this: Window, ev: WindowEventMap[E]) => any>, options?: boolean | AddEventListenerOptions): Fn;
  1481. /**
  1482. * Register using addEventListener on mounted, and removeEventListener automatically on unmounted.
  1483. *
  1484. * Overload 3: Explicitly Document target
  1485. *
  1486. * @see https://vueuse.org/useEventListener
  1487. * @param target
  1488. * @param event
  1489. * @param listener
  1490. * @param options
  1491. */
  1492. declare function useEventListener<E extends keyof DocumentEventMap>(target: Document, event: Arrayable<E>, listener: Arrayable<(this: Document, ev: DocumentEventMap[E]) => any>, options?: boolean | AddEventListenerOptions): Fn;
  1493. /**
  1494. * Register using addEventListener on mounted, and removeEventListener automatically on unmounted.
  1495. *
  1496. * Overload 4: Custom event target with event type infer
  1497. *
  1498. * @see https://vueuse.org/useEventListener
  1499. * @param target
  1500. * @param event
  1501. * @param listener
  1502. * @param options
  1503. */
  1504. declare function useEventListener<Names extends string, EventType = Event>(target: InferEventTarget<Names>, event: Arrayable<Names>, listener: Arrayable<GeneralEventListener<EventType>>, options?: boolean | AddEventListenerOptions): Fn;
  1505. /**
  1506. * Register using addEventListener on mounted, and removeEventListener automatically on unmounted.
  1507. *
  1508. * Overload 5: Custom event target fallback
  1509. *
  1510. * @see https://vueuse.org/useEventListener
  1511. * @param target
  1512. * @param event
  1513. * @param listener
  1514. * @param options
  1515. */
  1516. declare function useEventListener<EventType = Event>(target: MaybeComputedRef<EventTarget | null | undefined>, event: Arrayable<string>, listener: Arrayable<GeneralEventListener<EventType>>, options?: boolean | AddEventListenerOptions): Fn;
  1517. declare type UseEventSourceOptions = EventSourceInit;
  1518. /**
  1519. * Reactive wrapper for EventSource.
  1520. *
  1521. * @see https://vueuse.org/useEventSource
  1522. * @see https://developer.mozilla.org/en-US/docs/Web/API/EventSource/EventSource EventSource
  1523. * @param url
  1524. * @param events
  1525. * @param options
  1526. */
  1527. declare function useEventSource(url: string, events?: Array<string>, options?: UseEventSourceOptions): {
  1528. eventSource: Ref<EventSource | null>;
  1529. event: Ref<string | null>;
  1530. data: Ref<string | null>;
  1531. status: Ref<"OPEN" | "CONNECTING" | "CLOSED">;
  1532. error: Ref<Event | null>;
  1533. close: () => void;
  1534. };
  1535. declare type UseEventSourceReturn = ReturnType<typeof useEventSource>;
  1536. interface EyeDropperOpenOptions {
  1537. /**
  1538. * @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
  1539. */
  1540. signal?: AbortSignal;
  1541. }
  1542. interface EyeDropper {
  1543. new (): EyeDropper;
  1544. open: (options?: EyeDropperOpenOptions) => Promise<{
  1545. sRGBHex: string;
  1546. }>;
  1547. [Symbol.toStringTag]: 'EyeDropper';
  1548. }
  1549. interface UseEyeDropperOptions {
  1550. /**
  1551. * Initial sRGBHex.
  1552. *
  1553. * @default ''
  1554. */
  1555. initialValue?: string;
  1556. }
  1557. /**
  1558. * Reactive [EyeDropper API](https://developer.mozilla.org/en-US/docs/Web/API/EyeDropper_API)
  1559. *
  1560. * @see https://vueuse.org/useEyeDropper
  1561. * @param initialValue string
  1562. */
  1563. declare function useEyeDropper(options?: UseEyeDropperOptions): {
  1564. isSupported: vue_demi.Ref<boolean>;
  1565. sRGBHex: vue_demi.Ref<string>;
  1566. open: (openOptions?: EyeDropperOpenOptions) => Promise<{
  1567. sRGBHex: string;
  1568. } | undefined>;
  1569. };
  1570. declare type UseEyeDropperReturn = ReturnType<typeof useEyeDropper>;
  1571. interface UseFaviconOptions extends ConfigurableDocument {
  1572. baseUrl?: string;
  1573. rel?: string;
  1574. }
  1575. /**
  1576. * Reactive favicon.
  1577. *
  1578. * @see https://vueuse.org/useFavicon
  1579. * @param newIcon
  1580. * @param options
  1581. */
  1582. declare function useFavicon(newIcon: MaybeReadonlyRef<string | null | undefined>, options?: UseFaviconOptions): ComputedRef<string | null | undefined>;
  1583. declare function useFavicon(newIcon?: MaybeRef<string | null | undefined>, options?: UseFaviconOptions): Ref<string | null | undefined>;
  1584. declare type UseFaviconReturn = ReturnType<typeof useFavicon>;
  1585. interface UseFetchReturn<T> {
  1586. /**
  1587. * Indicates if the fetch request has finished
  1588. */
  1589. isFinished: Ref<boolean>;
  1590. /**
  1591. * The statusCode of the HTTP fetch response
  1592. */
  1593. statusCode: Ref<number | null>;
  1594. /**
  1595. * The raw response of the fetch response
  1596. */
  1597. response: Ref<Response | null>;
  1598. /**
  1599. * Any fetch errors that may have occurred
  1600. */
  1601. error: Ref<any>;
  1602. /**
  1603. * The fetch response body, may either be JSON or text
  1604. */
  1605. data: Ref<T | null>;
  1606. /**
  1607. * Indicates if the request is currently being fetched.
  1608. */
  1609. isFetching: Ref<boolean>;
  1610. /**
  1611. * Indicates if the fetch request is able to be aborted
  1612. */
  1613. canAbort: ComputedRef<boolean>;
  1614. /**
  1615. * Indicates if the fetch request was aborted
  1616. */
  1617. aborted: Ref<boolean>;
  1618. /**
  1619. * Abort the fetch request
  1620. */
  1621. abort: Fn;
  1622. /**
  1623. * Manually call the fetch
  1624. * (default not throwing error)
  1625. */
  1626. execute: (throwOnFailed?: boolean) => Promise<any>;
  1627. /**
  1628. * Fires after the fetch request has finished
  1629. */
  1630. onFetchResponse: EventHookOn<Response>;
  1631. /**
  1632. * Fires after a fetch request error
  1633. */
  1634. onFetchError: EventHookOn;
  1635. /**
  1636. * Fires after a fetch has completed
  1637. */
  1638. onFetchFinally: EventHookOn;
  1639. get(): UseFetchReturn<T> & PromiseLike<UseFetchReturn<T>>;
  1640. post(payload?: MaybeComputedRef<unknown>, type?: string): UseFetchReturn<T> & PromiseLike<UseFetchReturn<T>>;
  1641. put(payload?: MaybeComputedRef<unknown>, type?: string): UseFetchReturn<T> & PromiseLike<UseFetchReturn<T>>;
  1642. delete(payload?: MaybeComputedRef<unknown>, type?: string): UseFetchReturn<T> & PromiseLike<UseFetchReturn<T>>;
  1643. patch(payload?: MaybeComputedRef<unknown>, type?: string): UseFetchReturn<T> & PromiseLike<UseFetchReturn<T>>;
  1644. head(payload?: MaybeComputedRef<unknown>, type?: string): UseFetchReturn<T> & PromiseLike<UseFetchReturn<T>>;
  1645. options(payload?: MaybeComputedRef<unknown>, type?: string): UseFetchReturn<T> & PromiseLike<UseFetchReturn<T>>;
  1646. json<JSON = any>(): UseFetchReturn<JSON> & PromiseLike<UseFetchReturn<JSON>>;
  1647. text(): UseFetchReturn<string> & PromiseLike<UseFetchReturn<string>>;
  1648. blob(): UseFetchReturn<Blob> & PromiseLike<UseFetchReturn<Blob>>;
  1649. arrayBuffer(): UseFetchReturn<ArrayBuffer> & PromiseLike<UseFetchReturn<ArrayBuffer>>;
  1650. formData(): UseFetchReturn<FormData> & PromiseLike<UseFetchReturn<FormData>>;
  1651. }
  1652. declare type Combination = 'overwrite' | 'chain';
  1653. interface BeforeFetchContext {
  1654. /**
  1655. * The computed url of the current request
  1656. */
  1657. url: string;
  1658. /**
  1659. * The request options of the current request
  1660. */
  1661. options: RequestInit;
  1662. /**
  1663. * Cancels the current request
  1664. */
  1665. cancel: Fn;
  1666. }
  1667. interface AfterFetchContext<T = any> {
  1668. response: Response;
  1669. data: T | null;
  1670. }
  1671. interface OnFetchErrorContext<T = any, E = any> {
  1672. error: E;
  1673. data: T | null;
  1674. }
  1675. interface UseFetchOptions {
  1676. /**
  1677. * Fetch function
  1678. */
  1679. fetch?: typeof window.fetch;
  1680. /**
  1681. * Will automatically run fetch when `useFetch` is used
  1682. *
  1683. * @default true
  1684. */
  1685. immediate?: boolean;
  1686. /**
  1687. * Will automatically refetch when:
  1688. * - the URL is changed if the URL is a ref
  1689. * - the payload is changed if the payload is a ref
  1690. *
  1691. * @default false
  1692. */
  1693. refetch?: MaybeComputedRef<boolean>;
  1694. /**
  1695. * Initial data before the request finished
  1696. *
  1697. * @default null
  1698. */
  1699. initialData?: any;
  1700. /**
  1701. * Timeout for abort request after number of millisecond
  1702. * `0` means use browser default
  1703. *
  1704. * @default 0
  1705. */
  1706. timeout?: number;
  1707. /**
  1708. * Will run immediately before the fetch request is dispatched
  1709. */
  1710. beforeFetch?: (ctx: BeforeFetchContext) => Promise<Partial<BeforeFetchContext> | void> | Partial<BeforeFetchContext> | void;
  1711. /**
  1712. * Will run immediately after the fetch request is returned.
  1713. * Runs after any 2xx response
  1714. */
  1715. afterFetch?: (ctx: AfterFetchContext) => Promise<Partial<AfterFetchContext>> | Partial<AfterFetchContext>;
  1716. /**
  1717. * Will run immediately after the fetch request is returned.
  1718. * Runs after any 4xx and 5xx response
  1719. */
  1720. onFetchError?: (ctx: {
  1721. data: any;
  1722. response: Response | null;
  1723. error: any;
  1724. }) => Promise<Partial<OnFetchErrorContext>> | Partial<OnFetchErrorContext>;
  1725. }
  1726. interface CreateFetchOptions {
  1727. /**
  1728. * The base URL that will be prefixed to all urls unless urls are absolute
  1729. */
  1730. baseUrl?: MaybeComputedRef<string>;
  1731. /**
  1732. * Determine the inherit behavior for beforeFetch, afterFetch, onFetchError
  1733. * @default 'chain'
  1734. */
  1735. combination?: Combination;
  1736. /**
  1737. * Default Options for the useFetch function
  1738. */
  1739. options?: UseFetchOptions;
  1740. /**
  1741. * Options for the fetch request
  1742. */
  1743. fetchOptions?: RequestInit;
  1744. }
  1745. declare function createFetch(config?: CreateFetchOptions): typeof useFetch;
  1746. declare function useFetch<T>(url: MaybeComputedRef<string>): UseFetchReturn<T> & PromiseLike<UseFetchReturn<T>>;
  1747. declare function useFetch<T>(url: MaybeComputedRef<string>, useFetchOptions: UseFetchOptions): UseFetchReturn<T> & PromiseLike<UseFetchReturn<T>>;
  1748. declare function useFetch<T>(url: MaybeComputedRef<string>, options: RequestInit, useFetchOptions?: UseFetchOptions): UseFetchReturn<T> & PromiseLike<UseFetchReturn<T>>;
  1749. interface UseFileDialogOptions extends ConfigurableDocument {
  1750. /**
  1751. * @default true
  1752. */
  1753. multiple?: boolean;
  1754. /**
  1755. * @default '*'
  1756. */
  1757. accept?: string;
  1758. /**
  1759. * Select the input source for the capture file.
  1760. * @see [HTMLInputElement Capture](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/capture)
  1761. */
  1762. capture?: string;
  1763. }
  1764. interface UseFileDialogReturn {
  1765. files: Ref<FileList | null>;
  1766. open: (localOptions?: Partial<UseFileDialogOptions>) => void;
  1767. reset: () => void;
  1768. }
  1769. /**
  1770. * Open file dialog with ease.
  1771. *
  1772. * @see https://vueuse.org/useFileDialog
  1773. * @param options
  1774. */
  1775. declare function useFileDialog(options?: UseFileDialogOptions): UseFileDialogReturn;
  1776. /**
  1777. * window.showOpenFilePicker parameters
  1778. * @see https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker#parameters
  1779. */
  1780. interface FileSystemAccessShowOpenFileOptions {
  1781. multiple?: boolean;
  1782. types?: Array<{
  1783. description?: string;
  1784. accept: Record<string, string[]>;
  1785. }>;
  1786. excludeAcceptAllOption?: boolean;
  1787. }
  1788. /**
  1789. * window.showSaveFilePicker parameters
  1790. * @see https://developer.mozilla.org/en-US/docs/Web/API/window/showSaveFilePicker#parameters
  1791. */
  1792. interface FileSystemAccessShowSaveFileOptions {
  1793. suggestedName?: string;
  1794. types?: Array<{
  1795. description?: string;
  1796. accept: Record<string, string[]>;
  1797. }>;
  1798. excludeAcceptAllOption?: boolean;
  1799. }
  1800. /**
  1801. * FileHandle
  1802. * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle
  1803. */
  1804. interface FileSystemFileHandle {
  1805. getFile: () => Promise<File>;
  1806. createWritable: () => FileSystemWritableFileStream;
  1807. }
  1808. /**
  1809. * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemWritableFileStream
  1810. */
  1811. interface FileSystemWritableFileStream extends WritableStream {
  1812. /**
  1813. * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemWritableFileStream/write
  1814. */
  1815. write: FileSystemWritableFileStreamWrite;
  1816. /**
  1817. * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemWritableFileStream/seek
  1818. */
  1819. seek: (position: number) => Promise<void>;
  1820. /**
  1821. * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemWritableFileStream/truncate
  1822. */
  1823. truncate: (size: number) => Promise<void>;
  1824. }
  1825. /**
  1826. * FileStream.write
  1827. * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemWritableFileStream/write
  1828. */
  1829. interface FileSystemWritableFileStreamWrite {
  1830. (data: string | BufferSource | Blob): Promise<void>;
  1831. (options: {
  1832. type: 'write';
  1833. position: number;
  1834. data: string | BufferSource | Blob;
  1835. }): Promise<void>;
  1836. (options: {
  1837. type: 'seek';
  1838. position: number;
  1839. }): Promise<void>;
  1840. (options: {
  1841. type: 'truncate';
  1842. size: number;
  1843. }): Promise<void>;
  1844. }
  1845. /**
  1846. * FileStream.write
  1847. * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemWritableFileStream/write
  1848. */
  1849. declare type FileSystemAccessWindow = Window & {
  1850. showSaveFilePicker: (options: FileSystemAccessShowSaveFileOptions) => Promise<FileSystemFileHandle>;
  1851. showOpenFilePicker: (options: FileSystemAccessShowOpenFileOptions) => Promise<FileSystemFileHandle[]>;
  1852. };
  1853. declare type UseFileSystemAccessCommonOptions = Pick<FileSystemAccessShowOpenFileOptions, 'types' | 'excludeAcceptAllOption'>;
  1854. declare type UseFileSystemAccessShowSaveFileOptions = Pick<FileSystemAccessShowSaveFileOptions, 'suggestedName'>;
  1855. declare type UseFileSystemAccessOptions = ConfigurableWindow & UseFileSystemAccessCommonOptions & {
  1856. /**
  1857. * file data type
  1858. */
  1859. dataType?: MaybeComputedRef<'Text' | 'ArrayBuffer' | 'Blob'>;
  1860. };
  1861. /**
  1862. * Create and read and write local files.
  1863. * @see https://vueuse.org/useFileSystemAccess
  1864. * @param options
  1865. */
  1866. declare function useFileSystemAccess(options: UseFileSystemAccessOptions & {
  1867. dataType: 'Text';
  1868. }): UseFileSystemAccessReturn<string>;
  1869. declare function useFileSystemAccess(options: UseFileSystemAccessOptions & {
  1870. dataType: 'ArrayBuffer';
  1871. }): UseFileSystemAccessReturn<ArrayBuffer>;
  1872. declare function useFileSystemAccess(options: UseFileSystemAccessOptions & {
  1873. dataType: 'Blob';
  1874. }): UseFileSystemAccessReturn<Blob>;
  1875. declare function useFileSystemAccess(options: UseFileSystemAccessOptions): UseFileSystemAccessReturn<string | ArrayBuffer | Blob>;
  1876. interface UseFileSystemAccessReturn<T = string> {
  1877. isSupported: Ref<boolean>;
  1878. data: Ref<T | undefined>;
  1879. file: Ref<File | undefined>;
  1880. fileName: Ref<string>;
  1881. fileMIME: Ref<string>;
  1882. fileSize: Ref<number>;
  1883. fileLastModified: Ref<number>;
  1884. open: (_options?: UseFileSystemAccessCommonOptions) => Awaitable<void>;
  1885. create: (_options?: UseFileSystemAccessShowSaveFileOptions) => Awaitable<void>;
  1886. save: (_options?: UseFileSystemAccessShowSaveFileOptions) => Awaitable<void>;
  1887. saveAs: (_options?: UseFileSystemAccessShowSaveFileOptions) => Awaitable<void>;
  1888. updateData: () => Awaitable<void>;
  1889. }
  1890. interface UseFocusOptions extends ConfigurableWindow {
  1891. /**
  1892. * Initial value. If set true, then focus will be set on the target
  1893. *
  1894. * @default false
  1895. */
  1896. initialValue?: boolean;
  1897. }
  1898. interface UseFocusReturn {
  1899. /**
  1900. * If read as true, then the element has focus. If read as false, then the element does not have focus
  1901. * If set to true, then the element will be focused. If set to false, the element will be blurred.
  1902. */
  1903. focused: Ref<boolean>;
  1904. }
  1905. /**
  1906. * Track or set the focus state of a DOM element.
  1907. *
  1908. * @see https://vueuse.org/useFocus
  1909. * @param target The target element for the focus and blur events.
  1910. * @param options
  1911. */
  1912. declare function useFocus(target: MaybeElementRef, options?: UseFocusOptions): UseFocusReturn;
  1913. interface UseFocusWithinReturn {
  1914. /**
  1915. * True if the element or any of its descendants are focused
  1916. */
  1917. focused: ComputedRef<boolean>;
  1918. }
  1919. /**
  1920. * Track if focus is contained within the target element
  1921. *
  1922. * @see https://vueuse.org/useFocusWithin
  1923. * @param target The target element to track
  1924. * @param options Focus within options
  1925. */
  1926. declare function useFocusWithin(target: MaybeElementRef, options?: ConfigurableWindow): UseFocusWithinReturn;
  1927. interface UseFpsOptions {
  1928. /**
  1929. * Calculate the FPS on every x frames.
  1930. * @default 10
  1931. */
  1932. every?: number;
  1933. }
  1934. declare function useFps(options?: UseFpsOptions): Ref<number>;
  1935. interface UseFullscreenOptions extends ConfigurableDocument {
  1936. /**
  1937. * Automatically exit fullscreen when component is unmounted
  1938. *
  1939. * @default false
  1940. */
  1941. autoExit?: boolean;
  1942. }
  1943. /**
  1944. * Reactive Fullscreen API.
  1945. *
  1946. * @see https://vueuse.org/useFullscreen
  1947. * @param target
  1948. * @param options
  1949. */
  1950. declare function useFullscreen(target?: MaybeElementRef, options?: UseFullscreenOptions): {
  1951. isSupported: vue_demi.Ref<boolean>;
  1952. isFullscreen: vue_demi.Ref<boolean>;
  1953. enter: () => Promise<void>;
  1954. exit: () => Promise<void>;
  1955. toggle: () => Promise<void>;
  1956. };
  1957. declare type UseFullscreenReturn = ReturnType<typeof useFullscreen>;
  1958. interface UseGamepadOptions extends ConfigurableWindow, ConfigurableNavigator {
  1959. }
  1960. /**
  1961. * Maps a standard standard gamepad to an Xbox 360 Controller.
  1962. */
  1963. declare function mapGamepadToXbox360Controller(gamepad: Ref<Gamepad | undefined>): vue_demi.ComputedRef<{
  1964. buttons: {
  1965. a: GamepadButton;
  1966. b: GamepadButton;
  1967. x: GamepadButton;
  1968. y: GamepadButton;
  1969. };
  1970. bumper: {
  1971. left: GamepadButton;
  1972. right: GamepadButton;
  1973. };
  1974. triggers: {
  1975. left: GamepadButton;
  1976. right: GamepadButton;
  1977. };
  1978. stick: {
  1979. left: {
  1980. horizontal: number;
  1981. vertical: number;
  1982. button: GamepadButton;
  1983. };
  1984. right: {
  1985. horizontal: number;
  1986. vertical: number;
  1987. button: GamepadButton;
  1988. };
  1989. };
  1990. dpad: {
  1991. up: GamepadButton;
  1992. down: GamepadButton;
  1993. left: GamepadButton;
  1994. right: GamepadButton;
  1995. };
  1996. back: GamepadButton;
  1997. start: GamepadButton;
  1998. } | null>;
  1999. declare function useGamepad(options?: UseGamepadOptions): {
  2000. isSupported: Ref<boolean>;
  2001. onConnected: _vueuse_shared.EventHookOn<number>;
  2002. onDisconnected: _vueuse_shared.EventHookOn<number>;
  2003. gamepads: Ref<{
  2004. readonly axes: readonly number[];
  2005. readonly buttons: readonly {
  2006. readonly pressed: boolean;
  2007. readonly touched: boolean;
  2008. readonly value: number;
  2009. }[];
  2010. readonly connected: boolean;
  2011. readonly hapticActuators: readonly {
  2012. readonly type: "vibration";
  2013. }[];
  2014. readonly id: string;
  2015. readonly index: number;
  2016. readonly mapping: GamepadMappingType;
  2017. readonly timestamp: number;
  2018. }[]>;
  2019. pause: _vueuse_shared.Fn;
  2020. resume: _vueuse_shared.Fn;
  2021. isActive: Ref<boolean>;
  2022. };
  2023. declare type UseGamepadReturn = ReturnType<typeof useGamepad>;
  2024. interface UseGeolocationOptions extends Partial<PositionOptions>, ConfigurableNavigator {
  2025. immediate?: boolean;
  2026. }
  2027. /**
  2028. * Reactive Geolocation API.
  2029. *
  2030. * @see https://vueuse.org/useGeolocation
  2031. * @param options
  2032. */
  2033. declare function useGeolocation(options?: UseGeolocationOptions): {
  2034. isSupported: Ref<boolean>;
  2035. coords: Ref<GeolocationCoordinates>;
  2036. locatedAt: Ref<number | null>;
  2037. error: Ref<{
  2038. readonly code: number;
  2039. readonly message: string;
  2040. readonly PERMISSION_DENIED: number;
  2041. readonly POSITION_UNAVAILABLE: number;
  2042. readonly TIMEOUT: number;
  2043. } | null>;
  2044. resume: () => void;
  2045. pause: () => void;
  2046. };
  2047. declare type UseGeolocationReturn = ReturnType<typeof useGeolocation>;
  2048. interface UseIdleOptions extends ConfigurableWindow, ConfigurableEventFilter {
  2049. /**
  2050. * Event names that listen to for detected user activity
  2051. *
  2052. * @default ['mousemove', 'mousedown', 'resize', 'keydown', 'touchstart', 'wheel']
  2053. */
  2054. events?: WindowEventName[];
  2055. /**
  2056. * Listen for document visibility change
  2057. *
  2058. * @default true
  2059. */
  2060. listenForVisibilityChange?: boolean;
  2061. /**
  2062. * Initial state of the ref idle
  2063. *
  2064. * @default false
  2065. */
  2066. initialState?: boolean;
  2067. }
  2068. interface UseIdleReturn {
  2069. idle: Ref<boolean>;
  2070. lastActive: Ref<number>;
  2071. }
  2072. /**
  2073. * Tracks whether the user is being inactive.
  2074. *
  2075. * @see https://vueuse.org/useIdle
  2076. * @param timeout default to 1 minute
  2077. * @param options IdleOptions
  2078. */
  2079. declare function useIdle(timeout?: number, options?: UseIdleOptions): UseIdleReturn;
  2080. interface UseImageOptions {
  2081. /** Address of the resource */
  2082. src: string;
  2083. /** Images to use in different situations, e.g., high-resolution displays, small monitors, etc. */
  2084. srcset?: string;
  2085. /** Image sizes for different page layouts */
  2086. sizes?: string;
  2087. }
  2088. /**
  2089. * Reactive load an image in the browser, you can wait the result to display it or show a fallback.
  2090. *
  2091. * @see https://vueuse.org/useImage
  2092. * @param options Image attributes, as used in the <img> tag
  2093. * @param asyncStateOptions
  2094. */
  2095. declare const useImage: <Shallow extends true>(options: MaybeComputedRef<UseImageOptions>, asyncStateOptions?: UseAsyncStateOptions<Shallow, any>) => UseAsyncStateReturn<HTMLImageElement | undefined, true>;
  2096. declare type UseImageReturn = ReturnType<typeof useImage>;
  2097. interface UseScrollOptions {
  2098. /**
  2099. * Throttle time for scroll event, it’s disabled by default.
  2100. *
  2101. * @default 0
  2102. */
  2103. throttle?: number;
  2104. /**
  2105. * The check time when scrolling ends.
  2106. * This configuration will be setting to (throttle + idle) when the `throttle` is configured.
  2107. *
  2108. * @default 200
  2109. */
  2110. idle?: number;
  2111. /**
  2112. * Offset arrived states by x pixels
  2113. *
  2114. */
  2115. offset?: {
  2116. left?: number;
  2117. right?: number;
  2118. top?: number;
  2119. bottom?: number;
  2120. };
  2121. /**
  2122. * Trigger it when scrolling.
  2123. *
  2124. */
  2125. onScroll?: (e: Event) => void;
  2126. /**
  2127. * Trigger it when scrolling ends.
  2128. *
  2129. */
  2130. onStop?: (e: Event) => void;
  2131. /**
  2132. * Listener options for scroll event.
  2133. *
  2134. * @default {capture: false, passive: true}
  2135. */
  2136. eventListenerOptions?: boolean | AddEventListenerOptions;
  2137. /**
  2138. * Optionally specify a scroll behavior of `auto` (default, not smooth scrolling) or
  2139. * `smooth` (for smooth scrolling) which takes effect when changing the `x` or `y` refs.
  2140. *
  2141. * @default 'auto'
  2142. */
  2143. behavior?: MaybeComputedRef<ScrollBehavior>;
  2144. }
  2145. /**
  2146. * Reactive scroll.
  2147. *
  2148. * @see https://vueuse.org/useScroll
  2149. * @param element
  2150. * @param options
  2151. */
  2152. declare function useScroll(element: MaybeComputedRef<HTMLElement | SVGElement | Window | Document | null | undefined>, options?: UseScrollOptions): {
  2153. x: vue_demi.WritableComputedRef<number>;
  2154. y: vue_demi.WritableComputedRef<number>;
  2155. isScrolling: vue_demi.Ref<boolean>;
  2156. arrivedState: {
  2157. left: boolean;
  2158. right: boolean;
  2159. top: boolean;
  2160. bottom: boolean;
  2161. };
  2162. directions: {
  2163. left: boolean;
  2164. right: boolean;
  2165. top: boolean;
  2166. bottom: boolean;
  2167. };
  2168. };
  2169. declare type UseScrollReturn = ReturnType<typeof useScroll>;
  2170. interface UseInfiniteScrollOptions extends UseScrollOptions {
  2171. /**
  2172. * The minimum distance between the bottom of the element and the bottom of the viewport
  2173. *
  2174. * @default 0
  2175. */
  2176. distance?: number;
  2177. /**
  2178. * The direction in which to listen the scroll.
  2179. *
  2180. * @default 'bottom'
  2181. */
  2182. direction?: 'top' | 'bottom' | 'left' | 'right';
  2183. /**
  2184. * Whether to preserve the current scroll position when loading more items.
  2185. *
  2186. * @default false
  2187. */
  2188. preserveScrollPosition?: boolean;
  2189. }
  2190. /**
  2191. * Reactive infinite scroll.
  2192. *
  2193. * @see https://vueuse.org/useInfiniteScroll
  2194. */
  2195. declare function useInfiniteScroll(element: MaybeComputedRef<HTMLElement | SVGElement | Window | Document | null | undefined>, onLoadMore: (state: UnwrapNestedRefs<ReturnType<typeof useScroll>>) => void | Promise<void>, options?: UseInfiniteScrollOptions): void;
  2196. interface UseIntersectionObserverOptions extends ConfigurableWindow {
  2197. /**
  2198. * The Element or Document whose bounds are used as the bounding box when testing for intersection.
  2199. */
  2200. root?: MaybeElementRef;
  2201. /**
  2202. * A string which specifies a set of offsets to add to the root's bounding_box when calculating intersections.
  2203. */
  2204. rootMargin?: string;
  2205. /**
  2206. * Either a single number or an array of numbers between 0.0 and 1.
  2207. */
  2208. threshold?: number | number[];
  2209. }
  2210. /**
  2211. * Detects that a target element's visibility.
  2212. *
  2213. * @see https://vueuse.org/useIntersectionObserver
  2214. * @param target
  2215. * @param callback
  2216. * @param options
  2217. */
  2218. declare function useIntersectionObserver(target: MaybeElementRef, callback: IntersectionObserverCallback, options?: UseIntersectionObserverOptions): {
  2219. isSupported: vue_demi.Ref<boolean>;
  2220. stop: () => void;
  2221. };
  2222. declare type UseIntersectionObserverReturn = ReturnType<typeof useIntersectionObserver>;
  2223. declare type KeyModifier = 'Alt' | 'AltGraph' | 'CapsLock' | 'Control' | 'Fn' | 'FnLock' | 'Meta' | 'NumLock' | 'ScrollLock' | 'Shift' | 'Symbol' | 'SymbolLock';
  2224. interface UseModifierOptions<Initial> extends ConfigurableDocument {
  2225. /**
  2226. * Event names that will prompt update to modifier states
  2227. *
  2228. * @default ['mousedown', 'mouseup', 'keydown', 'keyup']
  2229. */
  2230. events?: WindowEventName[];
  2231. /**
  2232. * Initial value of the returned ref
  2233. *
  2234. * @default null
  2235. */
  2236. initial?: Initial;
  2237. }
  2238. declare type UseKeyModifierReturn<Initial> = Ref<Initial extends boolean ? boolean : boolean | null>;
  2239. declare function useKeyModifier<Initial extends boolean | null>(modifier: KeyModifier, options?: UseModifierOptions<Initial>): UseKeyModifierReturn<Initial>;
  2240. declare function useLocalStorage(key: string, initialValue: MaybeComputedRef<string>, options?: UseStorageOptions<string>): RemovableRef<string>;
  2241. declare function useLocalStorage(key: string, initialValue: MaybeComputedRef<boolean>, options?: UseStorageOptions<boolean>): RemovableRef<boolean>;
  2242. declare function useLocalStorage(key: string, initialValue: MaybeComputedRef<number>, options?: UseStorageOptions<number>): RemovableRef<number>;
  2243. declare function useLocalStorage<T>(key: string, initialValue: MaybeComputedRef<T>, options?: UseStorageOptions<T>): RemovableRef<T>;
  2244. declare function useLocalStorage<T = unknown>(key: string, initialValue: MaybeComputedRef<null>, options?: UseStorageOptions<T>): RemovableRef<T>;
  2245. declare const DefaultMagicKeysAliasMap: Readonly<Record<string, string>>;
  2246. interface UseMagicKeysOptions<Reactive extends Boolean> {
  2247. /**
  2248. * Returns a reactive object instead of an object of refs
  2249. *
  2250. * @default false
  2251. */
  2252. reactive?: Reactive;
  2253. /**
  2254. * Target for listening events
  2255. *
  2256. * @default window
  2257. */
  2258. target?: MaybeComputedRef<EventTarget>;
  2259. /**
  2260. * Alias map for keys, all the keys should be lowercase
  2261. * { target: keycode }
  2262. *
  2263. * @example { ctrl: "control" }
  2264. * @default <predefined-map>
  2265. */
  2266. aliasMap?: Record<string, string>;
  2267. /**
  2268. * Register passive listener
  2269. *
  2270. * @default true
  2271. */
  2272. passive?: boolean;
  2273. /**
  2274. * Custom event handler for keydown/keyup event.
  2275. * Useful when you want to apply custom logic.
  2276. *
  2277. * When using `e.preventDefault()`, you will need to pass `passive: false` to useMagicKeys().
  2278. */
  2279. onEventFired?: (e: KeyboardEvent) => void | boolean;
  2280. }
  2281. interface MagicKeysInternal {
  2282. /**
  2283. * A Set of currently pressed keys,
  2284. * Stores raw keyCodes.
  2285. *
  2286. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key
  2287. */
  2288. current: Set<string>;
  2289. }
  2290. declare type UseMagicKeysReturn<Reactive extends Boolean> = Readonly<Omit<Reactive extends true ? Record<string, boolean> : Record<string, ComputedRef<boolean>>, keyof MagicKeysInternal> & MagicKeysInternal>;
  2291. /**
  2292. * Reactive keys pressed state, with magical keys combination support.
  2293. *
  2294. * @see https://vueuse.org/useMagicKeys
  2295. */
  2296. declare function useMagicKeys(options?: UseMagicKeysOptions<false>): UseMagicKeysReturn<false>;
  2297. declare function useMagicKeys(options: UseMagicKeysOptions<true>): UseMagicKeysReturn<true>;
  2298. /**
  2299. * Many of the jsdoc definitions here are modified version of the
  2300. * documentation from MDN(https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement)
  2301. */
  2302. interface UseMediaSource {
  2303. /**
  2304. * The source url for the media
  2305. */
  2306. src: string;
  2307. /**
  2308. * The media codec type
  2309. */
  2310. type?: string;
  2311. }
  2312. interface UseMediaTextTrackSource {
  2313. /**
  2314. * Indicates that the track should be enabled unless the user's preferences indicate
  2315. * that another track is more appropriate
  2316. */
  2317. default?: boolean;
  2318. /**
  2319. * How the text track is meant to be used. If omitted the default kind is subtitles.
  2320. */
  2321. kind: TextTrackKind;
  2322. /**
  2323. * A user-readable title of the text track which is used by the browser
  2324. * when listing available text tracks.
  2325. */
  2326. label: string;
  2327. /**
  2328. * Address of the track (.vtt file). Must be a valid URL. This attribute
  2329. * must be specified and its URL value must have the same origin as the document
  2330. */
  2331. src: string;
  2332. /**
  2333. * Language of the track text data. It must be a valid BCP 47 language tag.
  2334. * If the kind attribute is set to subtitles, then srclang must be defined.
  2335. */
  2336. srcLang: string;
  2337. }
  2338. interface UseMediaControlsOptions extends ConfigurableDocument {
  2339. /**
  2340. * The source for the media, may either be a string, a `UseMediaSource` object, or a list
  2341. * of `UseMediaSource` objects.
  2342. */
  2343. src?: MaybeComputedRef<string | UseMediaSource | UseMediaSource[]>;
  2344. /**
  2345. * A list of text tracks for the media
  2346. */
  2347. tracks?: MaybeComputedRef<UseMediaTextTrackSource[]>;
  2348. }
  2349. interface UseMediaTextTrack {
  2350. /**
  2351. * The index of the text track
  2352. */
  2353. id: number;
  2354. /**
  2355. * The text track label
  2356. */
  2357. label: string;
  2358. /**
  2359. * Language of the track text data. It must be a valid BCP 47 language tag.
  2360. * If the kind attribute is set to subtitles, then srclang must be defined.
  2361. */
  2362. language: string;
  2363. /**
  2364. * Specifies the display mode of the text track, either `disabled`,
  2365. * `hidden`, or `showing`
  2366. */
  2367. mode: TextTrackMode;
  2368. /**
  2369. * How the text track is meant to be used. If omitted the default kind is subtitles.
  2370. */
  2371. kind: TextTrackKind;
  2372. /**
  2373. * Indicates the track's in-band metadata track dispatch type.
  2374. */
  2375. inBandMetadataTrackDispatchType: string;
  2376. /**
  2377. * A list of text track cues
  2378. */
  2379. cues: TextTrackCueList | null;
  2380. /**
  2381. * A list of active text track cues
  2382. */
  2383. activeCues: TextTrackCueList | null;
  2384. }
  2385. declare function useMediaControls(target: MaybeRef<HTMLMediaElement | null | undefined>, options?: UseMediaControlsOptions): {
  2386. currentTime: vue_demi.Ref<number>;
  2387. duration: vue_demi.Ref<number>;
  2388. waiting: vue_demi.Ref<boolean>;
  2389. seeking: vue_demi.Ref<boolean>;
  2390. ended: vue_demi.Ref<boolean>;
  2391. stalled: vue_demi.Ref<boolean>;
  2392. buffered: vue_demi.Ref<[number, number][]>;
  2393. playing: vue_demi.Ref<boolean>;
  2394. rate: vue_demi.Ref<number>;
  2395. volume: vue_demi.Ref<number>;
  2396. muted: vue_demi.Ref<boolean>;
  2397. tracks: vue_demi.Ref<{
  2398. id: number;
  2399. label: string;
  2400. language: string;
  2401. mode: TextTrackMode;
  2402. kind: TextTrackKind;
  2403. inBandMetadataTrackDispatchType: string;
  2404. cues: {
  2405. [x: number]: {
  2406. endTime: number;
  2407. id: string;
  2408. onenter: ((this: TextTrackCue, ev: Event) => any) | null;
  2409. onexit: ((this: TextTrackCue, ev: Event) => any) | null;
  2410. pauseOnExit: boolean;
  2411. startTime: number;
  2412. readonly track: {
  2413. readonly activeCues: any | null;
  2414. readonly cues: any | null;
  2415. readonly id: string;
  2416. readonly inBandMetadataTrackDispatchType: string;
  2417. readonly kind: TextTrackKind;
  2418. readonly label: string;
  2419. readonly language: string;
  2420. mode: TextTrackMode;
  2421. oncuechange: ((this: TextTrack, ev: Event) => any) | null;
  2422. addCue: (cue: TextTrackCue) => void;
  2423. removeCue: (cue: TextTrackCue) => void;
  2424. addEventListener: {
  2425. <K extends "cuechange">(type: K, listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any, options?: boolean | AddEventListenerOptions | undefined): void;
  2426. (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
  2427. };
  2428. removeEventListener: {
  2429. <K_1 extends "cuechange">(type: K_1, listener: (this: TextTrack, ev: TextTrackEventMap[K_1]) => any, options?: boolean | EventListenerOptions | undefined): void;
  2430. (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void;
  2431. };
  2432. dispatchEvent: (event: Event) => boolean;
  2433. } | null;
  2434. addEventListener: {
  2435. <K_2 extends keyof TextTrackCueEventMap>(type: K_2, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K_2]) => any, options?: boolean | AddEventListenerOptions | undefined): void;
  2436. (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
  2437. };
  2438. removeEventListener: {
  2439. <K_3 extends keyof TextTrackCueEventMap>(type: K_3, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K_3]) => any, options?: boolean | EventListenerOptions | undefined): void;
  2440. (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void;
  2441. };
  2442. dispatchEvent: (event: Event) => boolean;
  2443. };
  2444. readonly length: number;
  2445. getCueById: (id: string) => TextTrackCue | null;
  2446. [Symbol.iterator]: () => IterableIterator<TextTrackCue>;
  2447. } | null;
  2448. activeCues: {
  2449. [x: number]: {
  2450. endTime: number;
  2451. id: string;
  2452. onenter: ((this: TextTrackCue, ev: Event) => any) | null;
  2453. onexit: ((this: TextTrackCue, ev: Event) => any) | null;
  2454. pauseOnExit: boolean;
  2455. startTime: number;
  2456. readonly track: {
  2457. readonly activeCues: any | null;
  2458. readonly cues: any | null;
  2459. readonly id: string;
  2460. readonly inBandMetadataTrackDispatchType: string;
  2461. readonly kind: TextTrackKind;
  2462. readonly label: string;
  2463. readonly language: string;
  2464. mode: TextTrackMode;
  2465. oncuechange: ((this: TextTrack, ev: Event) => any) | null;
  2466. addCue: (cue: TextTrackCue) => void;
  2467. removeCue: (cue: TextTrackCue) => void;
  2468. addEventListener: {
  2469. <K extends "cuechange">(type: K, listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any, options?: boolean | AddEventListenerOptions | undefined): void;
  2470. (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
  2471. };
  2472. removeEventListener: {
  2473. <K_1 extends "cuechange">(type: K_1, listener: (this: TextTrack, ev: TextTrackEventMap[K_1]) => any, options?: boolean | EventListenerOptions | undefined): void;
  2474. (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void;
  2475. };
  2476. dispatchEvent: (event: Event) => boolean;
  2477. } | null;
  2478. addEventListener: {
  2479. <K_2 extends keyof TextTrackCueEventMap>(type: K_2, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K_2]) => any, options?: boolean | AddEventListenerOptions | undefined): void;
  2480. (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
  2481. };
  2482. removeEventListener: {
  2483. <K_3 extends keyof TextTrackCueEventMap>(type: K_3, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K_3]) => any, options?: boolean | EventListenerOptions | undefined): void;
  2484. (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void;
  2485. };
  2486. dispatchEvent: (event: Event) => boolean;
  2487. };
  2488. readonly length: number;
  2489. getCueById: (id: string) => TextTrackCue | null;
  2490. [Symbol.iterator]: () => IterableIterator<TextTrackCue>;
  2491. } | null;
  2492. }[]>;
  2493. selectedTrack: vue_demi.Ref<number>;
  2494. enableTrack: (track: number | UseMediaTextTrack, disableTracks?: boolean) => void;
  2495. disableTrack: (track?: number | UseMediaTextTrack) => void;
  2496. supportsPictureInPicture: boolean | undefined;
  2497. togglePictureInPicture: () => Promise<unknown>;
  2498. isPictureInPicture: vue_demi.Ref<boolean>;
  2499. onSourceError: _vueuse_shared.EventHookOn<Event>;
  2500. };
  2501. declare type UseMediaControlsReturn = ReturnType<typeof useMediaControls>;
  2502. /**
  2503. * Reactive Media Query.
  2504. *
  2505. * @see https://vueuse.org/useMediaQuery
  2506. * @param query
  2507. * @param options
  2508. */
  2509. declare function useMediaQuery(query: MaybeComputedRef<string>, options?: ConfigurableWindow): vue_demi.Ref<boolean>;
  2510. declare type CacheKey = any;
  2511. /**
  2512. * Custom memoize cache handler
  2513. */
  2514. interface UseMemoizeCache<Key, Value> {
  2515. /**
  2516. * Get value for key
  2517. */
  2518. get(key: Key): Value | undefined;
  2519. /**
  2520. * Set value for key
  2521. */
  2522. set(key: Key, value: Value): void;
  2523. /**
  2524. * Return flag if key exists
  2525. */
  2526. has(key: Key): boolean;
  2527. /**
  2528. * Delete value for key
  2529. */
  2530. delete(key: Key): void;
  2531. /**
  2532. * Clear cache
  2533. */
  2534. clear(): void;
  2535. }
  2536. /**
  2537. * Memoized function
  2538. */
  2539. interface UseMemoizeReturn<Result, Args extends unknown[]> {
  2540. /**
  2541. * Get result from cache or call memoized function
  2542. */
  2543. (...args: Args): Result;
  2544. /**
  2545. * Call memoized function and update cache
  2546. */
  2547. load(...args: Args): Result;
  2548. /**
  2549. * Delete cache of given arguments
  2550. */
  2551. delete(...args: Args): void;
  2552. /**
  2553. * Clear cache
  2554. */
  2555. clear(): void;
  2556. /**
  2557. * Generate cache key for given arguments
  2558. */
  2559. generateKey(...args: Args): CacheKey;
  2560. /**
  2561. * Cache container
  2562. */
  2563. cache: UseMemoizeCache<CacheKey, Result>;
  2564. }
  2565. interface UseMemoizeOptions<Result, Args extends unknown[]> {
  2566. getKey?: (...args: Args) => string | number;
  2567. cache?: UseMemoizeCache<CacheKey, Result>;
  2568. }
  2569. /**
  2570. * Reactive function result cache based on arguments
  2571. */
  2572. declare function useMemoize<Result, Args extends unknown[]>(resolver: (...args: Args) => Result, options?: UseMemoizeOptions<Result, Args>): UseMemoizeReturn<Result, Args>;
  2573. /**
  2574. * Performance.memory
  2575. *
  2576. * @see https://developer.mozilla.org/en-US/docs/Web/API/Performance/memory
  2577. */
  2578. interface MemoryInfo {
  2579. /**
  2580. * The maximum size of the heap, in bytes, that is available to the context.
  2581. */
  2582. readonly jsHeapSizeLimit: number;
  2583. /**
  2584. * The total allocated heap size, in bytes.
  2585. */
  2586. readonly totalJSHeapSize: number;
  2587. /**
  2588. * The currently active segment of JS heap, in bytes.
  2589. */
  2590. readonly usedJSHeapSize: number;
  2591. [Symbol.toStringTag]: 'MemoryInfo';
  2592. }
  2593. interface UseMemoryOptions extends UseIntervalFnOptions {
  2594. interval?: number;
  2595. }
  2596. /**
  2597. * Reactive Memory Info.
  2598. *
  2599. * @see https://vueuse.org/useMemory
  2600. * @param options
  2601. */
  2602. declare function useMemory(options?: UseMemoryOptions): {
  2603. isSupported: vue_demi.Ref<boolean>;
  2604. memory: vue_demi.Ref<MemoryInfo | undefined>;
  2605. };
  2606. declare type UseMemoryReturn = ReturnType<typeof useMemory>;
  2607. /**
  2608. * Mounted state in ref.
  2609. *
  2610. * @see https://vueuse.org/useMounted
  2611. * @param options
  2612. */
  2613. declare function useMounted(): vue_demi.Ref<boolean>;
  2614. interface UseMouseOptions extends ConfigurableWindow, ConfigurableEventFilter {
  2615. /**
  2616. * Mouse position based by page or client
  2617. *
  2618. * @default 'page'
  2619. */
  2620. type?: 'page' | 'client';
  2621. /**
  2622. * Listen to `touchmove` events
  2623. *
  2624. * @default true
  2625. */
  2626. touch?: boolean;
  2627. /**
  2628. * Reset to initial value when `touchend` event fired
  2629. *
  2630. * @default false
  2631. */
  2632. resetOnTouchEnds?: boolean;
  2633. /**
  2634. * Initial values
  2635. */
  2636. initialValue?: Position;
  2637. }
  2638. declare type MouseSourceType = 'mouse' | 'touch' | null;
  2639. /**
  2640. * Reactive mouse position.
  2641. *
  2642. * @see https://vueuse.org/useMouse
  2643. * @param options
  2644. */
  2645. declare function useMouse(options?: UseMouseOptions): {
  2646. x: vue_demi.Ref<number>;
  2647. y: vue_demi.Ref<number>;
  2648. sourceType: vue_demi.Ref<MouseSourceType>;
  2649. };
  2650. declare type UseMouseReturn = ReturnType<typeof useMouse>;
  2651. interface MouseInElementOptions extends UseMouseOptions {
  2652. handleOutside?: boolean;
  2653. }
  2654. /**
  2655. * Reactive mouse position related to an element.
  2656. *
  2657. * @see https://vueuse.org/useMouseInElement
  2658. * @param target
  2659. * @param options
  2660. */
  2661. declare function useMouseInElement(target?: MaybeElementRef, options?: MouseInElementOptions): {
  2662. x: vue_demi.Ref<number>;
  2663. y: vue_demi.Ref<number>;
  2664. sourceType: vue_demi.Ref<MouseSourceType>;
  2665. elementX: vue_demi.Ref<number>;
  2666. elementY: vue_demi.Ref<number>;
  2667. elementPositionX: vue_demi.Ref<number>;
  2668. elementPositionY: vue_demi.Ref<number>;
  2669. elementHeight: vue_demi.Ref<number>;
  2670. elementWidth: vue_demi.Ref<number>;
  2671. isOutside: vue_demi.Ref<boolean>;
  2672. stop: () => void;
  2673. };
  2674. declare type UseMouseInElementReturn = ReturnType<typeof useMouseInElement>;
  2675. interface MousePressedOptions extends ConfigurableWindow {
  2676. /**
  2677. * Listen to `touchstart` `touchend` events
  2678. *
  2679. * @default true
  2680. */
  2681. touch?: boolean;
  2682. /**
  2683. * Listen to `dragstart` `drop` and `dragend` events
  2684. *
  2685. * @default true
  2686. */
  2687. drag?: boolean;
  2688. /**
  2689. * Initial values
  2690. *
  2691. * @default false
  2692. */
  2693. initialValue?: boolean;
  2694. /**
  2695. * Element target to be capture the click
  2696. */
  2697. target?: MaybeElementRef;
  2698. }
  2699. /**
  2700. * Reactive mouse position.
  2701. *
  2702. * @see https://vueuse.org/useMousePressed
  2703. * @param options
  2704. */
  2705. declare function useMousePressed(options?: MousePressedOptions): {
  2706. pressed: vue_demi.Ref<boolean>;
  2707. sourceType: vue_demi.Ref<MouseSourceType>;
  2708. };
  2709. declare type UseMousePressedReturn = ReturnType<typeof useMousePressed>;
  2710. interface UseMutationObserverOptions extends MutationObserverInit, ConfigurableWindow {
  2711. }
  2712. /**
  2713. * Watch for changes being made to the DOM tree.
  2714. *
  2715. * @see https://vueuse.org/useMutationObserver
  2716. * @see https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver MutationObserver MDN
  2717. * @param target
  2718. * @param callback
  2719. * @param options
  2720. */
  2721. declare function useMutationObserver(target: MaybeElementRef, callback: MutationCallback, options?: UseMutationObserverOptions): {
  2722. isSupported: vue_demi.Ref<boolean>;
  2723. stop: () => void;
  2724. };
  2725. declare type UseMutationObserverReturn = ReturnType<typeof useMutationObserver>;
  2726. interface NavigatorLanguageState {
  2727. isSupported: Ref<boolean>;
  2728. /**
  2729. *
  2730. * ISO 639-1 standard Language Code
  2731. *
  2732. * @info The detected user agent language preference as a language tag
  2733. * (which is sometimes referred to as a "locale identifier").
  2734. * This consists of a 2-3 letter base language tag that indicates a
  2735. * language, optionally followed by additional subtags separated by
  2736. * '-'. The most common extra information is the country or region
  2737. * variant (like 'en-US' or 'fr-CA').
  2738. *
  2739. *
  2740. * @see https://www.iso.org/iso-639-language-codes.html
  2741. * @see https://www.loc.gov/standards/iso639-2/php/code_list.php
  2742. *
  2743. */
  2744. language: Ref<string | undefined>;
  2745. }
  2746. /**
  2747. *
  2748. * Reactive useNavigatorLanguage
  2749. *
  2750. * Detects the currently selected user language and returns a reactive language
  2751. * @see https://vueuse.org/useNavigatorLanguage
  2752. *
  2753. */
  2754. declare const useNavigatorLanguage: (options?: ConfigurableWindow) => Readonly<NavigatorLanguageState>;
  2755. declare type UseNavigatorLanguageReturn = ReturnType<typeof useNavigatorLanguage>;
  2756. declare type NetworkType = 'bluetooth' | 'cellular' | 'ethernet' | 'none' | 'wifi' | 'wimax' | 'other' | 'unknown';
  2757. declare type NetworkEffectiveType = 'slow-2g' | '2g' | '3g' | '4g' | undefined;
  2758. interface NetworkState {
  2759. isSupported: Ref<boolean>;
  2760. /**
  2761. * If the user is currently connected.
  2762. */
  2763. isOnline: Ref<boolean>;
  2764. /**
  2765. * The time since the user was last connected.
  2766. */
  2767. offlineAt: Ref<number | undefined>;
  2768. /**
  2769. * At this time, if the user is offline and reconnects
  2770. */
  2771. onlineAt: Ref<number | undefined>;
  2772. /**
  2773. * The download speed in Mbps.
  2774. */
  2775. downlink: Ref<number | undefined>;
  2776. /**
  2777. * The max reachable download speed in Mbps.
  2778. */
  2779. downlinkMax: Ref<number | undefined>;
  2780. /**
  2781. * The detected effective speed type.
  2782. */
  2783. effectiveType: Ref<NetworkEffectiveType | undefined>;
  2784. /**
  2785. * The estimated effective round-trip time of the current connection.
  2786. */
  2787. rtt: Ref<number | undefined>;
  2788. /**
  2789. * If the user activated data saver mode.
  2790. */
  2791. saveData: Ref<boolean | undefined>;
  2792. /**
  2793. * The detected connection/network type.
  2794. */
  2795. type: Ref<NetworkType>;
  2796. }
  2797. /**
  2798. * Reactive Network status.
  2799. *
  2800. * @see https://vueuse.org/useNetwork
  2801. * @param options
  2802. */
  2803. declare function useNetwork(options?: ConfigurableWindow): Readonly<NetworkState>;
  2804. declare type UseNetworkReturn = ReturnType<typeof useNetwork>;
  2805. interface UseNowOptions<Controls extends boolean> {
  2806. /**
  2807. * Expose more controls
  2808. *
  2809. * @default false
  2810. */
  2811. controls?: Controls;
  2812. /**
  2813. * Update interval, or use requestAnimationFrame
  2814. *
  2815. * @default requestAnimationFrame
  2816. */
  2817. interval?: 'requestAnimationFrame' | number;
  2818. }
  2819. /**
  2820. * Reactive current Date instance.
  2821. *
  2822. * @see https://vueuse.org/useNow
  2823. * @param options
  2824. */
  2825. declare function useNow(options?: UseNowOptions<false>): Ref<Date>;
  2826. declare function useNow(options: UseNowOptions<true>): {
  2827. now: Ref<Date>;
  2828. } & Pausable;
  2829. declare type UseNowReturn = ReturnType<typeof useNow>;
  2830. /**
  2831. * Reactive URL representing an object.
  2832. *
  2833. * @see https://vueuse.org/useObjectUrl
  2834. * @param object
  2835. */
  2836. declare function useObjectUrl(object: MaybeRef<Blob | MediaSource | undefined>): Readonly<vue_demi.Ref<string | undefined>>;
  2837. interface UseOffsetPaginationOptions {
  2838. /**
  2839. * Total number of items.
  2840. */
  2841. total?: MaybeRef<number>;
  2842. /**
  2843. * The number of items to display per page.
  2844. * @default 10
  2845. */
  2846. pageSize?: MaybeRef<number>;
  2847. /**
  2848. * The current page number.
  2849. * @default 1
  2850. */
  2851. page?: MaybeRef<number>;
  2852. /**
  2853. * Callback when the `page` change.
  2854. */
  2855. onPageChange?: (returnValue: UnwrapNestedRefs<UseOffsetPaginationReturn>) => unknown;
  2856. /**
  2857. * Callback when the `pageSize` change.
  2858. */
  2859. onPageSizeChange?: (returnValue: UnwrapNestedRefs<UseOffsetPaginationReturn>) => unknown;
  2860. /**
  2861. * Callback when the `pageCount` change.
  2862. */
  2863. onPageCountChange?: (returnValue: UnwrapNestedRefs<UseOffsetPaginationReturn>) => unknown;
  2864. }
  2865. interface UseOffsetPaginationReturn {
  2866. currentPage: Ref<number>;
  2867. currentPageSize: Ref<number>;
  2868. pageCount: ComputedRef<number>;
  2869. isFirstPage: ComputedRef<boolean>;
  2870. isLastPage: ComputedRef<boolean>;
  2871. prev: () => void;
  2872. next: () => void;
  2873. }
  2874. declare type UseOffsetPaginationInfinityPageReturn = Omit<UseOffsetPaginationReturn, 'isLastPage'>;
  2875. declare function useOffsetPagination(options: Omit<UseOffsetPaginationOptions, 'total'>): UseOffsetPaginationInfinityPageReturn;
  2876. declare function useOffsetPagination(options: UseOffsetPaginationOptions): UseOffsetPaginationReturn;
  2877. /**
  2878. * Reactive online state.
  2879. *
  2880. * @see https://vueuse.org/useOnline
  2881. * @param options
  2882. */
  2883. declare function useOnline(options?: ConfigurableWindow): vue.Ref<boolean>;
  2884. /**
  2885. * Reactive state to show whether mouse leaves the page.
  2886. *
  2887. * @see https://vueuse.org/usePageLeave
  2888. * @param options
  2889. */
  2890. declare function usePageLeave(options?: ConfigurableWindow): vue_demi.Ref<boolean>;
  2891. interface UseParallaxOptions extends ConfigurableWindow {
  2892. deviceOrientationTiltAdjust?: (i: number) => number;
  2893. deviceOrientationRollAdjust?: (i: number) => number;
  2894. mouseTiltAdjust?: (i: number) => number;
  2895. mouseRollAdjust?: (i: number) => number;
  2896. }
  2897. interface UseParallaxReturn {
  2898. /**
  2899. * Roll value. Scaled to `-0.5 ~ 0.5`
  2900. */
  2901. roll: ComputedRef<number>;
  2902. /**
  2903. * Tilt value. Scaled to `-0.5 ~ 0.5`
  2904. */
  2905. tilt: ComputedRef<number>;
  2906. /**
  2907. * Sensor source, can be `mouse` or `deviceOrientation`
  2908. */
  2909. source: ComputedRef<'deviceOrientation' | 'mouse'>;
  2910. }
  2911. /**
  2912. * Create parallax effect easily. It uses `useDeviceOrientation` and fallback to `useMouse`
  2913. * if orientation is not supported.
  2914. *
  2915. * @param target
  2916. * @param options
  2917. */
  2918. declare function useParallax(target: MaybeElementRef, options?: UseParallaxOptions): UseParallaxReturn;
  2919. declare type DescriptorNamePolyfill = 'accelerometer' | 'accessibility-events' | 'ambient-light-sensor' | 'background-sync' | 'camera' | 'clipboard-read' | 'clipboard-write' | 'gyroscope' | 'magnetometer' | 'microphone' | 'notifications' | 'payment-handler' | 'persistent-storage' | 'push' | 'speaker';
  2920. declare type GeneralPermissionDescriptor = PermissionDescriptor | {
  2921. name: DescriptorNamePolyfill;
  2922. };
  2923. interface UsePermissionOptions<Controls extends boolean> extends ConfigurableNavigator {
  2924. /**
  2925. * Expose more controls
  2926. *
  2927. * @default false
  2928. */
  2929. controls?: Controls;
  2930. }
  2931. declare type UsePermissionReturn = Readonly<Ref<PermissionState | undefined>>;
  2932. interface UsePermissionReturnWithControls {
  2933. state: UsePermissionReturn;
  2934. isSupported: Ref<boolean>;
  2935. query: () => Promise<PermissionStatus | undefined>;
  2936. }
  2937. /**
  2938. * Reactive Permissions API.
  2939. *
  2940. * @see https://vueuse.org/usePermission
  2941. */
  2942. declare function usePermission(permissionDesc: GeneralPermissionDescriptor | GeneralPermissionDescriptor['name'], options?: UsePermissionOptions<false>): UsePermissionReturn;
  2943. declare function usePermission(permissionDesc: GeneralPermissionDescriptor | GeneralPermissionDescriptor['name'], options: UsePermissionOptions<true>): UsePermissionReturnWithControls;
  2944. interface UsePointerState extends Position {
  2945. pressure: number;
  2946. pointerId: number;
  2947. tiltX: number;
  2948. tiltY: number;
  2949. width: number;
  2950. height: number;
  2951. twist: number;
  2952. pointerType: PointerType | null;
  2953. }
  2954. interface UsePointerOptions extends ConfigurableWindow {
  2955. /**
  2956. * Pointer types that listen to.
  2957. *
  2958. * @default ['mouse', 'touch', 'pen']
  2959. */
  2960. pointerTypes?: PointerType[];
  2961. /**
  2962. * Initial values
  2963. */
  2964. initialValue?: MaybeRef<Partial<UsePointerState>>;
  2965. /**
  2966. * @default window
  2967. */
  2968. target?: MaybeRef<EventTarget | null | undefined> | Document | Window;
  2969. }
  2970. /**
  2971. * Reactive pointer state.
  2972. *
  2973. * @see https://vueuse.org/usePointer
  2974. * @param options
  2975. */
  2976. declare function usePointer(options?: UsePointerOptions): {
  2977. isInside: Ref<boolean>;
  2978. pressure: Ref<number>;
  2979. pointerId: Ref<number>;
  2980. tiltX: Ref<number>;
  2981. tiltY: Ref<number>;
  2982. width: Ref<number>;
  2983. height: Ref<number>;
  2984. twist: Ref<number>;
  2985. pointerType: Ref<PointerType | null>;
  2986. x: Ref<number>;
  2987. y: Ref<number>;
  2988. };
  2989. declare type UsePointerReturn = ReturnType<typeof usePointer>;
  2990. declare enum SwipeDirection {
  2991. UP = "UP",
  2992. RIGHT = "RIGHT",
  2993. DOWN = "DOWN",
  2994. LEFT = "LEFT",
  2995. NONE = "NONE"
  2996. }
  2997. interface UseSwipeOptions extends ConfigurableWindow {
  2998. /**
  2999. * Register events as passive
  3000. *
  3001. * @default true
  3002. */
  3003. passive?: boolean;
  3004. /**
  3005. * @default 50
  3006. */
  3007. threshold?: number;
  3008. /**
  3009. * Callback on swipe start
  3010. */
  3011. onSwipeStart?: (e: TouchEvent) => void;
  3012. /**
  3013. * Callback on swipe moves
  3014. */
  3015. onSwipe?: (e: TouchEvent) => void;
  3016. /**
  3017. * Callback on swipe ends
  3018. */
  3019. onSwipeEnd?: (e: TouchEvent, direction: SwipeDirection) => void;
  3020. }
  3021. interface UseSwipeReturn {
  3022. isPassiveEventSupported: boolean;
  3023. isSwiping: Ref<boolean>;
  3024. direction: ComputedRef<SwipeDirection | null>;
  3025. coordsStart: Readonly<Position>;
  3026. coordsEnd: Readonly<Position>;
  3027. lengthX: ComputedRef<number>;
  3028. lengthY: ComputedRef<number>;
  3029. stop: () => void;
  3030. }
  3031. /**
  3032. * Reactive swipe detection.
  3033. *
  3034. * @see https://vueuse.org/useSwipe
  3035. * @param target
  3036. * @param options
  3037. */
  3038. declare function useSwipe(target: MaybeComputedRef<EventTarget | null | undefined>, options?: UseSwipeOptions): UseSwipeReturn;
  3039. interface UsePointerSwipeOptions {
  3040. /**
  3041. * @default 50
  3042. */
  3043. threshold?: number;
  3044. /**
  3045. * Callback on swipe start.
  3046. */
  3047. onSwipeStart?: (e: PointerEvent) => void;
  3048. /**
  3049. * Callback on swipe move.
  3050. */
  3051. onSwipe?: (e: PointerEvent) => void;
  3052. /**
  3053. * Callback on swipe end.
  3054. */
  3055. onSwipeEnd?: (e: PointerEvent, direction: SwipeDirection) => void;
  3056. /**
  3057. * Pointer types to listen to.
  3058. *
  3059. * @default ['mouse', 'touch', 'pen']
  3060. */
  3061. pointerTypes?: PointerType[];
  3062. }
  3063. interface UsePointerSwipeReturn {
  3064. readonly isSwiping: Ref<boolean>;
  3065. direction: Readonly<Ref<SwipeDirection | null>>;
  3066. readonly posStart: Position;
  3067. readonly posEnd: Position;
  3068. distanceX: Readonly<Ref<number>>;
  3069. distanceY: Readonly<Ref<number>>;
  3070. stop: () => void;
  3071. }
  3072. /**
  3073. * Reactive swipe detection based on PointerEvents.
  3074. *
  3075. * @see https://vueuse.org/usePointerSwipe
  3076. * @param target
  3077. * @param options
  3078. */
  3079. declare function usePointerSwipe(target: MaybeComputedRef<HTMLElement | null | undefined>, options?: UsePointerSwipeOptions): UsePointerSwipeReturn;
  3080. declare type ColorSchemeType = 'dark' | 'light' | 'no-preference';
  3081. /**
  3082. * Reactive prefers-color-scheme media query.
  3083. *
  3084. * @see https://vueuse.org/usePreferredColorScheme
  3085. * @param [options]
  3086. */
  3087. declare function usePreferredColorScheme(options?: ConfigurableWindow): vue_demi.ComputedRef<ColorSchemeType>;
  3088. declare type ContrastType = 'more' | 'less' | 'custom' | 'no-preference';
  3089. /**
  3090. * Reactive prefers-contrast media query.
  3091. *
  3092. * @see https://vueuse.org/usePreferredContrast
  3093. * @param [options]
  3094. */
  3095. declare function usePreferredContrast(options?: ConfigurableWindow): vue_demi.ComputedRef<ContrastType>;
  3096. /**
  3097. * Reactive dark theme preference.
  3098. *
  3099. * @see https://vueuse.org/usePreferredDark
  3100. * @param [options]
  3101. */
  3102. declare function usePreferredDark(options?: ConfigurableWindow): vue.Ref<boolean>;
  3103. /**
  3104. * Reactive Navigator Languages.
  3105. *
  3106. * @see https://vueuse.org/usePreferredLanguages
  3107. * @param options
  3108. */
  3109. declare function usePreferredLanguages(options?: ConfigurableWindow): Ref<readonly string[]>;
  3110. declare type ReducedMotionType = 'reduce' | 'no-preference';
  3111. /**
  3112. * Reactive prefers-reduced-motion media query.
  3113. *
  3114. * @see https://vueuse.org/usePreferredReducedMotion
  3115. * @param [options]
  3116. */
  3117. declare function usePreferredReducedMotion(options?: ConfigurableWindow): vue_demi.ComputedRef<ReducedMotionType>;
  3118. interface UseRafFnCallbackArguments {
  3119. /**
  3120. * Time elapsed between this and the last frame.
  3121. */
  3122. delta: number;
  3123. /**
  3124. * Time elapsed since the creation of the web page. See {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp#the_time_origin Time origin}.
  3125. */
  3126. timestamp: DOMHighResTimeStamp;
  3127. }
  3128. interface UseRafFnOptions extends ConfigurableWindow {
  3129. /**
  3130. * Start the requestAnimationFrame loop immediately on creation
  3131. *
  3132. * @default true
  3133. */
  3134. immediate?: boolean;
  3135. }
  3136. /**
  3137. * Call function on every `requestAnimationFrame`. With controls of pausing and resuming.
  3138. *
  3139. * @see https://vueuse.org/useRafFn
  3140. * @param fn
  3141. * @param options
  3142. */
  3143. declare function useRafFn(fn: (args: UseRafFnCallbackArguments) => void, options?: UseRafFnOptions): Pausable;
  3144. /**
  3145. * Reactive screen orientation
  3146. *
  3147. * @see https://vueuse.org/useScreenOrientation
  3148. */
  3149. declare const useScreenOrientation: (options?: ConfigurableWindow) => {
  3150. isSupported: vue_demi.Ref<boolean>;
  3151. orientation: vue_demi.Ref<OrientationType | undefined>;
  3152. angle: vue_demi.Ref<number>;
  3153. lockOrientation: (type: OrientationLockType) => Promise<void>;
  3154. unlockOrientation: () => void;
  3155. };
  3156. declare type UseScreenOrientationReturn = ReturnType<typeof useScreenOrientation>;
  3157. /**
  3158. * Reactive `env(safe-area-inset-*)`
  3159. *
  3160. * @see https://vueuse.org/useScreenSafeArea
  3161. */
  3162. declare function useScreenSafeArea(): {
  3163. top: vue_demi.Ref<string>;
  3164. right: vue_demi.Ref<string>;
  3165. bottom: vue_demi.Ref<string>;
  3166. left: vue_demi.Ref<string>;
  3167. update: () => void;
  3168. };
  3169. interface UseScriptTagOptions extends ConfigurableDocument {
  3170. /**
  3171. * Load the script immediately
  3172. *
  3173. * @default true
  3174. */
  3175. immediate?: boolean;
  3176. /**
  3177. * Add `async` attribute to the script tag
  3178. *
  3179. * @default true
  3180. */
  3181. async?: boolean;
  3182. /**
  3183. * Script type
  3184. *
  3185. * @default 'text/javascript'
  3186. */
  3187. type?: string;
  3188. /**
  3189. * Manual controls the timing of loading and unloading
  3190. *
  3191. * @default false
  3192. */
  3193. manual?: boolean;
  3194. crossOrigin?: 'anonymous' | 'use-credentials';
  3195. referrerPolicy?: 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
  3196. noModule?: boolean;
  3197. defer?: boolean;
  3198. /**
  3199. * Add custom attribute to the script tag
  3200. *
  3201. */
  3202. attrs?: Record<string, string>;
  3203. }
  3204. /**
  3205. * Async script tag loading.
  3206. *
  3207. * @see https://vueuse.org/useScriptTag
  3208. * @param src
  3209. * @param onLoaded
  3210. * @param options
  3211. */
  3212. declare function useScriptTag(src: MaybeComputedRef<string>, onLoaded?: (el: HTMLScriptElement) => void, options?: UseScriptTagOptions): {
  3213. scriptTag: vue_demi.Ref<HTMLScriptElement | null>;
  3214. load: (waitForScriptLoad?: boolean) => Promise<HTMLScriptElement | boolean>;
  3215. unload: () => void;
  3216. };
  3217. declare type UseScriptTagReturn = ReturnType<typeof useScriptTag>;
  3218. /**
  3219. * Lock scrolling of the element.
  3220. *
  3221. * @see https://vueuse.org/useScrollLock
  3222. * @param element
  3223. */
  3224. declare function useScrollLock(element: MaybeComputedRef<HTMLElement | SVGElement | Window | Document | null | undefined>, initialState?: boolean): vue_demi.WritableComputedRef<boolean>;
  3225. declare function useSessionStorage(key: string, initialValue: MaybeComputedRef<string>, options?: UseStorageOptions<string>): RemovableRef<string>;
  3226. declare function useSessionStorage(key: string, initialValue: MaybeComputedRef<boolean>, options?: UseStorageOptions<boolean>): RemovableRef<boolean>;
  3227. declare function useSessionStorage(key: string, initialValue: MaybeComputedRef<number>, options?: UseStorageOptions<number>): RemovableRef<number>;
  3228. declare function useSessionStorage<T>(key: string, initialValue: MaybeComputedRef<T>, options?: UseStorageOptions<T>): RemovableRef<T>;
  3229. declare function useSessionStorage<T = unknown>(key: string, initialValue: MaybeComputedRef<null>, options?: UseStorageOptions<T>): RemovableRef<T>;
  3230. interface UseShareOptions {
  3231. title?: string;
  3232. files?: File[];
  3233. text?: string;
  3234. url?: string;
  3235. }
  3236. /**
  3237. * Reactive Web Share API.
  3238. *
  3239. * @see https://vueuse.org/useShare
  3240. * @param shareOptions
  3241. * @param options
  3242. */
  3243. declare function useShare(shareOptions?: MaybeComputedRef<UseShareOptions>, options?: ConfigurableNavigator): {
  3244. isSupported: vue.Ref<boolean>;
  3245. share: (overrideOptions?: MaybeComputedRef<UseShareOptions>) => Promise<void>;
  3246. };
  3247. declare type UseShareReturn = ReturnType<typeof useShare>;
  3248. declare type UseSortedCompareFn<T = any> = (a: T, b: T) => number;
  3249. declare type UseSortedFn<T = any> = (arr: T[], compareFn: UseSortedCompareFn<T>) => T[];
  3250. interface UseSortedOptions<T = any> {
  3251. /**
  3252. * sort algorithm
  3253. */
  3254. sortFn?: UseSortedFn<T>;
  3255. /**
  3256. * compare function
  3257. */
  3258. compareFn?: UseSortedCompareFn<T>;
  3259. /**
  3260. * change the value of the source array
  3261. * @default false
  3262. */
  3263. dirty?: boolean;
  3264. }
  3265. declare function useSorted<T = any>(source: MaybeRef<T[]>, compareFn?: UseSortedCompareFn<T>): Ref<T[]>;
  3266. declare function useSorted<T = any>(source: MaybeRef<T[]>, options?: UseSortedOptions<T>): Ref<T[]>;
  3267. declare function useSorted<T = any>(source: MaybeRef<T[]>, compareFn?: UseSortedCompareFn<T>, options?: Omit<UseSortedOptions<T>, 'compareFn'>): Ref<T[]>;
  3268. declare type SpeechRecognitionErrorCode = 'aborted' | 'audio-capture' | 'bad-grammar' | 'language-not-supported' | 'network' | 'no-speech' | 'not-allowed' | 'service-not-allowed';
  3269. interface SpeechGrammar {
  3270. src: string;
  3271. weight: number;
  3272. }
  3273. interface SpeechGrammarList {
  3274. readonly length: number;
  3275. addFromString(string: string, weight?: number): void;
  3276. addFromURI(src: string, weight?: number): void;
  3277. item(index: number): SpeechGrammar;
  3278. [index: number]: SpeechGrammar;
  3279. }
  3280. interface SpeechRecognitionErrorEvent extends Event {
  3281. readonly error: SpeechRecognitionErrorCode;
  3282. readonly message: string;
  3283. }
  3284. interface SpeechRecognitionEvent extends Event {
  3285. readonly resultIndex: number;
  3286. readonly results: SpeechRecognitionResultList;
  3287. }
  3288. interface SpeechRecognitionEventMap {
  3289. 'audioend': Event;
  3290. 'audiostart': Event;
  3291. 'end': Event;
  3292. 'error': SpeechRecognitionErrorEvent;
  3293. 'nomatch': SpeechRecognitionEvent;
  3294. 'result': SpeechRecognitionEvent;
  3295. 'soundend': Event;
  3296. 'soundstart': Event;
  3297. 'speechend': Event;
  3298. 'speechstart': Event;
  3299. 'start': Event;
  3300. }
  3301. interface SpeechRecognition extends EventTarget {
  3302. continuous: boolean;
  3303. grammars: SpeechGrammarList;
  3304. interimResults: boolean;
  3305. lang: string;
  3306. maxAlternatives: number;
  3307. onaudioend: ((this: SpeechRecognition, ev: Event) => any) | null;
  3308. onaudiostart: ((this: SpeechRecognition, ev: Event) => any) | null;
  3309. onend: ((this: SpeechRecognition, ev: Event) => any) | null;
  3310. onerror: ((this: SpeechRecognition, ev: SpeechRecognitionErrorEvent) => any) | null;
  3311. onnomatch: ((this: SpeechRecognition, ev: SpeechRecognitionEvent) => any) | null;
  3312. onresult: ((this: SpeechRecognition, ev: SpeechRecognitionEvent) => any) | null;
  3313. onsoundend: ((this: SpeechRecognition, ev: Event) => any) | null;
  3314. onsoundstart: ((this: SpeechRecognition, ev: Event) => any) | null;
  3315. onspeechend: ((this: SpeechRecognition, ev: Event) => any) | null;
  3316. onspeechstart: ((this: SpeechRecognition, ev: Event) => any) | null;
  3317. onstart: ((this: SpeechRecognition, ev: Event) => any) | null;
  3318. abort(): void;
  3319. start(): void;
  3320. stop(): void;
  3321. addEventListener<K extends keyof SpeechRecognitionEventMap>(type: K, listener: (this: SpeechRecognition, ev: SpeechRecognitionEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
  3322. addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
  3323. removeEventListener<K extends keyof SpeechRecognitionEventMap>(type: K, listener: (this: SpeechRecognition, ev: SpeechRecognitionEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
  3324. removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
  3325. }
  3326. interface UseSpeechRecognitionOptions extends ConfigurableWindow {
  3327. /**
  3328. * Controls whether continuous results are returned for each recognition, or only a single result.
  3329. *
  3330. * @default true
  3331. */
  3332. continuous?: boolean;
  3333. /**
  3334. * Controls whether interim results should be returned (true) or not (false.) Interim results are results that are not yet final
  3335. *
  3336. * @default true
  3337. */
  3338. interimResults?: boolean;
  3339. /**
  3340. * Language for SpeechRecognition
  3341. *
  3342. * @default 'en-US'
  3343. */
  3344. lang?: MaybeComputedRef<string>;
  3345. }
  3346. /**
  3347. * Reactive SpeechRecognition.
  3348. *
  3349. * @see https://vueuse.org/useSpeechRecognition
  3350. * @see https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition SpeechRecognition
  3351. * @param options
  3352. */
  3353. declare function useSpeechRecognition(options?: UseSpeechRecognitionOptions): {
  3354. isSupported: Ref<boolean>;
  3355. isListening: Ref<boolean>;
  3356. isFinal: Ref<boolean>;
  3357. recognition: SpeechRecognition | undefined;
  3358. result: Ref<string>;
  3359. error: Ref<SpeechRecognitionErrorEvent | undefined>;
  3360. toggle: (value?: boolean) => void;
  3361. start: () => void;
  3362. stop: () => void;
  3363. };
  3364. declare type UseSpeechRecognitionReturn = ReturnType<typeof useSpeechRecognition>;
  3365. declare type UseSpeechSynthesisStatus = 'init' | 'play' | 'pause' | 'end';
  3366. interface UseSpeechSynthesisOptions extends ConfigurableWindow {
  3367. /**
  3368. * Language for SpeechSynthesis
  3369. *
  3370. * @default 'en-US'
  3371. */
  3372. lang?: MaybeComputedRef<string>;
  3373. /**
  3374. * Gets and sets the pitch at which the utterance will be spoken at.
  3375. *
  3376. * @default 1
  3377. */
  3378. pitch?: SpeechSynthesisUtterance['pitch'];
  3379. /**
  3380. * Gets and sets the speed at which the utterance will be spoken at.
  3381. *
  3382. * @default 1
  3383. */
  3384. rate?: SpeechSynthesisUtterance['rate'];
  3385. /**
  3386. * Gets and sets the voice that will be used to speak the utterance.
  3387. */
  3388. voice?: MaybeRef<SpeechSynthesisVoice>;
  3389. /**
  3390. * Gets and sets the volume that the utterance will be spoken at.
  3391. *
  3392. * @default 1
  3393. */
  3394. volume?: SpeechSynthesisUtterance['volume'];
  3395. }
  3396. /**
  3397. * Reactive SpeechSynthesis.
  3398. *
  3399. * @see https://vueuse.org/useSpeechSynthesis
  3400. * @see https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesis SpeechSynthesis
  3401. * @param options
  3402. */
  3403. declare function useSpeechSynthesis(text: MaybeComputedRef<string>, options?: UseSpeechSynthesisOptions): {
  3404. isSupported: Ref<boolean>;
  3405. isPlaying: Ref<boolean>;
  3406. status: Ref<UseSpeechSynthesisStatus>;
  3407. utterance: vue_demi.ComputedRef<SpeechSynthesisUtterance>;
  3408. error: Ref<SpeechSynthesisErrorEvent | undefined>;
  3409. toggle: (value?: boolean) => void;
  3410. speak: () => void;
  3411. };
  3412. declare type UseSpeechSynthesisReturn = ReturnType<typeof useSpeechSynthesis>;
  3413. interface UseStepperReturn<StepName, Steps, Step> {
  3414. /** List of steps. */
  3415. steps: Readonly<Ref<Steps>>;
  3416. /** List of step names. */
  3417. stepNames: Readonly<Ref<StepName[]>>;
  3418. /** Index of the current step. */
  3419. index: Ref<number>;
  3420. /** Current step. */
  3421. current: ComputedRef<Step>;
  3422. /** Next step, or undefined if the current step is the last one. */
  3423. next: ComputedRef<StepName | undefined>;
  3424. /** Previous step, or undefined if the current step is the first one. */
  3425. previous: ComputedRef<StepName | undefined>;
  3426. /** Whether the current step is the first one. */
  3427. isFirst: ComputedRef<boolean>;
  3428. /** Whether the current step is the last one. */
  3429. isLast: ComputedRef<boolean>;
  3430. /** Get the step at the specified index. */
  3431. at: (index: number) => Step | undefined;
  3432. /** Get a step by the specified name. */
  3433. get: (step: StepName) => Step | undefined;
  3434. /** Go to the specified step. */
  3435. goTo: (step: StepName) => void;
  3436. /** Go to the next step. Does nothing if the current step is the last one. */
  3437. goToNext: () => void;
  3438. /** Go to the previous step. Does nothing if the current step is the previous one. */
  3439. goToPrevious: () => void;
  3440. /** Go back to the given step, only if the current step is after. */
  3441. goBackTo: (step: StepName) => void;
  3442. /** Checks whether the given step is the next step. */
  3443. isNext: (step: StepName) => boolean;
  3444. /** Checks whether the given step is the previous step. */
  3445. isPrevious: (step: StepName) => boolean;
  3446. /** Checks whether the given step is the current step. */
  3447. isCurrent: (step: StepName) => boolean;
  3448. /** Checks if the current step is before the given step. */
  3449. isBefore: (step: StepName) => boolean;
  3450. /** Checks if the current step is after the given step. */
  3451. isAfter: (step: StepName) => boolean;
  3452. }
  3453. declare function useStepper<T extends string | number>(steps: MaybeRef<T[]>, initialStep?: T): UseStepperReturn<T, T[], T>;
  3454. declare function useStepper<T extends Record<string, any>>(steps: MaybeRef<T>, initialStep?: keyof T): UseStepperReturn<Exclude<keyof T, symbol>, T, T[keyof T]>;
  3455. interface UseStorageAsyncOptions<T> extends Omit<UseStorageOptions<T>, 'serializer'> {
  3456. /**
  3457. * Custom data serialization
  3458. */
  3459. serializer?: SerializerAsync<T>;
  3460. }
  3461. declare function useStorageAsync(key: string, initialValue: MaybeComputedRef<string>, storage?: StorageLikeAsync, options?: UseStorageAsyncOptions<string>): RemovableRef<string>;
  3462. declare function useStorageAsync(key: string, initialValue: MaybeComputedRef<boolean>, storage?: StorageLikeAsync, options?: UseStorageAsyncOptions<boolean>): RemovableRef<boolean>;
  3463. declare function useStorageAsync(key: string, initialValue: MaybeComputedRef<number>, storage?: StorageLikeAsync, options?: UseStorageAsyncOptions<number>): RemovableRef<number>;
  3464. declare function useStorageAsync<T>(key: string, initialValue: MaybeComputedRef<T>, storage?: StorageLikeAsync, options?: UseStorageAsyncOptions<T>): RemovableRef<T>;
  3465. declare function useStorageAsync<T = unknown>(key: string, initialValue: MaybeComputedRef<null>, storage?: StorageLikeAsync, options?: UseStorageAsyncOptions<T>): RemovableRef<T>;
  3466. interface UseStyleTagOptions extends ConfigurableDocument {
  3467. /**
  3468. * Media query for styles to apply
  3469. */
  3470. media?: string;
  3471. /**
  3472. * Load the style immediately
  3473. *
  3474. * @default true
  3475. */
  3476. immediate?: boolean;
  3477. /**
  3478. * Manual controls the timing of loading and unloading
  3479. *
  3480. * @default false
  3481. */
  3482. manual?: boolean;
  3483. /**
  3484. * DOM id of the style tag
  3485. *
  3486. * @default auto-incremented
  3487. */
  3488. id?: string;
  3489. }
  3490. interface UseStyleTagReturn {
  3491. id: string;
  3492. css: Ref<string>;
  3493. load: () => void;
  3494. unload: () => void;
  3495. isLoaded: Readonly<Ref<boolean>>;
  3496. }
  3497. /**
  3498. * Inject <style> element in head.
  3499. *
  3500. * Overload: Omitted id
  3501. *
  3502. * @see https://vueuse.org/useStyleTag
  3503. * @param css
  3504. * @param options
  3505. */
  3506. declare function useStyleTag(css: MaybeRef<string>, options?: UseStyleTagOptions): UseStyleTagReturn;
  3507. declare function useSupported(callback: () => unknown, sync?: boolean): Ref<boolean>;
  3508. declare type TemplateRefsList<T> = T[] & {
  3509. set(el: Object | null): void;
  3510. };
  3511. declare function useTemplateRefsList<T = Element>(): Readonly<Ref<Readonly<TemplateRefsList<T>>>>;
  3512. declare type UseTextDirectionValue = 'ltr' | 'rtl' | 'auto';
  3513. interface UseTextDirectionOptions extends ConfigurableDocument {
  3514. /**
  3515. * CSS Selector for the target element applying to
  3516. *
  3517. * @default 'html'
  3518. */
  3519. selector?: string;
  3520. /**
  3521. * Observe `document.querySelector(selector)` changes using MutationObserve
  3522. *
  3523. * @default false
  3524. */
  3525. observe?: boolean;
  3526. /**
  3527. * Initial value
  3528. *
  3529. * @default 'ltr'
  3530. */
  3531. initialValue?: UseTextDirectionValue;
  3532. }
  3533. /**
  3534. * Reactive dir of the element's text.
  3535. *
  3536. * @see https://vueuse.org/useTextDirection
  3537. */
  3538. declare function useTextDirection(options?: UseTextDirectionOptions): vue_demi.WritableComputedRef<UseTextDirectionValue>;
  3539. /**
  3540. * Reactively track user text selection based on [`Window.getSelection`](https://developer.mozilla.org/en-US/docs/Web/API/Window/getSelection).
  3541. *
  3542. * @see https://vueuse.org/useTextSelection
  3543. */
  3544. declare function useTextSelection(options?: ConfigurableWindow): {
  3545. text: vue_demi.ComputedRef<string>;
  3546. rects: vue_demi.ComputedRef<DOMRect[]>;
  3547. ranges: vue_demi.ComputedRef<Range[]>;
  3548. selection: vue_demi.Ref<{
  3549. readonly anchorNode: Node | null;
  3550. readonly anchorOffset: number;
  3551. readonly focusNode: Node | null;
  3552. readonly focusOffset: number;
  3553. readonly isCollapsed: boolean;
  3554. readonly rangeCount: number;
  3555. readonly type: string;
  3556. addRange: (range: Range) => void;
  3557. collapse: (node: Node | null, offset?: number | undefined) => void;
  3558. collapseToEnd: () => void;
  3559. collapseToStart: () => void;
  3560. containsNode: (node: Node, allowPartialContainment?: boolean | undefined) => boolean;
  3561. deleteFromDocument: () => void;
  3562. empty: () => void;
  3563. extend: (node: Node, offset?: number | undefined) => void;
  3564. getRangeAt: (index: number) => Range;
  3565. removeAllRanges: () => void;
  3566. removeRange: (range: Range) => void;
  3567. selectAllChildren: (node: Node) => void;
  3568. setBaseAndExtent: (anchorNode: Node, anchorOffset: number, focusNode: Node, focusOffset: number) => void;
  3569. setPosition: (node: Node | null, offset?: number | undefined) => void;
  3570. toString: () => string;
  3571. } | null>;
  3572. };
  3573. declare type UseTextSelectionReturn = ReturnType<typeof useTextSelection>;
  3574. interface UseTextareaAutosizeOptions {
  3575. /** Textarea element to autosize. */
  3576. element?: MaybeRef<HTMLTextAreaElement | undefined>;
  3577. /** Textarea content. */
  3578. input?: MaybeRef<string | undefined>;
  3579. /** Watch sources that should trigger a textarea resize. */
  3580. watch?: WatchSource | Array<WatchSource>;
  3581. /** Function called when the textarea size changes. */
  3582. onResize?: () => void;
  3583. }
  3584. declare function useTextareaAutosize(options?: UseTextareaAutosizeOptions): {
  3585. textarea: vue_demi.Ref<HTMLTextAreaElement>;
  3586. input: vue_demi.Ref<string>;
  3587. triggerResize: () => void;
  3588. };
  3589. declare type UseTextareaAutosizeReturn = ReturnType<typeof useTextareaAutosize>;
  3590. declare type UseThrottledRefHistoryOptions<Raw, Serialized = Raw> = Omit<UseRefHistoryOptions<Raw, Serialized>, 'eventFilter'> & {
  3591. throttle?: MaybeRef<number>;
  3592. trailing?: boolean;
  3593. };
  3594. declare type UseThrottledRefHistoryReturn<Raw, Serialized = Raw> = UseRefHistoryReturn<Raw, Serialized>;
  3595. /**
  3596. * Shorthand for [useRefHistory](https://vueuse.org/useRefHistory) with throttled filter.
  3597. *
  3598. * @see https://vueuse.org/useThrottledRefHistory
  3599. * @param source
  3600. * @param options
  3601. */
  3602. declare function useThrottledRefHistory<Raw, Serialized = Raw>(source: Ref<Raw>, options?: UseThrottledRefHistoryOptions<Raw, Serialized>): UseThrottledRefHistoryReturn<Raw, Serialized>;
  3603. declare type UseTimeAgoFormatter<T = number> = (value: T, isPast: boolean) => string;
  3604. declare type UseTimeAgoUnitNamesDefault = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
  3605. interface UseTimeAgoMessagesBuiltIn {
  3606. justNow: string;
  3607. past: string | UseTimeAgoFormatter<string>;
  3608. future: string | UseTimeAgoFormatter<string>;
  3609. invalid: string;
  3610. }
  3611. declare type UseTimeAgoMessages<UnitNames extends string = UseTimeAgoUnitNamesDefault> = UseTimeAgoMessagesBuiltIn & Record<UnitNames, string | UseTimeAgoFormatter<number>>;
  3612. interface FormatTimeAgoOptions<UnitNames extends string = UseTimeAgoUnitNamesDefault> {
  3613. /**
  3614. * Maximum unit (of diff in milliseconds) to display the full date instead of relative
  3615. *
  3616. * @default undefined
  3617. */
  3618. max?: UnitNames | number;
  3619. /**
  3620. * Formatter for full date
  3621. */
  3622. fullDateFormatter?: (date: Date) => string;
  3623. /**
  3624. * Messages for formatting the string
  3625. */
  3626. messages?: UseTimeAgoMessages<UnitNames>;
  3627. /**
  3628. * Minimum display time unit (default is minute)
  3629. *
  3630. * @default false
  3631. */
  3632. showSecond?: boolean;
  3633. /**
  3634. * Rounding method to apply.
  3635. *
  3636. * @default 'round'
  3637. */
  3638. rounding?: 'round' | 'ceil' | 'floor' | number;
  3639. /**
  3640. * Custom units
  3641. */
  3642. units?: UseTimeAgoUnit<UseTimeAgoUnitNamesDefault>[];
  3643. }
  3644. interface UseTimeAgoOptions<Controls extends boolean, UnitNames extends string = UseTimeAgoUnitNamesDefault> extends FormatTimeAgoOptions<UnitNames> {
  3645. /**
  3646. * Expose more controls
  3647. *
  3648. * @default false
  3649. */
  3650. controls?: Controls;
  3651. /**
  3652. * Intervals to update, set 0 to disable auto update
  3653. *
  3654. * @default 30_000
  3655. */
  3656. updateInterval?: number;
  3657. }
  3658. interface UseTimeAgoUnit<Unit extends string = UseTimeAgoUnitNamesDefault> {
  3659. max: number;
  3660. value: number;
  3661. name: Unit;
  3662. }
  3663. declare type UseTimeAgoReturn<Controls extends boolean = false> = Controls extends true ? {
  3664. timeAgo: ComputedRef<string>;
  3665. } & Pausable : ComputedRef<string>;
  3666. /**
  3667. * Reactive time ago formatter.
  3668. *
  3669. * @see https://vueuse.org/useTimeAgo
  3670. * @param options
  3671. */
  3672. declare function useTimeAgo<UnitNames extends string = UseTimeAgoUnitNamesDefault>(time: MaybeComputedRef<Date | number | string>, options?: UseTimeAgoOptions<false, UnitNames>): UseTimeAgoReturn<false>;
  3673. declare function useTimeAgo<UnitNames extends string = UseTimeAgoUnitNamesDefault>(time: MaybeComputedRef<Date | number | string>, options: UseTimeAgoOptions<true, UnitNames>): UseTimeAgoReturn<true>;
  3674. declare function formatTimeAgo<UnitNames extends string = UseTimeAgoUnitNamesDefault>(from: Date, options?: FormatTimeAgoOptions<UnitNames>, now?: Date | number): string;
  3675. declare function useTimeoutPoll(fn: () => Awaitable<void>, interval: MaybeComputedRef<number>, timeoutPollOptions?: UseTimeoutFnOptions): Pausable;
  3676. interface UseTimestampOptions<Controls extends boolean> {
  3677. /**
  3678. * Expose more controls
  3679. *
  3680. * @default false
  3681. */
  3682. controls?: Controls;
  3683. /**
  3684. * Offset value adding to the value
  3685. *
  3686. * @default 0
  3687. */
  3688. offset?: number;
  3689. /**
  3690. * Update the timestamp immediately
  3691. *
  3692. * @default true
  3693. */
  3694. immediate?: boolean;
  3695. /**
  3696. * Update interval, or use requestAnimationFrame
  3697. *
  3698. * @default requestAnimationFrame
  3699. */
  3700. interval?: 'requestAnimationFrame' | number;
  3701. /**
  3702. * Callback on each update
  3703. */
  3704. callback?: (timestamp: number) => void;
  3705. }
  3706. /**
  3707. * Reactive current timestamp.
  3708. *
  3709. * @see https://vueuse.org/useTimestamp
  3710. * @param options
  3711. */
  3712. declare function useTimestamp(options?: UseTimestampOptions<false>): Ref<number>;
  3713. declare function useTimestamp(options: UseTimestampOptions<true>): {
  3714. timestamp: Ref<number>;
  3715. } & Pausable;
  3716. declare type UseTimestampReturn = ReturnType<typeof useTimestamp>;
  3717. declare type UseTitleOptionsBase = {
  3718. /**
  3719. * Observe `document.title` changes using MutationObserve
  3720. * Cannot be used together with `titleTemplate` option.
  3721. *
  3722. * @default false
  3723. */
  3724. observe?: boolean;
  3725. } | {
  3726. /**
  3727. * The template string to parse the title (e.g., '%s | My Website')
  3728. * Cannot be used together with `observe` option.
  3729. *
  3730. * @default '%s'
  3731. */
  3732. titleTemplate?: MaybeRef<string> | ((title: string) => string);
  3733. };
  3734. declare type UseTitleOptions = ConfigurableDocument & UseTitleOptionsBase;
  3735. declare function useTitle(newTitle: MaybeReadonlyRef<string | null | undefined>, options?: UseTitleOptions): ComputedRef<string | null | undefined>;
  3736. declare function useTitle(newTitle?: MaybeRef<string | null | undefined>, options?: UseTitleOptions): Ref<string | null | undefined>;
  3737. declare type UseTitleReturn = ReturnType<typeof useTitle>;
  3738. /**
  3739. * Cubic bezier points
  3740. */
  3741. declare type CubicBezierPoints = [number, number, number, number];
  3742. /**
  3743. * Easing function
  3744. */
  3745. declare type EasingFunction = (n: number) => number;
  3746. /**
  3747. * Transition options
  3748. */
  3749. interface UseTransitionOptions {
  3750. /**
  3751. * Milliseconds to wait before starting transition
  3752. */
  3753. delay?: MaybeRef<number>;
  3754. /**
  3755. * Disables the transition
  3756. */
  3757. disabled?: MaybeRef<boolean>;
  3758. /**
  3759. * Transition duration in milliseconds
  3760. */
  3761. duration?: MaybeRef<number>;
  3762. /**
  3763. * Callback to execute after transition finishes
  3764. */
  3765. onFinished?: () => void;
  3766. /**
  3767. * Callback to execute after transition starts
  3768. */
  3769. onStarted?: () => void;
  3770. /**
  3771. * Easing function or cubic bezier points for calculating transition values
  3772. */
  3773. transition?: MaybeRef<EasingFunction | CubicBezierPoints>;
  3774. }
  3775. /**
  3776. * Common transitions
  3777. *
  3778. * @see https://easings.net
  3779. */
  3780. declare const TransitionPresets: Record<"easeInSine" | "easeOutSine" | "easeInOutSine" | "easeInQuad" | "easeOutQuad" | "easeInOutQuad" | "easeInCubic" | "easeOutCubic" | "easeInOutCubic" | "easeInQuart" | "easeOutQuart" | "easeInOutQuart" | "easeInQuint" | "easeOutQuint" | "easeInOutQuint" | "easeInExpo" | "easeOutExpo" | "easeInOutExpo" | "easeInCirc" | "easeOutCirc" | "easeInOutCirc" | "easeInBack" | "easeOutBack" | "easeInOutBack", CubicBezierPoints> & {
  3781. linear: EasingFunction;
  3782. };
  3783. declare function useTransition(source: Ref<number>, options?: UseTransitionOptions): ComputedRef<number>;
  3784. declare function useTransition<T extends MaybeRef<number>[]>(source: [...T], options?: UseTransitionOptions): ComputedRef<{
  3785. [K in keyof T]: number;
  3786. }>;
  3787. declare function useTransition<T extends Ref<number[]>>(source: T, options?: UseTransitionOptions): ComputedRef<number[]>;
  3788. declare type UrlParams = Record<string, string[] | string>;
  3789. interface UseUrlSearchParamsOptions<T> extends ConfigurableWindow {
  3790. /**
  3791. * @default true
  3792. */
  3793. removeNullishValues?: boolean;
  3794. /**
  3795. * @default false
  3796. */
  3797. removeFalsyValues?: boolean;
  3798. /**
  3799. * @default {}
  3800. */
  3801. initialValue?: T;
  3802. /**
  3803. * Write back to `window.history` automatically
  3804. *
  3805. * @default true
  3806. */
  3807. write?: boolean;
  3808. }
  3809. /**
  3810. * Reactive URLSearchParams
  3811. *
  3812. * @see https://vueuse.org/useUrlSearchParams
  3813. * @param mode
  3814. * @param options
  3815. */
  3816. declare function useUrlSearchParams<T extends Record<string, any> = UrlParams>(mode?: 'history' | 'hash' | 'hash-params', options?: UseUrlSearchParamsOptions<T>): T;
  3817. interface UseUserMediaOptions extends ConfigurableNavigator {
  3818. /**
  3819. * If the stream is enabled
  3820. * @default false
  3821. */
  3822. enabled?: MaybeRef<boolean>;
  3823. /**
  3824. * Recreate stream when the input devices id changed
  3825. *
  3826. * @default true
  3827. */
  3828. autoSwitch?: MaybeRef<boolean>;
  3829. /**
  3830. * The device id of video input
  3831. *
  3832. * When passing with `undefined` the default device will be used.
  3833. * Pass `false` or "none" to disabled video input
  3834. *
  3835. * @default undefined
  3836. */
  3837. videoDeviceId?: MaybeRef<string | undefined | false | 'none'>;
  3838. /**
  3839. * The device id of audi input
  3840. *
  3841. * When passing with `undefined` the default device will be used.
  3842. * Pass `false` or "none" to disabled audi input
  3843. *
  3844. * @default undefined
  3845. */
  3846. audioDeviceId?: MaybeRef<string | undefined | false | 'none'>;
  3847. }
  3848. /**
  3849. * Reactive `mediaDevices.getUserMedia` streaming
  3850. *
  3851. * @see https://vueuse.org/useUserMedia
  3852. * @param options
  3853. */
  3854. declare function useUserMedia(options?: UseUserMediaOptions): {
  3855. isSupported: Ref<boolean>;
  3856. stream: Ref<MediaStream | undefined>;
  3857. start: () => Promise<MediaStream | undefined>;
  3858. stop: () => void;
  3859. restart: () => Promise<MediaStream | undefined>;
  3860. videoDeviceId: Ref<string | false | undefined>;
  3861. audioDeviceId: Ref<string | false | undefined>;
  3862. enabled: Ref<boolean>;
  3863. autoSwitch: Ref<boolean>;
  3864. };
  3865. declare type UseUserMediaReturn = ReturnType<typeof useUserMedia>;
  3866. interface UseVModelOptions<T> {
  3867. /**
  3868. * When passive is set to `true`, it will use `watch` to sync with props and ref.
  3869. * Instead of relying on the `v-model` or `.sync` to work.
  3870. *
  3871. * @default false
  3872. */
  3873. passive?: boolean;
  3874. /**
  3875. * When eventName is set, it's value will be used to overwrite the emit event name.
  3876. *
  3877. * @default undefined
  3878. */
  3879. eventName?: string;
  3880. /**
  3881. * Attempting to check for changes of properties in a deeply nested object or array.
  3882. * Apply only when `passive` option is set to `true`
  3883. *
  3884. * @default false
  3885. */
  3886. deep?: boolean;
  3887. /**
  3888. * Defining default value for return ref when no value is passed.
  3889. *
  3890. * @default undefined
  3891. */
  3892. defaultValue?: T;
  3893. /**
  3894. * Clone the props.
  3895. * Accepts a custom clone function.
  3896. * When setting to `true`, it will use `JSON.parse(JSON.stringify(value))` to clone.
  3897. *
  3898. * @default false
  3899. */
  3900. clone?: boolean | CloneFn<T>;
  3901. }
  3902. /**
  3903. * Shorthand for v-model binding, props + emit -> ref
  3904. *
  3905. * @see https://vueuse.org/useVModel
  3906. * @param props
  3907. * @param key (default 'value' in Vue 2 and 'modelValue' in Vue 3)
  3908. * @param emit
  3909. */
  3910. declare function useVModel<P extends object, K extends keyof P, Name extends string>(props: P, key?: K, emit?: (name: Name, ...args: any[]) => void, options?: UseVModelOptions<P[K]>): vue_demi.Ref<UnwrapRef<P[K]>> | vue_demi.WritableComputedRef<P[K]>;
  3911. /**
  3912. * Shorthand for props v-model binding. Think like `toRefs(props)` but changes will also emit out.
  3913. *
  3914. * @see https://vueuse.org/useVModels
  3915. * @param props
  3916. * @param emit
  3917. */
  3918. declare function useVModels<P extends object, Name extends string>(props: P, emit?: (name: Name, ...args: any[]) => void, options?: UseVModelOptions<any>): ToRefs<P>;
  3919. interface UseVibrateOptions extends ConfigurableNavigator {
  3920. /**
  3921. *
  3922. * Vibration Pattern
  3923. *
  3924. * An array of values describes alternating periods in which the
  3925. * device is vibrating and not vibrating. Each value in the array
  3926. * is converted to an integer, then interpreted alternately as
  3927. * the number of milliseconds the device should vibrate and the
  3928. * number of milliseconds it should not be vibrating
  3929. *
  3930. * @default []
  3931. *
  3932. */
  3933. pattern?: MaybeComputedRef<number[] | number>;
  3934. /**
  3935. * Interval to run a persistent vibration, in ms
  3936. *
  3937. * Pass `0` to disable
  3938. *
  3939. * @default 0
  3940. *
  3941. */
  3942. interval?: number;
  3943. }
  3944. /**
  3945. * Reactive vibrate
  3946. *
  3947. * @see https://vueuse.org/useVibrate
  3948. * @see https://developer.mozilla.org/en-US/docs/Web/API/Vibration_API
  3949. * @param options
  3950. */
  3951. declare function useVibrate(options?: UseVibrateOptions): {
  3952. isSupported: vue.Ref<boolean>;
  3953. pattern: MaybeComputedRef<number | number[]>;
  3954. intervalControls: Pausable | undefined;
  3955. vibrate: (pattern?: number | number[]) => void;
  3956. stop: () => void;
  3957. };
  3958. declare type UseVibrateReturn = ReturnType<typeof useVibrate>;
  3959. declare type UseVirtualListItemSize = number | ((index: number) => number);
  3960. interface UseHorizontalVirtualListOptions extends UseVirtualListOptionsBase {
  3961. /**
  3962. * item width, accept a pixel value or a function that returns the height
  3963. *
  3964. * @default 0
  3965. */
  3966. itemWidth: UseVirtualListItemSize;
  3967. }
  3968. interface UseVerticalVirtualListOptions extends UseVirtualListOptionsBase {
  3969. /**
  3970. * item height, accept a pixel value or a function that returns the height
  3971. *
  3972. * @default 0
  3973. */
  3974. itemHeight: UseVirtualListItemSize;
  3975. }
  3976. interface UseVirtualListOptionsBase {
  3977. /**
  3978. * the extra buffer items outside of the view area
  3979. *
  3980. * @default 5
  3981. */
  3982. overscan?: number;
  3983. }
  3984. declare type UseVirtualListOptions = UseHorizontalVirtualListOptions | UseVerticalVirtualListOptions;
  3985. interface UseVirtualListItem<T> {
  3986. data: T;
  3987. index: number;
  3988. }
  3989. interface UseVirtualListReturn<T> {
  3990. list: Ref<UseVirtualListItem<T>[]>;
  3991. scrollTo: (index: number) => void;
  3992. containerProps: {
  3993. ref: Ref<HTMLElement | null>;
  3994. onScroll: () => void;
  3995. style: StyleValue;
  3996. };
  3997. wrapperProps: ComputedRef<{
  3998. style: {
  3999. width: string;
  4000. height: string;
  4001. marginTop: string;
  4002. } | {
  4003. width: string;
  4004. height: string;
  4005. marginLeft: string;
  4006. display: string;
  4007. };
  4008. }>;
  4009. }
  4010. declare function useVirtualList<T = any>(list: MaybeRef<T[]>, options: UseVirtualListOptions): UseVirtualListReturn<T>;
  4011. declare type WakeLockType = 'screen';
  4012. interface WakeLockSentinel extends EventTarget {
  4013. type: WakeLockType;
  4014. released: boolean;
  4015. release: () => Promise<void>;
  4016. }
  4017. declare type UseWakeLockOptions = ConfigurableNavigator & ConfigurableDocument;
  4018. /**
  4019. * Reactive Screen Wake Lock API.
  4020. *
  4021. * @see https://vueuse.org/useWakeLock
  4022. * @param options
  4023. */
  4024. declare const useWakeLock: (options?: UseWakeLockOptions) => {
  4025. isSupported: vue_demi.Ref<boolean>;
  4026. isActive: vue_demi.Ref<boolean>;
  4027. request: (type: WakeLockType) => Promise<void>;
  4028. release: () => Promise<void>;
  4029. };
  4030. declare type UseWakeLockReturn = ReturnType<typeof useWakeLock>;
  4031. interface WebNotificationOptions {
  4032. /**
  4033. * The title read-only property of the Notification interface indicates
  4034. * the title of the notification
  4035. *
  4036. * @default ''
  4037. */
  4038. title?: string;
  4039. /**
  4040. * The body string of the notification as specified in the constructor's
  4041. * options parameter.
  4042. *
  4043. * @default ''
  4044. */
  4045. body?: string;
  4046. /**
  4047. * The text direction of the notification as specified in the constructor's
  4048. * options parameter.
  4049. *
  4050. * @default ''
  4051. */
  4052. dir?: 'auto' | 'ltr' | 'rtl';
  4053. /**
  4054. * The language code of the notification as specified in the constructor's
  4055. * options parameter.
  4056. *
  4057. * @default DOMString
  4058. */
  4059. lang?: string;
  4060. /**
  4061. * The ID of the notification(if any) as specified in the constructor's options
  4062. * parameter.
  4063. *
  4064. * @default ''
  4065. */
  4066. tag?: string;
  4067. /**
  4068. * The URL of the image used as an icon of the notification as specified
  4069. * in the constructor's options parameter.
  4070. *
  4071. * @default ''
  4072. */
  4073. icon?: string;
  4074. /**
  4075. * Specifies whether the user should be notified after a new notification
  4076. * replaces an old one.
  4077. *
  4078. * @default false
  4079. */
  4080. renotify?: boolean;
  4081. /**
  4082. * A boolean value indicating that a notification should remain active until the
  4083. * user clicks or dismisses it, rather than closing automatically.
  4084. *
  4085. * @default false
  4086. */
  4087. requireInteraction?: boolean;
  4088. /**
  4089. * The silent read-only property of the Notification interface specifies
  4090. * whether the notification should be silent, i.e., no sounds or vibrations
  4091. * should be issued, regardless of the device settings.
  4092. *
  4093. * @default false
  4094. */
  4095. silent?: boolean;
  4096. /**
  4097. * Specifies a vibration pattern for devices with vibration hardware to emit.
  4098. * A vibration pattern, as specified in the Vibration API spec
  4099. *
  4100. * @see https://w3c.github.io/vibration/
  4101. */
  4102. vibrate?: number[];
  4103. }
  4104. interface UseWebNotificationOptions extends WebNotificationOptions, ConfigurableWindow {
  4105. }
  4106. /**
  4107. * Reactive useWebNotification
  4108. *
  4109. * @see https://vueuse.org/useWebNotification
  4110. * @see https://developer.mozilla.org/en-US/docs/Web/API/notification
  4111. * @param title
  4112. * @param defaultOptions of type WebNotificationOptions
  4113. * @param methods of type WebNotificationMethods
  4114. */
  4115. declare const useWebNotification: (defaultOptions?: UseWebNotificationOptions) => {
  4116. isSupported: Ref<boolean>;
  4117. notification: Ref<Notification | null>;
  4118. show: (overrides?: WebNotificationOptions) => Promise<Notification | undefined>;
  4119. close: () => void;
  4120. onClick: EventHook<any>;
  4121. onShow: EventHook<any>;
  4122. onError: EventHook<any>;
  4123. onClose: EventHook<any>;
  4124. };
  4125. declare type UseWebNotificationReturn = ReturnType<typeof useWebNotification>;
  4126. declare type WebSocketStatus = 'OPEN' | 'CONNECTING' | 'CLOSED';
  4127. interface UseWebSocketOptions {
  4128. onConnected?: (ws: WebSocket) => void;
  4129. onDisconnected?: (ws: WebSocket, event: CloseEvent) => void;
  4130. onError?: (ws: WebSocket, event: Event) => void;
  4131. onMessage?: (ws: WebSocket, event: MessageEvent) => void;
  4132. /**
  4133. * Send heartbeat for every x milliseconds passed
  4134. *
  4135. * @default false
  4136. */
  4137. heartbeat?: boolean | {
  4138. /**
  4139. * Message for the heartbeat
  4140. *
  4141. * @default 'ping'
  4142. */
  4143. message?: string | ArrayBuffer | Blob;
  4144. /**
  4145. * Interval, in milliseconds
  4146. *
  4147. * @default 1000
  4148. */
  4149. interval?: number;
  4150. /**
  4151. * Heartbeat response timeout, in milliseconds
  4152. *
  4153. * @default 1000
  4154. */
  4155. pongTimeout?: number;
  4156. };
  4157. /**
  4158. * Enabled auto reconnect
  4159. *
  4160. * @default false
  4161. */
  4162. autoReconnect?: boolean | {
  4163. /**
  4164. * Maximum retry times.
  4165. *
  4166. * Or you can pass a predicate function (which returns true if you want to retry).
  4167. *
  4168. * @default -1
  4169. */
  4170. retries?: number | (() => boolean);
  4171. /**
  4172. * Delay for reconnect, in milliseconds
  4173. *
  4174. * @default 1000
  4175. */
  4176. delay?: number;
  4177. /**
  4178. * On maximum retry times reached.
  4179. */
  4180. onFailed?: Fn;
  4181. };
  4182. /**
  4183. * Automatically open a connection
  4184. *
  4185. * @default true
  4186. */
  4187. immediate?: boolean;
  4188. /**
  4189. * Automatically close a connection
  4190. *
  4191. * @default true
  4192. */
  4193. autoClose?: boolean;
  4194. /**
  4195. * List of one or more sub-protocol strings
  4196. *
  4197. * @default []
  4198. */
  4199. protocols?: string[];
  4200. }
  4201. interface UseWebSocketReturn<T> {
  4202. /**
  4203. * Reference to the latest data received via the websocket,
  4204. * can be watched to respond to incoming messages
  4205. */
  4206. data: Ref<T | null>;
  4207. /**
  4208. * The current websocket status, can be only one of:
  4209. * 'OPEN', 'CONNECTING', 'CLOSED'
  4210. */
  4211. status: Ref<WebSocketStatus>;
  4212. /**
  4213. * Closes the websocket connection gracefully.
  4214. */
  4215. close: WebSocket['close'];
  4216. /**
  4217. * Reopen the websocket connection.
  4218. * If there the current one is active, will close it before opening a new one.
  4219. */
  4220. open: Fn;
  4221. /**
  4222. * Sends data through the websocket connection.
  4223. *
  4224. * @param data
  4225. * @param useBuffer when the socket is not yet open, store the data into the buffer and sent them one connected. Default to true.
  4226. */
  4227. send: (data: string | ArrayBuffer | Blob, useBuffer?: boolean) => boolean;
  4228. /**
  4229. * Reference to the WebSocket instance.
  4230. */
  4231. ws: Ref<WebSocket | undefined>;
  4232. }
  4233. /**
  4234. * Reactive WebSocket client.
  4235. *
  4236. * @see https://vueuse.org/useWebSocket
  4237. * @param url
  4238. */
  4239. declare function useWebSocket<Data = any>(url: MaybeComputedRef<string | URL>, options?: UseWebSocketOptions): UseWebSocketReturn<Data>;
  4240. interface UseWebWorkerReturn<Data = any> {
  4241. data: Ref<Data>;
  4242. post: typeof Worker.prototype['postMessage'];
  4243. terminate: () => void;
  4244. worker: ShallowRef<Worker | undefined>;
  4245. }
  4246. declare type WorkerFn = (...args: unknown[]) => Worker;
  4247. /**
  4248. * Simple Web Workers registration and communication.
  4249. *
  4250. * @see https://vueuse.org/useWebWorker
  4251. * @param url
  4252. * @param workerOptions
  4253. * @param options
  4254. */
  4255. declare function useWebWorker<T = any>(url: string, workerOptions?: WorkerOptions, options?: ConfigurableWindow): UseWebWorkerReturn<T>;
  4256. /**
  4257. * Simple Web Workers registration and communication.
  4258. *
  4259. * @see https://vueuse.org/useWebWorker
  4260. * @param worker
  4261. */
  4262. declare function useWebWorker<T = any>(worker: Worker | WorkerFn): UseWebWorkerReturn<T>;
  4263. declare type WebWorkerStatus = 'PENDING' | 'SUCCESS' | 'RUNNING' | 'ERROR' | 'TIMEOUT_EXPIRED';
  4264. interface UseWebWorkerOptions extends ConfigurableWindow {
  4265. /**
  4266. * Number of milliseconds before killing the worker
  4267. *
  4268. * @default undefined
  4269. */
  4270. timeout?: number;
  4271. /**
  4272. * An array that contains the external dependencies needed to run the worker
  4273. */
  4274. dependencies?: string[];
  4275. }
  4276. /**
  4277. * Run expensive function without blocking the UI, using a simple syntax that makes use of Promise.
  4278. *
  4279. * @see https://vueuse.org/useWebWorkerFn
  4280. * @param fn
  4281. * @param options
  4282. */
  4283. declare const useWebWorkerFn: <T extends (...fnArgs: any[]) => any>(fn: T, options?: UseWebWorkerOptions) => {
  4284. workerFn: (...fnArgs: Parameters<T>) => Promise<ReturnType<T>>;
  4285. workerStatus: vue_demi.Ref<WebWorkerStatus>;
  4286. workerTerminate: (status?: WebWorkerStatus) => void;
  4287. };
  4288. declare type UseWebWorkerFnReturn = ReturnType<typeof useWebWorkerFn>;
  4289. /**
  4290. * Reactively track window focus with `window.onfocus` and `window.onblur`.
  4291. *
  4292. * @see https://vueuse.org/useWindowFocus
  4293. * @param options
  4294. */
  4295. declare function useWindowFocus({ window }?: ConfigurableWindow): Ref<boolean>;
  4296. /**
  4297. * Reactive window scroll.
  4298. *
  4299. * @see https://vueuse.org/useWindowScroll
  4300. * @param options
  4301. */
  4302. declare function useWindowScroll({ window }?: ConfigurableWindow): {
  4303. x: vue_demi.Ref<number>;
  4304. y: vue_demi.Ref<number>;
  4305. };
  4306. declare type UseWindowScrollReturn = ReturnType<typeof useWindowScroll>;
  4307. interface UseWindowSizeOptions extends ConfigurableWindow {
  4308. initialWidth?: number;
  4309. initialHeight?: number;
  4310. /**
  4311. * Listen to window `orientationchange` event
  4312. *
  4313. * @default true
  4314. */
  4315. listenOrientation?: boolean;
  4316. /**
  4317. * Whether the scrollbar should be included in the width and height
  4318. * @default true
  4319. */
  4320. includeScrollbar?: boolean;
  4321. }
  4322. /**
  4323. * Reactive window size.
  4324. *
  4325. * @see https://vueuse.org/useWindowSize
  4326. * @param options
  4327. */
  4328. declare function useWindowSize(options?: UseWindowSizeOptions): {
  4329. width: vue_demi.Ref<number>;
  4330. height: vue_demi.Ref<number>;
  4331. };
  4332. declare type UseWindowSizeReturn = ReturnType<typeof useWindowSize>;
  4333. export { AfterFetchContext, AsyncComputedOnCancel, AsyncComputedOptions, BasicColorSchema, BatteryManager, BeforeFetchContext, Breakpoints, BrowserLocationState, CloneFn, ColorSchemeType, ComputedInjectGetter, ComputedInjectGetterWithDefault, ComputedInjectSetter, ConfigurableDocument, ConfigurableLocation, ConfigurableNavigator, ConfigurableWindow, ContrastType, CreateFetchOptions, CubicBezierPoints, DefaultMagicKeysAliasMap, DeviceMotionOptions, DocumentEventName, EasingFunction, ElementSize, EventBusEvents, EventBusIdentifier, EventBusKey, EventBusListener, EyeDropper, EyeDropperOpenOptions, FileSystemAccessShowOpenFileOptions, FileSystemAccessShowSaveFileOptions, FileSystemAccessWindow, FileSystemFileHandle, FormatTimeAgoOptions, GeneralEventListener, GeneralPermissionDescriptor, KeyFilter, KeyModifier, KeyPredicate, KeyStrokeEventName, MagicKeysInternal, MaybeComputedElementRef, MaybeElement, MaybeElementRef, MemoryInfo, MouseInElementOptions, MousePressedOptions, MouseSourceType, NavigatorLanguageState, NetworkEffectiveType, NetworkState, NetworkType, OnClickOutsideHandler, OnClickOutsideOptions, OnFetchErrorContext, OnKeyStrokeOptions, OnLongPressModifiers, OnLongPressOptions, PointerType, Position, ReducedMotionType, RenderableComponent, ResizeObserverCallback, ResizeObserverEntry, ResizeObserverSize, SSRHandlersMap, Serializer, SerializerAsync, StorageLike, StorageLikeAsync, StorageSerializers, SwipeDirection, TemplateRefsList, ToDataURLOptions, TransitionPresets, UnRefElementReturn, UnrefFn, UrlParams, UseAsyncQueueOptions, UseAsyncQueueResult, UseAsyncQueueReturn, UseAsyncQueueTask, UseAsyncStateOptions, UseAsyncStateReturn, UseBase64ObjectOptions, UseBase64Return, UseBatteryReturn, UseBluetoothOptions, UseBluetoothRequestDeviceOptions, UseBluetoothReturn, UseBreakpointsReturn, UseBroadcastChannelOptions, UseBroadcastChannelReturn, UseBrowserLocationReturn, UseClipboardOptions, UseClipboardReturn, UseClonedOptions, UseClonedReturn, UseColorModeOptions, UseConfirmDialogReturn, UseConfirmDialogRevealResult, UseCssVarOptions, UseCycleListOptions, UseCycleListReturn, UseDarkOptions, UseDeviceMotionReturn, UseDeviceOrientationReturn, UseDevicePixelRatioReturn, UseDevicesListOptions, UseDevicesListReturn, UseDisplayMediaOptions, UseDisplayMediaReturn, UseDraggableOptions, UseDraggableReturn, UseDropZoneReturn, UseElementBoundingOptions, UseElementBoundingReturn, UseElementByPointOptions, UseElementByPointReturn, UseElementSizeReturn, UseElementVisibilityOptions, UseEventBusReturn, UseEventSourceOptions, UseEventSourceReturn, UseEyeDropperOptions, UseEyeDropperReturn, UseFaviconOptions, UseFaviconReturn, UseFetchOptions, UseFetchReturn, UseFileDialogOptions, UseFileDialogReturn, UseFileSystemAccessCommonOptions, UseFileSystemAccessOptions, UseFileSystemAccessReturn, UseFileSystemAccessShowSaveFileOptions, UseFocusOptions, UseFocusReturn, UseFocusWithinReturn, UseFpsOptions, UseFullscreenOptions, UseFullscreenReturn, UseGamepadOptions, UseGamepadReturn, UseGeolocationOptions, UseGeolocationReturn, UseHorizontalVirtualListOptions, UseIdleOptions, UseIdleReturn, UseImageOptions, UseImageReturn, UseInfiniteScrollOptions, UseIntersectionObserverOptions, UseIntersectionObserverReturn, UseKeyModifierReturn, UseMagicKeysOptions, UseMagicKeysReturn, UseManualRefHistoryOptions, UseManualRefHistoryReturn, UseMediaControlsReturn, UseMediaSource, UseMediaTextTrack, UseMediaTextTrackSource, UseMemoizeCache, UseMemoizeOptions, UseMemoizeReturn, UseMemoryOptions, UseMemoryReturn, UseModifierOptions, UseMouseInElementReturn, UseMouseOptions, UseMousePressedReturn, UseMouseReturn, UseMutationObserverOptions, UseMutationObserverReturn, UseNavigatorLanguageReturn, UseNetworkReturn, UseNowOptions, UseNowReturn, UseOffsetPaginationInfinityPageReturn, UseOffsetPaginationOptions, UseOffsetPaginationReturn, UseParallaxOptions, UseParallaxReturn, UsePermissionOptions, UsePermissionReturn, UsePermissionReturnWithControls, UsePointerOptions, UsePointerReturn, UsePointerState, UsePointerSwipeOptions, UsePointerSwipeReturn, UseRafFnCallbackArguments, UseRafFnOptions, UseRefHistoryOptions, UseRefHistoryRecord, UseRefHistoryReturn, UseResizeObserverOptions, UseResizeObserverReturn, UseScreenOrientationReturn, UseScriptTagOptions, UseScriptTagReturn, UseScrollOptions, UseScrollReturn, UseShareOptions, UseShareReturn, UseSortedCompareFn, UseSortedFn, UseSortedOptions, UseSpeechRecognitionOptions, UseSpeechRecognitionReturn, UseSpeechSynthesisOptions, UseSpeechSynthesisReturn, UseSpeechSynthesisStatus, UseStepperReturn, UseStorageAsyncOptions, UseStorageOptions, UseStyleTagOptions, UseStyleTagReturn, UseSwipeOptions, UseSwipeReturn, UseTextDirectionOptions, UseTextDirectionValue, UseTextSelectionReturn, UseTextareaAutosizeOptions, UseTextareaAutosizeReturn, UseThrottledRefHistoryOptions, UseThrottledRefHistoryReturn, UseTimeAgoFormatter, UseTimeAgoMessages, UseTimeAgoMessagesBuiltIn, UseTimeAgoOptions, UseTimeAgoReturn, UseTimeAgoUnit, UseTimeAgoUnitNamesDefault, UseTimestampOptions, UseTimestampReturn, UseTitleOptions, UseTitleOptionsBase, UseTitleReturn, UseTransitionOptions, UseUrlSearchParamsOptions, UseUserMediaOptions, UseUserMediaReturn, UseVModelOptions, UseVerticalVirtualListOptions, UseVibrateOptions, UseVibrateReturn, UseVirtualListItem, UseVirtualListOptions, UseVirtualListOptionsBase, UseVirtualListReturn, UseWakeLockOptions, UseWakeLockReturn, UseWebNotificationOptions, UseWebNotificationReturn, UseWebSocketOptions, UseWebSocketReturn, UseWebWorkerFnReturn, UseWebWorkerOptions, UseWebWorkerReturn, UseWindowScrollReturn, UseWindowSizeOptions, UseWindowSizeReturn, VueInstance, WakeLockSentinel, WebNotificationOptions, WebSocketStatus, WebWorkerStatus, WindowEventName, WritableComputedInjectOptions, WritableComputedInjectOptionsWithDefault, computedAsync as asyncComputed, breakpointsAntDesign, breakpointsBootstrapV5, breakpointsMasterCss, breakpointsQuasar, breakpointsSematic, breakpointsTailwind, breakpointsVuetify, cloneFnJSON, computedAsync, computedInject, createFetch, createUnrefFn, defaultDocument, defaultLocation, defaultNavigator, defaultWindow, formatTimeAgo, getSSRHandler, mapGamepadToXbox360Controller, onClickOutside, onKeyDown, onKeyPressed, onKeyStroke, onKeyUp, onLongPress, onStartTyping, setSSRHandler, templateRef, unrefElement, useActiveElement, useAsyncQueue, useAsyncState, useBase64, useBattery, useBluetooth, useBreakpoints, useBroadcastChannel, useBrowserLocation, useCached, useClipboard, useCloned, useColorMode, useConfirmDialog, useCssVar, useCurrentElement, useCycleList, useDark, useDebouncedRefHistory, useDeviceMotion, useDeviceOrientation, useDevicePixelRatio, useDevicesList, useDisplayMedia, useDocumentVisibility, useDraggable, useDropZone, useElementBounding, useElementByPoint, useElementHover, useElementSize, useElementVisibility, useEventBus, useEventListener, useEventSource, useEyeDropper, useFavicon, useFetch, useFileDialog, useFileSystemAccess, useFocus, useFocusWithin, useFps, useFullscreen, useGamepad, useGeolocation, useIdle, useImage, useInfiniteScroll, useIntersectionObserver, useKeyModifier, useLocalStorage, useMagicKeys, useManualRefHistory, useMediaControls, useMediaQuery, useMemoize, useMemory, useMounted, useMouse, useMouseInElement, useMousePressed, useMutationObserver, useNavigatorLanguage, useNetwork, useNow, useObjectUrl, useOffsetPagination, useOnline, usePageLeave, useParallax, usePermission, usePointer, usePointerSwipe, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePreferredLanguages, usePreferredReducedMotion, useRafFn, useRefHistory, useResizeObserver, useScreenOrientation, useScreenSafeArea, useScriptTag, useScroll, useScrollLock, useSessionStorage, useShare, useSorted, useSpeechRecognition, useSpeechSynthesis, useStepper, useStorage, useStorageAsync, useStyleTag, useSupported, useSwipe, useTemplateRefsList, useTextDirection, useTextSelection, useTextareaAutosize, useThrottledRefHistory, useTimeAgo, useTimeoutPoll, useTimestamp, useTitle, useTransition, useUrlSearchParams, useUserMedia, useVModel, useVModels, useVibrate, useVirtualList, useWakeLock, useWebNotification, useWebSocket, useWebWorker, useWebWorkerFn, useWindowFocus, useWindowScroll, useWindowSize };