2 lines
11 KiB
JavaScript
2 lines
11 KiB
JavaScript
|
|
import{jsxs as t,jsx as n}from"react/jsx-runtime";import{createContext as r,useContext as e,useMemo as o,Fragment as a,createElement as i,useRef as s,useCallback as l,useLayoutEffect as c,useEffect as u,useInsertionEffect as f,forwardRef as d}from"react";const m=r({}),p=r({strict:!1}),y=r({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),g=r({});function h(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function v(t){return"string"==typeof t||Array.isArray(t)}const w=["initial","animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"];function b(t){return h(t.animate)||w.some(n=>v(t[n]))}function S(t){const{initial:n,animate:r}=function(t,n){if(b(t)){const{initial:n,animate:r}=t;return{initial:!1===n||v(n)?n:void 0,animate:v(r)?r:void 0}}return!1!==t.inherit?n:{}}(t,e(g));return o(()=>({initial:n,animate:r}),[x(n),x(r)])}function x(t){return Array.isArray(t)?t.join(" "):t}const M=(t=>n=>"string"==typeof n&&n.startsWith(t))("--"),P={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},T={...P,transform:t=>((t,n,r)=>r>n?n:r<t?t:r)(0,1,t)},k={...P,default:1},O=t=>({test:n=>"string"==typeof n&&n.endsWith(t)&&1===n.split(" ").length,parse:parseFloat,transform:n=>`${n}${t}`}),W=O("deg"),C=O("%"),L=O("px"),A=(()=>({...C,parse:t=>C.parse(t)/100,transform:t=>C.transform(100*t)}))(),E=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],j=(()=>new Set(E))(),B={...P,transform:Math.round},I={borderWidth:L,borderTopWidth:L,borderRightWidth:L,borderBottomWidth:L,borderLeftWidth:L,borderRadius:L,radius:L,borderTopLeftRadius:L,borderTopRightRadius:L,borderBottomRightRadius:L,borderBottomLeftRadius:L,width:L,maxWidth:L,height:L,maxHeight:L,top:L,right:L,bottom:L,left:L,padding:L,paddingTop:L,paddingRight:L,paddingBottom:L,paddingLeft:L,margin:L,marginTop:L,marginRight:L,marginBottom:L,marginLeft:L,backgroundPositionX:L,backgroundPositionY:L,...{rotate:W,rotateX:W,rotateY:W,rotateZ:W,scale:k,scaleX:k,scaleY:k,scaleZ:k,skew:W,skewX:W,skewY:W,distance:L,translateX:L,translateY:L,translateZ:L,x:L,y:L,z:L,perspective:L,transformPerspective:L,opacity:T,originX:A,originY:A,originZ:L},zIndex:B,fillOpacity:T,strokeOpacity:T,numOctaves:B},R=(t,n)=>n&&"number"==typeof t?n.transform(t):t,V=t=>Boolean(t&&t.getVelocity),X={};function Y(t,{layout:n,layoutId:r}){return j.has(t)||t.startsWith("origin")||(n||void 0!==r)&&(!!X[t]||"opacity"===t)}const $={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},D=E.length;function H(t,n,r){const{style:e,vars:o,transformOrigin:a}=t;let i=!1,s=!1;for(const t in n){const r=n[t];if(j.has(t))i=!0;else if(M(t))o[t]=r;else{const n=R(r,I[t]);t.startsWith("origin")?(s=!0,a[t]=n):e[t]=n}}if(n.transform||(i||r?e.transform=function(t,n,r){let e="",o=!0;for(let a=0;a<D;a++){const i=E[a],s=t[i];if(void 0===s)continue;let l=!0;if(l="number"==typeof s?s===(i.startsWith("scale")?1:0):0===parseFloat(s),!l||r){const t=R(s,I[i]);l||(o=!1,e+=`${$[i]||i}(${t}) `),r&&(n[i]=t)}}return e=e.trim(),r?e=r(n,o?"":e):o&&(e="none"),e}(n,t.transform,r):e.transform&&(e.transform="none")),s){const{originX:t="50%",originY:n="50%",originZ:r=0}=a;e.transformOrigin=`${t} ${n} ${r}`}}const F=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Z(t,n,r){for(const e in n)V(n[e])||Y(e,r)||(t[e]=n[e])}function z(t,n){const r={};return Z(r,t.style||{},t),Object.assign(r,function({transformTemplate:t},n){return o(()=>{const r={style:{},transform:{},transformOrigin:{},vars:{}};return H(r,n,t),Object.assign({},r.vars,r.style)},[n])}(t,n)),r}function N(t,n){const r={},e=z(t,n);return t.drag&&!1!==t.dragListener&&(r.draggable=!1,e.userSelect=e.WebkitUserSelect=e.WebkitTouchCallout="none",e.touchAction=!0===t.drag?"none":"pan-"+("x"===t.drag?"y":"x")),void 0===t.tabIndex&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=e,r}const U={offset:"stroke-dashoffset",array:"stroke-dasharray"},q={offset:"strokeDashoffset",array:"strokeDasharray"};fu
|