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

@reach/portal

Package Overview
Dependencies
Maintainers
3
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@reach/portal - npm Package Compare versions

Comparing version 0.7.3 to 0.7.4

20

dist/portal.cjs.development.js
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }

@@ -27,19 +29,17 @@

var Portal = function Portal(_a) {
var children = _a.children,
_b = _a.type,
type = _b === void 0 ? "reach-portal" : _b;
var Portal = function Portal(_ref) {
var children = _ref.children,
_ref$type = _ref.type,
type = _ref$type === void 0 ? "reach-portal" : _ref$type;
var mountNode = React.useRef(null);
var portalNode = React.useRef(null);
var _c = React.useState(),
forceUpdate = _c[1];
var _useState = React.useState(),
forceUpdate = _useState[1];
React.useLayoutEffect(function () {
var _a; // It's possible that the content we are portal has, itself, been portaled.
// It's possible that the content we are portal has, itself, been portaled.
// In that case, it's important to append to the correct document element.
var ownerDocument = mountNode.current.ownerDocument;
portalNode.current = (_a = ownerDocument) === null || _a === void 0 ? void 0 : _a.createElement(type);
portalNode.current = ownerDocument === null || ownerDocument === void 0 ? void 0 : ownerDocument.createElement(type);
ownerDocument.body.appendChild(portalNode.current);

@@ -46,0 +46,0 @@ forceUpdate({});

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

"use strict";var e,r=require("react"),t=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,n=require("react-dom"),u=function(e){var u=e.children,c=e.type,o=void 0===c?"reach-portal":c,a=r.useRef(null),l=r.useRef(null),d=r.useState()[1];return r.useLayoutEffect((function(){var e,r=a.current.ownerDocument;return l.current=null===(e=r)||void 0===e?void 0:e.createElement(o),r.body.appendChild(l.current),d({}),function(){l.current&&l.current.ownerDocument&&l.current.ownerDocument.body.removeChild(l.current)}}),[o]),l.current?n.createPortal(u,l.current):t.createElement("div",{ref:a})};u.displayName="Portal",exports.default=u;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("react"),t=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,u=require("react-dom"),n=function(e){var n=e.children,c=e.type,o=void 0===c?"reach-portal":c,a=r.useRef(null),l=r.useRef(null),d=r.useState()[1];return r.useLayoutEffect((function(){var e=a.current.ownerDocument;return l.current=null==e?void 0:e.createElement(o),e.body.appendChild(l.current),d({}),function(){l.current&&l.current.ownerDocument&&l.current.ownerDocument.body.removeChild(l.current)}}),[o]),l.current?u.createPortal(n,l.current):t.createElement("div",{ref:a})};n.displayName="Portal",exports.default=n;
//# sourceMappingURL=portal.cjs.production.min.js.map

@@ -22,19 +22,17 @@ import React, { useRef, useState, useLayoutEffect } from 'react';

var Portal = function Portal(_a) {
var children = _a.children,
_b = _a.type,
type = _b === void 0 ? "reach-portal" : _b;
var Portal = function Portal(_ref) {
var children = _ref.children,
_ref$type = _ref.type,
type = _ref$type === void 0 ? "reach-portal" : _ref$type;
var mountNode = useRef(null);
var portalNode = useRef(null);
var _c = useState(),
forceUpdate = _c[1];
var _useState = useState(),
forceUpdate = _useState[1];
useLayoutEffect(function () {
var _a; // It's possible that the content we are portal has, itself, been portaled.
// It's possible that the content we are portal has, itself, been portaled.
// In that case, it's important to append to the correct document element.
var ownerDocument = mountNode.current.ownerDocument;
portalNode.current = (_a = ownerDocument) === null || _a === void 0 ? void 0 : _a.createElement(type);
portalNode.current = ownerDocument === null || ownerDocument === void 0 ? void 0 : ownerDocument.createElement(type);
ownerDocument.body.appendChild(portalNode.current);

@@ -41,0 +39,0 @@ forceUpdate({});

{
"name": "@reach/portal",
"version": "0.7.3",
"version": "0.7.4",
"description": "Declarative portals for React",

@@ -28,3 +28,3 @@ "author": "React Training <hello@reacttraining.com>",

],
"gitHead": "fe739beb1d94cc58c4e72f88ab58efa58e0de8c8"
"gitHead": "f460709e283a60dd5ea62952b7feaf88546a50ff"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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