generaltranslation 7.1.0 → 7.1.1-alpha.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.
- package/dist/backwards-compatability/dataConversion.d.ts +23 -0
- package/dist/backwards-compatability/oldHashJsxChildren.d.ts +23 -0
- package/dist/backwards-compatability/oldTypes.d.ts +21 -0
- package/dist/backwards-compatability/typeChecking.d.ts +21 -0
- package/dist/index.cjs.min.cjs +18 -1
- package/dist/index.cjs.min.cjs.map +1 -1
- package/dist/index.esm.min.mjs +18 -1
- package/dist/index.esm.min.mjs.map +1 -1
- package/dist/internal.cjs.min.cjs +1 -1
- package/dist/internal.cjs.min.cjs.map +1 -1
- package/dist/internal.d.ts +4 -0
- package/dist/internal.esm.min.mjs +1 -1
- package/dist/internal.esm.min.mjs.map +1 -1
- package/dist/types-dir/entry.d.ts +2 -2
- package/dist/types.d.ts +2 -2
- package/package.json +1 -1
@@ -0,0 +1,23 @@
|
|
1
|
+
import { Variable as VariableObject, VariableType } from '../types';
|
2
|
+
import { OldBranchType, OldGTProp, OldJsxChild, OldJsxChildren, OldJsxElement, OldVariableObject, OldVariableType } from './oldTypes.js';
|
3
|
+
import { GTProp, JsxChild, JsxChildren, JsxElement } from '../types';
|
4
|
+
/**
|
5
|
+
* Convert request data from old format to new format
|
6
|
+
*/
|
7
|
+
export declare function getNewJsxChild(child: OldJsxChild): JsxChild;
|
8
|
+
export declare function getNewJsxChildren(children: OldJsxChildren): JsxChildren;
|
9
|
+
export declare function getNewJsxElement(element: OldJsxElement): JsxElement;
|
10
|
+
export declare function getNewBranchType(branch: OldBranchType): 'b' | 'p';
|
11
|
+
export declare function getNewVariableType(variable: OldVariableType): VariableType;
|
12
|
+
export declare function getNewVariableObject(variable: OldVariableObject): VariableObject;
|
13
|
+
export declare function getNewGTProp(dataGT: OldGTProp): GTProp;
|
14
|
+
/**
|
15
|
+
* Convert response data from old format to new format
|
16
|
+
*/
|
17
|
+
export declare function getOldJsxChild(child: JsxChild): OldJsxChild;
|
18
|
+
export declare function getOldJsxChildren(children: JsxChildren | OldJsxChildren): OldJsxChildren;
|
19
|
+
export declare function getOldJsxElement(element: JsxElement): OldJsxElement;
|
20
|
+
export declare function getOldBranchType(branch: 'b' | 'p'): OldBranchType;
|
21
|
+
export declare function getOldVariableType(variable: VariableType): OldVariableType;
|
22
|
+
export declare function getOldVariableObject(variable: VariableObject): OldVariableObject;
|
23
|
+
export declare function getOldGTProp(dataGT: GTProp, i: number): OldGTProp;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { OldJsxChildren } from './oldTypes';
|
2
|
+
/**
|
3
|
+
* Calculates a unique hash for a given string using sha256.
|
4
|
+
*
|
5
|
+
* @param {string} string - The string to be hashed.
|
6
|
+
* @returns {string} - The resulting hash as a hexadecimal string.
|
7
|
+
*/
|
8
|
+
export declare function oldHashString(string: string): string;
|
9
|
+
/**
|
10
|
+
* Calculates a unique ID for the given children objects by hashing their sanitized JSON string representation.
|
11
|
+
*
|
12
|
+
* @param {any} childrenAsObjects - The children objects to be hashed.
|
13
|
+
* @param {string} context - The context for the children
|
14
|
+
* @param {string} id - The id for the JSX Children object
|
15
|
+
* @param {function} hashFunction custom hash function
|
16
|
+
* @returns {string} - The unique has of the children.
|
17
|
+
*/
|
18
|
+
export declare function oldHashJsxChildren({ source, context, id, dataFormat, }: {
|
19
|
+
source: OldJsxChildren;
|
20
|
+
context?: string;
|
21
|
+
id?: string;
|
22
|
+
dataFormat: string;
|
23
|
+
}, hashFunction?: (string: string) => string): string;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
export type OldBranchType = 'branch' | 'plural';
|
2
|
+
export type OldGTProp = {
|
3
|
+
id: number;
|
4
|
+
transformation?: OldBranchType;
|
5
|
+
branches?: Record<string, OldJsxChildren>;
|
6
|
+
};
|
7
|
+
export type OldJsxElement = {
|
8
|
+
type: string;
|
9
|
+
props: {
|
10
|
+
children?: OldJsxChildren;
|
11
|
+
'data-_gt': OldGTProp;
|
12
|
+
};
|
13
|
+
};
|
14
|
+
export type OldVariableType = 'number' | 'variable' | 'datetime' | 'currency';
|
15
|
+
export type OldVariableObject = {
|
16
|
+
variable?: OldVariableType;
|
17
|
+
key: string;
|
18
|
+
id?: number;
|
19
|
+
};
|
20
|
+
export type OldJsxChild = OldJsxElement | OldVariableObject | string;
|
21
|
+
export type OldJsxChildren = OldJsxChild | OldJsxChild[];
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { JsxChild, JsxChildren } from '../types';
|
2
|
+
import { OldJsxChild, OldJsxChildren, OldVariableObject } from './oldTypes.js';
|
3
|
+
import { Variable as VariableObject } from '../types';
|
4
|
+
/**
|
5
|
+
* Checks if a JSX child is an old variable object format
|
6
|
+
* @param child - The JSX child to check
|
7
|
+
* @returns True if the child is an old variable object (has 'key' property)
|
8
|
+
*/
|
9
|
+
export declare function isOldVariableObject(child: OldJsxChild | JsxChild): child is OldVariableObject;
|
10
|
+
/**
|
11
|
+
* Checks if a JSX child is a new variable object format
|
12
|
+
* @param child - The JSX child to check
|
13
|
+
* @returns True if the child is a new variable object (has 'k' property)
|
14
|
+
*/
|
15
|
+
export declare function isNewVariableObject(child: OldJsxChild | JsxChild): child is VariableObject;
|
16
|
+
/**
|
17
|
+
* Checks if JSX children follow the old format
|
18
|
+
* @param children - The JSX children to check (can be string, array, or single child)
|
19
|
+
* @returns True if all children are in the old format
|
20
|
+
*/
|
21
|
+
export declare function isOldJsxChildren(children: OldJsxChildren | JsxChildren): children is OldJsxChildren;
|