@trustme24/flext 1.10.6 → 2.0.1

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.
Files changed (50) hide show
  1. package/README.md +17 -17
  2. package/bin/flext.mjs +24 -0
  3. package/dist/dialects/index.d.ts +2 -0
  4. package/dist/dialects/latest.d.ts +6 -0
  5. package/dist/dialects/legacy-1-0-beta4.d.ts +11 -0
  6. package/dist/index.cjs +259 -253
  7. package/dist/index.cjs.map +4 -4
  8. package/dist/index.d.ts +10 -7
  9. package/dist/index.js +29 -29
  10. package/dist/index.js.map +4 -4
  11. package/dist/types.d.ts +3 -74
  12. package/package.json +13 -11
  13. package/src/dialects/index.ts +2 -0
  14. package/src/dialects/latest.ts +8 -0
  15. package/src/dialects/legacy-1-0-beta4.ts +75 -0
  16. package/src/index.ts +82 -16
  17. package/src/tsconfig.json +3 -3
  18. package/src/types.ts +2 -102
  19. package/dist/engine.d.ts +0 -66
  20. package/dist/errors.d.ts +0 -25
  21. package/dist/index.css +0 -2
  22. package/dist/lib/index.d.ts +0 -70
  23. package/dist/modules/array/index.d.ts +0 -5
  24. package/dist/modules/cond/index.d.ts +0 -10
  25. package/dist/modules/date/index.d.ts +0 -16
  26. package/dist/modules/index.d.ts +0 -9
  27. package/dist/modules/match/index.d.ts +0 -5
  28. package/dist/modules/math/index.d.ts +0 -17
  29. package/dist/modules/media/index.d.ts +0 -3
  30. package/dist/modules/number/index.d.ts +0 -8
  31. package/dist/modules/put/index.d.ts +0 -7
  32. package/dist/modules/string/index.d.ts +0 -5
  33. package/src/engine.ts +0 -414
  34. package/src/env.d.ts +0 -4
  35. package/src/errors.ts +0 -51
  36. package/src/index.css +0 -1
  37. package/src/lib/index.ts +0 -931
  38. package/src/lib/unocssShadowDomHack.css +0 -133
  39. package/src/modules/array/index.ts +0 -68
  40. package/src/modules/cond/index.ts +0 -123
  41. package/src/modules/date/index.ts +0 -254
  42. package/src/modules/index.ts +0 -9
  43. package/src/modules/match/index.ts +0 -54
  44. package/src/modules/math/index.ts +0 -198
  45. package/src/modules/media/index.ts +0 -27
  46. package/src/modules/number/index.ts +0 -73
  47. package/src/modules/number/localeNames.json +0 -16
  48. package/src/modules/number/locales/kkKz.json +0 -98
  49. package/src/modules/put/index.ts +0 -61
  50. package/src/modules/string/index.ts +0 -45
