diff --git a/docs/assets/PageA.0d2cb5ba.js b/docs/assets/PageA.0d2cb5ba.js deleted file mode 100644 index b2b2778..0000000 --- a/docs/assets/PageA.0d2cb5ba.js +++ /dev/null @@ -1 +0,0 @@ -import{g as E,L as I,W as F,l as L,e as O}from"./api.ddc1e152.js";import{g as y,l as _,m as G,n as H,p as D,o as m,c as b,b as n,w as r,a as s,u as o,t as z,q as N,v as P,s as R,r as g,d as C,x as T,y as A,z as K,F as W,f as B,A as q}from"./vendor.705dcf8c.js";import{_ as Z}from"./index.5c4ccb44.js";const J={style:{"min-height":"100%",width:"100%"}},Q=["onClick"],X={class:"overflow-hidden"},Y={class:"px-4 pt-2 pb-4 border-t border-t-gray-800"},ee={class:"pb-4 text-gray-50 group-hover:text-yellow-300"},oe={class:"pt-3 flex justify-between items-center border-t border-t-gray-600 border-opacity-50"},te={class:"text-gray-50"},le=["onClick"],ne={class:"flex justify-center py-10 bg-gray-900"},S=y({props:{list:{type:Array},options:{type:Object},pageSize:{type:Number,default:100}},emits:{cardClick:null},setup(a,{emit:v}){const t=a,d=_([]),f=_(1),e=_(!0);G(()=>{p()});function p(){E({page:f.value,pageSize:t.pageSize}).then(c=>{d.value.push(...c),f.value+=1})}function l(c,x){d.value.splice(x,1)}function u(c){v("cardClick",c)}function h(c){}function V(c){console.error(`${c}: \u52A0\u8F7D\u5931\u8D25`)}function k(c){console.log(`${c}: \u52A0\u8F7D\u6210\u529F`)}function $(){e.value=!1,console.log("\u8BA1\u7B97\u5B8C\u6210")}return(c,x)=>{const i=H("loading");return D((m(),b("div",J,[n(o(F),{list:d.value,"row-key":a.options.rowKey,gutter:a.options.gutter,"has-around-gutter":a.options.hasAroundGutter,width:a.options.width,breakpoints:a.options.breakpoints,"img-selector":a.options.imgSelector,"background-color":a.options.backgroundColor,"animation-effect":a.options.animationEffect,"animation-duration":a.options.animationDuration,"animation-delay":a.options.animationDelay,lazyload:a.options.lazyload,"load-props":a.options.loadProps,"cross-origin":a.options.crossOrigin,align:a.options.align,onAfterRender:$},{item:r(({item:w,url:U,index:M})=>[s("div",{class:"bg-gray-900 rounded-lg shadow-md overflow-hidden transition-all duration-300 ease-linear hover:shadow-lg hover:shadow-gray-600 group",onClick:j=>u(w)},[s("div",X,[n(o(I),{url:U,title:"title",alt:w.name,class:"cursor-pointer transition-all duration-300 ease-linear group-hover:scale-105",onLoad:h,onError:V,onSuccess:k},null,8,["url","alt"])]),s("div",Y,[s("h2",ee,z(w.name),1),s("div",oe,[s("div",te," $ "+z(w.price),1),s("div",null,[s("button",{class:"px-3 h-7 rounded-full bg-red-500 text-sm text-white shadow-lg transition-all duration-300 hover:bg-red-600",onClick:N(j=>l(w,M),["stop"])}," \u5220\u9664 ",8,le)])])])],8,Q)]),_:1},8,["list","row-key","gutter","has-around-gutter","width","breakpoints","img-selector","background-color","animation-effect","animation-duration","animation-delay","lazyload","load-props","cross-origin","align"]),D(s("div",ne,[s("button",{class:"px-5 py-2 rounded-full bg-gray-700 text-md text-white cursor-pointer hover:bg-gray-800 transition-all duration-300",onClick:p}," \u52A0\u8F7D\u66F4\u591A ")],512),[[P,!e.value]])],512)),[[i,e.value]])}}});const ae=y({props:{visible:{type:Boolean},options:{type:Object}},emits:{"update:visible":null},setup(a,{emit:v}){const t=a,d=R({get(){return t.visible},set(f){v("update:visible",f)}});return(f,e)=>{const p=g("el-drawer");return m(),C(p,{modelValue:o(d),"onUpdate:modelValue":e[0]||(e[0]=l=>T(d)?d.value=l:null),size:"50%","with-header":!1},{default:r(()=>[n(S,{"page-size":20,options:a.options},null,8,["options"])]),_:1},8,["modelValue"])}}}),ie={},se={class:"pb-4 pt-4 flex justify-center bg-gray-900 group",href:"https://github.com/heikaimu/vue3-waterfall-plugin"},re=s("svg",{class:"h-7 w-7 fill-gray-400 transition-all duration-300 group-hover:fill-gray-200",viewBox:"0 0 16 16",version:"1.1","aria-hidden":"true"},[s("path",{d:"M8 0C3.58 0 0 3.58 0 8C0 11.54 2.29 14.53 5.47 15.59C5.87 15.66 6.02 15.42 6.02 15.21C6.02 15.02 6.01 14.39 6.01 13.72C4 14.09 3.48 13.23 3.32 12.78C3.23 12.55 2.84 11.84 2.5 11.65C2.22 11.5 1.82 11.13 2.49 11.12C3.12 11.11 3.57 11.7 3.72 11.94C4.44 13.15 5.59 12.81 6.05 12.6C6.12 12.08 6.33 11.73 6.56 11.53C4.78 11.33 2.92 10.64 2.92 7.58C2.92 6.71 3.23 5.99 3.74 5.43C3.66 5.23 3.38 4.41 3.82 3.31C3.82 3.31 4.49 3.1 6.02 4.13C6.66 3.95 7.34 3.86 8.02 3.86C8.7 3.86 9.38 3.95 10.02 4.13C11.55 3.09 12.22 3.31 12.22 3.31C12.66 4.41 12.38 5.23 12.3 5.43C12.81 5.99 13.12 6.7 13.12 7.58C13.12 10.65 11.25 11.33 9.47 11.53C9.76 11.78 10.01 12.26 10.01 13.01C10.01 14.08 10 14.94 10 15.21C10 15.42 10.15 15.67 10.55 15.59C13.71 14.53 16 11.53 16 8C16 3.58 12.42 0 8 0Z"})],-1),ue=[re];function de(a,v){return m(),b("a",se,ue)}var ce=Z(ie,[["render",de]]);const pe=B(" \u6392\u7248 "),me=B(" \u52A8\u753B "),fe=y({props:{form:{type:Object,default:()=>{}}},setup(a){const t=A(a.form),d=_([{label:"fadeIn",value:"fadeIn"},{label:"fadeInUp",value:"animate__fadeInUp"},{label:"fadeInDown",value:"animate__fadeInDown"},{label:"zoomIn",value:"animate__zoomIn"}]);return(f,e)=>{const p=g("el-input"),l=g("el-form-item"),u=g("el-divider"),h=g("el-input-number"),V=g("el-switch"),k=g("el-option"),$=g("el-select"),c=g("el-color-picker"),x=g("el-form");return m(),C(x,{size:"small","label-position":"top"},{default:r(()=>[n(l,{label:"imgSelector"},{default:r(()=>[n(p,{modelValue:o(t).imgSelector,"onUpdate:modelValue":e[0]||(e[0]=i=>o(t).imgSelector=i),disabled:""},null,8,["modelValue"])]),_:1}),n(u,{"content-position":"left"},{default:r(()=>[pe]),_:1}),n(l,{label:"width"},{default:r(()=>[n(h,{modelValue:o(t).width,"onUpdate:modelValue":e[1]||(e[1]=i=>o(t).width=i),min:0,step:10,style:{width:"100%"}},null,8,["modelValue"])]),_:1}),n(l,{label:"gutter"},{default:r(()=>[n(h,{modelValue:o(t).gutter,"onUpdate:modelValue":e[2]||(e[2]=i=>o(t).gutter=i),min:0,step:2,style:{width:"100%"}},null,8,["modelValue"])]),_:1}),n(l,{label:"hasAroundGutter"},{default:r(()=>[n(V,{modelValue:o(t).hasAroundGutter,"onUpdate:modelValue":e[3]||(e[3]=i=>o(t).hasAroundGutter=i)},null,8,["modelValue"])]),_:1}),n(u,{"content-position":"left"},{default:r(()=>[me]),_:1}),n(l,{label:"animationEffect"},{default:r(()=>[n($,{modelValue:o(t).animationEffect,"onUpdate:modelValue":e[4]||(e[4]=i=>o(t).animationEffect=i),placeholder:"\u8BF7\u9009\u62E9",style:{width:"100%"}},{default:r(()=>[(m(!0),b(W,null,K(d.value,i=>(m(),C(k,{key:i.value,label:i.label,value:i.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),n(l,{label:"animationDuration"},{default:r(()=>[n(h,{modelValue:o(t).animationDuration,"onUpdate:modelValue":e[5]||(e[5]=i=>o(t).animationDuration=i),min:0,step:100,style:{width:"100%"}},null,8,["modelValue"])]),_:1}),n(l,{label:"animationDelay"},{default:r(()=>[n(h,{modelValue:o(t).animationDelay,"onUpdate:modelValue":e[6]||(e[6]=i=>o(t).animationDelay=i),min:0,step:100,style:{width:"100%"}},null,8,["modelValue"])]),_:1}),n(l,{label:"backgroundColor"},{default:r(()=>[n(c,{modelValue:o(t).backgroundColor,"onUpdate:modelValue":e[7]||(e[7]=i=>o(t).backgroundColor=i)},null,8,["modelValue"])]),_:1})]),_:1})}}}),ge={class:"h-screen flex overflow-hidden"},ve={class:"flex-auto overflow-y-auto"},he={class:"h-full flex flex-col justify-between"},_e={class:"p-4 border-b border-b-gray-100 shadow-md"},be=s("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[s("path",{"fill-rule":"evenodd",d:"M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z","clip-rule":"evenodd"})],-1),we=[be],ye=s("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[s("path",{"fill-rule":"evenodd",d:"M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z","clip-rule":"evenodd"})],-1),Ce=[ye],xe={class:"p-4 flex-auto overflow-y-auto"},Ve=y({setup(a){function v(){const p=_(!0);function l(u){p.value=u}return{isOpen:p,handleToggleController:l}}const{isOpen:t,handleToggleController:d}=v(),f=A({rowKey:"id",gutter:10,hasAroundGutter:!0,width:320,breakpoints:{1200:{rowPerView:4},800:{rowPerView:3},500:{rowPerView:2}},animationEffect:"animate__fadeInUp",animationDuration:1e3,animationDelay:300,backgroundColor:"#2C2E3A",imgSelector:"src.original",loadProps:{loading:L,error:O,ratioCalculator:(p,l)=>{const u=3/4,h=4/3;return Math.random()>.5?u:h}},lazyload:!0,align:"center"}),e=_(!1);return(p,l)=>(m(),b("div",ge,[n(ae,{visible:e.value,"onUpdate:visible":l[0]||(l[0]=u=>e.value=u),options:o(f)},null,8,["visible","options"]),s("div",ve,[n(S,{options:o(f),onCardClick:l[1]||(l[1]=u=>e.value=!0)},null,8,["options"])]),s("div",he,[s("div",_e,[o(t)?(m(),b("span",{key:0,onClick:l[2]||(l[2]=u=>o(d)(!1))},we)):(m(),b("span",{key:1,onClick:l[3]||(l[3]=u=>o(d)(!0))},Ce))]),s("div",xe,[o(t)?(m(),C(fe,{key:0,form:o(f)},null,8,["form"])):q("",!0)]),n(ce)])]))}}),ze=y({setup(a){return(v,t)=>(m(),C(Ve))}});export{ze as default}; diff --git a/docs/assets/PageA.52cb6fcd.css b/docs/assets/PageA.52cb6fcd.css deleted file mode 100644 index 093364f..0000000 --- a/docs/assets/PageA.52cb6fcd.css +++ /dev/null @@ -1 +0,0 @@ -.el-drawer__body{padding:0!important} diff --git a/docs/assets/api.2c6172ca.css b/docs/assets/PageA.55ed4bb0.css similarity index 92% rename from docs/assets/api.2c6172ca.css rename to docs/assets/PageA.55ed4bb0.css index 2af7a4c..3175cc6 100644 --- a/docs/assets/api.2c6172ca.css +++ b/docs/assets/PageA.55ed4bb0.css @@ -1 +1 @@ -.waterfall-list[data-v-6d3e5303]{width:100%;position:relative;overflow:hidden;background-color:var(--84adae44)}.waterfall-item[data-v-6d3e5303]{position:absolute;left:0;top:0;transform:translateY(3000px);visibility:hidden}@keyframes fadeIn-6d3e5303{0%{opacity:0}to{opacity:1}}.fadeIn[data-v-6d3e5303]{animation-name:fadeIn-6d3e5303}.lazy__box[data-v-640f8d40]{width:100%;height:0;padding-bottom:100%;overflow:hidden;position:relative}.lazy__resource[data-v-640f8d40]{display:flex;justify-content:center;align-items:center;position:absolute;left:0;top:0;bottom:0;right:0}.lazy__img[data-v-640f8d40]{display:block}.lazy__img[lazy=loading][data-v-640f8d40]{padding:5em 0;width:48px}.lazy__img[lazy=loaded][data-v-640f8d40]{width:100%;height:100%;-o-object-fit:cover;object-fit:cover}.lazy__img[lazy=error][data-v-640f8d40]{padding:5em 0;width:48px;height:auto} +.waterfall-list[data-v-6d3e5303]{width:100%;position:relative;overflow:hidden;background-color:var(--84adae44)}.waterfall-item[data-v-6d3e5303]{position:absolute;left:0;top:0;transform:translateY(3000px);visibility:hidden}@keyframes fadeIn-6d3e5303{0%{opacity:0}to{opacity:1}}.fadeIn[data-v-6d3e5303]{animation-name:fadeIn-6d3e5303}.lazy__box[data-v-640f8d40]{width:100%;height:0;padding-bottom:100%;overflow:hidden;position:relative}.lazy__resource[data-v-640f8d40]{display:flex;justify-content:center;align-items:center;position:absolute;left:0;top:0;bottom:0;right:0}.lazy__img[data-v-640f8d40]{display:block}.lazy__img[lazy=loading][data-v-640f8d40]{padding:5em 0;width:48px}.lazy__img[lazy=loaded][data-v-640f8d40]{width:100%;height:100%;-o-object-fit:cover;object-fit:cover}.lazy__img[lazy=error][data-v-640f8d40]{padding:5em 0;width:48px;height:auto}.el-drawer__body{padding:0!important} diff --git a/docs/assets/PageA.9ac28eda.js b/docs/assets/PageA.9ac28eda.js new file mode 100644 index 0000000..d2eabc3 --- /dev/null +++ b/docs/assets/PageA.9ac28eda.js @@ -0,0 +1 @@ +import{g as he,l as ve,e as ye}from"./api.efcc3c21.js";import{g as $,p as L,l as N,m as w,u as _e,n as U,q as G,s as we,t as V,v as c,x as be,y as Ae,o as h,c as C,F as M,z as F,a as f,A as Ce,B as Oe,C as $e,D as H,b as m,w as v,E as W,G as ze,H as Ie,r as O,d as D,I as Se,J as K,f as X,L as De}from"./vendor.f2d4fbe7.js";import{_ as xe}from"./index.0c05c534.js";function ke(e){return be()?(Ae(e),!0):!1}const Y=typeof window!="undefined";function Ve(e,t){function n(...o){e(()=>t.apply(this,o),{fn:t,thisArg:this,args:o})}return n}function Ee(e,t={}){let n,o;return i=>{const a=c(e),s=c(t.maxWait);if(n&&clearTimeout(n),a<=0||s!==void 0&&s<=0)return o&&(clearTimeout(o),o=null),i();s&&!o&&(o=setTimeout(()=>{n&&clearTimeout(n),o=null,i()},s)),n=setTimeout(()=>{o&&clearTimeout(o),o=null,i()},a)}}function Re(e,t=200,n={}){return Ve(Ee(t,n),e)}function Le(e){var t;const n=c(e);return(t=n==null?void 0:n.$el)!=null?t:n}const je=Y?window:void 0,j=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},B="__vueuse_ssr_handlers__";j[B]=j[B]||{};j[B];var q=Object.getOwnPropertySymbols,Be=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,Te=(e,t)=>{var n={};for(var o in e)Be.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&q)for(var o of q(e))t.indexOf(o)<0&&Pe.call(e,o)&&(n[o]=e[o]);return n};function Ne(e,t,n={}){const o=n,{window:r=je}=o,i=Te(o,["window"]);let a;const s=r&&"ResizeObserver"in r,l=()=>{a&&(a.disconnect(),a=void 0)},d=N(()=>Le(e),p=>{l(),s&&r&&p&&(a=new ResizeObserver(t),a.observe(p,i))},{immediate:!0,flush:"post"}),g=()=>{l(),d()};return ke(g),{isSupported:s,stop:g}}var J,Q;Y&&(window==null?void 0:window.navigator)&&((J=window==null?void 0:window.navigator)==null?void 0:J.platform)&&/iP(ad|hone|od)/.test((Q=window==null?void 0:window.navigator)==null?void 0:Q.platform);const Ue=({breakpoints:e,wrapperWidth:t,gutter:n,hasAroundGutter:o,initWidth:r})=>{const i=Object.keys(e).map(d=>Number(d)).sort((d,g)=>d-g);let a=t,s=!1;for(const d of i)if(t<=d){a=d,s=!0;break}if(!s)return r;const l=e[a].rowPerView;return o?(t-n)/l-n:(t-(l-1)*n)/l};function Ge(e){const t=w(0),n=w(null);Ne(n,a=>{const s=a[0],{width:l}=s.contentRect;t.value=l});const o=V(()=>Ue({wrapperWidth:t.value,breakpoints:e.breakpoints,gutter:e.gutter,hasAroundGutter:e.hasAroundGutter,initWidth:e.width})),r=V(()=>{const a=e.hasAroundGutter?-e.gutter:e.gutter;return Math.floor((t.value+a)/(o.value+e.gutter))}),i=V(()=>{if(e.align==="left")return 0;if(e.align==="center"){const a=e.hasAroundGutter?e.gutter:-e.gutter,s=r.value*(o.value+e.gutter)+a;return(t.value-s)/2}else{const a=e.hasAroundGutter?e.gutter:-e.gutter,s=r.value*(o.value+e.gutter)+a;return t.value-s}});return{waterfallWrapper:n,wrapperWidth:t,colWidth:o,cols:r,offsetX:i}}function Z(e,t){return new RegExp(`(^|\\s)${t}(\\s|$)`).test(e.className)}function ee(e,t){if(Z(e,t))return;const n=e.className.split(/\s+/);n.push(t),e.className=n.join(" ")}const Me=document.createElement("div").style,P=(()=>{const e={standard:"transform",webkit:"webkitTransform",Moz:"MozTransform",O:"OTransform",ms:"msTransform"};for(const t in e){const n=e[t];if(Me[n]!==void 0)return t}return!1})();function x(e){return P===!1?!1:P==="standard"?e:P+e.charAt(0).toUpperCase()+e.substr(1)}const te=x("transform"),ne=x("animation-duration"),oe=x("animation-delay"),re=x("transition"),ie=x("animation-fill-mode");function Fe(e,t,n,o,r){const i=w([]),a=w(0),s=p=>{const y=e.hasAroundGutter?p+1:p;return e.gutter*y+t.value*p+o.value},l=()=>{i.value=new Array(n.value).fill(e.hasAroundGutter?e.gutter:0)},d=He(e);return{wrapperHeight:a,layoutHandle:async()=>new Promise(p=>{l();const y=[];if(r&&r.value&&r.value.childNodes.forEach(b=>{b.className==="waterfall-item"&&y.push(b)}),y.length===0)return!1;for(let b=0;b{const R=e.posDuration/1e3;re&&(_[re]=`transform ${R}s`)})}a.value=Math.max.apply(null,i.value),setTimeout(()=>{p(!0)},e.posDuration)})}}function He(e){return(t,n)=>{const o=t.firstChild;if(o&&!Z(o,e.animationPrefix)){const r=`${e.animationDuration/1e3}s`,i=`${e.animationDelay/1e3}s`,a=o.style;ee(o,e.animationPrefix),ee(o,e.animationEffect),ne&&(a[ne]=r),oe&&(a[oe]=i),ie&&(a[ie]="both"),n&&setTimeout(()=>{n()},e.animationDuration+e.animationDelay)}}}const We=typeof window!="undefined"&&window!==null,ae=Ye(),Ke=Object.prototype.propertyIsEnumerable,se=Object.getOwnPropertySymbols;function Xe(e,...t){return t.map(o=>o.replace(/\[(\w+)\]/g,".$1").split(".").reduce((r,i)=>r&&r[i],e))}function Ye(){return We&&"IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype?("isIntersecting"in window.IntersectionObserverEntry.prototype||Object.defineProperty(window.IntersectionObserverEntry.prototype,"isIntersecting",{get(){return this.intersectionRatio>0}}),!0):!1}function k(e){return typeof e=="function"||toString.call(e)==="[object Object]"}function qe(e){return typeof e=="object"?e===null:typeof e!="function"}function Je(e){return e!=="__proto__"&&e!=="constructor"&&e!=="prototype"}function Qe(e,...t){if(!k(e))throw new TypeError("expected the first argument to be an object");if(t.length===0||typeof Symbol!="function"||typeof se!="function")return e;for(const n of t){const o=se(n);for(const r of o)Ke.call(n,r)&&(e[r]=n[r])}return e}function le(e,...t){let n=0;for(qe(e)&&(e=t[n++]),e||(e={});n{const r=new Image;r.onload=()=>{n(r)},r.onerror=()=>{o(new Error("Image load error"))},t&&(r.crossOrigin="Anonymous"),r.src=e})}var z;(function(e){e.LOADING="loading",e.LOADED="loaded",e.ERROR="error"})(z||(z={}));const Ze={rootMargin:"0px",threshold:0},de="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",et="";class tt{constructor(t=!0,n,o=!0){this.lazyActive=!0,this.crossOrigin=!0,this.options={loading:de,error:et,observerOptions:Ze,log:!0,ratioCalculator:(r,i)=>i/r},this._images=new WeakMap,this.lazyActive=t,this.crossOrigin=o,this.config(n)}config(t={}){le(this.options,t),t.ratioCalculator&&(this.options.ratioCalculator=t.ratioCalculator)}mount(t,n,o){const{src:r,loading:i,error:a}=this._valueFormatter(n);t.setAttribute("lazy",z.LOADING),t.setAttribute("src",i||de),this.lazyActive?(ae||(this._setImageSrc(t,r,o,a),this._log(()=>{throw new Error("Not support IntersectionObserver!")})),this._initIntersectionObserver(t,r,o,a)):this._setImageSrc(t,r,o,a)}resize(t,n){const o=t.getAttribute("lazy"),r=t.getAttribute("src");o&&o===z.LOADED&&r&&ue(r,this.crossOrigin).then(i=>{const{width:a,height:s}=i,l=t.width/a*s;t.height=l;const d=t.style;d.height=`${l}px`,n()})}unmount(t){const n=this._realObserver(t);n&&n.unobserve(t),this._images.delete(t)}_setImageSrc(t,n,o,r){!n||t.getAttribute("src")===n||ue(n,this.crossOrigin).then(a=>{var s,l;const{width:d,height:g}=a,p=((l=(s=this.options).ratioCalculator)==null?void 0:l.call(s,d,g))||g/d,y=t.parentNode.parentNode;y.style.paddingBottom=`${p*100}%`,t.setAttribute("lazy",z.LOADED),t.removeAttribute("src"),t.setAttribute("src",n),o(!0)}).catch(()=>{const a=this._realObserver(t);a&&a.disconnect(),r&&(t.setAttribute("lazy",z.ERROR),t.setAttribute("src",r),o(!1)),this._log(()=>{throw new Error(`Image failed to load!And failed src was: ${n} `)})})}_isOpenLazy(){return ae&&this.lazyActive}_initIntersectionObserver(t,n,o,r){const i=this.options.observerOptions;this._images.set(t,new IntersectionObserver(s=>{Array.prototype.forEach.call(s,l=>{if(l.isIntersecting){const d=this._realObserver(t);d&&d.unobserve(l.target),this._setImageSrc(t,n,o,r)}})},i));const a=this._realObserver(t);a&&a.observe(t)}_valueFormatter(t){let n=t,o=this.options.loading,r=this.options.error;return k(t)&&(n=t.src,o=t.loading||this.options.loading,r=t.error||this.options.error),{src:n,loading:o,error:r}}_log(t){this.options.log&&t()}_realObserver(t){return this._images.get(t)}}var ce=(e,t)=>{for(const[n,o]of t)e[n]=o;return e};const T=$({props:{list:{type:Array,default:()=>[]},rowKey:{type:String,default:"id"},imgSelector:{type:String,default:"src"},width:{type:Number,default:200},breakpoints:{type:Object,default:()=>({1200:{rowPerView:3},800:{rowPerView:2},500:{rowPerView:1}})},gutter:{type:Number,default:10},hasAroundGutter:{type:Boolean,default:!0},posDuration:{type:Number,default:300},animationPrefix:{type:String,default:"animate__animated"},animationEffect:{type:String,default:"fadeIn"},animationDuration:{type:Number,default:1e3},animationDelay:{type:Number,default:300},backgroundColor:{type:String,default:"#fff"},lazyload:{type:Boolean,default:!0},loadProps:{type:Object,default:()=>{}},crossOrigin:{type:Boolean,default:!0},delay:{type:Number,default:300},align:{type:String,default:"center"}},setup(e,t){const n=new tt(e.lazyload,e.loadProps,e.crossOrigin);L("lazy",n);const{waterfallWrapper:o,wrapperWidth:r,colWidth:i,cols:a,offsetX:s}=Ge(e),{wrapperHeight:l,layoutHandle:d}=Fe(e,i,a,s,o),g=Re(()=>{d().then(()=>{t.emit("afterRender")})},e.delay);N(()=>[r,i,e.list],()=>{r.value>0&&g()},{deep:!0});const p=w(0);return L("sizeChangeTime",p),L("imgLoaded",g),{waterfallWrapper:o,wrapperHeight:l,getRenderURL:A=>Xe(A,e.imgSelector)[0],getKey:(A,u)=>A[e.rowKey]||u,renderer:g}}}),fe=()=>{_e(e=>({"84adae44":e.backgroundColor}))},me=T.setup;T.setup=me?(e,t)=>(fe(),me(e,t)):fe;const nt=T,ot={class:"waterfall-card"};function rt(e,t,n,o,r,i){return h(),C("div",{ref:"waterfallWrapper",class:"waterfall-list",style:Oe({height:`${e.wrapperHeight}px`})},[(h(!0),C(M,null,F(e.list,(a,s)=>(h(),C("div",{key:e.getKey(a,s),class:"waterfall-item"},[f("div",ot,[Ce(e.$slots,"item",{item:a,index:s,url:e.getRenderURL(a)},void 0,!0)])]))),128))],4)}var it=ce(nt,[["render",rt],["__scopeId","data-v-6d3e5303"]]);const at=$({props:{url:{type:String,default:""},title:{type:String,default:""},alt:{type:String,default:""}},setup(e,t){const n=U("imgLoaded"),o=U("lazy"),r=w(null);G(()=>{i()}),we(()=>{a()});function i(){!r.value||o.mount(r.value,e.url,l=>{n(),l?t.emit("success",e.url):t.emit("error",e.url)})}function a(){!r.value||o.unmount(r.value)}function s(){t.emit("load",e.url)}return{lazyRef:r,imageLoad:s}}}),st={class:"lazy__box"},lt={class:"lazy__resource"},ut=["title","alt"];function dt(e,t,n,o,r,i){return h(),C("div",st,[f("div",lt,[f("img",{ref:"lazyRef",class:"lazy__img",title:e.title,alt:e.alt,onLoad:t[0]||(t[0]=(...a)=>e.imageLoad&&e.imageLoad(...a))},null,40,ut)])])}var ct=ce(at,[["render",dt],["__scopeId","data-v-640f8d40"]]);const ft={style:{"min-height":"100%",width:"100%"}},mt=["onClick"],gt={class:"overflow-hidden"},pt={class:"px-4 pt-2 pb-4 border-t border-t-gray-800"},ht={class:"pb-4 text-gray-50 group-hover:text-yellow-300"},vt={class:"pt-3 flex justify-between items-center border-t border-t-gray-600 border-opacity-50"},yt={class:"text-gray-50"},_t=["onClick"],wt={class:"flex justify-center py-10 bg-gray-900"},ge=$({props:{list:{type:Array},options:{type:Object},pageSize:{type:Number,default:100}},emits:{cardClick:null},setup(e,{emit:t}){const n=e,o=w([]),r=w(1),i=w(!0);G(()=>{a()});function a(){he({page:r.value,pageSize:n.pageSize}).then(u=>{o.value.push(...u),r.value+=1})}function s(u,I){o.value.splice(I,1)}function l(u){t("cardClick",u)}function d(u){}function g(u){console.error(`${u}: \u52A0\u8F7D\u5931\u8D25`)}function p(u){console.log(`${u}: \u52A0\u8F7D\u6210\u529F`)}function y(){i.value=!1,console.log("\u8BA1\u7B97\u5B8C\u6210")}const b=w(null);function A(){b.value.renderer()}return(u,I)=>{const E=$e("loading");return H((h(),C("div",ft,[f("button",{onClick:A}," \u5F3A\u5236\u91CD\u7ED8 "),m(c(it),{ref:(_,S)=>{S.waterfall=_,b.value=_},list:o.value,"row-key":e.options.rowKey,gutter:e.options.gutter,"has-around-gutter":e.options.hasAroundGutter,width:e.options.width,breakpoints:e.options.breakpoints,"img-selector":e.options.imgSelector,"background-color":e.options.backgroundColor,"animation-effect":e.options.animationEffect,"animation-duration":e.options.animationDuration,"animation-delay":e.options.animationDelay,lazyload:e.options.lazyload,"load-props":e.options.loadProps,"cross-origin":e.options.crossOrigin,align:e.options.align,onAfterRender:y},{item:v(({item:_,url:S,index:R})=>[f("div",{class:"bg-gray-900 rounded-lg shadow-md overflow-hidden transition-all duration-300 ease-linear hover:shadow-lg hover:shadow-gray-600 group",onClick:pe=>l(_)},[f("div",gt,[m(c(ct),{url:S,title:"title",alt:_.name,class:"cursor-pointer transition-all duration-300 ease-linear group-hover:scale-105",onLoad:d,onError:g,onSuccess:p},null,8,["url","alt"])]),f("div",pt,[f("h2",ht,W(_.name),1),f("div",vt,[f("div",yt," $ "+W(_.price),1),f("div",null,[f("button",{class:"px-3 h-7 rounded-full bg-red-500 text-sm text-white shadow-lg transition-all duration-300 hover:bg-red-600",onClick:ze(pe=>s(_,R),["stop"])}," \u5220\u9664 ",8,_t)])])])],8,mt)]),_:1},8,["list","row-key","gutter","has-around-gutter","width","breakpoints","img-selector","background-color","animation-effect","animation-duration","animation-delay","lazyload","load-props","cross-origin","align"]),H(f("div",wt,[f("button",{class:"px-5 py-2 rounded-full bg-gray-700 text-md text-white cursor-pointer hover:bg-gray-800 transition-all duration-300",onClick:a}," \u52A0\u8F7D\u66F4\u591A ")],512),[[Ie,!i.value]])],512)),[[E,i.value]])}}});const bt=$({props:{visible:{type:Boolean},options:{type:Object}},emits:{"update:visible":null},setup(e,{emit:t}){const n=e,o=V({get(){return n.visible},set(r){t("update:visible",r)}});return(r,i)=>{const a=O("el-drawer");return h(),D(a,{modelValue:c(o),"onUpdate:modelValue":i[0]||(i[0]=s=>Se(o)?o.value=s:null),size:"50%","with-header":!1},{default:v(()=>[m(ge,{"page-size":20,options:e.options},null,8,["options"])]),_:1},8,["modelValue"])}}}),At={},Ct={class:"pb-4 pt-4 flex justify-center bg-gray-900 group",href:"https://github.com/heikaimu/vue3-waterfall-plugin"},Ot=f("svg",{class:"h-7 w-7 fill-gray-400 transition-all duration-300 group-hover:fill-gray-200",viewBox:"0 0 16 16",version:"1.1","aria-hidden":"true"},[f("path",{d:"M8 0C3.58 0 0 3.58 0 8C0 11.54 2.29 14.53 5.47 15.59C5.87 15.66 6.02 15.42 6.02 15.21C6.02 15.02 6.01 14.39 6.01 13.72C4 14.09 3.48 13.23 3.32 12.78C3.23 12.55 2.84 11.84 2.5 11.65C2.22 11.5 1.82 11.13 2.49 11.12C3.12 11.11 3.57 11.7 3.72 11.94C4.44 13.15 5.59 12.81 6.05 12.6C6.12 12.08 6.33 11.73 6.56 11.53C4.78 11.33 2.92 10.64 2.92 7.58C2.92 6.71 3.23 5.99 3.74 5.43C3.66 5.23 3.38 4.41 3.82 3.31C3.82 3.31 4.49 3.1 6.02 4.13C6.66 3.95 7.34 3.86 8.02 3.86C8.7 3.86 9.38 3.95 10.02 4.13C11.55 3.09 12.22 3.31 12.22 3.31C12.66 4.41 12.38 5.23 12.3 5.43C12.81 5.99 13.12 6.7 13.12 7.58C13.12 10.65 11.25 11.33 9.47 11.53C9.76 11.78 10.01 12.26 10.01 13.01C10.01 14.08 10 14.94 10 15.21C10 15.42 10.15 15.67 10.55 15.59C13.71 14.53 16 11.53 16 8C16 3.58 12.42 0 8 0Z"})],-1),$t=[Ot];function zt(e,t){return h(),C("a",Ct,$t)}var It=xe(At,[["render",zt]]);const St=X(" \u6392\u7248 "),Dt=X(" \u52A8\u753B "),xt=$({props:{form:{type:Object,default:()=>{}}},setup(e){const n=K(e.form),o=w([{label:"fadeIn",value:"fadeIn"},{label:"fadeInUp",value:"animate__fadeInUp"},{label:"fadeInDown",value:"animate__fadeInDown"},{label:"zoomIn",value:"animate__zoomIn"}]);return(r,i)=>{const a=O("el-input"),s=O("el-form-item"),l=O("el-divider"),d=O("el-input-number"),g=O("el-switch"),p=O("el-option"),y=O("el-select"),b=O("el-color-picker"),A=O("el-form");return h(),D(A,{size:"small","label-position":"top"},{default:v(()=>[m(s,{label:"imgSelector"},{default:v(()=>[m(a,{modelValue:c(n).imgSelector,"onUpdate:modelValue":i[0]||(i[0]=u=>c(n).imgSelector=u),disabled:""},null,8,["modelValue"])]),_:1}),m(l,{"content-position":"left"},{default:v(()=>[St]),_:1}),m(s,{label:"width"},{default:v(()=>[m(d,{modelValue:c(n).width,"onUpdate:modelValue":i[1]||(i[1]=u=>c(n).width=u),min:0,step:10,style:{width:"100%"}},null,8,["modelValue"])]),_:1}),m(s,{label:"gutter"},{default:v(()=>[m(d,{modelValue:c(n).gutter,"onUpdate:modelValue":i[2]||(i[2]=u=>c(n).gutter=u),min:0,step:2,style:{width:"100%"}},null,8,["modelValue"])]),_:1}),m(s,{label:"hasAroundGutter"},{default:v(()=>[m(g,{modelValue:c(n).hasAroundGutter,"onUpdate:modelValue":i[3]||(i[3]=u=>c(n).hasAroundGutter=u)},null,8,["modelValue"])]),_:1}),m(l,{"content-position":"left"},{default:v(()=>[Dt]),_:1}),m(s,{label:"animationEffect"},{default:v(()=>[m(y,{modelValue:c(n).animationEffect,"onUpdate:modelValue":i[4]||(i[4]=u=>c(n).animationEffect=u),placeholder:"\u8BF7\u9009\u62E9",style:{width:"100%"}},{default:v(()=>[(h(!0),C(M,null,F(o.value,u=>(h(),D(p,{key:u.value,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),m(s,{label:"animationDuration"},{default:v(()=>[m(d,{modelValue:c(n).animationDuration,"onUpdate:modelValue":i[5]||(i[5]=u=>c(n).animationDuration=u),min:0,step:100,style:{width:"100%"}},null,8,["modelValue"])]),_:1}),m(s,{label:"animationDelay"},{default:v(()=>[m(d,{modelValue:c(n).animationDelay,"onUpdate:modelValue":i[6]||(i[6]=u=>c(n).animationDelay=u),min:0,step:100,style:{width:"100%"}},null,8,["modelValue"])]),_:1}),m(s,{label:"backgroundColor"},{default:v(()=>[m(b,{modelValue:c(n).backgroundColor,"onUpdate:modelValue":i[7]||(i[7]=u=>c(n).backgroundColor=u)},null,8,["modelValue"])]),_:1})]),_:1})}}}),kt={class:"h-screen flex overflow-hidden"},Vt={class:"flex-auto overflow-y-auto"},Et={class:"h-full flex flex-col justify-between"},Rt={class:"p-4 border-b border-b-gray-100 shadow-md"},Lt=f("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[f("path",{"fill-rule":"evenodd",d:"M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z","clip-rule":"evenodd"})],-1),jt=[Lt],Bt=f("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[f("path",{"fill-rule":"evenodd",d:"M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z","clip-rule":"evenodd"})],-1),Pt=[Bt],Tt={class:"p-4 flex-auto overflow-y-auto"},Nt=$({setup(e){function t(){const a=w(!0);function s(l){a.value=l}return{isOpen:a,handleToggleController:s}}const{isOpen:n,handleToggleController:o}=t(),r=K({rowKey:"id",gutter:10,hasAroundGutter:!0,width:320,breakpoints:{1200:{rowPerView:4},800:{rowPerView:3},500:{rowPerView:2}},animationEffect:"animate__fadeInUp",animationDuration:1e3,animationDelay:300,backgroundColor:"#2C2E3A",imgSelector:"src.original",loadProps:{loading:ve,error:ye,ratioCalculator:(a,s)=>{const l=3/4,d=4/3;return Math.random()>.5?l:d}},lazyload:!0,align:"center"}),i=w(!1);return(a,s)=>(h(),C("div",kt,[m(bt,{visible:i.value,"onUpdate:visible":s[0]||(s[0]=l=>i.value=l),options:c(r)},null,8,["visible","options"]),f("div",Vt,[m(ge,{options:c(r),onCardClick:s[1]||(s[1]=l=>i.value=!0)},null,8,["options"])]),f("div",Et,[f("div",Rt,[c(n)?(h(),C("span",{key:0,onClick:s[2]||(s[2]=l=>c(o)(!1))},jt)):(h(),C("span",{key:1,onClick:s[3]||(s[3]=l=>c(o)(!0))},Pt))]),f("div",Tt,[c(n)?(h(),D(xt,{key:0,form:c(r)},null,8,["form"])):De("",!0)]),m(It)])]))}}),Ft=$({setup(e){return(t,n)=>(h(),D(Nt))}});export{Ft as default}; diff --git a/docs/assets/PageB.1e6a7ebb.js b/docs/assets/PageB.1e6a7ebb.js deleted file mode 100644 index f43d776..0000000 --- a/docs/assets/PageB.1e6a7ebb.js +++ /dev/null @@ -1 +0,0 @@ -import{l as C,e as L,L as P,W as x,g as z}from"./api.ddc1e152.js";import{_ as S}from"./index.5c4ccb44.js";import{g as B,y as D,m as E,c as l,b as g,w as M,u as e,a as t,F as V,z as A,l as c,o as d,t as p,M as j}from"./vendor.705dcf8c.js";const F={class:"page-b-content"},I={class:"bg-gray-900 rounded-lg shadow-md overflow-hidden transition-all duration-300 ease-linear hover:shadow-lg hover:shadow-gray-600 group"},G={class:"overflow-hidden"},K={class:"px-4 pt-2 pb-4 border-t border-t-gray-800"},N={class:"pb-4 text-gray-50 group-hover:text-yellow-300"},W={class:"page-menus"},$=["onClick"],O=B({setup(U){const _=function(){const r=c([1,2,3,4,5]),s=c(1),a=c([]);function n(i){s.value=i,u()}function u(){z({page:s.value,pageSize:40}).then(i=>{a.value=i})}return{list:a,page:s,pages:r,handleLoadMore:u,handleChangePage:n}},o=D({rowKey:"id",gutter:10,hasAroundGutter:!0,width:320,breakpoints:{1200:{rowPerView:4},800:{rowPerView:3},500:{rowPerView:2}},animationEffect:"animate__fadeInUp",animationDuration:1e3,animationDelay:300,backgroundColor:"#2C2E3A",imgSelector:"src.original",loadProps:{loading:C,error:L},lazyload:!0,crossOrigin:!0}),{list:h,page:m,pages:v,handleLoadMore:f,handleChangePage:w}=_();E(()=>{f()});function y(r){}function b(r){console.error(`${r}: \u52A0\u8F7D\u5931\u8D25`)}function k(r){}return(r,s)=>(d(),l("div",F,[g(e(x),{list:e(h),"row-key":e(o).rowKey,gutter:e(o).gutter,"has-around-gutter":e(o).hasAroundGutter,width:e(o).width,breakpoints:e(o).breakpoints,"img-selector":e(o).imgSelector,"background-color":e(o).backgroundColor,lazyload:e(o).lazyload,"load-props":e(o).loadProps},{item:M(({item:a,url:n})=>[t("div",I,[t("div",G,[g(e(P),{url:n,class:"cursor-pointer transition-all duration-300 ease-linear group-hover:scale-105",onLoad:y,onError:b,onSuccess:k},null,8,["url"])]),t("div",K,[t("h2",N,p(a.name),1)])])]),_:1},8,["list","row-key","gutter","has-around-gutter","width","breakpoints","img-selector","background-color","lazyload","load-props"]),t("div",W,[(d(!0),l(V,null,A(e(v),a=>(d(),l("p",{key:a,class:j(["page-menus__item",{active:a===e(m)}]),onClick:n=>e(w)(a)},p(a),11,$))),128))])]))}});var Q=S(O,[["__scopeId","data-v-2cbce89c"]]);export{Q as default}; diff --git a/docs/assets/PageB.20d40a19.js b/docs/assets/PageB.20d40a19.js new file mode 100644 index 0000000..14189a3 --- /dev/null +++ b/docs/assets/PageB.20d40a19.js @@ -0,0 +1 @@ +import{m as y,M as et,t as S,g as E,p as L,N as nt,l as rt,u as ot,o as p,c as b,F as D,z as P,a as _,A as it,B as st,n as k,q as N,s as at,J as ut,b as j,w as lt,v as g,E as x,O as ct}from"./vendor.f2d4fbe7.js";import{_ as $}from"./index.0c05c534.js";import{l as dt,e as ft,g as gt}from"./api.efcc3c21.js";const mt=({breakpoints:t,wrapperWidth:e,gutter:n,hasAroundGutter:r,initWidth:o})=>{const s=Object.keys(t).map(l=>Number(l)).sort((l,h)=>l-h);let i=e,a=!1;for(const l of s)if(e<=l){i=l,a=!0;break}if(!a)return o;const u=t[i].rowPerView;return r?(e-n)/u-n:(e-(u-1)*n)/u};function ht(t){const e=y(0),n=y(null);et(n,i=>{const a=i[0],{width:u}=a.contentRect;e.value=u});const r=S(()=>mt({wrapperWidth:e.value,breakpoints:t.breakpoints,gutter:t.gutter,hasAroundGutter:t.hasAroundGutter,initWidth:t.width})),o=S(()=>{const i=t.hasAroundGutter?-t.gutter:t.gutter;return Math.floor((e.value+i)/(r.value+t.gutter))}),s=S(()=>{if(t.align==="left")return 0;if(t.align==="center"){const i=t.hasAroundGutter?t.gutter:-t.gutter,a=o.value*(r.value+t.gutter)+i;return(e.value-a)/2}else{const i=t.hasAroundGutter?t.gutter:-t.gutter,a=o.value*(r.value+t.gutter)+i;return e.value-a}});return{waterfallWrapper:n,wrapperWidth:e,colWidth:r,cols:o,offsetX:s}}function B(t,e){return new RegExp(`(^|\\s)${e}(\\s|$)`).test(t.className)}function G(t,e){if(B(t,e))return;const n=t.className.split(/\s+/);n.push(e),t.className=n.join(" ")}const yt=document.createElement("div").style,C=(()=>{const t={standard:"transform",webkit:"webkitTransform",Moz:"MozTransform",O:"OTransform",ms:"msTransform"};for(const e in t){const n=t[e];if(yt[n]!==void 0)return e}return!1})();function O(t){return C===!1?!1:C==="standard"?t:C+t.charAt(0).toUpperCase()+t.substr(1)}const V=O("transform"),M=O("animation-duration"),T=O("animation-delay"),F=O("transition"),U=O("animation-fill-mode");function _t(t,e,n,r,o){const s=y([]),i=y(0),a=c=>{const f=t.hasAroundGutter?c+1:c;return t.gutter*f+e.value*c+r.value},u=()=>{s.value=new Array(n.value).fill(t.hasAroundGutter?t.gutter:0)},l=vt(t);return{wrapperHeight:i,layoutHandle:async()=>new Promise(c=>{u();const f=[];if(o&&o.value&&o.value.childNodes.forEach(d=>{d.className==="waterfall-item"&&f.push(d)}),f.length===0)return!1;for(let d=0;d{const tt=t.posDuration/1e3;F&&(z[F]=`transform ${tt}s`)})}i.value=Math.max.apply(null,s.value),setTimeout(()=>{c(!0)},t.posDuration)})}}function vt(t){return(e,n)=>{const r=e.firstChild;if(r&&!B(r,t.animationPrefix)){const o=`${t.animationDuration/1e3}s`,s=`${t.animationDelay/1e3}s`,i=r.style;G(r,t.animationPrefix),G(r,t.animationEffect),M&&(i[M]=o),T&&(i[T]=s),U&&(i[U]="both"),n&&setTimeout(()=>{n()},t.animationDuration+t.animationDelay)}}}const pt=typeof window!="undefined"&&window!==null,W=At(),bt=Object.prototype.propertyIsEnumerable,H=Object.getOwnPropertySymbols;function wt(t,...e){return e.map(r=>r.replace(/\[(\w+)\]/g,".$1").split(".").reduce((o,s)=>o&&o[s],t))}function At(){return pt&&"IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype?("isIntersecting"in window.IntersectionObserverEntry.prototype||Object.defineProperty(window.IntersectionObserverEntry.prototype,"isIntersecting",{get(){return this.intersectionRatio>0}}),!0):!1}function I(t){return typeof t=="function"||toString.call(t)==="[object Object]"}function Ot(t){return typeof t=="object"?t===null:typeof t!="function"}function It(t){return t!=="__proto__"&&t!=="constructor"&&t!=="prototype"}function zt(t,...e){if(!I(t))throw new TypeError("expected the first argument to be an object");if(e.length===0||typeof Symbol!="function"||typeof H!="function")return t;for(const n of e){const r=H(n);for(const o of r)bt.call(n,o)&&(t[o]=n[o])}return t}function K(t,...e){let n=0;for(Ot(t)&&(t=e[n++]),t||(t={});n{const o=new Image;o.onload=()=>{n(o)},o.onerror=()=>{r(new Error("Image load error"))},e&&(o.crossOrigin="Anonymous"),o.src=t})}var A;(function(t){t.LOADING="loading",t.LOADED="loaded",t.ERROR="error"})(A||(A={}));const St={rootMargin:"0px",threshold:0},Y="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Et="";class Lt{constructor(e=!0,n,r=!0){this.lazyActive=!0,this.crossOrigin=!0,this.options={loading:Y,error:Et,observerOptions:St,log:!0,ratioCalculator:(o,s)=>s/o},this._images=new WeakMap,this.lazyActive=e,this.crossOrigin=r,this.config(n)}config(e={}){K(this.options,e),e.ratioCalculator&&(this.options.ratioCalculator=e.ratioCalculator)}mount(e,n,r){const{src:o,loading:s,error:i}=this._valueFormatter(n);e.setAttribute("lazy",A.LOADING),e.setAttribute("src",s||Y),this.lazyActive?(W||(this._setImageSrc(e,o,r,i),this._log(()=>{throw new Error("Not support IntersectionObserver!")})),this._initIntersectionObserver(e,o,r,i)):this._setImageSrc(e,o,r,i)}resize(e,n){const r=e.getAttribute("lazy"),o=e.getAttribute("src");r&&r===A.LOADED&&o&&X(o,this.crossOrigin).then(s=>{const{width:i,height:a}=s,u=e.width/i*a;e.height=u;const l=e.style;l.height=`${u}px`,n()})}unmount(e){const n=this._realObserver(e);n&&n.unobserve(e),this._images.delete(e)}_setImageSrc(e,n,r,o){!n||e.getAttribute("src")===n||X(n,this.crossOrigin).then(i=>{var c,f;const{width:a,height:u}=i,l=((f=(c=this.options).ratioCalculator)==null?void 0:f.call(c,a,u))||u/a,h=e.parentNode.parentNode;h.style.paddingBottom=`${l*100}%`,e.setAttribute("lazy",A.LOADED),e.removeAttribute("src"),e.setAttribute("src",n),r(!0)}).catch(()=>{const i=this._realObserver(e);i&&i.disconnect(),o&&(e.setAttribute("lazy",A.ERROR),e.setAttribute("src",o),r(!1)),this._log(()=>{throw new Error(`Image failed to load!And failed src was: ${n} `)})})}_isOpenLazy(){return W&&this.lazyActive}_initIntersectionObserver(e,n,r,o){const s=this.options.observerOptions;this._images.set(e,new IntersectionObserver(a=>{Array.prototype.forEach.call(a,u=>{if(u.isIntersecting){const l=this._realObserver(e);l&&l.unobserve(u.target),this._setImageSrc(e,n,r,o)}})},s));const i=this._realObserver(e);i&&i.observe(e)}_valueFormatter(e){let n=e,r=this.options.loading,o=this.options.error;return I(e)&&(n=e.src,r=e.loading||this.options.loading,o=e.error||this.options.error),{src:n,loading:r,error:o}}_log(e){this.options.log&&e()}_realObserver(e){return this._images.get(e)}}const R=E({props:{list:{type:Array,default:()=>[]},rowKey:{type:String,default:"id"},imgSelector:{type:String,default:"src"},width:{type:Number,default:200},breakpoints:{type:Object,default:()=>({1200:{rowPerView:3},800:{rowPerView:2},500:{rowPerView:1}})},gutter:{type:Number,default:10},hasAroundGutter:{type:Boolean,default:!0},posDuration:{type:Number,default:300},animationPrefix:{type:String,default:"animate__animated"},animationEffect:{type:String,default:"fadeIn"},animationDuration:{type:Number,default:1e3},animationDelay:{type:Number,default:300},backgroundColor:{type:String,default:"#fff"},lazyload:{type:Boolean,default:!0},loadProps:{type:Object,default:()=>{}},crossOrigin:{type:Boolean,default:!0},delay:{type:Number,default:300},align:{type:String,default:"center"}},setup(t,e){const n=new Lt(t.lazyload,t.loadProps,t.crossOrigin);L("lazy",n);const{waterfallWrapper:r,wrapperWidth:o,colWidth:s,cols:i,offsetX:a}=ht(t),{wrapperHeight:u,layoutHandle:l}=_t(t,s,i,a,r),h=nt(()=>{l().then(()=>{e.emit("afterRender")})},t.delay);rt(()=>[o,s,t.list],()=>{o.value>0&&h()},{deep:!0});const c=y(0);return L("sizeChangeTime",c),L("imgLoaded",h),{waterfallWrapper:r,wrapperHeight:u,getRenderURL:m=>wt(m,t.imgSelector)[0],getKey:(m,v)=>m[t.rowKey]||v,renderer:h}}}),q=()=>{ot(t=>({"84adae44":t.backgroundColor}))},J=R.setup;R.setup=J?(t,e)=>(q(),J(t,e)):q;const $t=R,Ct={class:"waterfall-card"};function Rt(t,e,n,r,o,s){return p(),b("div",{ref:"waterfallWrapper",class:"waterfall-list",style:st({height:`${t.wrapperHeight}px`})},[(p(!0),b(D,null,P(t.list,(i,a)=>(p(),b("div",{key:t.getKey(i,a),class:"waterfall-item"},[_("div",Ct,[it(t.$slots,"item",{item:i,index:a,url:t.getRenderURL(i)},void 0,!0)])]))),128))],4)}var Dt=$($t,[["render",Rt],["__scopeId","data-v-6d3e5303"]]);const Pt=E({props:{url:{type:String,default:""},title:{type:String,default:""},alt:{type:String,default:""}},setup(t,e){const n=k("imgLoaded"),r=k("lazy"),o=y(null);N(()=>{s()}),at(()=>{i()});function s(){!o.value||r.mount(o.value,t.url,u=>{n(),u?e.emit("success",t.url):e.emit("error",t.url)})}function i(){!o.value||r.unmount(o.value)}function a(){e.emit("load",t.url)}return{lazyRef:o,imageLoad:a}}}),kt={class:"lazy__box"},Nt={class:"lazy__resource"},jt=["title","alt"];function xt(t,e,n,r,o,s){return p(),b("div",kt,[_("div",Nt,[_("img",{ref:"lazyRef",class:"lazy__img",title:t.title,alt:t.alt,onLoad:e[0]||(e[0]=(...i)=>t.imageLoad&&t.imageLoad(...i))},null,40,jt)])])}var Bt=$(Pt,[["render",xt],["__scopeId","data-v-640f8d40"]]);const Gt={class:"page-b-content"},Vt={class:"bg-gray-900 rounded-lg shadow-md overflow-hidden transition-all duration-300 ease-linear hover:shadow-lg hover:shadow-gray-600 group"},Mt={class:"overflow-hidden"},Tt={class:"px-4 pt-2 pb-4 border-t border-t-gray-800"},Ft={class:"pb-4 text-gray-50 group-hover:text-yellow-300"},Ut={class:"page-menus"},Wt=["onClick"],Ht=E({setup(t){const e=function(){const c=y([1,2,3,4,5]),f=y(1),d=y([]);function m(w){f.value=w,v()}function v(){gt({page:f.value,pageSize:40}).then(w=>{d.value=w})}return{list:d,page:f,pages:c,handleLoadMore:v,handleChangePage:m}},n=ut({rowKey:"id",gutter:10,hasAroundGutter:!0,width:320,breakpoints:{1200:{rowPerView:4},800:{rowPerView:3},500:{rowPerView:2}},animationEffect:"animate__fadeInUp",animationDuration:1e3,animationDelay:300,backgroundColor:"#2C2E3A",imgSelector:"src.original",loadProps:{loading:dt,error:ft},lazyload:!0,crossOrigin:!0}),{list:r,page:o,pages:s,handleLoadMore:i,handleChangePage:a}=e();N(()=>{i()});function u(c){}function l(c){console.error(`${c}: \u52A0\u8F7D\u5931\u8D25`)}function h(c){}return(c,f)=>(p(),b("div",Gt,[j(g(Dt),{list:g(r),"row-key":g(n).rowKey,gutter:g(n).gutter,"has-around-gutter":g(n).hasAroundGutter,width:g(n).width,breakpoints:g(n).breakpoints,"img-selector":g(n).imgSelector,"background-color":g(n).backgroundColor,lazyload:g(n).lazyload,"load-props":g(n).loadProps},{item:lt(({item:d,url:m})=>[_("div",Vt,[_("div",Mt,[j(g(Bt),{url:m,class:"cursor-pointer transition-all duration-300 ease-linear group-hover:scale-105",onLoad:u,onError:l,onSuccess:h},null,8,["url"])]),_("div",Tt,[_("h2",Ft,x(d.name),1)])])]),_:1},8,["list","row-key","gutter","has-around-gutter","width","breakpoints","img-selector","background-color","lazyload","load-props"]),_("div",Ut,[(p(!0),b(D,null,P(g(s),d=>(p(),b("p",{key:d,class:ct(["page-menus__item",{active:d===g(o)}]),onClick:m=>g(a)(d)},x(d),11,Wt))),128))])]))}});var qt=$(Ht,[["__scopeId","data-v-2cbce89c"]]);export{qt as default}; diff --git a/docs/assets/PageB.682b45d6.css b/docs/assets/PageB.682b45d6.css new file mode 100644 index 0000000..a822ad0 --- /dev/null +++ b/docs/assets/PageB.682b45d6.css @@ -0,0 +1 @@ +.waterfall-list[data-v-6d3e5303]{width:100%;position:relative;overflow:hidden;background-color:var(--84adae44)}.waterfall-item[data-v-6d3e5303]{position:absolute;left:0;top:0;transform:translateY(3000px);visibility:hidden}@keyframes fadeIn-6d3e5303{0%{opacity:0}to{opacity:1}}.fadeIn[data-v-6d3e5303]{animation-name:fadeIn-6d3e5303}.lazy__box[data-v-640f8d40]{width:100%;height:0;padding-bottom:100%;overflow:hidden;position:relative}.lazy__resource[data-v-640f8d40]{display:flex;justify-content:center;align-items:center;position:absolute;left:0;top:0;bottom:0;right:0}.lazy__img[data-v-640f8d40]{display:block}.lazy__img[lazy=loading][data-v-640f8d40]{padding:5em 0;width:48px}.lazy__img[lazy=loaded][data-v-640f8d40]{width:100%;height:100%;-o-object-fit:cover;object-fit:cover}.lazy__img[lazy=error][data-v-640f8d40]{padding:5em 0;width:48px;height:auto}.page-b-content[data-v-2cbce89c]{padding:20px;background-color:#2c2e3a}.page-menus[data-v-2cbce89c]{position:fixed;left:20px;bottom:20px}.page-menus__item[data-v-2cbce89c]{width:30px;height:30px;border-radius:50%;border:2px solid #e7e7e7;background-color:#fff;margin-bottom:14px;display:flex;justify-content:center;align-items:center;cursor:pointer;font-size:14px;color:#666}.page-menus__item.active[data-v-2cbce89c]{background-color:#e75932;color:#fff} diff --git a/docs/assets/PageB.d0650836.css b/docs/assets/PageB.d0650836.css deleted file mode 100644 index e92dadd..0000000 --- a/docs/assets/PageB.d0650836.css +++ /dev/null @@ -1 +0,0 @@ -.page-b-content[data-v-2cbce89c]{padding:20px;background-color:#2c2e3a}.page-menus[data-v-2cbce89c]{position:fixed;left:20px;bottom:20px}.page-menus__item[data-v-2cbce89c]{width:30px;height:30px;border-radius:50%;border:2px solid #e7e7e7;background-color:#fff;margin-bottom:14px;display:flex;justify-content:center;align-items:center;cursor:pointer;font-size:14px;color:#666}.page-menus__item.active[data-v-2cbce89c]{background-color:#e75932;color:#fff} diff --git a/docs/assets/api.ddc1e152.js b/docs/assets/api.ddc1e152.js deleted file mode 100644 index 73e7bad..0000000 --- a/docs/assets/api.ddc1e152.js +++ /dev/null @@ -1 +0,0 @@ -import{l as g,B as V,s as z,g as D,C as R,D as X,E as J,G as q,o as E,c as p,F as $,z as tt,a as I,H as et,I as rt,J as F,m as nt,L as ot}from"./vendor.705dcf8c.js";import{_}from"./index.5c4ccb44.js";var Ct="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABNBJREFUaEPtmV1oXEUUx//n3g1JRGqL9k1RsFq/6IMgSky8c2YTQyONiojWYumTQrWKSNH6oO1TS1EQFcTiQwsaK4qIbVdod+/M3Y0IteJDwVr1oVYFEfFFwUY2c2TCbrhZNptNduvuQgf2Ze85M+c359w5Z84l9PigHrcflwCqHrTWsoiUmLn8f3q1bR4wxggRlZxz00EQlCowf19smLYAxHF8NxFNA/gUgAKwGsApD5GC+eNiwLQL4GUi2gNgDIA31ENEKZhzIvK5h5mZmZkeHx//uV0wbQEwxpQADDPzgvny+fyNYRhO1MB42w9674RhWIqi6IdWYFoGMMbcBuA0ER1RSk3GcbyViB4HcBTAMWb+0RtYKpXWlMvlSSKaFBFdCTP/yIrIRxWY08uFaQfAswAeAPAaMx81xhwmojVpQ0TkSxH5QGt9tvp/kiQTzrlJAOsroeYfnXPOHQrD8JhS6qtmYFoGaGaRRjKFQuF6IhononsB+N9gSv4ggENKqYSIpN48cwCFQmF3EARPt2rMcvWZ+ao4ju/TWh+r6hpjRkVkYwXIh+d8qvEw/f39Hw4NDf1T/TMN8AqA/HKNWKk8EWmlVFjZvG0iUiSiIjO/W52zWCyuLZfLm4hoE4DxlHfmQi2bze6uBbih+tKt1LBm9Ky17wN4NAXgN29uiMi/HsS/2FrrA+n5isXi7bOzsx5mdyaTWT8yMvJ9XQC/K80YshIZv2uNAOrM+bWIHKjCWGuPi8g9zDzgZesC+LJgJcYtpeOc27MCAD/taWbeYIy5i4gKzjnvnW29BLCLmfcZY54H8GoQBONRFB3vGYByuXzt2NjYeWPMJwAeTGf8rg8hIvpTKXVlHMe3AogBnNFa+1prbnQ9gIi8rbXeHsfxE0T0DhE9qZSaP526HgDACDNPW2sPicjWvr6+VcPDw3/1jAd8vJ84ceKKTCbjj1NordelT7tu98BRZt5krd0sIlNEtFcp9VLPAIjIFq31lDHmLQBPBUGwIYqiBSV3xz1gjPFlRN3MXz0ujTHf+LKbmS+rTZZdC0BEJ5VSdxYKBR0EQYGIppRSW3oGAEA1++4F8KK/ySmljvQMQDX7Wmt9ZeqP0rqXr24NoZ+Y+TpjzDoiOuvvCszM9YrFbgV4nZmfi+N4JxHtJ6JnlFJv9hLAXPY1xuQAbASwlpnrNsY67oHKlXL+RgbgAjMP5nK5/oGBgd+DIPhNKeU7F3VHxwFq80Cl/fKYMeYRAIdFZL/W+oWeAQDwMDN/7PtLADzEHcx8qmcAUtn3FxFZrbW+vNFVteMhFMexj+/7faKqxP9okiRDzrkvALzHzL5NuejoOEDasiRJJqMo+sxau19EdgZB8FAURf4auTyARgrteJZuq9SbzxhzBsBNi2XfJcvpdhjZaI5GAEmSXOOcO09EsVIqu5QtHe/M1Rpord0hIm8A2MHM/h7QcHQjQMF/P3DOXZ3NZn/teoBKJr4AYLpSPviu4HfMfPNSxvvnCzzgnNvejFKrMmEYDi/S3LWVjx37mHlXM+vUhlAzOm2RISLnu9N+slwut2pwcHCCiCZExH+5mchmsyebWWgOwBgz3+lqRqldMszsd3zByOfzt4yOjn7b7Bod/8TUrKGLyV0CaHUHW9X/D9N93V6azvezAAAAAElFTkSuQmCC",Lt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABbFJREFUaEPtWV1sFFUUPufOLmjpD7G0nXtm11igD0Q0CpqImsiDEcGoIVEReeBBNGgkEQSjwUR4MQZ/MBr/MeFFFIkxYAR9MGr84cFijBJ9UFPD7r3TqtWWLsVuO3PM3ew20+3uzizTxpDsTSa7e+ec75zvnPtz7l2E87zhee4/NAj83xlsZKCRgZgRaAyhmAGMrV4zA5lM5sJEItGcz+dbhBDN5gGAZkRsQcTCd/Mwc0vpu+k3v5l5yHGcDUEPtdY7AeAsIp4t/5yYmCj0myefz//LzGfNY/p7enrGqjGtSEAp9ZgQYgsz07mGiJk3OY7zVklfKbULEZ88FzxE1L7vv+Q4ztPl+tMIZLPZFUKIb87FUFBHCLHQtu2+Up/WmuNi+r5/bSqVOh7EmUZAa70VAJ6PYwwRJ6SUyRKG67odzPxHHMyi7jYi2luTgOu6O5h5T1xjiLhDSvlsIAOfAcDKOLiI+KiU8pmwDGwGgFfjGCrqDhLRgkAWHmTml2PiPkBEr4URuAcA3o5pqKR+PxG9aX7M0DDaQEQHahJQSt2KiEdmiMA7RGQCUmha61jDiJlvcxznw7A5cAMzfz4TBHzfvzGVSn1qsDKZzErLsgyBac0skwBwwvf9HCKuBoD5VeRWSim/CMvAMkQ8MQME+ohoYZToE9HkapjNZq9AxFcQcUW5D8y83HGc72oSyGQyiy3L+qUeAsx8yMgj4p0BvZ1E9FRY9Jl5t+M4u4L2tNaPA0BBN9g8z+tJp9O/1iTQ39/f6fv+QB0ExoQQS4aGhv5qa2s7zsyXGl0hRJdt24W1P2TsbyWiF4L2lFL3IuK+ch+CmKV30zYyU/9YljVaB4EDRFSoeUrj3CwCUsrbw6JftPE9EV1ZloFhAGitkIGmdDpt6qjJVrEWcl03z8yTO2kImTuI6P2STDabfUQIsYqIbjJ91aJZhjkCANuZeSkArEbExeU2EXFcSjlnWn8l55RSg4h4UVgWELHPtu1FiDilzlFKmaxsNEa11ksA4KcwrLD3zPy34zjtkQhorU0RdkkYqJloRGRK5ClNKXUxIposFDax8kIOEfczcxsArI1goyTyOxF1RyKglPoBES+LAH4VEVVccrXWa4nogyKBXgBYXnR8DxH9XOz/EgCuj2AHmPlHx3Euj0RAa/0VAFwXAvw1EdU03tfXN7+7u3tIa73X87zD6XR6ygaZzWavEUJMKY9r2Kxor9okPsrMZkes1TYT0etRoldLxnXdF5l5SxgOIh6TUq6JlAGl1EFEvKsWqO/7C1Kp1GCY4bD3zDzHdd2TANBTS5aZ33McZ10kAlprM/k2VQNExENSypoEwxwPvndddyMz7w/R2UdE90UlYE5k5mRWsVWqCutxuJKs1tqUyetr4Owlom2RCLiuu4uZqx3A/yGi0D2iXkKnTp1amkgkTKVZERsRd0spp9RMxkbFSVzcTSePg2XOFNbjwcFBs9W35vP5Vs/z2oQQrYjY6vt+4dOs86ZI01o/AQA5Zs5ZljUyMTGRE0KMmN/JZHJkdHQ019TUNNLZ2ZmrVTP5vr89lUo9FykDWmsz1t6oN4pBeSHE+vHx8cN11lW1TE6e7oJCFTPQ39+/zvf9d+MQYOZlxc2rsBvHbUKIu23bPhgpA67rrmHmj2IY/bNYihiMWDcRJR8Q8RYp5dFIBAYGBhZ5njfl4FAvGSnlBUqph4QQ1eZSXZCWZS3u6ur6LRIBI6S1/hgAVkW0wsx8GhFPA8AIIuYA4OTw8PDDLS0txxBxXukutXiPOi8ibknsEyK6uZJO1ctds8qMjY2Zc+nVAFBwzjjJzCOJRCKXz+fPJJNJ46h5zti2fSaqU729vcmOjo5my7LmBS6MDSlzcdzseV7w8vjbuXPnHm9vbzfBmdYa/w9EjfpsyTUyMFuRjYrbyEDUSM2WXCMDsxXZqLjnfQb+A8eWU0/QfZYsAAAAAElFTkSuQmCC";const it=({breakpoints:t,wrapperWidth:e,gutter:r,hasAroundGutter:n,initWidth:o})=>{const s=Object.keys(t).map(l=>Number(l)).sort((l,d)=>l-d);let i=e,a=!1;for(const l of s)if(e<=l){i=l,a=!0;break}if(!a)return o;const u=t[i].rowPerView;return n?(e-r)/u-r:(e-(u-1)*r)/u};function st(t){const e=g(0),r=g(null);V(r,i=>{const a=i[0],{width:u}=a.contentRect;e.value=u});const n=z(()=>it({wrapperWidth:e.value,breakpoints:t.breakpoints,gutter:t.gutter,hasAroundGutter:t.hasAroundGutter,initWidth:t.width})),o=z(()=>{const i=t.hasAroundGutter?-t.gutter:t.gutter;return Math.floor((e.value+i)/(n.value+t.gutter))}),s=z(()=>{if(t.align==="left")return 0;if(t.align==="center"){const i=t.hasAroundGutter?t.gutter:-t.gutter,a=o.value*(n.value+t.gutter)+i;return(e.value-a)/2}else{const i=t.hasAroundGutter?t.gutter:-t.gutter,a=o.value*(n.value+t.gutter)+i;return e.value-a}});return{waterfallWrapper:r,wrapperWidth:e,colWidth:n,cols:o,offsetX:s}}function j(t,e){return new RegExp(`(^|\\s)${e}(\\s|$)`).test(t.className)}function B(t,e){if(j(t,e))return;const r=t.className.split(/\s+/);r.push(e),t.className=r.join(" ")}const at=document.createElement("div").style,O=(()=>{const t={standard:"transform",webkit:"webkitTransform",Moz:"MozTransform",O:"OTransform",ms:"msTransform"};for(const e in t){const r=t[e];if(at[r]!==void 0)return e}return!1})();function y(t){return O===!1?!1:O==="standard"?t:O+t.charAt(0).toUpperCase()+t.substr(1)}const M=y("transform"),C=y("animation-duration"),L=y("animation-delay"),x=y("transition"),P=y("animation-fill-mode");function ut(t,e,r,n,o){const s=g([]),i=g(0),a=c=>{const f=t.hasAroundGutter?c+1:c;return t.gutter*f+e.value*c+n.value},u=()=>{s.value=new Array(r.value).fill(t.hasAroundGutter?t.gutter:0)},l=lt(t);return{wrapperHeight:i,layoutHandle:async()=>new Promise(c=>{u();const f=[];if(o&&o.value&&o.value.childNodes.forEach(A=>{A.className==="waterfall-item"&&f.push(A)}),f.length===0)return!1;for(let A=0;A{const k=t.posDuration/1e3;x&&(b[x]=`transform ${k}s`)})}i.value=Math.max.apply(null,s.value),setTimeout(()=>{c(!0)},t.posDuration)})}}function lt(t){return(e,r)=>{const n=e.firstChild;if(n&&!j(n,t.animationPrefix)){const o=`${t.animationDuration/1e3}s`,s=`${t.animationDelay/1e3}s`,i=n.style;B(n,t.animationPrefix),B(n,t.animationEffect),C&&(i[C]=o),L&&(i[L]=s),P&&(i[P]="both"),r&&setTimeout(()=>{r()},t.animationDuration+t.animationDelay)}}}const ct=typeof window!="undefined"&&window!==null,T=At(),ft=Object.prototype.propertyIsEnumerable,G=Object.getOwnPropertySymbols;function dt(t,...e){return e.map(n=>n.replace(/\[(\w+)\]/g,".$1").split(".").reduce((o,s)=>o&&o[s],t))}function At(){return ct&&"IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype?("isIntersecting"in window.IntersectionObserverEntry.prototype||Object.defineProperty(window.IntersectionObserverEntry.prototype,"isIntersecting",{get(){return this.intersectionRatio>0}}),!0):!1}function v(t){return typeof t=="function"||toString.call(t)==="[object Object]"}function mt(t){return typeof t=="object"?t===null:typeof t!="function"}function gt(t){return t!=="__proto__"&&t!=="constructor"&&t!=="prototype"}function ht(t,...e){if(!v(t))throw new TypeError("expected the first argument to be an object");if(e.length===0||typeof Symbol!="function"||typeof G!="function")return t;for(const r of e){const n=G(r);for(const o of n)ft.call(r,o)&&(t[o]=r[o])}return t}function H(t,...e){let r=0;for(mt(t)&&(t=e[r++]),t||(t={});r{const o=new Image;o.onload=()=>{r(o)},o.onerror=()=>{n(new Error("Image load error"))},e&&(o.crossOrigin="Anonymous"),o.src=t})}var h;(function(t){t.LOADING="loading",t.LOADED="loaded",t.ERROR="error"})(h||(h={}));const yt={rootMargin:"0px",threshold:0},Q="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",vt="";class wt{constructor(e=!0,r,n=!0){this.lazyActive=!0,this.crossOrigin=!0,this.options={loading:Q,error:vt,observerOptions:yt,log:!0,ratioCalculator:(o,s)=>s/o},this._images=new WeakMap,this.lazyActive=e,this.crossOrigin=n,this.config(r)}config(e={}){H(this.options,e),e.ratioCalculator&&(this.options.ratioCalculator=e.ratioCalculator)}mount(e,r,n){const{src:o,loading:s,error:i}=this._valueFormatter(r);e.setAttribute("lazy",h.LOADING),e.setAttribute("src",s||Q),this.lazyActive?(T||(this._setImageSrc(e,o,n,i),this._log(()=>{throw new Error("Not support IntersectionObserver!")})),this._initIntersectionObserver(e,o,n,i)):this._setImageSrc(e,o,n,i)}resize(e,r){const n=e.getAttribute("lazy"),o=e.getAttribute("src");n&&n===h.LOADED&&o&&K(o,this.crossOrigin).then(s=>{const{width:i,height:a}=s,u=e.width/i*a;e.height=u;const l=e.style;l.height=`${u}px`,r()})}unmount(e){const r=this._realObserver(e);r&&r.unobserve(e),this._images.delete(e)}_setImageSrc(e,r,n,o){!r||e.getAttribute("src")===r||K(r,this.crossOrigin).then(i=>{var c,f;const{width:a,height:u}=i,l=((f=(c=this.options).ratioCalculator)==null?void 0:f.call(c,a,u))||u/a,d=e.parentNode.parentNode;d.style.paddingBottom=`${l*100}%`,e.setAttribute("lazy",h.LOADED),e.removeAttribute("src"),e.setAttribute("src",r),n(!0)}).catch(()=>{const i=this._realObserver(e);i&&i.disconnect(),o&&(e.setAttribute("lazy",h.ERROR),e.setAttribute("src",o),n(!1)),this._log(()=>{throw new Error(`Image failed to load!And failed src was: ${r} `)})})}_isOpenLazy(){return T&&this.lazyActive}_initIntersectionObserver(e,r,n,o){const s=this.options.observerOptions;this._images.set(e,new IntersectionObserver(a=>{Array.prototype.forEach.call(a,u=>{if(u.isIntersecting){const l=this._realObserver(e);l&&l.unobserve(u.target),this._setImageSrc(e,r,n,o)}})},s));const i=this._realObserver(e);i&&i.observe(e)}_valueFormatter(e){let r=e,n=this.options.loading,o=this.options.error;return v(e)&&(r=e.src,n=e.loading||this.options.loading,o=e.error||this.options.error),{src:r,loading:n,error:o}}_log(e){this.options.log&&e()}_realObserver(e){return this._images.get(e)}}const S=D({props:{list:{type:Array,default:()=>[]},rowKey:{type:String,default:"id"},imgSelector:{type:String,default:"src"},width:{type:Number,default:200},breakpoints:{type:Object,default:()=>({1200:{rowPerView:3},800:{rowPerView:2},500:{rowPerView:1}})},gutter:{type:Number,default:10},hasAroundGutter:{type:Boolean,default:!0},posDuration:{type:Number,default:300},animationPrefix:{type:String,default:"animate__animated"},animationEffect:{type:String,default:"fadeIn"},animationDuration:{type:Number,default:1e3},animationDelay:{type:Number,default:300},backgroundColor:{type:String,default:"#fff"},lazyload:{type:Boolean,default:!0},loadProps:{type:Object,default:()=>{}},crossOrigin:{type:Boolean,default:!0},delay:{type:Number,default:300},align:{type:String,default:"center"}},setup(t,e){const r=new wt(t.lazyload,t.loadProps,t.crossOrigin);R("lazy",r);const{waterfallWrapper:n,wrapperWidth:o,colWidth:s,cols:i,offsetX:a}=st(t),{wrapperHeight:u,layoutHandle:l}=ut(t,s,i,a,n),d=X(()=>{l().then(()=>{e.emit("afterRender")})},t.delay);J(()=>[o,s,t.list],()=>{o.value>0&&d()},{deep:!0});const c=g(0);return R("sizeChangeTime",c),R("imgLoaded",d),{waterfallWrapper:n,wrapperHeight:u,getRenderURL:m=>dt(m,t.imgSelector)[0],getKey:(m,w)=>m[t.rowKey]||w,renderer:d}}}),Y=()=>{q(t=>({"84adae44":t.backgroundColor}))},U=S.setup;S.setup=U?(t,e)=>(Y(),U(t,e)):Y;const bt=S,Et={class:"waterfall-card"};function pt(t,e,r,n,o,s){return E(),p("div",{ref:"waterfallWrapper",class:"waterfall-list",style:rt({height:`${t.wrapperHeight}px`})},[(E(!0),p($,null,tt(t.list,(i,a)=>(E(),p("div",{key:t.getKey(i,a),class:"waterfall-item"},[I("div",Et,[et(t.$slots,"item",{item:i,index:a,url:t.getRenderURL(i)},void 0,!0)])]))),128))],4)}var xt=_(bt,[["render",pt],["__scopeId","data-v-6d3e5303"]]);const zt=D({props:{url:{type:String,default:""},title:{type:String,default:""},alt:{type:String,default:""}},setup(t,e){const r=F("imgLoaded"),n=F("lazy"),o=g(null);nt(()=>{s()}),ot(()=>{i()});function s(){!o.value||n.mount(o.value,t.url,u=>{r(),u?e.emit("success",t.url):e.emit("error",t.url)})}function i(){!o.value||n.unmount(o.value)}function a(){e.emit("load",t.url)}return{lazyRef:o,imageLoad:a}}}),Rt={class:"lazy__box"},It={class:"lazy__resource"},Ot=["title","alt"];function St(t,e,r,n,o,s){return E(),p("div",Rt,[I("div",It,[I("img",{ref:"lazyRef",class:"lazy__img",title:t.title,alt:t.alt,onLoad:e[0]||(e[0]=(...i)=>t.imageLoad&&t.imageLoad(...i))},null,40,Ot)])])}var Pt=_(zt,[["render",St],["__scopeId","data-v-640f8d40"]]);function Nt(t=6){return Number(Math.random().toString().substr(3,t)+Date.now()).toString(36)}const Dt=["#409EFF","#67C23A","#E6A23C","#F56C6C","#909399"];function Ft(t,e){return Math.floor(Math.random()*(e-t+1))+t}function _t(){return Dt[Ft(0,4)]}const jt="https://www.getphotoblanket.com",Tt=({page:t=1,pageSize:e=20})=>{const r=`${jt}/products.json?page=${t}&limit=${e}`;return fetch(r).then(n=>n.json()).then(n=>n.products).then(n=>n.map(o=>({id:Nt(),star:!1,price:o.variants[0].price,src:{original:Math.random()>.1?o.images[0].src:"https://www.example.com/non-existent-image.jpg"},backgroundColor:_t(),name:o.title})))};export{Pt as L,xt as W,Lt as e,Tt as g,Ct as l}; diff --git a/docs/assets/api.efcc3c21.js b/docs/assets/api.efcc3c21.js new file mode 100644 index 0000000..2705795 --- /dev/null +++ b/docs/assets/api.efcc3c21.js @@ -0,0 +1 @@ +var n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABNBJREFUaEPtmV1oXEUUx//n3g1JRGqL9k1RsFq/6IMgSky8c2YTQyONiojWYumTQrWKSNH6oO1TS1EQFcTiQwsaK4qIbVdod+/M3Y0IteJDwVr1oVYFEfFFwUY2c2TCbrhZNptNduvuQgf2Ze85M+c359w5Z84l9PigHrcflwCqHrTWsoiUmLn8f3q1bR4wxggRlZxz00EQlCowf19smLYAxHF8NxFNA/gUgAKwGsApD5GC+eNiwLQL4GUi2gNgDIA31ENEKZhzIvK5h5mZmZkeHx//uV0wbQEwxpQADDPzgvny+fyNYRhO1MB42w9674RhWIqi6IdWYFoGMMbcBuA0ER1RSk3GcbyViB4HcBTAMWb+0RtYKpXWlMvlSSKaFBFdCTP/yIrIRxWY08uFaQfAswAeAPAaMx81xhwmojVpQ0TkSxH5QGt9tvp/kiQTzrlJAOsroeYfnXPOHQrD8JhS6qtmYFoGaGaRRjKFQuF6IhononsB+N9gSv4ggENKqYSIpN48cwCFQmF3EARPt2rMcvWZ+ao4ju/TWh+r6hpjRkVkYwXIh+d8qvEw/f39Hw4NDf1T/TMN8AqA/HKNWKk8EWmlVFjZvG0iUiSiIjO/W52zWCyuLZfLm4hoE4DxlHfmQi2bze6uBbih+tKt1LBm9Ky17wN4NAXgN29uiMi/HsS/2FrrA+n5isXi7bOzsx5mdyaTWT8yMvJ9XQC/K80YshIZv2uNAOrM+bWIHKjCWGuPi8g9zDzgZesC+LJgJcYtpeOc27MCAD/taWbeYIy5i4gKzjnvnW29BLCLmfcZY54H8GoQBONRFB3vGYByuXzt2NjYeWPMJwAeTGf8rg8hIvpTKXVlHMe3AogBnNFa+1prbnQ9gIi8rbXeHsfxE0T0DhE9qZSaP526HgDACDNPW2sPicjWvr6+VcPDw3/1jAd8vJ84ceKKTCbjj1NordelT7tu98BRZt5krd0sIlNEtFcp9VLPAIjIFq31lDHmLQBPBUGwIYqiBSV3xz1gjPFlRN3MXz0ujTHf+LKbmS+rTZZdC0BEJ5VSdxYKBR0EQYGIppRSW3oGAEA1++4F8KK/ySmljvQMQDX7Wmt9ZeqP0rqXr24NoZ+Y+TpjzDoiOuvvCszM9YrFbgV4nZmfi+N4JxHtJ6JnlFJv9hLAXPY1xuQAbASwlpnrNsY67oHKlXL+RgbgAjMP5nK5/oGBgd+DIPhNKeU7F3VHxwFq80Cl/fKYMeYRAIdFZL/W+oWeAQDwMDN/7PtLADzEHcx8qmcAUtn3FxFZrbW+vNFVteMhFMexj+/7faKqxP9okiRDzrkvALzHzL5NuejoOEDasiRJJqMo+sxau19EdgZB8FAURf4auTyARgrteJZuq9SbzxhzBsBNi2XfJcvpdhjZaI5GAEmSXOOcO09EsVIqu5QtHe/M1Rpord0hIm8A2MHM/h7QcHQjQMF/P3DOXZ3NZn/teoBKJr4AYLpSPviu4HfMfPNSxvvnCzzgnNvejFKrMmEYDi/S3LWVjx37mHlXM+vUhlAzOm2RISLnu9N+slwut2pwcHCCiCZExH+5mchmsyebWWgOwBgz3+lqRqldMszsd3zByOfzt4yOjn7b7Bod/8TUrKGLyV0CaHUHW9X/D9N93V6azvezAAAAAElFTkSuQmCC",F="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABbFJREFUaEPtWV1sFFUUPufOLmjpD7G0nXtm11igD0Q0CpqImsiDEcGoIVEReeBBNGgkEQSjwUR4MQZ/MBr/MeFFFIkxYAR9MGr84cFijBJ9UFPD7r3TqtWWLsVuO3PM3ew20+3uzizTxpDsTSa7e+ec75zvnPtz7l2E87zhee4/NAj83xlsZKCRgZgRaAyhmAGMrV4zA5lM5sJEItGcz+dbhBDN5gGAZkRsQcTCd/Mwc0vpu+k3v5l5yHGcDUEPtdY7AeAsIp4t/5yYmCj0myefz//LzGfNY/p7enrGqjGtSEAp9ZgQYgsz07mGiJk3OY7zVklfKbULEZ88FzxE1L7vv+Q4ztPl+tMIZLPZFUKIb87FUFBHCLHQtu2+Up/WmuNi+r5/bSqVOh7EmUZAa70VAJ6PYwwRJ6SUyRKG67odzPxHHMyi7jYi2luTgOu6O5h5T1xjiLhDSvlsIAOfAcDKOLiI+KiU8pmwDGwGgFfjGCrqDhLRgkAWHmTml2PiPkBEr4URuAcA3o5pqKR+PxG9aX7M0DDaQEQHahJQSt2KiEdmiMA7RGQCUmha61jDiJlvcxznw7A5cAMzfz4TBHzfvzGVSn1qsDKZzErLsgyBac0skwBwwvf9HCKuBoD5VeRWSim/CMvAMkQ8MQME+ohoYZToE9HkapjNZq9AxFcQcUW5D8y83HGc72oSyGQyiy3L+qUeAsx8yMgj4p0BvZ1E9FRY9Jl5t+M4u4L2tNaPA0BBN9g8z+tJp9O/1iTQ39/f6fv+QB0ExoQQS4aGhv5qa2s7zsyXGl0hRJdt24W1P2TsbyWiF4L2lFL3IuK+ch+CmKV30zYyU/9YljVaB4EDRFSoeUrj3CwCUsrbw6JftPE9EV1ZloFhAGitkIGmdDpt6qjJVrEWcl03z8yTO2kImTuI6P2STDabfUQIsYqIbjJ91aJZhjkCANuZeSkArEbExeU2EXFcSjlnWn8l55RSg4h4UVgWELHPtu1FiDilzlFKmaxsNEa11ksA4KcwrLD3zPy34zjtkQhorU0RdkkYqJloRGRK5ClNKXUxIposFDax8kIOEfczcxsArI1goyTyOxF1RyKglPoBES+LAH4VEVVccrXWa4nogyKBXgBYXnR8DxH9XOz/EgCuj2AHmPlHx3Euj0RAa/0VAFwXAvw1EdU03tfXN7+7u3tIa73X87zD6XR6ygaZzWavEUJMKY9r2Kxor9okPsrMZkes1TYT0etRoldLxnXdF5l5SxgOIh6TUq6JlAGl1EFEvKsWqO/7C1Kp1GCY4bD3zDzHdd2TANBTS5aZ33McZ10kAlprM/k2VQNExENSypoEwxwPvndddyMz7w/R2UdE90UlYE5k5mRWsVWqCutxuJKs1tqUyetr4Owlom2RCLiuu4uZqx3A/yGi0D2iXkKnTp1amkgkTKVZERsRd0spp9RMxkbFSVzcTSePg2XOFNbjwcFBs9W35vP5Vs/z2oQQrYjY6vt+4dOs86ZI01o/AQA5Zs5ZljUyMTGRE0KMmN/JZHJkdHQ019TUNNLZ2ZmrVTP5vr89lUo9FykDWmsz1t6oN4pBeSHE+vHx8cN11lW1TE6e7oJCFTPQ39+/zvf9d+MQYOZlxc2rsBvHbUKIu23bPhgpA67rrmHmj2IY/bNYihiMWDcRJR8Q8RYp5dFIBAYGBhZ5njfl4FAvGSnlBUqph4QQ1eZSXZCWZS3u6ur6LRIBI6S1/hgAVkW0wsx8GhFPA8AIIuYA4OTw8PDDLS0txxBxXukutXiPOi8ibknsEyK6uZJO1ctds8qMjY2Zc+nVAFBwzjjJzCOJRCKXz+fPJJNJ46h5zti2fSaqU729vcmOjo5my7LmBS6MDSlzcdzseV7w8vjbuXPnHm9vbzfBmdYa/w9EjfpsyTUyMFuRjYrbyEDUSM2WXCMDsxXZqLjnfQb+A8eWU0/QfZYsAAAAAElFTkSuQmCC";function e(A=6){return Number(Math.random().toString().substr(3,A)+Date.now()).toString(36)}const a=["#409EFF","#67C23A","#E6A23C","#F56C6C","#909399"];function i(A,t){return Math.floor(Math.random()*(t-A+1))+A}function E(){return a[i(0,4)]}const m="https://wanderprints.com",g=({page:A=1,pageSize:t=20})=>{const o=`${m}/products.json?page=${A}&limit=${t}`;return fetch(o).then(r=>r.json()).then(r=>r.products).then(r=>r.map(s=>({id:e(),star:!1,price:s.variants[0].price,src:{original:Math.random()>.1?s.images[0].src:"https://www.example.com/non-existent-image.jpg"},backgroundColor:E(),name:s.title})))};export{F as e,g,n as l}; diff --git a/docs/assets/index.5c4ccb44.js b/docs/assets/index.0c05c534.js similarity index 68% rename from docs/assets/index.5c4ccb44.js rename to docs/assets/index.0c05c534.js index d53f3b5..af685a8 100644 --- a/docs/assets/index.5c4ccb44.js +++ b/docs/assets/index.0c05c534.js @@ -1 +1 @@ -import{r as _,o as c,c as g,a as y,b as i,w as l,d as u,e as P,K as b,f,g as L,h as k,i as x,j as E,k as A}from"./vendor.705dcf8c.js";const O=function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver(e=>{for(const r of e)if(r.type==="childList")for(const n of r.addedNodes)n.tagName==="LINK"&&n.rel==="modulepreload"&&t(n)}).observe(document,{childList:!0,subtree:!0});function o(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerpolicy&&(r.referrerPolicy=e.referrerpolicy),e.crossorigin==="use-credentials"?r.credentials="include":e.crossorigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function t(e){if(e.ep)return;e.ep=!0;const r=o(e);fetch(e.href,r)}};O();var w=(a,s)=>{for(const[o,t]of s)a[o]=t;return a};const B={},C={class:"page-nav"},N=f(" \u57FA\u7840API\u5C55\u793A "),$=f(" \u6570\u636E\u5206\u9875\u5C55\u793A ");function I(a,s){const o=_("router-link"),t=_("router-view");return c(),g("div",null,[y("nav",C,[i(o,{to:"/page-a"},{default:l(()=>[N]),_:1}),i(o,{to:"/page-b"},{default:l(()=>[$]),_:1})]),i(t,null,{default:l(({Component:e})=>[(c(),u(b,null,[(c(),u(P(e)))],1024))]),_:1})])}var V=w(B,[["render",I],["__scopeId","data-v-9ecc2122"]]);const j=L({setup(a){return(s,o)=>(c(),u(V))}}),R="modulepreload",p={},W="./",m=function(s,o){return!o||o.length===0?s():Promise.all(o.map(t=>{if(t=`${W}${t}`,t in p)return;p[t]=!0;const e=t.endsWith(".css"),r=e?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${t}"]${r}`))return;const n=document.createElement("link");if(n.rel=e?"stylesheet":R,e||(n.as="script",n.crossOrigin=""),n.href=t,document.head.appendChild(n),e)return new Promise((h,v)=>{n.addEventListener("load",h),n.addEventListener("error",v)})})).then(()=>s())},D=k({history:x(),routes:[{path:"/",redirect:"/page-a"},{path:"/page-a",name:"PageA",component:()=>m(()=>import("./PageA.0d2cb5ba.js"),["assets/PageA.0d2cb5ba.js","assets/PageA.52cb6fcd.css","assets/api.ddc1e152.js","assets/api.2c6172ca.css","assets/vendor.705dcf8c.js"])},{path:"/page-b",name:"PageB",component:()=>m(()=>import("./PageB.1e6a7ebb.js"),["assets/PageB.1e6a7ebb.js","assets/PageB.d0650836.css","assets/api.ddc1e152.js","assets/api.2c6172ca.css","assets/vendor.705dcf8c.js"])}]});const d=E(j);d.use(A);d.use(D);d.mount("#app");export{w as _}; +import{r as _,o as c,c as g,a as y,b as i,w as l,d as u,e as P,K as L,f,g as k,h as x,i as E,j as b,k as A}from"./vendor.f2d4fbe7.js";const O=function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver(e=>{for(const r of e)if(r.type==="childList")for(const n of r.addedNodes)n.tagName==="LINK"&&n.rel==="modulepreload"&&t(n)}).observe(document,{childList:!0,subtree:!0});function o(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerpolicy&&(r.referrerPolicy=e.referrerpolicy),e.crossorigin==="use-credentials"?r.credentials="include":e.crossorigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function t(e){if(e.ep)return;e.ep=!0;const r=o(e);fetch(e.href,r)}};O();var w=(a,s)=>{for(const[o,t]of s)a[o]=t;return a};const B={},C={class:"page-nav"},N=f(" \u57FA\u7840API\u5C55\u793A "),$=f(" \u6570\u636E\u5206\u9875\u5C55\u793A ");function I(a,s){const o=_("router-link"),t=_("router-view");return c(),g("div",null,[y("nav",C,[i(o,{to:"/page-a"},{default:l(()=>[N]),_:1}),i(o,{to:"/page-b"},{default:l(()=>[$]),_:1})]),i(t,null,{default:l(({Component:e})=>[(c(),u(L,null,[(c(),u(P(e)))],1024))]),_:1})])}var V=w(B,[["render",I],["__scopeId","data-v-9ecc2122"]]);const j=k({setup(a){return(s,o)=>(c(),u(V))}}),R="modulepreload",p={},W="./",m=function(s,o){return!o||o.length===0?s():Promise.all(o.map(t=>{if(t=`${W}${t}`,t in p)return;p[t]=!0;const e=t.endsWith(".css"),r=e?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${t}"]${r}`))return;const n=document.createElement("link");if(n.rel=e?"stylesheet":R,e||(n.as="script",n.crossOrigin=""),n.href=t,document.head.appendChild(n),e)return new Promise((h,v)=>{n.addEventListener("load",h),n.addEventListener("error",v)})})).then(()=>s())},D=x({history:E(),routes:[{path:"/",redirect:"/page-a"},{path:"/page-a",name:"PageA",component:()=>m(()=>import("./PageA.9ac28eda.js"),["assets/PageA.9ac28eda.js","assets/PageA.55ed4bb0.css","assets/api.efcc3c21.js","assets/vendor.f2d4fbe7.js"])},{path:"/page-b",name:"PageB",component:()=>m(()=>import("./PageB.20d40a19.js"),["assets/PageB.20d40a19.js","assets/PageB.682b45d6.css","assets/vendor.f2d4fbe7.js","assets/api.efcc3c21.js"])}]});const d=b(j);d.use(A);d.use(D);d.mount("#app");export{w as _}; diff --git a/docs/assets/vendor.705dcf8c.js b/docs/assets/vendor.f2d4fbe7.js similarity index 99% rename from docs/assets/vendor.705dcf8c.js rename to docs/assets/vendor.f2d4fbe7.js index 65cf6f5..ee1d298 100644 --- a/docs/assets/vendor.705dcf8c.js +++ b/docs/assets/vendor.f2d4fbe7.js @@ -54,4 +54,4 @@ var F0=Object.defineProperty,V0=Object.defineProperties;var _0=Object.getOwnProp * vue-router v4.2.5 * (c) 2023 Eduardo San Martin Morote * @license MIT - */const Ea=typeof window!="undefined";function kW(e){return e.__esModule||e[Symbol.toStringTag]==="Module"}const St=Object.assign;function Hd(e,t){const n={};for(const o in t){const l=t[o];n[o]=Qn(l)?l.map(e):e(l)}return n}const Rr=()=>{},Qn=Array.isArray,EW=/\/$/,TW=e=>e.replace(EW,"");function Kd(e,t,n="/"){let o,l={},a="",r="";const s=t.indexOf("#");let i=t.indexOf("?");return s=0&&(i=-1),i>-1&&(o=t.slice(0,i),a=t.slice(i+1,s>-1?s:t.length),l=e(a)),s>-1&&(o=o||t.slice(0,s),r=t.slice(s,t.length)),o=AW(o!=null?o:t,n),{fullPath:o+(a&&"?")+a+r,path:o,query:l,hash:r}}function MW(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function c0(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function NW(e,t,n){const o=t.matched.length-1,l=n.matched.length-1;return o>-1&&o===l&&Ta(t.matched[o],n.matched[l])&&d0(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function Ta(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function d0(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!OW(e[n],t[n]))return!1;return!0}function OW(e,t){return Qn(e)?f0(e,t):Qn(t)?f0(t,e):e===t}function f0(e,t){return Qn(t)?e.length===t.length&&e.every((n,o)=>n===t[o]):e.length===1&&e[0]===t}function AW(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),o=e.split("/"),l=o[o.length-1];(l===".."||l===".")&&o.push("");let a=n.length-1,r,s;for(r=0;r1&&a--;else break;return n.slice(0,a).join("/")+"/"+o.slice(r-(r===o.length?1:0)).join("/")}var Lr;(function(e){e.pop="pop",e.push="push"})(Lr||(Lr={}));var Br;(function(e){e.back="back",e.forward="forward",e.unknown=""})(Br||(Br={}));function PW(e){if(!e)if(Ea){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),TW(e)}const IW=/^[^#]+#/;function DW(e,t){return e.replace(IW,"#")+t}function RW(e,t){const n=document.documentElement.getBoundingClientRect(),o=e.getBoundingClientRect();return{behavior:t.behavior,left:o.left-n.left-(t.left||0),top:o.top-n.top-(t.top||0)}}const Di=()=>({left:window.pageXOffset,top:window.pageYOffset});function LW(e){let t;if("el"in e){const n=e.el,o=typeof n=="string"&&n.startsWith("#"),l=typeof n=="string"?o?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!l)return;t=RW(l,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.pageXOffset,t.top!=null?t.top:window.pageYOffset)}function p0(e,t){return(history.state?history.state.position-t:-1)+e}const jd=new Map;function BW(e,t){jd.set(e,t)}function FW(e){const t=jd.get(e);return jd.delete(e),t}let VW=()=>location.protocol+"//"+location.host;function h0(e,t){const{pathname:n,search:o,hash:l}=t,a=e.indexOf("#");if(a>-1){let s=l.includes(e.slice(a))?e.slice(a).length:1,i=l.slice(s);return i[0]!=="/"&&(i="/"+i),c0(i,"")}return c0(n,e)+o+l}function _W(e,t,n,o){let l=[],a=[],r=null;const s=({state:d})=>{const p=h0(e,location),h=n.value,m=t.value;let v=0;if(d){if(n.value=p,t.value=d,r&&r===h){r=null;return}v=m?d.position-m.position:0}else o(p);l.forEach(g=>{g(n.value,h,{delta:v,type:Lr.pop,direction:v?v>0?Br.forward:Br.back:Br.unknown})})};function i(){r=n.value}function u(d){l.push(d);const p=()=>{const h=l.indexOf(d);h>-1&&l.splice(h,1)};return a.push(p),p}function c(){const{history:d}=window;!d.state||d.replaceState(St({},d.state,{scroll:Di()}),"")}function f(){for(const d of a)d();a=[],window.removeEventListener("popstate",s),window.removeEventListener("beforeunload",c)}return window.addEventListener("popstate",s),window.addEventListener("beforeunload",c,{passive:!0}),{pauseListeners:i,listen:u,destroy:f}}function v0(e,t,n,o=!1,l=!1){return{back:e,current:t,forward:n,replaced:o,position:window.history.length,scroll:l?Di():null}}function zW(e){const{history:t,location:n}=window,o={value:h0(e,n)},l={value:t.state};l.value||a(o.value,{back:null,current:o.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function a(i,u,c){const f=e.indexOf("#"),d=f>-1?(n.host&&document.querySelector("base")?e:e.slice(f))+i:VW()+e+i;try{t[c?"replaceState":"pushState"](u,"",d),l.value=u}catch(p){console.error(p),n[c?"replace":"assign"](d)}}function r(i,u){const c=St({},t.state,v0(l.value.back,i,l.value.forward,!0),u,{position:l.value.position});a(i,c,!0),o.value=i}function s(i,u){const c=St({},l.value,t.state,{forward:i,scroll:Di()});a(c.current,c,!0);const f=St({},v0(o.value,i,null),{position:c.position+1},u);a(i,f,!1),o.value=i}return{location:o,state:l,push:s,replace:r}}function HW(e){e=PW(e);const t=zW(e),n=_W(e,t.state,t.location,t.replace);function o(a,r=!0){r||n.pauseListeners(),history.go(a)}const l=St({location:"",base:e,go:o,createHref:DW.bind(null,e)},t,n);return Object.defineProperty(l,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(l,"state",{enumerable:!0,get:()=>t.state.value}),l}function PU(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),HW(e)}function KW(e){return typeof e=="string"||e&&typeof e=="object"}function m0(e){return typeof e=="string"||typeof e=="symbol"}const qo={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},g0=Symbol("");var y0;(function(e){e[e.aborted=4]="aborted",e[e.cancelled=8]="cancelled",e[e.duplicated=16]="duplicated"})(y0||(y0={}));function Ma(e,t){return St(new Error,{type:e,[g0]:!0},t)}function Mo(e,t){return e instanceof Error&&g0 in e&&(t==null||!!(e.type&t))}const b0="[^/]+?",jW={sensitive:!1,strict:!1,start:!0,end:!0},WW=/[.+*?^${}()[\]/\\]/g;function UW(e,t){const n=St({},jW,t),o=[];let l=n.start?"^":"";const a=[];for(const u of e){const c=u.length?[]:[90];n.strict&&!u.length&&(l+="/");for(let f=0;ft.length?t.length===1&&t[0]===40+40?1:-1:0}function qW(e,t){let n=0;const o=e.score,l=t.score;for(;n0&&t[t.length-1]<0}const GW={type:0,value:""},XW=/[a-zA-Z0-9_]/;function ZW(e){if(!e)return[[]];if(e==="/")return[[GW]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(p){throw new Error(`ERR (${n})/"${u}": ${p}`)}let n=0,o=n;const l=[];let a;function r(){a&&l.push(a),a=[]}let s=0,i,u="",c="";function f(){!u||(n===0?a.push({type:0,value:u}):n===1||n===2||n===3?(a.length>1&&(i==="*"||i==="+")&&t(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),a.push({type:1,value:u,regexp:c,repeatable:i==="*"||i==="+",optional:i==="*"||i==="?"})):t("Invalid state to consume buffer"),u="")}function d(){u+=i}for(;s{r(y)}:Rr}function r(c){if(m0(c)){const f=o.get(c);f&&(o.delete(c),n.splice(n.indexOf(f),1),f.children.forEach(r),f.alias.forEach(r))}else{const f=n.indexOf(c);f>-1&&(n.splice(f,1),c.record.name&&o.delete(c.record.name),c.children.forEach(r),c.alias.forEach(r))}}function s(){return n}function i(c){let f=0;for(;f=0&&(c.record.path!==n[f].record.path||!k0(c,n[f]));)f++;n.splice(f,0,c),c.record.name&&!$0(c)&&o.set(c.record.name,c)}function u(c,f){let d,p={},h,m;if("name"in c&&c.name){if(d=o.get(c.name),!d)throw Ma(1,{location:c});m=d.record.name,p=St(C0(f.params,d.keys.filter(y=>!y.optional).map(y=>y.name)),c.params&&C0(c.params,d.keys.map(y=>y.name))),h=d.stringify(p)}else if("path"in c)h=c.path,d=n.find(y=>y.re.test(h)),d&&(p=d.parse(h),m=d.record.name);else{if(d=f.name?o.get(f.name):n.find(y=>y.re.test(f.path)),!d)throw Ma(1,{location:c,currentLocation:f});m=d.record.name,p=St({},f.params,c.params),h=d.stringify(p)}const v=[];let g=d;for(;g;)v.unshift(g.record),g=g.parent;return{name:m,path:h,params:p,matched:v,meta:tU(v)}}return e.forEach(c=>a(c)),{addRoute:a,resolve:u,removeRoute:r,getRoutes:s,getRecordMatcher:l}}function C0(e,t){const n={};for(const o of t)o in e&&(n[o]=e[o]);return n}function xW(e){return{path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:void 0,beforeEnter:e.beforeEnter,props:eU(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||null:e.component&&{default:e.component}}}function eU(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const o in e.components)t[o]=typeof n=="object"?n[o]:n;return t}function $0(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function tU(e){return e.reduce((t,n)=>St(t,n.meta),{})}function S0(e,t){const n={};for(const o in e)n[o]=o in t?t[o]:e[o];return n}function k0(e,t){return t.children.some(n=>n===e||k0(e,n))}const E0=/#/g,nU=/&/g,oU=/\//g,lU=/=/g,aU=/\?/g,T0=/\+/g,rU=/%5B/g,sU=/%5D/g,M0=/%5E/g,iU=/%60/g,N0=/%7B/g,uU=/%7C/g,O0=/%7D/g,cU=/%20/g;function Wd(e){return encodeURI(""+e).replace(uU,"|").replace(rU,"[").replace(sU,"]")}function dU(e){return Wd(e).replace(N0,"{").replace(O0,"}").replace(M0,"^")}function Ud(e){return Wd(e).replace(T0,"%2B").replace(cU,"+").replace(E0,"%23").replace(nU,"%26").replace(iU,"`").replace(N0,"{").replace(O0,"}").replace(M0,"^")}function fU(e){return Ud(e).replace(lU,"%3D")}function pU(e){return Wd(e).replace(E0,"%23").replace(aU,"%3F")}function hU(e){return e==null?"":pU(e).replace(oU,"%2F")}function Ri(e){try{return decodeURIComponent(""+e)}catch{}return""+e}function vU(e){const t={};if(e===""||e==="?")return t;const o=(e[0]==="?"?e.slice(1):e).split("&");for(let l=0;la&&Ud(a)):[o&&Ud(o)]).forEach(a=>{a!==void 0&&(t+=(t.length?"&":"")+n,a!=null&&(t+="="+a))})}return t}function mU(e){const t={};for(const n in e){const o=e[n];o!==void 0&&(t[n]=Qn(o)?o.map(l=>l==null?null:""+l):o==null?o:""+o)}return t}const gU=Symbol(""),P0=Symbol(""),Yd=Symbol(""),I0=Symbol(""),qd=Symbol("");function Fr(){let e=[];function t(o){return e.push(o),()=>{const l=e.indexOf(o);l>-1&&e.splice(l,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function Go(e,t,n,o,l){const a=o&&(o.enterCallbacks[l]=o.enterCallbacks[l]||[]);return()=>new Promise((r,s)=>{const i=f=>{f===!1?s(Ma(4,{from:n,to:t})):f instanceof Error?s(f):KW(f)?s(Ma(2,{from:t,to:f})):(a&&o.enterCallbacks[l]===a&&typeof f=="function"&&a.push(f),r())},u=e.call(o&&o.instances[l],t,n,i);let c=Promise.resolve(u);e.length<3&&(c=c.then(i)),c.catch(f=>s(f))})}function Gd(e,t,n,o){const l=[];for(const a of e)for(const r in a.components){let s=a.components[r];if(!(t!=="beforeRouteEnter"&&!a.instances[r]))if(yU(s)){const u=(s.__vccOpts||s)[t];u&&l.push(Go(u,n,o,a,r))}else{let i=s();l.push(()=>i.then(u=>{if(!u)return Promise.reject(new Error(`Couldn't resolve component "${r}" at "${a.path}"`));const c=kW(u)?u.default:u;a.components[r]=c;const d=(c.__vccOpts||c)[t];return d&&Go(d,n,o,a,r)()}))}}return l}function yU(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function D0(e){const t=Ae(Yd),n=Ae(I0),o=S(()=>t.resolve(E(e.to))),l=S(()=>{const{matched:i}=o.value,{length:u}=i,c=i[u-1],f=n.matched;if(!c||!f.length)return-1;const d=f.findIndex(Ta.bind(null,c));if(d>-1)return d;const p=R0(i[u-2]);return u>1&&R0(c)===p&&f[f.length-1].path!==p?f.findIndex(Ta.bind(null,i[u-2])):d}),a=S(()=>l.value>-1&&$U(n.params,o.value.params)),r=S(()=>l.value>-1&&l.value===n.matched.length-1&&d0(n.params,o.value.params));function s(i={}){return CU(i)?t[E(e.replace)?"replace":"push"](E(e.to)).catch(Rr):Promise.resolve()}return{route:o,href:S(()=>o.value.href),isActive:a,isExactActive:r,navigate:s}}const bU=ee({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:D0,setup(e,{slots:t}){const n=$t(D0(e)),{options:o}=Ae(Yd),l=S(()=>({[L0(e.activeClass,o.linkActiveClass,"router-link-active")]:n.isActive,[L0(e.exactActiveClass,o.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const a=t.default&&t.default(n);return e.custom?a:ke("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:l.value},a)}}}),wU=bU;function CU(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function $U(e,t){for(const n in t){const o=t[n],l=e[n];if(typeof o=="string"){if(o!==l)return!1}else if(!Qn(l)||l.length!==o.length||o.some((a,r)=>a!==l[r]))return!1}return!0}function R0(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const L0=(e,t,n)=>e!=null?e:t!=null?t:n,SU=ee({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const o=Ae(qd),l=S(()=>e.route||o.value),a=Ae(P0,0),r=S(()=>{let u=E(a);const{matched:c}=l.value;let f;for(;(f=c[u])&&!f.components;)u++;return u}),s=S(()=>l.value.matched[r.value]);nt(P0,S(()=>r.value+1)),nt(gU,s),nt(qd,l);const i=N();return ve(()=>[i.value,s.value,e.name],([u,c,f],[d,p,h])=>{c&&(c.instances[f]=u,p&&p!==c&&u&&u===d&&(c.leaveGuards.size||(c.leaveGuards=p.leaveGuards),c.updateGuards.size||(c.updateGuards=p.updateGuards))),u&&c&&(!p||!Ta(c,p)||!d)&&(c.enterCallbacks[f]||[]).forEach(m=>m(u))},{flush:"post"}),()=>{const u=l.value,c=e.name,f=s.value,d=f&&f.components[c];if(!d)return B0(n.default,{Component:d,route:u});const p=f.props[c],h=p?p===!0?u.params:typeof p=="function"?p(u):p:null,v=ke(d,St({},h,t,{onVnodeUnmounted:g=>{g.component.isUnmounted&&(f.instances[c]=null)},ref:i}));return B0(n.default,{Component:v,route:u})||v}}});function B0(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const kU=SU;function IU(e){const t=QW(e.routes,e),n=e.parseQuery||vU,o=e.stringifyQuery||A0,l=e.history,a=Fr(),r=Fr(),s=Fr(),i=Ht(qo);let u=qo;Ea&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=Hd.bind(null,W=>""+W),f=Hd.bind(null,hU),d=Hd.bind(null,Ri);function p(W,le){let pe,$e;return m0(W)?(pe=t.getRecordMatcher(W),$e=le):$e=W,t.addRoute($e,pe)}function h(W){const le=t.getRecordMatcher(W);le&&t.removeRoute(le)}function m(){return t.getRoutes().map(W=>W.record)}function v(W){return!!t.getRecordMatcher(W)}function g(W,le){if(le=St({},le||i.value),typeof W=="string"){const Y=Kd(n,W,le.path),re=t.resolve({path:Y.path},le),be=l.createHref(Y.fullPath);return St(Y,re,{params:d(re.params),hash:Ri(Y.hash),redirectedFrom:void 0,href:be})}let pe;if("path"in W)pe=St({},W,{path:Kd(n,W.path,le.path).path});else{const Y=St({},W.params);for(const re in Y)Y[re]==null&&delete Y[re];pe=St({},W,{params:f(Y)}),le.params=f(le.params)}const $e=t.resolve(pe,le),Le=W.hash||"";$e.params=c(d($e.params));const Be=MW(o,St({},W,{hash:dU(Le),path:$e.path})),K=l.createHref(Be);return St({fullPath:Be,hash:Le,query:o===A0?mU(W.query):W.query||{}},$e,{redirectedFrom:void 0,href:K})}function y(W){return typeof W=="string"?Kd(n,W,i.value.path):St({},W)}function C(W,le){if(u!==W)return Ma(8,{from:le,to:W})}function $(W){return M(W)}function b(W){return $(St(y(W),{replace:!0}))}function k(W){const le=W.matched[W.matched.length-1];if(le&&le.redirect){const{redirect:pe}=le;let $e=typeof pe=="function"?pe(W):pe;return typeof $e=="string"&&($e=$e.includes("?")||$e.includes("#")?$e=y($e):{path:$e},$e.params={}),St({query:W.query,hash:W.hash,params:"path"in $e?{}:W.params},$e)}}function M(W,le){const pe=u=g(W),$e=i.value,Le=W.state,Be=W.force,K=W.replace===!0,Y=k(pe);if(Y)return M(St(y(Y),{state:typeof Y=="object"?St({},Le,Y.state):Le,force:Be,replace:K}),le||pe);const re=pe;re.redirectedFrom=le;let be;return!Be&&NW(o,$e,pe)&&(be=Ma(16,{to:re,from:$e}),he($e,$e,!0,!1)),(be?Promise.resolve(be):P(re,$e)).catch(fe=>Mo(fe)?Mo(fe,2)?fe:U(fe):B(fe,re,$e)).then(fe=>{if(fe){if(Mo(fe,2))return M(St({replace:K},y(fe.to),{state:typeof fe.to=="object"?St({},Le,fe.to.state):Le,force:Be}),le||re)}else fe=I(re,$e,!0,K,Le);return F(re,$e,fe),fe})}function D(W,le){const pe=C(W,le);return pe?Promise.reject(pe):Promise.resolve()}function V(W){const le=se.values().next().value;return le&&typeof le.runWithContext=="function"?le.runWithContext(W):W()}function P(W,le){let pe;const[$e,Le,Be]=EU(W,le);pe=Gd($e.reverse(),"beforeRouteLeave",W,le);for(const Y of $e)Y.leaveGuards.forEach(re=>{pe.push(Go(re,W,le))});const K=D.bind(null,W,le);return pe.push(K),ie(pe).then(()=>{pe=[];for(const Y of a.list())pe.push(Go(Y,W,le));return pe.push(K),ie(pe)}).then(()=>{pe=Gd(Le,"beforeRouteUpdate",W,le);for(const Y of Le)Y.updateGuards.forEach(re=>{pe.push(Go(re,W,le))});return pe.push(K),ie(pe)}).then(()=>{pe=[];for(const Y of Be)if(Y.beforeEnter)if(Qn(Y.beforeEnter))for(const re of Y.beforeEnter)pe.push(Go(re,W,le));else pe.push(Go(Y.beforeEnter,W,le));return pe.push(K),ie(pe)}).then(()=>(W.matched.forEach(Y=>Y.enterCallbacks={}),pe=Gd(Be,"beforeRouteEnter",W,le),pe.push(K),ie(pe))).then(()=>{pe=[];for(const Y of r.list())pe.push(Go(Y,W,le));return pe.push(K),ie(pe)}).catch(Y=>Mo(Y,8)?Y:Promise.reject(Y))}function F(W,le,pe){s.list().forEach($e=>V(()=>$e(W,le,pe)))}function I(W,le,pe,$e,Le){const Be=C(W,le);if(Be)return Be;const K=le===qo,Y=Ea?history.state:{};pe&&($e||K?l.replace(W.fullPath,St({scroll:K&&Y&&Y.scroll},Le)):l.push(W.fullPath,Le)),i.value=W,he(W,le,pe,K),U()}let R;function j(){R||(R=l.listen((W,le,pe)=>{if(!ge.listening)return;const $e=g(W),Le=k($e);if(Le){M(St(Le,{replace:!0}),$e).catch(Rr);return}u=$e;const Be=i.value;Ea&&BW(p0(Be.fullPath,pe.delta),Di()),P($e,Be).catch(K=>Mo(K,4|8)?K:Mo(K,2)?(M(K.to,$e).then(Y=>{Mo(Y,4|16)&&!pe.delta&&pe.type===Lr.pop&&l.go(-1,!1)}).catch(Rr),Promise.reject()):(pe.delta&&l.go(-pe.delta,!1),B(K,$e,Be))).then(K=>{K=K||I($e,Be,!1),K&&(pe.delta&&!Mo(K,8)?l.go(-pe.delta,!1):pe.type===Lr.pop&&Mo(K,4|16)&&l.go(-1,!1)),F($e,Be,K)}).catch(Rr)}))}let _=Fr(),H=Fr(),O;function B(W,le,pe){U(W);const $e=H.list();return $e.length?$e.forEach(Le=>Le(W,le,pe)):console.error(W),Promise.reject(W)}function G(){return O&&i.value!==qo?Promise.resolve():new Promise((W,le)=>{_.add([W,le])})}function U(W){return O||(O=!W,j(),_.list().forEach(([le,pe])=>W?pe(W):le()),_.reset()),W}function he(W,le,pe,$e){const{scrollBehavior:Le}=e;if(!Ea||!Le)return Promise.resolve();const Be=!pe&&FW(p0(W.fullPath,0))||($e||!pe)&&history.state&&history.state.scroll||null;return _e().then(()=>Le(W,le,Be)).then(K=>K&&LW(K)).catch(K=>B(K,W,le))}const de=W=>l.go(W);let we;const se=new Set,ge={currentRoute:i,listening:!0,addRoute:p,removeRoute:h,hasRoute:v,getRoutes:m,resolve:g,options:e,push:$,replace:b,go:de,back:()=>de(-1),forward:()=>de(1),beforeEach:a.add,beforeResolve:r.add,afterEach:s.add,onError:H.add,isReady:G,install(W){const le=this;W.component("RouterLink",wU),W.component("RouterView",kU),W.config.globalProperties.$router=le,Object.defineProperty(W.config.globalProperties,"$route",{enumerable:!0,get:()=>E(i)}),Ea&&!we&&i.value===qo&&(we=!0,$(l.location).catch(Le=>{}));const pe={};for(const Le in qo)Object.defineProperty(pe,Le,{get:()=>i.value[Le],enumerable:!0});W.provide(Yd,le),W.provide(I0,Tf(pe)),W.provide(qd,i);const $e=W.unmount;se.add(W),W.unmount=function(){se.delete(W),se.size<1&&(u=qo,R&&R(),R=null,i.value=qo,we=!1,O=!1),$e()}}};function ie(W){return W.reduce((le,pe)=>le.then(()=>V(pe)),Promise.resolve())}return ge}function EU(e,t){const n=[],o=[],l=[],a=Math.max(t.matched.length,e.matched.length);for(let r=0;rTa(u,s))?o.push(s):n.push(s));const i=e.matched[r];i&&(t.matched.find(u=>Ta(u,i))||l.push(i))}return[n,o,l]}export{Z as A,ar as B,nt as C,OU as D,ve as E,Re as F,NU as G,ce as H,De as I,Ae as J,MU as K,zl as L,T as M,L as a,X as b,A as c,Q as d,ct as e,st as f,ee as g,IU as h,PU as i,mC as j,AU as k,N as l,Ze as m,gn as n,w as o,Ue as p,Ke as q,ne as r,S as s,me as t,E as u,dt as v,q as w,Bt as x,$t as y,at as z}; + */const Ea=typeof window!="undefined";function kW(e){return e.__esModule||e[Symbol.toStringTag]==="Module"}const St=Object.assign;function Hd(e,t){const n={};for(const o in t){const l=t[o];n[o]=Qn(l)?l.map(e):e(l)}return n}const Rr=()=>{},Qn=Array.isArray,EW=/\/$/,TW=e=>e.replace(EW,"");function Kd(e,t,n="/"){let o,l={},a="",r="";const s=t.indexOf("#");let i=t.indexOf("?");return s=0&&(i=-1),i>-1&&(o=t.slice(0,i),a=t.slice(i+1,s>-1?s:t.length),l=e(a)),s>-1&&(o=o||t.slice(0,s),r=t.slice(s,t.length)),o=AW(o!=null?o:t,n),{fullPath:o+(a&&"?")+a+r,path:o,query:l,hash:r}}function MW(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function c0(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function NW(e,t,n){const o=t.matched.length-1,l=n.matched.length-1;return o>-1&&o===l&&Ta(t.matched[o],n.matched[l])&&d0(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function Ta(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function d0(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!OW(e[n],t[n]))return!1;return!0}function OW(e,t){return Qn(e)?f0(e,t):Qn(t)?f0(t,e):e===t}function f0(e,t){return Qn(t)?e.length===t.length&&e.every((n,o)=>n===t[o]):e.length===1&&e[0]===t}function AW(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),o=e.split("/"),l=o[o.length-1];(l===".."||l===".")&&o.push("");let a=n.length-1,r,s;for(r=0;r1&&a--;else break;return n.slice(0,a).join("/")+"/"+o.slice(r-(r===o.length?1:0)).join("/")}var Lr;(function(e){e.pop="pop",e.push="push"})(Lr||(Lr={}));var Br;(function(e){e.back="back",e.forward="forward",e.unknown=""})(Br||(Br={}));function PW(e){if(!e)if(Ea){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),TW(e)}const IW=/^[^#]+#/;function DW(e,t){return e.replace(IW,"#")+t}function RW(e,t){const n=document.documentElement.getBoundingClientRect(),o=e.getBoundingClientRect();return{behavior:t.behavior,left:o.left-n.left-(t.left||0),top:o.top-n.top-(t.top||0)}}const Di=()=>({left:window.pageXOffset,top:window.pageYOffset});function LW(e){let t;if("el"in e){const n=e.el,o=typeof n=="string"&&n.startsWith("#"),l=typeof n=="string"?o?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!l)return;t=RW(l,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.pageXOffset,t.top!=null?t.top:window.pageYOffset)}function p0(e,t){return(history.state?history.state.position-t:-1)+e}const jd=new Map;function BW(e,t){jd.set(e,t)}function FW(e){const t=jd.get(e);return jd.delete(e),t}let VW=()=>location.protocol+"//"+location.host;function h0(e,t){const{pathname:n,search:o,hash:l}=t,a=e.indexOf("#");if(a>-1){let s=l.includes(e.slice(a))?e.slice(a).length:1,i=l.slice(s);return i[0]!=="/"&&(i="/"+i),c0(i,"")}return c0(n,e)+o+l}function _W(e,t,n,o){let l=[],a=[],r=null;const s=({state:d})=>{const p=h0(e,location),h=n.value,m=t.value;let v=0;if(d){if(n.value=p,t.value=d,r&&r===h){r=null;return}v=m?d.position-m.position:0}else o(p);l.forEach(g=>{g(n.value,h,{delta:v,type:Lr.pop,direction:v?v>0?Br.forward:Br.back:Br.unknown})})};function i(){r=n.value}function u(d){l.push(d);const p=()=>{const h=l.indexOf(d);h>-1&&l.splice(h,1)};return a.push(p),p}function c(){const{history:d}=window;!d.state||d.replaceState(St({},d.state,{scroll:Di()}),"")}function f(){for(const d of a)d();a=[],window.removeEventListener("popstate",s),window.removeEventListener("beforeunload",c)}return window.addEventListener("popstate",s),window.addEventListener("beforeunload",c,{passive:!0}),{pauseListeners:i,listen:u,destroy:f}}function v0(e,t,n,o=!1,l=!1){return{back:e,current:t,forward:n,replaced:o,position:window.history.length,scroll:l?Di():null}}function zW(e){const{history:t,location:n}=window,o={value:h0(e,n)},l={value:t.state};l.value||a(o.value,{back:null,current:o.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function a(i,u,c){const f=e.indexOf("#"),d=f>-1?(n.host&&document.querySelector("base")?e:e.slice(f))+i:VW()+e+i;try{t[c?"replaceState":"pushState"](u,"",d),l.value=u}catch(p){console.error(p),n[c?"replace":"assign"](d)}}function r(i,u){const c=St({},t.state,v0(l.value.back,i,l.value.forward,!0),u,{position:l.value.position});a(i,c,!0),o.value=i}function s(i,u){const c=St({},l.value,t.state,{forward:i,scroll:Di()});a(c.current,c,!0);const f=St({},v0(o.value,i,null),{position:c.position+1},u);a(i,f,!1),o.value=i}return{location:o,state:l,push:s,replace:r}}function HW(e){e=PW(e);const t=zW(e),n=_W(e,t.state,t.location,t.replace);function o(a,r=!0){r||n.pauseListeners(),history.go(a)}const l=St({location:"",base:e,go:o,createHref:DW.bind(null,e)},t,n);return Object.defineProperty(l,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(l,"state",{enumerable:!0,get:()=>t.state.value}),l}function PU(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),HW(e)}function KW(e){return typeof e=="string"||e&&typeof e=="object"}function m0(e){return typeof e=="string"||typeof e=="symbol"}const qo={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},g0=Symbol("");var y0;(function(e){e[e.aborted=4]="aborted",e[e.cancelled=8]="cancelled",e[e.duplicated=16]="duplicated"})(y0||(y0={}));function Ma(e,t){return St(new Error,{type:e,[g0]:!0},t)}function Mo(e,t){return e instanceof Error&&g0 in e&&(t==null||!!(e.type&t))}const b0="[^/]+?",jW={sensitive:!1,strict:!1,start:!0,end:!0},WW=/[.+*?^${}()[\]/\\]/g;function UW(e,t){const n=St({},jW,t),o=[];let l=n.start?"^":"";const a=[];for(const u of e){const c=u.length?[]:[90];n.strict&&!u.length&&(l+="/");for(let f=0;ft.length?t.length===1&&t[0]===40+40?1:-1:0}function qW(e,t){let n=0;const o=e.score,l=t.score;for(;n0&&t[t.length-1]<0}const GW={type:0,value:""},XW=/[a-zA-Z0-9_]/;function ZW(e){if(!e)return[[]];if(e==="/")return[[GW]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(p){throw new Error(`ERR (${n})/"${u}": ${p}`)}let n=0,o=n;const l=[];let a;function r(){a&&l.push(a),a=[]}let s=0,i,u="",c="";function f(){!u||(n===0?a.push({type:0,value:u}):n===1||n===2||n===3?(a.length>1&&(i==="*"||i==="+")&&t(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),a.push({type:1,value:u,regexp:c,repeatable:i==="*"||i==="+",optional:i==="*"||i==="?"})):t("Invalid state to consume buffer"),u="")}function d(){u+=i}for(;s{r(y)}:Rr}function r(c){if(m0(c)){const f=o.get(c);f&&(o.delete(c),n.splice(n.indexOf(f),1),f.children.forEach(r),f.alias.forEach(r))}else{const f=n.indexOf(c);f>-1&&(n.splice(f,1),c.record.name&&o.delete(c.record.name),c.children.forEach(r),c.alias.forEach(r))}}function s(){return n}function i(c){let f=0;for(;f=0&&(c.record.path!==n[f].record.path||!k0(c,n[f]));)f++;n.splice(f,0,c),c.record.name&&!$0(c)&&o.set(c.record.name,c)}function u(c,f){let d,p={},h,m;if("name"in c&&c.name){if(d=o.get(c.name),!d)throw Ma(1,{location:c});m=d.record.name,p=St(C0(f.params,d.keys.filter(y=>!y.optional).map(y=>y.name)),c.params&&C0(c.params,d.keys.map(y=>y.name))),h=d.stringify(p)}else if("path"in c)h=c.path,d=n.find(y=>y.re.test(h)),d&&(p=d.parse(h),m=d.record.name);else{if(d=f.name?o.get(f.name):n.find(y=>y.re.test(f.path)),!d)throw Ma(1,{location:c,currentLocation:f});m=d.record.name,p=St({},f.params,c.params),h=d.stringify(p)}const v=[];let g=d;for(;g;)v.unshift(g.record),g=g.parent;return{name:m,path:h,params:p,matched:v,meta:tU(v)}}return e.forEach(c=>a(c)),{addRoute:a,resolve:u,removeRoute:r,getRoutes:s,getRecordMatcher:l}}function C0(e,t){const n={};for(const o of t)o in e&&(n[o]=e[o]);return n}function xW(e){return{path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:void 0,beforeEnter:e.beforeEnter,props:eU(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||null:e.component&&{default:e.component}}}function eU(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const o in e.components)t[o]=typeof n=="object"?n[o]:n;return t}function $0(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function tU(e){return e.reduce((t,n)=>St(t,n.meta),{})}function S0(e,t){const n={};for(const o in e)n[o]=o in t?t[o]:e[o];return n}function k0(e,t){return t.children.some(n=>n===e||k0(e,n))}const E0=/#/g,nU=/&/g,oU=/\//g,lU=/=/g,aU=/\?/g,T0=/\+/g,rU=/%5B/g,sU=/%5D/g,M0=/%5E/g,iU=/%60/g,N0=/%7B/g,uU=/%7C/g,O0=/%7D/g,cU=/%20/g;function Wd(e){return encodeURI(""+e).replace(uU,"|").replace(rU,"[").replace(sU,"]")}function dU(e){return Wd(e).replace(N0,"{").replace(O0,"}").replace(M0,"^")}function Ud(e){return Wd(e).replace(T0,"%2B").replace(cU,"+").replace(E0,"%23").replace(nU,"%26").replace(iU,"`").replace(N0,"{").replace(O0,"}").replace(M0,"^")}function fU(e){return Ud(e).replace(lU,"%3D")}function pU(e){return Wd(e).replace(E0,"%23").replace(aU,"%3F")}function hU(e){return e==null?"":pU(e).replace(oU,"%2F")}function Ri(e){try{return decodeURIComponent(""+e)}catch{}return""+e}function vU(e){const t={};if(e===""||e==="?")return t;const o=(e[0]==="?"?e.slice(1):e).split("&");for(let l=0;la&&Ud(a)):[o&&Ud(o)]).forEach(a=>{a!==void 0&&(t+=(t.length?"&":"")+n,a!=null&&(t+="="+a))})}return t}function mU(e){const t={};for(const n in e){const o=e[n];o!==void 0&&(t[n]=Qn(o)?o.map(l=>l==null?null:""+l):o==null?o:""+o)}return t}const gU=Symbol(""),P0=Symbol(""),Yd=Symbol(""),I0=Symbol(""),qd=Symbol("");function Fr(){let e=[];function t(o){return e.push(o),()=>{const l=e.indexOf(o);l>-1&&e.splice(l,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function Go(e,t,n,o,l){const a=o&&(o.enterCallbacks[l]=o.enterCallbacks[l]||[]);return()=>new Promise((r,s)=>{const i=f=>{f===!1?s(Ma(4,{from:n,to:t})):f instanceof Error?s(f):KW(f)?s(Ma(2,{from:t,to:f})):(a&&o.enterCallbacks[l]===a&&typeof f=="function"&&a.push(f),r())},u=e.call(o&&o.instances[l],t,n,i);let c=Promise.resolve(u);e.length<3&&(c=c.then(i)),c.catch(f=>s(f))})}function Gd(e,t,n,o){const l=[];for(const a of e)for(const r in a.components){let s=a.components[r];if(!(t!=="beforeRouteEnter"&&!a.instances[r]))if(yU(s)){const u=(s.__vccOpts||s)[t];u&&l.push(Go(u,n,o,a,r))}else{let i=s();l.push(()=>i.then(u=>{if(!u)return Promise.reject(new Error(`Couldn't resolve component "${r}" at "${a.path}"`));const c=kW(u)?u.default:u;a.components[r]=c;const d=(c.__vccOpts||c)[t];return d&&Go(d,n,o,a,r)()}))}}return l}function yU(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function D0(e){const t=Ae(Yd),n=Ae(I0),o=S(()=>t.resolve(E(e.to))),l=S(()=>{const{matched:i}=o.value,{length:u}=i,c=i[u-1],f=n.matched;if(!c||!f.length)return-1;const d=f.findIndex(Ta.bind(null,c));if(d>-1)return d;const p=R0(i[u-2]);return u>1&&R0(c)===p&&f[f.length-1].path!==p?f.findIndex(Ta.bind(null,i[u-2])):d}),a=S(()=>l.value>-1&&$U(n.params,o.value.params)),r=S(()=>l.value>-1&&l.value===n.matched.length-1&&d0(n.params,o.value.params));function s(i={}){return CU(i)?t[E(e.replace)?"replace":"push"](E(e.to)).catch(Rr):Promise.resolve()}return{route:o,href:S(()=>o.value.href),isActive:a,isExactActive:r,navigate:s}}const bU=ee({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:D0,setup(e,{slots:t}){const n=$t(D0(e)),{options:o}=Ae(Yd),l=S(()=>({[L0(e.activeClass,o.linkActiveClass,"router-link-active")]:n.isActive,[L0(e.exactActiveClass,o.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const a=t.default&&t.default(n);return e.custom?a:ke("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:l.value},a)}}}),wU=bU;function CU(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function $U(e,t){for(const n in t){const o=t[n],l=e[n];if(typeof o=="string"){if(o!==l)return!1}else if(!Qn(l)||l.length!==o.length||o.some((a,r)=>a!==l[r]))return!1}return!0}function R0(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const L0=(e,t,n)=>e!=null?e:t!=null?t:n,SU=ee({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const o=Ae(qd),l=S(()=>e.route||o.value),a=Ae(P0,0),r=S(()=>{let u=E(a);const{matched:c}=l.value;let f;for(;(f=c[u])&&!f.components;)u++;return u}),s=S(()=>l.value.matched[r.value]);nt(P0,S(()=>r.value+1)),nt(gU,s),nt(qd,l);const i=N();return ve(()=>[i.value,s.value,e.name],([u,c,f],[d,p,h])=>{c&&(c.instances[f]=u,p&&p!==c&&u&&u===d&&(c.leaveGuards.size||(c.leaveGuards=p.leaveGuards),c.updateGuards.size||(c.updateGuards=p.updateGuards))),u&&c&&(!p||!Ta(c,p)||!d)&&(c.enterCallbacks[f]||[]).forEach(m=>m(u))},{flush:"post"}),()=>{const u=l.value,c=e.name,f=s.value,d=f&&f.components[c];if(!d)return B0(n.default,{Component:d,route:u});const p=f.props[c],h=p?p===!0?u.params:typeof p=="function"?p(u):p:null,v=ke(d,St({},h,t,{onVnodeUnmounted:g=>{g.component.isUnmounted&&(f.instances[c]=null)},ref:i}));return B0(n.default,{Component:v,route:u})||v}}});function B0(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const kU=SU;function IU(e){const t=QW(e.routes,e),n=e.parseQuery||vU,o=e.stringifyQuery||A0,l=e.history,a=Fr(),r=Fr(),s=Fr(),i=Ht(qo);let u=qo;Ea&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=Hd.bind(null,W=>""+W),f=Hd.bind(null,hU),d=Hd.bind(null,Ri);function p(W,le){let pe,$e;return m0(W)?(pe=t.getRecordMatcher(W),$e=le):$e=W,t.addRoute($e,pe)}function h(W){const le=t.getRecordMatcher(W);le&&t.removeRoute(le)}function m(){return t.getRoutes().map(W=>W.record)}function v(W){return!!t.getRecordMatcher(W)}function g(W,le){if(le=St({},le||i.value),typeof W=="string"){const Y=Kd(n,W,le.path),re=t.resolve({path:Y.path},le),be=l.createHref(Y.fullPath);return St(Y,re,{params:d(re.params),hash:Ri(Y.hash),redirectedFrom:void 0,href:be})}let pe;if("path"in W)pe=St({},W,{path:Kd(n,W.path,le.path).path});else{const Y=St({},W.params);for(const re in Y)Y[re]==null&&delete Y[re];pe=St({},W,{params:f(Y)}),le.params=f(le.params)}const $e=t.resolve(pe,le),Le=W.hash||"";$e.params=c(d($e.params));const Be=MW(o,St({},W,{hash:dU(Le),path:$e.path})),K=l.createHref(Be);return St({fullPath:Be,hash:Le,query:o===A0?mU(W.query):W.query||{}},$e,{redirectedFrom:void 0,href:K})}function y(W){return typeof W=="string"?Kd(n,W,i.value.path):St({},W)}function C(W,le){if(u!==W)return Ma(8,{from:le,to:W})}function $(W){return M(W)}function b(W){return $(St(y(W),{replace:!0}))}function k(W){const le=W.matched[W.matched.length-1];if(le&&le.redirect){const{redirect:pe}=le;let $e=typeof pe=="function"?pe(W):pe;return typeof $e=="string"&&($e=$e.includes("?")||$e.includes("#")?$e=y($e):{path:$e},$e.params={}),St({query:W.query,hash:W.hash,params:"path"in $e?{}:W.params},$e)}}function M(W,le){const pe=u=g(W),$e=i.value,Le=W.state,Be=W.force,K=W.replace===!0,Y=k(pe);if(Y)return M(St(y(Y),{state:typeof Y=="object"?St({},Le,Y.state):Le,force:Be,replace:K}),le||pe);const re=pe;re.redirectedFrom=le;let be;return!Be&&NW(o,$e,pe)&&(be=Ma(16,{to:re,from:$e}),he($e,$e,!0,!1)),(be?Promise.resolve(be):P(re,$e)).catch(fe=>Mo(fe)?Mo(fe,2)?fe:U(fe):B(fe,re,$e)).then(fe=>{if(fe){if(Mo(fe,2))return M(St({replace:K},y(fe.to),{state:typeof fe.to=="object"?St({},Le,fe.to.state):Le,force:Be}),le||re)}else fe=I(re,$e,!0,K,Le);return F(re,$e,fe),fe})}function D(W,le){const pe=C(W,le);return pe?Promise.reject(pe):Promise.resolve()}function V(W){const le=se.values().next().value;return le&&typeof le.runWithContext=="function"?le.runWithContext(W):W()}function P(W,le){let pe;const[$e,Le,Be]=EU(W,le);pe=Gd($e.reverse(),"beforeRouteLeave",W,le);for(const Y of $e)Y.leaveGuards.forEach(re=>{pe.push(Go(re,W,le))});const K=D.bind(null,W,le);return pe.push(K),ie(pe).then(()=>{pe=[];for(const Y of a.list())pe.push(Go(Y,W,le));return pe.push(K),ie(pe)}).then(()=>{pe=Gd(Le,"beforeRouteUpdate",W,le);for(const Y of Le)Y.updateGuards.forEach(re=>{pe.push(Go(re,W,le))});return pe.push(K),ie(pe)}).then(()=>{pe=[];for(const Y of Be)if(Y.beforeEnter)if(Qn(Y.beforeEnter))for(const re of Y.beforeEnter)pe.push(Go(re,W,le));else pe.push(Go(Y.beforeEnter,W,le));return pe.push(K),ie(pe)}).then(()=>(W.matched.forEach(Y=>Y.enterCallbacks={}),pe=Gd(Be,"beforeRouteEnter",W,le),pe.push(K),ie(pe))).then(()=>{pe=[];for(const Y of r.list())pe.push(Go(Y,W,le));return pe.push(K),ie(pe)}).catch(Y=>Mo(Y,8)?Y:Promise.reject(Y))}function F(W,le,pe){s.list().forEach($e=>V(()=>$e(W,le,pe)))}function I(W,le,pe,$e,Le){const Be=C(W,le);if(Be)return Be;const K=le===qo,Y=Ea?history.state:{};pe&&($e||K?l.replace(W.fullPath,St({scroll:K&&Y&&Y.scroll},Le)):l.push(W.fullPath,Le)),i.value=W,he(W,le,pe,K),U()}let R;function j(){R||(R=l.listen((W,le,pe)=>{if(!ge.listening)return;const $e=g(W),Le=k($e);if(Le){M(St(Le,{replace:!0}),$e).catch(Rr);return}u=$e;const Be=i.value;Ea&&BW(p0(Be.fullPath,pe.delta),Di()),P($e,Be).catch(K=>Mo(K,4|8)?K:Mo(K,2)?(M(K.to,$e).then(Y=>{Mo(Y,4|16)&&!pe.delta&&pe.type===Lr.pop&&l.go(-1,!1)}).catch(Rr),Promise.reject()):(pe.delta&&l.go(-pe.delta,!1),B(K,$e,Be))).then(K=>{K=K||I($e,Be,!1),K&&(pe.delta&&!Mo(K,8)?l.go(-pe.delta,!1):pe.type===Lr.pop&&Mo(K,4|16)&&l.go(-1,!1)),F($e,Be,K)}).catch(Rr)}))}let _=Fr(),H=Fr(),O;function B(W,le,pe){U(W);const $e=H.list();return $e.length?$e.forEach(Le=>Le(W,le,pe)):console.error(W),Promise.reject(W)}function G(){return O&&i.value!==qo?Promise.resolve():new Promise((W,le)=>{_.add([W,le])})}function U(W){return O||(O=!W,j(),_.list().forEach(([le,pe])=>W?pe(W):le()),_.reset()),W}function he(W,le,pe,$e){const{scrollBehavior:Le}=e;if(!Ea||!Le)return Promise.resolve();const Be=!pe&&FW(p0(W.fullPath,0))||($e||!pe)&&history.state&&history.state.scroll||null;return _e().then(()=>Le(W,le,Be)).then(K=>K&&LW(K)).catch(K=>B(K,W,le))}const de=W=>l.go(W);let we;const se=new Set,ge={currentRoute:i,listening:!0,addRoute:p,removeRoute:h,hasRoute:v,getRoutes:m,resolve:g,options:e,push:$,replace:b,go:de,back:()=>de(-1),forward:()=>de(1),beforeEach:a.add,beforeResolve:r.add,afterEach:s.add,onError:H.add,isReady:G,install(W){const le=this;W.component("RouterLink",wU),W.component("RouterView",kU),W.config.globalProperties.$router=le,Object.defineProperty(W.config.globalProperties,"$route",{enumerable:!0,get:()=>E(i)}),Ea&&!we&&i.value===qo&&(we=!0,$(l.location).catch(Le=>{}));const pe={};for(const Le in qo)Object.defineProperty(pe,Le,{get:()=>i.value[Le],enumerable:!0});W.provide(Yd,le),W.provide(I0,Tf(pe)),W.provide(qd,i);const $e=W.unmount;se.add(W),W.unmount=function(){se.delete(W),se.size<1&&(u=qo,R&&R(),R=null,i.value=qo,we=!1,O=!1),$e()}}};function ie(W){return W.reduce((le,pe)=>le.then(()=>V(pe)),Promise.resolve())}return ge}function EU(e,t){const n=[],o=[],l=[],a=Math.max(t.matched.length,e.matched.length);for(let r=0;rTa(u,s))?o.push(s):n.push(s));const i=e.matched[r];i&&(t.matched.find(u=>Ta(u,i))||l.push(i))}return[n,o,l]}export{ce as A,De as B,gn as C,Ue as D,me as E,Re as F,Ke as G,dt as H,Bt as I,$t as J,MU as K,Z as L,ar as M,OU as N,T as O,L as a,X as b,A as c,Q as d,ct as e,st as f,ee as g,IU as h,PU as i,mC as j,AU as k,ve as l,N as m,Ae as n,w as o,nt as p,Ze as q,ne as r,zl as s,S as t,NU as u,E as v,q as w,e1 as x,uf as y,at as z}; diff --git a/docs/index.html b/docs/index.html index 429bca2..f9dc891 100644 --- a/docs/index.html +++ b/docs/index.html @@ -11,8 +11,8 @@ Vue3瀑布流 - - + + diff --git a/example/api.ts b/example/api.ts index 77ac4eb..adb6e40 100644 --- a/example/api.ts +++ b/example/api.ts @@ -83,7 +83,7 @@ function randomColor() { // return list // } -const website = 'https://www.getphotoblanket.com' +const website = 'https://wanderprints.com' // const website = 'https://www.getphotoblanket.com'; export const getList = ({ page = 1, pageSize = 20 }) => { diff --git a/example/components/WaterfallList.vue b/example/components/WaterfallList.vue index cba9c0b..e9a9284 100644 --- a/example/components/WaterfallList.vue +++ b/example/components/WaterfallList.vue @@ -6,7 +6,11 @@ -->