Socket
Socket
Sign inDemoInstall

@endorphinjs/template-runtime

Package Overview
Dependencies
Maintainers
1
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@endorphinjs/template-runtime - npm Package Compare versions

Comparing version 0.8.8 to 0.9.0

30

dist/attribute.d.ts

@@ -24,7 +24,7 @@ import { Component } from './component';

*/
export declare function propsSet(elem: Component, initial?: {}): {};
export declare function propsSet(elem: Component, initial?: Record<string, unknown>): Record<string, unknown>;
/**
* Alias for `elem.setAttribute`
*/
export declare function setAttribute(elem: Element, name: string, value: any): any;
export declare function setAttribute<T = unknown>(elem: Element, name: string, value: T): T;
/**

@@ -34,11 +34,11 @@ * Updates element’s `name` attribute value only if it differs from previous value,

*/
export declare function updateAttribute(elem: Element, prev: ValueMap, name: string, value: any): number;
export declare function updateAttribute(elem: Element, prev: ValueMap, name: string, value: unknown): number;
/**
* Alias for `elem.className`
*/
export declare function setClass(elem: Element, value: any): any;
export declare function setClass<T = unknown>(elem: Element, value: T): T;
/**
* Shorthand to update class name, specific to Endorphin compiled code
*/
export declare function updateClass(elem: Element, prev: ValueMap, value: any): number;
export declare function updateClass(elem: Element, prev: ValueMap, value: unknown): number;
/**

@@ -50,7 +50,7 @@ * Sets attribute value as expression. Unlike regular primitive attributes,

*/
export declare function setAttributeExpression(elem: Element, name: string, value: any): any;
export declare function setAttributeExpression<T = unknown>(elem: Element, name: string, value: T): T;
/**
* Alias for `elem.setAttributeNS`
*/
export declare function setAttributeNS(elem: Element, ns: string, name: string, value: any): any;
export declare function setAttributeNS<T = unknown>(elem: Element, ns: string, name: string, value: T): T;
/**

@@ -60,19 +60,19 @@ * Updates element’s `name` attribute value only if it differs from previous value,

*/
export declare function updateAttributeNS(elem: Element, prevNS: ValueMapNS, ns: string, name: string, value: any): number;
export declare function updateAttributeNS(elem: Element, prevNS: ValueMapNS, ns: string, name: string, value: unknown): number;
/**
* Same as `setAttributeExpression()` but for namespaced attributes
*/
export declare function setAttributeExpressionNS(elem: Element, ns: string, name: string, value: any): any;
export declare function setAttributeExpressionNS<T = unknown>(elem: Element, ns: string, name: string, value: T): T;
/**
* Sets pending namespaced attribute value which will be added to element later
*/
export declare function setPendingAttributeNS(attrs: ValueMapNS, ns: string, name: string, value: any): void;
export declare function setPendingAttributeNS(attrs: ValueMapNS, ns: string, name: string, value: unknown): void;
/**
* Updates pending `name` value only if given `value` is not null
*/
export declare function updatePendingAttribute(attrs: ValueMap, name: string, value: any): void;
export declare function updatePendingAttribute(attrs: ValueMap, name: string, value: unknown): void;
/**
* Updates pending namespaced `name` value only if given `value` is not null
*/
export declare function updatePendingAttributeNS(attrs: ValueMap, ns: string, name: string, value: any): void;
export declare function updatePendingAttributeNS(attrs: ValueMap, ns: string, name: string, value: unknown): void;
/**

@@ -85,3 +85,3 @@ * Adds given class name to pending attribute set

*/
export declare function addPendingClassIf(data: ValueMap, className: string, condition: any): void;
export declare function addPendingClassIf(data: ValueMap, className: string, condition: unknown): void;
/**

@@ -98,3 +98,3 @@ * Finalizes pending attributes

*/
export declare function inputValue(value: any): any;
export declare function inputValue(value: unknown): string;
/**

@@ -104,3 +104,3 @@ * Updates element’s `name` property value only if it differs from previous value,

*/
export declare function updateProperty(elem: Element, prev: ValueMap, name: string, value: any): number;
export declare function updateProperty(elem: Element, prev: ValueMap, name: string, value: unknown): number;
export {};
import { Injector } from './injector';
import { Changes, Data, UpdateTemplate, MountTemplate } from './types';
import { Changes, UpdateTemplate, MountTemplate } from './types';
import { Store } from './store';

@@ -17,3 +17,3 @@ export interface RefMap {

}
export interface Component<P = Data, S = Data, T = Store | undefined> extends HTMLElement {
export interface Component<P = any, S = any, T = Store | undefined> extends HTMLElement {
/**

@@ -47,2 +47,11 @@ * Pointer to component view container. By default, it’s the same as component

}
declare type HookCallback = () => void;
interface ComponentHooks {
init: [];
didChange: HookCallback[];
willMount: HookCallback[];
didMount: HookCallback[];
willRender: HookCallback[];
willUpdate: HookCallback[];
}
/**

@@ -59,3 +68,5 @@ * Internal Endorphin component descriptor

/** Runtime variables */
vars: object;
vars: Record<string, unknown>;
/** Hooks callbacks */
hooks: ComponentHooks;
/**

@@ -75,3 +86,3 @@ * A function for updating rendered component content. Might be available

/** Default props values */
defaultProps: object;
defaultProps: Record<string, unknown>;
partialDeps: PartialDeps | null;

@@ -95,3 +106,3 @@ }

/** Methods and properties to extend component with */
extend?: object;
extend?: Record<string, unknown>;
/** List of plugins for current component of factory method for producing plugins */

@@ -109,5 +120,5 @@ plugins?: ComponentDefinition[] | PluginFactory;

/** Initial props factory */
props?(component: Component): {};
props?(component: Component): Record<string, unknown>;
/** Initial state factory */
state?(component: Component): {};
state?(component: Component): Record<string, unknown>;
/** Returns instance of store used for components */

@@ -167,7 +178,7 @@ store?(): Store;

*/
export declare function mountComponent(component: Component, props?: object): void;
export declare function mountComponent(component: Component, props?: Record<string, unknown>): void;
/**
* Updates given mounted component
*/
export declare function updateComponent(component: Component, props?: object, partialDeps?: PartialDeps): number;
export declare function updateComponent(component: Component, props?: Record<string, unknown>, partialDeps?: PartialDeps): number;
/**

@@ -191,2 +202,3 @@ * Destroys given component: removes static event listeners and cleans things up

export declare function renderComponent(component: Component, changes?: Changes): void;
export declare function afterUpdate<C extends Component>(component: C, callback: HookCallback): void;
export {};
declare type TextNode = Text & {
$value: any;
$value: unknown;
};

@@ -36,3 +36,3 @@ /**

*/
export declare function updateText(node: TextNode, value: any): number;
export declare function updateText(node: TextNode, value: unknown): number;
/**

@@ -48,3 +48,2 @@ * Isolates given element with CSS scope

* Removes given DOM node from its tree
* @param {Node} node
*/

@@ -51,0 +50,0 @@ export declare function domRemove(node: Node): void;

@@ -6,5 +6,3 @@ import { Scope, EventBinding, ComponentEventListener } from './types';

host: Component;
events: {
[type: string]: EventBinding | void;
};
events: Record<string, EventBinding | void>;
}

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

@@ -13,5 +13,3 @@ import { LinkedList, LinkedListItem } from './linked-list';

/** Slots container */
slots: {
[name: string]: SlotContext;
} | null;
slots: Record<string, SlotContext> | null;
}

