amotify 0.2.132 → 0.2.133
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/demo/esbuild/app.tsx +2 -123
- package/demo/esbuild/designBook.tsx +249 -449
- package/demo/esbuild/public/index.js +90 -94
- package/dist/@utils/config.js +1 -1
- package/dist/fn/Input/Slider.js +1 -1
- package/package.json +1 -1
package/dist/@utils/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as s,c as h}from"../chunk-C5N2D3ZX.js";import d,{UUID as
|
|
1
|
+
import{b as s,c as h}from"../chunk-C5N2D3ZX.js";import d,{UUID as u}from"jmini";import{useRefresh as f,ColorObjects as b,SetThemeColorTag as p}from".";let n={sessionUID:u(),appRoot:null,darkMode:"light",themeColor:"comun",roundness:2,isSystemDarkmode:()=>window.matchMedia("(prefers-color-scheme: dark)").matches==!0,deviceIs:"",browserIs:"",isPhone:!1,isTouchDevice:!1,isIOS:!1,screen:{breakpoint:834,phonepoint:690,viewHeight:0,viewWidth:0,isBreakpoint:(e=834)=>window.innerWidth<=e,isPhonepoint:(e=690)=>window.innerWidth<=e}};const o={get:()=>n,set:e=>{n=s(s({},n),e)},update:{themeColor:e=>{if(b.find(r=>r.key==e)||(e="comun"),e==o.get().themeColor)return;o.set(h(s({},o.get()),{themeColor:e}));let t=d(document.body);t.removeClass(t.findClass(/^bdsTC/)).addClass("bdsTC_"+e).callback(()=>{p()}),o.restart()},darkMode:e=>{if(["light","dark","dim","auto"].includes(e)||(e="light"),e==o.get().darkMode)return;let t=e=="auto"?o.get().isSystemDarkmode()?"dark":"light":e;o.set(h(s({},o.get()),{darkMode:t}));let r=d(document.body);r.removeClass(r.findClass(/^bdsDM/)).addClass("bdsDM_"+t),o.restart()},roundness:e=>{e>=0&&e<=5||(e=2),e!=o.get().roundness&&(o.set(h(s({},o.get()),{roundness:e})),o.restart())},screen:e=>{o.get().screen=s(s({},o.get().screen),e)}},launch:e=>{const t=window.navigator.userAgent.toLowerCase(),r=t.indexOf("windows nt")!==-1?"windows":t.indexOf("android")!==-1?"android":t.indexOf("iphone")!==-1?"iPhone":t.indexOf("ipad")>-1?"iPad":t.indexOf("mac os x")!==-1?"macOSX":"undefined",g=t.indexOf("msie")!==-1||t.indexOf("trident")!==-1?"ie":t.indexOf("edge")!==-1?"edge":t.indexOf("chrome")!==-1?"chrome":t.indexOf("safari")!==-1?"safari":t.indexOf("firefox")!==-1?"firefox":t.indexOf("opera")!==-1||t.indexOf("opr")!==-1?"opera":"undefined";n.appRoot=e.appRoot||document.body,n.appRoot instanceof HTMLElement&&(n.appRoot.tabIndex=0),d.is.exist(e.roundness)&&o.update.roundness(e.roundness),d.is.exist(e.themeColor)&&o.update.themeColor(e.themeColor),d.is.exist(e.darkMode)&&o.update.darkMode(e.darkMode),n.deviceIs=r,n.browserIs=g,n.isPhone=["Android","iPhone"].includes(r),n.isTouchDevice=window.ontouchstart!==void 0&&0<navigator.maxTouchPoints,n.isIOS=["iPhone","iPad"].includes(r),n.isTouchDevice=window.ontouchstart!==void 0&&0<navigator.maxTouchPoints,n.isIOS=["iPhone","iPad"].includes(r),n.screen={breakpoint:834,phonepoint:690,viewHeight:window.innerHeight,viewWidth:window.innerWidth,isBreakpoint:(i=834)=>window.innerWidth<=i,isPhonepoint:(i=690)=>window.innerWidth<=i},d(document.body).addClass(["AMOTIFY_be_body","usrDevice_"+o.get().deviceIs,"bdsDM_"+o.get().darkMode,"bdsTC_"+o.get().themeColor]),d(window).addEvent({eventType:"load",eventID:"windowLoad",callback:()=>{let i=document.body.style,a=d(document.body),l=Number(a.getStyleProperty("--topNavHeight").removeLetters()||0),m=Number(a.getStyleProperty("--footerNavHeight").removeLetters()||0),w=window.innerHeight-l-m;i.setProperty("--viewHeight",window.innerHeight+"px"),i.setProperty("--contentHeight",w+"px")}}).addEvent({eventType:"resize",eventID:"getDeviceInfo",callback:()=>{o.update.screen({viewHeight:window.innerHeight,viewWidth:window.innerWidth});let i=d(document.body),a=window.innerHeight,l=Number(i.getStyleProperty("--topNavHeight").removeLetters()),m=Number(i.getStyleProperty("--footerNavHeight").removeLetters()),c=a-l-m;i.setStyleProperty("--viewHeight",a+"px").setStyleProperty("--sideNavHeight",c+"px").setStyleProperty("--contentHeight",c+"px")}}),p()},restart:()=>{f.release("RootViewController_"+o.get().sessionUID,u())}};export{o as Config,o as default};
|
package/dist/fn/Input/Slider.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as C,c as
|
|
1
|
+
import{b as C,c as T,d as k}from"../../chunk-C5N2D3ZX.js";import{jsx as d,jsxs as W}from"react/jsx-runtime";import g,{UUID as _}from"jmini";import{useState as B,useEffect as P}from"react";import{$$fromRoot as I,GenerateHTMLProps as $}from"../../@utils";import{Box as D,Flex as A,Column as q}from"../../atoms";import{Button as O}from"../Button";import{OptionalInputWrapper as G,BoxWrapper as X,CoreEffects as F}from"./core";import{InputSliderClasses as c}from"../../@styles/componentClasses";function j(t){let{value:e,states:n}=t,{required:s}=n,o=[];return s&&!e&&o.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"}),{ok:!o.filter(({type:r})=>r=="invalid").length,notice:o}}const z=t=>{let{value:e,val_status:n}=t,{min:s,max:o,step:r}=n;e=Math.max(e,s),e=Math.min(e,o);let a=e/o*o;return a=Math.round(a/r),{stepValue:a*r,stepIndex:a,positionLeft:a*r/o*100+"%"}},N={IndicatorLabels:t=>{let{componentID:e,min:n,max:s,step:o,customLegends:r}=t,i=[],a=Math.round(n/o),p=Math.round(s/o),S=p-a+1;for(var u=a;u<=p;u++){let l=u*o;l=Math.max(l,n),l=Math.min(l,s);let f=l/s*100+"%";i.push(d(D,{className:c("Label"),id:"Legend-"+e+"-"+u,display:u==a||u==p?"flex":"none",position:"absolute",top:0,unitHeight:1,unitWidth:1.5,transition:"middle",fontColor:"1.clear",verticalAlign:"center",horizontalAlign:"center",freeCSS:{left:f,whiteSpace:"nowrap",textAlign:"center"},children:r?r(l):l.rank()},l))}return P(()=>{const l=()=>{let f=I("#Labels-"+e),{width:v}=f.position(),L=Math.round(v/50)-1,b=Math.round(S/L);for(let m=a+1;m<p;m++)I("#Legend-"+e+"-"+m).css({display:m%b==0?"flex":"none"})};return g(window).addEvent({eventID:"SliderResizeCallback-"+e,eventType:"resize",callback:()=>{l()}}),l(),()=>{g(window).removeEvent("SliderResizeCallback-"+e)}},[]),d(A,{className:c("Labels"),verticalAlign:"center",horizontalAlign:"between",fontSize:"0.xs",position:"relative",unitHeight:1,id:"Labels-"+e,children:d(D,{position:"absolute",top:0,left:0,bottom:0,freeCSS:{right:12*1.5},children:i})})},Rail:t=>{let{val_status:e,set_status:n,DotData:s,form:o,enableFormSubmit:r}=t,{componentID:i}=e;return W(A,{className:c("Rail"),position:"relative",paddingLeft:"1/2",unitHeight:1.5,verticalAlign:"center",freeCSS:{minWidth:"10rem",zIndex:1,cursor:"pointer"},onPointerDown:a=>{t.rootStates.disabled||(a.stopPropagation(),y.Effects.Start(a,{val_status:e,set_status:n,DotData:s}))},children:[d(D,{className:c("Bar"),backgroundColor:"layer.4",position:"relative",borderRadius:"1.tone.primary",transition:"middle",flexSizing:"none",unitHeight:"2/3",width:1,id:i+"_Bar",children:d(D,{className:c("BarColor"),position:"relative",height:1,width:0,left:0,transition:"long",borderRadius:"inherit",backgroundColor:t.color,opacity:"middle",overflow:"hidden",freeCSS:{width:s.positionLeft},id:i+"_BarColor"})}),d(D,{className:c("BallWrap"),position:"absolute",top:0,left:0,bottom:0,freeCSS:{right:12*1.5},children:d(O.Plain,{className:c("Ball"),position:"absolute",boxShadow:"1.remark",backgroundColor:t.color,top:0,left:0,ssSquare:1.5,borderRadius:"1.tone.primary",freeCSS:{zIndex:2,left:s.positionLeft},id:i+"_Ball",onKeyDown:a=>{y.KeyDownEvent({event:a,val_status:e,set_status:n,DotData:s}),r&&F.SubmitForm(a,o)}})})]})}},y={Effects:{Start:(t,e)=>{g(document).addEvent({eventID:"SliderMouseMove",eventType:"mousemove",callback:n=>{y.Effects.Move(n,e)},options:{passive:!1}}).addEvent({eventID:"SliderTouchMove",eventType:"touchmove",callback:n=>{y.Effects.Move(n,e)},options:{passive:!1}}).addEvent({eventID:"SliderMouseUp",eventType:"mouseup",callback:()=>{y.Effects.End()}}).addEvent({eventID:"SliderTouchEnd",eventType:"touchend",callback:()=>{y.Effects.End()}})},Move:(t,e)=>{let n=g.getCursor(t).x,{val_status:s,set_status:o}=e,{componentID:r,min:i,max:a}=s,p=I("#"+r+"_Ball"),S=I("#"+r+"_Bar"),u=I("#"+r+"_BarColor"),{width:l,left:f}=S.position(),v=(n-f)/l;v=Math.max(v,0),v=Math.min(v,1);let L=v*a,b=z({value:L,val_status:s}),m=b.positionLeft,w=b.stepValue;return p.css({left:m}),u.css({width:m}),o(x=>{let E=x.dataValue;return w==E?x:T(C({},x),{dataValue:w,eventType:"update",eventID:_()})}),t.preventDefault(),t.stopPropagation(),!1},End:()=>{g(document).removeEvent(["SliderMouseMove","SliderTouchMove","SliderMouseUp","SliderTouchEnd"])}},KeyDownEvent:t=>{let{event:e,val_status:n,set_status:s}=t,{min:o,max:r,step:i}=n,{key:a,metaKey:p,ctrlKey:S}=e,u=S||p,l=n.dataValue;a.match(/Arrow/)&&(e.preventDefault(),a.match(/Left|Up/)?u?l=o:l-=i:a.match(/Right|Down/)&&(u?l=r:l+=i),l=Math.max(Math.min(l,r),o),s(f=>T(C({},f),{dataValue:l,eventType:"update",eventID:_()})))}},J=t=>{let V=t,{color:e="theme",required:n,form:s="",legends:{enable:o=!0,custom:r,showAlways:i=!1}={},min:a,max:p,step:S,enableFormSubmit:u,checkValidationAtFirst:l,onValidate:f,onUpdateValue:v,onUpdateValidValue:L,value:b="",className:m,freeCSS:w,wrapStyles:x}=V,E=k(V,["color","required","form","legends","min","max","step","enableFormSubmit","checkValidationAtFirst","onValidate","onUpdateValue","onUpdateValidValue","value","className","freeCSS","wrapStyles"]),[h,R]=B({componentID:t.componentID||"",dataValue:b,min:a,max:p,step:S,eventType:"init",eventID:_()}),[M,K]=B({ok:!1,notice:[]});F.CommonEffects({type:"slider",states:t,val_status:h,set_status:R,val_validate:M,set_validate:K,SystemValidation:j});let U=z({value:h.dataValue,val_status:h});return d(X,{val_status:h,set_status:R,val_validate:M,states:t,children:W(q,{gap:"1/2",flexSizing:"auto",className:[c("Wrap"),m,c("ShowLegendsAlways_"+i)].join(" "),children:[d(N.Rail,{rootStates:t,color:e,val_status:h,set_status:R,DotData:U,form:s,enableFormSubmit:u}),!!o&&d(N.IndicatorLabels,{componentID:h.componentID,min:a,max:p,step:S,customLegends:r})]})})},H=t=>{let e=C({},t);return d(G,{componentID:t.componentID,children:J,states:$(e)})};export{H as Slider,H as default};
|