@trustme24/flext 1.9.4 → 1.10.0

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.
@@ -1,53 +1,54 @@
1
1
  import { AST } from '@handlebars/parser';
2
- import { Obj, Isset, IsNumber, IsObject, Has, Inarr, Macro, MacroParam, DataModel, DataModelNode, CollectorFilterHandler } from './types';
3
- import { TemplateDataValidationError } from './errors';
2
+ import { TemplateDataValidationError } from '../errors';
4
3
  import striptags from 'striptags';
5
4
  import Handlebars, { TemplateDelegate } from 'handlebars';
6
- import * as types from "./types";
5
+ import * as types from '../types';
7
6
  export declare const uno: any;
8
7
  export declare const DEFAULT_MODEL_DEPTH = 10;
8
+ export declare const DEFAULT_FIELD_TYPE: types.FieldType;
9
9
  export declare const stripHtml: typeof striptags;
10
10
  export declare class HandlebarsCollector<T = any> extends Handlebars.Visitor {
11
11
  data: T[];
12
- match: CollectorFilterHandler<T>;
13
- constructor(filter?: CollectorFilterHandler<T>);
12
+ match: types.CollectorFilterHandler<T>;
13
+ constructor(filter?: types.CollectorFilterHandler<T>);
14
14
  onCollect(val: T): void;
15
- setMatchHandler(val: CollectorFilterHandler<T>): this;
15
+ setMatchHandler(val: types.CollectorFilterHandler<T>): this;
16
16
  setAst(ast: AST.Program): this;
17
17
  collect(ast: AST.Program): T[];
18
18
  }
19
- export declare function inarr<T extends any, A extends any[]>(val: T, ...arr: A): Inarr<T, A>;
20
- export declare function has<T extends Obj, K extends keyof T>(obj: T, key: K): Has<T, K>;
21
- export declare function isset<T extends any>(val: T): Isset<T>;
22
- export declare function isNumber<T extends any>(val: T): IsNumber<T>;
23
- export declare function isObject<T extends any>(val: T): IsObject<T>;
19
+ export declare function inarr<T extends any, A extends any[]>(val: T, ...arr: A): types.Inarr<T, A>;
20
+ export declare function has<T extends types.Obj, K extends keyof T>(obj: T, key: K): types.Has<T, K>;
21
+ export declare function isset<T extends any>(val: T): types.Isset<T>;
22
+ export declare function isNumber<T extends any>(val: T): types.IsNumber<T>;
23
+ export declare function isObject<T extends any>(val: T): types.IsObject<T>;
24
24
  export declare function audit(val: any): string;
25
25
  export declare function getAst(val: string): AST.Program;
26
26
  export declare function getTemplate(val: string | AST.Program): TemplateDelegate;
27
- export declare function getHtml(template: TemplateDelegate, data?: Obj, helpers?: Obj): string;
28
- export declare function getCss(template: TemplateDelegate, data?: Obj, options?: Obj): Promise<string>;
27
+ export declare function getHtml(template: TemplateDelegate, data?: types.Obj, helpers?: types.Obj): string;
28
+ export declare function getCss(template: TemplateDelegate, data?: types.Obj, options?: types.Obj): Promise<string>;
29
29
  export declare function unique<T = any>(arr: T[]): T[];
30
30
  export declare function getPaths(ast: AST.Program): string[];
31
- export declare function pathToDataModelNode(path: string, depth?: number): DataModelNode;
32
- export declare function pathToDataModel(path: string, depth?: number): DataModel;
33
- export declare function getDataModel(ast: AST.Program): DataModel;
31
+ export declare function pathToDataModelNode(path: string, depth?: number): types.DataModelNode;
32
+ export declare function pathToDataModel(path: string, depth?: number): types.DataModel;
33
+ export declare function getDataModel(ast: AST.Program): types.DataModel;
34
34
  export declare function dataModelNodeToMetadata(node: types.DataModelNode, fields: types.Field[], _options?: types.Obj, depth?: number): types.MetadataModelNode;
35
- export declare function getMacroParam(val: string): MacroParam | null;
36
- export declare function getMacroParams(val: string, doWarn?: boolean): MacroParam[];
37
- export declare function getMacros(ast: AST.Program, doWarn?: boolean): Macro[];
35
+ export declare function getMacroParam(val: string): types.MacroParam | null;
36
+ export declare function getMacroParams(val: string, doWarn?: boolean): types.MacroParam[];
37
+ export declare function getMacros(ast: AST.Program, doWarn?: boolean): types.Macro[];
38
38
  export declare function getHtmlH1(ast: AST.Program, doWarn?: boolean): string[];
39
39
  export declare function getTemplateValidationErrorsByMetadata(data: types.Obj, model: types.MetadataModelNode[], depth?: number): TemplateDataValidationError[];
40
40
  export declare function ensureString(val: any): string;
41
41
  export declare function ensureNullableString(val: any): string | null;
42
- export declare function ensureDate(val: Date | string | number): Date;
42
+ export declare function ensureDate<T extends boolean = true>(val: Date | string | number, doWarn?: T): T extends true ? Date : Date | null;
43
43
  export declare function ensureTitle(val: string | number): string;
44
44
  export declare function ensureFieldName(val: string): string;
45
45
  export declare function ensureNullableFieldMinMax(val: any): Date | number | null;
46
46
  export declare function ensureNullableFieldMinMaxLength(val: any): number | null;
47
47
  export declare function ensureNullableFieldOrder(val: any): number | null;
48
48
  export declare function ensureFieldValue(val: any): types.FieldValue;
