Socket
Socket
Sign inDemoInstall

react-arbiter

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-arbiter - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

5

CHANGELOG.md
# React Arbiter Changelog
## 0.4.1
- Improved typings
- Added new `wrapper` option for `wrapElement`
## 0.4.0

@@ -4,0 +9,0 @@

15

dist/types/index.d.ts

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

import { ComponentType } from 'react';
import { ComponentType, Ref } from 'react';
export interface ArbiterModuleMetadata {

@@ -110,3 +110,3 @@ /**

}
export interface WrapOptions<T, K extends keyof T> extends StasisOptions {
export interface WrapComponentOptions<T> extends StasisOptions {
/**

@@ -116,3 +116,3 @@ * The optional props to be forwarded (i.e., captured) to the wrapped

*/
forwardProps?: Pick<T, K>;
forwardProps?: T;
/**

@@ -123,2 +123,11 @@ * The optional contextTypes to consider for wrapping foreign components.

}
export interface WrapElementOptions extends StasisOptions {
/**
* Defines the wrapper (i.e., host) element to be used for wrapping HTML
* elements. The HTML element is forwarded via the ref.
*/
wrapper?: ComponentType<{
ref: Ref<HTMLElement>;
}> | string;
}
export interface ArbiterOptions<TApi> {

@@ -125,0 +134,0 @@ /**

4

dist/wrappers/component.d.ts
import * as React from 'react';
import { ComponentDefinition, WrapOptions } from '../types';
import { ComponentDefinition, WrapComponentOptions } from '../types';
/**

@@ -11,2 +11,2 @@ * Wraps the provided component (or rendering function) to a React component

*/
export declare function wrapComponent<T, K extends keyof T>(value: ComponentDefinition<T>, options?: WrapOptions<T, K>): React.ComponentType<{}>;
export declare function wrapComponent<T, U>(value: ComponentDefinition<T & U>, options?: WrapComponentOptions<U>): React.ComponentType<T>;

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

return (props) => (React.createElement(components_1.ArbiterStasis, Object.assign({}, stasisOptions),
React.createElement(Component, Object.assign({}, props, componentOptions))));
React.createElement(Component, Object.assign({}, props, componentOptions || {}))));
}

@@ -46,3 +46,3 @@ function wrapForeignComponent(render, stasisOptions, componentOptions, contextTypes) {

return (props) => (React.createElement(components_1.ArbiterStasis, Object.assign({}, stasisOptions),
React.createElement(Component, Object.assign({}, props, componentOptions, { render: render }))));
React.createElement(Component, Object.assign({}, props, componentOptions || {}, { render: render }))));
}

@@ -58,3 +58,3 @@ /**

function wrapComponent(value, options = {}) {
const { forwardProps = {}, contextTypes = [] } = options, stasisOptions = __rest(options, ["forwardProps", "contextTypes"]);
const { forwardProps, contextTypes = [] } = options, stasisOptions = __rest(options, ["forwardProps", "contextTypes"]);
if (value) {

@@ -61,0 +61,0 @@ const argAsReact = value;

import * as React from 'react';
import { StasisOptions } from '../types';
import { WrapElementOptions } from '../types';
/**

@@ -10,2 +10,2 @@ * Wraps the given node in a stasis. If a plain HTML element is provided

*/
export declare function wrapElement(content: React.ReactNode | HTMLElement, options?: StasisOptions): React.ReactChild;
export declare function wrapElement(content: React.ReactNode | HTMLElement, options?: WrapElementOptions): React.ReactChild;
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -13,8 +22,13 @@ const React = require("react");

function wrapElement(content, options = {}) {
const { wrapper = 'div' } = options, stasisOptions = __rest(options, ["wrapper"]);
if (content instanceof HTMLElement) {
const htmlNode = content;
content = React.createElement("div", { ref: host => host && host.appendChild(htmlNode) });
content = React.createElement(wrapper, {
ref(host) {
host && host.appendChild(htmlNode);
},
});
}
return React.createElement(components_1.ArbiterStasis, Object.assign({}, options), content);
return React.createElement(components_1.ArbiterStasis, Object.assign({}, stasisOptions), content);
}
exports.wrapElement = wrapElement;
{
"name": "react-arbiter",
"version": "0.4.0",
"version": "0.4.1",
"description": "Recall all your modules to extend your SPA dynamically at runtime.",

@@ -35,7 +35,7 @@ "main": "dist/index.js",

"@types/enzyme": "^3.1.17",
"@types/enzyme-adapter-react-16": "^1.0.3",
"@types/enzyme-adapter-react-16": "^1.0.5",
"@types/jest": "^24.0.3",
"@types/react": "^16.8.2",
"@types/react-dom": "^16.8.0",
"enzyme": "^3.8.0",
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.9.1",

@@ -48,3 +48,3 @@ "enzyme-to-json": "^3.3.5",

"react-dom": "^16.8.1",
"ts-jest": "^23.10.5",
"ts-jest": "^24.0.0",
"tslint": "^5.12.1",

@@ -51,0 +51,0 @@ "tslint-config-prettier": "^1.18.0",

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