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.5.2 to 0.5.3

7

dist/cjs/adaptor/wechat.d.ts
import { AdaptorType } from '.';
import { Container, BasedContainer } from '../container';
import { Adaptor, AdaptorConfig, ExportComponentMeta } from './common';
import { OnScrollOptions, OnShareAppMessageOptions, OnResizeOptions, OnTabItemTapOptions } from '../lifecycles/types';
export interface WeChatInstance {

@@ -16,4 +17,6 @@ setData(data: object, callback?: Function): void;

onReachBottom(this: WeChatInstance): void;
onPageScroll(this: WeChatInstance): void;
onShareAppMessage(this: WeChatInstance, options: any): void;
onPageScroll(this: WeChatInstance, options: OnScrollOptions): void;
onShareAppMessage(this: WeChatInstance, options: OnShareAppMessageOptions): void;
onResize(this: WeChatInstance, options: OnResizeOptions): void;
onTabItemTap(this: WeChatInstance, options: OnTabItemTapOptions): void;
onTitleClick(this: WeChatInstance): void;

@@ -20,0 +23,0 @@ onOptionMenuClick(this: WeChatInstance): void;

@@ -59,2 +59,11 @@ "use strict";

},
onReady() {
this.__GOJI_CONTAINER.emitLifecycleEvent('onReady');
},
onShow() {
this.__GOJI_CONTAINER.emitLifecycleEvent('onShow');
},
onHide() {
this.__GOJI_CONTAINER.emitLifecycleEvent('onHide');
},
onUnload() {

@@ -67,8 +76,2 @@ this.__GOJI_CONTAINER.emitLifecycleEvent('onUnload');

},
onShow() {
this.__GOJI_CONTAINER.emitLifecycleEvent('onShow');
},
onHide() {
this.__GOJI_CONTAINER.emitLifecycleEvent('onHide');
},
onPullDownRefresh() {

@@ -80,4 +83,4 @@ this.__GOJI_CONTAINER.emitLifecycleEvent('onPullDownRefresh');

},
onPageScroll() {
this.__GOJI_CONTAINER.emitLifecycleEvent('onPageScroll');
onPageScroll(options) {
this.__GOJI_CONTAINER.emitLifecycleEvent('onPageScroll', options);
},

@@ -87,2 +90,9 @@ onShareAppMessage(options) {

},
onResize(options) {
this.__GOJI_CONTAINER.emitLifecycleEvent('onResize', options);
},
onTabItemTap(options) {
this.__GOJI_CONTAINER.emitLifecycleEvent('onTabItemTap', options);
},
// FIXME: Alipay specific lifecycles. We should fork them to alipay adaptor later
onTitleClick() {

@@ -89,0 +99,0 @@ this.__GOJI_CONTAINER.emitLifecycleEvent('onTitleClick');

@@ -25,3 +25,3 @@ import { FiberRoot } from 'react-reconciler';

private getRootDom;
emitLifecycleEvent(eventName: LifecycleName, eventData?: any): void;
emitLifecycleEvent<T extends LifecycleName>(eventName: T, eventData?: any): void;
render(element: JSX.Element | null): void;

@@ -28,0 +28,0 @@ createPortal: (element: JSX.Element | null) => {

@@ -185,2 +185,19 @@ import { CSSProperties } from 'react';

}
interface NavigatorProps extends BaseProps {
target?: string;
url?: string;
openType?: string;
delta?: number;
appId?: string;
path?: string;
extraData?: object;
version?: string;
hoverClass?: string;
hoverStopPropagation?: boolean;
hoverStartTime?: number;
hoverStayTime?: number;
onSuccess?: (e: any) => void;
onFail?: (e: any) => void;
onComplete?: (e: any) => void;
}
interface UnknownProps extends BaseProps {

@@ -217,3 +234,3 @@ }

export declare const Textarea: import("react").FunctionComponent<UnknownProps>;
export declare const Navigator: import("react").FunctionComponent<UnknownProps>;
export declare const Navigator: import("react").FunctionComponent<NavigatorProps>;
export declare const Image: import("react").FunctionComponent<ImageProps>;

@@ -220,0 +237,0 @@ export declare const Video: import("react").FunctionComponent<UnknownProps>;

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

import { OnLoadOptions, OnPageScrollOptions, OnPageShareAppMessageOptions } from '../types';
import { OnLoadOptions, OnScrollOptions, OnShareAppMessageOptions, OnResizeOptions, OnTabItemTapOptions } from '../types';
export declare const useOnLoad: (callback: (data: OnLoadOptions) => void, deps?: any[] | undefined) => void;

@@ -9,6 +9,6 @@ export declare const useOnShow: (callback: (data: undefined) => void, deps?: any[] | undefined) => void;

export declare const useOnReachBottom: (callback: (data: undefined) => void, deps?: any[] | undefined) => void;
export declare const useOnPageScroll: (callback: (data: OnPageScrollOptions) => void, deps?: any[] | undefined) => void;
export declare const useOnShareAppMessage: (callback: (data: OnPageShareAppMessageOptions) => void, deps?: any[] | undefined) => void;
export declare const useOnResize: (callback: (data: unknown) => void, deps?: any[] | undefined) => void;
export declare const useOnTabItemTap: (callback: (data: unknown) => void, deps?: any[] | undefined) => void;
export declare const useOnPageScroll: (callback: (data: OnScrollOptions) => void, deps?: any[] | undefined) => void;
export declare const useOnShareAppMessage: (callback: (data: OnShareAppMessageOptions) => void, deps?: any[] | undefined) => void;
export declare const useOnResize: (callback: (data: OnResizeOptions) => void, deps?: any[] | undefined) => void;
export declare const useOnTabItemTap: (callback: (data: OnTabItemTapOptions) => void, deps?: any[] | undefined) => void;
export declare const useOnTitleClick: (callback: (data: undefined) => void, deps?: any[] | undefined) => void;

@@ -15,0 +15,0 @@ export declare const useOnOptionMenuClick: (callback: (data: undefined) => void, deps?: any[] | undefined) => void;

@@ -1,4 +0,4 @@

declare type WechatLifecycleName = 'onLoad' | 'onShow' | 'onReady' | 'onHide' | 'onUnload' | 'onUnload' | 'onPullDownRefresh' | 'onReachBottom' | 'onPageScroll' | 'onShareAppMessage' | 'onResize' | 'onTabItemTap';
declare type AlipayLifecycleName = WechatLifecycleName | 'onTitleClick' | 'onOptionMenuClick' | 'onPopMenuClick' | 'onPullIntercept';
declare type InternalLifecycleName = 'internalComponentUpdate';
export declare type WechatLifecycleName = 'onLoad' | 'onShow' | 'onReady' | 'onHide' | 'onUnload' | 'onUnload' | 'onPullDownRefresh' | 'onReachBottom' | 'onPageScroll' | 'onShareAppMessage' | 'onResize' | 'onTabItemTap';
export declare type AlipayLifecycleName = WechatLifecycleName | 'onTitleClick' | 'onOptionMenuClick' | 'onPopMenuClick' | 'onPullIntercept';
export declare type InternalLifecycleName = 'internalComponentUpdate';
export declare type LifecycleName = WechatLifecycleName | AlipayLifecycleName | InternalLifecycleName;

@@ -9,11 +9,22 @@ export declare type UniversalLifecycleName = 'loadOptions' | 'visibility';

}
export interface OnPageScrollOptions {
export interface OnScrollOptions {
scrollTop: number;
}
export interface OnPageShareAppMessageOptions {
export interface OnShareAppMessageOptions {
from: 'button' | 'menu';
target: object | undefined;
}
export declare type OnResizeOptions = unknown;
export declare type OnTabItemTap = unknown;
export {};
export interface OnResizeOptions {
deviceOrientation: 'landscape' | 'portrait';
size: {
screenHeight: number;
screenWidth: number;
windowWidth: number;
windowHeight: number;
};
}
export declare type OnTabItemTapOptions = {
index: string;
pagePath: string;
text: string;
};
import { AdaptorType } from '.';
import { Container, BasedContainer } from '../container';
import { Adaptor, AdaptorConfig, ExportComponentMeta } from './common';
import { OnScrollOptions, OnShareAppMessageOptions, OnResizeOptions, OnTabItemTapOptions } from '../lifecycles/types';
export interface WeChatInstance {

@@ -16,4 +17,6 @@ setData(data: object, callback?: Function): void;

onReachBottom(this: WeChatInstance): void;
onPageScroll(this: WeChatInstance): void;
onShareAppMessage(this: WeChatInstance, options: any): void;
onPageScroll(this: WeChatInstance, options: OnScrollOptions): void;
onShareAppMessage(this: WeChatInstance, options: OnShareAppMessageOptions): void;
onResize(this: WeChatInstance, options: OnResizeOptions): void;
onTabItemTap(this: WeChatInstance, options: OnTabItemTapOptions): void;
onTitleClick(this: WeChatInstance): void;

@@ -20,0 +23,0 @@ onOptionMenuClick(this: WeChatInstance): void;

@@ -47,2 +47,11 @@ import React, { cloneElement, useState } from 'react';

},
onReady() {
this.__GOJI_CONTAINER.emitLifecycleEvent('onReady');
},
onShow() {
this.__GOJI_CONTAINER.emitLifecycleEvent('onShow');
},
onHide() {
this.__GOJI_CONTAINER.emitLifecycleEvent('onHide');
},
onUnload() {

@@ -55,8 +64,2 @@ this.__GOJI_CONTAINER.emitLifecycleEvent('onUnload');

},
onShow() {
this.__GOJI_CONTAINER.emitLifecycleEvent('onShow');
},
onHide() {
this.__GOJI_CONTAINER.emitLifecycleEvent('onHide');
},
onPullDownRefresh() {

@@ -68,4 +71,4 @@ this.__GOJI_CONTAINER.emitLifecycleEvent('onPullDownRefresh');

},
onPageScroll() {
this.__GOJI_CONTAINER.emitLifecycleEvent('onPageScroll');
onPageScroll(options) {
this.__GOJI_CONTAINER.emitLifecycleEvent('onPageScroll', options);
},

@@ -75,2 +78,9 @@ onShareAppMessage(options) {

},
onResize(options) {
this.__GOJI_CONTAINER.emitLifecycleEvent('onResize', options);
},
onTabItemTap(options) {
this.__GOJI_CONTAINER.emitLifecycleEvent('onTabItemTap', options);
},
// FIXME: Alipay specific lifecycles. We should fork them to alipay adaptor later
onTitleClick() {

@@ -77,0 +87,0 @@ this.__GOJI_CONTAINER.emitLifecycleEvent('onTitleClick');

@@ -25,3 +25,3 @@ import { FiberRoot } from 'react-reconciler';

private getRootDom;
emitLifecycleEvent(eventName: LifecycleName, eventData?: any): void;
emitLifecycleEvent<T extends LifecycleName>(eventName: T, eventData?: any): void;
render(element: JSX.Element | null): void;

@@ -28,0 +28,0 @@ createPortal: (element: JSX.Element | null) => {

@@ -185,2 +185,19 @@ import { CSSProperties } from 'react';

}
interface NavigatorProps extends BaseProps {
target?: string;
url?: string;
openType?: string;
delta?: number;
appId?: string;
path?: string;
extraData?: object;
version?: string;
hoverClass?: string;
hoverStopPropagation?: boolean;
hoverStartTime?: number;
hoverStayTime?: number;
onSuccess?: (e: any) => void;
onFail?: (e: any) => void;
onComplete?: (e: any) => void;
}
interface UnknownProps extends BaseProps {

@@ -217,3 +234,3 @@ }

export declare const Textarea: import("react").FunctionComponent<UnknownProps>;
export declare const Navigator: import("react").FunctionComponent<UnknownProps>;
export declare const Navigator: import("react").FunctionComponent<NavigatorProps>;
export declare const Image: import("react").FunctionComponent<ImageProps>;

@@ -220,0 +237,0 @@ export declare const Video: import("react").FunctionComponent<UnknownProps>;

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

import { OnLoadOptions, OnPageScrollOptions, OnPageShareAppMessageOptions } from '../types';
import { OnLoadOptions, OnScrollOptions, OnShareAppMessageOptions, OnResizeOptions, OnTabItemTapOptions } from '../types';
export declare const useOnLoad: (callback: (data: OnLoadOptions) => void, deps?: any[] | undefined) => void;

@@ -9,6 +9,6 @@ export declare const useOnShow: (callback: (data: undefined) => void, deps?: any[] | undefined) => void;

export declare const useOnReachBottom: (callback: (data: undefined) => void, deps?: any[] | undefined) => void;
export declare const useOnPageScroll: (callback: (data: OnPageScrollOptions) => void, deps?: any[] | undefined) => void;
export declare const useOnShareAppMessage: (callback: (data: OnPageShareAppMessageOptions) => void, deps?: any[] | undefined) => void;
export declare const useOnResize: (callback: (data: unknown) => void, deps?: any[] | undefined) => void;
export declare const useOnTabItemTap: (callback: (data: unknown) => void, deps?: any[] | undefined) => void;
export declare const useOnPageScroll: (callback: (data: OnScrollOptions) => void, deps?: any[] | undefined) => void;
export declare const useOnShareAppMessage: (callback: (data: OnShareAppMessageOptions) => void, deps?: any[] | undefined) => void;
export declare const useOnResize: (callback: (data: OnResizeOptions) => void, deps?: any[] | undefined) => void;
export declare const useOnTabItemTap: (callback: (data: OnTabItemTapOptions) => void, deps?: any[] | undefined) => void;
export declare const useOnTitleClick: (callback: (data: undefined) => void, deps?: any[] | undefined) => void;

@@ -15,0 +15,0 @@ export declare const useOnOptionMenuClick: (callback: (data: undefined) => void, deps?: any[] | undefined) => void;

@@ -1,4 +0,4 @@

declare type WechatLifecycleName = 'onLoad' | 'onShow' | 'onReady' | 'onHide' | 'onUnload' | 'onUnload' | 'onPullDownRefresh' | 'onReachBottom' | 'onPageScroll' | 'onShareAppMessage' | 'onResize' | 'onTabItemTap';
declare type AlipayLifecycleName = WechatLifecycleName | 'onTitleClick' | 'onOptionMenuClick' | 'onPopMenuClick' | 'onPullIntercept';
declare type InternalLifecycleName = 'internalComponentUpdate';
export declare type WechatLifecycleName = 'onLoad' | 'onShow' | 'onReady' | 'onHide' | 'onUnload' | 'onUnload' | 'onPullDownRefresh' | 'onReachBottom' | 'onPageScroll' | 'onShareAppMessage' | 'onResize' | 'onTabItemTap';
export declare type AlipayLifecycleName = WechatLifecycleName | 'onTitleClick' | 'onOptionMenuClick' | 'onPopMenuClick' | 'onPullIntercept';
export declare type InternalLifecycleName = 'internalComponentUpdate';
export declare type LifecycleName = WechatLifecycleName | AlipayLifecycleName | InternalLifecycleName;

@@ -9,11 +9,22 @@ export declare type UniversalLifecycleName = 'loadOptions' | 'visibility';

}
export interface OnPageScrollOptions {
export interface OnScrollOptions {
scrollTop: number;
}
export interface OnPageShareAppMessageOptions {
export interface OnShareAppMessageOptions {
from: 'button' | 'menu';
target: object | undefined;
}
export declare type OnResizeOptions = unknown;
export declare type OnTabItemTap = unknown;
export {};
export interface OnResizeOptions {
deviceOrientation: 'landscape' | 'portrait';
size: {
screenHeight: number;
screenWidth: number;
windowWidth: number;
windowHeight: number;
};
}
export declare type OnTabItemTapOptions = {
index: string;
pagePath: string;
text: string;
};
{
"name": "@goji/core",
"version": "0.5.2",
"version": "0.5.3",
"description": "Goji Core",

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

},
"gitHead": "8401dfc5fed319e7aab9339ec2d50d28ae661048"
"gitHead": "8eb70c25a54c41cfe2502c4a218359c48e82af69"
}

@@ -137,3 +137,3 @@ import { cloneElement } from 'react';

public emitLifecycleEvent(eventName: LifecycleName, eventData?: any) {
public emitLifecycleEvent<T extends LifecycleName>(eventName: T, eventData?: any) {
const publicRootInstance = this.getPublicRootInstance();

@@ -140,0 +140,0 @@ if (publicRootInstance) {

@@ -235,2 +235,20 @@ import { createElement, CSSProperties } from 'react';

interface NavigatorProps extends BaseProps {
target?: string;
url?: string;
openType?: string;
delta?: number;
appId?: string;
path?: string;
extraData?: object;
version?: string;
hoverClass?: string;
hoverStopPropagation?: boolean;
hoverStartTime?: number;
hoverStayTime?: number;
onSuccess?: (e: any) => void;
onFail?: (e: any) => void;
onComplete?: (e: any) => void;
}
interface UnknownProps extends BaseProps {}

@@ -269,3 +287,3 @@

textarea: UnknownProps;
navigator: UnknownProps;
navigator: NavigatorProps;
image: ImageProps;

@@ -272,0 +290,0 @@ video: UnknownProps;

import { useContext, useLayoutEffect } from 'react';
import {
OnLoadOptions,
OnPageScrollOptions,
OnPageShareAppMessageOptions,
OnScrollOptions,
OnShareAppMessageOptions,
OnResizeOptions,
OnTabItemTap,
OnTabItemTapOptions,
LifecycleName,

@@ -34,8 +34,8 @@ } from '../types';

export const useOnReachBottom = createLifecycleHook('onReachBottom');
export const useOnPageScroll = createLifecycleHook<OnPageScrollOptions>('onPageScroll');
export const useOnShareAppMessage = createLifecycleHook<OnPageShareAppMessageOptions>(
export const useOnPageScroll = createLifecycleHook<OnScrollOptions>('onPageScroll');
export const useOnShareAppMessage = createLifecycleHook<OnShareAppMessageOptions>(
'onShareAppMessage',
);
export const useOnResize = createLifecycleHook<OnResizeOptions>('onResize');
export const useOnTabItemTap = createLifecycleHook<OnTabItemTap>('onTabItemTap');
export const useOnTabItemTap = createLifecycleHook<OnTabItemTapOptions>('onTabItemTap');
// alipay only

@@ -42,0 +42,0 @@ export const useOnTitleClick = createLifecycleHook('onTitleClick');

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

type WechatLifecycleName =
export type WechatLifecycleName =
| 'onLoad'

@@ -15,3 +15,3 @@ | 'onShow'

type AlipayLifecycleName =
export type AlipayLifecycleName =
| WechatLifecycleName

@@ -23,3 +23,3 @@ | 'onTitleClick'

type InternalLifecycleName = 'internalComponentUpdate';
export type InternalLifecycleName = 'internalComponentUpdate';

@@ -34,7 +34,7 @@ export type LifecycleName = WechatLifecycleName | AlipayLifecycleName | InternalLifecycleName;

export interface OnPageScrollOptions {
export interface OnScrollOptions {
scrollTop: number;
}
export interface OnPageShareAppMessageOptions {
export interface OnShareAppMessageOptions {
from: 'button' | 'menu';

@@ -44,6 +44,16 @@ target: object | undefined;

// FIXME: fix type later
export type OnResizeOptions = unknown;
export interface OnResizeOptions {
deviceOrientation: 'landscape' | 'portrait';
size: {
screenHeight: number;
screenWidth: number;
windowWidth: number;
windowHeight: number;
};
}
// FIXME: fix type later
export type OnTabItemTap = unknown;
export type OnTabItemTapOptions = {
index: string;
pagePath: string;
text: string;
};

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

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