@armco/imageeditor 0.0.1 → 0.0.3
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/cjs/Control-chunk.js +1 -3
- package/cjs/Control.js +1 -1
- package/cjs/ImageEditor.js +3 -3
- package/es/Control-chunk.js +200 -497
- package/es/Control.js +3 -2
- package/es/ImageEditor.js +31 -30
- package/package.json +1 -1
package/cjs/Control-chunk.js
CHANGED
|
@@ -1,3 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
2
|
-
<rect width="20" height="20" x="2" y="2" fill="none" stroke="#000" stroke-width="2"rx="2"></rect>
|
|
3
|
-
</svg>`,H.SVG).querySelector("svg"),Mt=/^[a-zA-Z]{2,3}[./][a-zA-Z0-9]+$/,Nt=t=>typeof t=="object"?u.raw:t.startsWith("data:image/svg+xml;base64,")?u.b64:t.startsWith("<svg")?u.svgString:t.startsWith("http://")||t.startsWith("https://")?u.URL:Mt.test(t)?u.identifier:u.b64,_=t=>{try{const e=st.parseFromString(t,H.SVG).querySelector("svg");return console.warn("Parsed item isn't an svg"),e===null?L:e}catch(e){return console.warn("Error parsing SVG string:",e),L}},At=t=>{try{const e=atob(t);return _(e)}catch(e){return console.error("Error decoding base64 SVG string:",e),L}},jt=t=>{const e=o=>{const r=Array.from(o.children).map(e),a=Array.from(o.attributes).reduce((i,n)=>(i[n.name]=n.value,i),{});return h.createElement(o.tagName,a,...r)};return e(t)},Ht=(t,e)=>{const{attributes:o,theme:r}=t,{colors:a}=o||{},{strokeColor:i,toggleStrokeColor:n,hoverStrokeColor:c,darkStrokeColor:s,darkToggleStrokeColor:l,darkHoverStrokeColor:d}=a||{},{hovered:g,toggled:O}=e;return r===q.DARK1?g&&d?d:O&&l?l:s:g&&c?c:O&&n?n:i},Ft=(t,e)=>{const{attributes:o,theme:r}=t,{colors:a}=o||{},{fillColor:i,toggleFillColor:n,hoverFillColor:c,darkFillColor:s,darkToggleFillColor:l,darkHoverFillColor:d}=a||{},{hovered:g,toggled:O}=e;return r===q.DARK1?g&&d?d:O&&l?l:s:g&&c?c:O&&n?n:i},Gt=(t,e,o)=>{if(!(t instanceof SVGSVGElement))return;const{attributes:r,hoverShadow:a}=e,{strokeWidth:i,styles:n}=r||{},c=((r==null?void 0:r.classes)||"")+(a?" hover-shadow p-1":""),s=Ft(e,o),l=Ht(e,o),d=(r==null?void 0:r.height)||(typeof(n==null?void 0:n.height)=="number"?typeof(n==null?void 0:n.height)+"px":typeof(n==null?void 0:n.height))||(r==null?void 0:r.size)||"1rem",g=(r==null?void 0:r.width)||(typeof(n==null?void 0:n.width)=="number"?typeof(n==null?void 0:n.width)+"px":typeof(n==null?void 0:n.width))||(r==null?void 0:r.size)||"1rem";s&&t.setAttribute("fill",s),l&&t.setAttribute("stroke",l),i&&t.setAttribute("stroke-width",i),t.setAttribute("width",g),t.setAttribute("height",d),t.setAttribute("class",`ar-Icon${c?" "+c:""}`),n&&Object.assign(t.style,n)};(function(){try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".ar-Icon{transition:all .3s}.ar-Icon:hover.hover-shadow{box-shadow:0 4px 8px var(--ar-shadow)}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();const Bt={development:"http://localhost:5000/api",production:"https://api.armco.tech"},it={development:"http://localhost:5001/api",production:"https://static.armco.tech"};`${it[process.env.NODE_ENV]}`;class at{constructor(e,o,r){this.message=e,this.status=o,this.extras=r}}const Dt=10;async function Vt(t,e,o){const r=lt(t,e);return o={method:"GET",mode:"cors",credentials:"include",...o},ct(r,o)}async function Ut(t,e,o){let r=lt(t,e);const a=process.env.NODE_ENV||"development",i=r.startsWith("http")?"":it[a];return r=i?i+r:r,o={method:"GET",mode:"cors",credentials:"include",...o},ct(r,o)}async function ct(t,e){const o=process.env.NODE_ENV||"development",r=t.startsWith("http")?"":Bt[o],a=e==null?void 0:e.extras;t=r?r+t:t,e.headers||(e.headers={}),e.toggleLoader&&e.toggleLoader({[t]:!0}),e.headers.Origin=window.location.protocol+"//"+window.location.host;const i=await fetch(t,e),{ok:n,status:c,headers:s}=i;if(n){if(s.get("content-type")){if(s.get("content-type").indexOf("application/json")!==-1){const g=await i.json();return e.toggleLoader&&e.toggleLoader({[t]:!1}),{status:c,body:g,headers:s}}else if(s.get("content-type").indexOf("application/zip")!==-1||s.get("content-type").indexOf("image/png")!==-1||s.get("content-type").indexOf("application/pdf")!==-1||s.get("content-type").indexOf("video/mp4")!==-1||s.get("content-type").indexOf("image/gif")!==-1){const g=await i.blob();return e.toggleLoader&&e.toggleLoader({[t]:!1}),{status:c,body:g,headers:s}}}const d=await i.text();return e.toggleLoader&&e.toggleLoader({[t]:!1}),{status:c,body:d,headers:s}}const l=await i.json();throw e.toggleLoader&&e.toggleLoader({[t]:!1}),console.log(l),new at(l.error||l.message,c,a)}function lt(t,e){if(!e)return t||"";const o=Object.keys(e).length;return t&&o?Object.keys(e).filter(r=>e[r]!==void 0).reduce((r,a,i)=>r.concat(`${encodeURIComponent(a)}=${encodeURIComponent(e[a]).replace(/'/g,"%27")}`+(i<o-1?"&":"")),t+"?"):""}async function zt(t,e={}){let{retryDescriptor:o=[1,3,5],maxAttempts:r=5,onRetry:a,onSuccess:i,onFailure:n}=e;r=Math.min(r,Dt);let c=0;const s=async()=>{try{const l=await t();return i&&i(),l}catch(l){if(c<Math.min(o.length,r)){const d=o[c]*1e3;return c++,a&&a(c,d),console.warn(`Retrying in ${d/1e3} seconds...`),await new Promise(g=>setTimeout(g,d)),s()}else{const d=new at("Max retries reached",500,l);throw n&&n(d),d}}};return s()}var dt=(t=>(t.LIGHT1="th-light-1",t.DARK1="th-dark-1",t))(dt||{});function Wt(){let t=!1;return function(e){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(e.substr(0,4)))&&(t=!0)}(navigator.userAgent||navigator.vendor||"opera"in window&&window.opera),t}h.createContext({slotted:[]});const _t=h.createContext({theme:dt.DARK1,drawerState:{collapsed:Wt()},notify:()=>{},setDrawerState:()=>{},setLeftPanelContent:()=>{},setLoggedIn:()=>{},setModalState:()=>{},setRightPanelContent:()=>{},setTheme:()=>{},setUser:()=>{}}),qt=()=>{const t=h.useContext(_t);if(!t)throw new Error("useTheme must be used within an ArProvider");return{theme:t.theme,setTheme:t.setTheme}},Kt=t=>e=>{const{theme:o,setTheme:r}=qt();return v.jsx(t,{...e,theme:o,setTheme:r})},N={};class Xt extends h.Component{constructor(e){super(e),this.parseIconDescriptor=o=>{var r,a,i;const n=typeof o=="object"&&"source"in o,c=n&&!!u[o.type];let s=n?o.source:o;const l=c?o.type:Nt(s);let d;if(l===u.identifier||l===u.URL){s=s;const g=l===u.URL?s:s.replace(/./g,"/"),O=()=>(l===u.URL?Vt:Ut)(g);if(N[s])N[s].icon?this.setState({juice:N[s].icon??L,type:l}):(r=N[s].promise)==null||r.then(b=>this.handleIconResponse(b,s,l));else{const b=zt(O).then(A=>(this.handleIconResponse(A,s,l),A));N[s]={promise:b}}}else{switch(l){case u.b64:d=At(s);break;case u.raw:d=v.jsx("img",{src:s,alt:"ar-icon",className:`ar-Icon ${(a=this.props.attributes)==null?void 0:a.classes}${this.props.hoverShadow?" hover-shadow p-1":""}`,style:(i=this.props.attributes)==null?void 0:i.styles});break;case u.svgString:d=_(s);break;default:console.error("Unsupported icon type."),d=L}d&&this.setState({juice:d,type:l})}},this.handleMouseEnter=()=>{var o,r;this.setState({hovered:!0}),(r=(o=this.props.events)==null?void 0:o.onMouseEnter)==null||r.call(o)},this.handleMouseLeave=()=>{var o,r;this.setState({hovered:!1}),(r=(o=this.props.events)==null?void 0:o.onMouseLeave)==null||r.call(o)},this.state={hovered:!1,toggled:e.toggled||!1,juice:L,type:u.svgString},this.parseIconDescriptor=this.parseIconDescriptor.bind(this),this.handleIconResponse=this.handleIconResponse.bind(this)}componentDidMount(){this.props.icon&&this.parseIconDescriptor(this.props.icon)}componentDidUpdate(e){if(JSON.stringify(e.attributes)!==JSON.stringify(this.props.attributes)){const{juice:o}=this.state;o&&Gt(o,this.props,this.state)}}handleIconResponse(e,o,r){var a,i;const n=e.headers.get("content-type");let c;r===u.identifier||n!=null&&n.includes(H.SVG)?c=_(e.body):n&&Object.values(H).findIndex(s=>n.includes(s))>-1?c=v.jsx("img",{src:o,alt:"ar-icon",className:`ar-Icon ${(a=this.props.attributes)==null?void 0:a.classes}${this.props.hoverShadow?" hover-shadow p-1":""}`,style:(i=this.props.attributes)==null?void 0:i.styles}):(console.error("Unsupported content type."),c=L),c&&this.setState({juice:c,type:r}),N[o].icon=c}render(){var e;const{juice:o,type:r}=this.state;return o?r===u.raw?o:h.cloneElement(jt(o),{onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onClick:(e=this.props.events)==null?void 0:e.onClick,onClickCapture:()=>this.setState({toggled:!this.state.toggled})}):null}}const ht=Kt(Xt),Jt=({icon:t,handler:e,tooltip:o})=>v.jsxs(nt,{children:[v.jsx("span",{className:"mx-3 p-1 cursor-pointer",slot:D.ANCHOR,children:v.jsx(ht,{icon:t,attributes:{colors:{fillColor:"#ffffff99"},classes:"cursor-pointer",size:"2rem"},events:{onClick:e}})}),v.jsx("span",{slot:D.POPOVER,children:o})]});exports.B=ht;exports.Control=Jt;exports.L=D;exports.v=nt;
|
|
1
|
+
"use strict";const g=require("react/jsx-runtime"),s=require("react"),lt=require("react-dom"),ut=require("@armco/icon");var y=(t=>(t.POPOVER="popover",t.ANCHOR="anchor",t))(y||{}),F=(t=>(t.POPOVER="popover",t.ANCHOR="anchor",t))(F||{}),N=(t=>(t.FADEINOUT="fade",t.EXPANDSHRINK="expand-shrink",t))(N||{}),z=(t=>(t.TOPLEFT="top-left",t.TOPRIGHT="top-right",t.TOPCENTER="top-center",t.RIGHTTOP="right-top",t.RIGHTBOTTOM="right-bottom",t.RIGHTCENTER="right-center",t.BOTTOMLEFT="bottom-left",t.BOTTOMRIGHT="bottom-right",t.BOTTOMCENTER="bottom-center",t.LEFTTOP="left-top",t.LEFTBOTTOM="left-bottom",t.LEFTCENTER="left-center",t.BOTTOM="bottom",t.RIGHT="right",t.LEFT="left",t.TOP="top",t.AUTO="auto",t))(z||{}),w=(t=>(t.HOVER="hover",t.CLICK="click",t))(w||{}),d=(t=>(t.TOPLEFT="top-left",t.TOPRIGHT="top-right",t.TOPCENTER="top-center",t.RIGHTTOP="right-top",t.RIGHTBOTTOM="right-bottom",t.RIGHTCENTER="right-center",t.BOTTOMLEFT="bottom-left",t.BOTTOMRIGHT="bottom-right",t.BOTTOMCENTER="bottom-center",t.LEFTTOP="left-top",t.LEFTBOTTOM="left-bottom",t.LEFTCENTER="left-center",t.BOTTOM="bottom",t.RIGHT="right",t.LEFT="left",t.TOP="top",t.AUTO="auto",t))(d||{});const at=window.getComputedStyle(document.documentElement),C=parseFloat(at.fontSize),B=7;function ht(t){if(t){const e=document.querySelector(".ar-Editor__frame");if(e)return e.contentDocument}return document}function J(t){if(t){const e=document.querySelector(".ar-Editor__frame");if(e)return e.contentWindow}return window}function dt(t,e,o,c){const n=J(c)||window;if({bottom:e.top+e.height+o.height>n.innerHeight,right:e.left+e.width+o.width>n.innerWidth,left:e.left-o.width<0,top:e.top-o.height<0}[t])return!1;if(t==="left"||t==="right"){if(C>e.top||C>e.bottom)return!1}else if(C>e.left||C>e.right)return!1;return t}function ft(t,e,o,c,n){const l={[d.BOTTOM]:{top:e.top+e.height+(c?0:B)+(n||0),left:e.left+(e.width-o.width)/2},[d.RIGHT]:{top:e.top+(e.height-o.height)/2,left:e.left+e.width+(c?0:B)},[d.LEFT]:{top:e.top+(e.height-o.height)/2,left:e.left-o.width-(c?0:B)},[d.TOP]:{top:e.top-o.height-(c?0:B)-(n||0),left:e.left+(e.width-o.width)/2}};let{left:r,top:a}=l[t];return t===d.BOTTOM||t===d.TOP?(r<0&&(r=C),r+o.width>window.innerWidth&&(r=`calc(100% - ${o.width}px - ${C}px)`)):(a<0&&(a=C),a+o.height>window.innerHeight&&(a=`calc(100% - ${o.height}px - ${C}px)`)),{left:r,top:a}}function Tt(t,e,o,c){if(o&&o!==d.AUTO)return o;const n=[d.BOTTOM,d.RIGHT,d.LEFT,d.TOP];for(const l of n)if(dt(l,t,e,c))return l;return d.BOTTOM}function pt(t,e,o,c,n,l,r){const a=J(l)||window;t=n?{left:n[0],x:n[0],top:n[1],y:n[1],height:0,width:0,right:a.screen.width-n[0],bottom:a.screen.height-n[1],toJSON:()=>{}}:t;const h=Tt(t,e,o,l),{left:p,top:m}=ft(h,t,e,c,r);return{leftTop:{top:(""+m).startsWith("calc")?m:m+"px",left:(""+p).startsWith("calc")?p:p+"px"},position:h}}const Ot=t=>{const{children:e,classes:o,container:c,demo:n,styles:l}=t,[r,a]=s.useState();return s.useEffect(()=>(a(c||document.createElement("div")),()=>a(null)),[c]),s.useEffect(()=>{if(r){const h=ht(n);if(h){const p=h.getElementById("root");p&&p.appendChild(r)}return()=>{if(h){const p=h.getElementById("root");p&&p.removeChild(r)}}}},[r,n]),s.useEffect(()=>{r&&(o&&(r.className=o),r.classList.contains("ar-Portal")||r.classList.add("ar-Portal"),l&&Object.assign(r.style,l))},[o,l,r]),r?lt.createPortal(e,r):null};let mt=!1;const gt={left:"right",right:"left",top:"bottom",bottom:"top"},Et={left:"135",right:"-45",top:"-135",bottom:"45"},Rt=t=>{const{classes:e,children:o,closeOnSelfClick:c,contentClasses:n,contentMatchAnchorWidth:l,demo:r,disabled:a,hideMarker:h,invertBg:p,isOpen:m,isRaw:Q,onAnchorClick:G,onClose:P,popAtPointer:j,position:$=z.AUTO,preserveMarkerSpace:D,stretch:Z,topOffset:_,trigger:v=w.CLICK,animation:x,updateTriggers:tt,wrapText:et,...ot}=t,f=s.useMemo(()=>x&&!Array.isArray(x)?[x]:x,[x]),H=s.useRef(null),E=s.useRef(null),[R,I]=s.useState(),[rt,nt]=s.useState(),[L,it]=s.useState(),[K,V]=s.useState(),[M,S]=s.useState(),A=s.useRef(),q=s.useRef(0),W=s.useCallback(()=>{if(!H.current||!E.current)return;const i=H.current.getBoundingClientRect();l&&(E.current.style.width=i.width+"px");const u=E.current.getBoundingClientRect();f&&f.length>0&&f.indexOf(N.EXPANDSHRINK)>-1&&(u.width=Math.floor(u.width*1.25),u.height=Math.floor(u.height*1.25));const{leftTop:T,position:O}=pt(i,u,$,h&&!D,j&&v===w.CLICK?A.current:null,r,_);nt(T),it(O)},[l,r,h,j,$,D,_,v,f]);let k,U;return s.Children.forEach(o,i=>{var u,T;((u=i==null?void 0:i.props)==null?void 0:u.slot)===F.ANCHOR&&(U=i),((T=i==null?void 0:i.props)==null?void 0:T.slot)===F.POPOVER&&(k=i)}),s.useEffect(()=>{m!==void 0&&(I(m),m&&!M&&S(!0))},[m,M]),s.useEffect(()=>{var i;let u=T=>{H.current&&!H.current.contains(T.target)&&E.current&&!E.current.contains(T.target)&&(I(!1),P&&P())};if(v===w.CLICK&&R){document.addEventListener("mousedown",u);const T=document.querySelector("iframe");return T&&((i=T.contentWindow)==null||i.document.addEventListener("mousedown",u)),()=>{var O;document.removeEventListener("click",u);const b=document.querySelector("iframe");b&&((O=b.contentWindow)==null||O.document.removeEventListener("click",u))}}},[v,R,P]),s.useEffect(()=>{M&&R&&(W(),V(!0))},[R,M,W,...tt||[]]),s.useEffect(()=>{if(!h&&E.current&&K&&L){const i=E.current,u=H.current.getBoundingClientRect(),T=gt[L],O=i.getBoundingClientRect();f&&f.length>0&&f.indexOf(N.EXPANDSHRINK)>-1&&(O.width=Math.floor(O.width*1.25),O.height=Math.floor(O.height*1.25));const b=L==="top"||L==="bottom";let X=u[b?"width":"height"]/2-7;const st=u.left-O.left+X,ct=u.top-O.top+X;i.style.setProperty("--marker-transform",`rotate(${Et[L]}deg)`),i.style.setProperty(`--marker-${T}`,"-0.35rem"),i.style.setProperty(`--marker-${L}`,"initial"),i.style.setProperty(`--marker-${b?"left":"top"}`,(b?st:ct)+"px"),V(!1)}},[K,E,h,L,A,f]),g.jsxs(g.Fragment,{children:[g.jsx("span",{className:`ar-Popover__anchor${e?" "+e:""}${Z?" w-100":""}`,onMouseDown:i=>{A.current=[i.clientX,i.clientY],Date.now()-q.current<500||(q.current=Date.now(),v===w.CLICK&&!mt&&!a&&(!M&&S(!0),(m===void 0||m)&&setTimeout(()=>I(!R),0)),R&&P&&P(),G&&G(!R))},ref:H,onMouseEnter:()=>{v===w.HOVER&&!a&&(S(!0),setTimeout(()=>I(!0),0))},onMouseLeave:()=>{v===w.HOVER&&!a&&(setTimeout(()=>I(!1),0),P&&P())},...ot,children:U}),k&&M&&g.jsx(Ot,{classes:`position-fixed popover-container${R?" z-3000":" invisible"}`,demo:r,styles:rt||{},children:g.jsx("div",{className:`ar-Popover__content${p?" invert-bg":""}${et?" wrap":""}${$?" "+$:""} ${n}${f&&f.length>0?" transition "+(f==null?void 0:f.join(" ")):""} ${R?" show":""}${h?" hide-marker":""}${Q?"":" p-1 border-radius l2 f25"}`,onClick:()=>c&&I(!1),ref:E,children:k})})]})},Y=t=>{const{children:e,demo:o,...c}=t,[n,l]=s.useState();return g.jsx(Rt,{contentClasses:"overflow-auto",trigger:w.HOVER,onAnchorClick:()=>{l(!1),setTimeout(()=>l(void 0),10)},animation:[N.EXPANDSHRINK,N.FADEINOUT],demo:o,isOpen:n,hideMarker:!0,preserveMarkerSpace:!0,wrapText:!0,...c,children:e})},wt=({icon:t,handler:e,tooltip:o})=>g.jsxs(Y,{children:[g.jsx("span",{className:"mx-3 p-1 cursor-pointer",slot:y.ANCHOR,children:g.jsx(ut,{icon:t,attributes:{colors:{fillColor:"#ffffff99"},classes:"cursor-pointer",size:"2rem"},events:{onClick:e}})}),g.jsx("span",{slot:y.POPOVER,children:o})]});exports.Control=wt;exports.L=y;exports.v=Y;
|
package/cjs/Control.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("react/jsx-runtime");const r=require("./Control-chunk.js");require("react");require("react-dom");module.exports=r.Control;
|
|
1
|
+
"use strict";require("react/jsx-runtime");const r=require("./Control-chunk.js");require("@armco/icon");require("react");require("react-dom");module.exports=r.Control;
|
package/cjs/ImageEditor.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode('.ar-Image{transition:all .3s}.ar-Image.fill{object-fit:cover}.ar-Image.fill.preserveAspectRatio{object-fit:contain}.ar-Slider input[type=range]{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;cursor:pointer}.ar-Slider input[type=range]:hover+.ar-Slider__bubble{opacity:1}.ar-Slider input[type=range]:focus{outline:none}.ar-Slider input[type=range]::-webkit-slider-runnable-track{background-color:#053a5f;border-radius:.2rem;height:.2rem}.ar-Slider input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none;margin-top:-6.5px;transition:outline .5s;background-color:var(--ar-bg-slider-track);height:1rem;width:1rem;border-radius:50%}.ar-Slider input[type=range]::-webkit-slider-thumb:hover{border:5px solid var(--ar-bg-slider-track)}.ar-Slider input[type=range]:focus::-webkit-slider-thumb{border:1px solid #053a5f}.ar-Slider input[type=range]::-moz-range-track{background-color:#053a5f;border-radius:.2rem;height:.2rem}.ar-Slider input[type=range]::-moz-range-thumb{border:none;border-radius:0;background-color:var(--ar-bg-slider-track);height:1rem;width:1rem}.ar-Slider input[type=range]:focus::-moz-range-thumb{border:1px solid #053a5f}.ar-Slider .ar-Slider__bubble{background:#454545;color:#fff;padding:4px 12px;border-radius:4px;left:50%;bottom:-1.5rem;transform:translate(-50%);opacity:0;transition:opacity .3s}.ar-Slider .ar-Slider__bubble:after{content:"";position:absolute;width:4px;height:4px;transform:rotate(45deg);background:#454545;top:-2px;left:50%}.ar-Slider .ar-Slider__manual-input{width:2rem}.ar-ImageEditor .ar-ImageEditor__image-container{max-width:60vw;max-height:75vh}.ar-ImageEditor .ar-ImageEditor__editor-controls{transition:background-color .5s,box-shadow .5s ease-in-out;background-color:var(--ar-bg-tertiary-faded-2);border-radius:2rem}.ar-ImageEditor .ar-ImageEditor__editor-controls:hover{background-color:var(--ar-bg-tertiary-faded)}.ar-ImageEditor .ar-ImageEditor__editor-controls .ar-ImageEditor__download-button{width:2rem;height:2rem;display:inline-block}.ar-ImageEditor .ar-ImageEditor__editor-controls .ar-ImageEditor__download-button:hover{background-color:var(--ar-bg-tertiary-faded-2)}.ar-ImageEditor .ar-ImageEditor__editor-controls .ar-ImageEditor__commit-button{width:2rem;height:2rem;display:inline-block}.ar-ImageEditor .ar-ImageEditor__editor-controls .ar-ImageEditor__commit-button.is-dirty:hover{background-color:var(--ar-bg-tertiary-faded-2)}.ar-ImageEditor .ar-ImageEditor__controls{bottom:0}.ar-ImageEditor .ar-ImageEditor__controls .ar-ImageEditor__controls-container{transition:background-color .5s,box-shadow .5s,max-height .5s ease-in-out;background-color:var(--ar-bg-tertiary-faded-2);max-height:3.2rem;overflow:hidden}.ar-ImageEditor .ar-ImageEditor__controls .ar-ImageEditor__controls-container:hover{background-color:var(--ar-bg-tertiary-faded)}.ar-ImageEditor .ar-ImageEditor__controls .ar-ImageEditor__controls-container.expanded{max-height:20rem}.ar-Portal{z-index:2001;white-space:nowrap}.ar-Popover__anchor:focus-visible{outline:none}:root{--marker-transform: rotate(45deg);--marker-top: -.4rem;--marker-left: 10%;--marker-right: unset;--marker-bottom: unset}:root .ar-Popover__content{box-shadow:0 4px 8px -2px #091e4240,0 0 1px #091e424f;z-index:2002;background-color:var(--ar-bg);white-space:nowrap;position:relative;border:1px solid var(--ar-color-border)}:root .ar-Popover__content>*{position:relative}:root .ar-Popover__content.invert-bg{background-color:var(--ar-bg-invert-1)}:root .ar-Popover__content.wrap{white-space:wrap}:root .ar-Popover__content:not(.hide-marker):before{content:"";background-color:var(--ar-bg);position:absolute;height:.7rem;width:.7rem;border-width:1px;border-style:solid;border-color:var(--ar-color-border) transparent transparent var(--ar-color-border);transform:var(--marker-transform);top:var(--marker-top);left:var(--marker-left);right:var(--marker-right);bottom:var(--marker-bottom)}:root .ar-Popover__content.invert-bg:not(.hide-marker):before{background-color:var(--ar-bg-invert-1)}:root .ar-Popover__content.transition{transition:width .15s ease-in-out,height .15s ease-in-out,opacity .3s ease-in-out,transform .15s ease-in-out}:root .ar-Popover__content.transition.expand-shrink{transform:scale(.8)}:root .ar-Popover__content.transition.show{transform:scale(1)}@media (min-width: 576px){:root .ar-Popover__content{max-width:25vw}}:root .ar-List__item{line-height:1.5rem}:root .ar-List__item:hover{background-color:var(--ar-color-font);color:var(--ar-color-font-invert);cursor:pointer}')),document.head.appendChild(r)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
2
|
-
"use strict";const t=require("react/jsx-runtime"),
|
|
3
|
-
${
|
|
2
|
+
"use strict";const t=require("react/jsx-runtime"),p=require("react"),j=require("./Control-chunk.js"),O=require("@armco/icon"),z=require("./helper.js");require("react-dom");const F=s=>new URL(s).hostname,L=s=>{const d=F(s);return d==="localhost"||d==="armco.tech"?"use-credentials":"anonymous"},k=p.forwardRef((s,d)=>{const{alt:h,blur:c,brightness:g,classes:n,contrast:m,customBgZIndex:r,demo:N,fill:f,flipHorizontal:b,flipVertical:y,grayscale:C,image:i,isBackground:u,opacity:I,preserveAspectRatio:_,rotateBy:e,saturate:o,scale:l,sepia:x,style:v,title:R}=s,a={};l!==void 0&&(a.transform=`scale(${l})`),b&&(a.transform=`scaleX(-${l!==void 0?l:1})`),y&&(a.transform=(a.transform?a.transform+" ":"")+`scaleY(-${l!==void 0?l:1})`),e&&(a.transform=(a.transform?a.transform+" ":"")+`rotate(${e}deg)`),I&&(a.opacity=I),g&&(a.filter=`brightness(${g})`),m&&(a.filter=(a.filter?a.filter+" ":"")+`contrast(${m})`),o&&(a.filter=(a.filter?a.filter+" ":"")+`saturate(${o})`),c&&(a.filter=(a.filter?a.filter+" ":"")+`blur(${c}px)`),C&&(a.filter=(a.filter?a.filter+" ":"")+`grayscale(${C})`),x&&(a.filter=(a.filter?a.filter+" ":"")+`sepia(${x})`),u&&r&&(a.zIndex=`${r} !important`);const E=N?i||"https://picsum.photos/200/300":i;return t.jsx("img",{ref:d,className:`ar-Image
|
|
3
|
+
${f&&!u?" fill w-100 h-100":""}
|
|
4
4
|
${_&&!u?" preserveAspectRatio":""}
|
|
5
5
|
${u?" position-absolute top-0 start-0 h-100 w-100":""}
|
|
6
6
|
${n?" "+n:""}
|
|
7
|
-
`,crossOrigin:
|
|
7
|
+
`,crossOrigin:L(E),src:E,alt:h||"ar-image-placeholder",title:R,style:{...a,...v||{}}})});function S(s,d){const h=+s.value,c=+(s.min?s.min:0),g=+(s.max?s.max:100),n=Number((h-c)*100/(g-c));d.innerHTML=""+h;const m=-(n/100*16)+8;d.style.left=`calc(${n}% + ${m}px)`}const A=s=>{const{assistiveContent:d,classes:h,containerClasses:c,focussed:g,id:n,label:m,name:r,size:N,onBlur:f,onChange:b,onFocus:y,precision:C,type:i,value:u,withManual:I,..._}=s,e=p.useRef(null),o=p.useRef(null),[l,x]=p.useState();return p.useEffect(()=>{e.current&&o.current&&S(e.current,o.current),e.current&&e.current.addEventListener("input",()=>{e.current&&o.current&&S(e.current,o.current)})},[]),p.useEffect(()=>{u!==l&&x(u)},[u]),t.jsx("div",{className:`ar-Slider w-100${c?" "+c:""}`,children:t.jsxs("div",{className:"ar-Slider__control flex-v-center position-relative justify-content-between",children:[m&&t.jsx("label",{className:"me-3",htmlFor:n,children:t.jsx("strong",{children:m})}),t.jsxs("div",{className:"ar-Slider__slider-bar flex-center",children:[t.jsx("div",{className:"d-inline-block me-2",children:_.min}),t.jsxs("div",{className:"position-relative",children:[t.jsx("input",{ref:e,id:n,name:r||n,type:"range",className:`ar-TextInput__input h-100 py-2${h?" "+h:""}`,onChange:v=>{x(v.target.value),b&&b(v)},onFocus:y,onBlur:f,value:l,step:C,..._}),l&&t.jsx("output",{ref:o,className:"ar-Slider__bubble position-absolute",htmlFor:n})]}),t.jsx("div",{className:"d-inline-block ms-2",children:_.max}),I&&t.jsx("input",{className:"ar-Slider__manual-input",type:"text",value:l,onChange:v=>{x(v.target.value),b&&b(v)},title:"Maunal Value"})]})]})})};let $={rotateBy:0,brightness:1,contrast:1,saturate:1,grayscale:0,blur:0,sepia:0,opacity:1,scale:1};const w=s=>(s%360+360)%360,B=22.5,H=s=>{const{image:d,imageState:h,onChange:c,onCommit:g,viewOnly:n}=s;$={...$,...h};const m=p.useRef(null),[r,N]=p.useState({...$}),[f,b]=p.useState(),[y,C]=p.useState(),i=(e,o)=>{const l={...r,[e]:o},{rotateBy:x,...v}=l,{rotateBy:R,...a}=$;x!==void 0&&R!==void 0&&C(JSON.stringify(v)!==JSON.stringify(a)||w(x)!==w(R)),N(l),c&&c(l)},u=[{icon:"tb.TbFlipHorizontal",handler:()=>i("flipHorizontal",!r.flipHorizontal),tooltip:"Flip Horizontal"},{icon:"tb.TbFlipVertical",handler:()=>i("flipVertical",!r.flipVertical),tooltip:"Flip Vertical"},{icon:"ai.AiOutlineRotateLeft",handler:()=>i("rotateBy",r.rotateBy-B),tooltip:"Rotate Left"},{icon:"ai.AiOutlineRotateRight",handler:()=>i("rotateBy",r.rotateBy+B),tooltip:"Rotate Right"},{icon:"fi.FiZoomIn",handler:()=>i("scale",(r.scale+1)%10),tooltip:"Zoom In"},{icon:"fi.FiZoomOut",handler:()=>i("scale",(r.scale-1<0?0:r.scale-1)%10),tooltip:"Zoom Out"},{icon:f?"md.MdOutlineExpandLess":"md.MdOutlineExpandMore",handler:()=>b(!f),tooltip:f?"Hide Advanced Controls":"Show Advanced Controls"}],I=[{icon:"fi.FiZoomIn",handler:()=>N({...r,scale:(r.scale+1)%10}),tooltip:"Zoom In"},{icon:"fi.FiZoomOut",handler:()=>N({...r,scale:(r.scale-1<0?0:r.scale-1)%10}),tooltip:"Zoom Out"}],_=[[{label:"Brightness",min:0,max:5,precision:.1,handler:e=>i("brightness",+e.target.value)},{label:"Contrast",min:0,max:5,precision:.1,handler:e=>i("contrast",+e.target.value)}],[{label:"Saturation",min:0,max:10,precision:.2,handler:e=>i("saturate",+e.target.value)},{label:"Grayscale",min:0,max:1,precision:.05,handler:e=>i("grayscale",+e.target.value)}],[{label:"Blur",min:0,max:20,handler:e=>i("blur",+e.target.value)},{label:"Sepia",min:0,max:1,precision:.05,handler:e=>i("sepia",+e.target.value)}],[{label:"Opacity",min:0,max:1,precision:.05,handler:e=>i("opacity",+e.target.value)},{label:"Scale",min:0,max:10,precision:.2,handler:e=>i("scale",+e.target.value)}]];return t.jsxs("div",{className:"ar-ImageEditor d-flex flex-column h-100 overflow-auto flex-center position-relative",children:[!n&&t.jsxs("div",{className:"ar-ImageEditor__editor-controls position-absolute p-1 top-0 end-0 hover-shadow-dark",children:[t.jsxs(j.v,{children:[t.jsx("span",{className:"ar-ImageEditor__download-button cursor-pointer border-radius-50 p-1 me-2",slot:j.L.ANCHOR,children:t.jsx(O,{icon:"md/MdDownload",attributes:{colors:{fillColor:"#232323cc"},size:"1.5rem"},events:{onClick:()=>z.downloadEditedImage(m.current)}})}),t.jsx("span",{slot:j.L.POPOVER,children:"Download"})]}),t.jsxs(j.v,{children:[t.jsx("span",{className:`ar-ImageEditor__commit-button border-radius-50 p-1${y?" cursor-pointer is-dirty":""}`,slot:j.L.ANCHOR,children:t.jsx(O,{icon:"io5.IoCheckmarkCircleSharp",slot:j.L.ANCHOR,attributes:{colors:{fillColor:y?"#008000":"#00800077"},size:"1.5rem"},events:{onClick:()=>y&&g&&g(r)}})}),t.jsx("span",{slot:j.L.POPOVER,children:y?"Save":"Edit image to save"})]})]}),t.jsx("div",{className:"ar-ImageEditor__image-container mb-4",children:t.jsx(k,{ref:m,image:d,fill:!0,preserveAspectRatio:!0,...r})}),t.jsx("div",{className:"ar-ImageEditor__controls py-3 flex-center z-1 position-absolute",children:t.jsxs("div",{className:`ar-ImageEditor__controls-container border-radius prominent hover-shadow-dark${f?" expanded":""}`,children:[t.jsx("div",{className:`ar-ImageEditor__basic-controls px-3 py-2 ${f?"border-bottom":""}`,children:(n?I:u).map(e=>t.jsx(j.Control,{...e}))}),!n&&t.jsx("div",{className:"ar-ImageEditor__advanced-controls mt-2 px-3",children:_.map(e=>t.jsx("div",{className:"row pb-3 border-bottom",children:e.map(o=>t.jsx("div",{className:"col-6",children:t.jsx(A,{label:o.label,min:o.min,max:o.max,onChange:o.handler,precision:o.precision})}))}))})]})})]})};module.exports=H;
|
package/es/Control-chunk.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { jsxs as Y, Fragment as at, jsx as H } from "react/jsx-runtime";
|
|
2
|
+
import { useState as v, useEffect as L, useMemo as dt, useRef as x, useCallback as ut, Children as Tt } from "react";
|
|
3
|
+
import ft from "react-dom";
|
|
4
|
+
import pt from "@armco/icon";
|
|
5
|
+
var G = /* @__PURE__ */ ((t) => (t.POPOVER = "popover", t.ANCHOR = "anchor", t))(G || {}), D = /* @__PURE__ */ ((t) => (t.POPOVER = "popover", t.ANCHOR = "anchor", t))(D || {}), B = /* @__PURE__ */ ((t) => (t.FADEINOUT = "fade", t.EXPANDSHRINK = "expand-shrink", t))(B || {}), Q = /* @__PURE__ */ ((t) => (t.TOPLEFT = "top-left", t.TOPRIGHT = "top-right", t.TOPCENTER = "top-center", t.RIGHTTOP = "right-top", t.RIGHTBOTTOM = "right-bottom", t.RIGHTCENTER = "right-center", t.BOTTOMLEFT = "bottom-left", t.BOTTOMRIGHT = "bottom-right", t.BOTTOMCENTER = "bottom-center", t.LEFTTOP = "left-top", t.LEFTBOTTOM = "left-bottom", t.LEFTCENTER = "left-center", t.BOTTOM = "bottom", t.RIGHT = "right", t.LEFT = "left", t.TOP = "top", t.AUTO = "auto", t))(Q || {}), E = /* @__PURE__ */ ((t) => (t.HOVER = "hover", t.CLICK = "click", t))(E || {}), d = /* @__PURE__ */ ((t) => (t.TOPLEFT = "top-left", t.TOPRIGHT = "top-right", t.TOPCENTER = "top-center", t.RIGHTTOP = "right-top", t.RIGHTBOTTOM = "right-bottom", t.RIGHTCENTER = "right-center", t.BOTTOMLEFT = "bottom-left", t.BOTTOMRIGHT = "bottom-right", t.BOTTOMCENTER = "bottom-center", t.LEFTTOP = "left-top", t.LEFTBOTTOM = "left-bottom", t.LEFTCENTER = "left-center", t.BOTTOM = "bottom", t.RIGHT = "right", t.LEFT = "left", t.TOP = "top", t.AUTO = "auto", t))(d || {});
|
|
6
|
+
const mt = window.getComputedStyle(document.documentElement), w = parseFloat(mt.fontSize), A = 7;
|
|
7
|
+
function Ot(t) {
|
|
7
8
|
if (t) {
|
|
8
9
|
const e = document.querySelector(".ar-Editor__frame");
|
|
9
10
|
if (e)
|
|
@@ -11,7 +12,7 @@ function Mt(t) {
|
|
|
11
12
|
}
|
|
12
13
|
return document;
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
+
function Z(t) {
|
|
15
16
|
if (t) {
|
|
16
17
|
const e = document.querySelector(".ar-Editor__frame");
|
|
17
18
|
if (e)
|
|
@@ -19,600 +20,303 @@ function at(t) {
|
|
|
19
20
|
}
|
|
20
21
|
return window;
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
-
const
|
|
23
|
+
function gt(t, e, o, l) {
|
|
24
|
+
const n = Z(l) || window;
|
|
24
25
|
if ({
|
|
25
|
-
bottom: e.top + e.height + o.height >
|
|
26
|
-
right: e.left + e.width + o.width >
|
|
26
|
+
bottom: e.top + e.height + o.height > n.innerHeight,
|
|
27
|
+
right: e.left + e.width + o.width > n.innerWidth,
|
|
27
28
|
left: e.left - o.width < 0,
|
|
28
29
|
top: e.top - o.height < 0
|
|
29
30
|
}[t])
|
|
30
31
|
return !1;
|
|
31
32
|
if (t === "left" || t === "right") {
|
|
32
|
-
if (
|
|
33
|
+
if (w > e.top || w > e.bottom)
|
|
33
34
|
return !1;
|
|
34
|
-
} else if (
|
|
35
|
+
} else if (w > e.left || w > e.right)
|
|
35
36
|
return !1;
|
|
36
37
|
return t;
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
-
const
|
|
40
|
-
[
|
|
41
|
-
top: e.top + e.height + (
|
|
39
|
+
function Et(t, e, o, l, n) {
|
|
40
|
+
const c = {
|
|
41
|
+
[d.BOTTOM]: {
|
|
42
|
+
top: e.top + e.height + (l ? 0 : A) + (n || 0),
|
|
42
43
|
left: e.left + (e.width - o.width) / 2
|
|
43
44
|
},
|
|
44
|
-
[
|
|
45
|
+
[d.RIGHT]: {
|
|
45
46
|
top: e.top + (e.height - o.height) / 2,
|
|
46
|
-
left: e.left + e.width + (
|
|
47
|
+
left: e.left + e.width + (l ? 0 : A)
|
|
47
48
|
},
|
|
48
|
-
[
|
|
49
|
+
[d.LEFT]: {
|
|
49
50
|
top: e.top + (e.height - o.height) / 2,
|
|
50
|
-
left: e.left - o.width - (
|
|
51
|
+
left: e.left - o.width - (l ? 0 : A)
|
|
51
52
|
},
|
|
52
|
-
[
|
|
53
|
-
top: e.top - o.height - (
|
|
53
|
+
[d.TOP]: {
|
|
54
|
+
top: e.top - o.height - (l ? 0 : A) - (n || 0),
|
|
54
55
|
left: e.left + (e.width - o.width) / 2
|
|
55
56
|
}
|
|
56
57
|
};
|
|
57
|
-
let { left:
|
|
58
|
-
return t ===
|
|
58
|
+
let { left: r, top: h } = c[t];
|
|
59
|
+
return t === d.BOTTOM || t === d.TOP ? (r < 0 && (r = w), r + o.width > window.innerWidth && (r = `calc(100% - ${o.width}px - ${w}px)`)) : (h < 0 && (h = w), h + o.height > window.innerHeight && (h = `calc(100% - ${o.height}px - ${w}px)`)), { left: r, top: h };
|
|
59
60
|
}
|
|
60
|
-
function
|
|
61
|
-
if (o && o !==
|
|
61
|
+
function wt(t, e, o, l) {
|
|
62
|
+
if (o && o !== d.AUTO)
|
|
62
63
|
return o;
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
const n = [
|
|
65
|
+
d.BOTTOM,
|
|
66
|
+
d.RIGHT,
|
|
67
|
+
d.LEFT,
|
|
68
|
+
d.TOP
|
|
68
69
|
];
|
|
69
|
-
for (const
|
|
70
|
-
if (
|
|
71
|
-
return
|
|
72
|
-
return
|
|
70
|
+
for (const c of n)
|
|
71
|
+
if (gt(c, t, e, l))
|
|
72
|
+
return c;
|
|
73
|
+
return d.BOTTOM;
|
|
73
74
|
}
|
|
74
|
-
function
|
|
75
|
-
const
|
|
76
|
-
t =
|
|
77
|
-
left:
|
|
78
|
-
x:
|
|
79
|
-
top:
|
|
80
|
-
y:
|
|
75
|
+
function Rt(t, e, o, l, n, c, r) {
|
|
76
|
+
const h = Z(c) || window;
|
|
77
|
+
t = n ? {
|
|
78
|
+
left: n[0],
|
|
79
|
+
x: n[0],
|
|
80
|
+
top: n[1],
|
|
81
|
+
y: n[1],
|
|
81
82
|
height: 0,
|
|
82
83
|
width: 0,
|
|
83
|
-
right:
|
|
84
|
-
bottom:
|
|
84
|
+
right: h.screen.width - n[0],
|
|
85
|
+
bottom: h.screen.height - n[1],
|
|
85
86
|
toJSON: () => {
|
|
86
87
|
}
|
|
87
88
|
} : t;
|
|
88
|
-
const
|
|
89
|
+
const a = wt(
|
|
89
90
|
t,
|
|
90
91
|
e,
|
|
91
92
|
o,
|
|
92
|
-
|
|
93
|
-
), { left:
|
|
94
|
-
|
|
93
|
+
c
|
|
94
|
+
), { left: f, top: m } = Et(
|
|
95
|
+
a,
|
|
95
96
|
t,
|
|
96
97
|
e,
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
l,
|
|
99
|
+
r
|
|
99
100
|
);
|
|
100
101
|
return {
|
|
101
102
|
leftTop: {
|
|
102
|
-
top: ("" +
|
|
103
|
-
left: ("" +
|
|
103
|
+
top: ("" + m).startsWith("calc") ? m : m + "px",
|
|
104
|
+
left: ("" + f).startsWith("calc") ? f : f + "px"
|
|
104
105
|
},
|
|
105
|
-
position:
|
|
106
|
+
position: a
|
|
106
107
|
};
|
|
107
108
|
}
|
|
108
|
-
const
|
|
109
|
-
const { children: e, classes: o, container:
|
|
110
|
-
return
|
|
111
|
-
if (
|
|
112
|
-
const
|
|
113
|
-
if (
|
|
114
|
-
const
|
|
115
|
-
|
|
109
|
+
const Ct = (t) => {
|
|
110
|
+
const { children: e, classes: o, container: l, demo: n, styles: c } = t, [r, h] = v();
|
|
111
|
+
return L(() => (h(l || document.createElement("div")), () => h(null)), [l]), L(() => {
|
|
112
|
+
if (r) {
|
|
113
|
+
const a = Ot(n);
|
|
114
|
+
if (a) {
|
|
115
|
+
const f = a.getElementById("root");
|
|
116
|
+
f && f.appendChild(r);
|
|
116
117
|
}
|
|
117
118
|
return () => {
|
|
118
|
-
if (
|
|
119
|
-
const
|
|
120
|
-
|
|
119
|
+
if (a) {
|
|
120
|
+
const f = a.getElementById("root");
|
|
121
|
+
f && f.removeChild(r);
|
|
121
122
|
}
|
|
122
123
|
};
|
|
123
124
|
}
|
|
124
|
-
}, [
|
|
125
|
-
|
|
126
|
-
}, [o,
|
|
125
|
+
}, [r, n]), L(() => {
|
|
126
|
+
r && (o && (r.className = o), r.classList.contains("ar-Portal") || r.classList.add("ar-Portal"), c && Object.assign(r.style, c));
|
|
127
|
+
}, [o, c, r]), r ? ft.createPortal(e, r) : null;
|
|
127
128
|
};
|
|
128
|
-
let
|
|
129
|
-
const
|
|
129
|
+
let Pt = !1;
|
|
130
|
+
const vt = {
|
|
130
131
|
left: "right",
|
|
131
132
|
right: "left",
|
|
132
133
|
top: "bottom",
|
|
133
134
|
bottom: "top"
|
|
134
|
-
},
|
|
135
|
+
}, Lt = {
|
|
135
136
|
left: "135",
|
|
136
137
|
right: "-45",
|
|
137
138
|
top: "-135",
|
|
138
139
|
bottom: "45"
|
|
139
|
-
},
|
|
140
|
+
}, Ht = (t) => {
|
|
140
141
|
const {
|
|
141
142
|
classes: e,
|
|
142
143
|
children: o,
|
|
143
|
-
closeOnSelfClick:
|
|
144
|
-
contentClasses:
|
|
145
|
-
contentMatchAnchorWidth:
|
|
146
|
-
demo:
|
|
147
|
-
disabled:
|
|
148
|
-
hideMarker:
|
|
149
|
-
invertBg:
|
|
150
|
-
isOpen:
|
|
151
|
-
isRaw:
|
|
152
|
-
onAnchorClick:
|
|
153
|
-
onClose:
|
|
154
|
-
popAtPointer:
|
|
155
|
-
position:
|
|
156
|
-
preserveMarkerSpace:
|
|
157
|
-
stretch:
|
|
158
|
-
topOffset:
|
|
159
|
-
trigger:
|
|
160
|
-
animation:
|
|
161
|
-
updateTriggers:
|
|
162
|
-
wrapText:
|
|
163
|
-
...
|
|
164
|
-
} = t,
|
|
165
|
-
() =>
|
|
166
|
-
[
|
|
167
|
-
),
|
|
168
|
-
if (!
|
|
144
|
+
closeOnSelfClick: l,
|
|
145
|
+
contentClasses: n,
|
|
146
|
+
contentMatchAnchorWidth: c,
|
|
147
|
+
demo: r,
|
|
148
|
+
disabled: h,
|
|
149
|
+
hideMarker: a,
|
|
150
|
+
invertBg: f,
|
|
151
|
+
isOpen: m,
|
|
152
|
+
isRaw: tt,
|
|
153
|
+
onAnchorClick: _,
|
|
154
|
+
onClose: R,
|
|
155
|
+
popAtPointer: K,
|
|
156
|
+
position: y = Q.AUTO,
|
|
157
|
+
preserveMarkerSpace: V,
|
|
158
|
+
stretch: et,
|
|
159
|
+
topOffset: W,
|
|
160
|
+
trigger: C = E.CLICK,
|
|
161
|
+
animation: $,
|
|
162
|
+
updateTriggers: ot,
|
|
163
|
+
wrapText: rt,
|
|
164
|
+
...nt
|
|
165
|
+
} = t, u = dt(
|
|
166
|
+
() => $ && !Array.isArray($) ? [$] : $,
|
|
167
|
+
[$]
|
|
168
|
+
), I = x(null), O = x(null), [g, M] = v(), [it, lt] = v(), [P, ct] = v(), [U, X] = v(), [b, k] = v(), F = x(), q = x(0), j = ut(() => {
|
|
169
|
+
if (!I.current || !O.current)
|
|
169
170
|
return;
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
const { leftTop:
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
171
|
+
const i = I.current.getBoundingClientRect();
|
|
172
|
+
c && (O.current.style.width = i.width + "px");
|
|
173
|
+
const s = O.current.getBoundingClientRect();
|
|
174
|
+
u && u.length > 0 && u.indexOf(B.EXPANDSHRINK) > -1 && (s.width = Math.floor(s.width * 1.25), s.height = Math.floor(s.height * 1.25));
|
|
175
|
+
const { leftTop: T, position: p } = Rt(
|
|
176
|
+
i,
|
|
177
|
+
s,
|
|
178
|
+
y,
|
|
179
|
+
a && !V,
|
|
180
|
+
K && C === E.CLICK ? F.current : null,
|
|
181
|
+
r,
|
|
182
|
+
W
|
|
182
183
|
);
|
|
183
|
-
|
|
184
|
+
lt(T), ct(p);
|
|
184
185
|
}, [
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
186
|
+
c,
|
|
187
|
+
r,
|
|
188
|
+
a,
|
|
189
|
+
K,
|
|
190
|
+
y,
|
|
191
|
+
V,
|
|
192
|
+
W,
|
|
193
|
+
C,
|
|
194
|
+
u
|
|
194
195
|
]);
|
|
195
|
-
let
|
|
196
|
-
return
|
|
197
|
-
var
|
|
198
|
-
((
|
|
199
|
-
}),
|
|
200
|
-
|
|
201
|
-
}, [
|
|
202
|
-
var
|
|
203
|
-
let
|
|
204
|
-
|
|
196
|
+
let S, z;
|
|
197
|
+
return Tt.forEach(o, (i) => {
|
|
198
|
+
var s, T;
|
|
199
|
+
((s = i == null ? void 0 : i.props) == null ? void 0 : s.slot) === D.ANCHOR && (z = i), ((T = i == null ? void 0 : i.props) == null ? void 0 : T.slot) === D.POPOVER && (S = i);
|
|
200
|
+
}), L(() => {
|
|
201
|
+
m !== void 0 && (M(m), m && !b && k(!0));
|
|
202
|
+
}, [m, b]), L(() => {
|
|
203
|
+
var i;
|
|
204
|
+
let s = (T) => {
|
|
205
|
+
I.current && !I.current.contains(T.target) && O.current && !O.current.contains(T.target) && (M(!1), R && R());
|
|
205
206
|
};
|
|
206
|
-
if (
|
|
207
|
-
document.addEventListener("mousedown",
|
|
208
|
-
const
|
|
209
|
-
return
|
|
210
|
-
var
|
|
211
|
-
document.removeEventListener("click",
|
|
207
|
+
if (C === E.CLICK && g) {
|
|
208
|
+
document.addEventListener("mousedown", s);
|
|
209
|
+
const T = document.querySelector("iframe");
|
|
210
|
+
return T && ((i = T.contentWindow) == null || i.document.addEventListener("mousedown", s)), () => {
|
|
211
|
+
var p;
|
|
212
|
+
document.removeEventListener("click", s);
|
|
212
213
|
const N = document.querySelector("iframe");
|
|
213
|
-
N && ((
|
|
214
|
+
N && ((p = N.contentWindow) == null || p.document.removeEventListener("click", s));
|
|
214
215
|
};
|
|
215
216
|
}
|
|
216
|
-
}, [
|
|
217
|
-
|
|
217
|
+
}, [C, g, R]), L(() => {
|
|
218
|
+
b && g && (j(), X(!0));
|
|
218
219
|
}, [
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
220
|
+
g,
|
|
221
|
+
b,
|
|
222
|
+
j,
|
|
222
223
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
223
|
-
...
|
|
224
|
-
]),
|
|
225
|
-
if (!
|
|
226
|
-
const
|
|
227
|
-
|
|
228
|
-
const N =
|
|
229
|
-
let
|
|
230
|
-
const
|
|
231
|
-
|
|
224
|
+
...ot || []
|
|
225
|
+
]), L(() => {
|
|
226
|
+
if (!a && O.current && U && P) {
|
|
227
|
+
const i = O.current, s = I.current.getBoundingClientRect(), T = vt[P], p = i.getBoundingClientRect();
|
|
228
|
+
u && u.length > 0 && u.indexOf(B.EXPANDSHRINK) > -1 && (p.width = Math.floor(p.width * 1.25), p.height = Math.floor(p.height * 1.25));
|
|
229
|
+
const N = P === "top" || P === "bottom";
|
|
230
|
+
let J = s[N ? "width" : "height"] / 2 - 7;
|
|
231
|
+
const st = s.left - p.left + J, ht = s.top - p.top + J;
|
|
232
|
+
i.style.setProperty(
|
|
232
233
|
"--marker-transform",
|
|
233
|
-
`rotate(${
|
|
234
|
-
),
|
|
235
|
-
`--marker-${
|
|
234
|
+
`rotate(${Lt[P]}deg)`
|
|
235
|
+
), i.style.setProperty(
|
|
236
|
+
`--marker-${T}`,
|
|
236
237
|
"-0.35rem"
|
|
237
|
-
),
|
|
238
|
-
`--marker-${
|
|
238
|
+
), i.style.setProperty(
|
|
239
|
+
`--marker-${P}`,
|
|
239
240
|
"initial"
|
|
240
|
-
),
|
|
241
|
+
), i.style.setProperty(
|
|
241
242
|
`--marker-${N ? "left" : "top"}`,
|
|
242
|
-
(N ?
|
|
243
|
-
),
|
|
243
|
+
(N ? st : ht) + "px"
|
|
244
|
+
), X(!1);
|
|
244
245
|
}
|
|
245
246
|
}, [
|
|
246
|
-
|
|
247
|
+
U,
|
|
247
248
|
O,
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
]), /* @__PURE__ */
|
|
253
|
-
/* @__PURE__ */
|
|
249
|
+
a,
|
|
250
|
+
P,
|
|
251
|
+
F,
|
|
252
|
+
u
|
|
253
|
+
]), /* @__PURE__ */ Y(at, { children: [
|
|
254
|
+
/* @__PURE__ */ H(
|
|
254
255
|
"span",
|
|
255
256
|
{
|
|
256
|
-
className: `ar-Popover__anchor${e ? " " + e : ""}${
|
|
257
|
-
onMouseDown: (
|
|
258
|
-
|
|
257
|
+
className: `ar-Popover__anchor${e ? " " + e : ""}${et ? " w-100" : ""}`,
|
|
258
|
+
onMouseDown: (i) => {
|
|
259
|
+
F.current = [i.clientX, i.clientY], Date.now() - q.current < 500 || (q.current = Date.now(), C === E.CLICK && !Pt && !h && (!b && k(!0), (m === void 0 || m) && setTimeout(() => M(!g), 0)), g && R && R(), _ && _(!g));
|
|
259
260
|
},
|
|
260
|
-
ref:
|
|
261
|
+
ref: I,
|
|
261
262
|
onMouseEnter: () => {
|
|
262
|
-
|
|
263
|
+
C === E.HOVER && !h && (k(!0), setTimeout(() => M(!0), 0));
|
|
263
264
|
},
|
|
264
265
|
onMouseLeave: () => {
|
|
265
|
-
|
|
266
|
+
C === E.HOVER && !h && (setTimeout(() => M(!1), 0), R && R());
|
|
266
267
|
},
|
|
267
|
-
...
|
|
268
|
-
children:
|
|
268
|
+
...nt,
|
|
269
|
+
children: z
|
|
269
270
|
}
|
|
270
271
|
),
|
|
271
|
-
|
|
272
|
-
|
|
272
|
+
S && b && /* @__PURE__ */ H(
|
|
273
|
+
Ct,
|
|
273
274
|
{
|
|
274
|
-
classes: `position-fixed popover-container${
|
|
275
|
-
demo:
|
|
276
|
-
styles:
|
|
277
|
-
children: /* @__PURE__ */
|
|
275
|
+
classes: `position-fixed popover-container${g ? " z-3000" : " invisible"}`,
|
|
276
|
+
demo: r,
|
|
277
|
+
styles: it || {},
|
|
278
|
+
children: /* @__PURE__ */ H(
|
|
278
279
|
"div",
|
|
279
280
|
{
|
|
280
|
-
className: `ar-Popover__content${
|
|
281
|
-
onClick: () =>
|
|
281
|
+
className: `ar-Popover__content${f ? " invert-bg" : ""}${rt ? " wrap" : ""}${y ? " " + y : ""} ${n}${u && u.length > 0 ? " transition " + (u == null ? void 0 : u.join(" ")) : ""} ${g ? " show" : ""}${a ? " hide-marker" : ""}${tt ? "" : " p-1 border-radius l2 f25"}`,
|
|
282
|
+
onClick: () => l && M(!1),
|
|
282
283
|
ref: O,
|
|
283
|
-
children:
|
|
284
|
+
children: S
|
|
284
285
|
}
|
|
285
286
|
)
|
|
286
287
|
}
|
|
287
288
|
)
|
|
288
289
|
] });
|
|
289
|
-
},
|
|
290
|
-
const { children: e, demo: o, ...
|
|
291
|
-
return /* @__PURE__ */
|
|
292
|
-
|
|
290
|
+
}, It = (t) => {
|
|
291
|
+
const { children: e, demo: o, ...l } = t, [n, c] = v();
|
|
292
|
+
return /* @__PURE__ */ H(
|
|
293
|
+
Ht,
|
|
293
294
|
{
|
|
294
295
|
contentClasses: "overflow-auto",
|
|
295
|
-
trigger:
|
|
296
|
+
trigger: E.HOVER,
|
|
296
297
|
onAnchorClick: () => {
|
|
297
|
-
|
|
298
|
+
c(!1), setTimeout(() => c(void 0), 10);
|
|
298
299
|
},
|
|
299
300
|
animation: [
|
|
300
301
|
B.EXPANDSHRINK,
|
|
301
302
|
B.FADEINOUT
|
|
302
303
|
],
|
|
303
304
|
demo: o,
|
|
304
|
-
isOpen:
|
|
305
|
+
isOpen: n,
|
|
305
306
|
hideMarker: !0,
|
|
306
307
|
preserveMarkerSpace: !0,
|
|
307
308
|
wrapText: !0,
|
|
308
|
-
...
|
|
309
|
+
...l,
|
|
309
310
|
children: e
|
|
310
311
|
}
|
|
311
312
|
);
|
|
312
|
-
},
|
|
313
|
-
`<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg">
|
|
314
|
-
<rect width="20" height="20" x="2" y="2" fill="none" stroke="#000" stroke-width="2"rx="2"></rect>
|
|
315
|
-
</svg>`,
|
|
316
|
-
G.SVG
|
|
317
|
-
).querySelector("svg"), zt = /^[a-zA-Z]{2,3}[./][a-zA-Z0-9]+$/, Wt = (t) => typeof t == "object" ? p.raw : t.startsWith("data:image/svg+xml;base64,") ? p.b64 : t.startsWith("<svg") ? p.svgString : t.startsWith("http://") || t.startsWith("https://") ? p.URL : zt.test(t) ? p.identifier : p.b64, q = (t) => {
|
|
318
|
-
try {
|
|
319
|
-
const e = ct.parseFromString(t, G.SVG).querySelector("svg");
|
|
320
|
-
return console.warn("Parsed item isn't an svg"), e === null ? I : e;
|
|
321
|
-
} catch (e) {
|
|
322
|
-
return console.warn("Error parsing SVG string:", e), I;
|
|
323
|
-
}
|
|
324
|
-
}, _t = (t) => {
|
|
325
|
-
try {
|
|
326
|
-
const e = atob(t);
|
|
327
|
-
return q(e);
|
|
328
|
-
} catch (e) {
|
|
329
|
-
return console.error("Error decoding base64 SVG string:", e), I;
|
|
330
|
-
}
|
|
331
|
-
}, Kt = (t) => {
|
|
332
|
-
const e = (o) => {
|
|
333
|
-
const r = Array.from(o.children).map(e), a = Array.from(o.attributes).reduce((s, n) => (s[n.name] = n.value, s), {});
|
|
334
|
-
return xt(o.tagName, a, ...r);
|
|
335
|
-
};
|
|
336
|
-
return e(t);
|
|
337
|
-
}, qt = (t, e) => {
|
|
338
|
-
const { attributes: o, theme: r } = t, { colors: a } = o || {}, {
|
|
339
|
-
strokeColor: s,
|
|
340
|
-
toggleStrokeColor: n,
|
|
341
|
-
hoverStrokeColor: c,
|
|
342
|
-
darkStrokeColor: i,
|
|
343
|
-
darkToggleStrokeColor: l,
|
|
344
|
-
darkHoverStrokeColor: d
|
|
345
|
-
} = a || {}, { hovered: u, toggled: b } = e;
|
|
346
|
-
return r === X.DARK1 ? u && d ? d : b && l ? l : i : u && c ? c : b && n ? n : s;
|
|
347
|
-
}, Xt = (t, e) => {
|
|
348
|
-
const { attributes: o, theme: r } = t, { colors: a } = o || {}, {
|
|
349
|
-
fillColor: s,
|
|
350
|
-
toggleFillColor: n,
|
|
351
|
-
hoverFillColor: c,
|
|
352
|
-
darkFillColor: i,
|
|
353
|
-
darkToggleFillColor: l,
|
|
354
|
-
darkHoverFillColor: d
|
|
355
|
-
} = a || {}, { hovered: u, toggled: b } = e;
|
|
356
|
-
return r === X.DARK1 ? u && d ? d : b && l ? l : i : u && c ? c : b && n ? n : s;
|
|
357
|
-
}, Jt = (t, e, o) => {
|
|
358
|
-
if (!(t instanceof SVGSVGElement))
|
|
359
|
-
return;
|
|
360
|
-
const { attributes: r, hoverShadow: a } = e, { strokeWidth: s, styles: n } = r || {}, c = ((r == null ? void 0 : r.classes) || "") + (a ? " hover-shadow p-1" : ""), i = Xt(e, o), l = qt(e, o), d = (r == null ? void 0 : r.height) || (typeof (n == null ? void 0 : n.height) == "number" ? typeof (n == null ? void 0 : n.height) + "px" : typeof (n == null ? void 0 : n.height)) || (r == null ? void 0 : r.size) || "1rem", u = (r == null ? void 0 : r.width) || (typeof (n == null ? void 0 : n.width) == "number" ? typeof (n == null ? void 0 : n.width) + "px" : typeof (n == null ? void 0 : n.width)) || (r == null ? void 0 : r.size) || "1rem";
|
|
361
|
-
i && t.setAttribute("fill", i), l && t.setAttribute("stroke", l), s && t.setAttribute("stroke-width", s), t.setAttribute("width", u), t.setAttribute("height", d), t.setAttribute("class", `ar-Icon${c ? " " + c : ""}`), n && Object.assign(t.style, n);
|
|
362
|
-
};
|
|
363
|
-
(function() {
|
|
364
|
-
try {
|
|
365
|
-
if (typeof document < "u") {
|
|
366
|
-
var t = document.createElement("style");
|
|
367
|
-
t.appendChild(document.createTextNode(".ar-Icon{transition:all .3s}.ar-Icon:hover.hover-shadow{box-shadow:0 4px 8px var(--ar-shadow)}")), document.head.appendChild(t);
|
|
368
|
-
}
|
|
369
|
-
} catch (e) {
|
|
370
|
-
console.error("vite-plugin-css-injected-by-js", e);
|
|
371
|
-
}
|
|
372
|
-
})();
|
|
373
|
-
const Zt = {
|
|
374
|
-
development: "http://localhost:5000/api",
|
|
375
|
-
production: "https://api.armco.tech"
|
|
376
|
-
}, lt = {
|
|
377
|
-
development: "http://localhost:5001/api",
|
|
378
|
-
production: "https://static.armco.tech"
|
|
379
|
-
};
|
|
380
|
-
`${lt[process.env.NODE_ENV]}`;
|
|
381
|
-
class dt {
|
|
382
|
-
constructor(e, o, r) {
|
|
383
|
-
this.message = e, this.status = o, this.extras = r;
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
const Yt = 10;
|
|
387
|
-
async function Qt(t, e, o) {
|
|
388
|
-
const r = pt(t, e);
|
|
389
|
-
return o = {
|
|
390
|
-
method: "GET",
|
|
391
|
-
mode: "cors",
|
|
392
|
-
credentials: "include",
|
|
393
|
-
...o
|
|
394
|
-
}, ht(r, o);
|
|
395
|
-
}
|
|
396
|
-
async function te(t, e, o) {
|
|
397
|
-
let r = pt(t, e);
|
|
398
|
-
const a = process.env.NODE_ENV || "development", s = r.startsWith("http") ? "" : lt[a];
|
|
399
|
-
return r = s ? s + r : r, o = {
|
|
400
|
-
method: "GET",
|
|
401
|
-
mode: "cors",
|
|
402
|
-
credentials: "include",
|
|
403
|
-
...o
|
|
404
|
-
}, ht(r, o);
|
|
405
|
-
}
|
|
406
|
-
async function ht(t, e) {
|
|
407
|
-
const o = process.env.NODE_ENV || "development", r = t.startsWith("http") ? "" : Zt[o], a = e == null ? void 0 : e.extras;
|
|
408
|
-
t = r ? r + t : t, e.headers || (e.headers = {}), e.toggleLoader && e.toggleLoader({ [t]: !0 }), e.headers.Origin = window.location.protocol + "//" + window.location.host;
|
|
409
|
-
const s = await fetch(t, e), { ok: n, status: c, headers: i } = s;
|
|
410
|
-
if (n) {
|
|
411
|
-
if (i.get("content-type")) {
|
|
412
|
-
if (i.get("content-type").indexOf("application/json") !== -1) {
|
|
413
|
-
const u = await s.json();
|
|
414
|
-
return e.toggleLoader && e.toggleLoader({ [t]: !1 }), { status: c, body: u, headers: i };
|
|
415
|
-
} else if (i.get("content-type").indexOf("application/zip") !== -1 || i.get("content-type").indexOf("image/png") !== -1 || i.get("content-type").indexOf("application/pdf") !== -1 || i.get("content-type").indexOf("video/mp4") !== -1 || i.get("content-type").indexOf("image/gif") !== -1) {
|
|
416
|
-
const u = await s.blob();
|
|
417
|
-
return e.toggleLoader && e.toggleLoader({ [t]: !1 }), { status: c, body: u, headers: i };
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
const d = await s.text();
|
|
421
|
-
return e.toggleLoader && e.toggleLoader({ [t]: !1 }), { status: c, body: d, headers: i };
|
|
422
|
-
}
|
|
423
|
-
const l = await s.json();
|
|
424
|
-
throw e.toggleLoader && e.toggleLoader({ [t]: !1 }), console.log(l), new dt(l.error || l.message, c, a);
|
|
425
|
-
}
|
|
426
|
-
function pt(t, e) {
|
|
427
|
-
if (!e)
|
|
428
|
-
return t || "";
|
|
429
|
-
const o = Object.keys(e).length;
|
|
430
|
-
return t && o ? Object.keys(e).filter((r) => e[r] !== void 0).reduce(
|
|
431
|
-
(r, a, s) => r.concat(
|
|
432
|
-
`${encodeURIComponent(a)}=${encodeURIComponent(
|
|
433
|
-
e[a]
|
|
434
|
-
).replace(/'/g, "%27")}` + (s < o - 1 ? "&" : "")
|
|
435
|
-
),
|
|
436
|
-
t + "?"
|
|
437
|
-
) : "";
|
|
438
|
-
}
|
|
439
|
-
async function ee(t, e = {}) {
|
|
440
|
-
let {
|
|
441
|
-
retryDescriptor: o = [1, 3, 5],
|
|
442
|
-
maxAttempts: r = 5,
|
|
443
|
-
onRetry: a,
|
|
444
|
-
onSuccess: s,
|
|
445
|
-
onFailure: n
|
|
446
|
-
} = e;
|
|
447
|
-
r = Math.min(r, Yt);
|
|
448
|
-
let c = 0;
|
|
449
|
-
const i = async () => {
|
|
450
|
-
try {
|
|
451
|
-
const l = await t();
|
|
452
|
-
return s && s(), l;
|
|
453
|
-
} catch (l) {
|
|
454
|
-
if (c < Math.min(o.length, r)) {
|
|
455
|
-
const d = o[c] * 1e3;
|
|
456
|
-
return c++, a && a(c, d), console.warn(`Retrying in ${d / 1e3} seconds...`), await new Promise((u) => setTimeout(u, d)), i();
|
|
457
|
-
} else {
|
|
458
|
-
const d = new dt(
|
|
459
|
-
"Max retries reached",
|
|
460
|
-
500,
|
|
461
|
-
l
|
|
462
|
-
);
|
|
463
|
-
throw n && n(d), d;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
};
|
|
467
|
-
return i();
|
|
468
|
-
}
|
|
469
|
-
var ut = /* @__PURE__ */ ((t) => (t.LIGHT1 = "th-light-1", t.DARK1 = "th-dark-1", t))(ut || {});
|
|
470
|
-
function oe() {
|
|
471
|
-
let t = !1;
|
|
472
|
-
return function(e) {
|
|
473
|
-
(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(
|
|
474
|
-
e
|
|
475
|
-
) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(
|
|
476
|
-
e.substr(0, 4)
|
|
477
|
-
)) && (t = !0);
|
|
478
|
-
}(
|
|
479
|
-
navigator.userAgent || navigator.vendor || "opera" in window && window.opera
|
|
480
|
-
), t;
|
|
481
|
-
}
|
|
482
|
-
it({ slotted: [] });
|
|
483
|
-
const re = it({
|
|
484
|
-
theme: ut.DARK1,
|
|
485
|
-
drawerState: { collapsed: oe() },
|
|
486
|
-
notify: () => {
|
|
487
|
-
},
|
|
488
|
-
setDrawerState: () => {
|
|
489
|
-
},
|
|
490
|
-
setLeftPanelContent: () => {
|
|
491
|
-
},
|
|
492
|
-
setLoggedIn: () => {
|
|
493
|
-
},
|
|
494
|
-
setModalState: () => {
|
|
495
|
-
},
|
|
496
|
-
setRightPanelContent: () => {
|
|
497
|
-
},
|
|
498
|
-
setTheme: () => {
|
|
499
|
-
},
|
|
500
|
-
setUser: () => {
|
|
501
|
-
}
|
|
502
|
-
}), ne = () => {
|
|
503
|
-
const t = Lt(re);
|
|
504
|
-
if (!t)
|
|
505
|
-
throw new Error("useTheme must be used within an ArProvider");
|
|
506
|
-
return { theme: t.theme, setTheme: t.setTheme };
|
|
507
|
-
}, ie = (t) => (e) => {
|
|
508
|
-
const { theme: o, setTheme: r } = ne();
|
|
509
|
-
return /* @__PURE__ */ y(t, { ...e, theme: o, setTheme: r });
|
|
510
|
-
}, A = {};
|
|
511
|
-
class se extends St {
|
|
512
|
-
constructor(e) {
|
|
513
|
-
super(e), this.parseIconDescriptor = (o) => {
|
|
514
|
-
var r, a, s;
|
|
515
|
-
const n = typeof o == "object" && "source" in o, c = n && !!p[o.type];
|
|
516
|
-
let i = n ? o.source : o;
|
|
517
|
-
const l = c ? o.type : Wt(i);
|
|
518
|
-
let d;
|
|
519
|
-
if (l === p.identifier || l === p.URL) {
|
|
520
|
-
i = i;
|
|
521
|
-
const u = l === p.URL ? i : i.replace(/./g, "/"), b = () => (l === p.URL ? Qt : te)(u);
|
|
522
|
-
if (A[i])
|
|
523
|
-
A[i].icon ? this.setState({
|
|
524
|
-
juice: A[i].icon ?? I,
|
|
525
|
-
type: l
|
|
526
|
-
}) : (r = A[i].promise) == null || r.then(
|
|
527
|
-
(w) => this.handleIconResponse(w, i, l)
|
|
528
|
-
);
|
|
529
|
-
else {
|
|
530
|
-
const w = ee(b).then((H) => (this.handleIconResponse(H, i, l), H));
|
|
531
|
-
A[i] = { promise: w };
|
|
532
|
-
}
|
|
533
|
-
} else {
|
|
534
|
-
switch (l) {
|
|
535
|
-
case p.b64:
|
|
536
|
-
d = _t(i);
|
|
537
|
-
break;
|
|
538
|
-
case p.raw:
|
|
539
|
-
d = /* @__PURE__ */ y(
|
|
540
|
-
"img",
|
|
541
|
-
{
|
|
542
|
-
src: i,
|
|
543
|
-
alt: "ar-icon",
|
|
544
|
-
className: `ar-Icon ${(a = this.props.attributes) == null ? void 0 : a.classes}${this.props.hoverShadow ? " hover-shadow p-1" : ""}`,
|
|
545
|
-
style: (s = this.props.attributes) == null ? void 0 : s.styles
|
|
546
|
-
}
|
|
547
|
-
);
|
|
548
|
-
break;
|
|
549
|
-
case p.svgString:
|
|
550
|
-
d = q(i);
|
|
551
|
-
break;
|
|
552
|
-
default:
|
|
553
|
-
console.error("Unsupported icon type."), d = I;
|
|
554
|
-
}
|
|
555
|
-
d && this.setState({ juice: d, type: l });
|
|
556
|
-
}
|
|
557
|
-
}, this.handleMouseEnter = () => {
|
|
558
|
-
var o, r;
|
|
559
|
-
this.setState({ hovered: !0 }), (r = (o = this.props.events) == null ? void 0 : o.onMouseEnter) == null || r.call(o);
|
|
560
|
-
}, this.handleMouseLeave = () => {
|
|
561
|
-
var o, r;
|
|
562
|
-
this.setState({ hovered: !1 }), (r = (o = this.props.events) == null ? void 0 : o.onMouseLeave) == null || r.call(o);
|
|
563
|
-
}, this.state = {
|
|
564
|
-
hovered: !1,
|
|
565
|
-
toggled: e.toggled || !1,
|
|
566
|
-
juice: I,
|
|
567
|
-
type: p.svgString
|
|
568
|
-
}, this.parseIconDescriptor = this.parseIconDescriptor.bind(this), this.handleIconResponse = this.handleIconResponse.bind(this);
|
|
569
|
-
}
|
|
570
|
-
componentDidMount() {
|
|
571
|
-
this.props.icon && this.parseIconDescriptor(this.props.icon);
|
|
572
|
-
}
|
|
573
|
-
componentDidUpdate(e) {
|
|
574
|
-
if (JSON.stringify(e.attributes) !== JSON.stringify(this.props.attributes)) {
|
|
575
|
-
const { juice: o } = this.state;
|
|
576
|
-
o && Jt(o, this.props, this.state);
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
handleIconResponse(e, o, r) {
|
|
580
|
-
var a, s;
|
|
581
|
-
const n = e.headers.get("content-type");
|
|
582
|
-
let c;
|
|
583
|
-
r === p.identifier || n != null && n.includes(G.SVG) ? c = q(e.body) : n && Object.values(G).findIndex(
|
|
584
|
-
(i) => n.includes(i)
|
|
585
|
-
) > -1 ? c = /* @__PURE__ */ y(
|
|
586
|
-
"img",
|
|
587
|
-
{
|
|
588
|
-
src: o,
|
|
589
|
-
alt: "ar-icon",
|
|
590
|
-
className: `ar-Icon ${(a = this.props.attributes) == null ? void 0 : a.classes}${this.props.hoverShadow ? " hover-shadow p-1" : ""}`,
|
|
591
|
-
style: (s = this.props.attributes) == null ? void 0 : s.styles
|
|
592
|
-
}
|
|
593
|
-
) : (console.error("Unsupported content type."), c = I), c && this.setState({ juice: c, type: r }), A[o].icon = c;
|
|
594
|
-
}
|
|
595
|
-
render() {
|
|
596
|
-
var e;
|
|
597
|
-
const { juice: o, type: r } = this.state;
|
|
598
|
-
return o ? r === p.raw ? o : It(
|
|
599
|
-
Kt(o),
|
|
600
|
-
{
|
|
601
|
-
onMouseEnter: this.handleMouseEnter,
|
|
602
|
-
onMouseLeave: this.handleMouseLeave,
|
|
603
|
-
onClick: (e = this.props.events) == null ? void 0 : e.onClick,
|
|
604
|
-
onClickCapture: () => this.setState({ toggled: !this.state.toggled })
|
|
605
|
-
}
|
|
606
|
-
) : null;
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
const ae = ie(se), he = ({
|
|
313
|
+
}, Bt = ({
|
|
610
314
|
icon: t,
|
|
611
315
|
handler: e,
|
|
612
316
|
tooltip: o
|
|
613
|
-
}) => /* @__PURE__ */
|
|
614
|
-
/* @__PURE__ */
|
|
615
|
-
|
|
317
|
+
}) => /* @__PURE__ */ Y(It, { children: [
|
|
318
|
+
/* @__PURE__ */ H("span", { className: "mx-3 p-1 cursor-pointer", slot: G.ANCHOR, children: /* @__PURE__ */ H(
|
|
319
|
+
pt,
|
|
616
320
|
{
|
|
617
321
|
icon: t,
|
|
618
322
|
attributes: {
|
|
@@ -623,11 +327,10 @@ const ae = ie(se), he = ({
|
|
|
623
327
|
events: { onClick: e }
|
|
624
328
|
}
|
|
625
329
|
) }),
|
|
626
|
-
/* @__PURE__ */
|
|
330
|
+
/* @__PURE__ */ H("span", { slot: G.POPOVER, children: o })
|
|
627
331
|
] });
|
|
628
332
|
export {
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
Ut as v
|
|
333
|
+
Bt as C,
|
|
334
|
+
G as L,
|
|
335
|
+
It as v
|
|
633
336
|
};
|
package/es/Control.js
CHANGED
package/es/ImageEditor.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode('.ar-Image{transition:all .3s}.ar-Image.fill{object-fit:cover}.ar-Image.fill.preserveAspectRatio{object-fit:contain}.ar-Slider input[type=range]{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;cursor:pointer}.ar-Slider input[type=range]:hover+.ar-Slider__bubble{opacity:1}.ar-Slider input[type=range]:focus{outline:none}.ar-Slider input[type=range]::-webkit-slider-runnable-track{background-color:#053a5f;border-radius:.2rem;height:.2rem}.ar-Slider input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none;margin-top:-6.5px;transition:outline .5s;background-color:var(--ar-bg-slider-track);height:1rem;width:1rem;border-radius:50%}.ar-Slider input[type=range]::-webkit-slider-thumb:hover{border:5px solid var(--ar-bg-slider-track)}.ar-Slider input[type=range]:focus::-webkit-slider-thumb{border:1px solid #053a5f}.ar-Slider input[type=range]::-moz-range-track{background-color:#053a5f;border-radius:.2rem;height:.2rem}.ar-Slider input[type=range]::-moz-range-thumb{border:none;border-radius:0;background-color:var(--ar-bg-slider-track);height:1rem;width:1rem}.ar-Slider input[type=range]:focus::-moz-range-thumb{border:1px solid #053a5f}.ar-Slider .ar-Slider__bubble{background:#454545;color:#fff;padding:4px 12px;border-radius:4px;left:50%;bottom:-1.5rem;transform:translate(-50%);opacity:0;transition:opacity .3s}.ar-Slider .ar-Slider__bubble:after{content:"";position:absolute;width:4px;height:4px;transform:rotate(45deg);background:#454545;top:-2px;left:50%}.ar-Slider .ar-Slider__manual-input{width:2rem}.ar-ImageEditor .ar-ImageEditor__image-container{max-width:60vw;max-height:75vh}.ar-ImageEditor .ar-ImageEditor__editor-controls{transition:background-color .5s,box-shadow .5s ease-in-out;background-color:var(--ar-bg-tertiary-faded-2);border-radius:2rem}.ar-ImageEditor .ar-ImageEditor__editor-controls:hover{background-color:var(--ar-bg-tertiary-faded)}.ar-ImageEditor .ar-ImageEditor__editor-controls .ar-ImageEditor__download-button{width:2rem;height:2rem;display:inline-block}.ar-ImageEditor .ar-ImageEditor__editor-controls .ar-ImageEditor__download-button:hover{background-color:var(--ar-bg-tertiary-faded-2)}.ar-ImageEditor .ar-ImageEditor__editor-controls .ar-ImageEditor__commit-button{width:2rem;height:2rem;display:inline-block}.ar-ImageEditor .ar-ImageEditor__editor-controls .ar-ImageEditor__commit-button.is-dirty:hover{background-color:var(--ar-bg-tertiary-faded-2)}.ar-ImageEditor .ar-ImageEditor__controls{bottom:0}.ar-ImageEditor .ar-ImageEditor__controls .ar-ImageEditor__controls-container{transition:background-color .5s,box-shadow .5s,max-height .5s ease-in-out;background-color:var(--ar-bg-tertiary-faded-2);max-height:3.2rem;overflow:hidden}.ar-ImageEditor .ar-ImageEditor__controls .ar-ImageEditor__controls-container:hover{background-color:var(--ar-bg-tertiary-faded)}.ar-ImageEditor .ar-ImageEditor__controls .ar-ImageEditor__controls-container.expanded{max-height:20rem}.ar-Portal{z-index:2001;white-space:nowrap}.ar-Popover__anchor:focus-visible{outline:none}:root{--marker-transform: rotate(45deg);--marker-top: -.4rem;--marker-left: 10%;--marker-right: unset;--marker-bottom: unset}:root .ar-Popover__content{box-shadow:0 4px 8px -2px #091e4240,0 0 1px #091e424f;z-index:2002;background-color:var(--ar-bg);white-space:nowrap;position:relative;border:1px solid var(--ar-color-border)}:root .ar-Popover__content>*{position:relative}:root .ar-Popover__content.invert-bg{background-color:var(--ar-bg-invert-1)}:root .ar-Popover__content.wrap{white-space:wrap}:root .ar-Popover__content:not(.hide-marker):before{content:"";background-color:var(--ar-bg);position:absolute;height:.7rem;width:.7rem;border-width:1px;border-style:solid;border-color:var(--ar-color-border) transparent transparent var(--ar-color-border);transform:var(--marker-transform);top:var(--marker-top);left:var(--marker-left);right:var(--marker-right);bottom:var(--marker-bottom)}:root .ar-Popover__content.invert-bg:not(.hide-marker):before{background-color:var(--ar-bg-invert-1)}:root .ar-Popover__content.transition{transition:width .15s ease-in-out,height .15s ease-in-out,opacity .3s ease-in-out,transform .15s ease-in-out}:root .ar-Popover__content.transition.expand-shrink{transform:scale(.8)}:root .ar-Popover__content.transition.show{transform:scale(1)}@media (min-width: 576px){:root .ar-Popover__content{max-width:25vw}}:root .ar-List__item{line-height:1.5rem}:root .ar-List__item:hover{background-color:var(--ar-color-font);color:var(--ar-color-font-invert);cursor:pointer}')),document.head.appendChild(r)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
2
2
|
import { jsx as a, jsxs as x } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef as L, useRef as w, useState as R, useEffect as B } from "react";
|
|
4
|
-
import { v as z, L as I,
|
|
4
|
+
import { v as z, L as I, C as V } from "./Control-chunk.js";
|
|
5
|
+
import F from "@armco/icon";
|
|
5
6
|
import { downloadEditedImage as Z } from "./helper.js";
|
|
6
7
|
import "react-dom";
|
|
7
|
-
const M = (
|
|
8
|
-
const d = M(
|
|
8
|
+
const M = (i) => new URL(i).hostname, D = (i) => {
|
|
9
|
+
const d = M(i);
|
|
9
10
|
return d === "localhost" || d === "armco.tech" ? "use-credentials" : "anonymous";
|
|
10
11
|
}, P = L(
|
|
11
|
-
(
|
|
12
|
+
(i, d) => {
|
|
12
13
|
const {
|
|
13
14
|
alt: u,
|
|
14
15
|
blur: c,
|
|
@@ -21,7 +22,7 @@ const M = (o) => new URL(o).hostname, D = (o) => {
|
|
|
21
22
|
flipHorizontal: b,
|
|
22
23
|
flipVertical: y,
|
|
23
24
|
grayscale: C,
|
|
24
|
-
image:
|
|
25
|
+
image: o,
|
|
25
26
|
isBackground: p,
|
|
26
27
|
opacity: $,
|
|
27
28
|
preserveAspectRatio: _,
|
|
@@ -31,9 +32,9 @@ const M = (o) => new URL(o).hostname, D = (o) => {
|
|
|
31
32
|
sepia: f,
|
|
32
33
|
style: g,
|
|
33
34
|
title: O
|
|
34
|
-
} =
|
|
35
|
+
} = i, t = {};
|
|
35
36
|
n !== void 0 && (t.transform = `scale(${n})`), b && (t.transform = `scaleX(-${n !== void 0 ? n : 1})`), y && (t.transform = (t.transform ? t.transform + " " : "") + `scaleY(-${n !== void 0 ? n : 1})`), e && (t.transform = (t.transform ? t.transform + " " : "") + `rotate(${e}deg)`), $ && (t.opacity = $), v && (t.filter = `brightness(${v})`), m && (t.filter = (t.filter ? t.filter + " " : "") + `contrast(${m})`), l && (t.filter = (t.filter ? t.filter + " " : "") + `saturate(${l})`), c && (t.filter = (t.filter ? t.filter + " " : "") + `blur(${c}px)`), C && (t.filter = (t.filter ? t.filter + " " : "") + `grayscale(${C})`), f && (t.filter = (t.filter ? t.filter + " " : "") + `sepia(${f})`), p && r && (t.zIndex = `${r} !important`);
|
|
36
|
-
const S = N ?
|
|
37
|
+
const S = N ? o || "https://picsum.photos/200/300" : o;
|
|
37
38
|
return /* @__PURE__ */ a(
|
|
38
39
|
"img",
|
|
39
40
|
{
|
|
@@ -53,13 +54,13 @@ const M = (o) => new URL(o).hostname, D = (o) => {
|
|
|
53
54
|
);
|
|
54
55
|
}
|
|
55
56
|
);
|
|
56
|
-
function k(
|
|
57
|
-
const u = +
|
|
57
|
+
function k(i, d) {
|
|
58
|
+
const u = +i.value, c = +(i.min ? i.min : 0), v = +(i.max ? i.max : 100), s = Number((u - c) * 100 / (v - c));
|
|
58
59
|
d.innerHTML = "" + u;
|
|
59
60
|
const m = -(s / 100 * 16) + 8;
|
|
60
61
|
d.style.left = `calc(${s}% + ${m}px)`;
|
|
61
62
|
}
|
|
62
|
-
const T = (
|
|
63
|
+
const T = (i) => {
|
|
63
64
|
const {
|
|
64
65
|
assistiveContent: d,
|
|
65
66
|
classes: u,
|
|
@@ -73,11 +74,11 @@ const T = (o) => {
|
|
|
73
74
|
onChange: b,
|
|
74
75
|
onFocus: y,
|
|
75
76
|
precision: C,
|
|
76
|
-
type:
|
|
77
|
+
type: o,
|
|
77
78
|
value: p,
|
|
78
79
|
withManual: $,
|
|
79
80
|
..._
|
|
80
|
-
} =
|
|
81
|
+
} = i, e = w(null), l = w(null), [n, f] = R();
|
|
81
82
|
return B(() => {
|
|
82
83
|
e.current && l.current && k(e.current, l.current), e.current && e.current.addEventListener("input", () => {
|
|
83
84
|
e.current && l.current && k(e.current, l.current);
|
|
@@ -149,13 +150,13 @@ let E = {
|
|
|
149
150
|
opacity: 1,
|
|
150
151
|
scale: 1
|
|
151
152
|
};
|
|
152
|
-
const A = (
|
|
153
|
-
const { image: d, imageState: u, onChange: c, onCommit: v, viewOnly: s } =
|
|
153
|
+
const A = (i) => (i % 360 + 360) % 360, H = 22.5, q = (i) => {
|
|
154
|
+
const { image: d, imageState: u, onChange: c, onCommit: v, viewOnly: s } = i;
|
|
154
155
|
E = {
|
|
155
156
|
...E,
|
|
156
157
|
...u
|
|
157
158
|
};
|
|
158
|
-
const m = w(null), [r, N] = R({ ...E }), [h, b] = R(), [y, C] = R(),
|
|
159
|
+
const m = w(null), [r, N] = R({ ...E }), [h, b] = R(), [y, C] = R(), o = (e, l) => {
|
|
159
160
|
const n = { ...r, [e]: l }, { rotateBy: f, ...g } = n, { rotateBy: O, ...t } = E;
|
|
160
161
|
f !== void 0 && O !== void 0 && C(
|
|
161
162
|
JSON.stringify(g) !== JSON.stringify(t) || A(f) !== A(O)
|
|
@@ -163,32 +164,32 @@ const A = (o) => (o % 360 + 360) % 360, H = 22.5, Y = (o) => {
|
|
|
163
164
|
}, p = [
|
|
164
165
|
{
|
|
165
166
|
icon: "tb.TbFlipHorizontal",
|
|
166
|
-
handler: () =>
|
|
167
|
+
handler: () => o("flipHorizontal", !r.flipHorizontal),
|
|
167
168
|
tooltip: "Flip Horizontal"
|
|
168
169
|
},
|
|
169
170
|
{
|
|
170
171
|
icon: "tb.TbFlipVertical",
|
|
171
|
-
handler: () =>
|
|
172
|
+
handler: () => o("flipVertical", !r.flipVertical),
|
|
172
173
|
tooltip: "Flip Vertical"
|
|
173
174
|
},
|
|
174
175
|
{
|
|
175
176
|
icon: "ai.AiOutlineRotateLeft",
|
|
176
|
-
handler: () =>
|
|
177
|
+
handler: () => o("rotateBy", r.rotateBy - H),
|
|
177
178
|
tooltip: "Rotate Left"
|
|
178
179
|
},
|
|
179
180
|
{
|
|
180
181
|
icon: "ai.AiOutlineRotateRight",
|
|
181
|
-
handler: () =>
|
|
182
|
+
handler: () => o("rotateBy", r.rotateBy + H),
|
|
182
183
|
tooltip: "Rotate Right"
|
|
183
184
|
},
|
|
184
185
|
{
|
|
185
186
|
icon: "fi.FiZoomIn",
|
|
186
|
-
handler: () =>
|
|
187
|
+
handler: () => o("scale", (r.scale + 1) % 10),
|
|
187
188
|
tooltip: "Zoom In"
|
|
188
189
|
},
|
|
189
190
|
{
|
|
190
191
|
icon: "fi.FiZoomOut",
|
|
191
|
-
handler: () =>
|
|
192
|
+
handler: () => o(
|
|
192
193
|
"scale",
|
|
193
194
|
(r.scale - 1 < 0 ? 0 : r.scale - 1) % 10
|
|
194
195
|
),
|
|
@@ -220,14 +221,14 @@ const A = (o) => (o % 360 + 360) % 360, H = 22.5, Y = (o) => {
|
|
|
220
221
|
min: 0,
|
|
221
222
|
max: 5,
|
|
222
223
|
precision: 0.1,
|
|
223
|
-
handler: (e) =>
|
|
224
|
+
handler: (e) => o("brightness", +e.target.value)
|
|
224
225
|
},
|
|
225
226
|
{
|
|
226
227
|
label: "Contrast",
|
|
227
228
|
min: 0,
|
|
228
229
|
max: 5,
|
|
229
230
|
precision: 0.1,
|
|
230
|
-
handler: (e) =>
|
|
231
|
+
handler: (e) => o("contrast", +e.target.value)
|
|
231
232
|
}
|
|
232
233
|
],
|
|
233
234
|
[
|
|
@@ -236,14 +237,14 @@ const A = (o) => (o % 360 + 360) % 360, H = 22.5, Y = (o) => {
|
|
|
236
237
|
min: 0,
|
|
237
238
|
max: 10,
|
|
238
239
|
precision: 0.2,
|
|
239
|
-
handler: (e) =>
|
|
240
|
+
handler: (e) => o("saturate", +e.target.value)
|
|
240
241
|
},
|
|
241
242
|
{
|
|
242
243
|
label: "Grayscale",
|
|
243
244
|
min: 0,
|
|
244
245
|
max: 1,
|
|
245
246
|
precision: 0.05,
|
|
246
|
-
handler: (e) =>
|
|
247
|
+
handler: (e) => o("grayscale", +e.target.value)
|
|
247
248
|
}
|
|
248
249
|
],
|
|
249
250
|
[
|
|
@@ -251,14 +252,14 @@ const A = (o) => (o % 360 + 360) % 360, H = 22.5, Y = (o) => {
|
|
|
251
252
|
label: "Blur",
|
|
252
253
|
min: 0,
|
|
253
254
|
max: 20,
|
|
254
|
-
handler: (e) =>
|
|
255
|
+
handler: (e) => o("blur", +e.target.value)
|
|
255
256
|
},
|
|
256
257
|
{
|
|
257
258
|
label: "Sepia",
|
|
258
259
|
min: 0,
|
|
259
260
|
max: 1,
|
|
260
261
|
precision: 0.05,
|
|
261
|
-
handler: (e) =>
|
|
262
|
+
handler: (e) => o("sepia", +e.target.value)
|
|
262
263
|
}
|
|
263
264
|
],
|
|
264
265
|
[
|
|
@@ -267,14 +268,14 @@ const A = (o) => (o % 360 + 360) % 360, H = 22.5, Y = (o) => {
|
|
|
267
268
|
min: 0,
|
|
268
269
|
max: 1,
|
|
269
270
|
precision: 0.05,
|
|
270
|
-
handler: (e) =>
|
|
271
|
+
handler: (e) => o("opacity", +e.target.value)
|
|
271
272
|
},
|
|
272
273
|
{
|
|
273
274
|
label: "Scale",
|
|
274
275
|
min: 0,
|
|
275
276
|
max: 10,
|
|
276
277
|
precision: 0.2,
|
|
277
|
-
handler: (e) =>
|
|
278
|
+
handler: (e) => o("scale", +e.target.value)
|
|
278
279
|
}
|
|
279
280
|
]
|
|
280
281
|
];
|
|
@@ -366,5 +367,5 @@ const A = (o) => (o % 360 + 360) % 360, H = 22.5, Y = (o) => {
|
|
|
366
367
|
] });
|
|
367
368
|
};
|
|
368
369
|
export {
|
|
369
|
-
|
|
370
|
+
q as default
|
|
370
371
|
};
|