Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-filerobot-image-editor

Package Overview
Dependencies
Maintainers
2
Versions
170
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-filerobot-image-editor - npm Package Compare versions

Comparing version 5.0.0-beta.26 to 5.0.0-beta.27

2

lib/actions/setAnnotation.js

@@ -1,1 +0,1 @@

import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["dismissHistory","replaceCurrent","selectOnSet","onAnnotationAdd"];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{EVENTS}from"../utils/constants";import emitCustomEvent from"../utils/emitCustomEvent";import randomId from"../utils/randomId";export var SET_ANNOTATION="SET_ANNOTATION";var setAnnotation=function(a){var b,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},d=c.dismissHistory,e=c.replaceCurrent,f=void 0!==e&&e,g=c.selectOnSet,h=c.onAnnotationAdd,i=_objectWithoutProperties(c,_excluded),j=null!==(b=i.id)&&void 0!==b?b:randomId(i.name),k=a.annotations[j]||{},l=0===Object.keys(k).length,m=_objectSpread(_objectSpread({},i),{},{id:j});if((f||l)&&"function"==typeof h){var n=h(m,a);m=_objectSpread(_objectSpread({},m),n)}if(k&&!Object.keys(m).some(function(a){return"undefined"!=typeof m[a]&&m[a]!==k[a]}))return a;var o=_objectSpread(_objectSpread({},f?{}:k),m);return emitCustomEvent(k?EVENTS.ANNOTATION_EDIT:EVENTS.ANNOTATION_ADD,{annotation:o}),_objectSpread(_objectSpread({},a),{},{isDesignState:!(void 0!==d&&d),annotationIds:l?[].concat(_toConsumableArray(a.annotationIds),[o.id]):a.annotationIds,annotations:_objectSpread(_objectSpread({},a.annotations),{},_defineProperty({},o.id,o)),selectionsIds:void 0!==g&&g?[o.id]:a.selectionsIds})};export default setAnnotation;
import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["dismissHistory","replaceCurrent","selectOnSet","onAnnotationAdd"];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{EVENTS}from"../utils/constants";import emitCustomEvent from"../utils/emitCustomEvent";import randomId from"../utils/randomId";export var SET_ANNOTATION="SET_ANNOTATION";var setAnnotation=function(a){var b,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},d=c.dismissHistory,e=c.replaceCurrent,f=void 0!==e&&e,g=c.selectOnSet,h=c.onAnnotationAdd,i=_objectWithoutProperties(c,_excluded),j=null!==(b=i.id)&&void 0!==b?b:randomId(i.name),k=a.annotations[j]||{},l=0===Object.keys(k).length,m=_objectSpread(_objectSpread({},i),{},{id:j});if((f||l)&&"function"==typeof h){var n=h(m,a);m=_objectSpread(_objectSpread({},m),n)}if(k&&!Object.keys(m).some(function(a){return"undefined"!=typeof m[a]&&m[a]!==k[a]}))return a;var o=_objectSpread(_objectSpread({},f?{}:k),m);return emitCustomEvent(l?EVENTS.ANNOTATION_ADD:EVENTS.ANNOTATION_EDIT,{annotation:o}),_objectSpread(_objectSpread({},a),{},{isDesignState:!(void 0!==d&&d),annotationIds:l?[].concat(_toConsumableArray(a.annotationIds),[o.id]):a.annotationIds,annotations:_objectSpread(_objectSpread({},a.annotations),{},_defineProperty({},o.id,o)),selectionsIds:void 0!==g&&g?[o.id]:a.selectionsIds})};export default setAnnotation;

@@ -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 isAnnotationTool from"../../utils/isAnnotationTool";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(function(){return(h!==TABS_IDS.ANNOTATE&&h!==TABS_IDS.WATERMARK||!isAnnotationTool(i))&&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||isAnnotationTool(i))?POINTER_ICONS.DRAW:g}},[h,i,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||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&&!isAnnotationTool(i)||h===TABS_IDS.WATERMARK)},D=function(a){(" "===a.key||"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){(" "===a.key||"Control"===a.key)&&(a.preventDefault(),C())},F=function(){c.current&&c.current.container().focus()};useEffect(function(){y(h!==TABS_IDS.ANNOTATE&&h!==TABS_IDS.WATERMARK&&!isAnnotationTool(i)&&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,i,p.factor,t]),useEffect(function(){f({type:CHANGE_POINTER_ICON,payload:{pointerCssIcon:POINTER_ICONS[x?"DRAG":"DEFAULT"]}})},[x]);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);
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{useEditableTextId,useStore}from"../../hooks";import isAnnotationTool from"../../utils/isAnnotationTool";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,t=useEditableTextId();Konva.pixelRatio=r;var u=DEFAULT_ZOOM_FACTOR,v=!s&&i!==TOOLS_IDS.CROP,w=useState(function(){return(h!==TABS_IDS.ANNOTATE&&h!==TABS_IDS.WATERMARK||!isAnnotationTool(i))&&p.factor>u}),x=_slicedToArray(w,2),y=x[0],z=x[1],A=useMemo(function(){return{cursor:g===POINTER_ICONS.DEFAULT&&(h===TABS_IDS.ANNOTATE||isAnnotationTool(i))?POINTER_ICONS.DRAW:g}},[h,i,g]),B=function(a){f({type:ZOOM_CANVAS,payload:a})},C=useCallback(function(a){var b,c;a.evt.preventDefault(),null===(b=(c=a.currentTarget).container)||void 0===b||b.call(c).focus(),a.target instanceof Konva.Stage&&0<n.length&&f({type:CLEAR_ANNOTATIONS_SELECTIONS})},[n]),D=function(){return z(h!==TABS_IDS.ANNOTATE&&!isAnnotationTool(i)||h===TABS_IDS.WATERMARK)},E=function(a){(" "===a.key||"Control"===a.key)&&!a.repeat&&p.factor>u&&v&&(a.preventDefault(),z(!0),f({type:CHANGE_POINTER_ICON,payload:{pointerCssIcon:POINTER_ICONS.DRAG}}))},F=function(a){(" "===a.key||"Control"===a.key)&&(a.preventDefault(),D())},G=function(){c.current&&!t&&c.current.container().focus()};useEffect(function(){z(h!==TABS_IDS.ANNOTATE&&h!==TABS_IDS.WATERMARK&&!isAnnotationTool(i)&&p.factor>u);var a;return c.current&&(a=c.current.container(),a.addEventListener("mouseenter",G),a.addEventListener("keydown",E),a.addEventListener("keyup",F)),function(){a&&(a.removeEventListener("mouseenter",G),a.removeEventListener("keydown",E),a.removeEventListener("keyup",F))}},[h,i,p.factor,u,t]),useEffect(function(){f({type:CHANGE_POINTER_ICON,payload:{pointerCssIcon:POINTER_ICONS[y?"DRAG":"DEFAULT"]}})},[y]);var H=l*(v&&p.factor||u);return React.createElement(StyledCanvasNode,{className:"FIE_canvas-node",tabIndex:-1,ref:c,width:j,height:k,scaleX:H,scaleY:H,x:v&&p.x||null,y:v&&p.y||null,zoomFactor:v&&p.factor||u,onWheel:v?function handleZoom(a){a.evt.preventDefault();var b=(p.factor||u)+a.evt.deltaY*-ZOOM_DELTA_TO_SCALE_CONVERT_FACTOR,c=a.currentTarget.getPointerPosition();B(_objectSpread(_objectSpread({},c),{},{factor:b}))}:void 0,onTap:C,onClick:C,onTouchMove:v?function(a){return zoomOnTouchesMove(a,B)}:void 0,onDragStart:function preventDraggingIfMultiTouches(a){var b;1<(null===(b=a.evt.touches)||void 0===b?void 0:b.length)&&z(!1)},onTouchEnd:v?function endTouchesZoomingEnablePanning(){endTouchesZooming(D)}: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:v&&y,onDragEnd:function handleCanvasDragEnd(a){a.currentTarget.draggable()&&"stage"===a.target.nodeType.toLowerCase()&&v&&y&&B({factor:p.factor,x:a.target.x(),y:a.target.y(),preparedDimensions:!0})},style:A},b)};export default memo(CanvasNode);
{
"name": "react-filerobot-image-editor",
"version": "5.0.0-beta.26",
"version": "5.0.0-beta.27",
"license": "MIT",

@@ -47,3 +47,3 @@ "author": "Scaleflex",

},
"gitHead": "5e154d23893abf25386ccb22e0b46aabd35be06f"
"gitHead": "47491a02a7591097b195b64f321916d8dd3cc6a6"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc