@appkit/dek-ui 0.9.0 → 0.10.0

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/dist/index.es.js CHANGED
@@ -33599,7 +33599,7 @@ const XN1 = a2(_3)`
33599
33599
  `, tU1 = a2.div`
33600
33600
  ${({ $vertical: t, $height: r, $width: e, $padding: h }) => t ? `position: absolute;
33601
33601
  top: 0;
33602
- right: ${h + 6}px;
33602
+ right: 0;
33603
33603
  height: ${typeof r == "number" ? `${r}px` : r};
33604
33604
  display: flex;
33605
33605
  justify-content: center;
@@ -33778,7 +33778,7 @@ function iU1(t, r = {}) {
33778
33778
  }
33779
33779
  const bG1 = ({
33780
33780
  vertical: t = !1,
33781
- autoplay: r = 15e3,
33781
+ autoplay: r = 15,
33782
33782
  width: e,
33783
33783
  height: h,
33784
33784
  padding: n = 10,
@@ -33823,7 +33823,7 @@ const bG1 = ({
33823
33823
  cardSize: t ? g.height : g.width,
33824
33824
  cardCount: V,
33825
33825
  cardPadCount: n,
33826
- autoplay: V > 1 ? r : 0,
33826
+ autoplay: V > 1 ? r * 1e3 : 0,
33827
33827
  vertical: t,
33828
33828
  renderCard: k,
33829
33829
  width: g.width,
package/dist/index.umd.js CHANGED
@@ -423,7 +423,7 @@ Valid keys: `+JSON.stringify(Object.keys(F),null," "));var M1=k1(t1,H1,n1,m,_+"
423
423
  `,tU1=G1.div`
424
424
  ${({$vertical:t,$height:r,$width:e,$padding:h})=>t?`position: absolute;
425
425
  top: 0;
426
- right: ${h+6}px;
426
+ right: 0;
427
427
  height: ${typeof r=="number"?`${r}px`:r};
428
428
  display: flex;
429
429
  justify-content: center;
@@ -473,7 +473,7 @@ Valid keys: `+JSON.stringify(Object.keys(F),null," "));var M1=k1(t1,H1,n1,m,_+"
473
473
  height: 8px;
474
474
  border-radius: 50%;
475
475
  background: ${({$active:t})=>t?"#ffffff99":"#ffffff33"};
476
- `;function eU1(t){const[r,e]=G.useState(!1),{cursor:h,width:n,height:l,v:d,c:g,p:L,...y}=t;G.useEffect(()=>{let U=null;return t.carouselState.dragging===!1&&r==!0?U=setTimeout(()=>{t.carouselState.dragging!=r&&e(t.carouselState.dragging)},2e3):e(t.carouselState.dragging),()=>{U&&clearTimeout(U)}},[t.carouselState.dragging,r]);let V=-Math.round(h)%g;for(;V<0;)V+=g;const k=g>1?d?0:(h-L)*n:0,E=g>1&&d?(h-L)*l:0,q=g>1?{transform:`translate3d(${k}px, ${E}px, 0)`}:{};return B1.jsxs(XN1,{$vertical:d,$width:n,$height:l,"aria-label":"stack",children:[B1.jsx(ZN1,{$vertical:d,$width:n,$height:l,style:q,...y}),B1.jsx(tU1,{"aria-label":"pager-container",$vertical:d,$width:n,$height:l,$padding:L,$dragging:r,children:B1.jsx(aU1,{"aria-label":"pager",$vertical:d,$count:g,children:[...new Array(g).keys()].map((U,D)=>B1.jsx(rU1,{"aria-label":"pager-item",$active:V===D},D))})})]})}const hU1={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend",blur:"touchcancel"},nU1=(t,r,e,h)=>Math.sqrt(Math.pow(e-t,2)+Math.pow(h-r,2));function iU1(t,r={}){const e=r.clickTolerance||5;class h extends G.Component{constructor(d){super(d);n0(this,"isMouseDown");n0(this,"mouseDownId");n0(this,"mouseTouchId",0);n0(this,"lastMoveEvent");n0(this,"clickStartX");n0(this,"clickStartY");n0(this,"mockTouchEvent",(d,g={})=>({changedTouches:g.changedTouches||[{identifier:this.mouseTouchId,pageX:d.pageX,pageY:d.pageY}],type:hU1[d.type]||d.type,preventDefault:d.preventDefault.bind(d),stopPropagation:d.stopPropagation.bind(d)}));n0(this,"onMouseDown",d=>{this.props.onMouseDown&&this.props.onMouseDown(d),this.isMouseDown=!0,this.mouseDownId++,this.clickStartX=d.pageX,this.clickStartY=d.pageY,this.props.onTouchStart&&this.props.onTouchStart(this.mockTouchEvent(d))});n0(this,"onDocumentMouseMove",d=>{this.isMouseDown&&(this.lastMoveEvent=this.mockTouchEvent(d),this.props.onTouchMove&&this.props.onTouchMove(this.lastMoveEvent))});n0(this,"onDocumentMouseUp",d=>{this.isMouseDown&&(this.isMouseDown=!1,this.props.onTouchEnd&&this.props.onTouchEnd(this.mockTouchEvent(d)),setTimeout(()=>{this.clickStartX=null,this.clickStartY=null},0))});n0(this,"onWindowBlur",d=>{if(!this.isMouseDown)return;this.isMouseDown=!1,this.clickStartX=null,this.clickStartY=null;const g=this.mockTouchEvent(d,{changedTouches:this.lastMoveEvent.changedTouches});this.props.onTouchCancel&&this.props.onTouchCancel(g)});n0(this,"onDocumentClick",d=>{this.clickStartX!==null&&this.clickStartY!==null&&nU1(this.clickStartX,this.clickStartY,d.pageX,d.pageY)>e&&(this.clickStartX=null,this.clickStartY=null,d.preventDefault(),d.stopPropagation())});this.isMouseDown=!1,this.mouseDownId=0,this.lastMoveEvent=null,this.clickStartX=null,this.clickStartY=null}componentDidMount(){document.addEventListener("mousemove",this.onDocumentMouseMove),document.addEventListener("mouseup",this.onDocumentMouseUp),document.addEventListener("click",this.onDocumentClick,!0),window.addEventListener("blur",this.onWindowBlur)}componentWillUnmount(){document.removeEventListener("mousemove",this.onDocumentMouseMove),document.removeEventListener("mouseup",this.onDocumentMouseUp),document.removeEventListener("click",this.onDocumentClick,!0),window.removeEventListener("blur",this.onWindowBlur)}render(){const{onMouseDown:d,...g}=this.props;return B1.jsx(t,{...g,onMouseDown:this.onMouseDown})}}return h}const cU1=({vertical:t=!1,autoplay:r=15e3,width:e,height:h,padding:n=10,elements:l=[B1.jsx("div",{})]})=>{const d=G.useRef(),[g,L]=G.useState({width:0,height:0});G.useLayoutEffect(()=>{d.current&&L({width:d.current.offsetWidth,height:d.current.offsetHeight})},[e,h]);const y=iU1(eU1),V=l.length;n=Math.max(1,n);function k(E,q){const U=l[q];return B1.jsx(KN1,{"data-index":E,"data-mod-index":q,$vertical:t,$width:g.width,$height:g.height,children:B1.jsx(QN1,{$vertical:t,$width:g.width-n,$height:g.height,children:B1.jsx(JN1,{children:U})})},E)}return B1.jsx(GN1,{ref:d,$width:e,$height:h,children:B1.jsx(YN1,{component:y,cardSize:t?g.height:g.width,cardCount:V,cardPadCount:n,autoplay:V>1?r:0,vertical:t,renderCard:k,width:g.width,height:g.height,v:t,c:V,p:n})})},lU1=G1.div`
476
+ `;function eU1(t){const[r,e]=G.useState(!1),{cursor:h,width:n,height:l,v:d,c:g,p:L,...y}=t;G.useEffect(()=>{let U=null;return t.carouselState.dragging===!1&&r==!0?U=setTimeout(()=>{t.carouselState.dragging!=r&&e(t.carouselState.dragging)},2e3):e(t.carouselState.dragging),()=>{U&&clearTimeout(U)}},[t.carouselState.dragging,r]);let V=-Math.round(h)%g;for(;V<0;)V+=g;const k=g>1?d?0:(h-L)*n:0,E=g>1&&d?(h-L)*l:0,q=g>1?{transform:`translate3d(${k}px, ${E}px, 0)`}:{};return B1.jsxs(XN1,{$vertical:d,$width:n,$height:l,"aria-label":"stack",children:[B1.jsx(ZN1,{$vertical:d,$width:n,$height:l,style:q,...y}),B1.jsx(tU1,{"aria-label":"pager-container",$vertical:d,$width:n,$height:l,$padding:L,$dragging:r,children:B1.jsx(aU1,{"aria-label":"pager",$vertical:d,$count:g,children:[...new Array(g).keys()].map((U,D)=>B1.jsx(rU1,{"aria-label":"pager-item",$active:V===D},D))})})]})}const hU1={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend",blur:"touchcancel"},nU1=(t,r,e,h)=>Math.sqrt(Math.pow(e-t,2)+Math.pow(h-r,2));function iU1(t,r={}){const e=r.clickTolerance||5;class h extends G.Component{constructor(d){super(d);n0(this,"isMouseDown");n0(this,"mouseDownId");n0(this,"mouseTouchId",0);n0(this,"lastMoveEvent");n0(this,"clickStartX");n0(this,"clickStartY");n0(this,"mockTouchEvent",(d,g={})=>({changedTouches:g.changedTouches||[{identifier:this.mouseTouchId,pageX:d.pageX,pageY:d.pageY}],type:hU1[d.type]||d.type,preventDefault:d.preventDefault.bind(d),stopPropagation:d.stopPropagation.bind(d)}));n0(this,"onMouseDown",d=>{this.props.onMouseDown&&this.props.onMouseDown(d),this.isMouseDown=!0,this.mouseDownId++,this.clickStartX=d.pageX,this.clickStartY=d.pageY,this.props.onTouchStart&&this.props.onTouchStart(this.mockTouchEvent(d))});n0(this,"onDocumentMouseMove",d=>{this.isMouseDown&&(this.lastMoveEvent=this.mockTouchEvent(d),this.props.onTouchMove&&this.props.onTouchMove(this.lastMoveEvent))});n0(this,"onDocumentMouseUp",d=>{this.isMouseDown&&(this.isMouseDown=!1,this.props.onTouchEnd&&this.props.onTouchEnd(this.mockTouchEvent(d)),setTimeout(()=>{this.clickStartX=null,this.clickStartY=null},0))});n0(this,"onWindowBlur",d=>{if(!this.isMouseDown)return;this.isMouseDown=!1,this.clickStartX=null,this.clickStartY=null;const g=this.mockTouchEvent(d,{changedTouches:this.lastMoveEvent.changedTouches});this.props.onTouchCancel&&this.props.onTouchCancel(g)});n0(this,"onDocumentClick",d=>{this.clickStartX!==null&&this.clickStartY!==null&&nU1(this.clickStartX,this.clickStartY,d.pageX,d.pageY)>e&&(this.clickStartX=null,this.clickStartY=null,d.preventDefault(),d.stopPropagation())});this.isMouseDown=!1,this.mouseDownId=0,this.lastMoveEvent=null,this.clickStartX=null,this.clickStartY=null}componentDidMount(){document.addEventListener("mousemove",this.onDocumentMouseMove),document.addEventListener("mouseup",this.onDocumentMouseUp),document.addEventListener("click",this.onDocumentClick,!0),window.addEventListener("blur",this.onWindowBlur)}componentWillUnmount(){document.removeEventListener("mousemove",this.onDocumentMouseMove),document.removeEventListener("mouseup",this.onDocumentMouseUp),document.removeEventListener("click",this.onDocumentClick,!0),window.removeEventListener("blur",this.onWindowBlur)}render(){const{onMouseDown:d,...g}=this.props;return B1.jsx(t,{...g,onMouseDown:this.onMouseDown})}}return h}const cU1=({vertical:t=!1,autoplay:r=15,width:e,height:h,padding:n=10,elements:l=[B1.jsx("div",{})]})=>{const d=G.useRef(),[g,L]=G.useState({width:0,height:0});G.useLayoutEffect(()=>{d.current&&L({width:d.current.offsetWidth,height:d.current.offsetHeight})},[e,h]);const y=iU1(eU1),V=l.length;n=Math.max(1,n);function k(E,q){const U=l[q];return B1.jsx(KN1,{"data-index":E,"data-mod-index":q,$vertical:t,$width:g.width,$height:g.height,children:B1.jsx(QN1,{$vertical:t,$width:g.width-n,$height:g.height,children:B1.jsx(JN1,{children:U})})},E)}return B1.jsx(GN1,{ref:d,$width:e,$height:h,children:B1.jsx(YN1,{component:y,cardSize:t?g.height:g.width,cardCount:V,cardPadCount:n,autoplay:V>1?r*1e3:0,vertical:t,renderCard:k,width:g.width,height:g.height,v:t,c:V,p:n})})},lU1=G1.div`
477
477
  position: relative;
478
478
  background-color: ${t=>t.$pressed?b1.view.backColor.lighter:Ct(t.$backColor)};
479
479
  border-radius: 10px;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@appkit/dek-ui",
3
3
  "private": false,
4
- "version": "0.9.0",
4
+ "version": "0.10.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "tsc && vite build",