@trustme24/flext 1.10.3 → 1.10.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine.d.ts +66 -0
- package/dist/index.cjs +156 -156
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +2 -54
- package/dist/index.js +20 -20
- package/dist/index.js.map +4 -4
- package/package.json +8 -8
- package/src/engine.ts +414 -0
- package/src/index.ts +4 -381
- package/src/lib/index.ts +1 -1
package/dist/engine.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { AST } from '@handlebars/parser';
|
|
2
|
+
import * as types from './types';
|
|
3
|
+
import * as errors from './errors';
|
|
4
|
+
export declare const DEFAULT_HELPER_NAME = "__default";
|
|
5
|
+
export declare const DEFAULT_MODEL_DEPTH = 10;
|
|
6
|
+
export type MacrosData = {
|
|
7
|
+
version?: string | null;
|
|
8
|
+
lang?: string | null;
|
|
9
|
+
timeZone?: string | null;
|
|
10
|
+
title?: string | null;
|
|
11
|
+
moduleNames?: string[] | null;
|
|
12
|
+
lineHeight?: string | null;
|
|
13
|
+
fields?: types.Field[] | null;
|
|
14
|
+
};
|
|
15
|
+
export declare class SimpleFlext {
|
|
16
|
+
ast: AST.Program;
|
|
17
|
+
data: types.Obj;
|
|
18
|
+
helpers: types.Obj;
|
|
19
|
+
onGetProcessed: types.GetProcessedTemplateHandler;
|
|
20
|
+
onGetAst: types.GetTemplateAstHandler;
|
|
21
|
+
constructor(val?: string | null, data?: types.Obj, helpers?: types.Obj);
|
|
22
|
+
setTemplate(val: string): this;
|
|
23
|
+
setData(val: types.Obj): this;
|
|
24
|
+
setHelpers(val: types.Obj): this;
|
|
25
|
+
addHelper(name: string, val: any): this;
|
|
26
|
+
setOnGetProcessed(val: types.GetProcessedTemplateHandler): this;
|
|
27
|
+
setOnGetAst(val: types.GetTemplateAstHandler): this;
|
|
28
|
+
getHtml(data?: types.Obj | null, helpers?: types.Obj | null): string;
|
|
29
|
+
getCss(data?: types.Obj | null, options?: types.Obj): Promise<string>;
|
|
30
|
+
get html(): string;
|
|
31
|
+
}
|
|
32
|
+
export declare class Flext extends SimpleFlext {
|
|
33
|
+
version: string;
|
|
34
|
+
lang: string;
|
|
35
|
+
title: string;
|
|
36
|
+
timeZone: string;
|
|
37
|
+
lineHeight: number;
|
|
38
|
+
assets: types.Obj<Blob>;
|
|
39
|
+
fields: types.Field[];
|
|
40
|
+
onGetTitle: types.GetTemplateTitleHandler;
|
|
41
|
+
onGetMacro: types.GetTemplateMacroHandler;
|
|
42
|
+
constructor(val?: string | null, data?: types.Obj, helpers?: types.Obj);
|
|
43
|
+
useModule(...val: string[]): this;
|
|
44
|
+
setTemplate(val: string): this;
|
|
45
|
+
setVersion(val: string): this;
|
|
46
|
+
setLang(val: string): this;
|
|
47
|
+
setTitle(val: string): this;
|
|
48
|
+
setTimeZone(val: string): this;
|
|
49
|
+
setLineHeight(val: number): this;
|
|
50
|
+
setAssets(val: types.Obj<Blob>): this;
|
|
51
|
+
addAsset(name: string, val: Blob): this;
|
|
52
|
+
setFields(val: types.Field[]): this;
|
|
53
|
+
addModule(name: string, val: any): this;
|
|
54
|
+
setOnGetTitle(val: types.GetTemplateTitleHandler): this;
|
|
55
|
+
setOnGetMacro(val: types.GetTemplateMacroHandler): this;
|
|
56
|
+
getDataModel(depth?: number): types.MetadataModelNode[];
|
|
57
|
+
getValidationErrors(data?: types.Obj | null, depth?: number): errors.TemplateDataValidationError[];
|
|
58
|
+
getIsValid(data?: types.Obj | null, depth?: number): boolean;
|
|
59
|
+
get model(): types.MetadataModelNode[];
|
|
60
|
+
get validationErrors(): errors.TemplateDataValidationError[];
|
|
61
|
+
get errors(): errors.BaseError[];
|
|
62
|
+
get isValid(): boolean;
|
|
63
|
+
}
|
|
64
|
+
export declare function macrosToData(macros: types.Macro[]): MacrosData;
|
|
65
|
+
export declare function defaultGetProcessed(val: string): string;
|
|
66
|
+
export default Flext;
|