@anoki/fse-ui
Version:
FSE UI components library
3 lines (2 loc) • 4.75 kB
JavaScript
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index.cjs470.js");function g(t){return t===void 0&&(t=""),t.trim().split(" ").filter(e=>!!e.trim())}function S(t){const e=t;Object.keys(e).forEach(r=>{try{e[r]=null}catch{}try{delete e[r]}catch{}})}function T(t,e){return e===void 0&&(e=0),setTimeout(t,e)}function E(){return Date.now()}function M(t){const e=a.a();let r;return e.getComputedStyle&&(r=e.getComputedStyle(t,null)),!r&&t.currentStyle&&(r=t.currentStyle),r||(r=t.style),r}function b(t,e){e===void 0&&(e="x");const r=a.a();let n,o,s;const l=M(t);return r.WebKitCSSMatrix?(o=l.transform||l.webkitTransform,o.split(",").length>6&&(o=o.split(", ").map(i=>i.replace(",",".")).join(", ")),s=new r.WebKitCSSMatrix(o==="none"?"":o)):(s=l.MozTransform||l.OTransform||l.MsTransform||l.msTransform||l.transform||l.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,"),n=s.toString().split(",")),e==="x"&&(r.WebKitCSSMatrix?o=s.m41:n.length===16?o=parseFloat(n[12]):o=parseFloat(n[4])),e==="y"&&(r.WebKitCSSMatrix?o=s.m42:n.length===16?o=parseFloat(n[13]):o=parseFloat(n[5])),o||0}function u(t){return typeof t=="object"&&t!==null&&t.constructor&&Object.prototype.toString.call(t).slice(8,-1)==="Object"}function x(t){return typeof window<"u"&&typeof window.HTMLElement<"u"?t instanceof HTMLElement:t&&(t.nodeType===1||t.nodeType===11)}function p(){const t=Object(arguments.length<=0?void 0:arguments[0]),e=["__proto__","constructor","prototype"];for(let r=1;r<arguments.length;r+=1){const n=r<0||arguments.length<=r?void 0:arguments[r];if(n!=null&&!x(n)){const o=Object.keys(Object(n)).filter(s=>e.indexOf(s)<0);for(let s=0,l=o.length;s<l;s+=1){const i=o[s],f=Object.getOwnPropertyDescriptor(n,i);f!==void 0&&f.enumerable&&(u(t[i])&&u(n[i])?n[i].__swiper__?t[i]=n[i]:p(t[i],n[i]):!u(t[i])&&u(n[i])?(t[i]={},n[i].__swiper__?t[i]=n[i]:p(t[i],n[i])):t[i]=n[i])}}}return t}function v(t,e,r){t.style.setProperty(e,r)}function C(t){let{swiper:e,targetPosition:r,side:n}=t;const o=a.a(),s=-e.translate;let l=null,i;const f=e.params.speed;e.wrapperEl.style.scrollSnapType="none",o.cancelAnimationFrame(e.cssModeFrameID);const h=r>s?"next":"prev",y=(m,d)=>h==="next"&&m>=d||h==="prev"&&m<=d,w=()=>{i=new Date().getTime(),l===null&&(l=i);const m=Math.max(Math.min((i-l)/f,1),0),d=.5-Math.cos(m*Math.PI)/2;let c=s+d*(r-s);if(y(c,r)&&(c=r),e.wrapperEl.scrollTo({[n]:c}),y(c,r)){e.wrapperEl.style.overflow="hidden",e.wrapperEl.style.scrollSnapType="",setTimeout(()=>{e.wrapperEl.style.overflow="",e.wrapperEl.scrollTo({[n]:c})}),o.cancelAnimationFrame(e.cssModeFrameID);return}e.cssModeFrameID=o.requestAnimationFrame(w)};w()}function O(t,e){e===void 0&&(e="");const r=a.a(),n=[...t.children];return r.HTMLSlotElement&&t instanceof HTMLSlotElement&&n.push(...t.assignedElements()),e?n.filter(o=>o.matches(e)):n}function P(t,e){const r=[e];for(;r.length>0;){const n=r.shift();if(t===n)return!0;r.push(...n.children,...n.shadowRoot?n.shadowRoot.children:[],...n.assignedElements?n.assignedElements():[])}}function j(t,e){const r=a.a();let n=e.contains(t);return!n&&r.HTMLSlotElement&&e instanceof HTMLSlotElement&&(n=[...e.assignedElements()].includes(t),n||(n=P(t,e))),n}function _(t){try{console.warn(t);return}catch{}}function F(t,e){e===void 0&&(e=[]);const r=document.createElement(t);return r.classList.add(...Array.isArray(e)?e:g(e)),r}function H(t,e){const r=[];for(;t.previousElementSibling;){const n=t.previousElementSibling;e?n.matches(e)&&r.push(n):r.push(n),t=n}return r}function L(t,e){const r=[];for(;t.nextElementSibling;){const n=t.nextElementSibling;e?n.matches(e)&&r.push(n):r.push(n),t=n}return r}function A(t,e){return a.a().getComputedStyle(t,null).getPropertyValue(e)}function I(t){let e=t,r;if(e){for(r=0;(e=e.previousSibling)!==null;)e.nodeType===1&&(r+=1);return r}}function k(t,e){const r=[];let n=t.parentElement;for(;n;)e?n.matches(e)&&r.push(n):r.push(n),n=n.parentElement;return r}function W(t,e,r){const n=a.a();return t[e==="width"?"offsetWidth":"offsetHeight"]+parseFloat(n.getComputedStyle(t,null).getPropertyValue(e==="width"?"margin-right":"margin-top"))+parseFloat(n.getComputedStyle(t,null).getPropertyValue(e==="width"?"margin-left":"margin-bottom"))}function D(t){return(Array.isArray(t)?t:[t]).filter(e=>!!e)}function K(t,e){e===void 0&&(e=""),typeof trustedTypes<"u"?t.innerHTML=trustedTypes.createPolicy("html",{createHTML:r=>r}).createHTML(e):t.innerHTML=e}exports.a=v;exports.b=k;exports.c=F;exports.e=O;exports.f=E;exports.h=W;exports.i=I;exports.j=g;exports.k=b;exports.m=D;exports.n=T;exports.o=u;exports.q=A;exports.r=L;exports.s=K;exports.t=H;exports.u=C;exports.v=_;exports.w=j;exports.x=p;exports.y=S;
//# sourceMappingURL=index.cjs468.js.map