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

@rc-component/trigger

Package Overview
Dependencies
Maintainers
4
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rc-component/trigger - npm Package Compare versions

Comparing version 1.13.1 to 1.13.2

15

es/hooks/useWinClick.js
import { warning } from 'rc-util';
import { getShadowRoot } from "rc-util/es/Dom/shadow";
import raf from "rc-util/es/raf";

@@ -46,6 +47,6 @@ import * as React from 'react';

// shadow root
var inShadow = targetRoot && targetRoot !== targetEle.ownerDocument;
if (inShadow) {
targetRoot.addEventListener('mousedown', onWindowMouseDown);
targetRoot.addEventListener('click', onWindowClick);
var targetShadowRoot = getShadowRoot(targetEle);
if (targetShadowRoot) {
targetShadowRoot.addEventListener('mousedown', onWindowMouseDown);
targetShadowRoot.addEventListener('click', onWindowClick);
}

@@ -61,5 +62,5 @@

win.removeEventListener('click', onWindowClick);
if (inShadow) {
targetRoot.removeEventListener('mousedown', onWindowMouseDown);
targetRoot.removeEventListener('click', onWindowClick);
if (targetShadowRoot) {
targetShadowRoot.removeEventListener('mousedown', onWindowMouseDown);
targetShadowRoot.removeEventListener('click', onWindowClick);
}

@@ -66,0 +67,0 @@ };

@@ -9,2 +9,3 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";

import { isDOM } from "rc-util/es/Dom/findDOMNode";
import { getShadowRoot } from "rc-util/es/Dom/shadow";
import useEvent from "rc-util/es/hooks/useEvent";

@@ -125,5 +126,5 @@ import useId from "rc-util/es/hooks/useId";

var inPopupOrChild = useEvent(function (ele) {
var _childDOM$getRootNode, _popupEle$getRootNode;
var _getShadowRoot, _getShadowRoot2;
var childDOM = targetEle;
return (childDOM === null || childDOM === void 0 ? void 0 : childDOM.contains(ele)) || (childDOM === null || childDOM === void 0 ? void 0 : (_childDOM$getRootNode = childDOM.getRootNode()) === null || _childDOM$getRootNode === void 0 ? void 0 : _childDOM$getRootNode.host) === ele || ele === childDOM || (popupEle === null || popupEle === void 0 ? void 0 : popupEle.contains(ele)) || (popupEle === null || popupEle === void 0 ? void 0 : (_popupEle$getRootNode = popupEle.getRootNode()) === null || _popupEle$getRootNode === void 0 ? void 0 : _popupEle$getRootNode.host) === ele || ele === popupEle || Object.values(subPopupElements.current).some(function (subPopupEle) {
return (childDOM === null || childDOM === void 0 ? void 0 : childDOM.contains(ele)) || ((_getShadowRoot = getShadowRoot(childDOM)) === null || _getShadowRoot === void 0 ? void 0 : _getShadowRoot.host) === ele || ele === childDOM || (popupEle === null || popupEle === void 0 ? void 0 : popupEle.contains(ele)) || ((_getShadowRoot2 = getShadowRoot(popupEle)) === null || _getShadowRoot2 === void 0 ? void 0 : _getShadowRoot2.host) === ele || ele === popupEle || Object.values(subPopupElements.current).some(function (subPopupEle) {
return (subPopupEle === null || subPopupEle === void 0 ? void 0 : subPopupEle.contains(ele)) || ele === subPopupEle;

@@ -130,0 +131,0 @@ });

@@ -10,2 +10,3 @@ "use strict";

var _rcUtil = require("rc-util");
var _shadow = require("rc-util/lib/Dom/shadow");
var _raf = _interopRequireDefault(require("rc-util/lib/raf"));

@@ -55,6 +56,6 @@ var React = _interopRequireWildcard(require("react"));

// shadow root
var inShadow = targetRoot && targetRoot !== targetEle.ownerDocument;
if (inShadow) {
targetRoot.addEventListener('mousedown', onWindowMouseDown);
targetRoot.addEventListener('click', onWindowClick);
var targetShadowRoot = (0, _shadow.getShadowRoot)(targetEle);
if (targetShadowRoot) {
targetShadowRoot.addEventListener('mousedown', onWindowMouseDown);
targetShadowRoot.addEventListener('click', onWindowClick);
}

@@ -70,5 +71,5 @@

win.removeEventListener('click', onWindowClick);
if (inShadow) {
targetRoot.removeEventListener('mousedown', onWindowMouseDown);
targetRoot.removeEventListener('click', onWindowClick);
if (targetShadowRoot) {
targetShadowRoot.removeEventListener('mousedown', onWindowMouseDown);
targetShadowRoot.removeEventListener('click', onWindowClick);
}

@@ -75,0 +76,0 @@ };

@@ -17,2 +17,3 @@ "use strict";

var _findDOMNode = require("rc-util/lib/Dom/findDOMNode");
var _shadow = require("rc-util/lib/Dom/shadow");
var _useEvent = _interopRequireDefault(require("rc-util/lib/hooks/useEvent"));

@@ -134,5 +135,5 @@ var _useId = _interopRequireDefault(require("rc-util/lib/hooks/useId"));

var inPopupOrChild = (0, _useEvent.default)(function (ele) {
var _childDOM$getRootNode, _popupEle$getRootNode;
var _getShadowRoot, _getShadowRoot2;
var childDOM = targetEle;
return (childDOM === null || childDOM === void 0 ? void 0 : childDOM.contains(ele)) || (childDOM === null || childDOM === void 0 ? void 0 : (_childDOM$getRootNode = childDOM.getRootNode()) === null || _childDOM$getRootNode === void 0 ? void 0 : _childDOM$getRootNode.host) === ele || ele === childDOM || (popupEle === null || popupEle === void 0 ? void 0 : popupEle.contains(ele)) || (popupEle === null || popupEle === void 0 ? void 0 : (_popupEle$getRootNode = popupEle.getRootNode()) === null || _popupEle$getRootNode === void 0 ? void 0 : _popupEle$getRootNode.host) === ele || ele === popupEle || Object.values(subPopupElements.current).some(function (subPopupEle) {
return (childDOM === null || childDOM === void 0 ? void 0 : childDOM.contains(ele)) || ((_getShadowRoot = (0, _shadow.getShadowRoot)(childDOM)) === null || _getShadowRoot === void 0 ? void 0 : _getShadowRoot.host) === ele || ele === childDOM || (popupEle === null || popupEle === void 0 ? void 0 : popupEle.contains(ele)) || ((_getShadowRoot2 = (0, _shadow.getShadowRoot)(popupEle)) === null || _getShadowRoot2 === void 0 ? void 0 : _getShadowRoot2.host) === ele || ele === popupEle || Object.values(subPopupElements.current).some(function (subPopupEle) {
return (subPopupEle === null || subPopupEle === void 0 ? void 0 : subPopupEle.contains(ele)) || ele === subPopupEle;

@@ -139,0 +140,0 @@ });

{
"name": "@rc-component/trigger",
"version": "1.13.1",
"version": "1.13.2",
"description": "base abstract trigger component for react",

@@ -69,3 +69,3 @@ "engines": {

"rc-resize-observer": "^1.3.1",
"rc-util": "^5.29.2"
"rc-util": "^5.31.1"
},

@@ -72,0 +72,0 @@ "peerDependencies": {

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