Socket
Socket
Sign inDemoInstall

react-eyedrop

Package Overview
Dependencies
9
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.5.0 to 5.5.1

4

dist/eyeDropper.d.ts
import * as React from 'react';
import { OnChangeEyedrop } from './types';
declare type Props = {
type Props = {
onChange: (changes: OnChangeEyedrop) => void;

@@ -24,3 +24,3 @@ wrapperClasses?: string;

};
export declare const EyeDropper: (props: Props) => JSX.Element;
export declare const EyeDropper: (props: Props) => React.JSX.Element;
export {};
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k;

@@ -16,6 +16,4 @@ "use strict";

const errors_1 = require("../constants/errors");
const elementToCanvas_1 = require("./elementToCanvas");
const html2canvas = _html2canvas;
const targetToCanvas = (_target) => __awaiter(void 0, void 0, void 0, function* () {
var _a;
let target = _target;

@@ -27,9 +25,9 @@ // Remember original target element position

for (let i = 0; i < 20; i++) {
if ((target instanceof HTMLElement)) {
if (target instanceof HTMLElement) {
break;
}
target = (_a = target) === null || _a === void 0 ? void 0 : _a.parentElement;
target = target === null || target === void 0 ? void 0 : target.parentElement;
// Element inside svg ex. path, will have target.offset(X|Y) referenced from outer svg tag not the path itself
// This will make sure we got correct target pixel on svg element
if (target.tagName === 'svg') {
// This will make sure we got correct target pixel on svg element
if (target.tagName === "svg") {
originalClientTop = target.getBoundingClientRect().top;

@@ -59,17 +57,5 @@ originalClientLeft = target.getBoundingClientRect().left;

targetPickXOffset,
targetPickYOffset
targetPickYOffset,
};
}
// This approach is not workable with transparent image
const targetBackgroundImage = window.getComputedStyle(target).backgroundImage;
// Make sure the backgroundImage to use in process must have url('') because it will have problem with gradient such as linear('')
// Also it is not gonna work with multiple url(''), url('') pattern, but it is tradeoff for better performance
if (targetBackgroundImage && targetBackgroundImage !== 'none' && targetBackgroundImage.startsWith('url(')) {
const targetCanvas = yield (0, elementToCanvas_1.elementToCanvas)(target);
return {
targetCanvas,
targetPickXOffset,
targetPickYOffset
};
}
// Make sure to have 1:1 scale so that it will pick correct color

@@ -80,5 +66,5 @@ const targetCanvas = yield html2canvas(target, { logging: false, scale: 1 });

targetPickXOffset,
targetPickYOffset
targetPickYOffset,
};
});
exports.targetToCanvas = targetToCanvas;

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

export declare type RgbObj = {
export type RgbObj = {
r: number;

@@ -6,3 +6,3 @@ g: number;

};
export declare type OnChangeEyedrop = {
export type OnChangeEyedrop = {
rgb: string;

@@ -12,3 +12,3 @@ hex: string;

};
export declare type HookOptions = {
export type HookOptions = {
once?: boolean;

@@ -28,3 +28,3 @@ pickRadius?: number;

};
export declare type PickingMode = {
export type PickingMode = {
isPicking: boolean;

@@ -31,0 +31,0 @@ disableButton: boolean;

@@ -6,4 +6,4 @@ import { HookOptions } from './types';

};
declare type ReturnValue = [typeof initialStateColors, () => void, () => void];
type ReturnValue = [typeof initialStateColors, () => void, () => void];
export declare const useEyeDrop: ({ once, pickRadius, cursorActive, cursorInactive, cursorAwait, customProps, onPickStart, onPickEnd, onPickCancel, onExtractColor, onChange, }?: HookOptions) => ReturnValue;
export {};

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

declare type ExtractionValues = {
type ExtractionValues = {
x: number;

@@ -3,0 +3,0 @@ y: number;

{
"name": "react-eyedrop",
"version": "5.5.0",
"version": "5.5.1",
"description": "A reusable ColorPick EyeDropper written in React & TypeScript.",

@@ -48,6 +48,6 @@ "main": "dist/index.js",

"@typescript-eslint/parser": "^4.20.0",
"@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^26.6.3",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"eslint": "^7.23.0",

@@ -54,0 +54,0 @@ "eslint-plugin-react": "^7.23.1",

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc