generaltranslation 7.0.0-alpha.18 → 7.0.0-alpha.19
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 +1 @@
|
|
1
|
-
{"version":3,"file":"types.cjs.min.cjs","sources":["../src/types.ts"],"sourcesContent":["import { LocaleProperties } from './locales/getLocaleProperties';\n\nexport { LocaleProperties };\n\nexport type Content = string | Array<string | Variable>;\n\n/**\n * Map of data-_gt properties to their corresponding React props\n */\nexport const HTML_CONTENT_PROPS = {\n pl: 'placeholder',\n ti: 'title',\n alt: 'alt',\n arl: 'aria-label',\n arb: 'aria-labelledby',\n ard: 'aria-describedby',\n} as const;\n\nexport type HtmlContentPropKeysRecord = Partial<\n Record<keyof typeof HTML_CONTENT_PROPS, string>\n>;\nexport type HtmlContentPropValuesRecord = Partial<\n Record<(typeof HTML_CONTENT_PROPS)[keyof typeof HTML_CONTENT_PROPS], string>\n>;\n\n/**\n * Transformations are made from a prefix and a suffix.\n */\nexport type Transformation =\n | 'translate-client'\n | 'translate-server'\n | 'variable-variable'\n | 'variable-currency'\n | 'variable-datetime'\n | 'variable-number'\n | 'plural'\n | 'branch';\nexport type TransformationPrefix =\n | 'translate'\n | 'variable'\n | 'plural'\n | 'branch'\n | 'fragment';\nexport type VariableTransformationSuffix =\n | 'variable'\n | 'number'\n | 'datetime'\n | 'currency';\n\n/**\n * GTProp is an internal property used to contain data for translating and rendering elements.\n * note, transformations are only read on the server side if they are 'plural' or 'branch'\n */\nexport type GTProp = {\n
|
1
|
+
{"version":3,"file":"types.cjs.min.cjs","sources":["../src/types.ts"],"sourcesContent":["import { LocaleProperties } from './locales/getLocaleProperties';\n\nexport { LocaleProperties };\n\nexport type Content = string | Array<string | Variable>;\n\n/**\n * Map of data-_gt properties to their corresponding React props\n */\nexport const HTML_CONTENT_PROPS = {\n pl: 'placeholder',\n ti: 'title',\n alt: 'alt',\n arl: 'aria-label',\n arb: 'aria-labelledby',\n ard: 'aria-describedby',\n} as const;\n\nexport type HtmlContentPropKeysRecord = Partial<\n Record<keyof typeof HTML_CONTENT_PROPS, string>\n>;\nexport type HtmlContentPropValuesRecord = Partial<\n Record<(typeof HTML_CONTENT_PROPS)[keyof typeof HTML_CONTENT_PROPS], string>\n>;\n\n/**\n * Transformations are made from a prefix and a suffix.\n */\nexport type Transformation =\n | 'translate-client'\n | 'translate-server'\n | 'variable-variable'\n | 'variable-currency'\n | 'variable-datetime'\n | 'variable-number'\n | 'plural'\n | 'branch';\nexport type TransformationPrefix =\n | 'translate'\n | 'variable'\n | 'plural'\n | 'branch'\n | 'fragment';\nexport type VariableTransformationSuffix =\n | 'variable'\n | 'number'\n | 'datetime'\n | 'currency';\n\n/**\n * GTProp is an internal property used to contain data for translating and rendering elements.\n * note, transformations are only read on the server side if they are 'plural' or 'branch'\n */\nexport type GTProp = {\n b?: Record<string, JsxChildren>; // Branches\n t?: 'p' | 'b'; // Branch Transformation\n} & HtmlContentPropKeysRecord;\n\nexport type JsxElement = {\n type: string;\n i?: number; // id\n props: {\n d?: GTProp;\n children?: JsxChildren;\n };\n};\n\nexport type JsxChild = string | JsxElement | Variable;\nexport type JsxChildren = JsxChild | JsxChild[];\n\nexport type Metadata = {\n context?: string;\n id?: string;\n sourceLocale?: string;\n actionType?: 'standard' | 'fast' | string;\n [key: string]: any;\n};\n\nexport type DataFormat = 'JSX' | 'ICU' | 'I18NEXT';\n\nexport type FormatVariables = Record<\n string,\n string | number | boolean | null | undefined | Date\n>;\n\nexport type Update =\n | {\n type: 'content';\n data: {\n source: Content;\n metadata: Metadata;\n };\n }\n | {\n type: 'jsx';\n data: {\n source: JsxChildren;\n metadata: Metadata;\n };\n };\n\nexport type Request =\n | {\n type: 'content';\n data: {\n source: Content;\n targetLocale: string;\n metadata: Metadata;\n };\n }\n | {\n type: 'jsx';\n data: {\n source: JsxChildren;\n targetLocale: string;\n metadata: Metadata;\n };\n };\n\nexport type ContentTranslationResult = {\n translation: Content;\n locale: string;\n reference?: {\n id: string;\n key: string;\n };\n};\n\nexport type IcuTranslationResult = {\n translation: string;\n locale: string;\n reference?: {\n id: string;\n key: string;\n };\n};\n\nexport type JsxTranslationResult = {\n translation: JsxChildren;\n locale: string;\n reference?: {\n id: string;\n key: string;\n };\n};\n\nexport type TranslationError = {\n error: string;\n code: number;\n reference?: {\n id: string;\n key: string;\n };\n};\n\nexport type { CustomMapping } from './locales/customLocaleMapping';\n\n// ----- VARIABLES ----- //\n\nexport type VariableType =\n | 'v' // Variable\n | 'n' // Number\n | 'd' // Date\n | 'c'; // Currency\n\n/**\n * Variables are used to store the variable name and type.\n */\nexport type Variable = {\n k: string;\n i?: number;\n v?: VariableType;\n};\n"],"names":["pl","ti","alt","arl","arb","ard"],"mappings":"wCASkC,CAChCA,GAAI,cACJC,GAAI,QACJC,IAAK,MACLC,IAAK,aACLC,IAAK,kBACLC,IAAK"}
|
package/dist/types.d.ts
CHANGED
@@ -49,12 +49,12 @@ type VariableTransformationSuffix = 'variable' | 'number' | 'datetime' | 'curren
|
|
49
49
|
* note, transformations are only read on the server side if they are 'plural' or 'branch'
|
50
50
|
*/
|
51
51
|
type GTProp = {
|
52
|
-
id: number;
|
53
52
|
b?: Record<string, JsxChildren>;
|
54
53
|
t?: 'p' | 'b';
|
55
54
|
} & HtmlContentPropKeysRecord;
|
56
55
|
type JsxElement = {
|
57
56
|
type: string;
|
57
|
+
i?: number;
|
58
58
|
props: {
|
59
59
|
d?: GTProp;
|
60
60
|
children?: JsxChildren;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.esm.min.mjs","sources":["../src/types.ts"],"sourcesContent":["import { LocaleProperties } from './locales/getLocaleProperties';\n\nexport { LocaleProperties };\n\nexport type Content = string | Array<string | Variable>;\n\n/**\n * Map of data-_gt properties to their corresponding React props\n */\nexport const HTML_CONTENT_PROPS = {\n pl: 'placeholder',\n ti: 'title',\n alt: 'alt',\n arl: 'aria-label',\n arb: 'aria-labelledby',\n ard: 'aria-describedby',\n} as const;\n\nexport type HtmlContentPropKeysRecord = Partial<\n Record<keyof typeof HTML_CONTENT_PROPS, string>\n>;\nexport type HtmlContentPropValuesRecord = Partial<\n Record<(typeof HTML_CONTENT_PROPS)[keyof typeof HTML_CONTENT_PROPS], string>\n>;\n\n/**\n * Transformations are made from a prefix and a suffix.\n */\nexport type Transformation =\n | 'translate-client'\n | 'translate-server'\n | 'variable-variable'\n | 'variable-currency'\n | 'variable-datetime'\n | 'variable-number'\n | 'plural'\n | 'branch';\nexport type TransformationPrefix =\n | 'translate'\n | 'variable'\n | 'plural'\n | 'branch'\n | 'fragment';\nexport type VariableTransformationSuffix =\n | 'variable'\n | 'number'\n | 'datetime'\n | 'currency';\n\n/**\n * GTProp is an internal property used to contain data for translating and rendering elements.\n * note, transformations are only read on the server side if they are 'plural' or 'branch'\n */\nexport type GTProp = {\n
|
1
|
+
{"version":3,"file":"types.esm.min.mjs","sources":["../src/types.ts"],"sourcesContent":["import { LocaleProperties } from './locales/getLocaleProperties';\n\nexport { LocaleProperties };\n\nexport type Content = string | Array<string | Variable>;\n\n/**\n * Map of data-_gt properties to their corresponding React props\n */\nexport const HTML_CONTENT_PROPS = {\n pl: 'placeholder',\n ti: 'title',\n alt: 'alt',\n arl: 'aria-label',\n arb: 'aria-labelledby',\n ard: 'aria-describedby',\n} as const;\n\nexport type HtmlContentPropKeysRecord = Partial<\n Record<keyof typeof HTML_CONTENT_PROPS, string>\n>;\nexport type HtmlContentPropValuesRecord = Partial<\n Record<(typeof HTML_CONTENT_PROPS)[keyof typeof HTML_CONTENT_PROPS], string>\n>;\n\n/**\n * Transformations are made from a prefix and a suffix.\n */\nexport type Transformation =\n | 'translate-client'\n | 'translate-server'\n | 'variable-variable'\n | 'variable-currency'\n | 'variable-datetime'\n | 'variable-number'\n | 'plural'\n | 'branch';\nexport type TransformationPrefix =\n | 'translate'\n | 'variable'\n | 'plural'\n | 'branch'\n | 'fragment';\nexport type VariableTransformationSuffix =\n | 'variable'\n | 'number'\n | 'datetime'\n | 'currency';\n\n/**\n * GTProp is an internal property used to contain data for translating and rendering elements.\n * note, transformations are only read on the server side if they are 'plural' or 'branch'\n */\nexport type GTProp = {\n b?: Record<string, JsxChildren>; // Branches\n t?: 'p' | 'b'; // Branch Transformation\n} & HtmlContentPropKeysRecord;\n\nexport type JsxElement = {\n type: string;\n i?: number; // id\n props: {\n d?: GTProp;\n children?: JsxChildren;\n };\n};\n\nexport type JsxChild = string | JsxElement | Variable;\nexport type JsxChildren = JsxChild | JsxChild[];\n\nexport type Metadata = {\n context?: string;\n id?: string;\n sourceLocale?: string;\n actionType?: 'standard' | 'fast' | string;\n [key: string]: any;\n};\n\nexport type DataFormat = 'JSX' | 'ICU' | 'I18NEXT';\n\nexport type FormatVariables = Record<\n string,\n string | number | boolean | null | undefined | Date\n>;\n\nexport type Update =\n | {\n type: 'content';\n data: {\n source: Content;\n metadata: Metadata;\n };\n }\n | {\n type: 'jsx';\n data: {\n source: JsxChildren;\n metadata: Metadata;\n };\n };\n\nexport type Request =\n | {\n type: 'content';\n data: {\n source: Content;\n targetLocale: string;\n metadata: Metadata;\n };\n }\n | {\n type: 'jsx';\n data: {\n source: JsxChildren;\n targetLocale: string;\n metadata: Metadata;\n };\n };\n\nexport type ContentTranslationResult = {\n translation: Content;\n locale: string;\n reference?: {\n id: string;\n key: string;\n };\n};\n\nexport type IcuTranslationResult = {\n translation: string;\n locale: string;\n reference?: {\n id: string;\n key: string;\n };\n};\n\nexport type JsxTranslationResult = {\n translation: JsxChildren;\n locale: string;\n reference?: {\n id: string;\n key: string;\n };\n};\n\nexport type TranslationError = {\n error: string;\n code: number;\n reference?: {\n id: string;\n key: string;\n };\n};\n\nexport type { CustomMapping } from './locales/customLocaleMapping';\n\n// ----- VARIABLES ----- //\n\nexport type VariableType =\n | 'v' // Variable\n | 'n' // Number\n | 'd' // Date\n | 'c'; // Currency\n\n/**\n * Variables are used to store the variable name and type.\n */\nexport type Variable = {\n k: string;\n i?: number;\n v?: VariableType;\n};\n"],"names":["HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard"],"mappings":"AASa,IAAAA,EAAqB,CAChCC,GAAI,cACJC,GAAI,QACJC,IAAK,MACLC,IAAK,aACLC,IAAK,kBACLC,IAAK"}
|