@pictogrammers/element
Version:
Web Component Element for TypeScript
48 lines (47 loc) • 1.85 kB
TypeScript
import './global';
interface CustomElementConfig {
selector?: string;
template?: string;
style?: CSSStyleSheet;
useShadow?: boolean;
}
export declare const index: unique symbol;
export declare function getProxyValue(obj: any): any;
export declare function Component(config?: CustomElementConfig): (cls: any, context?: any) => void;
export declare function TransmutePart(part: string, selector: string): (cls: any) => void;
export declare function Prop(normalize?: (value: any) => any): any;
export declare function Part(): any;
/**
* Store data via a Map into LocalStorage
* @param key String
* @returns Value
*/
export declare function Local(key: string): any;
interface TemplateAttribute {
[part: string]: Function | string | number | null;
}
interface TemplatePart {
[part: string]: TemplateAttribute;
}
export declare function node<T>(template: string, init: TemplatePart): T;
export declare function normalizeInt(value: any): number;
export declare function normalizeFloat(value: any): number;
export declare function normalizeBoolean(value: any): boolean;
export declare function normalizeString(value: any): string;
export type Changes = {
[key: string]: boolean;
};
type ForEach = {
container: HTMLElement;
items: any;
type: (item: any) => any;
create?: ($item: HTMLElement, item: any) => void;
update?: ($item: HTMLElement, item: any) => void;
connect?: ($item: HTMLElement, item: any) => void;
disconnect?: ($item: HTMLElement, item: any) => void;
};
export declare function forEach({ container, items, type, create, connect, disconnect, update }: ForEach): void;
export declare function selectComponent<T>(tagName: string): T;
export declare function selectPart<T>(component: HTMLElement, name: string): T;
export declare function getProps(tag: string): string[];
export {};