@dooboostore/dom-render
Version:
html view template engine
193 lines • 9.35 kB
TypeScript
import type { DomRenderConfig } from '../configs/DomRenderConfig';
import { ComponentSet } from '../components/ComponentSet';
import { OperatorExecuter } from '../operators/OperatorExecuter';
import { TargetElement } from '../configs/TargetElement';
import { TargetAttr } from '../configs/TargetAttr';
import { DestroyOptionType } from './DestroyOptionType';
import { Attrs } from './Attrs';
import { RawSetType } from './RawSetType';
import { Render } from './Render';
import { OnDestroyRenderParams } from '../lifecycle/OnDestroyRender';
export type RenderResult = {
raws: RawSet[];
executedOperators: OperatorExecuter[];
};
export declare class RawSet {
uuid: string;
type: RawSetType;
point: {
start: Comment | Text | HTMLMetaElement;
node: Node;
end: Comment | Text | HTMLMetaElement;
innerHTML?: string;
parent?: Node | null;
parentRawSet?: RawSet;
childrenRawSets?: RawSet[];
};
dataSet: {
config: DomRenderConfig;
fragment: DocumentFragment;
render?: Render;
};
detect?: {
action: Function;
};
static readonly DR_NAME = "dr";
static readonly DR_IF_NAME = "dr-if";
static readonly DR_FOR_NAME = "dr-for";
static readonly DR_FOR_OF_NAME = "dr-for-of";
static readonly DR_THIS_PROPERTY_NAME = "dr-this-property";
static readonly DR_REPEAT_NAME = "dr-repeat";
static readonly DR_THIS_NAME = "dr-this";
static readonly DR_FORM_NAME = "dr-form";
static readonly DR_PRE_NAME = "dr-pre";
static readonly DR_APPENDER_NAME = "dr-appender";
static readonly DR_INNERHTML_NAME = "dr-inner-html";
static readonly DR_INNERTEXT_NAME = "dr-inner-text";
static readonly DR_DETECT_NAME = "dr-detect";
static readonly DR_STRIP_NAME = "dr-strip";
static readonly DR_REPLACE_TARGET_ELEMENT_IS_NAME = "dr-replace-target-element-is";
static readonly DR_TARGET_ELEMENT_ELEMENTNAME = "dr-target-element";
static readonly DR_DETECT_IF_OPTIONNAME = "dr-detect-option-if";
static readonly DR_DETECT_FILTER_OPTIONNAME = "dr-detect-option-filter";
static readonly DR_DETECT_ATTR_OPTIONNAME = "dr-detect-option-attr";
/**
* @deprecated
*/
static readonly DR_THIS_OPTIONNAME = "dr-option-this";
static readonly DR_ATTR_OPTIONNAME = "dr-option-attr";
static readonly DR_IF_OPTIONNAME = "dr-option-if";
static readonly DR_IT_OPTIONNAME = "dr-option-it";
static readonly DR_VAR_OPTIONNAME = "dr-option-var";
static readonly DR_AFTER_OPTIONNAME = "dr-option-after";
static readonly DR_NEXT_OPTIONNAME = "dr-option-next";
static readonly DR_BEFORE_OPTIONNAME = "dr-option-before";
static readonly DR_COMPLETE_OPTIONNAME = "dr-option-complete";
static readonly DR_STRIP_OPTIONNAME = "dr-option-strip";
static readonly DR_DESTROY_OPTIONNAME = "dr-option-destroy";
static readonly DR_THIS_NAME_OPTIONNAME = "dr-option-this-name";
static readonly DR_VARIABLE_NAME_OPTIONNAME = "dr-option-variable-name";
static readonly DR_ITEM_VARIABLE_NAME_OPTIONNAME = "dr-option-item-variable-name";
static readonly DR_ITEM_VARIABLE_NAME_OPTIONNAME_DEFAULT = "it";
static readonly DR_ITEM_INDEX_VARIABLE_NAME_OPTIONNAME = "dr-option-item-index-variable-name";
static readonly DR_ITEM_OFFSET_INDEX_VARIABLE_NAME_OPTIONNAME = "dr-option-item-offset-index-variable-name";
static readonly DR_ITEM_INDEX_OFFSET_OPTIONNAME = "dr-option-item-index-offset";
static readonly DR_ITEM_INDEX_VARIABLE_NAME_OPTIONNAME_DEFAULT = "index";
static readonly DR_ITEM_OFFSET_INDEX_VARIABLE_NAME_OPTIONNAME_DEFAULT = "offsetIndex";
static readonly DR_INNER_HTML_NAME_OPTIONNAME = "dr-option-inner-html-name";
static readonly DR_INNER_TEXT_NAME_OPTIONNAME = "dr-option-inner-text-name";
static readonly DR_INNER_HTML_ESCAPED_NAME_OPTIONNAME = "dr-option-inner-html-escaped-name";
static readonly DR_KEY_OPTIONNAME = "dr-option-key";
static readonly DR_HAS_KEYS_OPTIONNAME = "dr-option-has-keys";
static readonly DR_ON_CREATE_ARGUMENTS_OPTIONNAME = "dr-on-create:arguments";
static readonly DR_ON_CREATED_CALLBACK_OPTIONNAME = "dr-on-create:callback";
static readonly DR_ON_CONSTRUCTOR_ARGUMENTS_OPTIONNAME = "dr-on-constructor:arguments";
static readonly drAttrsOriginName: Attrs;
static readonly DR_TAGS: any[];
static readonly DR_ELEMENTS: string[];
static readonly DR_ATTRIBUTES: readonly ["dr", "dr-appender", "dr-if", "dr-for-of", "dr-this-property", "dr-for", "dr-this", "dr-form", "dr-pre", "dr-inner-html", "dr-inner-text", "dr-repeat", "dr-strip"];
constructor(uuid: string, type: RawSetType, point: {
start: Comment | Text | HTMLMetaElement;
node: Node;
end: Comment | Text | HTMLMetaElement;
innerHTML?: string;
parent?: Node | null;
parentRawSet?: RawSet;
childrenRawSets?: RawSet[];
}, dataSet: {
config: DomRenderConfig;
fragment: DocumentFragment;
render?: Render;
}, detect?: {
action: Function;
});
get isConnected(): boolean;
getUsingTriggerVariables(config?: DomRenderConfig): Set<string>;
private lastRenderedValue;
render(obj: any, config: DomRenderConfig): Promise<RenderResult>;
private static generateRuleSelector;
static generateStyleTransform(styleBody: string | string[], componentKey: string, styleTagWrap?: boolean): string;
private static extractCssImports;
applyEvent(obj: any, fragment?: DocumentFragment, config?: DomRenderConfig): void;
onRenderedEvent(obj: any, nodes: Node[], config?: DomRenderConfig): void;
getAttribute(element: Element, attr: string): string;
getAttributeAndDelete(element: Element, attr: string): string;
getDrAppendAttributeAndDelete(element: Element, obj: any): string;
replaceBody(genNode: Node): void;
static checkPointCreates(element: Node, obj: any, config: DomRenderConfig): RawSet[];
static createStartEndPoint(data: {
node?: Node;
id: string;
type: RawSetType;
}, config: DomRenderConfig): {
start: HTMLMetaElement;
end: HTMLMetaElement;
} | {
start: Comment;
end: Comment;
};
remove(): void;
childAllRemove(): void;
childs(stopNext?: (node: Node) => boolean): any[];
getHasRawSet(key: string): RawSet;
static drItOtherEncoding(element: Element | DocumentFragment, postFix?: string): string;
static drItOtherDecoding(element: Element | DocumentFragment, random: string): void;
static drVarDecoding(element: Element, vars: {
name: string;
value: string;
regex: RegExp;
random: string;
}[]): void;
static replaceInnerHTML(element: Element, config: {
asIs: string | RegExp;
toBe?: string;
}): string;
static drThisEncoding(element: Element, drThis: string, config: {
asIs: RegExp;
toBe?: string;
}): string;
static drThisBindEncoding(element: Element, variable: RegExp, config: {
config: DomRenderConfig;
otherReplaceVariablePath?: string;
}): string;
static drThisBindDecoding(element: Element, config: {
asIs: string;
toBe: string;
config: DomRenderConfig;
}): void;
static drThisDecoding(element: Element, config: {
asIs: string;
toBe: string;
}): void;
static drFormOtherMoveAttr(element: Element, as: string, to: string, config: DomRenderConfig): void;
static drVarEncoding(element: Element, drVarOption: string): {
name: string;
value: string;
regex: RegExp;
random: string;
}[];
static drThisCreate(rawSet: RawSet, element: Element, drThis: string, drVarOption: string, drStripOption: boolean | string | null, obj: any, config: DomRenderConfig, set?: ComponentSet): Promise<DocumentFragment | undefined>;
private static fetchTemplateStyle;
static createComponentTargetAttribute(name: string, getThisObj: (element: Element, attrValue: string, obj: any, rawSet: RawSet) => any, factory: (element: Element, attrValue: string, obj: any, rawSet: RawSet) => DocumentFragment): TargetAttr;
static createComponentTargetElement<T = any>({ name, objFactory, template, styles, noStrip }: {
name: string;
noStrip?: boolean;
objFactory: (element: Element, obj: any, rawSet: RawSet, counstructorParam: any[]) => any;
template?: string | ((instance: T) => Promise<string>);
styles?: string | string[] | ((instance: T) => Promise<string>);
}): TargetElement<T>;
static isExpression(data: string | null): boolean;
static expressionGroups(data: string | null): any[];
static destroy(obj: any | undefined, parameter: OnDestroyRenderParams, config: DomRenderConfig, destroyOptions?: (DestroyOptionType | string)[]): void;
findNearThis: (obj: any, rawSet?: RawSet) => any;
findParentThis: (obj: any, rawSet?: RawSet) => any;
findNearThisPath: (rawSet?: RawSet) => string | undefined;
findParentThisPath: (rawSet?: RawSet) => string | undefined;
findThisPaths: (rawSet?: RawSet) => string[];
static getAttributeObject(element: Element, config: {
script: string;
obj: any;
renderData?: any;
}): any;
}
//# sourceMappingURL=RawSet.d.ts.map