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

@remirror/react-utils

Package Overview
Dependencies
Maintainers
1
Versions
275
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@remirror/react-utils - npm Package Compare versions

Comparing version 1.0.0-next.53 to 1.0.0-next.54

13

CHANGELOG.md
# @remirror/react-utils
## 1.0.0-next.54
> 2020-11-19
### Patch Changes
- Forced update in pre-release mode.
- Updated dependencies []:
- @remirror/core-constants@1.0.0-next.54
- @remirror/core-helpers@1.0.0-next.54
- @remirror/core-types@1.0.0-next.54
## 1.0.0-next.53

@@ -4,0 +17,0 @@

6

dist/declarations/src/react-utils.d.ts

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

import React, { ComponentType, Fragment, ReactElement, ReactNode } from 'react';
import { ComponentType, Fragment, ReactElement, ReactNode } from 'react';
import type { AnyFunction, UnknownShape } from '@remirror/core-types';

@@ -98,3 +98,3 @@ export interface RemirrorComponentStaticProperties {

*/
export declare const oneChildOnly: <Props extends object = any>(value: unknown) => React.ReactElement<Props, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>;
export declare function oneChildOnly<Props extends object = any>(value: unknown): ReactElement<Props>;
/**

@@ -105,2 +105,2 @@ * Add the specified key to an element when it is a valid react element.

*/
export declare const addKeyToElement: (element: ReactNode, key: string | number) => {} | null | undefined;
export declare function addKeyToElement(element: ReactNode, key: string | number): ReactNode;

@@ -6,3 +6,3 @@ 'use strict';

var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
var React = require('react');
var react = require('react');
var coreConstants = require('@remirror/core-constants');

@@ -14,3 +14,2 @@ var coreHelpers = require('@remirror/core-helpers');

var _objectSpread__default = /*#__PURE__*/_interopDefault(_objectSpread);
var React__default = /*#__PURE__*/_interopDefault(React);

@@ -32,3 +31,3 @@ /**

function isValidElement(value) {
return coreHelpers.isObject(value) && /*#__PURE__*/React.isValidElement(value);
return coreHelpers.isObject(value) && /*#__PURE__*/react.isValidElement(value);
}

