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

react-portalize

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-portalize - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

2

dist/cjs/index.js
"use strict";
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
var _interopRequireWildcard = require("@babel/runtime-corejs2/helpers/interopRequireWildcard");

@@ -5,0 +5,0 @@ exports.__esModule = true;

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");

@@ -8,3 +8,3 @@ exports.__esModule = true;

var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inheritsLoose"));

@@ -11,0 +11,0 @@ var _react = _interopRequireDefault(require("react"));

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

import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
import React from 'react';

@@ -11,67 +10,54 @@ import ReactDOM from 'react-dom';

export var PORTALS = {};
export const PORTALS = {};
function _ref2(children, _ref) {
var provider = _ref.provider,
value = _ref.value;
function _ref(children, {
provider,
value
}) {
return React.createElement(provider, {
children: children,
value: value
children,
value
});
}
function _render() {
this.nodes = typeof document !== 'undefined' && document.querySelectorAll(this.props.container);
export default class Portalize extends React.Component {
constructor(...args) {
super(...args);
this.nodes = null;
}
if (this.nodes === false) {
var _this$props = this.props,
children = _this$props.children,
server = _this$props.server,
providers = _this$props.providers;
render() {
this.nodes = typeof document !== 'undefined' && document.querySelectorAll(this.props.container);
if (server === false) {
return null;
}
if (this.nodes === false) {
let {
children,
server,
providers
} = this.props;
if (providers !== void 0 && providers.length > 0) {
children = providers.reduceRight(_ref2, children);
}
if (server === false) {
return null;
}
PORTALS[this.props.container] = children;
return null;
} else if (this.nodes.length === 0) {
return null;
} else {
var portals = [];
if (providers !== void 0 && providers.length > 0) {
children = providers.reduceRight(_ref, children);
}
for (var i = 0; i < this.nodes.length; i++) {
portals.push(ReactDOM.createPortal(this.props.children, this.nodes[i]));
}
PORTALS[this.props.container] = children;
return null;
} else if (this.nodes.length === 0) {
return null;
} else {
const portals = [];
return portals;
}
}
for (let i = 0; i < this.nodes.length; i++) {
portals.push(ReactDOM.createPortal(this.props.children, this.nodes[i]));
}
var Portalize =
/*#__PURE__*/
function (_React$Component) {
_inheritsLoose(Portalize, _React$Component);
function Portalize() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
return portals;
}
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
_this.nodes = null;
return _this;
}
var _proto = Portalize.prototype;
_proto.render = _render;
return Portalize;
}(React.Component);
}
Portalize.propTypes = {

@@ -88,3 +74,2 @@ container: PropTypes.string.isRequired,

server: true
};
export { Portalize as default };
};
{
"version": "1.0.4",
"version": "1.0.5",
"main": "dist/cjs/index.js",

@@ -12,10 +12,9 @@ "module": "dist/es/index.js",

"build:server": "rimraf server && cross-env NODE_ENV=production BABEL_ENV=node-cjs babel server-src --out-dir server",
"watch": "rimraf dist/es && rimraf server && cross-env NODE_ENV=production BABEL_ENV=es babel src -w --out-dir dist/es & cross-env NODE_ENV=production BABEL_ENV=es babel server-src -w --out-dir server",
"edit": "atom ./"
"watch": "rimraf dist/es && rimraf server && cross-env NODE_ENV=production BABEL_ENV=es babel src -w --out-dir dist/es & cross-env NODE_ENV=production BABEL_ENV=es babel server-src -w --out-dir server"
},
"author": "Jared Lunde <jared@tessellate.io> (https://github.com/jaredlunde)",
"author": "Jared Lunde <jared@BeStellar.co> (https://github.com/jaredLunde)",
"sideEffects": false,
"analyze": true,
"license": "MIT",
"repository": "https://github.com/jaredlunde/react-portalize",
"repository": "https://github.com/jaredLunde/react-portalize",
"keywords": [

@@ -30,4 +29,4 @@ "react",

"devDependencies": {
"@inst-app/babel-preset-esx": "^1.0.2",
"@inst-app/babel-preset-react": "^1.0.0",
"@stellar-apps/babel-preset-es": "^1.0.1",
"@stellar-apps/babel-preset-react": "^1.0.0",
"cross-env": "^5.2.0",

@@ -37,3 +36,4 @@ "rimraf": "^2.6.2"

"dependencies": {
"@babel/runtime": "^7.0.0",
"@babel/runtime": "^7.3.1",
"@babel/runtime-corejs2": "^7.3.1",
"cheerio": "^1.0.0-rc.2"

@@ -40,0 +40,0 @@ },

"use strict";
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
exports.__esModule = true;
exports.renderPortalsToString = renderPortalsToString;
var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
var _server = require("react-dom/server");

@@ -13,3 +17,3 @@

function renderPortalsToString(html) {
const selectors = Object.keys(_reactPortalize.PORTALS);
const selectors = (0, _keys.default)(_reactPortalize.PORTALS);
if (selectors.length === 0) return html;

@@ -16,0 +20,0 @@ const doc = (0, _cheerio.load)(html);

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