Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@brushes/simulate-component

Package Overview
Dependencies
Maintainers
3
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@brushes/simulate-component - npm Package Compare versions

Comparing version
0.3.91
to
0.3.92
+1
-1
dist/index.js

@@ -1,1 +0,1 @@

import{jsx as e,Fragment as n,jsxs as t}from"react/jsx-runtime";import{useState as r,useMemo as o,useEffect as i,memo as c,useCallback as s,useRef as a}from"react";import{getEnv as l,getTaro as d}from"@brushes/utils";import{Swiper as h,Radio as u,Checkbox as g}from"antd-mobile";import*as p from"antd-mobile";export{p as antdMobile};import m from"classnames";import{isEmpty as b,isFunction as f,noop as v}from"lodash-es";function j(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}function O(e,n,t,r){return new(t||(t=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(c,s)}a((r=r.apply(e,n||[])).next())}))}const w=n=>{var{children:t=""}=n,r=j(n,["children"]);return e("div",Object.assign({},r,{children:t}))},y=n=>{var{children:t=""}=n,r=j(n,["children"]);return e("span",Object.assign({},r,{children:t}))},S=new Map;const x=function(e){let n,t="pending",r=e.then((e=>{t="success",n=e}),(e=>{t="error",n=e}));return{read(){if("pending"===t)throw r;if("error"===t)throw n;if("success"===t)return n}}}(function(){const e=S.get("component");return new Promise((n=>{e?n(e):(()=>{O(this,void 0,void 0,(function*(){let e={};if(l()){const[n,t]=yield Promise.all([import("@tarojs/components"),import("antd-mobile")]);e=Object.assign(Object.assign({},t),n)}else{const n=yield import("antd-mobile");e=Object.assign(Object.assign({},n),{View:w,Text:y})}S.set("component",e),n(e)}))})()}))}());let T=!0,C={};function N(){const[e]=r((()=>(T&&(T=!1,C=x.read()),C)));return e}function k(e,n={height:200,width:375},t=""){const c=o((()=>l()),[]),[s,a]=r("");return i((()=>{let r="";if(c){const o=d().getSystemInfoSync().windowWidth;r=1==e?Math.floor(o*n.height/n.width)+"px":t||"100vh"}else r=1==e?Math.floor(375*n.height/n.width)+"px":t||"667px";a(r)}),[e,n]),s}function E(t){var{indicatorDots:i=!0,direction:c="horizontal",autoplayInterval:s,loop:a=!0,data:l,type:u,render:g,style:p,imgHeight:m,autoplay:b}=t,f=j(t,["indicatorDots","direction","autoplayInterval","loop","data","type","render","style","imgHeight","autoplay"]);const[v,O]=r(b),{Swiper:w,SwiperItem:y,Skeleton:S}=N(),x=o((()=>d()),[]),T=o((()=>x?w:h),[x]),C=o((()=>x?y:h.Item),[x]),E=k(u,m),I=o((()=>x?{vertical:"horizontal"!==c,interval:s,indicatorColor:"#999",circular:!0,indicatorActiveColor:"#333",indicatorDots:i}:{direction:c,autoplayInterval:s,loop:a}),[c,s,a,i,x]);return e(n,{children:l.length>0?e(T,Object.assign({},Object.assign(Object.assign(Object.assign({},I),f),{style:Object.assign(Object.assign({},p),{height:E})}),{autoplay:v,onChange:e=>{if(x){const{current:n}=e.detail;n!==l.length-1||a?O(b):O(!1)}}},{children:l.map(((n,t)=>e(C,{children:g(n)},t)))})):e(S,{animated:!0,style:{"--width":"100%","--height":E}})})}const I=c((({Threshold:n=50,onScroll:t,scrollTop:i=0,children:c})=>{const{ScrollView:a,PullToRefresh:l}=N(),[h,u]=r(i),g=a||l,p=o((()=>getEnv()),[]),m=o((()=>p?{scrollY:!0,enablePassive:!0,scrollWithAnimation:!0,upperThreshold:n,lowerThreshold:n,onScrollToLower:t,enhanced:!0,showScrollbar:!1,style:{height:"100%"}}:{onRefresh:t}),[]),b=s((e=>{if(!p)return;if("WEB"===d().getEnv()){const{scrollTop:n}=e.detail;u(n)}}),[]);return e(g,Object.assign({onScroll:b},m,{scrollTop:h},{children:c}))})),W=c((({Threshold:n=50,onScroll:t,scrollTop:i=0,children:c})=>{const a=o((()=>l()),[]),{ScrollView:h,PullToRefresh:u}=N(),[g,p]=r(i),m=h||u,b=o((()=>a?{scrollY:!0,enablePassive:!0,scrollWithAnimation:!0,upperThreshold:n,lowerThreshold:n,onScrollToLower:t,enhanced:!0,showScrollbar:!1,style:{height:"100%"}}:{onRefresh:t}),[a]),f=s((e=>{if(!a)return;if("WEB"===d().getEnv()){const{scrollTop:n}=e.detail;p(n)}}),[]);return e(m,Object.assign({onScroll:f},b,{scrollTop:g},{children:c}))}));function z({text:n="加载中……"}){const{View:r,Text:o}=N();return t(r,Object.assign({style:{textAlign:"center",fontSize:"14px",padding:"5px 0"}},{children:[t(r,Object.assign({className:"qj-loading"},{children:[e(r,{className:"qj-loading__ring"}),e(r,{className:"qj-loading__ring"}),e(r,{className:"qj-loading__ring"})]})),e(o,Object.assign({style:{marginLeft:5}},{children:n}))]}))}const P=({tabs:n,onChange:t,actived:r,activeColor:o})=>{const{View:i}=N();return e(i,Object.assign({className:"qj-tabs",id:"qj-tabs-id"},{children:n.map(((n,c)=>e(i,Object.assign({onClick:()=>t(c,n),className:m({"actived-item":r===c,"default-item":!0}),style:{borderColor:r===c?o:""}},{children:n.name}),c)))}))},_=({tabs:o,render:i,defaultIndex:c,activeColor:s="#000"})=>{const{View:a}=N(),[l,d]=r(c),[h,u]=r((()=>{const e=new Array(c+1);return e[c]=o[c],e}));return t(n,{children:[e(P,{actived:l,onChange:(e,n)=>{d(e),u((t=>(t[e]=n,t)))},tabs:o,activeColor:s}),h.map(((n,t)=>e(a,Object.assign({style:{display:t===l?"block":"none"}},{children:i(n)}),t)))]})},V=({className:n="iconfont",prefixClass:t="icon",onClick:r=(()=>{}),style:o={fontSize:16,color:"#444",fontWeight:900},value:i})=>{const{Text:c}=N();return e(c,{onClick:r,className:m(t,i?`${t}-${i}`:"",n),style:o})},q=({popupVisible:n,popupHandler:r,children:o})=>{const{View:i}=N();return t(i,Object.assign({className:"brushes-popup "+(n?"show":"")},{children:[e(i,{className:"brushes-popup-mask",onClick:()=>r(!1)}),t(i,Object.assign({className:"brushes-popup-content"},{children:[e(i,Object.assign({className:"brushes-popup-closeWrap"},{children:e(V,{value:"close-bold",style:{fontSize:22},onClick:()=>r(!1)})})),o]}))]}))},B=({count:n,handleStep:r})=>{const{View:o,Text:i}=N();return t(o,Object.assign({className:"numStep"},{children:[e(V,{value:"jianqu",onClick:r.bind(null,"minus")}),e(i,Object.assign({className:"content"},{children:n})),e(V,{value:"zengjia",onClick:r.bind(null,"plus")})]}))},R=n=>{var{children:t}=n,r=j(n,["children"]);const{Radio:i}=N(),c=d(),s=o((()=>c&&"WEB"!==c.getEnv()?i:u),[i,c]);return e(s,Object.assign({},r,{children:t}))},A=n=>{var{children:t}=n,r=j(n,["children"]);const{RadioGroup:i}=N(),c=d(),s=o((()=>c&&"WEB"!==c.getEnv()?i:null==u?void 0:u.Group),[i,c]);return e(s,Object.assign({},r,{children:t}))},M=n=>{var{children:t}=n,r=j(n,["children"]);const{Checkbox:i}=N(),c=d(),s=o((()=>c&&"WEB"!==c.getEnv()?i:g),[i,c]);return e(s,Object.assign({},r,{children:t}))},L=n=>{var{children:t}=n,r=j(n,["children"]);const{CheckboxGroup:i}=N(),c=d(),s=o((()=>c&&"WEB"!==c.getEnv()?i:null==g?void 0:g.Group),[i,c]);return e(s,Object.assign({},r,{children:t}))};function G({loading:n,children:r}){const{View:o}=N();return t(o,Object.assign({style:{position:"relative",textAlign:"center"}},{children:[r,n?e(o,Object.assign({className:"wrap-loading"},{children:t(o,Object.assign({className:"qj-loading"},{children:[e(o,{className:"qj-loading__ring"}),e(o,{className:"qj-loading__ring"}),e(o,{className:"qj-loading__ring"})]}))})):null]}))}const Y=c((({fontSize:c=14,color:s,content:a=[],speed:l=30,icon:h="gonggao",direction:u="horizontal",navigator:g})=>{const{View:p,NoticeBar:m}=N(),[b,f]=r({}),v=o((()=>`animElemId${Math.ceil(1e6*Math.random()).toString(36)}`),[]),j="horizontal"===u?"scroll-animate":"normal",O=o((()=>a.toString().length),[a]),w=o((()=>"horizontal"===u?1e3:350),[u]),y=o((()=>{const e=d();return e&&"WEB"!==e.getEnv()}),[]),S=o((()=>{switch(u){case"horizontal":return 15*O;case"vertical":return"100%"}}),[u,O]);return i((()=>{if(!y)return;const e=d();let n="";const t=setTimeout((()=>{e.createSelectorQuery().select(`#${v}`).boundingClientRect((t=>{const{width:r,height:o}=t||{},i=(e=>{if(!y)return;const n=d().getSystemInfoSync().windowWidth;return"horizontal"===u&&e/n>1?e/n:1})(r)||1,c=500*i/+l,s=()=>{const n=e.createAnimation({duration:c*w,timingFunction:"linear"}),t=e.createAnimation({duration:0,timingFunction:"linear"}),s=()=>{setTimeout((()=>{t.translateX(r/i).step(),f(t.export())}),c*w+200),setTimeout((()=>{n.translateX(-r).step(),f(n.export())}),100)};switch(u){case"horizontal":default:s();break;case"vertical":setTimeout((()=>{t.translateY(o/a.length).step(),f(t.export())}),c*w+200),setTimeout((()=>{n.translateY(-o).step(),f(n.export())}),100)}};s(),n=setInterval(s,c*w+300)})).exec()}),1e3);return()=>{clearTimeout(t),clearInterval(n)}}),[a,w,u,v,y,l]),e(n,{children:y?t(p,Object.assign({id:"noticebar-wrap"},{children:[e(p,Object.assign({className:"icon-pre"},{children:e(V,{style:{fontSize:20,fontWeight:600},value:h})})),e(p,Object.assign({animation:b,id:v},{children:e(p,Object.assign({style:{width:S},className:j},{children:a.map(((n,t)=>e(p,Object.assign({style:{color:s},onClick:()=>g?g(t):()=>{},className:"scroll-animate-item"},{children:n}),t)))}))}))]})):e(m,{speed:l,style:{"--font-size":c+"px","--text-color":s,"--border-color":"#fff3e9","--background-color":"#fff9ed"},content:a[0]})})})),$=n=>{var{children:t}=n,r=j(n,["children"]);return e("div",Object.assign({},r,{children:t}))},D=c((n=>{var{children:t}=n,r=j(n,["children"]);const{View:o=$,Skeleton:i}=N();return e(o,Object.assign({},r,{children:t||e(i.Paragraph,{style:{minWidth:35,height:20,overflow:"hidden"},lineCount:1,animated:!0})}))})),H=n=>{var{children:t}=n,r=j(n,["children"]);return e("div",Object.assign({},r,{children:t}))},X=c((n=>{var{children:t}=n,r=j(n,["children"]);const{Text:o=H,Skeleton:i}=N();return e(o,Object.assign({},r,{children:t||e(i,{style:{"--width":"100%","--height":"16px"},animated:!0})}))})),F=new Map;function Q(e){const[n,t]=r(!0),[o,c]=r(null),[s,a]=r("");return i((()=>{if(F.has(e)&&e){const n=F.get(e);return t(!1),void a(n)}(function(e){return new Promise(((n,t)=>{let r;const o=d();r=b(o)||"WEB"===o.getEnv()?new Image:o.createOffscreenCanvas({type:"2d"}).createImage(),r.onload=()=>{n(e)},r.onerror=t,r.src=e}))})(e).then((()=>{t(!1),a(e),function(e){F.set(e,e)}(e)})).catch((e=>{t(!1),c(e)}))}),[e]),{loading:n,srcPath:s,error:o}}const J=c((n=>{var{src:t,errorImg:r="https://brushes.oss-cn-shanghai.aliyuncs.com/static/defaultPic.png"}=n,o=j(n,["src","errorImg"]);const{Image:i,Skeleton:c}=N(),{srcPath:s,loading:a,error:l}=Q(t);return s?e(i,Object.assign({src:s},o)):a?e(c,Object.assign({animated:!0},o)):l?e(i,Object.assign({src:r},o)):null}));var K=Object.freeze({__proto__:null,SmoothSwiper:E,ScrollView:I,ScrollViewX:W,Loading:z,Tabs:_,Popup:q,NumStep:B,IconMobile:V,Radio:R,SmoothRadio:A,Checkbox:M,SmoothCheckbox:L,WrapLoading:G,NoticeBar:Y,SmoothView:D,SmoothText:X,Image:J});function U(e){const n=a();return n.current=f(e)?e:v,s(((...e)=>n.current(...e)),[n])}function Z(e,n=void 0){const t=a(n);return t.current===n&&(t.current=e()),t}let ee={};function ne(){const e=N();return o((()=>b(ee)?(ee=Object.assign(Object.assign({},e),K),ee):ee),[e])}export{M as Checkbox,V as IconMobile,J as Image,z as Loading,Y as NoticeBar,B as NumStep,q as Popup,R as Radio,I as ScrollView,W as ScrollViewX,L as SmoothCheckbox,A as SmoothRadio,E as SmoothSwiper,X as SmoothText,D as SmoothView,_ as Tabs,G as WrapLoading,ne as useComponent,k as useImageHeight,U as useImmutableCallback,Z as useLazyRef};
import{jsx as e,Fragment as n,jsxs as t}from"react/jsx-runtime";import{useState as r,useMemo as o,useEffect as i,memo as c,useCallback as s,useRef as l}from"react";import{getEnv as a,getTaro as d}from"@brushes/utils";import{Swiper as h,Radio as u,Checkbox as g}from"antd-mobile";import*as p from"antd-mobile";export{p as antdMobile};import m from"classnames";import{isEmpty as b,isFunction as f,noop as j}from"lodash-es";function v(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}function O(e,n,t,r){return new(t||(t=Promise))((function(o,i){function c(e){try{l(r.next(e))}catch(e){i(e)}}function s(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(c,s)}l((r=r.apply(e,n||[])).next())}))}const w=n=>{var{children:t=""}=n,r=v(n,["children"]);return e("div",Object.assign({},r,{children:t}))},y=n=>{var{children:t=""}=n,r=v(n,["children"]);return e("span",Object.assign({},r,{children:t}))},S=new Map;const x=function(e){let n,t="pending",r=e.then((e=>{t="success",n=e}),(e=>{t="error",n=e}));return{read(){if("pending"===t)throw r;if("error"===t)throw n;if("success"===t)return n}}}(function(){const e=S.get("component");return new Promise((n=>{e?n(e):(()=>{O(this,void 0,void 0,(function*(){let e={};if(a()){const[n,t]=yield Promise.all([import("@tarojs/components"),import("antd-mobile")]);e=Object.assign(Object.assign({},t),n)}else{const n=yield import("antd-mobile");e=Object.assign(Object.assign({},n),{View:w,Text:y})}S.set("component",e),n(e)}))})()}))}());let T=!0,C={};function N(){const[e]=r((()=>(T&&(T=!1,C=x.read()),C)));return e}function k(e,n={height:200,width:375},t=""){const c=o((()=>a()),[]),[s,l]=r("");return i((()=>{let r="";if(c){const o=d().getSystemInfoSync().windowWidth;r=1==e?Math.floor(o*n.height/n.width)+"px":t||"100vh"}else r=1==e?Math.floor(375*n.height/n.width)+"px":t||"667px";l(r)}),[e,n]),s}function I(t){var{indicatorDots:i=!0,direction:c="horizontal",autoplayInterval:s,loop:l=!0,data:a,type:u,render:g,style:p,imgHeight:m,autoplay:b}=t,f=v(t,["indicatorDots","direction","autoplayInterval","loop","data","type","render","style","imgHeight","autoplay"]);const[j,O]=r(b),{Swiper:w,SwiperItem:y,Skeleton:S}=N(),x=o((()=>d()),[]),T=o((()=>x?w:h),[x]),C=o((()=>x?y:h.Item),[x]),I=k(u,m),E=o((()=>x?{vertical:"horizontal"!==c,interval:s,indicatorColor:"#999",circular:!0,indicatorActiveColor:"#333",indicatorDots:i}:{direction:c,autoplayInterval:s,loop:l}),[c,s,l,i,x]);return e(n,{children:a.length>0?e(T,Object.assign({},Object.assign(Object.assign(Object.assign({},E),f),{style:Object.assign(Object.assign({},p),{height:I})}),{autoplay:j,onChange:e=>{if(x){const{current:n}=e.detail;n!==a.length-1||l?O(b):O(!1)}}},{children:a.map(((n,t)=>e(C,{children:g(n)},t)))})):e(S,{animated:!0,style:{"--width":"100%","--height":I}})})}const E=c((({Threshold:n=50,onScroll:t,scrollTop:i=0,children:c})=>{const{ScrollView:l,PullToRefresh:h}=N(),[u,g]=r(i),p=l||h,m=o((()=>a()),[]),b=o((()=>m?{scrollY:!0,enablePassive:!0,scrollWithAnimation:!0,upperThreshold:n,lowerThreshold:n,onScrollToLower:t,enhanced:!0,showScrollbar:!1,style:{height:"100%"}}:{onRefresh:t}),[]),f=s((e=>{if(!m)return;if("WEB"===d().getEnv()){const{scrollTop:n}=e.detail;g(n)}}),[]);return e(p,Object.assign({onScroll:f},b,{scrollTop:u},{children:c}))})),W=c((({Threshold:n=50,onScroll:t,scrollTop:i=0,children:c})=>{const l=o((()=>a()),[]),{ScrollView:h,PullToRefresh:u}=N(),[g,p]=r(i),m=h||u,b=o((()=>l?{scrollY:!0,enablePassive:!0,scrollWithAnimation:!0,upperThreshold:n,lowerThreshold:n,onScrollToLower:t,enhanced:!0,showScrollbar:!1,style:{height:"100%"}}:{onRefresh:t}),[l]),f=s((e=>{if(!l)return;if("WEB"===d().getEnv()){const{scrollTop:n}=e.detail;p(n)}}),[]);return e(m,Object.assign({onScroll:f},b,{scrollTop:g},{children:c}))}));function z({text:n="加载中……"}){const{View:r,Text:o}=N();return t(r,Object.assign({style:{textAlign:"center",fontSize:"14px",padding:"5px 0"}},{children:[t(r,Object.assign({className:"qj-loading"},{children:[e(r,{className:"qj-loading__ring"}),e(r,{className:"qj-loading__ring"}),e(r,{className:"qj-loading__ring"})]})),e(o,Object.assign({style:{marginLeft:5}},{children:n}))]}))}const P=({tabs:n,onChange:t,actived:r,activeColor:o})=>{const{View:i}=N();return e(i,Object.assign({className:"qj-tabs",id:"qj-tabs-id"},{children:n.map(((n,c)=>e(i,Object.assign({onClick:()=>t(c,n),className:m({"actived-item":r===c,"default-item":!0}),style:{borderColor:r===c?o:""}},{children:n.name}),c)))}))},_=({tabs:o,render:i,defaultIndex:c,activeColor:s="#000"})=>{const{View:l}=N(),[a,d]=r(c),[h,u]=r((()=>{const e=new Array(c+1);return e[c]=o[c],e}));return t(n,{children:[e(P,{actived:a,onChange:(e,n)=>{d(e),u((t=>(t[e]=n,t)))},tabs:o,activeColor:s}),h.map(((n,t)=>e(l,Object.assign({style:{display:t===a?"block":"none"}},{children:i(n)}),t)))]})},V=({className:n="iconfont",prefixClass:t="icon",onClick:r=(()=>{}),style:o={fontSize:16,color:"#444",fontWeight:900},value:i})=>{const{Text:c}=N();return e(c,{onClick:r,className:m(t,i?`${t}-${i}`:"",n),style:o})},q=({popupVisible:n,popupHandler:r,children:o})=>{const{View:i}=N();return t(i,Object.assign({className:"brushes-popup "+(n?"show":"")},{children:[e(i,{className:"brushes-popup-mask",onClick:()=>r(!1)}),t(i,Object.assign({className:"brushes-popup-content"},{children:[e(i,Object.assign({className:"brushes-popup-closeWrap"},{children:e(V,{value:"close-bold",style:{fontSize:22},onClick:()=>r(!1)})})),o]}))]}))},B=({count:n,handleStep:r})=>{const{View:o,Text:i}=N();return t(o,Object.assign({className:"numStep"},{children:[e(V,{value:"jianqu",onClick:r.bind(null,"minus")}),e(i,Object.assign({className:"content"},{children:n})),e(V,{value:"zengjia",onClick:r.bind(null,"plus")})]}))},R=n=>{var{children:t}=n,r=v(n,["children"]);const{Radio:i}=N(),c=d(),s=o((()=>c&&"WEB"!==c.getEnv()?i:u),[i,c]);return e(s,Object.assign({},r,{children:t}))},A=n=>{var{children:t}=n,r=v(n,["children"]);const{RadioGroup:i}=N(),c=d(),s=o((()=>c&&"WEB"!==c.getEnv()?i:null==u?void 0:u.Group),[i,c]);return e(s,Object.assign({},r,{children:t}))},M=n=>{var{children:t}=n,r=v(n,["children"]);const{Checkbox:i}=N(),c=d(),s=o((()=>c&&"WEB"!==c.getEnv()?i:g),[i,c]);return e(s,Object.assign({},r,{children:t}))},L=n=>{var{children:t}=n,r=v(n,["children"]);const{CheckboxGroup:i}=N(),c=d(),s=o((()=>c&&"WEB"!==c.getEnv()?i:null==g?void 0:g.Group),[i,c]);return e(s,Object.assign({},r,{children:t}))};function G({loading:n,children:r}){const{View:o}=N();return t(o,Object.assign({style:{position:"relative",textAlign:"center"}},{children:[r,n?e(o,Object.assign({className:"wrap-loading"},{children:t(o,Object.assign({className:"qj-loading"},{children:[e(o,{className:"qj-loading__ring"}),e(o,{className:"qj-loading__ring"}),e(o,{className:"qj-loading__ring"})]}))})):null]}))}const Y=c((({fontSize:c=14,color:s,content:l=[],speed:a=30,icon:h="gonggao",direction:u="horizontal",navigator:g})=>{const{View:p,NoticeBar:m}=N(),[b,f]=r({}),j=o((()=>`animElemId${Math.ceil(1e6*Math.random()).toString(36)}`),[]),v="horizontal"===u?"scroll-animate":"normal",O=o((()=>l.toString().length),[l]),w=o((()=>"horizontal"===u?1e3:350),[u]),y=o((()=>{const e=d();return e&&"WEB"!==e.getEnv()}),[]),S=o((()=>{switch(u){case"horizontal":return 15*O;case"vertical":return"100%"}}),[u,O]);return i((()=>{if(!y)return;const e=d();let n="";const t=setTimeout((()=>{e.createSelectorQuery().select(`#${j}`).boundingClientRect((t=>{const{width:r,height:o}=t||{},i=(e=>{if(!y)return;const n=d().getSystemInfoSync().windowWidth;return"horizontal"===u&&e/n>1?e/n:1})(r)||1,c=500*i/+a,s=()=>{const n=e.createAnimation({duration:c*w,timingFunction:"linear"}),t=e.createAnimation({duration:0,timingFunction:"linear"}),s=()=>{setTimeout((()=>{t.translateX(r/i).step(),f(t.export())}),c*w+200),setTimeout((()=>{n.translateX(-r).step(),f(n.export())}),100)};switch(u){case"horizontal":default:s();break;case"vertical":setTimeout((()=>{t.translateY(o/l.length).step(),f(t.export())}),c*w+200),setTimeout((()=>{n.translateY(-o).step(),f(n.export())}),100)}};s(),n=setInterval(s,c*w+300)})).exec()}),1e3);return()=>{clearTimeout(t),clearInterval(n)}}),[l,w,u,j,y,a]),e(n,{children:y?t(p,Object.assign({id:"noticebar-wrap"},{children:[e(p,Object.assign({className:"icon-pre"},{children:e(V,{style:{fontSize:20,fontWeight:600},value:h})})),e(p,Object.assign({animation:b,id:j},{children:e(p,Object.assign({style:{width:S},className:v},{children:l.map(((n,t)=>e(p,Object.assign({style:{color:s},onClick:()=>g?g(t):()=>{},className:"scroll-animate-item"},{children:n}),t)))}))}))]})):e(m,{speed:a,style:{"--font-size":c+"px","--text-color":s,"--border-color":"#fff3e9","--background-color":"#fff9ed"},content:l[0]})})})),$=n=>{var{children:t}=n,r=v(n,["children"]);return e("div",Object.assign({},r,{children:t}))},D=c((n=>{var{children:t}=n,r=v(n,["children"]);const{View:o=$,Skeleton:i}=N();return e(o,Object.assign({},r,{children:t||e(i.Paragraph,{style:{minWidth:35,height:20,overflow:"hidden"},lineCount:1,animated:!0})}))})),H=n=>{var{children:t}=n,r=v(n,["children"]);return e("div",Object.assign({},r,{children:t}))},X=c((n=>{var{children:t}=n,r=v(n,["children"]);const{Text:o=H,Skeleton:i}=N();return e(o,Object.assign({},r,{children:t||e(i,{style:{"--width":"100%","--height":"16px"},animated:!0})}))})),F=new Map;function Q(e){const[n,t]=r(!0),[o,c]=r(null),[s,l]=r("");return i((()=>{if(F.has(e)&&e){const n=F.get(e);return t(!1),void l(n)}(function(e){return new Promise(((n,t)=>{let r;const o=d();r=b(o)||"WEB"===o.getEnv()?new Image:o.createOffscreenCanvas({type:"2d"}).createImage(),r.onload=()=>{n(e)},r.onerror=t,r.src=e}))})(e).then((()=>{t(!1),l(e),function(e){F.set(e,e)}(e)})).catch((e=>{t(!1),c(e)}))}),[e]),{loading:n,srcPath:s,error:o}}const J=c((n=>{var{src:t,errorImg:r="https://brushes.oss-cn-shanghai.aliyuncs.com/static/defaultPic.png"}=n,o=v(n,["src","errorImg"]);const{Image:i,Skeleton:c}=N(),{srcPath:s,loading:l,error:a}=Q(t);return s?e(i,Object.assign({src:s},o)):l?e(c,Object.assign({animated:!0},o)):a?e(i,Object.assign({src:r},o)):null}));var K=Object.freeze({__proto__:null,SmoothSwiper:I,ScrollView:E,ScrollViewX:W,Loading:z,Tabs:_,Popup:q,NumStep:B,IconMobile:V,Radio:R,SmoothRadio:A,Checkbox:M,SmoothCheckbox:L,WrapLoading:G,NoticeBar:Y,SmoothView:D,SmoothText:X,Image:J});function U(e){const n=l();return n.current=f(e)?e:j,s(((...e)=>n.current(...e)),[n])}function Z(e,n=void 0){const t=l(n);return t.current===n&&(t.current=e()),t}let ee={};function ne(){const e=N();return o((()=>b(ee)?(ee=Object.assign(Object.assign({},e),K),ee):ee),[e])}export{M as Checkbox,V as IconMobile,J as Image,z as Loading,Y as NoticeBar,B as NumStep,q as Popup,R as Radio,E as ScrollView,W as ScrollViewX,L as SmoothCheckbox,A as SmoothRadio,I as SmoothSwiper,X as SmoothText,D as SmoothView,_ as Tabs,G as WrapLoading,ne as useComponent,k as useImageHeight,U as useImmutableCallback,Z as useLazyRef};
{
"name": "@brushes/simulate-component",
"version": "0.3.91",
"version": "0.3.92",
"description": "'组件库'",

@@ -5,0 +5,0 @@ "main": "dist/index.js",