amotify 0.1.31 → 0.1.32

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.
Files changed (95) hide show
  1. package/dist/@declaration/_.js +1 -1
  2. package/dist/@styles/componentClasses/_.css +68 -65
  3. package/dist/@styles/componentClasses/_.js +39 -39
  4. package/dist/@styles/index.css +68 -65
  5. package/dist/@styles/index.js +39 -39
  6. package/dist/@styles/init.css +1 -1
  7. package/dist/@styles/style.css +68 -65
  8. package/dist/@styles/style.js +39 -39
  9. package/dist/@styles/var.css +1 -1
  10. package/dist/@utils/GenerateClassName.js +470 -1
  11. package/dist/@utils/LaunchReactApp.js +78 -1
  12. package/dist/@utils/_.js +12 -1
  13. package/dist/@utils/collectForm.js +96 -1
  14. package/dist/@utils/color.js +103 -1
  15. package/dist/@utils/config.js +101 -1
  16. package/dist/@utils/fin.js +39 -1
  17. package/dist/@utils/getElement.js +13 -1
  18. package/dist/@utils/jsminEx.js +172 -1
  19. package/dist/@utils/pageTransit.js +33 -1
  20. package/dist/@utils/useRecycle.js +44 -1
  21. package/dist/@utils/useStore.js +54 -1
  22. package/dist/atoms/Box.js +20 -1
  23. package/dist/atoms/FAI.js +148 -1
  24. package/dist/atoms/Flex.js +34 -1
  25. package/dist/atoms/Grid.js +17 -1
  26. package/dist/atoms/Img.js +65 -1
  27. package/dist/atoms/Logo.js +359 -51
  28. package/dist/atoms/P.js +20 -1
  29. package/dist/atoms/Placeholder.js +44 -1
  30. package/dist/atoms/Span.js +20 -1
  31. package/dist/atoms/_.js +9 -1
  32. package/dist/chunk-JJ3PEWPN.js +60 -0
  33. package/dist/fn/Button.js +316 -1
  34. package/dist/fn/Cropper.js +1009 -1
  35. package/dist/fn/Effect/Fade.js +88 -1
  36. package/dist/fn/Effect/Pudding.js +22 -1
  37. package/dist/fn/Effect/Ripple.js +117 -3
  38. package/dist/fn/Effect/_.js +14 -1
  39. package/dist/fn/Input/AutoHeightText.js +112 -1
  40. package/dist/fn/Input/Checker.js +36 -1
  41. package/dist/fn/Input/Chips/Selector.js +472 -1
  42. package/dist/fn/Input/Chips/_.js +349 -1
  43. package/dist/fn/Input/Contenteditable.js +160 -1
  44. package/dist/fn/Input/DigitCharacters.js +275 -1
  45. package/dist/fn/Input/Filer.js +619 -1
  46. package/dist/fn/Input/Hidden.js +48 -1
  47. package/dist/fn/Input/List.js +450 -1
  48. package/dist/fn/Input/Parts.js +121 -1
  49. package/dist/fn/Input/Plain.js +12 -1
  50. package/dist/fn/Input/RichSelect.js +279 -1
  51. package/dist/fn/Input/Search.js +53 -1
  52. package/dist/fn/Input/Segmented.js +245 -1
  53. package/dist/fn/Input/Select.js +278 -1
  54. package/dist/fn/Input/Slider.js +538 -1
  55. package/dist/fn/Input/Switch.js +221 -1
  56. package/dist/fn/Input/Text.js +626 -1
  57. package/dist/fn/Input/TextArea.js +151 -1
  58. package/dist/fn/Input/Time/Picker.js +1457 -1
  59. package/dist/fn/Input/Time/_.js +867 -1
  60. package/dist/fn/Input/_.js +48 -1
  61. package/dist/fn/Input/core.js +626 -1
  62. package/dist/fn/Layout/PageNotFound.js +90 -1
  63. package/dist/fn/Layout/PageRouter.js +87 -1
  64. package/dist/fn/Layout/PageViewController.js +29 -1
  65. package/dist/fn/Layout/Plate.js +37 -1
  66. package/dist/fn/Layout/RootViewController.js +315 -1
  67. package/dist/fn/Layout/SwipeView.js +348 -1
  68. package/dist/fn/Layout/TabBar.js +72 -1
  69. package/dist/fn/Layout/_.js +22 -1
  70. package/dist/fn/Loader/_.js +104 -1
  71. package/dist/fn/Loader/corner.js +85 -1
  72. package/dist/fn/Loader/mini.js +125 -1
  73. package/dist/fn/Loader/top.js +73 -1
  74. package/dist/fn/Sheet.js +1101 -1
  75. package/dist/fn/Snackbar.js +216 -1
  76. package/dist/fn/Table/Data.js +974 -1
  77. package/dist/fn/Table/Drag.js +435 -1
  78. package/dist/fn/Table/Normal.js +136 -1
  79. package/dist/fn/Table/Parts.js +41 -1
  80. package/dist/fn/Table/Wrapper.js +60 -1
  81. package/dist/fn/Table/_.js +16 -1
  82. package/dist/fn/Table/cellStyling.js +51 -1
  83. package/dist/fn/Tooltips.js +58 -1
  84. package/dist/fn/_.js +10 -1
  85. package/dist/index.js +20 -1
  86. package/dist/mols/Accordion.js +152 -1
  87. package/dist/mols/Column.js +16 -1
  88. package/dist/mols/LinkifyText.js +42 -1
  89. package/dist/mols/List.js +42 -1
  90. package/dist/mols/Row.js +47 -1
  91. package/dist/mols/Text.js +67 -1
  92. package/dist/mols/_.js +6 -1
  93. package/dist/temps/_.js +1 -1
  94. package/dist/temps/designBook.js +3639 -20
  95. package/package.json +1 -1