package/dist/types.d.ts CHANGED
@@ -1,74 +1,3 @@
1
- import { AST } from '@handlebars/parser';
2
- export type Obj<T extends any = any> = Record<string, T>;
3
- export type Isset<T extends any> = T extends null | undefined ? false : true;
4
- export type IsNumber<T extends any> = T extends number ? true : false;
5
- export type IsObject<T extends any, O extends Obj = Obj> = T extends O ? true : false;
6
- export type Has<T extends Obj, K extends keyof T> = T[K];
7
- export type Inarr<T extends any, A extends any[]> = T extends A[any] ? true : false;
8
- export type FieldType = 'string' | 'number' | 'boolean' | 'object' | 'array' | 'date' | 'mixed';
9
- export type FieldValue = string | number | boolean | Obj | FieldValue[] | null;
10
- export type MacroParam = {
11
- name: string;
12
- value: string | null;
13
- };
14
- export type Macro = {
15
- name: string;
16
- params: MacroParam[];
17
- };
18
- export type FieldValueOption = {
19
- type: string;
20
- name: string;
21
- fieldName: string;
22
- label?: string | null;
23
- descr?: string | null;
24
- value?: FieldValue | null;
25
- isDisabled: boolean;
26
- };
27
- export type Field = {
28
- type: FieldType;
29
- name: string;
30
- label?: string | null;
31
- descr?: string | null;
32
- hint?: string | null;
33
- min?: Date | number | null;
34
- max?: Date | number | null;
35
- minLength?: number | null;
36
- maxLength?: number | null;
37
- order?: number | null;
38
- options?: FieldValueOption[] | null;
39
- value?: FieldValue;
40
- isRequired: boolean;
41
- extra?: {
42
- macroName?: string | null;
43
- absoluteOrder?: number | null;
44
- };
45
- };
46
- export type DataModelNode = {
47
- name: string;
48
- $?: DataModelNode[];
49
- };
50
- export type DataModel = DataModelNode & {
51
- addPath: (path: string, depth?: number) => void;
52
- };
53
- export type MetadataModelNode = DataModelNode & {
54
- type: FieldType;
55
- label?: string | null;
56
- descr?: string | null;
57
- hint?: string | null;
58
- min?: Date | number | null;
59
- max?: Date | number | null;
60
- minLength?: number | null;
61
- maxLength?: number | null;
62
- order?: number | null;
63
- options?: FieldValueOption[] | null;
64
- value?: string | null;
65
- isRequired: boolean;
66
- extra?: {
67
- fieldName?: string | null;
68
- };
69
- };
70
- export type CollectorFilterHandler<T = any> = (val?: T) => boolean;
71
- export type GetProcessedTemplateHandler = (val: string) => string;
72
- export type GetTemplateAstHandler = (val: string) => AST.Program;
73
- export type GetTemplateTitleHandler = (ast: AST.Program) => string[];
74
- export type GetTemplateMacroHandler = (ast: AST.Program) => Macro[];
1
+ import { types } from '@flext/core';
2
+ export interface FlextInterface extends types.ProcessorInterface {
3
+ }
package/package.json CHANGED
@@ -1,29 +1,32 @@
1
1
  {
2
2
  "name": "@trustme24/flext",
3
- "version": "1.10.6",
3
+ "version": "2.0.1",
4
4
  "description": "A technology for building reliable document templates",
5
5
  "keywords": ["templates", "templating engine", "documents", "document engine", "handlebars"],
6
6
  "repository": "https://github.com/TrustMe-kz/flext.git",
7
7
  "type": "module",
8
8
  "main": "dist/index.js",
9
9
  "types": "dist/index.d.ts",
10
+ "bin": {
11
+ "flext": "./bin/flext.mjs"
12
+ },
10
13
  "exports": {
11
14
  ".": {
12
15
  "types": "./dist/index.d.ts",
13
16
  "import": "./dist/index.js",
14
17
  "require": "./dist/index.cjs"
15
- },
16
- "./index.css": "./dist/index.css"
18
+ }
17
19
  },
18
20
  "scripts": {
21
+ "sync-dialects": "bin/sync-dialects.mjs",
19
22
  "start:test-app": "cd test/app && npm run test-app",
20
23
  "build:types": "tsc -p src/tsconfig.json && tsc-alias -p src/tsconfig.json",
21
- "build:css": "tailwindcss -i ./src/index.css -o ./dist/index.css --minify",
22
- "build-only": "bin/build.mjs && npm run build:types && npm run build:css",
24
+ "build-dialects": "bin/build-dialects.mjs",
25
+ "build-only": "bin/build.mjs && npm run build:types",
23
26
  "build": "npm run build-only && vitest run",
24
27
  "test:app": "npm run build && cd test/app && npm i && npm run test-app",
25
28
  "test-only": "vitest run",
26
- "test": "npm run npm run build-only && npm run test-only",
29
+ "test": "npm run build-only && npm run test-only",
27
30
  "prepublish": "npm run build"
28
31
  },
29
32
  "files": [
@@ -38,18 +41,17 @@
38
41
  "@babel/preset-env": "^7.29.2",
39
42
  "@babel/preset-typescript": "^7.28.5",
40
43
  "@handlebars/parser": "^2.2.2",
41
- "@tailwindcss/cli": "^4.2.2",
42
44
  "@types/node": "^25.5.0",
43
45
  "esbuild": "^0.27.4",
44
46
  "esbuild-plugin-import-glob": "^0.1.1",
45
- "tailwindcss": "^4.2.2",
46
47
  "tsc-alias": "^1.8.16",
47
- "typescript": "^5.9.3",
48
- "vitest": "^4.1.0"
48
+ "typescript": "^6.0.2",
49
+ "vitest": "^4.1.2"
49
50
  },
