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

@goji/core

Package Overview
Dependencies
Maintainers
2
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@goji/core - npm Package Compare versions

Comparing version 0.4.14 to 0.4.15

2

dist/cjs/constants.d.ts
export declare const TYPE_TEXT = "GOJI_TYPE_TEXT";
export declare const TYPE_SUBTREE = "GOJI_TYPE_SUBTREE";
export declare type GojiTarget = 'wechat' | 'baidu' | 'alipay' | 'toutiao';
export declare type GojiTarget = 'wechat' | 'baidu' | 'alipay' | 'toutiao' | 'qq';
export declare const GOJI_TARGET: GojiTarget;

@@ -5,0 +5,0 @@ interface SimplifyComponent {

@@ -8,3 +8,3 @@ /// <reference types="react" />

export declare const render: (element: JSX.Element, options?: Partial<RenderOptions>) => any;
export declare const createPortal: (element: JSX.Element | null) => import("react").ReactNode;
export declare const createPortal: (element: JSX.Element | null) => import("react").ReactPortal;
export * from './factoryComponents';

@@ -11,0 +11,0 @@ export { Subtree } from './subtree';

@@ -26,4 +26,7 @@ "use strict";

// eslint-disable-next-line react-hooks/rules-of-hooks
const { createPortal: innerCreatePortal } = react_1.useContext(portal_1.PortalContext);
return innerCreatePortal(element);
const portalContext = react_1.useContext(portal_1.PortalContext);
if (!portalContext) {
throw new Error('Canot not found `portalContext`. This might be an internal error in Goji');
}
return portalContext.createPortal(element);
};

@@ -30,0 +33,0 @@ __export(require("./factoryComponents"));

@@ -1,5 +0,5 @@

import { ReactNode } from 'react';
import { ReactNode, ReactPortal } from 'react';
export interface PortalContext {
createPortal: (element: JSX.Element | null) => ReactNode;
createPortal: (element: ReactNode) => ReactPortal;
}
export declare const PortalContext: import("react").Context<PortalContext>;
export declare const PortalContext: import("react").Context<PortalContext | undefined>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = require("react");
exports.PortalContext = react_1.createContext({
createPortal() {
return null;
},
});
exports.PortalContext = react_1.createContext(undefined);
//# sourceMappingURL=context.js.map

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

const constants_1 = require("./constants");
const useFlattenBridge = constants_1.GOJI_TARGET === 'wechat';
const useFlattenBridge = constants_1.GOJI_TARGET === 'wechat' || constants_1.GOJI_TARGET === 'qq';
exports.Subtree = (props) => {

@@ -8,0 +8,0 @@ return react_1.createElement(useFlattenBridge ? constants_1.TYPE_SUBTREE : react_1.Fragment, props);

export declare const TYPE_TEXT = "GOJI_TYPE_TEXT";
export declare const TYPE_SUBTREE = "GOJI_TYPE_SUBTREE";
export declare type GojiTarget = 'wechat' | 'baidu' | 'alipay' | 'toutiao';
export declare type GojiTarget = 'wechat' | 'baidu' | 'alipay' | 'toutiao' | 'qq';
export declare const GOJI_TARGET: GojiTarget;

@@ -5,0 +5,0 @@ interface SimplifyComponent {

@@ -8,3 +8,3 @@ /// <reference types="react" />

export declare const render: (element: JSX.Element, options?: Partial<RenderOptions>) => any;
export declare const createPortal: (element: JSX.Element | null) => import("react").ReactNode;
export declare const createPortal: (element: JSX.Element | null) => import("react").ReactPortal;
export * from './factoryComponents';

@@ -11,0 +11,0 @@ export { Subtree } from './subtree';

@@ -21,4 +21,7 @@ import { useContext } from 'react';

// eslint-disable-next-line react-hooks/rules-of-hooks
const { createPortal: innerCreatePortal } = useContext(PortalContext);
return innerCreatePortal(element);
const portalContext = useContext(PortalContext);
if (!portalContext) {
throw new Error('Canot not found `portalContext`. This might be an internal error in Goji');
}
return portalContext.createPortal(element);
};

@@ -25,0 +28,0 @@ export * from './factoryComponents';

@@ -1,5 +0,5 @@

import { ReactNode } from 'react';
import { ReactNode, ReactPortal } from 'react';
export interface PortalContext {
createPortal: (element: JSX.Element | null) => ReactNode;
createPortal: (element: ReactNode) => ReactPortal;
}
export declare const PortalContext: import("react").Context<PortalContext>;
export declare const PortalContext: import("react").Context<PortalContext | undefined>;
import { createContext } from 'react';
export const PortalContext = createContext({
createPortal() {
return null;
},
});
export const PortalContext = createContext(undefined);
//# sourceMappingURL=context.js.map
import { createElement, Fragment } from 'react';
import { TYPE_SUBTREE, GOJI_TARGET } from './constants';
const useFlattenBridge = GOJI_TARGET === 'wechat';
const useFlattenBridge = GOJI_TARGET === 'wechat' || GOJI_TARGET === 'qq';
export const Subtree = (props) => {

@@ -5,0 +5,0 @@ return createElement(useFlattenBridge ? TYPE_SUBTREE : Fragment, props);

{
"name": "@goji/core",
"version": "0.4.14",
"version": "0.4.15",
"description": "Goji Core",

@@ -80,3 +80,3 @@ "main": "dist/cjs/index.js",

},
"gitHead": "bc1abee46fb4e5f41bcac3561f883121b3c52ee4"
"gitHead": "8291c95b14b20ea7eaa989d3c82db8916aec7910"
}
export const TYPE_TEXT = 'GOJI_TYPE_TEXT';
export const TYPE_SUBTREE = 'GOJI_TYPE_SUBTREE';
export type GojiTarget = 'wechat' | 'baidu' | 'alipay' | 'toutiao';
export type GojiTarget = 'wechat' | 'baidu' | 'alipay' | 'toutiao' | 'qq';

@@ -6,0 +6,0 @@ export const GOJI_TARGET: GojiTarget = (process.env.GOJI_TARGET as GojiTarget) || 'wechat';

@@ -29,4 +29,7 @@ import { useContext } from 'react';

// eslint-disable-next-line react-hooks/rules-of-hooks
const { createPortal: innerCreatePortal } = useContext(PortalContext);
return innerCreatePortal(element);
const portalContext = useContext(PortalContext);
if (!portalContext) {
throw new Error('Canot not found `portalContext`. This might be an internal error in Goji');
}
return portalContext.createPortal(element);
};

@@ -33,0 +36,0 @@

@@ -1,11 +0,8 @@

import { createContext, ReactNode } from 'react';
import { createContext, ReactNode, ReactPortal } from 'react';
export interface PortalContext {
createPortal: (element: JSX.Element | null) => ReactNode;
// from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/f0016483a4b1d1fd6fd636c47eea19e2d1614336/types/react-dom/index.d.ts#L27
createPortal: (element: ReactNode) => ReactPortal;
}
export const PortalContext = createContext<PortalContext>({
createPortal() {
return null;
},
});
export const PortalContext = createContext<PortalContext | undefined>(undefined);
import React, { createElement, Fragment, CSSProperties } from 'react';
import { TYPE_SUBTREE, GOJI_TARGET } from './constants';
const useFlattenBridge = GOJI_TARGET === 'wechat';
const useFlattenBridge = GOJI_TARGET === 'wechat' || GOJI_TARGET === 'qq';

@@ -6,0 +6,0 @@ export const Subtree = (

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

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