index.d.ts 172 KB

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