50
51
  "dependencies": {
52
+ "@flext/core": "^1.0.2",
51
53
  "@unocss/preset-wind4": "^66.6.7",
52
- "handlebars": "^4.7.8",
54
+ "handlebars": "^4.7.9",
53
55
  "luxon": "^3.7.2",
54
56
  "striptags": "^3.2.0",
55
57
  "unocss": "^66.6.7",
@@ -0,0 +1,2 @@
1
+ export { default as Latest } from './latest';
2
+ export { default as Legacy_1_0_beta4 } from './legacy-1-0-beta4';
@@ -0,0 +1,8 @@
1
+ import { Dialect } from '@flext/core';
2
+
3
+ export class LatestDialect extends Dialect {
4
+ public name = 'latest';
5
+ public aliases = [ '1.0' ];
6
+ }
7
+
8
+ export default LatestDialect;
@@ -0,0 +1,75 @@
1
+ import { AST } from '@handlebars/parser';
2
+ import { types, lib, Dialect, BaseError, BaseWarning } from '@flext/core';
3
+
4
+
5
+ // Constants
6
+
7
+ export const HANDLEBARS_COMMENT_BEGIN = '{{!--';
8
+
9
+ export const DIALECT_MACRO = 'syntax';
10
+
11
+ export const LEGACY_DIALECT_MACRO = 'v';
12
+
13
+
14
+ export class LegacyDialect extends Dialect {
15
+ public name = '1.0.beta4';
16
+
17
+ public testAst(val: AST.Program, doWarn?: boolean|null): boolean {
18
+
19
+ // Doing some checks
20
+
21
+ if (!this.name)
22
+ throw new BaseError(`Flext: Unable to test the template: 'name' param is not set in the dialect`);
23
+
24
+
25
+ // Doing some checks
26
+
27
+ const macros = lib.astToMacros(val);
28
+ const macro = macros?.find(m => m?.name === LEGACY_DIALECT_MACRO) ?? null;
29
+
30
+ if (!macro) {
31
+ if (doWarn)
32
+ throw new BaseWarning(`Flext: Unable to test the template: '@v' macro is not set`);
33
+ else
34
+ return false;
35
+ }
36
+
37
+
38
+ // Getting the dialect
39
+
40
+ const [ param ] = macro?.params ?? [];
41
+
42
+ if (!param) {
43
+ if (doWarn)
44
+ throw new BaseWarning(`Flext: Unable to test the template: Bad '@v' macro`);
45
+ else
46
+ return false;
47
+ }
48
+
49
+
50
+ if (this.aliases && this.aliases?.length)
51
+ return param?.value === this.name || lib.inarr(param?.value, ...this.aliases);
52
+ else
53
+ return param?.value === this.name;
54
+ }
55
+
56
+ public templateToStandard(template: types.Template): types.StandardTemplate {
57
+ let result = template;
58
+
59
+
60
+ // Defining the functions
61
+
62
+ const filter = (search: string, val: string): void => { result = result.replace(search, val); };
63
+
64
+
65
+ // Getting the template
66
+
67
+ filter(HANDLEBARS_COMMENT_BEGIN + ' @' + LEGACY_DIALECT_MACRO, HANDLEBARS_COMMENT_BEGIN + ' @' + DIALECT_MACRO); // '{{!-- @v' --> '{{!-- @syntax'
68
+ filter(HANDLEBARS_COMMENT_BEGIN + '@' + LEGACY_DIALECT_MACRO, HANDLEBARS_COMMENT_BEGIN + '@' + DIALECT_MACRO); // '{{!--@v' --> '{{!--@syntax'
69
+
70
+
71
+ return result;
72
+ }
73
+ }
74
+
75
+ export default LegacyDialect;
package/src/index.ts CHANGED
@@ -1,14 +1,82 @@
1
- import { Obj, Macro, Field, FieldType, FieldValue, FieldValueOption, DataModel, DataModelNode, MetadataModelNode, CollectorFilterHandler, GetTemplateAstHandler, GetTemplateTitleHandler, GetTemplateMacroHandler } from '@/types';
2
- import { BaseThrowable, BaseWarning, BaseError, PotentialLoopError, TemplateError, TemplateSyntaxError, TemplateDataValidationError } from '@/errors';
3
- import { Flext, SimpleFlext } from './engine';
1
+ import { types as coreTypes, lib, errors, Obj, Macro, Field, FieldType, FieldValue, FieldValueOption, DataModel, DataModelNode, MetadataModelNode, CollectorFilterHandler, ParseTemplateHandler, GetTemplateTitleHandler, GetTemplateMacroHandler, BaseThrowable, BaseWarning, BaseError, PotentialLoopError, TemplateError, TemplateSyntaxError, TemplateDataValidationError, Processor, SimpleProcessor, Dialect } from '@flext/core';
4
2
  import * as types from '@/types';
5
- import * as lib from '@/lib';
6
- import * as errors from '@/errors';
7
- import * as modules from './modules';
3
+ import * as core from '@flext/core';
4
+ import * as dialects from '@/dialects';
8
5
 
9
- export default Flext;
6
+
7
+ // Constants
8
+
9
+ export const DIALECT_MACRO = 'syntax';
10
+
11
+ export const LEGACY_DIALECT_MACRO = 'v';
12
+
13
+
14
+ // Variables
15
+
16
+ export const latestDialect = new dialects.Latest();
17
+
18
+
19
+ export class Flext extends Processor implements types.FlextInterface {
20
+ setTemplate(val: coreTypes.Template): this {
21
+ const ast = lib.hbsToAst(val);
22
+ const macros = lib.astToMacros(ast);
23
+
24
+
25
+ // Getting the macro
26
+
27
+ const macro = macros?.find(m => lib.inarr(m?.name, DIALECT_MACRO, LEGACY_DIALECT_MACRO)) ?? null;
28
+
29
+ if (!macro) {
30
+ this.setDialect(latestDialect);
31
+ return super.setTemplate(val);
32
+ }
33
+
34
+
35
+ // Getting the macro param
36
+
37
+ const [ param ] = macro?.params ?? [];
38
+
39
+ if (!param)
40
+ throw new errors.BaseError(`Flext: Unable to set the template: Bad '@syntax' macro: ` + lib.audit(macro));
41
+
42
+
43
+ // Getting the dialect
44
+
45
+ const dialectName = param?.value ?? null;
46
+
47
+ if (!dialectName)
48
+ throw new errors.BaseError(`Flext: Unable to set the template: Bad '@syntax' macro: ` + lib.audit(macro));
49
+
50
+
51
+ // Setting the dialect
52
+
53
+ for (const key in dialects) {
54
+ if (!lib.has(dialects, key as any)) continue;
55
+
56
+
57
+ // Getting the bundled dialect
58
+
59
+ const Dialect = dialects[key];
60
+ const dialect = new Dialect();
61
+
62
+ if (dialectName !== dialect?.name) continue;
63
+
64
+
65
+ // Setting the bundled dialect
66
+
67
+ this.setDialect(dialect);
68
+
69
+
70
+ break;
71
+ }
72
+
73
+
74
+ return super.setTemplate(val);
75
+ }
76
+ }
10
77
 
11
78
  export {
79
+ core,
12
80
  Obj,
13
81
  Macro,
14
82
  Field,
@@ -19,10 +87,9 @@ export {
19
87
  DataModelNode,
20
88
  MetadataModelNode,
21
89
  CollectorFilterHandler,
22
- GetTemplateAstHandler,
90
+ ParseTemplateHandler,
23
91
  GetTemplateTitleHandler,
24
92
  GetTemplateMacroHandler,
25
-
26
93
  BaseThrowable,
27
94
  BaseWarning,
28
95
  BaseError,
@@ -30,12 +97,11 @@ export {
30
97
  TemplateError,
31
98
  TemplateSyntaxError,
32
99
  TemplateDataValidationError,
100
+ Processor,
101
+ SimpleProcessor,
102
+ Dialect,
33
103
 
34
- Flext,
35
- SimpleFlext,
36
-
37
- types,
38
- lib,
39
- errors,
40
- modules,
104
+ dialects,
41
105
  };
106
+
107
+ export default Flext;
package/src/tsconfig.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "baseUrl": "..",
4
3
  "paths": {
5
- "@/*": [ "src/*" ]
4
+ "@/*": [ "./*" ]
6
5
  },
7
6
  "target": "ES2020",
8
7
  "useDefineForClassFields": true,
@@ -29,7 +28,8 @@
29
28
  "strictNullChecks": false,
30
29
  "noUnusedLocals": true,
31
30
  "noUnusedParameters": true,
32
- "noFallthroughCasesInSwitch": true
31
+ "noFallthroughCasesInSwitch": true,
32
+ "ignoreDeprecations": "6.0"
33
33
  },
34
34
  "include": [ "**/*.ts", "**/*.d.ts" ]
35
35
  }
package/src/types.ts CHANGED
@@ -1,103 +1,3 @@
1
- import { AST } from '@handlebars/parser';
1
+ import { types } from '@flext/core';
2
2
 
3
-
4
- // Base Data Types
5
-
6
- export type Obj<T extends any = any> = Record<string, T>;
7
-
8
- export type Isset<T extends any> = T extends null|undefined ? false : true;
9
-
10
- export type IsNumber<T extends any> = T extends number ? true : false;
11
-
12
- export type IsObject<T extends any, O extends Obj = Obj> = T extends O ? true : false;
13
-
14
- export type Has<T extends Obj, K extends keyof T> = T[K];
15
-
16
- export type Inarr<T extends any, A extends any[]> = T extends A[any] ? true : false;
17
-
18
- export type FieldType = 'string' | 'number' | 'boolean' | 'object' | 'array' | 'date' | 'mixed';
19
-
20
- export type FieldValue = string | number | boolean | Obj | FieldValue[] | null;
21
-
22
-
23
- // Base Struct Types
24
-
25
- export type MacroParam = {
26
- name: string,
27
- value: string|null,
28
- };
29
-
30
- export type Macro = {
31
- name: string,
32
- params: MacroParam[],
33
- };
34
-
35
- export type FieldValueOption = {
36
- type: string,
37
- name: string,
38
- fieldName: string,
39
- label?: string|null,
40
- descr?: string|null,
41
- value?: FieldValue | null,
42
- isDisabled: boolean,
43
- };
44
-
45
- export type Field = {
46
- type: FieldType,
47
- name: string,
48
- label?: string|null,
49
- descr?: string|null,
50
- hint?: string|null,
51
- min?: Date | number | null,
52
- max?: Date | number | null,
53
- minLength?: number|null,
54
- maxLength?: number|null,
55
- order?: number|null,
56
- options?: FieldValueOption[] | null,
57
- value?: FieldValue,
58
- isRequired: boolean,
59
- extra?: {
60
- macroName?: string|null,
61
- absoluteOrder?: number|null,
62
- }
63
- };
64
-
65
- export type DataModelNode = {
66
- name: string,
67
- $?: DataModelNode[],
68
- };
69
-
70
- export type DataModel = DataModelNode & {
71
- addPath: (path: string, depth?: number) => void,
72
- };
73
-
74
- export type MetadataModelNode = DataModelNode & {
75
- type: FieldType,
76
- label?: string|null,
77
- descr?: string|null,
78
- hint?: string|null,
79
- min?: Date | number | null,
80
- max?: Date | number | null,
81
- minLength?: number|null,
82
- maxLength?: number|null,
83
- order?: number|null,
84
- options?: FieldValueOption[] | null,
85
- value?: string|null,
86
- isRequired: boolean,
87
- extra?: {
88
- fieldName?: string|null,
89
- },
90
- };
91
-
92
-
93
- // Base Callable Types
94
-
95
- export type CollectorFilterHandler<T = any> = (val?: T) => boolean;
96
-
97
- export type GetProcessedTemplateHandler = (val: string) => string;
98
-
99
- export type GetTemplateAstHandler = (val: string) => AST.Program;
100
-
101
- export type GetTemplateTitleHandler = (ast: AST.Program) => string[];
102
-
103
- export type GetTemplateMacroHandler = (ast: AST.Program) => Macro[];
3
+ export interface FlextInterface extends types.ProcessorInterface {}
package/dist/engine.d.ts DELETED
@@ -1,66 +0,0 @@
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;
package/dist/errors.d.ts DELETED
@@ -1,25 +0,0 @@
1
- export declare class BaseThrowable extends Error {
2
- name: string;
3
- constructor(message: string, stack?: string | null);
4
- }
5
- export declare class BaseWarning extends BaseThrowable {
6
- name: string;
7
- }
8
- export declare class BaseError extends BaseThrowable {
9
- name: string;
10
- }
11
- export declare class PotentialLoopError extends BaseError {
12
- name: string;
13
- constructor(message?: string, stack?: string | null);
14
- }
15
- export declare class TemplateError extends BaseError {
16
- name: string;
17
- }
18
- export declare class TemplateSyntaxError extends TemplateError {
19
- name: string;
20
- }
21
- export declare class TemplateDataValidationError extends TemplateError {
22
- name: string;
23
- fieldName: string;
24
- constructor(message?: string, fieldName?: string | null);
25
- }
package/dist/index.css DELETED
@@ -1,2 +0,0 @@
1
- /*! tailwindcss v4.2.1 | MIT License | https://tailwindcss.com */
2
- @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-blue-500:oklch(62.3% .214 259.815);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.static{position:static}.text-blue-500{color:var(--color-blue-500)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}
@@ -1,70 +0,0 @@
1
- import { AST } from '@handlebars/parser';
2
- import { TemplateDataValidationError } from '../errors';
3
- import striptags from 'striptags';
4
- import Handlebars, { TemplateDelegate } from 'handlebars';
5
- import * as types from '../types';
6
- export declare const uno: Promise<import("unocss").UnoGenerator<import("@unocss/preset-typography").TypographyTheme>>;
7
- export declare const DEFAULT_MODEL_DEPTH = 10;
8
- export declare const DEFAULT_FIELD_TYPE: types.FieldType;
9
- export declare const stripHtml: typeof striptags;
10
- export declare class HandlebarsCollector<T = any> extends Handlebars.Visitor {
11
- data: T[];
12
- match: types.CollectorFilterHandler<T>;
13
- constructor(filter?: types.CollectorFilterHandler<T>);
14
- onCollect(val: T): void;
15
- setMatchHandler(val: types.CollectorFilterHandler<T>): this;
16
- setAst(ast: AST.Program): this;
17
- collect(ast: AST.Program): T[];
18
- }
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
- export declare function audit(val: any): string;
25
- export declare function getAst(val: string): AST.Program;
26
- export declare function getTemplate(val: string | AST.Program): TemplateDelegate;
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
- export declare function unique<T = any>(arr: T[]): T[];
30
- export declare function getPaths(ast: AST.Program): string[];
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
- export declare function dataModelNodeToMetadata(node: types.DataModelNode, fields: types.Field[], _options?: types.Obj, depth?: number): types.MetadataModelNode;
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
- export declare function getHtmlH1(ast: AST.Program, doWarn?: boolean): string[];
39
- export declare function getTemplateValidationErrorsByMetadata(data: types.Obj, model: types.MetadataModelNode[], depth?: number): TemplateDataValidationError[];
40
- export declare function ensureString(val: any): string;
41
- export declare function ensureNullableString(val: any): string | null;
42
- export declare function ensureDate<T extends boolean = true>(val: Date | string | number, doWarn?: T): T extends true ? Date : Date | null;
43
- export declare function ensureTitle(val: string | number): string;
44
- export declare function ensureFieldName(val: string): string;
45
- export declare function ensureNullableFieldMinMax(val: any): Date | number | null;
46
- export declare function ensureNullableFieldMinMaxLength(val: any): number | null;
47
- export declare function ensureNullableFieldOrder(val: any): number | null;
48
- export declare function ensureFieldValue(val: any): types.FieldValue;
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;
52
- export declare function macroToModuleNames(val: types.Macro): string[];
53
- export declare function macroToField(val: types.Macro): types.Field;
54
- export declare function macroToFieldValueOption(val: types.Macro): types.FieldValueOption;
55
- export declare function applyValueOptionsToFields(options: types.FieldValueOption[], fields: types.Field[]): void;
56
- export declare function applyAbsoluteOrderToFields(fields: types.Field[]): void;
57
- export declare function defineModule(options?: any): any;
58
- export declare class RegexHelper {
59
- static dbDateStr: RegExp;
60
- static macro: RegExp;
61
- static macroParams: RegExp;
62
- static macroParam: RegExp;
63
- static macroNamedParam: RegExp;
64
- static macroSimpleParam: RegExp;
65
- static htmlH1Somewhere: RegExp;
66
- }
67
- export declare class FilterHelper {
68
- static macro(val: string): boolean;
69
- static htmlH1Somewhere(val: string): boolean;
70
- }
@@ -1,5 +0,0 @@
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,10 +0,0 @@
1
- export declare function op(state: any): boolean;
2
- export declare function not(state: any): boolean;
3
- export declare function equal(state: any): boolean;
4
- export declare function notEqual(state: any): boolean;
5
- export declare function and(state: any): boolean;
6
- export declare function or(state: any): boolean;
7
- export declare function greater(state: any): boolean;
8
- export declare function less(state: any): boolean;
9
- declare const _default: any;
10
- export default _default;