index.d.ts 152 KB

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