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

zoid

Package Overview
Dependencies
Maintainers
2
Versions
147
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zoid - npm Package Compare versions

Comparing version 9.0.66 to 9.0.67

2

package.json
{
"name": "zoid",
"version": "9.0.66",
"version": "9.0.67",
"description": "Cross domain components.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -15,3 +15,3 @@ /* @flow */

import type { PropsType } from '../component/props';
import type { WindowRef, PropRef } from '../parent';
import type { WindowRef, PropRef, ParentExportsType } from '../parent';
import type { StringMatcherType } from '../types';

@@ -27,3 +27,3 @@

export type ChildHelpers<P> = {|
export type ChildHelpers<P, X> = {|
uid : string,

@@ -38,3 +38,4 @@ close : () => ZalgoPromise<void>,

show : () => ZalgoPromise<void>,
hide : () => ZalgoPromise<void>
hide : () => ZalgoPromise<void>,
export : (X) => ZalgoPromise<void>
|};

@@ -117,3 +118,3 @@

export function childComponent<P>(options : NormalizedComponentOptionsType<P>) : ChildComponent<P> {
export function childComponent<P, X>(options : NormalizedComponentOptionsType<P, X>) : ChildComponent<P> {
const { propsDef, autoResize, allowedParentDomains } = options;

@@ -133,5 +134,5 @@

const { uid, parent: parentRef, parentDomain, exports, context, props: propsRef } = childPayload;
const { uid, parent: parentRef, parentDomain, exports: parentExports, context, props: propsRef } = childPayload;
const parentComponentWindow = getParentComponentWindow(parentRef);
const parent = deserializeMessage(parentComponentWindow, parentDomain, exports);
const parent : ParentExportsType<P, X> = deserializeMessage(parentComponentWindow, parentDomain, parentExports);

@@ -161,6 +162,10 @@ const { show, hide, close } = parent;

const getHelpers = () : ChildHelpers<P> => {
const xport = (xports : X) : ZalgoPromise<void> => {
return parent.export(xports);
};
const getHelpers = () : ChildHelpers<P, X> => {
return {
show, hide, close, focus, onError, resize,
onProps, getParent, getParentDomain, uid
onProps, getParent, getParentDomain, uid, export: xport
};

@@ -167,0 +172,0 @@ };

@@ -10,3 +10,3 @@ /* @flow */

// $FlowFixMe
export function normalizeChildProp<P, T>(propsDef : PropsDefinitionType<P>, props : PropsType<P>, key : string, value : ?T, helpers : ChildHelpers<P>) : ?T {
export function normalizeChildProp<P, T, X>(propsDef : PropsDefinitionType<P, X>, props : PropsType<P>, key : string, value : ?T, helpers : ChildHelpers<P, X>) : ?T {
if (!propsDef.hasOwnProperty(key)) {

@@ -19,4 +19,4 @@ return value;

if (typeof prop.childDecorate === 'function') {
const { uid, close, focus, onError, onProps, resize, getParent, getParentDomain, show, hide } = helpers;
const decoratedValue = prop.childDecorate({ value, uid, close, focus, onError, onProps, resize, getParent, getParentDomain, show, hide });
const { uid, close, focus, onError, onProps, resize, getParent, getParentDomain, show, hide, export: xport } = helpers;
const decoratedValue = prop.childDecorate({ value, uid, close, focus, onError, onProps, resize, getParent, getParentDomain, show, hide, export: xport });

@@ -31,3 +31,3 @@ // $FlowFixMe

// eslint-disable-next-line max-params
export function normalizeChildProps<P>(parentComponentWindow : CrossDomainWindowType, propsDef : PropsDefinitionType<P>, props : PropsType<P>, origin : string, helpers : ChildHelpers<P>, isUpdate : boolean = false) : (PropsType<P>) {
export function normalizeChildProps<P, X>(parentComponentWindow : CrossDomainWindowType, propsDef : PropsDefinitionType<P, X>, props : PropsType<P>, origin : string, helpers : ChildHelpers<P, X>, isUpdate : boolean = false) : (PropsType<P>) {

@@ -34,0 +34,0 @@ const result = {};

@@ -37,3 +37,3 @@ /* @flow */

export type ComponentOptionsType<P> = {|
export type ComponentOptionsType<P, X> = {|

@@ -46,3 +46,3 @@ tag : string,

props? : UserPropsDefinitionType<P>,
props? : UserPropsDefinitionType<P, X>,

@@ -82,3 +82,3 @@ dimensions? : CssDimensionsType,

export type NormalizedComponentOptionsType<P> = {|
export type NormalizedComponentOptionsType<P, X> = {|
tag : string,

@@ -91,3 +91,3 @@ name : string,

propsDef : PropsDefinitionType<P>,
propsDef : PropsDefinitionType<P, X>,
dimensions : CssDimensionsType,

@@ -108,9 +108,12 @@ autoResize : AutoResizeType,

validate : ?({| props : PropsInputType<P> |}) => void,
logger : Logger
logger : Logger,
exports : ({| getExports : () => ZalgoPromise<X> |}) => X
|};
export type ZoidComponentInstance<P> = {|
export type ZoidComponentInstance<P, X = void> = {|
...ParentHelpers<P>,
...X,
isEligible : () => boolean,
clone : () => ZoidComponentInstance<P>,
clone : () => ZoidComponentInstance<P, X>,
render : (container? : string | HTMLElement, context? : $Values<typeof CONTEXT>) => ZalgoPromise<void>,

@@ -121,4 +124,4 @@ renderTo : (target : CrossDomainWindowType, container? : string, context? : $Values<typeof CONTEXT>) => ZalgoPromise<void>

// eslint-disable-next-line flowtype/require-exact-type
export type ZoidComponent<P> = {
(PropsInputType<P>) : ZoidComponentInstance<P>,
export type ZoidComponent<P, X = void> = {
(PropsInputType<P>) : ZoidComponentInstance<P, X>,
driver : (string, mixed) => mixed,

@@ -140,3 +143,8 @@ isChild : () => boolean,

function normalizeOptions<P>(options : ComponentOptionsType<P>) : NormalizedComponentOptionsType<P> {
const getDefaultExports = <X>() : () => X => {
// $FlowFixMe
return noop;
};
function normalizeOptions<P, X>(options : ComponentOptionsType<P, X>) : NormalizedComponentOptionsType<P, X> {
let {

@@ -157,3 +165,4 @@ tag,

eligible = () => ({ eligible: true }),
logger = { info: noop }
logger = { info: noop },
exports: xports = getDefaultExports()
} = options;

@@ -187,3 +196,4 @@

logger,
eligible
eligible,
exports: xports
};

@@ -195,5 +205,5 @@ }

export type Component<P> = {|
init : (PropsInputType<P>) => ZoidComponentInstance<P>,
instances : $ReadOnlyArray<ZoidComponentInstance<P>>,
export type Component<P, X> = {|
init : (PropsInputType<P>) => ZoidComponentInstance<P, X>,
instances : $ReadOnlyArray<ZoidComponentInstance<P, X>>,
driver : (string, mixed) => mixed,

@@ -205,3 +215,3 @@ isChild : () => boolean,

export function component<P>(opts : ComponentOptionsType<P>) : Component<P> {
export function component<P, X>(opts : ComponentOptionsType<P, X>) : Component<P, X> {
if (__DEBUG__) {

@@ -305,3 +315,3 @@ validateOptions(opts);

const init = (props : PropsInputType<P>) : ZoidComponentInstance<P> => {
const init = (props : PropsInputType<P>) : ZoidComponentInstance<P, X> => {
// eslint-disable-next-line prefer-const

@@ -372,2 +382,3 @@ let instance;

instance = {
...parent.getExports(),
...parent.getHelpers(),

@@ -424,7 +435,7 @@ isEligible,

export type ComponentDriverType<P, L, D> = {|
register : (string, PropsDefinitionType<P>, (PropsInputType<P>) => ZoidComponentInstance<P>, L) => D
export type ComponentDriverType<P, L, D, X> = {|
register : (string, PropsDefinitionType<P, X>, (PropsInputType<P>) => ZoidComponentInstance<P, X>, L) => D
|};
export function create<P>(options : ComponentOptionsType<P>) : ZoidComponent<P> {
export function create<P, X>(options : ComponentOptionsType<P, X>) : ZoidComponent<P, X> {
setupPostRobot();

@@ -431,0 +442,0 @@

@@ -19,2 +19,3 @@ /* @flow */

export type showPropType = () => ZalgoPromise<void>;
export type exportPropType<X> = (X) => ZalgoPromise<void>;
export type hidePropType = () => ZalgoPromise<void>;

@@ -73,3 +74,3 @@ export type resizePropType = ({| width : ?number, height : ?number |}) => ZalgoPromise<void>;

type PropDefinitionType<T, P, S : string> = {|
type PropDefinitionType<T, P, S : string, X> = {|
type : S,

@@ -113,3 +114,4 @@ alias? : string,

show : () => ZalgoPromise<void>,
hide : () => ZalgoPromise<void>
hide : () => ZalgoPromise<void>,
export : (X) => ZalgoPromise<void>
|}) => ?T,

@@ -126,42 +128,43 @@ required? : boolean,

export type BooleanPropDefinitionType<T : boolean, P> = PropDefinitionType<T, P, 'boolean'>;
export type StringPropDefinitionType<T : string, P> = PropDefinitionType<T, P, 'string'>;
export type NumberPropDefinitionType<T : number, P> = PropDefinitionType<T, P, 'number'>;
export type FunctionPropDefinitionType<T : Function, P> = PropDefinitionType<T, P, 'function'>;
export type ArrayPropDefinitionType<T : Array<*> | $ReadOnlyArray<*>, P> = PropDefinitionType<T, P, 'array'>; // eslint-disable-line flowtype/no-mutable-array
export type ObjectPropDefinitionType<T : Object, P> = PropDefinitionType<T, P, 'object'>;
export type BooleanPropDefinitionType<T : boolean, P, X> = PropDefinitionType<T, P, 'boolean', X>;
export type StringPropDefinitionType<T : string, P, X> = PropDefinitionType<T, P, 'string', X>;
export type NumberPropDefinitionType<T : number, P, X> = PropDefinitionType<T, P, 'number', X>;
export type FunctionPropDefinitionType<T : Function, P, X> = PropDefinitionType<T, P, 'function', X>;
export type ArrayPropDefinitionType<T : Array<*> | $ReadOnlyArray<*>, P, X> = PropDefinitionType<T, P, 'array', X>; // eslint-disable-line flowtype/no-mutable-array
export type ObjectPropDefinitionType<T : Object, P, X> = PropDefinitionType<T, P, 'object', X>;
export type MixedPropDefinitionType<P> = BooleanPropDefinitionType<*, P> | StringPropDefinitionType<*, P> | NumberPropDefinitionType<*, P> | FunctionPropDefinitionType<*, P> | ObjectPropDefinitionType<*, P> | ArrayPropDefinitionType<*, P>;
export type MixedPropDefinitionType<P, X> = BooleanPropDefinitionType<*, P, X> | StringPropDefinitionType<*, P, X> | NumberPropDefinitionType<*, P, X> | FunctionPropDefinitionType<*, P, X> | ObjectPropDefinitionType<*, P, X> | ArrayPropDefinitionType<*, P, X>;
export type UserPropsDefinitionType<P> = {
[string] : MixedPropDefinitionType<P>
export type UserPropsDefinitionType<P, X> = {
[string] : MixedPropDefinitionType<P, X>
};
export type BuiltInPropsDefinitionType<P> = {|
timeout : NumberPropDefinitionType<timeoutPropType, P>,
window : ObjectPropDefinitionType<windowPropType, P>,
close : FunctionPropDefinitionType<closePropType, P>,
focus : FunctionPropDefinitionType<focusPropType, P>,
resize : FunctionPropDefinitionType<resizePropType, P>,
uid : StringPropDefinitionType<uidPropType, P>,
cspNonce : StringPropDefinitionType<cspNoncePropType, P>,
getParent : FunctionPropDefinitionType<getParentPropType, P>,
getParentDomain : FunctionPropDefinitionType<getParentDomainPropType, P>,
hide : FunctionPropDefinitionType<hidePropType, P>,
show : FunctionPropDefinitionType<showPropType, P>,
export type BuiltInPropsDefinitionType<P, X> = {|
timeout : NumberPropDefinitionType<timeoutPropType, P, X>,
window : ObjectPropDefinitionType<windowPropType, P, X>,
close : FunctionPropDefinitionType<closePropType, P, X>,
focus : FunctionPropDefinitionType<focusPropType, P, X>,
resize : FunctionPropDefinitionType<resizePropType, P, X>,
uid : StringPropDefinitionType<uidPropType, P, X>,
cspNonce : StringPropDefinitionType<cspNoncePropType, P, X>,
getParent : FunctionPropDefinitionType<getParentPropType, P, X>,
getParentDomain : FunctionPropDefinitionType<getParentDomainPropType, P, X>,
hide : FunctionPropDefinitionType<hidePropType, P, X>,
show : FunctionPropDefinitionType<showPropType, P, X>,
export : FunctionPropDefinitionType<exportPropType<X>, P, X>,
onDisplay : FunctionPropDefinitionType<onDisplayPropType, P>,
onRendered : FunctionPropDefinitionType<onRenderedPropType, P>,
onRender : FunctionPropDefinitionType<onRenderPropType, P>,
onClose : FunctionPropDefinitionType<onClosePropType, P>,
onDestroy : FunctionPropDefinitionType<onDestroyPropType, P>,
onResize : FunctionPropDefinitionType<onClosePropType, P>,
onFocus : FunctionPropDefinitionType<onFocusPropType, P>,
onError : FunctionPropDefinitionType<onErrorPropType, P>,
onProps : FunctionPropDefinitionType<onPropsPropType<P>, P>
onDisplay : FunctionPropDefinitionType<onDisplayPropType, P, X>,
onRendered : FunctionPropDefinitionType<onRenderedPropType, P, X>,
onRender : FunctionPropDefinitionType<onRenderPropType, P, X>,
onClose : FunctionPropDefinitionType<onClosePropType, P, X>,
onDestroy : FunctionPropDefinitionType<onDestroyPropType, P, X>,
onResize : FunctionPropDefinitionType<onClosePropType, P, X>,
onFocus : FunctionPropDefinitionType<onFocusPropType, P, X>,
onError : FunctionPropDefinitionType<onErrorPropType, P, X>,
onProps : FunctionPropDefinitionType<onPropsPropType<P>, P, X>
|};
export type PropsDefinitionType<P> = {|
...BuiltInPropsDefinitionType<P>,
[ string ] : MixedPropDefinitionType<P>
export type PropsDefinitionType<P, X> = {|
...BuiltInPropsDefinitionType<P, X>,
[ string ] : MixedPropDefinitionType<P, X>
|};

@@ -172,3 +175,3 @@

export function getBuiltInProps<P>() : BuiltInPropsDefinitionType<P> {
export function getBuiltInProps<P, X>() : BuiltInPropsDefinitionType<P, X> {
return {

@@ -269,2 +272,9 @@ window: {

export: {
type: 'function',
required: false,
sendToChild: false,
childDecorate: ({ 'export': xport }) => xport
},
onDisplay: {

@@ -271,0 +281,0 @@ type: 'function',

@@ -9,3 +9,3 @@ /* @flow */

function validatepropsDefinitions<P>(options : ComponentOptionsType<P>) {
function validatepropsDefinitions<P, X>(options : ComponentOptionsType<P, X>) {

@@ -46,3 +46,3 @@ if (options.props && !(typeof options.props === 'object')) {

// eslint-disable-next-line complexity
export function validateOptions<P>(options : ?ComponentOptionsType<P>) { // eslint-ignore-line
export function validateOptions<P, X>(options : ?ComponentOptionsType<P, X>) { // eslint-ignore-line

@@ -49,0 +49,0 @@ if (!options) {

@@ -20,3 +20,3 @@ /* @flow */

export const angular : ComponentDriverType<*, Angular, AngularModule> = {
export const angular : ComponentDriverType<*, Angular, AngularModule, *> = {

@@ -23,0 +23,0 @@ register: (tag, propsDef, init, ng) => {

@@ -48,3 +48,3 @@ /* @flow */

export const angular2 : ComponentDriverType<*, Angular2, Angular2Module> = {
export const angular2 : ComponentDriverType<*, Angular2, Angular2Module, *> = {

@@ -51,0 +51,0 @@ register: (tag, propsDef, init, { Component : AngularComponent, NgModule, ElementRef, NgZone }) => {

@@ -34,3 +34,3 @@ /* @flow */

export const react : ComponentDriverType<*, ReactLibraryType, typeof ReactClassType> = {
export const react : ComponentDriverType<*, ReactLibraryType, typeof ReactClassType, *> = {

@@ -37,0 +37,0 @@ register: (tag, propsDef, init, { React, ReactDOM }) => {

@@ -40,3 +40,3 @@ /* @flow */

export const vue : ComponentDriverType<*, VueType, RegisteredVueComponent> = {
export const vue : ComponentDriverType<*, VueType, RegisteredVueComponent, *> = {

@@ -43,0 +43,0 @@ register: (tag, propsDef, init, Vue) => {

@@ -40,3 +40,3 @@ /* @flow */

export type ParentExportsType<P> = {|
export type ParentExportsType<P, X> = {|
init : (ChildExportsType<P>) => ZalgoPromise<void>,

@@ -48,3 +48,4 @@ close : () => ZalgoPromise<void>,

show : () => ZalgoPromise<void>,
hide : () => ZalgoPromise<void>
hide : () => ZalgoPromise<void>,
export : (X) => ZalgoPromise<void>
|};

@@ -148,3 +149,3 @@

type ParentComponent<P> = {|
type ParentComponent<P, X> = {|
init : () => void,

@@ -155,3 +156,4 @@ render : (CrossDomainWindowType, string | HTMLElement, $Values<typeof CONTEXT>) => ZalgoPromise<void>,

getHelpers : () => ParentHelpers<P>,
getDelegateOverrides : () => ZalgoPromise<DelegateOverrides>
getDelegateOverrides : () => ZalgoPromise<DelegateOverrides>,
getExports : () => X
|};

@@ -164,4 +166,4 @@

export function parentComponent<P>(options : NormalizedComponentOptionsType<P>, overrides? : ParentDelegateOverrides<P> = getDefaultOverrides(), parentWin : CrossDomainWindowType = window) : ParentComponent<P> {
const { propsDef, containerTemplate, prerenderTemplate, tag, name, attributes, dimensions, autoResize, url, domain: domainMatch, validate } = options;
export function parentComponent<P, X>(options : NormalizedComponentOptionsType<P, X>, overrides? : ParentDelegateOverrides<P> = getDefaultOverrides(), parentWin : CrossDomainWindowType = window) : ParentComponent<P, X> {
const { propsDef, containerTemplate, prerenderTemplate, tag, name, attributes, dimensions, autoResize, url, domain: domainMatch, validate, exports: xports } = options;

@@ -668,7 +670,21 @@ const initPromise = new ZalgoPromise();

const exportsPromise : ZalgoPromise<X> = new ZalgoPromise();
const getExports = () : X => {
return xports({
getExports: () => exportsPromise
});
};
const resolveExports = (actualExports : X) : ZalgoPromise<void> => {
return ZalgoPromise.try(() => {
exportsPromise.resolve(actualExports);
});
};
initChild.onError = onError;
const buildParentExports = (win : ProxyWindow) : ParentExportsType<P> => {
const buildParentExports = (win : ProxyWindow) : ParentExportsType<P, X> => {
const checkClose = () => checkWindowClose(win);
return { init: initChild, close, checkClose, resize, onError, show, hide };
return { init: initChild, close, checkClose, resize, onError, show, hide, export: resolveExports };
};

@@ -867,3 +883,3 @@

}).then(({ data: { parent } }) => {
const parentComp : ParentComponent<P> = parent;
const parentComp : ParentComponent<P, X> = parent;

@@ -1044,4 +1060,5 @@ clean.register(err => {

getHelpers,
getDelegateOverrides
getDelegateOverrides,
getExports
};
}

@@ -17,3 +17,3 @@ /* @flow */

export function extendProps<P>(propsDef : PropsDefinitionType<P>, props : PropsType<P>, inputProps : PropsInputType<P>, helpers : ParentHelpers<P>, isUpdate : boolean = false) { // eslint-disable-line complexity
export function extendProps<P, X>(propsDef : PropsDefinitionType<P, X>, props : PropsType<P>, inputProps : PropsInputType<P>, helpers : ParentHelpers<P>, isUpdate : boolean = false) { // eslint-disable-line complexity

@@ -105,3 +105,3 @@ // $FlowFixMe

// $FlowFixMe
function getQueryParam<P>(prop : MixedPropDefinitionType<P>, key : string, value : string) : ZalgoPromise<string> {
function getQueryParam<P, X>(prop : MixedPropDefinitionType<P, X>, key : string, value : string) : ZalgoPromise<string> {
return ZalgoPromise.try(() => {

@@ -119,3 +119,3 @@ if (typeof prop.queryParam === 'function') {

// $FlowFixMe
function getQueryValue<P>(prop : MixedPropDefinitionType<P>, key : string, value : string) : ZalgoPromise<string> {
function getQueryValue<P, X>(prop : MixedPropDefinitionType<P, X>, key : string, value : string) : ZalgoPromise<string> {
return ZalgoPromise.try(() => {

@@ -130,3 +130,3 @@ if (typeof prop.queryValue === 'function' && isDefined(value)) {

export function propsToQuery<P>(propsDef : PropsDefinitionType<P>, props : (PropsType<P>)) : ZalgoPromise<{ [string] : string | boolean }> {
export function propsToQuery<P, X>(propsDef : PropsDefinitionType<P, X>, props : (PropsType<P>)) : ZalgoPromise<{ [string] : string | boolean }> {

@@ -133,0 +133,0 @@ const params = {};

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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