taggedjs
Version:
tagged template reactive html
51 lines (50 loc) • 2.12 kB
TypeScript
import { EventCallback } from './getDomTag.function.js';
import { ContextItem } from './ContextItem.type.js';
import { AnySupport } from './index.js';
import { Props } from '../Props.js';
import { TagWrapper } from './tag.utils.js';
import { OnDestroyCallback } from '../state/onDestroy.function.js';
import { Subscription } from '../subject/subject.utils.js';
import { ValueTypes } from './ValueTypes.enum.js';
import { PropWatches, TagJsComponent } from '../TagJsTags/tag.function.js';
import { ProcessInit } from './ProcessInit.type.js';
import { ProcessDelete, TagJsTag } from '../TagJsTags/TagJsTag.type.js';
import { CheckSupportValueChange, HasValueChanged } from './Context.types.js';
import { ProcessUpdate } from './ProcessUpdate.type.js';
export type Wrapper = ((newSupport: AnySupport, subject: ContextItem, prevSupport?: AnySupport) => AnySupport) & TagWrapper<unknown> & {
tagJsType: typeof ValueTypes.tagComponent | typeof ValueTypes.templater;
processInit: ProcessInit;
processUpdate: ProcessUpdate;
hasValueChanged: HasValueChanged | CheckSupportValueChange;
destroy: ProcessDelete;
};
/** NOT shared across variable spots. The Subject/ContextItem is more global than this is */
export type TagGlobal = {
deleted?: true;
isApp?: boolean;
subscriptions?: Subscription<unknown>[];
destroyCallback?: OnDestroyCallback;
callbackMaker?: true;
};
export interface SupportTagGlobal extends TagGlobal {
blocked: AnySupport[];
}
export type Events = {
[name: string]: EventCallback;
};
export type Clone = (Element | Text | ChildNode);
export type TemplaterResult = TagJsTag<any> & {
tagJsType: string;
processInit: ProcessInit;
propWatch: PropWatches;
wrapper?: Wrapper;
tag?: TagJsComponent<any>;
props?: Props;
outerHTML: string;
/** Used inside of an array.map() function */
key: <T>(arrayValue: T) => TemplaterResultArrayItem<T>;
};
export type TemplaterResultArrayItem<T> = TemplaterResult & {
arrayValue?: T;
};
export declare function getTemplaterResult(propWatch: PropWatches, props?: Props): TemplaterResult;