@@ -1 +1,1009 @@
1
- import{b as X,c as O,e as P}from"../chunk-VY3566IV.js";import{Fragment as $,jsx as h,jsxs as y}from"react/jsx-runtime";import{$$ as b,$$fromRoot as j,useStore as M}from"../@utils/_";import{useState as k,useEffect as H}from"react";import V from"../atoms/Flex";import D from"../atoms/Box";import B from"../atoms/FAI";import T from"../mols/Column";import q from"../mols/Row";import Y from"./Button";import A from"./Sheet";import z from"./Loader/_";import W from"./Input/_";import{faPalette as K}from"@fortawesome/free-solid-svg-icons/faPalette";import{faBarsStaggered as Z}from"@fortawesome/free-solid-svg-icons/faBarsStaggered";import{faRotateLeft as J}from"@fortawesome/free-solid-svg-icons/faRotateLeft";import{faRotateRight as Q}from"@fortawesome/free-solid-svg-icons/faRotateRight";import{CropperClasses as U}from"../@styles/componentClasses/_";class ee{constructor(i){this.set_scale=i.set_scale,this.val_file=i.val_file,this.develops=i.develops,this.use=i.use,this.componentID=i.componentID,this.scale={current:i.scale.default,default:i.scale.default,min:i.scale.min,max:i.scale.max};let e=i.canvas,{width:l,height:t}=e,a=i.picture.image,{width:m,height:s}=a,c=m/s;this.Canvas={elm:e,ctx:e.getContext("2d")};let o=0,r=0;this.use=="square"?(o=e.width/3*2,r=e.height/3*2):this.use=="wallpaper.horizontal"?(o=e.width*(7/9),r=o/3):this.use=="wallpaper.vertical"&&(r=e.height*(7/9),o=r/2);let n=(e.width-o)/2,d=(e.height-r)/2,g=o/r;this.Picture={elm:a,originDataUrl:a.src,aspect:c,revisedAspect:g>c?o/m:r/s,rotate:i.picture.rotate,grayScale:i.picture.grayScale,tone:i.picture.tone},this.pst={frame:{x:n,y:d,w:o,h:r,aspect:g},outImage:{x:0,y:0,w:0,h:0},imageX:m/2,imageY:s/2,centerX:l/2,centerY:t/2},this.dragEffectInfo={origin:{x:0,y:0},frameExpandRate:{x:0,y:0}},this.pinchEffectInfo={origin:{x:0,y:0,scale:this.scale.current}},this.modifyImage()}dragEffect(i){let{eventType:e,x:l,y:t}=i;if(e=="start"){let a=this.Canvas.elm.position();this.dragEffectInfo={origin:{x:l,y:t},frameExpandRate:{x:this.Canvas.elm.width/a.width,y:this.Canvas.elm.height/a.height}}}else{let{origin:a,frameExpandRate:m}=this.dragEffectInfo,s=a.x-l,c=a.y-t,o=this.scale.current*this.Picture.revisedAspect/100,r=s/o*m.x,n=c/o*m.y;e=="move"?this.drawImage(this.pst.imageX+r,this.pst.imageY+n):e=="end"&&this.drawImage(this.pst.imageX+=r,this.pst.imageY+=n)}}pinchEffect(i){let{eventType:e,event:l}=i,{x:t,y:a}=b.getCursor(l.touches[0]),{x:m,y:s}=b.getCursor(l.touches[1]),c=m-t,o=s-a;if(e=="start")this.pinchEffectInfo.origin={x:c,y:o,scale:this.scale.current};else if(e=="move"){let{origin:r}=this.pinchEffectInfo,n=Math.sqrt(Math.pow(r.x,2)+Math.pow(r.y,2)),g=Math.sqrt(Math.pow(c,2)+Math.pow(o,2))/n,C=Number(r.scale*g);this.set_scale(C)}}updateScale(i){let e=i;e=Math.max(e,this.scale.min),e=Math.min(e,this.scale.max),this.scale.current=e,this.drawImage()}updateFilter(i){this.Picture.grayScale=i.grayScale,this.Picture.tone=i.tone,this.Picture.rotate=i.rotate,this.modifyImage()}modifyImage(){return P(this,null,function*(){let{grayScale:i,tone:e,rotate:l}=this.Picture;const t=document.createElement("canvas");let a=t.getContext("2d"),m=new Image;m.src=this.Picture.originDataUrl;let s=m.width,c=m.height;(l==90||l==270)&&(s=m.height,c=m.width),t.width=s,t.height=c,i&&(a.filter="grayscale("+i+"%)"),l&&(a.translate(s/2,c/2),a.rotate(l*Math.PI/180),[90,270].includes(l)?a.translate(-c/2,-s/2):a.translate(-s/2,-c/2)),a.drawImage(m,0,0,m.width,m.height);let o=a.getImageData(0,0,t.width,t.height),r=o.data;{i/=100;let C=[[255,255,255],[255,200,100],[170,170,255],[240,200,145],[128,255,255],[255,128,255],[255,255,128],[128,158,169],[128,112,162],[50,192,87],[246,100,140]][e],x=C[0]/255,S=C[1]/255,p=C[2]/255;for(let u=0;u<c;u++)for(let v=0;v<s;v++){var n=(u*s+v)*4;if(i){let w=.3*r[n]+.59*r[n+1]+.11*r[n+2];for(var d=0;d<3;d++){let E=r[n+d];r[n+d]=E+(w-E)*i}}r[n]*=x,r[n+1]*=S,r[n+2]*=p}}a.putImageData(o,0,0);let g=t.toDataURL("image/jpeg");{let C=yield b.ImageLoader(g),{width:x,height:S}=C,p=x/S;this.Picture=O(X({},this.Picture),{elm:C,aspect:p,revisedAspect:this.pst.frame.aspect>p?this.pst.frame.w/x:this.pst.frame.h/S})}this.drawImage()})}drawImage(i,e){let{use:l,Canvas:{ctx:t},pst:{frame:a}}=this,m=i||this.pst.imageX,s=e||this.pst.imageY;{let c=this.scale.current/100,o=this.Picture.revisedAspect*c,r=this.pst.centerX-m*o,n=this.pst.centerY-s*o,d=this.Picture.elm.width*o,g=this.Picture.elm.height*o;{let C=this.pst.frame.x+this.pst.frame.w-d,x=this.pst.frame.x,S=this.pst.frame.y+this.pst.frame.h-g,p=this.pst.frame.y,u=0;r<C&&(u=r-C),r>x&&(u=r-x);let v=0;n<S&&(v=n-S),n>p&&(v=n-p),this.dragEffectInfo.origin.x+=u/2/this.dragEffectInfo.frameExpandRate.x,this.dragEffectInfo.origin.y+=v/2/this.dragEffectInfo.frameExpandRate.y,r=Math.min(Math.max(r,C),x),n=Math.min(Math.max(n,S),p)}this.pst.outImage={x:r,y:n,w:d,h:g},t.clearRect(0,0,this.Canvas.elm.width,this.Canvas.elm.height),t.drawImage(this.Picture.elm,0,0,this.Picture.elm.width,this.Picture.elm.height,r,n,d,g)}{l=="square"?(t.fillStyle="rgba( 20,24,20,.3 )",t.beginPath(),t.arc(this.Canvas.elm.width/2,this.Canvas.elm.height/2,this.Canvas.elm.width,0,Math.PI*2,!0),t.arc(this.Canvas.elm.width/2,this.Canvas.elm.height/2,this.Canvas.elm.width/3*2/2,0,Math.PI*2,!1),t.closePath(),t.fill()):(l=="wallpaper.horizontal"||l=="wallpaper.vertical")&&(t.fillStyle="rgba( 20,24,20,.3 )"),t.beginPath(),t.moveTo(0,0),t.lineTo(this.Canvas.elm.width,0),t.lineTo(this.Canvas.elm.width,this.Canvas.elm.height),t.lineTo(0,this.Canvas.elm.height),t.lineTo(0,0),t.closePath(),t.lineTo(a.x,a.y),t.lineTo(a.x,a.y+a.h),t.lineTo(a.x+a.w,a.y+a.h),t.lineTo(a.x+a.w,a.y),t.lineTo(a.x,a.y),t.fill();let o=b(document.body).getStyleProperty("--color-theme-hsl");t.lineWidth=this.Canvas.elm.width/200,t.strokeStyle=`hsla( ${o},1 )`,t.strokeRect(a.x,a.y,a.w,a.h)}}export(){return P(this,null,function*(){let{develops:i,Picture:e,pst:{outImage:l,frame:t}}=this,a=l.w/e.elm.width,m=l.h/e.elm.height,s=(t.x-l.x)/a,c=(t.x-l.x+t.w)/a,o=(t.y-l.y)/m,r=(t.y-l.y+t.h)/m,n=Array.from({length:i.length}),d="image/jpeg";for(let g=0;g<i.length;g++){let{size:C,maxSize:x}=i[g];x=x||{S:1024*20,R:1024*100,L:1024*350}[C];let S={S:144,R:576,L:1152}[C],p=S;this.use=="wallpaper.horizontal"?p=S/3*2:this.use=="wallpaper.vertical"&&(p=S*2);let u=document.createElement("canvas");u.width=S,u.height=p;let v=u.getContext("2d");if(!v)return;v.clearRect(0,0,S,p),v.drawImage(this.Picture.elm,s,o,c-s,r-o,0,0,S,p);let w=u.toDataURL(d),E=yield w.toBlob(d);if(!E)return;if(E.size>=x){let F=x/E.size;if(w=u.toDataURL(d,F*.92),E=yield w.toBlob(d),!E)return}let L=new File([E],this.val_file.name,{type:d});n[g]=L}return n})}}const G={Core:f=>{let{val_file:i,options:e,finishedCallback:l,abortCallback:t}=f,{use:a,develops:m=[]}=e,[s]=k(b.uuid.gen(32));const c={scale:{default:125,min:100,max:300},rotate:0,grayScale:0,tone:0};let[o,r]=k(c.scale.default),[n,d]=k(c.rotate),[g,C]=k(c.grayScale),[x,S]=k(c.tone);return H(()=>{M.set({key:s,value:{}}),P(void 0,null,function*(){z.fn.corner.active();let{target:p}=yield i.read();if(!p)return;let u=p.result,v=j("#Canvas-"+s)[0];if(!v)return;let w=new ee({set_scale:r,val_file:i,develops:m,use:a,scale:c.scale,componentID:s,canvas:v,picture:{image:yield b.ImageLoader(u),grayScale:c.grayScale,tone:c.tone,rotate:c.rotate}});M.set({key:s,value:{Instance:w}});const E=function(I){if(I.preventDefault(),I.touches&&I.touches.length>1)w.pinchEffect({eventType:"start",event:I}),b(document).addEvent({eventType:"touchmove",eventID:"CropperEffectMove",options:{passive:!1},callback:R=>{R.preventDefault(),w.pinchEffect({eventType:"move",event:R})}}).addEvent({eventType:"touchend",eventID:"CropperEffectEnd",options:{passive:!1},callback:F});else{w.dragEffect(X({eventType:"start"},b.getCursor(I)));let{type:R}=I;b(document).addEvent({eventType:R=="touchstart"?"touchmove":"mousemove",eventID:"CropperEffectMove",options:{passive:!1},callback:_=>{L("move",_)}}).addEvent({eventType:R=="touchstart"?"touchend":"mouseup",eventID:"CropperEffectEnd",options:{passive:!1},callback:_=>{L("end",_),F(_)}})}},L=function(I,R){R.preventDefault(),w.dragEffect(X({eventType:I},b.getCursor(R)))},F=function(I){I.preventDefault(),b(document).removeEvent(["CropperEffectMove","CropperEffectEnd"])};b(v).removeEvent(["CropperMouseWheel","CropperTouchStart","CropperMouseDown"]).addEvent({eventID:"CropperMouseWheel",eventType:"wheel",callback:I=>{I.preventDefault();let R=Number(I.wheelDelta*.04),_=w.scale.current+R;_=Math.max(_,w.scale.min),_=Math.min(_,w.scale.max),r(_)},options:{passive:!1}}).addEvent({eventType:"touchstart",eventID:"CropperTouchStart",callback:E,options:{passive:!1}}).addEvent({eventType:"mousedown",eventID:"CropperMouseDown",callback:E,options:{passive:!1}}),setTimeout(()=>{z.fn.corner.stop()},1e3)})},[i.id]),H(()=>{var u;let p=(u=M.get(s))==null?void 0:u.Instance;p&&p.updateScale(o)},[o]),H(()=>{var u;let p=(u=M.get(s))==null?void 0:u.Instance;p&&p.updateFilter({grayScale:g,tone:x,rotate:n})},[g,x,n]),h(A.Comps.Body,{children:y(V,{className:[U("Wrap"),U("Use_"+a)].join(" "),flexWrap:!1,position:"relative",overflow:"hidden",borderRadius:"inherit",boxShadow:"3.remark",UnderBreakPointStyles:{flexType:"col"},children:[h(D,{flexGrid:3,UnderBreakPointStyles:{width:1,padding:2},children:h(D,{overflow:"hidden",position:"relative",backgroundColor:"4.layer.darken",freeCSS:{zIndex:1},UnderBreakPointStyles:{borderRadius:"1.tone.primary"},children:h("canvas",{width:"2400",height:a=="wallpaper.horizontal"?"1800":a=="wallpaper.vertical"?"3200":"2400",className:U("Canvas"),id:"Canvas-"+s})})}),y(T,{gap:0,flexGrid:2,boxShadow:"3.remark",UnderBreakPointStyles:{width:1,maxWidth:"unset"},freeCSS:{maxWidth:12*28},children:[y(T,{gap:1,flexSizing:0,overflow:"auto",padding:1.5,UnderBreakPointStyles:{flexSizing:"none"},children:[h(D,{flexSizing:"none",fontSize:"4.thirdTitle",isSemiBoldFont:!0,children:"\u30D5\u30A3\u30EB\u30BF\u30FC"}),h(G.SettingRegion,{DefaultOptions:c,val_scale:o,set_scale:r,val_tone:x,set_tone:S,val_grayScale:g,set_grayScale:C,val_rotate:n,set_rotate:d})]}),y(V,{padding:1.5,flexSizing:"none",gap:1,borderTop:!0,children:[h(Y.Button.Border.R,{onClick:()=>{t()},children:"\u30AD\u30E3\u30F3\u30BB\u30EB"}),h(Y.Button.Prime.R,{flexSizing:0,onClick:()=>P(void 0,null,function*(){var v;let p=(v=M.get(s))==null?void 0:v.Instance;if(!p)return;z.fn.mini.active("CropperExportation");let u=yield p.export();setTimeout(()=>{z.fn.mini.stop("CropperExportation"),l(u)},3e3)}),children:y(q.Center,{gap:"1/2",children:[h(z.White.R,{loaderID:"CropperExportation"}),"\u6C7A\u5B9A"]})})]})]})]})})},SettingRegion:f=>{let i=[];for(let e=1;e<=10;e++)i.push({value:e,label:y($,{children:[h(D,{className:[U("ToneBall"),U("ToneBall_"+e)].join(" ")}),h(D,{textAlign:"center",flexSizing:"auto",children:["","\u6696\u8272","\u5BD2\u8272","\u30BB\u30D4\u30A2","\u30B7\u30A2\u30F3","\u30DE\u30BC\u30F3\u30BF","\u30A4\u30A8\u30ED\u30FC","\u30AA\u30EA\u30B8\u30CA\u30EB1","\u30AA\u30EA\u30B8\u30CA\u30EB2","\u30AA\u30EA\u30B8\u30CA\u30EB3","\u30AA\u30EA\u30B8\u30CA\u30EB4"][e]})]})});return y($,{children:[y(T,{gap:"1/3",children:[y(D,{children:[h(B.Rotate,{fontSize:"3.paragraph",fontColor:"4.thin"})," Rotate"]}),y(q.Separate,{flexChilds:"even",paddingLeft:2,children:[y(Y.Button.Border.S,{onClick:()=>{let e=f.val_rotate-90;e<0&&(e+=360),f.set_rotate(e)},children:[h(B,{icon:J})," \u5DE6\u306B\u56DE\u8EE2"]}),y(Y.Button.Border.S,{onClick:()=>{f.set_rotate((f.val_rotate+90)%360)},children:["\u53F3\u306B\u56DE\u8EE2 ",h(B,{icon:Q})]})]})]}),y(T,{gap:"1/3",children:[y(D,{children:[h(B.Search,{fontSize:"3.paragraph",fontColor:"4.thin"})," Zoom"]}),h(D,{paddingLeft:2,children:h(W.Slider,{override:"force",value:f.val_scale-100,min:f.DefaultOptions.scale.min-100,max:f.DefaultOptions.scale.max-100,step:25,onUpdateValidValue:({eventType:e,value:l})=>{b.interval.clear("Cropper.UpdateScale"),b.interval.standBy("Cropper.UpdateScale",400,()=>{f.set_scale(l+100)})},legends:{enable:!0,custom:e=>"x"+Math.round(100+e)/100}})})]}),y(T,{gap:"1/3",children:[y(D,{children:[h(B,{icon:K,fontSize:"3.paragraph",fontColor:"4.thin"})," Gray Scale"]}),h(D,{paddingLeft:2,children:h(W.Slider,{value:f.val_grayScale,min:0,max:100,step:10,onUpdateValidValue:({value:e})=>{b.interval.clear("Cropper.GrayScale"),b.interval.standBy("Cropper.GrayScale",400,()=>{f.set_grayScale(e)})},legends:{enable:!0,custom:e=>e+"%"}})})]}),y(T,{gap:"1/3",children:[y(D,{children:[h(B,{icon:Z,fontSize:"3.paragraph",fontColor:"4.thin"})," Tone"]}),h(D,{paddingLeft:2,children:h(W.Radio,{value:f.val_tone,gap:"1/2",cellStyles:{isRounded:!0,borderWidth:2,borderColor:"1.thin",padding:"1/2",paddingRight:1,fontSize:"1.mini",gap:"1/3",flexSizing:"auto"},options:[{value:0,label:"\u306A\u3057",padding:["1/2",1],flexCenter:!0},...i],onUpdateValidValue:({value:e})=>{f.set_tone(e[0])}})})]})]})}},N={open:f=>P(void 0,null,function*(){let i=yield W.Filer.fn.openDialog({accept:"image",multiple:!1}),e="CropperImage";A.open({sheetID:e,type:"normal.middleCenter",size:"3L",freeCSS:{width:f.use=="wallpaper.horizontal"?12*100:12*80},content:h(G.Core,{val_file:i[0],options:f,finishedCallback:l=>{A.close(e),f.onProcessFinished(l)},abortCallback:()=>{A.close(e)}}),close_option:{escapeKeyDown:!1}})})};export{N as Cropper,N as default};
1
+ import {
2
+ __async,
3
+ __spreadProps,
4
+ __spreadValues
5
+ } from "../chunk-JJ3PEWPN.js";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
+ import {
8
+ $$,
9
+ $$fromRoot,
10
+ useStore
11
+ } from "../@utils/_";
12
+ import {
13
+ useState,
14
+ useEffect
15
+ } from "react";
16
+ import Flex from "../atoms/Flex";
17
+ import Box from "../atoms/Box";
18
+ import FAI from "../atoms/FAI";
19
+ import Column from "../mols/Column";
20
+ import Row from "../mols/Row";
21
+ import Button from "./Button";
22
+ import Sheet from "./Sheet";
23
+ import Loader from "./Loader/_";
24
+ import Input from "./Input/_";
25
+ import { faPalette } from "@fortawesome/free-solid-svg-icons/faPalette";
26
+ import { faBarsStaggered } from "@fortawesome/free-solid-svg-icons/faBarsStaggered";
27
+ import { faRotateLeft } from "@fortawesome/free-solid-svg-icons/faRotateLeft";
28
+ import { faRotateRight } from "@fortawesome/free-solid-svg-icons/faRotateRight";
29
+ import { CropperClasses } from "../@styles/componentClasses/_";
30
+ class Picture {
31
+ constructor(params) {
32
+ this.set_scale = params.set_scale;
33
+ this.val_file = params.val_file;
34
+ this.develops = params.develops;
35
+ this.use = params.use;
36
+ this.componentID = params.componentID;
37
+ this.scale = {
38
+ current: params.scale.default,
39
+ default: params.scale.default,
40
+ min: params.scale.min,
41
+ max: params.scale.max
42
+ };
43
+ let Canvas = params.canvas;
44
+ let {
45
+ width: cvsW,
46
+ height: cvsH
47
+ } = Canvas;
48
+ let Picture2 = params.picture.image;
49
+ let {
50
+ width: pictW,
51
+ height: pictH
52
+ } = Picture2;
53
+ let pictAsp = pictW / pictH;
54
+ this.Canvas = {
55
+ elm: Canvas,
56
+ ctx: Canvas.getContext("2d")
57
+ };
58
+ let frameW = 0, frameH = 0;
59
+ if (this.use == "square") {
60
+ frameW = Canvas.width / 3 * 2;
61
+ frameH = Canvas.height / 3 * 2;
62
+ } else if (this.use == "wallpaper.horizontal") {
63
+ frameW = Canvas.width * (7 / 9);
64
+ frameH = frameW / 3;
65
+ } else if (this.use == "wallpaper.vertical") {
66
+ frameH = Canvas.height * (7 / 9);
67
+ frameW = frameH / 2;
68
+ }
69
+ let frameX = (Canvas.width - frameW) / 2;
70
+ let frameY = (Canvas.height - frameH) / 2;
71
+ let frameAsp = frameW / frameH;
72
+ this.Picture = {
73
+ elm: Picture2,
74
+ originDataUrl: Picture2.src,
75
+ aspect: pictAsp,
76
+ revisedAspect: frameAsp > pictAsp ? frameW / pictW : frameH / pictH,
77
+ rotate: params.picture.rotate,
78
+ grayScale: params.picture.grayScale,
79
+ tone: params.picture.tone
80
+ };
81
+ this.pst = {
82
+ frame: {
83
+ x: frameX,
84
+ y: frameY,
85
+ w: frameW,
86
+ h: frameH,
87
+ aspect: frameAsp
88
+ },
89
+ outImage: { x: 0, y: 0, w: 0, h: 0 },
90
+ imageX: pictW / 2,
91
+ imageY: pictH / 2,
92
+ centerX: cvsW / 2,
93
+ centerY: cvsH / 2
94
+ };
95
+ this.dragEffectInfo = {
96
+ origin: { x: 0, y: 0 },
97
+ frameExpandRate: { x: 0, y: 0 }
98
+ };
99
+ this.pinchEffectInfo = {
100
+ origin: {
101
+ x: 0,
102
+ y: 0,
103
+ scale: this.scale.current
104
+ }
105
+ };
106
+ this.modifyImage();
107
+ }
108
+ dragEffect(params) {
109
+ let {
110
+ eventType,
111
+ x,
112
+ y
113
+ } = params;
114
+ if (eventType == "start") {
115
+ let CanvasRect = this.Canvas.elm.position();
116
+ this.dragEffectInfo = {
117
+ origin: { x, y },
118
+ frameExpandRate: {
119
+ x: this.Canvas.elm.width / CanvasRect.width,
120
+ y: this.Canvas.elm.height / CanvasRect.height
121
+ }
122
+ };
123
+ } else {
124
+ let {
125
+ origin,
126
+ frameExpandRate
127
+ } = this.dragEffectInfo;
128
+ let dragX = origin.x - x;
129
+ let dragY = origin.y - y;
130
+ let scale = this.scale.current * this.Picture.revisedAspect / 100;
131
+ let shiftX = dragX / scale * frameExpandRate.x;
132
+ let shiftY = dragY / scale * frameExpandRate.y;
133
+ if (eventType == "move") {
134
+ this.drawImage(
135
+ this.pst.imageX + shiftX,
136
+ this.pst.imageY + shiftY
137
+ );
138
+ } else if (eventType == "end") {
139
+ this.drawImage(
140
+ this.pst.imageX += shiftX,
141
+ this.pst.imageY += shiftY
142
+ );
143
+ }
144
+ }
145
+ }
146
+ pinchEffect(params) {
147
+ let {
148
+ eventType,
149
+ event
150
+ } = params;
151
+ let { x: x1, y: y1 } = $$.getCursor(event.touches[0]);
152
+ let { x: x2, y: y2 } = $$.getCursor(event.touches[1]);
153
+ let marginX = x2 - x1;
154
+ let marginY = y2 - y1;
155
+ if (eventType == "start") {
156
+ this.pinchEffectInfo.origin = {
157
+ x: marginX,
158
+ y: marginY,
159
+ scale: this.scale.current
160
+ };
161
+ } else if (eventType == "move") {
162
+ let {
163
+ origin
164
+ } = this.pinchEffectInfo;
165
+ let originDist = Math.sqrt(Math.pow(origin.x, 2) + Math.pow(origin.y, 2));
166
+ let dist = Math.sqrt(Math.pow(marginX, 2) + Math.pow(marginY, 2));
167
+ let margin = dist / originDist;
168
+ let scale = Number(origin.scale * margin);
169
+ this.set_scale(scale);
170
+ }
171
+ }
172
+ updateScale(scale) {
173
+ let nextValue = scale;
174
+ nextValue = Math.max(nextValue, this.scale.min);
175
+ nextValue = Math.min(nextValue, this.scale.max);
176
+ this.scale.current = nextValue;
177
+ this.drawImage();
178
+ }
179
+ updateFilter(params) {
180
+ this.Picture.grayScale = params.grayScale;
181
+ this.Picture.tone = params.tone;
182
+ this.Picture.rotate = params.rotate;
183
+ this.modifyImage();
184
+ }
185
+ modifyImage() {
186
+ return __async(this, null, function* () {
187
+ let {
188
+ grayScale,
189
+ tone,
190
+ rotate
191
+ } = this.Picture;
192
+ const canvas = document.createElement("canvas");
193
+ let ctx = canvas.getContext("2d");
194
+ let image = new Image();
195
+ image.src = this.Picture.originDataUrl;
196
+ let ImageW = image.width;
197
+ let ImageH = image.height;
198
+ if (rotate == 90 || rotate == 270) {
199
+ ImageW = image.height;
200
+ ImageH = image.width;
201
+ }
202
+ canvas.width = ImageW;
203
+ canvas.height = ImageH;
204
+ if (grayScale)
205
+ ctx.filter = "grayscale(" + grayScale + "%)";
206
+ if (rotate) {
207
+ ctx.translate(ImageW / 2, ImageH / 2);
208
+ ctx.rotate(rotate * Math.PI / 180);
209
+ if ([90, 270].includes(rotate)) {
210
+ ctx.translate(-ImageH / 2, -ImageW / 2);
211
+ } else {
212
+ ctx.translate(-ImageW / 2, -ImageH / 2);
213
+ }
214
+ }
215
+ ctx.drawImage(image, 0, 0, image.width, image.height);
216
+ let newImage = ctx.getImageData(0, 0, canvas.width, canvas.height);
217
+ let imgData = newImage.data;
218
+ {
219
+ grayScale /= 100;
220
+ let ColorDir = [
221
+ [255, 255, 255],
222
+ // Original
223
+ [255, 200, 100],
224
+ // Warm
225
+ [170, 170, 255],
226
+ // Cold
227
+ [240, 200, 145],
228
+ // Sepia
229
+ [128, 255, 255],
230
+ // Cyan
231
+ [255, 128, 255],
232
+ // Magenta
233
+ [255, 255, 128],
234
+ // Yellow
235
+ [128, 158, 169],
236
+ // Origin1
237
+ [128, 112, 162],
238
+ // Origin2
239
+ [50, 192, 87],
240
+ // Origin3
241
+ [246, 100, 140]
242
+ // Origin4
243
+ ][tone];
244
+ let rCorrect = ColorDir[0] / 255;
245
+ let gCorrect = ColorDir[1] / 255;
246
+ let bCorrect = ColorDir[2] / 255;
247
+ for (let iH = 0; iH < ImageH; iH++) {
248
+ for (let iW = 0; iW < ImageW; iW++) {
249
+ var Index = (iH * ImageW + iW) * 4;
250
+ if (grayScale) {
251
+ let terminal = 0.3 * imgData[Index] + 0.59 * imgData[Index + 1] + 0.11 * imgData[Index + 2];
252
+ for (var k = 0; k < 3; k++) {
253
+ let current = imgData[Index + k];
254
+ imgData[Index + k] = current + (terminal - current) * grayScale;
255
+ }
256
+ }
257
+ imgData[Index] *= rCorrect;
258
+ imgData[Index + 1] *= gCorrect;
259
+ imgData[Index + 2] *= bCorrect;
260
+ }
261
+ }
262
+ }
263
+ ctx.putImageData(newImage, 0, 0);
264
+ let newDataUrl = canvas.toDataURL("image/jpeg");
265
+ {
266
+ let Picture2 = yield $$.ImageLoader(newDataUrl);
267
+ let {
268
+ width: pictW,
269
+ height: pictH
270
+ } = Picture2;
271
+ let pictAsp = pictW / pictH;
272
+ this.Picture = __spreadProps(__spreadValues({}, this.Picture), {
273
+ elm: Picture2,
274
+ aspect: pictAsp,
275
+ revisedAspect: this.pst.frame.aspect > pictAsp ? this.pst.frame.w / pictW : this.pst.frame.h / pictH
276
+ });
277
+ }
278
+ this.drawImage();
279
+ });
280
+ }
281
+ drawImage(_imageX, _imageY) {
282
+ let {
283
+ use,
284
+ Canvas: {
285
+ ctx
286
+ },
287
+ pst: {
288
+ frame
289
+ }
290
+ } = this;
291
+ let ImageX = _imageX || this.pst.imageX;
292
+ let ImageY = _imageY || this.pst.imageY;
293
+ {
294
+ let scale = this.scale.current / 100;
295
+ let totalScale = this.Picture.revisedAspect * scale;
296
+ let imgX = this.pst.centerX - ImageX * totalScale;
297
+ let imgY = this.pst.centerY - ImageY * totalScale;
298
+ let imgW = this.Picture.elm.width * totalScale;
299
+ let imgH = this.Picture.elm.height * totalScale;
300
+ {
301
+ let minX = this.pst.frame.x + this.pst.frame.w - imgW;
302
+ let maxX = this.pst.frame.x;
303
+ let minY = this.pst.frame.y + this.pst.frame.h - imgH;
304
+ let maxY = this.pst.frame.y;
305
+ let extraX = 0;
306
+ if (imgX < minX)
307
+ extraX = imgX - minX;
308
+ if (imgX > maxX)
309
+ extraX = imgX - maxX;
310
+ let extraY = 0;
311
+ if (imgY < minY)
312
+ extraY = imgY - minY;
313
+ if (imgY > maxY)
314
+ extraY = imgY - maxY;
315
+ this.dragEffectInfo.origin.x += extraX / 2 / this.dragEffectInfo.frameExpandRate.x;
316
+ this.dragEffectInfo.origin.y += extraY / 2 / this.dragEffectInfo.frameExpandRate.y;
317
+ imgX = Math.min(Math.max(imgX, minX), maxX);
318
+ imgY = Math.min(Math.max(imgY, minY), maxY);
319
+ }
320
+ this.pst.outImage = {
321
+ x: imgX,
322
+ y: imgY,
323
+ w: imgW,
324
+ h: imgH
325
+ };
326
+ ctx.clearRect(
327
+ 0,
328
+ 0,
329
+ this.Canvas.elm.width,
330
+ this.Canvas.elm.height
331
+ );
332
+ ctx.drawImage(
333
+ this.Picture.elm,
334
+ 0,
335
+ 0,
336
+ this.Picture.elm.width,
337
+ this.Picture.elm.height,
338
+ imgX,
339
+ imgY,
340
+ imgW,
341
+ imgH
342
+ );
343
+ }
344
+ {
345
+ if (use == "square") {
346
+ ctx.fillStyle = "rgba( 20,24,20,.3 )";
347
+ ctx.beginPath();
348
+ ctx.arc(this.Canvas.elm.width / 2, this.Canvas.elm.height / 2, this.Canvas.elm.width, 0, Math.PI * 2, true);
349
+ ctx.arc(this.Canvas.elm.width / 2, this.Canvas.elm.height / 2, this.Canvas.elm.width / 3 * 2 / 2, 0, Math.PI * 2, false);
350
+ ctx.closePath();
351
+ ctx.fill();
352
+ } else if (use == "wallpaper.horizontal") {
353
+ ctx.fillStyle = "rgba( 20,24,20,.3 )";
354
+ } else if (use == "wallpaper.vertical") {
355
+ ctx.fillStyle = "rgba( 20,24,20,.3 )";
356
+ }
357
+ ctx.beginPath();
358
+ ctx.moveTo(0, 0);
359
+ ctx.lineTo(this.Canvas.elm.width, 0);
360
+ ctx.lineTo(this.Canvas.elm.width, this.Canvas.elm.height);
361
+ ctx.lineTo(0, this.Canvas.elm.height);
362
+ ctx.lineTo(0, 0);
363
+ ctx.closePath();
364
+ ctx.lineTo(frame.x, frame.y);
365
+ ctx.lineTo(frame.x, frame.y + frame.h);
366
+ ctx.lineTo(frame.x + frame.w, frame.y + frame.h);
367
+ ctx.lineTo(frame.x + frame.w, frame.y);
368
+ ctx.lineTo(frame.x, frame.y);
369
+ ctx.fill();
370
+ let body = $$(document.body);
371
+ let themeColorHSL = body.getStyleProperty("--color-theme-hsl");
372
+ ctx.lineWidth = this.Canvas.elm.width / 200;
373
+ ctx.strokeStyle = `hsla( ${themeColorHSL},1 )`;
374
+ ctx.strokeRect(frame.x, frame.y, frame.w, frame.h);
375
+ }
376
+ }
377
+ export() {
378
+ return __async(this, null, function* () {
379
+ let {
380
+ develops,
381
+ Picture: Picture2,
382
+ pst: {
383
+ outImage,
384
+ frame
385
+ }
386
+ } = this;
387
+ let ratioX = outImage.w / Picture2.elm.width;
388
+ let ratioY = outImage.h / Picture2.elm.height;
389
+ let Left = (frame.x - outImage.x) / ratioX;
390
+ let Right = (frame.x - outImage.x + frame.w) / ratioX;
391
+ let Top = (frame.y - outImage.y) / ratioY;
392
+ let Bottom = (frame.y - outImage.y + frame.h) / ratioY;
393
+ let Files = Array.from({ length: develops.length });
394
+ let MimeType = "image/jpeg";
395
+ for (let index = 0; index < develops.length; index++) {
396
+ let {
397
+ size,
398
+ maxSize
399
+ } = develops[index];
400
+ maxSize = maxSize || {
401
+ S: 1024 * 20,
402
+ R: 1024 * 100,
403
+ L: 1024 * 350
404
+ }[size];
405
+ let width = {
406
+ S: 144,
407
+ R: 576,
408
+ L: 1152
409
+ }[size];
410
+ let height = width;
411
+ if (this.use == "wallpaper.horizontal") {
412
+ height = width / 3 * 2;
413
+ } else if (this.use == "wallpaper.vertical") {
414
+ height = width * 2;
415
+ }
416
+ let Preview = document.createElement("canvas");
417
+ Preview.width = width;
418
+ Preview.height = height;
419
+ let previewCtx = Preview.getContext("2d");
420
+ if (!previewCtx)
421
+ return;
422
+ previewCtx.clearRect(0, 0, width, height);
423
+ previewCtx.drawImage(
424
+ this.Picture.elm,
425
+ Left,
426
+ Top,
427
+ Right - Left,
428
+ Bottom - Top,
429
+ 0,
430
+ 0,
431
+ width,
432
+ height
433
+ );
434
+ let dataUrl = Preview.toDataURL(MimeType);
435
+ let blob = yield dataUrl.toBlob(MimeType);
436
+ if (!blob)
437
+ return;
438
+ if (blob.size >= maxSize) {
439
+ let Ratio = maxSize / blob.size;
440
+ dataUrl = Preview.toDataURL(MimeType, Ratio * 0.92);
441
+ blob = yield dataUrl.toBlob(MimeType);
442
+ if (!blob)
443
+ return;
444
+ }
445
+ let file = new File([blob], this.val_file.name, { type: MimeType });
446
+ Files[index] = file;
447
+ }
448
+ return Files;
449
+ });
450
+ }
451
+ }
452
+ const Comps = {
453
+ Core: (params) => {
454
+ let {
455
+ val_file,
456
+ options,
457
+ finishedCallback,
458
+ abortCallback
459
+ } = params;
460
+ let {
461
+ use,
462
+ develops = []
463
+ } = options;
464
+ let [val_componentID] = useState($$.uuid.gen(32));
465
+ const DefaultOptions = {
466
+ scale: {
467
+ default: 125,
468
+ min: 100,
469
+ max: 300
470
+ },
471
+ rotate: 0,
472
+ grayScale: 0,
473
+ tone: 0
474
+ };
475
+ let [val_scale, set_scale] = useState(DefaultOptions.scale.default);
476
+ let [val_rotate, set_rotate] = useState(DefaultOptions.rotate);
477
+ let [val_grayScale, set_grayScale] = useState(DefaultOptions.grayScale);
478
+ let [val_tone, set_tone] = useState(DefaultOptions.tone);
479
+ useEffect(() => {
480
+ useStore.set({
481
+ key: val_componentID,
482
+ value: {}
483
+ });
484
+ (() => __async(void 0, null, function* () {
485
+ Loader.fn.corner.active();
486
+ let { target } = yield val_file.read();
487
+ if (!target)
488
+ return;
489
+ let dataUrl = target.result;
490
+ let Canvas = $$fromRoot("#Canvas-" + val_componentID)[0];
491
+ if (!Canvas)
492
+ return;
493
+ let __Cropper = new Picture({
494
+ set_scale,
495
+ val_file,
496
+ develops,
497
+ use,
498
+ scale: DefaultOptions.scale,
499
+ componentID: val_componentID,
500
+ canvas: Canvas,
501
+ picture: {
502
+ image: yield $$.ImageLoader(dataUrl),
503
+ grayScale: DefaultOptions.grayScale,
504
+ tone: DefaultOptions.tone,
505
+ rotate: DefaultOptions.rotate
506
+ }
507
+ });
508
+ useStore.set({
509
+ key: val_componentID,
510
+ value: {
511
+ Instance: __Cropper
512
+ }
513
+ });
514
+ const UserEffectStart = function(event) {
515
+ event.preventDefault();
516
+ if (event.touches && event.touches.length > 1) {
517
+ __Cropper.pinchEffect({
518
+ eventType: "start",
519
+ event
520
+ });
521
+ $$(document).addEvent({
522
+ eventType: "touchmove",
523
+ eventID: "CropperEffectMove",
524
+ options: { passive: false },
525
+ callback: (event2) => {
526
+ event2.preventDefault();
527
+ __Cropper.pinchEffect({
528
+ eventType: "move",
529
+ event: event2
530
+ });
531
+ }
532
+ }).addEvent({
533
+ eventType: "touchend",
534
+ eventID: "CropperEffectEnd",
535
+ options: { passive: false },
536
+ callback: EventEnd
537
+ });
538
+ } else {
539
+ __Cropper.dragEffect(__spreadValues({
540
+ eventType: "start"
541
+ }, $$.getCursor(event)));
542
+ let { type } = event;
543
+ $$(document).addEvent({
544
+ eventType: type == "touchstart" ? "touchmove" : "mousemove",
545
+ eventID: "CropperEffectMove",
546
+ options: { passive: false },
547
+ callback: (event2) => {
548
+ DragEffect("move", event2);
549
+ }
550
+ }).addEvent({
551
+ eventType: type == "touchstart" ? "touchend" : "mouseup",
552
+ eventID: "CropperEffectEnd",
553
+ options: { passive: false },
554
+ callback: (event2) => {
555
+ DragEffect("end", event2);
556
+ EventEnd(event2);
557
+ }
558
+ });
559
+ }
560
+ };
561
+ const DragEffect = function(eventType, event) {
562
+ event.preventDefault();
563
+ __Cropper.dragEffect(__spreadValues({
564
+ eventType
565
+ }, $$.getCursor(event)));
566
+ };
567
+ const EventEnd = function(event) {
568
+ event.preventDefault();
569
+ $$(document).removeEvent([
570
+ "CropperEffectMove",
571
+ "CropperEffectEnd"
572
+ ]);
573
+ };
574
+ $$(Canvas).removeEvent([
575
+ "CropperMouseWheel",
576
+ "CropperTouchStart",
577
+ "CropperMouseDown"
578
+ ]).addEvent({
579
+ eventID: "CropperMouseWheel",
580
+ eventType: "wheel",
581
+ callback: (event) => {
582
+ event.preventDefault();
583
+ let bitScale = Number(event.wheelDelta * 0.04);
584
+ let nextScale = __Cropper.scale.current + bitScale;
585
+ nextScale = Math.max(nextScale, __Cropper.scale.min);
586
+ nextScale = Math.min(nextScale, __Cropper.scale.max);
587
+ set_scale(nextScale);
588
+ },
589
+ options: { passive: false }
590
+ }).addEvent({
591
+ eventType: "touchstart",
592
+ eventID: "CropperTouchStart",
593
+ callback: UserEffectStart,
594
+ options: { passive: false }
595
+ }).addEvent({
596
+ eventType: "mousedown",
597
+ eventID: "CropperMouseDown",
598
+ callback: UserEffectStart,
599
+ options: { passive: false }
600
+ });
601
+ setTimeout(() => {
602
+ Loader.fn.corner.stop();
603
+ }, 1e3);
604
+ }))();
605
+ }, [val_file.id]);
606
+ useEffect(() => {
607
+ var _a;
608
+ let Instance = (_a = useStore.get(val_componentID)) == null ? void 0 : _a.Instance;
609
+ if (Instance) {
610
+ Instance.updateScale(val_scale);
611
+ }
612
+ }, [val_scale]);
613
+ useEffect(() => {
614
+ var _a;
615
+ let Instance = (_a = useStore.get(val_componentID)) == null ? void 0 : _a.Instance;
616
+ if (Instance) {
617
+ Instance.updateFilter({
618
+ grayScale: val_grayScale,
619
+ tone: val_tone,
620
+ rotate: val_rotate
621
+ });
622
+ }
623
+ }, [val_grayScale, val_tone, val_rotate]);
624
+ return /* @__PURE__ */ jsx(Sheet.Comps.Body, { children: /* @__PURE__ */ jsxs(
625
+ Flex,
626
+ {
627
+ className: [
628
+ CropperClasses("Wrap"),
629
+ CropperClasses("Use_" + use)
630
+ ].join(" "),
631
+ flexWrap: false,
632
+ position: "relative",
633
+ overflow: "hidden",
634
+ borderRadius: "inherit",
635
+ boxShadow: "3.remark",
636
+ UnderBreakPointStyles: {
637
+ flexType: "col"
638
+ },
639
+ children: [
640
+ /* @__PURE__ */ jsx(
641
+ Box,
642
+ {
643
+ flexGrid: 3,
644
+ UnderBreakPointStyles: {
645
+ width: 1,
646
+ padding: 2
647
+ },
648
+ children: /* @__PURE__ */ jsx(
649
+ Box,
650
+ {
651
+ overflow: "hidden",
652
+ position: "relative",
653
+ backgroundColor: "4.layer.darken",
654
+ freeCSS: {
655
+ zIndex: 1
656
+ },
657
+ UnderBreakPointStyles: {
658
+ borderRadius: "1.tone.primary"
659
+ },
660
+ children: /* @__PURE__ */ jsx(
661
+ "canvas",
662
+ {
663
+ width: "2400",
664
+ height: use == "wallpaper.horizontal" ? "1800" : use == "wallpaper.vertical" ? "3200" : "2400",
665
+ className: CropperClasses("Canvas"),
666
+ id: "Canvas-" + val_componentID
667
+ }
668
+ )
669
+ }
670
+ )
671
+ }
672
+ ),
673
+ /* @__PURE__ */ jsxs(
674
+ Column,
675
+ {
676
+ gap: 0,
677
+ flexGrid: 2,
678
+ boxShadow: "3.remark",
679
+ UnderBreakPointStyles: {
680
+ width: 1,
681
+ maxWidth: "unset"
682
+ },
683
+ freeCSS: {
684
+ maxWidth: 12 * 28
685
+ },
686
+ children: [
687
+ /* @__PURE__ */ jsxs(
688
+ Column,
689
+ {
690
+ gap: 1,
691
+ flexSizing: 0,
692
+ overflow: "auto",
693
+ padding: 1.5,
694
+ UnderBreakPointStyles: {
695
+ flexSizing: "none"
696
+ },
697
+ children: [
698
+ /* @__PURE__ */ jsx(
699
+ Box,
700
+ {
701
+ flexSizing: "none",
702
+ fontSize: "4.thirdTitle",
703
+ isSemiBoldFont: true,
704
+ children: "\u30D5\u30A3\u30EB\u30BF\u30FC"
705
+ }
706
+ ),
707
+ /* @__PURE__ */ jsx(
708
+ Comps.SettingRegion,
709
+ {
710
+ DefaultOptions,
711
+ val_scale,
712
+ set_scale,
713
+ val_tone,
714
+ set_tone,
715
+ val_grayScale,
716
+ set_grayScale,
717
+ val_rotate,
718
+ set_rotate
719
+ }
720
+ )
721
+ ]
722
+ }
723
+ ),
724
+ /* @__PURE__ */ jsxs(
725
+ Flex,
726
+ {
727
+ padding: 1.5,
728
+ flexSizing: "none",
729
+ gap: 1,
730
+ borderTop: true,
731
+ children: [
732
+ /* @__PURE__ */ jsx(
733
+ Button.Button.Border.R,
734
+ {
735
+ onClick: () => {
736
+ abortCallback();
737
+ },
738
+ children: "\u30AD\u30E3\u30F3\u30BB\u30EB"
739
+ }
740
+ ),
741
+ /* @__PURE__ */ jsx(
742
+ Button.Button.Prime.R,
743
+ {
744
+ flexSizing: 0,
745
+ onClick: () => __async(void 0, null, function* () {
746
+ var _a;
747
+ let Instance = (_a = useStore.get(val_componentID)) == null ? void 0 : _a.Instance;
748
+ if (!Instance)
749
+ return;
750
+ Loader.fn.mini.active("CropperExportation");
751
+ let Files = yield Instance.export();
752
+ setTimeout(() => {
753
+ Loader.fn.mini.stop("CropperExportation");
754
+ finishedCallback(Files);
755
+ }, 3e3);
756
+ }),
757
+ children: /* @__PURE__ */ jsxs(
758
+ Row.Center,
759
+ {
760
+ gap: "1/2",
761
+ children: [
762
+ /* @__PURE__ */ jsx(
763
+ Loader.White.R,
764
+ {
765
+ loaderID: "CropperExportation"
766
+ }
767
+ ),
768
+ "\u6C7A\u5B9A"
769
+ ]
770
+ }
771
+ )
772
+ }
773
+ )
774
+ ]
775
+ }
776
+ )
777
+ ]
778
+ }
779
+ )
780
+ ]
781
+ }
782
+ ) });
783
+ },
784
+ SettingRegion: (params) => {
785
+ let ToneList = [];
786
+ for (let index = 1; index <= 10; index++) {
787
+ ToneList.push({
788
+ value: index,
789
+ label: /* @__PURE__ */ jsxs(Fragment, { children: [
790
+ /* @__PURE__ */ jsx(
791
+ Box,
792
+ {
793
+ className: [
794
+ CropperClasses("ToneBall"),
795
+ CropperClasses("ToneBall_" + index)
796
+ ].join(" ")
797
+ }
798
+ ),
799
+ /* @__PURE__ */ jsx(
800
+ Box,
801
+ {
802
+ textAlign: "center",
803
+ flexSizing: "auto",
804
+ children: ["", "\u6696\u8272", "\u5BD2\u8272", "\u30BB\u30D4\u30A2", "\u30B7\u30A2\u30F3", "\u30DE\u30BC\u30F3\u30BF", "\u30A4\u30A8\u30ED\u30FC", "\u30AA\u30EA\u30B8\u30CA\u30EB1", "\u30AA\u30EA\u30B8\u30CA\u30EB2", "\u30AA\u30EA\u30B8\u30CA\u30EB3", "\u30AA\u30EA\u30B8\u30CA\u30EB4"][index]
805
+ }
806
+ )
807
+ ] })
808
+ });
809
+ }
810
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
811
+ /* @__PURE__ */ jsxs(Column, { gap: "1/3", children: [
812
+ /* @__PURE__ */ jsxs(Box, { children: [
813
+ /* @__PURE__ */ jsx(
814
+ FAI.Rotate,
815
+ {
816
+ fontSize: "3.paragraph",
817
+ fontColor: "4.thin"
818
+ }
819
+ ),
820
+ " Rotate"
821
+ ] }),
822
+ /* @__PURE__ */ jsxs(
823
+ Row.Separate,
824
+ {
825
+ flexChilds: "even",
826
+ paddingLeft: 2,
827
+ children: [
828
+ /* @__PURE__ */ jsxs(
829
+ Button.Button.Border.S,
830
+ {
831
+ onClick: () => {
832
+ let next = params.val_rotate - 90;
833
+ if (next < 0)
834
+ next += 360;
835
+ params.set_rotate(next);
836
+ },
837
+ children: [
838
+ /* @__PURE__ */ jsx(FAI, { icon: faRotateLeft }),
839
+ " \u5DE6\u306B\u56DE\u8EE2"
840
+ ]
841
+ }
842
+ ),
843
+ /* @__PURE__ */ jsxs(
844
+ Button.Button.Border.S,
845
+ {
846
+ onClick: () => {
847
+ params.set_rotate((params.val_rotate + 90) % 360);
848
+ },
849
+ children: [
850
+ "\u53F3\u306B\u56DE\u8EE2 ",
851
+ /* @__PURE__ */ jsx(FAI, { icon: faRotateRight })
852
+ ]
853
+ }
854
+ )
855
+ ]
856
+ }
857
+ )
858
+ ] }),
859
+ /* @__PURE__ */ jsxs(Column, { gap: "1/3", children: [
860
+ /* @__PURE__ */ jsxs(Box, { children: [
861
+ /* @__PURE__ */ jsx(
862
+ FAI.Search,
863
+ {
864
+ fontSize: "3.paragraph",
865
+ fontColor: "4.thin"
866
+ }
867
+ ),
868
+ " Zoom"
869
+ ] }),
870
+ /* @__PURE__ */ jsx(Box, { paddingLeft: 2, children: /* @__PURE__ */ jsx(
871
+ Input.Slider,
872
+ {
873
+ override: "force",
874
+ value: params.val_scale - 100,
875
+ min: params.DefaultOptions.scale.min - 100,
876
+ max: params.DefaultOptions.scale.max - 100,
877
+ step: 25,
878
+ onUpdateValidValue: ({ eventType, value }) => {
879
+ $$.interval.clear("Cropper.UpdateScale");
880
+ $$.interval.standBy("Cropper.UpdateScale", 400, () => {
881
+ params.set_scale(value + 100);
882
+ });
883
+ },
884
+ legends: {
885
+ enable: true,
886
+ custom: (value) => {
887
+ let scale = Math.round(100 + value);
888
+ return "x" + scale / 100;
889
+ }
890
+ }
891
+ }
892
+ ) })
893
+ ] }),
894
+ /* @__PURE__ */ jsxs(Column, { gap: "1/3", children: [
895
+ /* @__PURE__ */ jsxs(Box, { children: [
896
+ /* @__PURE__ */ jsx(
897
+ FAI,
898
+ {
899
+ icon: faPalette,
900
+ fontSize: "3.paragraph",
901
+ fontColor: "4.thin"
902
+ }
903
+ ),
904
+ " Gray Scale"
905
+ ] }),
906
+ /* @__PURE__ */ jsx(Box, { paddingLeft: 2, children: /* @__PURE__ */ jsx(
907
+ Input.Slider,
908
+ {
909
+ value: params.val_grayScale,
910
+ min: 0,
911
+ max: 100,
912
+ step: 10,
913
+ onUpdateValidValue: ({ value }) => {
914
+ $$.interval.clear("Cropper.GrayScale");
915
+ $$.interval.standBy("Cropper.GrayScale", 400, () => {
916
+ params.set_grayScale(value);
917
+ });
918
+ },
919
+ legends: {
920
+ enable: true,
921
+ custom: (value) => value + "%"
922
+ }
923
+ }
924
+ ) })
925
+ ] }),
926
+ /* @__PURE__ */ jsxs(Column, { gap: "1/3", children: [
927
+ /* @__PURE__ */ jsxs(Box, { children: [
928
+ /* @__PURE__ */ jsx(
929
+ FAI,
930
+ {
931
+ icon: faBarsStaggered,
932
+ fontSize: "3.paragraph",
933
+ fontColor: "4.thin"
934
+ }
935
+ ),
936
+ " Tone"
937
+ ] }),
938
+ /* @__PURE__ */ jsx(Box, { paddingLeft: 2, children: /* @__PURE__ */ jsx(
939
+ Input.Radio,
940
+ {
941
+ value: params.val_tone,
942
+ gap: "1/2",
943
+ cellStyles: {
944
+ isRounded: true,
945
+ borderWidth: 2,
946
+ borderColor: "1.thin",
947
+ padding: "1/2",
948
+ paddingRight: 1,
949
+ fontSize: "1.mini",
950
+ gap: "1/3",
951
+ flexSizing: "auto"
952
+ },
953
+ options: [
954
+ {
955
+ value: 0,
956
+ label: "\u306A\u3057",
957
+ padding: ["1/2", 1],
958
+ flexCenter: true
959
+ },
960
+ ...ToneList
961
+ ],
962
+ onUpdateValidValue: ({ value }) => {
963
+ params.set_tone(value[0]);
964
+ }
965
+ }
966
+ ) })
967
+ ] })
968
+ ] });
969
+ }
970
+ };
971
+ const Cropper = {
972
+ open: (params) => __async(void 0, null, function* () {
973
+ let Image2 = yield Input.Filer.fn.openDialog({
974
+ // accept: 'image/jpeg,image/jpg,image/png,image/gif',
975
+ accept: "image",
976
+ multiple: false
977
+ });
978
+ let sheetID = "CropperImage";
979
+ Sheet.open({
980
+ sheetID,
981
+ type: "normal.middleCenter",
982
+ size: "3L",
983
+ freeCSS: {
984
+ width: params.use == "wallpaper.horizontal" ? 12 * 100 : 12 * 80
985
+ },
986
+ content: /* @__PURE__ */ jsx(
987
+ Comps.Core,
988
+ {
989
+ val_file: Image2[0],
990
+ options: params,
991
+ finishedCallback: (files) => {
992
+ Sheet.close(sheetID);
993
+ params.onProcessFinished(files);
994
+ },
995
+ abortCallback: () => {
996
+ Sheet.close(sheetID);
997
+ }
998
+ }
999
+ ),
1000
+ close_option: {
1001
+ escapeKeyDown: false
1002
+ }
1003
+ });
1004
+ })
1005
+ };
1006
+ export {
1007
+ Cropper,
1008
+ Cropper as default
1009
+ };