react-filerobot-image-editor
Advanced tools
Comparing version 4.1.1 to 4.2.0
@@ -1,1 +0,1 @@ | ||
import _defineProperty from"@babel/runtime/helpers/defineProperty";function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import extractCurrentDesignState from"../utils/extractCurrentDesignState";export var RESET="RESET";var reset=function(a){var b=extractCurrentDesignState({imgSrc:a.imgSrc});return _objectSpread(_objectSpread(_objectSpread({},a),b),{},{selectionsIds:[],isResetted:!0,pastDesignStates:[],futureDesignStates:[],hasUndo:!1,hasRedo:!1,haveNotSavedChanges:!1})};export default reset; | ||
import _defineProperty from"@babel/runtime/helpers/defineProperty";function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import extractCurrentDesignState from"../utils/extractCurrentDesignState";export var RESET="RESET";var reset=function(a,b){var c=extractCurrentDesignState(_objectSpread(_objectSpread({},b.config),{},{imgSrc:a.imgSrc}),!0);return _objectSpread(_objectSpread(_objectSpread({},a),c),{},{selectionsIds:[],isResetted:!0,pastDesignStates:[],futureDesignStates:[],hasUndo:!1,hasRedo:!1,haveNotSavedChanges:!1})};export default reset; |
@@ -1,1 +0,1 @@ | ||
import styled from"styled-components";var StyledAppWrapper=styled.div.attrs(function(a){var b,c,d=a.$size,e=void 0===d?{}:d;return{style:{width:null!==(b=e.width)&&void 0!==b?b:"100%",height:null!==(c=e.height)&&void 0!==c?c:"100%"}}}).withConfig({componentId:"sc-ugtqr7-0"})(["display:flex;flex-direction:column;align-items:center;height:100%;max-height:100%;width:100%;max-width:100%;overflow:auto;position:relative;min-height:250px;min-width:300px;"]),StyledMainContent=styled.div.withConfig({componentId:"sc-ugtqr7-1"})(["display:flex;align-items:flex-start;width:100%;padding:12px;box-sizing:border-box;height:calc(100% - 95px);flex-grow:1;[data-phone='true'] &{padding:0;}"]),StyledCanvasAndTools=styled.div.withConfig({componentId:"sc-ugtqr7-2"})(["height:100%;width:calc(100% - 80px);flex-grow:1;overflow-y:auto;display:flex;flex-direction:column;"]),StyledPhoneToolsAndTabs=styled.div.withConfig({componentId:"sc-ugtqr7-3"})(["width:100%;flex-grow:1;"]);export{StyledAppWrapper,StyledMainContent,StyledCanvasAndTools,StyledPhoneToolsAndTabs}; | ||
import styled from"styled-components";var StyledAppWrapper=styled.div.attrs(function(a){var b,c,d=a.$size,e=void 0===d?{}:d;return{style:{width:null!==(b=e.width)&&void 0!==b?b:"100%",height:null!==(c=e.height)&&void 0!==c?c:"100%"}}}).withConfig({componentId:"sc-ugtqr7-0"})(["display:flex;flex-direction:column;align-items:center;height:100%;max-height:100%;width:100%;max-width:100%;overflow:auto;position:relative;min-height:250px;min-width:300px;background:",";"],function(a){var b=a.theme;return b.palette["bg-secondary"]}),StyledMainContent=styled.div.withConfig({componentId:"sc-ugtqr7-1"})(["display:flex;align-items:flex-start;width:100%;padding:12px;box-sizing:border-box;height:calc(100% - 95px);flex-grow:1;[data-phone='true'] &{padding:0;}"]),StyledCanvasAndTools=styled.div.withConfig({componentId:"sc-ugtqr7-2"})(["height:100%;width:calc(100% - 80px);flex-grow:1;overflow-y:auto;display:flex;flex-direction:column;"]),StyledPhoneToolsAndTabs=styled.div.withConfig({componentId:"sc-ugtqr7-3"})(["width:100%;flex-grow:1;display:flex;flex-direction:column;justify-content:flex-end;"]);export{StyledAppWrapper,StyledMainContent,StyledCanvasAndTools,StyledPhoneToolsAndTabs}; |
@@ -1,1 +0,1 @@ | ||
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import React,{memo,useCallback,useEffect,useMemo,useState,useRef}from"react";import Konva from"konva";import{useStrictMode}from"react-konva";import{CHANGE_POINTER_ICON,CLEAR_ANNOTATIONS_SELECTIONS,ZOOM_CANVAS}from"../../actions";import{DEFAULT_ZOOM_FACTOR,POINTER_ICONS,TABS_IDS,TOOLS_IDS}from"../../utils/constants";import{useStore}from"../../hooks";import{endTouchesZooming,zoomOnTouchesMove}from"./touchZoomingEvents";import{StyledCanvasNode}from"./MainCanvas.styled";var ZOOM_DELTA_TO_SCALE_CONVERT_FACTOR=.006,CanvasNode=function(a){var b=a.children;useStrictMode(!0);var c=useRef(),d=useStore(),f=d.dispatch,g=d.pointerCssIcon,h=d.tabId,i=d.toolId,j=d.canvasWidth,k=d.canvasHeight,l=d.canvasScale,m=d.selectionsIds,n=void 0===m?[]:m,o=d.zoom,p=void 0===o?{}:o,q=d.config.previewPixelRatio;Konva.pixelRatio=q;var r=DEFAULT_ZOOM_FACTOR,s=i!==TOOLS_IDS.CROP,t=useState(h!==TABS_IDS.ANNOTATE&&h!==TABS_IDS.WATERMARK&&p.factor>r),u=_slicedToArray(t,2),v=u[0],w=u[1],x=useMemo(function(){return{cursor:g===POINTER_ICONS.DEFAULT&&h===TABS_IDS.ANNOTATE?POINTER_ICONS.DRAW:g}},[h,g]),y=function(a){f({type:ZOOM_CANVAS,payload:a})},z=useCallback(function(a){var b,c;a.evt.preventDefault(),null===(b=(c=a.currentTarget).container)||void 0===b?void 0:b.call(c).focus(),a.target instanceof Konva.Stage&&0<n.length&&f({type:CLEAR_ANNOTATIONS_SELECTIONS})},[n]),A=function(){return w(h!==TABS_IDS.ANNOTATE||h===TABS_IDS.WATERMARK)},B=function(a){("Space"===a.code||"Control"===a.key)&&!a.repeat&&p.factor>r&&s&&(a.preventDefault(),w(!0),f({type:CHANGE_POINTER_ICON,payload:{pointerCssIcon:POINTER_ICONS.DRAG}}))},C=function(a){"Space"===a.code&&(a.preventDefault(),A())},D=function(){c.current&&c.current.container().focus()};useEffect(function(){f({type:CHANGE_POINTER_ICON,payload:{pointerCssIcon:POINTER_ICONS[v?"DRAG":"DEFAULT"]}})},[v]),useEffect(function(){w(h!==TABS_IDS.ANNOTATE&&h!==TABS_IDS.WATERMARK&&p.factor>r);var a;return c.current&&(a=c.current.container(),a.addEventListener("mouseenter",D),a.addEventListener("keydown",B),a.addEventListener("keyup",C)),function(){a&&(a.removeEventListener("mouseenter",D),a.removeEventListener("keydown",B),a.removeEventListener("keyup",C))}},[h,p.factor,r]);var E=l*(s&&p.factor||r);return React.createElement(StyledCanvasNode,{className:"FIE_canvas-node",tabIndex:-1,ref:c,width:j,height:k,scaleX:E,scaleY:E,x:s&&p.x||null,y:s&&p.y||null,zoomFactor:s&&p.factor||r,onWheel:s?function handleZoom(a){a.evt.preventDefault();var b=(p.factor||r)+a.evt.deltaY*-ZOOM_DELTA_TO_SCALE_CONVERT_FACTOR,c=a.currentTarget.getPointerPosition();y(_objectSpread(_objectSpread({},c),{},{factor:b}))}:void 0,onTap:z,onClick:z,onTouchMove:s?function(a){return zoomOnTouchesMove(a,y)}:void 0,onDragStart:function preventDraggingIfMultiTouches(a){var b;1<(null===(b=a.evt.touches)||void 0===b?void 0:b.length)&&w(!1)},onTouchEnd:s?function endTouchesZoomingEnablePanning(){endTouchesZooming(A)}:void 0,dragBoundFunc:function dragBoundFunc(a){var b=Math.min(0,Math.max(a.x,j*(1-p.factor))),c=Math.min(0,Math.max(a.y,k*(1-p.factor)));return{x:b,y:c}},draggable:s&&v,onDragEnd:function handleCanvasDragEnd(a){a.currentTarget.draggable()&&"stage"===a.target.nodeType.toLowerCase()&&s&&v&&y({factor:p.factor,x:a.target.x(),y:a.target.y(),preparedDimensions:!0})},style:x},b)};export default memo(CanvasNode); | ||
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import React,{memo,useCallback,useEffect,useMemo,useState,useRef}from"react";import Konva from"konva";import{useStrictMode}from"react-konva";import{CHANGE_POINTER_ICON,CLEAR_ANNOTATIONS_SELECTIONS,ZOOM_CANVAS}from"../../actions";import{DEFAULT_ZOOM_FACTOR,POINTER_ICONS,TABS_IDS,TOOLS_IDS}from"../../utils/constants";import{useStore}from"../../hooks";import{endTouchesZooming,zoomOnTouchesMove}from"./touchZoomingEvents";import{StyledCanvasNode}from"./MainCanvas.styled";var ZOOM_DELTA_TO_SCALE_CONVERT_FACTOR=.006,CanvasNode=function(a){var b=a.children;useStrictMode(!0);var c=useRef(),d=useStore(),f=d.dispatch,g=d.pointerCssIcon,h=d.tabId,i=d.toolId,j=d.canvasWidth,k=d.canvasHeight,l=d.canvasScale,m=d.selectionsIds,n=void 0===m?[]:m,o=d.zoom,p=void 0===o?{}:o,q=d.config,r=q.previewPixelRatio,s=q.disableZooming;Konva.pixelRatio=r;var t=DEFAULT_ZOOM_FACTOR,u=!s&&i!==TOOLS_IDS.CROP,v=useState(h!==TABS_IDS.ANNOTATE&&h!==TABS_IDS.WATERMARK&&p.factor>t),w=_slicedToArray(v,2),x=w[0],y=w[1],z=useMemo(function(){return{cursor:g===POINTER_ICONS.DEFAULT&&h===TABS_IDS.ANNOTATE?POINTER_ICONS.DRAW:g}},[h,g]),A=function(a){f({type:ZOOM_CANVAS,payload:a})},B=useCallback(function(a){var b,c;a.evt.preventDefault(),null===(b=(c=a.currentTarget).container)||void 0===b?void 0:b.call(c).focus(),a.target instanceof Konva.Stage&&0<n.length&&f({type:CLEAR_ANNOTATIONS_SELECTIONS})},[n]),C=function(){return y(h!==TABS_IDS.ANNOTATE||h===TABS_IDS.WATERMARK)},D=function(a){("Space"===a.code||"Control"===a.key)&&!a.repeat&&p.factor>t&&u&&(a.preventDefault(),y(!0),f({type:CHANGE_POINTER_ICON,payload:{pointerCssIcon:POINTER_ICONS.DRAG}}))},E=function(a){"Space"===a.code&&(a.preventDefault(),C())},F=function(){c.current&&c.current.container().focus()};useEffect(function(){f({type:CHANGE_POINTER_ICON,payload:{pointerCssIcon:POINTER_ICONS[x?"DRAG":"DEFAULT"]}})},[x]),useEffect(function(){y(h!==TABS_IDS.ANNOTATE&&h!==TABS_IDS.WATERMARK&&p.factor>t);var a;return c.current&&(a=c.current.container(),a.addEventListener("mouseenter",F),a.addEventListener("keydown",D),a.addEventListener("keyup",E)),function(){a&&(a.removeEventListener("mouseenter",F),a.removeEventListener("keydown",D),a.removeEventListener("keyup",E))}},[h,p.factor,t]);var G=l*(u&&p.factor||t);return React.createElement(StyledCanvasNode,{className:"FIE_canvas-node",tabIndex:-1,ref:c,width:j,height:k,scaleX:G,scaleY:G,x:u&&p.x||null,y:u&&p.y||null,zoomFactor:u&&p.factor||t,onWheel:u?function handleZoom(a){a.evt.preventDefault();var b=(p.factor||t)+a.evt.deltaY*-ZOOM_DELTA_TO_SCALE_CONVERT_FACTOR,c=a.currentTarget.getPointerPosition();A(_objectSpread(_objectSpread({},c),{},{factor:b}))}:void 0,onTap:B,onClick:B,onTouchMove:u?function(a){return zoomOnTouchesMove(a,A)}:void 0,onDragStart:function preventDraggingIfMultiTouches(a){var b;1<(null===(b=a.evt.touches)||void 0===b?void 0:b.length)&&y(!1)},onTouchEnd:u?function endTouchesZoomingEnablePanning(){endTouchesZooming(C)}:void 0,dragBoundFunc:function dragBoundFunc(a){var b=Math.min(0,Math.max(a.x,j*(1-p.factor))),c=Math.min(0,Math.max(a.y,k*(1-p.factor)));return{x:b,y:c}},draggable:u&&x,onDragEnd:function handleCanvasDragEnd(a){a.currentTarget.draggable()&&"stage"===a.target.nodeType.toLowerCase()&&u&&x&&A({factor:p.factor,x:a.target.x(),y:a.target.y(),preparedDimensions:!0})},style:z},b)};export default memo(CanvasNode); |
@@ -1,1 +0,1 @@ | ||
import{Stage}from"react-konva";import styled from"styled-components";var CanvasContainer=styled.div.withConfig({componentId:"sc-3ln9py-0"})(["width:100%;position:relative;height:calc(100% - 94px - 12px);background:",";overflow:hidden;min-height:250px;flex-grow:1;"],function(a){var b=a.theme;return b.palette["bg-primary"]}),StyledOrignalImage=styled.img.withConfig({componentId:"sc-3ln9py-1"})(["max-width:98%;max-height:98%;box-shadow:0 0 0 5px rgba(0,0,0,0.1);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);z-index:2;"]),StyledCanvasNode=styled(Stage).withConfig({componentId:"sc-3ln9py-2"})(["outline:none;"]);export{CanvasContainer,StyledOrignalImage,StyledCanvasNode}; | ||
import{Stage}from"react-konva";import styled from"styled-components";var CanvasContainer=styled.div.withConfig({componentId:"sc-3ln9py-0"})(["width:100%;position:relative;height:calc(100% - 94px - 12px);background:",";overflow:hidden;min-height:250px;flex-grow:1;"],function(a){var b=a.theme;return b.palette["bg-primary"]}),StyledOrignalImage=styled.img.withConfig({componentId:"sc-3ln9py-1"})(["max-width:98%;max-height:98%;box-shadow:0 0 0 5px rgba(0,0,0,0.1);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);z-index:2;"]),StyledCanvasNode=styled(Stage).withConfig({componentId:"sc-3ln9py-2"})(["outline:none;background:",";"],function(a){var b=a.theme;return b.palette["bg-secondary"]});export{CanvasContainer,StyledOrignalImage,StyledCanvasNode}; |
@@ -1,1 +0,1 @@ | ||
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import React,{useState}from"react";import Minus from"@scaleflex/icons/minus";import Plus from"@scaleflex/icons/plus";import Menu from"@scaleflex/ui/core/menu";import MenuItem,{MenuItemLabel}from"@scaleflex/ui/core/menu-item";import{ZOOM_CANVAS}from"../../actions";import{DEFAULT_ZOOM_FACTOR,TOOLS_IDS}from"../../utils/constants";import{useStore}from"../../hooks";import getZoomFitFactor from"../../utils/getZoomFitFactor";import toPrecisedFloat from"../../utils/toPrecisedFloat";import{StyledSmallButton,StyledZoomPercentageLabel}from"./Topbar.styled";import{ZOOM_FACTORS_PRESETS}from"./Topbar.constants";var MULTIPLY_ZOOM_FACTOR=1.1,CanvasZooming=function(){var a=useStore(),b=a.dispatch,c=a.zoom,d=void 0===c?{}:c,e=a.toolId,f=a.feedback,g=a.t,h=a.shownImageDimensions,i=a.resize,j=a.originalImage,k=a.adjustments.crop,l=a.config.useZoomPresetsMenu,m=0===f.duration,n=useState(null),o=_slicedToArray(n,2),p=o[0],q=o[1],r=function(a){b({type:ZOOM_CANVAS,payload:{factor:a}})},s=function(){var a=i.width&&i.height&&i||k.width&&k.height&&k||h,b=getZoomFitFactor(k.width&&k.height&&k||h,a);r(b||DEFAULT_ZOOM_FACTOR)},t=function(a){q(p?null:a.target)},u=function(a){if("fit"===a)return s(),void t();var b=Math.min(a*j.width/h.width,a*j.height/h.height);r(b),t()},v=e===TOOLS_IDS.CROP||m,w=!j||i.width||i.height?d.factor:Math.min(h.width*d.factor/j.width,h.height*d.factor/j.height);return React.createElement(React.Fragment,null,React.createElement(StyledSmallButton,{onClick:function zoomOut(){r(d.factor/MULTIPLY_ZOOM_FACTOR)},color:"link",title:g("zoomOutTitle"),disabled:v},React.createElement(Minus,null)),React.createElement(StyledZoomPercentageLabel,{title:g("toggleZoomMenuTitle"),onClick:v?void 0:l&&t||s,"aria-disabled":v},"".concat(toPrecisedFloat(100*w,0),"%")),React.createElement(Menu,{anchorEl:p,onClose:t,open:!!p,position:"bottom"},ZOOM_FACTORS_PRESETS.map(function(a){var b=a.factor,c=a.labelKey,d=a.label;return React.createElement(MenuItem,{key:d||c,onClick:function onClick(){return u(b)}},React.createElement(MenuItemLabel,null,null!==d&&void 0!==d?d:g(c)))})),React.createElement(StyledSmallButton,{onClick:function zoomIn(){r(d.factor*MULTIPLY_ZOOM_FACTOR)},color:"link",title:g("zoomInTitle"),disabled:v},React.createElement(Plus,null)))};export default CanvasZooming; | ||
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import React,{useState}from"react";import Minus from"@scaleflex/icons/minus";import Plus from"@scaleflex/icons/plus";import Menu from"@scaleflex/ui/core/menu";import MenuItem,{MenuItemLabel}from"@scaleflex/ui/core/menu-item";import{ZOOM_CANVAS}from"../../actions";import{DEFAULT_ZOOM_FACTOR,TOOLS_IDS}from"../../utils/constants";import{useStore}from"../../hooks";import getZoomFitFactor from"../../utils/getZoomFitFactor";import toPrecisedFloat from"../../utils/toPrecisedFloat";import{StyledSmallButton,StyledZoomPercentageLabel}from"./Topbar.styled";import{ZOOM_FACTORS_PRESETS}from"./Topbar.constants";var MULTIPLY_ZOOM_FACTOR=1.1,CanvasZooming=function(){var a=useStore(),b=a.dispatch,c=a.zoom,d=void 0===c?{}:c,e=a.toolId,f=a.feedback,g=a.t,h=a.shownImageDimensions,i=a.resize,j=a.originalImage,k=a.adjustments.crop,l=a.config.useZoomPresetsMenu,m=0===f.duration,n=useState(null),o=_slicedToArray(n,2),p=o[0],q=o[1],r=function(a){b({type:ZOOM_CANVAS,payload:{factor:a}})},s=function(){var a=i.width&&i.height&&i||k.width&&k.height&&k||h,b=getZoomFitFactor(k.width&&k.height&&k||h,a);r(b||DEFAULT_ZOOM_FACTOR)},t=function(a){q(p?null:a.target)},u=function(a){if("fit"===a)return s(),void t();var b=Math.min(a*j.width/h.width,a*j.height/h.height);r(b),t()},v=e===TOOLS_IDS.CROP||m,w=!j||i.width||i.height?d.factor:Math.min(h.width*d.factor/j.width,h.height*d.factor/j.height);return React.createElement(React.Fragment,null,React.createElement(StyledSmallButton,{onClick:function zoomOut(){r(d.factor/MULTIPLY_ZOOM_FACTOR)},color:"link",title:g("zoomOutTitle"),disabled:v,className:"FIE_topbar-zoom-out-btn"},React.createElement(Minus,null)),React.createElement(StyledZoomPercentageLabel,{title:g("toggleZoomMenuTitle"),onClick:v?void 0:l&&t||s,"aria-disabled":v,className:"FIE_topbar-zoom-label"},"".concat(toPrecisedFloat(100*w,0),"%")),React.createElement(StyledSmallButton,{onClick:function zoomIn(){r(d.factor*MULTIPLY_ZOOM_FACTOR)},color:"link",title:g("zoomInTitle"),disabled:v,className:"FIE_topbar-zoom-in-btn"},React.createElement(Plus,null)),React.createElement(Menu,{anchorEl:p,onClose:t,open:!!p,position:"bottom",className:"FIE_topbar-zoom-menu"},ZOOM_FACTORS_PRESETS.map(function(a){var b=a.factor,c=a.labelKey,d=a.label;return React.createElement(MenuItem,{key:d||c,onClick:function onClick(){return u(b)}},React.createElement(MenuItemLabel,null,null!==d&&void 0!==d?d:g(c)))})))};export default CanvasZooming; |
@@ -1,1 +0,1 @@ | ||
import React from"react";import Separator from"../common/Separator";import{usePhoneScreen,useStore}from"../../hooks";import CloseButton from"./CloseButton";import SaveButton from"./SaveButton";import ResetButton from"./ResetButton";import UndoButton from"./UndoButton";import RedoButton from"./RedoButton";import ImageDimensionsAndDisplayToggle from"./ImageDimensionsAndDisplayToggle";import CanvasZooming from"./CanvasZooming";import{StyledTopbar,StyledFlexCenterAlignedContainer}from"./Topbar.styled";import BackButton from"./BackButton";var Topbar=function(){var a=useStore(),b=a.config.showBackButton,c=usePhoneScreen();return React.createElement(StyledTopbar,{reverseDirection:b,className:"FIE_topbar"},React.createElement(StyledFlexCenterAlignedContainer,{reverseDirection:b,className:"FIE_topbar-buttons-wrapper"},c?React.createElement("div",null,React.createElement(SaveButton,null),React.createElement("div",{style:{marginTop:6},className:"FIE_topbar-history-buttons"},React.createElement(ResetButton,{margin:"0"}),React.createElement(UndoButton,{margin:"0"}),React.createElement(RedoButton,{margin:"0"}))):React.createElement(React.Fragment,null,React.createElement(SaveButton,null),React.createElement("div",{className:"FIE_topbar-history-buttons"},React.createElement(ResetButton,null),React.createElement(UndoButton,null),React.createElement(RedoButton,null)))),React.createElement(StyledFlexCenterAlignedContainer,{className:"FIE_topbar-center-options"},React.createElement(ImageDimensionsAndDisplayToggle,null),React.createElement(Separator,null),React.createElement(CanvasZooming,null)),b?React.createElement(BackButton,null):React.createElement(CloseButton,null))};export default Topbar; | ||
import React from"react";import Separator from"../common/Separator";import{usePhoneScreen,useStore}from"../../hooks";import CloseButton from"./CloseButton";import SaveButton from"./SaveButton";import ResetButton from"./ResetButton";import UndoButton from"./UndoButton";import RedoButton from"./RedoButton";import ImageDimensionsAndDisplayToggle from"./ImageDimensionsAndDisplayToggle";import CanvasZooming from"./CanvasZooming";import{StyledTopbar,StyledFlexCenterAlignedContainer}from"./Topbar.styled";import BackButton from"./BackButton";var Topbar=function(){var a=useStore(),b=a.config,c=b.showBackButton,d=b.disableZooming,e=usePhoneScreen();return React.createElement(StyledTopbar,{reverseDirection:c,className:"FIE_topbar"},React.createElement(StyledFlexCenterAlignedContainer,{reverseDirection:c,className:"FIE_topbar-buttons-wrapper"},e?React.createElement("div",null,React.createElement(SaveButton,null),React.createElement("div",{style:{marginTop:6},className:"FIE_topbar-history-buttons"},React.createElement(ResetButton,{margin:"0"}),React.createElement(UndoButton,{margin:"0"}),React.createElement(RedoButton,{margin:"0"}))):React.createElement(React.Fragment,null,React.createElement(SaveButton,null),React.createElement("div",{className:"FIE_topbar-history-buttons"},React.createElement(ResetButton,null),React.createElement(UndoButton,null),React.createElement(RedoButton,null)))),React.createElement(StyledFlexCenterAlignedContainer,{className:"FIE_topbar-center-options"},React.createElement(ImageDimensionsAndDisplayToggle,null),!d&&React.createElement(React.Fragment,null,React.createElement(Separator,null),React.createElement(CanvasZooming,null))),c?React.createElement(BackButton,null):React.createElement(CloseButton,null))};export default Topbar; |
@@ -1,1 +0,1 @@ | ||
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import React,{useCallback,useState}from"react";import Revert from"@scaleflex/icons/revert";import Warning from"@scaleflex/icons/warning";import{useStore}from"../../hooks";import Modal from"../common/Modal";import{RESET}from"../../actions";import{StyledHistoryButton}from"./Topbar.styled";var ResetButton=function(a){var b=a.margin,c=useStore(),d=c.dispatch,e=c.isResetted,f=!(void 0!==e)||e,g=c.theme,h=c.feedback,i=c.t,j=0===h.duration,k=useState(!1),l=_slicedToArray(k,2),m=l[0],n=l[1],o=function(){n(!1)},p=useCallback(function(){d({type:RESET}),o()},[]);return React.createElement(React.Fragment,null,React.createElement(StyledHistoryButton,{className:"FIE_topbar-reset-button",color:"link",onClick:f?void 0:function openModal(){n(!0)},disabled:f||j,title:i("resetOperations"),margin:b},React.createElement(Revert,{size:12})),m&&React.createElement(Modal,{title:i("changesLoseConfirmation"),hint:i("changesLoseConfirmationHint"),isOpened:m,onCancel:o,onDone:p,Icon:function WarningIcon(){return React.createElement(Warning,{color:g.palette.warning,size:25})},doneLabel:i("continue"),cancelLabel:i("cancel"),doneButtonColor:"error",doneButtonStyle:{background:g.palette.warning}}))};ResetButton.defaultProps={margin:void 0};export default ResetButton; | ||
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import React,{useCallback,useState}from"react";import Revert from"@scaleflex/icons/revert";import Warning from"@scaleflex/icons/warning";import{useStore}from"../../hooks";import Modal from"../common/Modal";import{RESET}from"../../actions";import{StyledHistoryButton}from"./Topbar.styled";var ResetButton=function(a){var b=a.margin,c=useStore(),d=c.dispatch,e=c.isResetted,f=!(void 0!==e)||e,g=c.theme,h=c.feedback,i=c.t,j=c.config,k=0===h.duration,l=useState(!1),m=_slicedToArray(l,2),n=m[0],o=m[1],p=function(){o(!1)},q=useCallback(function(){d({type:RESET,payload:{config:j}}),p()},[j]);return React.createElement(React.Fragment,null,React.createElement(StyledHistoryButton,{className:"FIE_topbar-reset-button",color:"link",onClick:f?void 0:function openModal(){o(!0)},disabled:f||k,title:i("resetOperations"),margin:b},React.createElement(Revert,{size:12})),n&&React.createElement(Modal,{title:i("changesLoseConfirmation"),hint:i("changesLoseConfirmationHint"),isOpened:n,onCancel:p,onDone:q,Icon:function WarningIcon(){return React.createElement(Warning,{color:g.palette.warning,size:25})},doneLabel:i("continue"),cancelLabel:i("cancel"),doneButtonColor:"error",doneButtonStyle:{background:g.palette.warning}}))};ResetButton.defaultProps={margin:void 0};export default ResetButton; |
@@ -1,1 +0,1 @@ | ||
import _extends from"@babel/runtime/helpers/extends";import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import React,{useEffect,useRef,useState}from"react";import MenuItem from"@scaleflex/ui/core/menu-item";import SaveAs from"@scaleflex/icons/save-as";import Label from"@scaleflex/ui/core/label";import{useStore,useTransformedImgData}from"../../hooks";import getFileFullName from"../../utils/getFileFullName";import{CLOSING_REASONS,ELLIPSE_CROP,SUPPORTED_IMAGE_TYPES}from"../../utils/constants";import{SET_FEEDBACK,SHOW_LOADER}from"../../actions";import Modal from"../common/Modal";import Slider from"../common/Slider";import restrictNumber from"../../utils/restrictNumber";import{Resize}from"../tools/Resize";import ButtonWithMenu from"../common/ButtonWithMenu";import{StyledFileExtensionSelect,StyledFileNameInput,StyledQualityWrapper,StyledResizeOnSave}from"./Topbar.styled";var sliderStyle={marginBottom:16},saveButtonWrapperStyle={width:67},saveButtonMenuStyle={marginLeft:12},isFieSaveMounted=!0,SaveButton=function(){var a=useStore(),b=useRef(),c=a.theme,d=a.dispatch,e=a.originalImage,f=a.resize,g=a.isLoadingGlobally,h=a.haveNotSavedChanges,i=a.feedback,j=a.t,k=a.adjustments;k=void 0===k?{}:k;var l=k.crop,m=a.config,n=m.onClose,o=m.closeAfterSave,p=m.onBeforeSave,q=m.onSave,r=m.forceToPngInEllipticalCrop,s=m.defaultSavedImageType,t=m.useCloudimage,u=m.moreSaveOptions,v=useState(!1),w=_slicedToArray(v,2),x=w[0],y=w[1],z=useState({quality:.92}),A=_slicedToArray(z,2),B=A[0],C=A[1],D=useTransformedImgData(),E=["jpeg","jpg","webp"].includes(B.extension),F=0===i.duration,G=function(){isFieSaveMounted&&x&&(b.current=null,y(!1))},H=function(){var a=D(B),c=b.current||q;c(a.imageData,a.designState),b.current=null,o&&n&&n(CLOSING_REASONS.AFTER_SAVE,h)},I=function(){d({type:SHOW_LOADER}),y(!1),setTimeout(H,3)},J=function(){var a=b.current||q;if("function"!=typeof a)throw new Error("Please provide onSave function handler.");return B.name&&B.extension?void I():void d({type:SET_FEEDBACK,payload:{feedback:{message:j("nameIsRequired")}}})},K=function(){if(t){var a=D(B),c=b.current||q;return void c(a.imageData,a.designState)}return b.current||"function"!=typeof p||!1!==p(B)?void y(!0):void J()},L=function(a,c){if("function"==typeof a)b.current=a,c();else throw new Error("onSave function callback is required as an argument to the passed function.")};useEffect(function(){if(e&&(!B.name||!B.extension)){var a=getFileFullName(e.name,r&&l.ratio===ELLIPSE_CROP?"png":SUPPORTED_IMAGE_TYPES.includes(null===s||void 0===s?void 0:s.toLowerCase())&&s),b=a.name,c=a.extension;C(_objectSpread(_objectSpread({},B),{},{name:b,extension:c}))}},[e,x]),useEffect(function(){C(_objectSpread(_objectSpread({},B),{},{size:{width:f.width,height:f.height}}))},[f]),useEffect(function(){return isFieSaveMounted=!0,function(){isFieSaveMounted=!1}},[]);var M=Array.isArray(u)&&0<u.length?u.map(function(a,b){return _objectSpread(_objectSpread({},a),{},{key:"".concat(a.label||b,"-option-key"),onClick:"function"==typeof a.onClick?function(){return a.onClick(function(a){return L(a,K)},function(a){return L(a,I)})}:void 0})}):[];return React.createElement(React.Fragment,null,React.createElement(ButtonWithMenu,{className:"FIE_topbar-save",color:"primary",label:j("save"),onClick:K,menuPosition:"bottom",menuItems:M,menuStyle:saveButtonMenuStyle,wrapperStyle:saveButtonWrapperStyle,disabled:g||F}),x&&React.createElement(Modal,{className:"FIE_save-modal",title:j("saveAsModalLabel"),Icon:function Icon(a){return React.createElement(SaveAs,_extends({color:c.palette["accent-primary"]},a))},isOpened:x,onCancel:G,onDone:J,doneLabel:j("save"),cancelLabel:j("cancel"),doneButtonColor:"primary",areButtonsDisabled:g,zIndex:11110},React.createElement(StyledFileNameInput,{className:"FIE_save-file-name-input",value:B.name,onChange:function changeFileName(a){var b=a.target.value;C(_objectSpread(_objectSpread({},B),{},{name:b}))},size:"sm",placeholder:j("name"),error:!!B.name,focusOnMount:!0}),React.createElement(StyledFileExtensionSelect,{className:"FIE_save-extension-selector",onChange:function onChange(a){return C(_objectSpread(_objectSpread({},B),{},{extension:a}))},value:B.extension,placeholder:j("extension"),size:"sm"},SUPPORTED_IMAGE_TYPES.map(function(a){return React.createElement(MenuItem,{key:a,value:a},a)})),E&&React.createElement(StyledQualityWrapper,{className:"FIE_save-quality-wrapper"},React.createElement(Label,null,j("quality")),React.createElement(Slider,{annotation:"%",min:1,max:100,onChange:function changeQuality(a){C(_objectSpread(_objectSpread({},B),{},{quality:restrictNumber(a/100,.01,1)}))},value:parseInt(100*B.quality,10),width:"100%",style:sliderStyle})),React.createElement(StyledResizeOnSave,{className:"FIE_save-resize-wrapper"},React.createElement(Label,null,j("resize")),React.createElement(Resize,{onChange:function resizeImageFile(a){C(_objectSpread(_objectSpread({},B),{},{size:_objectSpread(_objectSpread({},B.size),a)}))},currentSize:(null===B||void 0===B?void 0:B.size)||{},hideResetButton:!0,alignLeft:!0}))))};export default SaveButton; | ||
import _extends from"@babel/runtime/helpers/extends";import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import React,{useEffect,useRef,useState}from"react";import MenuItem from"@scaleflex/ui/core/menu-item";import SaveAs from"@scaleflex/icons/save-as";import Label from"@scaleflex/ui/core/label";import{useStore,useTransformedImgData}from"../../hooks";import getFileFullName from"../../utils/getFileFullName";import{CLOSING_REASONS,ELLIPSE_CROP,SUPPORTED_IMAGE_TYPES}from"../../utils/constants";import{HIDE_LOADER,SET_FEEDBACK,SHOW_LOADER}from"../../actions";import Modal from"../common/Modal";import Slider from"../common/Slider";import restrictNumber from"../../utils/restrictNumber";import{Resize}from"../tools/Resize";import ButtonWithMenu from"../common/ButtonWithMenu";import{StyledFileExtensionSelect,StyledFileNameInput,StyledQualityWrapper,StyledResizeOnSave}from"./Topbar.styled";var sliderStyle={marginBottom:16},saveButtonWrapperStyle={width:67},saveButtonMenuStyle={marginLeft:12},isFieSaveMounted=!0,SaveButton=function(){var a=useStore(),b=useRef(),c=a.theme,d=a.dispatch,e=a.originalImage,f=a.resize,g=a.isLoadingGlobally,h=a.haveNotSavedChanges,i=a.feedback,j=a.t,k=a.adjustments;k=void 0===k?{}:k;var l=k.crop,m=a.config,n=m.onClose,o=m.closeAfterSave,p=m.onBeforeSave,q=m.onSave,r=m.forceToPngInEllipticalCrop,s=m.defaultSavedImageType,t=m.useCloudimage,u=m.moreSaveOptions,v=useState(!1),w=_slicedToArray(v,2),x=w[0],y=w[1],z=useState({quality:.92}),A=_slicedToArray(z,2),B=A[0],C=A[1],D=useTransformedImgData(),E=["jpeg","jpg","webp"].includes(B.extension),F=0===i.duration,G=function(){isFieSaveMounted&&x&&(b.current=null,y(!1))},H=function(){var a=D(B,!1,!0),c=b.current||q,e=c(a.imageData,a.designState),f=function(){d({type:HIDE_LOADER})};e instanceof Promise?e["finally"](f):f(),b.current=null,o&&n&&n(CLOSING_REASONS.AFTER_SAVE,h)},I=function(){d({type:SHOW_LOADER}),y(!1),setTimeout(H,3)},J=function(){var a=b.current||q;if("function"!=typeof a)throw new Error("Please provide onSave function handler.");return B.name&&B.extension?void I():void d({type:SET_FEEDBACK,payload:{feedback:{message:j("nameIsRequired")}}})},K=function(){if(t){var a=D(B),c=b.current||q;return void c(a.imageData,a.designState)}return b.current||"function"!=typeof p||!1!==p(B)?void y(!0):void J()},L=function(a,c){if("function"==typeof a)b.current=a,c();else throw new Error("onSave function callback is required as an argument to the passed function.")};useEffect(function(){if(e&&(!B.name||!B.extension)){var a=getFileFullName(e.name,r&&l.ratio===ELLIPSE_CROP?"png":SUPPORTED_IMAGE_TYPES.includes(null===s||void 0===s?void 0:s.toLowerCase())&&s),b=a.name,c=a.extension;C(_objectSpread(_objectSpread({},B),{},{name:b,extension:c}))}},[e,x]),useEffect(function(){C(_objectSpread(_objectSpread({},B),{},{size:{width:f.width,height:f.height}}))},[f]),useEffect(function(){return isFieSaveMounted=!0,function(){isFieSaveMounted=!1}},[]);var M=Array.isArray(u)&&0<u.length?u.map(function(a,b){return _objectSpread(_objectSpread({},a),{},{key:"".concat(a.label||b,"-option-key"),onClick:"function"==typeof a.onClick?function(){return a.onClick(function(a){return L(a,K)},function(a){return L(a,I)})}:void 0})}):[];return React.createElement(React.Fragment,null,React.createElement(ButtonWithMenu,{className:"FIE_topbar-save",color:"primary",label:j("save"),onClick:K,menuPosition:"bottom",menuItems:M,menuStyle:saveButtonMenuStyle,wrapperStyle:saveButtonWrapperStyle,disabled:g||F}),x&&React.createElement(Modal,{className:"FIE_save-modal",title:j("saveAsModalLabel"),Icon:function Icon(a){return React.createElement(SaveAs,_extends({color:c.palette["accent-primary"]},a))},isOpened:x,onCancel:G,onDone:J,doneLabel:j("save"),cancelLabel:j("cancel"),doneButtonColor:"primary",areButtonsDisabled:g,zIndex:11110},React.createElement(StyledFileNameInput,{className:"FIE_save-file-name-input",value:B.name,onChange:function changeFileName(a){var b=a.target.value;C(_objectSpread(_objectSpread({},B),{},{name:b}))},size:"sm",placeholder:j("name"),error:!!B.name,focusOnMount:!0}),React.createElement(StyledFileExtensionSelect,{className:"FIE_save-extension-selector",onChange:function onChange(a){return C(_objectSpread(_objectSpread({},B),{},{extension:a}))},value:B.extension,placeholder:j("extension"),size:"sm"},SUPPORTED_IMAGE_TYPES.map(function(a){return React.createElement(MenuItem,{key:a,value:a},a)})),E&&React.createElement(StyledQualityWrapper,{className:"FIE_save-quality-wrapper"},React.createElement(Label,null,j("quality")),React.createElement(Slider,{annotation:"%",min:1,max:100,onChange:function changeQuality(a){C(_objectSpread(_objectSpread({},B),{},{quality:restrictNumber(a/100,.01,1)}))},value:parseInt(100*B.quality,10),width:"100%",style:sliderStyle})),React.createElement(StyledResizeOnSave,{className:"FIE_save-resize-wrapper"},React.createElement(Label,null,j("resize")),React.createElement(Resize,{onChange:function resizeImageFile(a){C(_objectSpread(_objectSpread({},B),{},{size:_objectSpread(_objectSpread({},B.size),a)}))},currentSize:(null===B||void 0===B?void 0:B.size)||{},hideResetButton:!0,alignLeft:!0}))))};export default SaveButton; |
@@ -1,1 +0,1 @@ | ||
import _defineProperty from"@babel/runtime/helpers/defineProperty";var _theme$annotationsCom;import{MIN_CROP,TABS_IDS,TOOLS_IDS}from"../utils/constants";export default(_theme$annotationsCom={theme:{palette:{"bg-primary-active":"#ECF3FF"},typography:{fontFamily:"Roboto, Arial"}},annotationsCommon:{fill:"#000000",stroke:"#000000",strokeWidth:0,shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,shadowColor:"#000000",shadowOpacity:1,opacity:1}},_defineProperty(_theme$annotationsCom,TOOLS_IDS.TEXT,{text:"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",fontFamily:"Arial",fonts:[{label:"Arial",value:"Arial"},"Tahoma","Sans-serif",{label:"Comic Sans",value:"Comic-sans"}],fontSize:14,letterSpacing:0,lineHeight:1,align:"left",fontStyle:"normal",onFontChange:void 0}),_defineProperty(_theme$annotationsCom,TOOLS_IDS.IMAGE,{fill:void 0}),_defineProperty(_theme$annotationsCom,TOOLS_IDS.RECT,{cornerRadius:0}),_defineProperty(_theme$annotationsCom,TOOLS_IDS.ELLIPSE,{}),_defineProperty(_theme$annotationsCom,TOOLS_IDS.POLYGON,{sides:3}),_defineProperty(_theme$annotationsCom,TOOLS_IDS.PEN,{strokeWidth:1,tension:.5,lineCap:"round"}),_defineProperty(_theme$annotationsCom,TOOLS_IDS.LINE,{lineCap:"butt",strokeWidth:1}),_defineProperty(_theme$annotationsCom,TOOLS_IDS.ARROW,{strokeWidth:6,lineCap:"butt",pointerLength:void 0,pointerWidth:void 0}),_defineProperty(_theme$annotationsCom,TOOLS_IDS.WATERMARK,{gallery:[]}),_defineProperty(_theme$annotationsCom,TOOLS_IDS.CROP,{minWidth:MIN_CROP.WIDTH,minHeight:MIN_CROP.HEIGHT,width:null,height:null,maxWidth:null,maxHeight:null,ratio:"original",ratioTitleKey:void 0,noPresets:!1,autoResize:!1,presetsItems:[],presetsFolders:[]}),_defineProperty(_theme$annotationsCom,"tabsIds",[]),_defineProperty(_theme$annotationsCom,"defaultTabId",TABS_IDS.ADJUST),_defineProperty(_theme$annotationsCom,"defaultToolId",TOOLS_IDS.CROP),_defineProperty(_theme$annotationsCom,"onClose",void 0),_defineProperty(_theme$annotationsCom,"onSave",void 0),_defineProperty(_theme$annotationsCom,"onBeforeSave",void 0),_defineProperty(_theme$annotationsCom,"closeAfterSave",!1),_defineProperty(_theme$annotationsCom,"defaultSavedImageName",void 0),_defineProperty(_theme$annotationsCom,"defaultSavedImageType",null),_defineProperty(_theme$annotationsCom,"forceToPngInEllipticalCrop",!1),_defineProperty(_theme$annotationsCom,"useBackendTranslations",!0),_defineProperty(_theme$annotationsCom,"translations",null),_defineProperty(_theme$annotationsCom,"language","en"),_defineProperty(_theme$annotationsCom,"avoidChangesNotSavedAlertOnLeave",!1),_defineProperty(_theme$annotationsCom,"loadableDesignState",null),_defineProperty(_theme$annotationsCom,"moreSaveOptions",[]),_defineProperty(_theme$annotationsCom,"savingPixelRatio",8),_defineProperty(_theme$annotationsCom,"previewPixelRatio",window?window.devicePixelRatio||1:1),_defineProperty(_theme$annotationsCom,"showBackButton",!1),_defineProperty(_theme$annotationsCom,"useCloudimage",!1),_defineProperty(_theme$annotationsCom,"cloudimage",{token:"",dontPrefixUrl:!1,domain:"cloudimg.io",version:"",loadableQuery:"",secureProtocol:!0,imageSealing:{enable:!1,salt:"",charCount:10,includeParams:[]}}),_defineProperty(_theme$annotationsCom,"observePluginContainerSize",!1),_defineProperty(_theme$annotationsCom,"showCanvasOnly",!1),_defineProperty(_theme$annotationsCom,"getCurrentImgDataFnRef",void 0),_defineProperty(_theme$annotationsCom,"onModify",void 0),_defineProperty(_theme$annotationsCom,"useZoomPresetsMenu",!0),_theme$annotationsCom); | ||
import _defineProperty from"@babel/runtime/helpers/defineProperty";var _theme$annotationsCom;import{MIN_CROP,TABS_IDS,TOOLS_IDS}from"../utils/constants";export default(_theme$annotationsCom={theme:{palette:{"bg-primary-active":"#ECF3FF"},typography:{fontFamily:"Roboto, Arial"}},annotationsCommon:{fill:"#000000",stroke:"#000000",strokeWidth:0,shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,shadowColor:"#000000",shadowOpacity:1,opacity:1}},_defineProperty(_theme$annotationsCom,TOOLS_IDS.TEXT,{text:"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",fontFamily:"Arial",fonts:[{label:"Arial",value:"Arial"},"Tahoma","Sans-serif",{label:"Comic Sans",value:"Comic-sans"}],fontSize:14,letterSpacing:0,lineHeight:1,align:"left",fontStyle:"normal",onFontChange:void 0}),_defineProperty(_theme$annotationsCom,TOOLS_IDS.IMAGE,{fill:void 0}),_defineProperty(_theme$annotationsCom,TOOLS_IDS.RECT,{cornerRadius:0}),_defineProperty(_theme$annotationsCom,TOOLS_IDS.ELLIPSE,{}),_defineProperty(_theme$annotationsCom,TOOLS_IDS.POLYGON,{sides:3}),_defineProperty(_theme$annotationsCom,TOOLS_IDS.PEN,{strokeWidth:1,tension:.5,lineCap:"round"}),_defineProperty(_theme$annotationsCom,TOOLS_IDS.LINE,{lineCap:"butt",strokeWidth:1}),_defineProperty(_theme$annotationsCom,TOOLS_IDS.ARROW,{strokeWidth:6,lineCap:"butt",pointerLength:void 0,pointerWidth:void 0}),_defineProperty(_theme$annotationsCom,TOOLS_IDS.WATERMARK,{gallery:[]}),_defineProperty(_theme$annotationsCom,TOOLS_IDS.CROP,{minWidth:MIN_CROP.WIDTH,minHeight:MIN_CROP.HEIGHT,width:null,height:null,maxWidth:null,maxHeight:null,ratio:"original",ratioTitleKey:void 0,noPresets:!1,autoResize:!1,presetsItems:[],presetsFolders:[]}),_defineProperty(_theme$annotationsCom,"tabsIds",[]),_defineProperty(_theme$annotationsCom,"defaultTabId",TABS_IDS.ADJUST),_defineProperty(_theme$annotationsCom,"defaultToolId",TOOLS_IDS.CROP),_defineProperty(_theme$annotationsCom,"onClose",void 0),_defineProperty(_theme$annotationsCom,"onSave",void 0),_defineProperty(_theme$annotationsCom,"onBeforeSave",void 0),_defineProperty(_theme$annotationsCom,"closeAfterSave",!1),_defineProperty(_theme$annotationsCom,"defaultSavedImageName",void 0),_defineProperty(_theme$annotationsCom,"defaultSavedImageType",null),_defineProperty(_theme$annotationsCom,"forceToPngInEllipticalCrop",!1),_defineProperty(_theme$annotationsCom,"useBackendTranslations",!0),_defineProperty(_theme$annotationsCom,"translations",null),_defineProperty(_theme$annotationsCom,"language","en"),_defineProperty(_theme$annotationsCom,"avoidChangesNotSavedAlertOnLeave",!1),_defineProperty(_theme$annotationsCom,"loadableDesignState",null),_defineProperty(_theme$annotationsCom,"moreSaveOptions",[]),_defineProperty(_theme$annotationsCom,"savingPixelRatio",4),_defineProperty(_theme$annotationsCom,"previewPixelRatio",window?window.devicePixelRatio||1:1),_defineProperty(_theme$annotationsCom,"showBackButton",!1),_defineProperty(_theme$annotationsCom,"useCloudimage",!1),_defineProperty(_theme$annotationsCom,"cloudimage",{token:"",dontPrefixUrl:!1,domain:"cloudimg.io",version:"",loadableQuery:"",secureProtocol:!0,imageSealing:{enable:!1,salt:"",charCount:10,includeParams:[]}}),_defineProperty(_theme$annotationsCom,"observePluginContainerSize",!1),_defineProperty(_theme$annotationsCom,"showCanvasOnly",!1),_defineProperty(_theme$annotationsCom,"getCurrentImgDataFnRef",void 0),_defineProperty(_theme$annotationsCom,"onModify",void 0),_defineProperty(_theme$annotationsCom,"useZoomPresetsMenu",!0),_defineProperty(_theme$annotationsCom,"disableZooming",!1),_theme$annotationsCom); |
@@ -1,1 +0,1 @@ | ||
import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";import _defineProperty from"@babel/runtime/helpers/defineProperty";var _excluded=["isDesignState"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import{useReducer}from"react";import{REDO,RESET,UNDO}from"../actions";import redo from"../actions/redo";import reset from"../actions/reset";import undo from"../actions/undo";import extractCurrentDesignState from"../utils/extractCurrentDesignState";var timeout,useAppReducer=function(a,b){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=_objectSpread(_objectSpread({},b),{},{pastDesignStates:[],futureDesignStates:[],hasRedo:!1,hasUndo:!1});return useReducer(function undoRedoResetReducer(b,e){var f=a(b,e)||d;if(e.type===UNDO)return undo(b)||b;if(e.type===REDO)return redo(b)||b;if(e.type===RESET)return reset(b)||b;if(f.isDesignState){var g=extractCurrentDesignState(b),h=f.isDesignState,i=_objectWithoutProperties(f,_excluded),j=_objectSpread(_objectSpread({},i),{},{pastDesignStates:[g].concat(_toConsumableArray(b.pastDesignStates)),hasUndo:!0,hasRedo:!1,futureDesignStates:[],isResetted:!1,haveNotSavedChanges:!0});return timeout=setTimeout(function(){clearTimeout(timeout),"function"==typeof c.onModify&&c.onModify(j)}),j}return f},d)};export default useAppReducer; | ||
import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";import _defineProperty from"@babel/runtime/helpers/defineProperty";var _excluded=["isDesignState"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import{useReducer}from"react";import{REDO,RESET,UNDO}from"../actions";import extractCurrentDesignState from"../utils/extractCurrentDesignState";var timeout,useAppReducer=function(a,b){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=_objectSpread(_objectSpread({},b),{},{pastDesignStates:[],futureDesignStates:[],hasRedo:!1,hasUndo:!1});return useReducer(function undoRedoResetReducer(b,e){var f=a(b,e)||d;if([UNDO,REDO,RESET].includes(e.type))return f;if(f.isDesignState){var g=extractCurrentDesignState(b),h=f.isDesignState,i=_objectWithoutProperties(f,_excluded),j=_objectSpread(_objectSpread({},i),{},{pastDesignStates:[g].concat(_toConsumableArray(b.pastDesignStates)),hasUndo:!0,hasRedo:!1,futureDesignStates:[],isResetted:!1,haveNotSavedChanges:!0});return timeout=setTimeout(function(){clearTimeout(timeout),"function"==typeof c.onModify&&c.onModify(j)}),j}return f},d)};export default useAppReducer; |
@@ -1,1 +0,1 @@ | ||
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["filter"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import Konva from"konva";import{HIDE_LOADER,SET_SAVED}from"../actions";import{ELLIPSE_CROP,IMAGE_NODE_ID,SUPPORTED_IMAGE_TYPES,TOOLS_IDS}from"../utils/constants";import extractCurrentDesignState from"../utils/extractCurrentDesignState";import mapCropBox from"../utils/mapCropBox";import getSizeAfterRotation from"../utils/getSizeAfterRotation";import imageToBase64 from"../utils/imageToBase64";import getFileFullName from"../utils/getFileFullName";import operationsToCloudimageUrl from"../utils/operationsToCloudimageUrl";import useStore from"./useStore";var useTransformedImgData=function(){var a=useStore(),b=a.dispatch,c=a.designLayer,d=a.shownImageDimensions,e=a.originalImage,f=a.adjustments,g=f.crop,h=f.rotation,i=void 0===h?0:h,j=f.isFlippedX,k=f.isFlippedY,l=a.config,m=l.savingPixelRatio,n=l.previewPixelRatio,o=l.forceToPngInEllipticalCrop,p=l.defaultSavedImageType,q=l.useCloudimage,r=l.cloudimage;return q?function getTransformedCloudimageData(){var b,c,f=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},h=extractCurrentDesignState(a),i=h.filter,j=_objectWithoutProperties(h,_excluded),k=operationsToCloudimageUrl(r,j,d,e),l=mapCropBox({x:g.x,y:g.y,width:g.width,height:g.height},d,e),m={cloudimageUrl:k,width:(null===f||void 0===f||null===(b=f.size)||void 0===b?void 0:b.width)||l.width,height:(null===f||void 0===f||null===(c=f.size)||void 0===c?void 0:c.height)||l.height};return{imageData:m,designState:j}}:function getTransformedImgData(){var f=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},h=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1];Konva.pixelRatio=h||m;var l=c.attrs,q=l.clipWidth,r=l.clipHeight,s=l.clipX,t=l.clipY;c.setAttr("isSaving",!0);var u=c.getStage().clone({width:e.width,height:e.height,scaleX:j?-1:1,scaleY:k?-1:1}),v=_slicedToArray(u.children,1),w=v[0];u.children[1].destroy();var x=u.findOne("#".concat(IMAGE_NODE_ID));x.cache();var y={x:u.width()/d.width,y:u.height()/d.height};w.setAttrs({rotation:0,offsetX:0,offsetY:0,x:0,y:0,scaleX:y.x,scaleY:y.y});var z=_objectSpread(_objectSpread({},(!f.name||!f.extension)&&getFileFullName(e.name,o&&g.ratio===ELLIPSE_CROP?"png":SUPPORTED_IMAGE_TYPES.includes(null===p||void 0===p?void 0:p.toLowerCase())&&p)),f),A=z.name,B=z.extension,C=z.quality,D=void 0===C?92:C,E=z.size,F=void 0===E?{}:E,G=["jpeg","jpg","webp"].includes(B),H=mapCropBox({x:g.x||s,y:g.y||t,width:g.width||q,height:g.height||r},d,u.attrs),I=getSizeAfterRotation(H.width,H.height,i);if(u.setAttrs({offsetX:H.width/2+H.x,offsetY:H.height/2+H.y,width:I.width,height:I.height,x:I.width/2,y:I.height/2,rotation:i}),F.width){var O=(j?-1:1)*(F.width/u.width());u.setAttrs({scaleX:O,width:F.width,x:u.x()*Math.abs(O)})}if(F.height){var P=(k?-1:1)*(F.height/u.height());u.setAttrs({scaleY:P,height:F.height,y:u.y()*Math.abs(P)})}var J=_objectSpread({mimeType:"image/".concat("jpg"===B?"jpeg":B)},G?{quality:D}:{}),K=u.toCanvas(J),L=u.toDataURL(J),M=_objectSpread(_objectSpread({},extractCurrentDesignState(a)),{},{shownImageDimensions:{width:a.shownImageDimensions.width,height:a.shownImageDimensions.height,scaledBy:a.shownImageDimensions.scaledBy}});M.filter&&(M.filter=M.filter.name),M.finetunes=M.finetunes.map(function(a){return a.name}),Object.keys(M.annotations).forEach(function(a){var b,c=M.annotations[a],d=c.name===TOOLS_IDS.IMAGE&&(null===(b=c.image)||void 0===b?void 0:b.src);d&&d.startsWith("blob:")?M.annotations[a].image=imageToBase64(c.image):c.image instanceof HTMLImageElement&&(M.annotations[a].image=d)});var N=_objectSpread({fullName:"".concat(A,".").concat(B),name:A,extension:B,mimeType:"image/".concat(B),imageCanvas:K,imageBase64:L,width:F.width||H.width,height:F.height||H.height},G?{quality:D}:{});return c.setAttr("isSaving",!1),b({type:SET_SAVED}),x.clearCache(),Konva.pixelRatio=n,b({type:HIDE_LOADER}),{imageData:N,designState:M}}};export default useTransformedImgData; | ||
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["filter"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import Konva from"konva";import{HIDE_LOADER,SET_SAVED}from"../actions";import{ELLIPSE_CROP,IMAGE_NODE_ID,SUPPORTED_IMAGE_TYPES,TOOLS_IDS}from"../utils/constants";import extractCurrentDesignState from"../utils/extractCurrentDesignState";import mapCropBox from"../utils/mapCropBox";import getSizeAfterRotation from"../utils/getSizeAfterRotation";import imageToBase64 from"../utils/imageToBase64";import getFileFullName from"../utils/getFileFullName";import operationsToCloudimageUrl from"../utils/operationsToCloudimageUrl";import useStore from"./useStore";var useTransformedImgData=function(){var a=useStore(),b=a.dispatch,c=a.designLayer,d=a.shownImageDimensions,e=a.originalImage,f=a.adjustments,g=f.crop,h=f.rotation,i=void 0===h?0:h,j=f.isFlippedX,k=f.isFlippedY,l=a.config,m=l.savingPixelRatio,n=l.previewPixelRatio,o=l.forceToPngInEllipticalCrop,p=l.defaultSavedImageType,q=l.useCloudimage,r=l.cloudimage;return q?function getTransformedCloudimageData(){var b,c,f=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},h=extractCurrentDesignState(a),i=h.filter,j=_objectWithoutProperties(h,_excluded),k=operationsToCloudimageUrl(r,j,d,e),l=mapCropBox({x:g.x,y:g.y,width:g.width,height:g.height},d,e),m={cloudimageUrl:k,width:(null===f||void 0===f||null===(b=f.size)||void 0===b?void 0:b.width)||l.width,height:(null===f||void 0===f||null===(c=f.size)||void 0===c?void 0:c.height)||l.height};return{imageData:m,designState:j}}:function getTransformedImgData(){var f=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},h=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1],l=!!(2<arguments.length&&void 0!==arguments[2])&&arguments[2];Konva.pixelRatio=h||m;var q=c.attrs,r=q.clipWidth,s=q.clipHeight,t=q.clipX,u=q.clipY;c.setAttr("isSaving",!0);var v=c.getStage().clone({width:e.width,height:e.height,scaleX:j?-1:1,scaleY:k?-1:1}),w=_slicedToArray(v.children,1),x=w[0];v.children[1].destroy();var y=v.findOne("#".concat(IMAGE_NODE_ID));y.cache();var z={x:v.width()/d.width,y:v.height()/d.height};x.setAttrs({rotation:0,offsetX:0,offsetY:0,x:0,y:0,scaleX:z.x,scaleY:z.y});var A=_objectSpread(_objectSpread({},(!f.name||!f.extension)&&getFileFullName(e.name,o&&g.ratio===ELLIPSE_CROP?"png":SUPPORTED_IMAGE_TYPES.includes(null===p||void 0===p?void 0:p.toLowerCase())&&p)),f),B=A.name,C=A.extension,D=A.quality,E=void 0===D?92:D,F=A.size,G=void 0===F?{}:F,H=["jpeg","jpg","webp"].includes(C),I=mapCropBox({x:g.x||t,y:g.y||u,width:g.width||r,height:g.height||s},d,v.attrs),J=getSizeAfterRotation(I.width,I.height,i);if(v.setAttrs({offsetX:I.width/2+I.x,offsetY:I.height/2+I.y,width:J.width,height:J.height,x:J.width/2,y:J.height/2,rotation:i}),G.width){var Q=(j?-1:1)*(G.width/v.width());v.setAttrs({scaleX:Q,width:G.width,x:v.x()*Math.abs(Q)})}if(G.height){var R=(k?-1:1)*(G.height/v.height());v.setAttrs({scaleY:R,height:G.height,y:v.y()*Math.abs(R)})}var K=_objectSpread({mimeType:"image/".concat("jpg"===C?"jpeg":C)},H?{quality:E}:{}),L=v.toCanvas(K),M=v.toDataURL(K),N=_objectSpread(_objectSpread({},extractCurrentDesignState(a)),{},{shownImageDimensions:{width:a.shownImageDimensions.width,height:a.shownImageDimensions.height,scaledBy:a.shownImageDimensions.scaledBy}});N.filter&&(N.filter=N.filter.name),N.finetunes=N.finetunes.map(function(a){return a.name}),Object.keys(N.annotations).forEach(function(a){var b,c=N.annotations[a],d=c.name===TOOLS_IDS.IMAGE&&(null===(b=c.image)||void 0===b?void 0:b.src);d&&d.startsWith("blob:")?N.annotations[a].image=imageToBase64(c.image):c.image instanceof HTMLImageElement&&(N.annotations[a].image=d)});var O=_objectSpread({fullName:"".concat(B,".").concat(C),name:B,extension:C,mimeType:"image/".concat(C),imageCanvas:L,imageBase64:M,width:G.width||I.width,height:G.height||I.height},H?{quality:E}:{});c.setAttr("isSaving",!1),b({type:SET_SAVED}),y.clearCache(),Konva.pixelRatio=n;var P=function(){b({type:HIDE_LOADER})};return l||P(),{imageData:O,designState:N,hideLoadingSpinner:P}}};export default useTransformedImgData; |
@@ -188,3 +188,3 @@ import { FunctionComponent, RefObject } from "react"; | ||
type onSaveFunction = (savedImageData: savedImageData, imageDesignState: imageDesignState) => void; | ||
type onSaveFunction = (savedImageData: savedImageData, imageDesignState: imageDesignState) => void | Promise; | ||
@@ -196,3 +196,7 @@ export type getCurrentImgDataFunction = (imageFileInfo: { | ||
size?: { width?: number, height?: number }, | ||
}, pixelRatio: boolean) => ({ imageData: savedImageData, designState: imageDesignState }); | ||
}, pixelRatio?: boolean | number, keepLoadingSpinnerShown?: boolean) => ({ | ||
imageData: savedImageData, | ||
designState: imageDesignState, | ||
hideLoadingSpinner: () => void, | ||
}); | ||
@@ -292,2 +296,3 @@ type triggerSaveModalFn = (onSaveFunction) => void; | ||
useZoomPresetsMenu?: boolean; | ||
disableZooming?: boolean; | ||
} | ||
@@ -294,0 +299,0 @@ |
@@ -1,1 +0,1 @@ | ||
import defaultConfig from"../context/defaultConfig";import getInitialAppState from"../context/getInitialAppState";var extractCurrentDesignState=function(a){var b=getInitialAppState(defaultConfig);return{imgSrc:a.imgSrc||b.imgSrc,finetunes:a.finetunes||b.finetunes,finetunesProps:a.finetunesProps||b.finetunesProps,filter:a.filter||b.filter,adjustments:a.adjustments||b.adjustments,annotations:a.annotations||b.annotations,resize:a.resize||b.resize}};export default extractCurrentDesignState; | ||
import defaultConfig from"../context/defaultConfig";import getInitialAppState from"../context/getInitialAppState";var extractCurrentDesignState=function(a,b){var c=getInitialAppState(b?a:defaultConfig);return{imgSrc:a.imgSrc||c.imgSrc,finetunes:a.finetunes||c.finetunes,finetunesProps:a.finetunesProps||c.finetunesProps,filter:a.filter||c.filter,adjustments:a.adjustments||c.adjustments,annotations:a.annotations||c.annotations,resize:a.resize||c.resize}};export default extractCurrentDesignState; |
@@ -1,1 +0,1 @@ | ||
import _defineProperty from"@babel/runtime/helpers/defineProperty";function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import defaultTranslations from"../context/defaultTranslations";import{TRANSLATIONS_GRID_UUID}from"./constants";var backendTranslations={},activatedTranslations=_objectSpread({},defaultTranslations),hardcodedErrorMsg="Error while loading translations from backend.";export var updateTranslations=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:"en";return Object.assign(activatedTranslations,backendTranslations[null===b||void 0===b?void 0:b.toLowerCase()]||{},a)};var sendMissingTranslationsToBackend=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:[];return new Promise(function(b,c){var d=new XMLHttpRequest;d.responseType="json",d.onload=function(){if(200<=d.status&&300>d.status)b(d.response);else{var a;console.warn("Error in sending translation key to backend ".concat(null===(a=d.response)||void 0===a?void 0:a.hint,", ").concat(d.status)),c()}},d.onerror=function(){var a;console.warn("Error in sending translation key to backend ".concat(null===(a=d.response)||void 0===a?void 0:a.hint,", ").concat(d.status)),c()};d.open("POST","https://i18n.ultrafast.io/import/request-translations?grid_uuid=".concat(TRANSLATIONS_GRID_UUID)),d.send(JSON.stringify({grid_uuid:TRANSLATIONS_GRID_UUID,translations_requests:a}))})};export var getBackendTranslations=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:"en",b=1<arguments.length?arguments[1]:void 0;return new Promise(function(c,d){var e=a.toLowerCase(),f=new XMLHttpRequest;f.responseType="json",f.onload=function(){if(200<=f.status&&300>f.status){(f.response||[]).forEach(function(a){backendTranslations[e]=_objectSpread(_objectSpread({},backendTranslations[e]),{},_defineProperty({},a.translation_key,a.translations[e]))});var i=[];Object.keys(defaultTranslations).forEach(function(a){var b;a&&!(null!==(b=backendTranslations[e])&&void 0!==b&&b[a])&&i.push({key:a,lang:e,default:defaultTranslations[a]})}),0<i.length&&sendMissingTranslationsToBackend(i),updateTranslations(b,e),c(activatedTranslations)}else{var a,g,h;console.error("Status code: ".concat(f.status)),console.error((null===(a=f.response)||void 0===a?void 0:a.msg)||(null===(g=f.response)||void 0===g?void 0:g.msg)||(null===(h=f.response)||void 0===h?void 0:h.details)||hardcodedErrorMsg),d()}},f.onerror=function(){console.error("Status code ".concat(f.status,", error: ").concat(hardcodedErrorMsg)),d()},f.open("GET","https://i18n.ultrafast.io/api/export?grid=".concat(TRANSLATIONS_GRID_UUID)),f.send()})};export var translate=function(a){return activatedTranslations[a]||a||""}; | ||
import _defineProperty from"@babel/runtime/helpers/defineProperty";function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import defaultTranslations from"../context/defaultTranslations";import{TRANSLATIONS_GRID_UUID}from"./constants";var backendTranslations={},activatedTranslations=_objectSpread({},defaultTranslations),hardcodedErrorMsg="Error while loading translations from backend.";export var updateTranslations=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:"en";return Object.assign(activatedTranslations,backendTranslations[null===b||void 0===b?void 0:b.toLowerCase()]||{},a)};var sendMissingTranslationsToBackend=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:[];return new Promise(function(b,c){var d=new XMLHttpRequest;d.responseType="json",d.onload=function(){if(200<=d.status&&300>d.status)b(d.response);else{var a;console.warn("Error in sending translation key to backend ".concat(null===(a=d.response)||void 0===a?void 0:a.hint,", ").concat(d.status)),c()}},d.onerror=function(){var a;console.warn("Error in sending translation key to backend ".concat(null===(a=d.response)||void 0===a?void 0:a.hint,", ").concat(d.status)),c()};d.open("POST","https://neo.wordplex.io/api/import/request-translations?grid_uuid=".concat(TRANSLATIONS_GRID_UUID)),d.send(JSON.stringify({grid_uuid:TRANSLATIONS_GRID_UUID,translations_requests:a}))})};export var getBackendTranslations=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:"en",b=1<arguments.length?arguments[1]:void 0;return new Promise(function(c,d){var e=a.toLowerCase(),f=new XMLHttpRequest;f.responseType="json",f.onload=function(){if(200<=f.status&&300>f.status){(f.response||[]).forEach(function(a){backendTranslations[e]=_objectSpread(_objectSpread({},backendTranslations[e]),{},_defineProperty({},a.translation_key,a.translations[e]))});var i=[];Object.keys(defaultTranslations).forEach(function(a){var b;a&&!(null!==(b=backendTranslations[e])&&void 0!==b&&b[a])&&i.push({key:a,lang:e,default:defaultTranslations[a]})}),0<i.length&&sendMissingTranslationsToBackend(i),updateTranslations(b,e),c(activatedTranslations)}else{var a,g,h;console.error("Status code: ".concat(f.status)),console.error((null===(a=f.response)||void 0===a?void 0:a.msg)||(null===(g=f.response)||void 0===g?void 0:g.msg)||(null===(h=f.response)||void 0===h?void 0:h.details)||hardcodedErrorMsg),d()}},f.onerror=function(){console.error("Status code ".concat(f.status,", error: ").concat(hardcodedErrorMsg)),d()},f.open("GET","https://i18n.ultrafast.io/api/export?grid=".concat(TRANSLATIONS_GRID_UUID)),f.send()})};export var translate=function(a){return activatedTranslations[a]||a||""}; |
{ | ||
"name": "react-filerobot-image-editor", | ||
"version": "4.1.1", | ||
"version": "4.2.0", | ||
"license": "MIT", | ||
@@ -32,4 +32,4 @@ "author": "Scaleflex", | ||
"@babel/runtime": "^7.17.2", | ||
"@scaleflex/icons": "1.0.0-beta.75", | ||
"@scaleflex/ui": "1.0.0-beta.78", | ||
"@scaleflex/icons": "1.0.0-beta.80", | ||
"@scaleflex/ui": "1.0.0-beta.80", | ||
"konva": "8.3.2", | ||
@@ -47,3 +47,3 @@ "prop-types": "15.7.2", | ||
}, | ||
"gitHead": "97068cbade8365996a7ca8e4a585aa5cf2cd694e" | ||
"gitHead": "10cbd73ba62de02ecba6fbb64ad72ba630c26846" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
306300
275
1
+ Added@scaleflex/icons@1.0.0-beta.80(transitive)
+ Added@scaleflex/ui@1.0.0-beta.80(transitive)
- Removed@scaleflex/icons@1.0.0-beta.75(transitive)
- Removed@scaleflex/ui@1.0.0-beta.78(transitive)
- Removedreact@18.3.1(transitive)
- Removedreact-dom@18.3.1(transitive)
- Removedreact-fast-compare@3.2.2(transitive)
- Removedreact-popper@2.3.0(transitive)
- Removedscheduler@0.23.2(transitive)
- Removedwarning@4.0.3(transitive)
Updated@scaleflex/ui@1.0.0-beta.80