@@ -51,3 +50,3 @@ /**

function isReactFragment(value) {
return coreHelpers.isObject(value) && isValidElement(value) && value.type === React.Fragment;
return coreHelpers.isObject(value) && isValidElement(value) && value.type === react.Fragment;
}

@@ -115,3 +114,3 @@ /**

var oneChildOnly = value => {
function oneChildOnly(value) {
if (!value) {

@@ -125,4 +124,4 @@ throw new Error('This component requires ONE child component - Nothing was provided');

return React.Children.only(value);
};
return react.Children.only(value);
}
/**

@@ -134,3 +133,3 @@ * Add the specified key to an element when it is a valid react element.

var addKeyToElement = (element, key) => {
function addKeyToElement(element, key) {
if (!isValidElement(element)) {

@@ -140,6 +139,6 @@ return element;

return /*#__PURE__*/React__default['default'].cloneElement(element, _objectSpread__default['default'](_objectSpread__default['default']({}, element.props), {}, {
return /*#__PURE__*/react.cloneElement(element, _objectSpread__default['default'](_objectSpread__default['default']({}, element.props), {}, {
key
}));
};
}

@@ -146,0 +145,0 @@ exports.addKeyToElement = addKeyToElement;

import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';
import React, { isValidElement as isValidElement$1, Fragment, Children } from 'react';
import { isValidElement as isValidElement$1, Fragment, Children, cloneElement } from 'react';
import { ErrorConstant } from '@remirror/core-constants';

@@ -106,3 +106,3 @@ import { isObject, isString, bool, isFunction, invariant } from '@remirror/core-helpers';

var oneChildOnly = value => {
function oneChildOnly(value) {
if (!value) {

@@ -117,3 +117,3 @@ throw new Error('This component requires ONE child component - Nothing was provided');

return Children.only(value);
};
}
/**

@@ -125,3 +125,3 @@ * Add the specified key to an element when it is a valid react element.

var addKeyToElement = (element, key) => {
function addKeyToElement(element, key) {
if (!isValidElement(element)) {

@@ -131,7 +131,7 @@ return element;

return /*#__PURE__*/React.cloneElement(element, _objectSpread(_objectSpread({}, element.props), {}, {
return /*#__PURE__*/cloneElement(element, _objectSpread(_objectSpread({}, element.props), {}, {
key
}));
};
}
export { RemirrorType, addKeyToElement, asDefaultProps, getElementProps, isReactDOMElement, isReactFragment, isRemirrorElement, isRemirrorProvider, isValidElement, oneChildOnly, propIsFunction };

@@ -6,3 +6,3 @@ 'use strict';

var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
var React = require('react');
var react = require('react');
var coreConstants = require('@remirror/core-constants');

@@ -14,3 +14,2 @@ var coreHelpers = require('@remirror/core-helpers');

var _objectSpread__default = /*#__PURE__*/_interopDefault(_objectSpread);
var React__default = /*#__PURE__*/_interopDefault(React);

@@ -32,3 +31,3 @@ /**

function isValidElement(value) {
return coreHelpers.isObject(value) && /*#__PURE__*/React.isValidElement(value);
return coreHelpers.isObject(value) && /*#__PURE__*/react.isValidElement(value);
}

@@ -51,3 +50,3 @@ /**

function isReactFragment(value) {
return coreHelpers.isObject(value) && isValidElement(value) && value.type === React.Fragment;
return coreHelpers.isObject(value) && isValidElement(value) && value.type === react.Fragment;
}

@@ -115,3 +114,3 @@ /**

var oneChildOnly = value => {
function oneChildOnly(value) {
if (!value) {

@@ -125,4 +124,4 @@ throw new Error('This component requires ONE child component - Nothing was provided');

return React.Children.only(value);
};
return react.Children.only(value);
}
/**

@@ -134,3 +133,3 @@ * Add the specified key to an element when it is a valid react element.

var addKeyToElement = (element, key) => {
function addKeyToElement(element, key) {
if (!isValidElement(element)) {

@@ -140,6 +139,6 @@ return element;

return /*#__PURE__*/React__default['default'].cloneElement(element, _objectSpread__default['default'](_objectSpread__default['default']({}, element.props), {}, {
return /*#__PURE__*/react.cloneElement(element, _objectSpread__default['default'](_objectSpread__default['default']({}, element.props), {}, {
key
}));
};
}

@@ -146,0 +145,0 @@ exports.addKeyToElement = addKeyToElement;

@@ -7,3 +7,3 @@ "use strict";

var _objectSpread = require("@babel/runtime/helpers/objectSpread2"), React = require("react"), coreConstants = require("@remirror/core-constants"), coreHelpers = require("@remirror/core-helpers");
var _objectSpread = require("@babel/runtime/helpers/objectSpread2"), react = require("react"), coreConstants = require("@remirror/core-constants"), coreHelpers = require("@remirror/core-helpers");

@@ -16,6 +16,6 @@ function _interopDefault(e) {

var _objectSpread__default = _interopDefault(_objectSpread), React__default = _interopDefault(React);
var _objectSpread__default = _interopDefault(_objectSpread);
function isValidElement(value) {
return coreHelpers.isObject(value) && React.isValidElement(value);
return coreHelpers.isObject(value) && react.isValidElement(value);
}

@@ -28,3 +28,3 @@

function isReactFragment(value) {
return coreHelpers.isObject(value) && isValidElement(value) && value.type === React.Fragment;
return coreHelpers.isObject(value) && isValidElement(value) && value.type === react.Fragment;
}

@@ -42,10 +42,16 @@

var asDefaultProps = () => props => props, isRemirrorElement = value => coreHelpers.bool(coreHelpers.isObject(value) && isValidElement(value) && value.type.$$remirrorType), isRemirrorElementOfType = type => value => isRemirrorElement(value) && value.type.$$remirrorType === type, isRemirrorProvider = isRemirrorElementOfType(exports.RemirrorType.Provider), propIsFunction = value => (coreHelpers.isFunction(value) || coreHelpers.invariant(!1),
!0), oneChildOnly = value => {
!0);
function oneChildOnly(value) {
if (!value) throw new Error("This component requires ONE child component - Nothing was provided");
if (!isValidElement(value)) throw new Error("This component requires ONE child component - An invalid element was provided");
return React.Children.only(value);
}, addKeyToElement = (element, key) => isValidElement(element) ? React__default.default.cloneElement(element, _objectSpread__default.default(_objectSpread__default.default({}, element.props), {}, {
key: key
})) : element;
return react.Children.only(value);
}
function addKeyToElement(element, key) {
return isValidElement(element) ? react.cloneElement(element, _objectSpread__default.default(_objectSpread__default.default({}, element.props), {}, {
key: key
})) : element;
}
exports.addKeyToElement = addKeyToElement, exports.asDefaultProps = asDefaultProps,

@@ -52,0 +58,0 @@ exports.getElementProps = getElementProps, exports.isReactDOMElement = isReactDOMElement,

import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';
import React, { isValidElement as isValidElement$1, Fragment, Children } from 'react';
import { isValidElement as isValidElement$1, Fragment, Children, cloneElement } from 'react';
import { ErrorConstant } from '@remirror/core-constants';

@@ -106,3 +106,3 @@ import { isObject, isString, bool, isFunction, invariant } from '@remirror/core-helpers';

var oneChildOnly = value => {
function oneChildOnly(value) {
if (!value) {

@@ -117,3 +117,3 @@ throw new Error('This component requires ONE child component - Nothing was provided');

return Children.only(value);
};
}
/**

@@ -125,3 +125,3 @@ * Add the specified key to an element when it is a valid react element.

var addKeyToElement = (element, key) => {
function addKeyToElement(element, key) {
if (!isValidElement(element)) {

@@ -131,7 +131,7 @@ return element;

return /*#__PURE__*/React.cloneElement(element, _objectSpread(_objectSpread({}, element.props), {}, {
return /*#__PURE__*/cloneElement(element, _objectSpread(_objectSpread({}, element.props), {}, {
key
}));
};
}
export { RemirrorType, addKeyToElement, asDefaultProps, getElementProps, isReactDOMElement, isReactFragment, isRemirrorElement, isRemirrorProvider, isValidElement, oneChildOnly, propIsFunction };
{
"name": "@remirror/react-utils",
"version": "1.0.0-next.53",
"version": "1.0.0-next.54",
"description": "A small set of utilities for react components in remirror.",

@@ -30,5 +30,5 @@ "keywords": [

"@babel/runtime": "^7.12.0",
"@remirror/core-constants": "1.0.0-next.53",
"@remirror/core-helpers": "1.0.0-next.53",
"@remirror/core-types": "1.0.0-next.53"
"@remirror/core-constants": "1.0.0-next.54",
"@remirror/core-helpers": "1.0.0-next.54",
"@remirror/core-types": "1.0.0-next.54"
},

@@ -35,0 +35,0 @@ "devDependencies": {

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