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

starcounter-jack-haunted

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

starcounter-jack-haunted - npm Package Compare versions

Comparing version 6.0.3 to 6.0.4

lib/comp.d.ts

1

lib/core.d.ts

@@ -29,2 +29,1 @@ import { ComponentCreator } from './component.js';

export * from "./ref.js";
export * from "./haunted-lit-element.js";

@@ -22,3 +22,2 @@ import { makeComponent } from './component.js';

export * from "./ref.js";
export * from "./haunted-lit-element.js";
//# sourceMappingURL=core.js.map

@@ -1,48 +0,56 @@

import { LitElement } from 'lit-element';
import { State } from 'haunted/core.js';
const defer = Promise.resolve().then.bind(Promise.resolve());
export class HauntedLitElement extends LitElement {
haunted;
constructor() {
super();
this.haunted = new State(() => this.requestUpdate(), this);
}
connectedCallback() {
// console.warn("connecting", this);
super.connectedCallback();
}
update(_changedProperties) {
this.haunted.run(() => {
super.update(_changedProperties);
});
}
updated(_changedProperties) {
super.updated(_changedProperties);
this.haunted.runLayoutEffects();
defer(() => this.haunted.runEffects());
}
disconnectedCallback() {
this.haunted.teardown();
super.disconnectedCallback();
}
}
export const component = (renderer, propsOrBaseCls = HauntedLitElement, props = {}) => {
const localProps = typeof propsOrBaseCls === 'object' ? propsOrBaseCls : props;
const localBaseClass = typeof propsOrBaseCls === 'function' ? propsOrBaseCls : HauntedLitElement;
const retCls = class extends localBaseClass {
render() {
//console.warn("rendering", this);
return renderer.call(this, this);
}
};
Object.entries(localProps).forEach(([key, val]) => {
retCls[key] = val;
});
return retCls;
};
export const comp = (tag, renderer, prop) => {
let constructor = component(renderer, prop);
customElements.define(tag, constructor);
return constructor;
};
"use strict";
// import { LitElement } from 'lit-element';
// import { State } from 'haunted/core.js';
// import { Renderer } from "./component.js"
// const defer = Promise.resolve().then.bind(Promise.resolve());
// type Component<P extends object> = HTMLElement & P;
// type Constructor<P extends object> = new (...args: unknown[]) => Component<P>;
// export class HauntedLitElement extends LitElement {
// haunted: State;
// constructor() {
// super();
// this.haunted = new State(() => this.requestUpdate(), this);
// }
// connectedCallback(): void {
// // console.warn("connecting", this);
// super.connectedCallback();
// }
// update(_changedProperties: any) {
// this.haunted.run(() => {
// super.update(_changedProperties);
// });
// }
// updated(_changedProperties: any) {
// super.updated(_changedProperties);
// this.haunted.runLayoutEffects();
// defer(() => this.haunted.runEffects());
// }
// disconnectedCallback() {
// this.haunted.teardown();
// super.disconnectedCallback();
// }
// }
// export const component = <P extends object>(renderer: any, propsOrBaseCls: P | (typeof HauntedLitElement) = HauntedLitElement, props: P = {} as any): Constructor<P> => {
// const localProps = typeof propsOrBaseCls === 'object' ? propsOrBaseCls : props;
// const localBaseClass = typeof propsOrBaseCls === 'function' ? (propsOrBaseCls as (typeof HauntedLitElement)) : HauntedLitElement;
// const retCls = class extends localBaseClass {
// render() {
// //console.warn("rendering", this);
// return renderer.call(this, this);
// }
// };
// Object.entries(localProps).forEach(([key, val]: [string, any]) => {
// (retCls as any)[key] = val;
// });
// return retCls as unknown as Constructor<P>;
// };
// export const comp: Comp = <P extends object>(tag: string, renderer: Renderer<P>, prop?: P) => {
// let constructor = component<P>(renderer, prop);
// customElements.define(tag, constructor);
// return constructor;
// }
// export interface Comp {
// <P extends object>(tag: string, renderer: Renderer<P>, prop?: P): Constructor<P>;
// <P extends object>(tag: string, renderer: Renderer<any>, prop?: P): Constructor<any>;
// }
//# sourceMappingURL=haunted-lit-element.js.map
export { html, render, component, createContext, virtual } from './lit-haunted.js';
export * from './core.js';
export { default } from './core.js';
export { Component } from "./component.js";
export { comp } from "./comp.js";
export { html, render, component, createContext, virtual } from './lit-haunted.js';
export * from './core.js';
export { default } from './core.js';
export { comp } from "./comp.js";
//# sourceMappingURL=haunted.js.map

@@ -9,3 +9,3 @@ import { State, Callable } from './state.js';

*/
declare const useEffect: (callback: (this: State<unknown>, self: HTMLElement) => void | Promise<void> | VoidFunction, values?: unknown[] | undefined) => void;
declare const useEffect: (callback: (this: State<unknown>, self: HTMLElement) => void | VoidFunction | Promise<void>, values?: unknown[] | undefined) => void;
export { setEffects, useEffect };

@@ -8,3 +8,3 @@ import { State } from './state.js';

*/
declare const useLayoutEffect: (callback: (this: State<unknown>, self: HTMLElement) => void | Promise<void> | VoidFunction, values?: unknown[] | undefined) => void;
declare const useLayoutEffect: (callback: (this: State<unknown>, self: HTMLElement) => void | VoidFunction | Promise<void>, values?: unknown[] | undefined) => void;
export { useLayoutEffect };
{
"name": "starcounter-jack-haunted",
"repository": "git://github.com/starcounter-jack/haunted.git",
"version": "6.0.3",
"version": "6.0.4",
"description": "Hooks for web components",

@@ -6,0 +6,0 @@ "main": "lib/haunted.js",

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