Socket
Socket
Sign inDemoInstall

@gondel/plugin-react

Package Overview
Dependencies
Maintainers
4
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gondel/plugin-react - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

## [1.1.2](https://github.com/namics/gondel/compare/v1.1.1...v1.1.2) (2020-01-16)
### Bug Fixes
* **react plugin:** allow to set the wrapper html element ([56e8f16](https://github.com/namics/gondel/commit/56e8f16))
## [1.1.1](https://github.com/namics/gondel/compare/v1.1.0...v1.1.1) (2020-01-16)

@@ -8,0 +19,0 @@

8

dist/GondelReactComponent.d.ts
import React, { StatelessComponent, ComponentClass, ComponentLifecycle } from "react";
import { GondelBaseComponent } from "@gondel/core";
declare type RenderableReactComponent<State> = StatelessComponent<Readonly<State>> | ComponentClass<Readonly<State>, any>;
export declare class GondelReactComponent<State extends {}> extends GondelBaseComponent implements ComponentLifecycle<null, State> {
static readonly AppPromiseMap: WeakMap<Promise<RenderableReactComponent<any>>, RenderableReactComponent<any>>;
declare type RenderableReactComponent<State> = StatelessComponent<State> | ComponentClass<State, any>;
export declare class GondelReactComponent<State = {}, TElement extends HTMLElement = HTMLDivElement> extends GondelBaseComponent<TElement> implements ComponentLifecycle<null, State> {
static readonly AppPromiseMap: WeakMap<Promise<React.ComponentType<any>>, React.ComponentType<any>>;
_setInternalState: (config: State) => void | undefined;
App?: RenderableReactComponent<State> | Promise<RenderableReactComponent<State>>;
state: Readonly<State>;
constructor(ctx: HTMLElement, componentName: string);
constructor(ctx: TElement, componentName: string);
setState(state: Partial<State>): void;

@@ -11,0 +11,0 @@ /**

{
"name": "@gondel/plugin-react",
"version": "1.1.1",
"version": "1.1.2",
"description": "Gondel Plugin to boot react widgets and apps",

@@ -60,3 +60,3 @@ "bugs": "https://github.com/namics/gondel/issues",

},
"gitHead": "5d50e0676434daa46138c1b3bdbf50d887afa259"
"gitHead": "40d0471a610ffa353af7956bac7a9d53e847a419"
}

@@ -0,23 +1,6 @@

import { Component } from "@gondel/core";
import { TestApp } from "../fixtures/TestApp";
import { GondelReactComponent } from "./GondelReactComponent";
import { TestApp } from "../fixtures/TestApp";
import {
Component,
GondelComponent,
GondelBaseComponent,
IGondelComponent,
StartMethod
} from "@gondel/core";
import { isPromise } from "./utils";
class StubComponent<T> extends GondelReactComponent<T> {
_componentName = "StubComponent";
}
const createStubComponent = <TState>() => {
const root = document.createElement("div");
const component = new StubComponent<TState>(root, "stub");
return { component, root };
};
const createComponentStateHTML = (initialState: object = {}) => {

@@ -29,3 +12,2 @@ const tree = document.createElement("div");

tree.appendChild(initialScript);
return tree;

@@ -45,3 +27,3 @@ };

const root = document.createElement("div");
const c = new GondelReactComponent<{}>(root, "example");
const c = new GondelReactComponent(root, "example");

@@ -53,3 +35,3 @@ expect((c as any).start).toBeDefined();

it("should not expose certain react lifecycle methods", () => {
class TestComponent extends GondelReactComponent<{}> {
class TestComponent extends GondelReactComponent {
_componentName = "TestComponent";

@@ -85,5 +67,5 @@ }

const c = new TestComponent(root, "test");
expect(c.state.theme).toEqual("light");
expect(c.state.loaded).toBe(true);
const component = new TestComponent(root, "test");
expect(component.state.theme).toEqual("light");
expect(component.state.loaded).toBe(true);
});

@@ -94,3 +76,7 @@ });

it("should expose an initial default state", () => {
const { component } = createStubComponent<{ a: number; b: string }>();
const root = document.createElement("div");
class TestComponent extends GondelReactComponent {
_componentName = "TestComponent";
}
const component = new TestComponent(root, "stub");

@@ -161,10 +147,10 @@ // check if state & setter are defined

@Component("test")
class TestComponent extends GondelReactComponent<{ text: string }> {
class TestComponent extends GondelReactComponent {
App = TestApp;
}
const root = document.createElement("div");
const c = new TestComponent(root, "test");
expect(typeof (c as any).start).toBeTruthy();
const startPromise = (c as any).start() as Promise<any>;
const component = new TestComponent(root, "test");
component.setState({ a: 1 });
expect(typeof (component as any).start).toBeTruthy();
const startPromise = (component as any).start() as Promise<any>;
expect(isPromise(startPromise)).toBeTruthy();

@@ -171,0 +157,0 @@ const startResponse = await startPromise;

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