49
- export declare function filter(regex: RegExp, val: string | number): boolean;
50
- export declare function compare(a: number | null | undefined, b: number | null | undefined): number;
49
+ export declare function sum(...args: number[]): number;
50
+ export declare function matches(regex: RegExp, val: string | number): boolean;
51
+ export declare function compare(val: number | null | undefined, valRef: number | null | undefined): number;
51
52
  export declare function macroToModuleNames(val: types.Macro): string[];
52
53
  export declare function macroToField(val: types.Macro): types.Field;
53
54
  export declare function macroToFieldValueOption(val: types.Macro): types.FieldValueOption;
@@ -0,0 +1,5 @@
1
+ export declare function op(state: any): any[] | boolean;
2
+ export declare function destruct(state: any): any[];
3
+ export declare function check(state: any): boolean;
4
+ declare const _default: any;
5
+ export default _default;
@@ -1,17 +1,15 @@
1
1
  import { DateTime } from 'luxon';
2
- import { SafeString } from 'handlebars';
3
- export declare const DEFAULT_COLOR_OP = "text";
4
2
  export declare function op(state: any): DateTime | string | number | null;
5
- export declare function opWithColor(state: any): SafeString;
6
3
  export declare function now(state: any): DateTime;
7
- export declare function seconds(state: any): SafeString;
8
- export declare function minutes(state: any): SafeString;
9
- export declare function hours(state: any): SafeString;
10
- export declare function day(state: any): SafeString;
11
- export declare function month(state: any): SafeString;
12
- export declare function monthText(state: any): SafeString;
13
- export declare function year(state: any): SafeString;
14
- export declare function text(state: any): SafeString;
4
+ export declare function seconds(state: any): string;
5
+ export declare function minutes(state: any): string;
6
+ export declare function hours(state: any): string;
7
+ export declare function day(state: any): string;
8
+ export declare function month(state: any): string;
9
+ export declare function monthText(state: any): string;
10
+ export declare function year(state: any): string;
11
+ export declare function format(state: any): string;
12
+ export declare function text(state: any): string;
15
13
  export declare function unix(state: any): number;
16
14
  export declare function iso(state: any): string;
17
15
  declare const _default: any;
@@ -1,3 +1,4 @@
1
+ export { default as array } from './array';
1
2
  export { default as cond } from './cond';
2
3
  export { default as date } from './date';
3
4
  export { default as match } from './match';
@@ -1,17 +1,17 @@
1
- import { SafeString } from 'handlebars';
2
1
  export type Arg = string | number | null | undefined;
2
+ export type FlattenFuncArg = number | number[];
3
3
  export declare function op(state: any): number;
4
- export declare function opWithColor(state: any): SafeString;
5
- export declare function plus(state: any): SafeString;
6
- export declare function minus(state: any): SafeString;
7
- export declare function multiply(state: any): SafeString;
8
- export declare function divide(state: any): SafeString;
9
- export declare function intDivide(state: any): SafeString;
10
- export declare function power(state: any): SafeString;
11
- export declare function round(state: any): SafeString;
12
- export declare function percent(state: any): SafeString;
13
- export declare function sqrt(state: any): SafeString;
14
- export declare function cbrt(state: any): SafeString;
15
- export declare function abs(state: any): SafeString;
4
+ export declare function plus(state: any): number;
5
+ export declare function _sum(state: any): number;
6
+ export declare function minus(state: any): number;
7
+ export declare function multiply(state: any): number;
8
+ export declare function divide(state: any): number;
9
+ export declare function intDivide(state: any): number;
10
+ export declare function power(state: any): number;
11
+ export declare function round(state: any): number;
12
+ export declare function percent(state: any): number;
13
+ export declare function sqrt(state: any): number;
14
+ export declare function cbrt(state: any): number;
15
+ export declare function abs(state: any): number;
16
16
  declare const _default: any;
17
17
  export default _default;
@@ -1,10 +1,8 @@
1
- import { SafeString } from 'handlebars';
2
1
  import { Obj } from '../../types';
3
2
  export declare const DEFAULT_LANG = "en";
4
3
  export declare const LOCALES: Obj;
5
4
  export declare function op(state: any): number | string | boolean;
6
- export declare function opWithColor(state: any): SafeString;
7
- export declare function text(state: any): SafeString;
5
+ export declare function text(state: any): string;
8
6
  export declare function check(state: any): boolean;
9
7
  declare const _default: any;
10
8
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trustme24/flext",
3
- "version": "1.9.4",
3
+ "version": "1.10.0",
4
4
  "description": "A Powerful Templating Engine",
5
5
  "keywords": ["templates", "templating engine", "modular templates", "handlebars"],
6
6
  "type": "module",
@@ -32,12 +32,12 @@
32
32
  "license": "MIT",
33
33
  "devDependencies": {
34
34
  "@babel/cli": "^7.28.6",
35
- "@babel/core": "^7.28.6",
36
- "@babel/preset-env": "^7.28.6",
35
+ "@babel/core": "^7.29.0",
36
+ "@babel/preset-env": "^7.29.0",
37
37
  "@babel/preset-typescript": "^7.28.5",
38
38
  "@handlebars/parser": "^2.2.2",
39
39
  "@tailwindcss/cli": "^4.1.18",
40
- "@types/node": "^25.0.10",
40
+ "@types/node": "^25.2.0",
41
41
  "esbuild": "^0.27.2",
42
42
  "esbuild-plugin-import-glob": "^0.1.1",
43
43
  "tailwindcss": "^4.1.18",