@@ -18,0 +16,0 @@ export interface Block {

@@ -24,2 +24,2 @@ import { Injector, Block } from './injector';

export declare function clearIterator(block: IteratorBlock): void;
export declare function prepareScope(scope: Scope, index: number, key: any, value: any): Scope;
export declare function prepareScope(scope: Scope, index: number, key: unknown, value: unknown): Scope;

@@ -10,3 +10,3 @@ import { Injector, Block } from './injector';

body: MountBlock;
defaults: object;
defaults: Record<string, unknown>;
}

@@ -20,3 +20,3 @@ interface PartialsMap {

*/
export declare function mountPartial(host: Component, injector: Injector, partial: PartialDefinition, args: object): PartialBlock;
export declare function mountPartial(host: Component, injector: Injector, partial: PartialDefinition, args: Record<string, unknown>): PartialBlock;
/**

@@ -26,5 +26,5 @@ * Updates mounted partial

*/
export declare function updatePartial(block: PartialBlock, partial: PartialDefinition, args: object): number;
export declare function updatePartial(block: PartialBlock, partial: PartialDefinition, args: Record<string, unknown>): number;
export declare function unmountPartial(block: PartialBlock): void;
export declare function clearPartial(block: PartialBlock): void;
export {};
import endorphin from './runtime';
export default endorphin;
export { Component, ComponentDefinition, createComponent, mountComponent, unmountComponent } from './component';
export { Component, ComponentDefinition, createComponent, mountComponent, unmountComponent, afterUpdate } from './component';
export { Store } from './store';
export { Changes } from './types';
export { TweenOptions, TweenFactory, composeTween } from './animation';

@@ -25,3 +25,3 @@ import { Component, ComponentDefinition } from './component';

/** Initial component props */
props?: {};
props?: Record<string, unknown>;
/** Store for component */

@@ -38,5 +38,2 @@ store?: Store;

* Safe property getter
* @param {*} ctx
* @param {*} ...args
* @returns {*}
*/

@@ -47,3 +44,3 @@ export declare function get(ctx: any): any;

*/
export declare function call(ctx: any, methodName: string, args?: any[]): any;
export declare function call(ctx: Record<string, unknown>, methodName: string, args?: any[]): any;
/**

@@ -50,0 +47,0 @@ * Filter items from given collection that matches `fn` criteria and returns

@@ -6,3 +6,3 @@ import { Scope } from './types';

*/
export declare function enterScope(host: Component, incoming?: any): Scope;
export declare function enterScope(host: Component, incoming?: Record<string, unknown>): Scope;
/**

@@ -15,3 +15,3 @@ * Exit from current variable scope

*/
export declare function createScope(host: Component, incoming?: any): Scope;
export declare function createScope(host: Component, incoming?: Record<string, unknown>): Scope;
/**

@@ -40,2 +40,2 @@ * Sets given object as current component scope

*/
export declare function setVar(elem: Component, name: string, value: any): void;
export declare function setVar(elem: Component, name: string, value: unknown): void;
import { Component } from './component';
import { Data } from './types';
declare type StoreUpdateHandler = (state: any, changes: object) => void;
declare type StoreUpdateHandler = (state: any, changes: Record<string, unknown>) => void;
export interface StoreUpdateEntry {

@@ -39,3 +39,2 @@ keys?: string[];

* Stops watching for store updates for given component
* @param {Component} component
*/

@@ -42,0 +41,0 @@ unwatch(component: Component): void;

@@ -18,5 +18,3 @@ import { Component } from './component';

}
export interface Data {
[key: string]: any;
}
export declare type Data = object;
export interface ChangeSet<T = any> {

@@ -30,3 +28,3 @@ prev: {

}
export declare type Changes<T = any> = {
export declare type Changes<T = unknown> = {
[P in keyof T]?: {

@@ -33,0 +31,0 @@ current: T[P] | null;

@@ -11,5 +11,5 @@ import { Component } from './component';

}
export declare function mountUse(host: Component, elem: HTMLElement, factory: UseDirectiveFactory, param?: any): UseDirectiveInternal;
export declare function updateUse(data: UseDirectiveInternal, param?: any): void;
export declare function mountUse(host: Component, elem: HTMLElement, factory: UseDirectiveFactory, param?: unknown): UseDirectiveInternal;
export declare function updateUse(data: UseDirectiveInternal, param?: unknown): void;
export declare function unmountUse(data: UseDirectiveInternal): void;
export {};

@@ -7,7 +7,7 @@ import { Changes, ChangeSet } from './types';

*/
export declare function obj(proto?: any): {};
export declare function obj(proto?: any): Record<string, unknown>;
/**
* Check if given value id defined, e.g. not `null`, `undefined` or `NaN`
*/
export declare function isDefined(value: any): boolean;
export declare function isDefined(value: unknown): boolean;
/**

@@ -21,3 +21,3 @@ * Creates object for storing change sets, e.g. current and previous values

*/
export declare function changed(next: any, prev: any, prefix?: string): Changes | null;
export declare function changed(next: Record<string, unknown>, prev: Record<string, unknown>, prefix?: string): Changes | null;
/**

@@ -36,3 +36,5 @@ * Adds given `scope` attribute to `el` to isolate its CSS

*/
declare const getObjectDescriptors: <T>(source: any) => {};
declare const getObjectDescriptors: <T>(o: T) => { [P in keyof T]: TypedPropertyDescriptor<T[P]>; } & {
[x: string]: PropertyDescriptor;
};
export { assign, getObjectDescriptors };

@@ -43,3 +45,3 @@ /**

*/
export declare function assignIfNeeded(prev: any, next: any): boolean;
export declare function assignIfNeeded(prev: Record<string, unknown>, next: Record<string, unknown>): boolean;
export declare function safeCall<T, U, Y>(fn?: (p1?: T, p2?: U) => Y, arg1?: T, arg2?: U): Y | undefined;

@@ -46,0 +48,0 @@ export declare function captureError<T, U, Y>(host: Component, fn?: (p1?: T, p2?: U) => Y, arg1?: T, arg2?: U): Y | undefined;

{
"name": "@endorphinjs/template-runtime",
"version": "0.8.8",
"version": "0.9.0",
"description": "EndorphinJS template runtime, embedded with template bundles",

@@ -10,6 +10,5 @@ "main": "./dist/runtime.cjs.js",

"test": "mocha",
"lint": "tslint ./src/**/*.ts",
"build": "rollup -c && npm run types",
"lint": "eslint ./src/**/*.ts",
"build": "rollup -c",
"watch": "rollup -wc",
"types": "tsc -p ./tsconfig.declaration.json",
"clean": "rm -rf ./dist",

@@ -27,11 +26,13 @@ "prepare": "npm run lint && npm test && npm run clean && npm run build"

"devDependencies": {
"@endorphinjs/template-compiler": "^0.8.7",
"@types/mocha": "^5.2.7",
"@types/node": "^12.11.1",
"mocha": "^6.2.2",
"rollup": "^1.25.1",
"rollup-plugin-typescript": "^1.0.1",
"ts-node": "^8.4.1",
"tslint": "^5.20.0",
"typescript": "^3.6.4"
"@endorphinjs/template-compiler": "^0.9.0",
"@rollup/plugin-typescript": "^8.2.5",
"@types/mocha": "^9.0.0",
"@types/node": "^16.4.11",
"@typescript-eslint/eslint-plugin": "^4.29.0",
"@typescript-eslint/parser": "^4.29.0",
"eslint": "^7.32.0",
"mocha": "^9.0.3",
"rollup": "^2.55.1",
"ts-node": "^10.1.0",
"typescript": "^4.3.5"
},

@@ -54,3 +55,3 @@ "directories": {

},
"gitHead": "233694929f17b8d852d2e74c11d31acd6abe3812"
"gitHead": "d1548ba7919d745fc372d2005d8e6ab53c7132a1"
}

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 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