generaltranslation 8.2.5 → 8.2.7
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/CHANGELOG.md +14 -0
- package/dist/ApiError-4zIP-twr.cjs +24 -0
- package/dist/ApiError-4zIP-twr.cjs.map +1 -0
- package/dist/ApiError-Bv7vlzyQ.mjs +19 -0
- package/dist/ApiError-Bv7vlzyQ.mjs.map +1 -0
- package/dist/errors.cjs +3 -0
- package/dist/errors.d.cts +11 -0
- package/dist/errors.d.mts +11 -0
- package/dist/errors.mjs +2 -0
- package/dist/id-CPbVYREY.mjs +74 -0
- package/dist/id-CPbVYREY.mjs.map +1 -0
- package/dist/id-VXBgyXu2.cjs +89 -0
- package/dist/id-VXBgyXu2.cjs.map +1 -0
- package/dist/id.cjs +5 -0
- package/dist/{id/hashSource.d.ts → id.d.cts} +20 -5
- package/dist/id.d.mts +40 -0
- package/dist/id.mjs +2 -0
- package/dist/index.cjs +3354 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1157 -0
- package/dist/index.d.mts +1157 -0
- package/dist/index.mjs +3305 -0
- package/dist/index.mjs.map +1 -0
- package/dist/internal-CTeI8uLd.mjs +774 -0
- package/dist/internal-CTeI8uLd.mjs.map +1 -0
- package/dist/internal-PCKq4YMW.cjs +1012 -0
- package/dist/internal-PCKq4YMW.cjs.map +1 -0
- package/dist/internal.cjs +43 -0
- package/dist/{internal.d.ts → internal.d.cts} +62 -114
- package/dist/internal.d.mts +242 -0
- package/dist/internal.mjs +3 -0
- package/dist/sha2-DKowBr6H.cjs +747 -0
- package/dist/sha2-DKowBr6H.cjs.map +1 -0
- package/dist/stableStringify-DgDlE_pD.mjs +53 -0
- package/dist/stableStringify-DgDlE_pD.mjs.map +1 -0
- package/dist/types-D2fTTTvZ.d.cts +737 -0
- package/dist/types-fUW4_Ole.d.mts +737 -0
- package/dist/types.cjs +17 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +2 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.mjs +16 -0
- package/dist/types.mjs.map +1 -0
- package/package.json +53 -35
- package/dist/backwards-compatability/dataConversion.d.ts +0 -23
- package/dist/backwards-compatability/oldHashJsxChildren.d.ts +0 -23
- package/dist/backwards-compatability/oldTypes.d.ts +0 -21
- package/dist/backwards-compatability/typeChecking.d.ts +0 -21
- package/dist/cache/IntlCache.d.ts +0 -26
- package/dist/cache/types.d.ts +0 -32
- package/dist/derive/condenseVars.d.ts +0 -7
- package/dist/derive/declareVar.d.ts +0 -26
- package/dist/derive/decodeVars.d.ts +0 -9
- package/dist/derive/derive.d.ts +0 -38
- package/dist/derive/extractVars.d.ts +0 -9
- package/dist/derive/index.d.ts +0 -7
- package/dist/derive/indexVars.d.ts +0 -6
- package/dist/derive/utils/constants.d.ts +0 -2
- package/dist/derive/utils/regex.d.ts +0 -2
- package/dist/derive/utils/sanitizeVar.d.ts +0 -12
- package/dist/derive/utils/traverseHelpers.d.ts +0 -4
- package/dist/derive/utils/traverseIcu.d.ts +0 -20
- package/dist/derive/utils/types.d.ts +0 -23
- package/dist/errors/ApiError.d.ts +0 -7
- package/dist/errors/formattingErrors.d.ts +0 -1
- package/dist/errors.cjs.min.cjs +0 -2
- package/dist/errors.cjs.min.cjs.map +0 -1
- package/dist/errors.d.ts +0 -9
- package/dist/errors.esm.min.mjs +0 -2
- package/dist/errors.esm.min.mjs.map +0 -1
- package/dist/formatting/custom-formats/CutoffFormat/CutoffFormat.d.ts +0 -59
- package/dist/formatting/custom-formats/CutoffFormat/constants.d.ts +0 -4
- package/dist/formatting/custom-formats/CutoffFormat/types.d.ts +0 -48
- package/dist/formatting/format.d.ts +0 -1
- package/dist/id/hashTemplate.d.ts +0 -4
- package/dist/id/types.d.ts +0 -7
- package/dist/id.cjs.min.cjs +0 -19
- package/dist/id.cjs.min.cjs.map +0 -1
- package/dist/id.d.ts +0 -86
- package/dist/id.esm.min.mjs +0 -19
- package/dist/id.esm.min.mjs.map +0 -1
- package/dist/index.cjs.min.cjs +0 -19
- package/dist/index.cjs.min.cjs.map +0 -1
- package/dist/index.d.ts +0 -1627
- package/dist/index.esm.min.mjs +0 -19
- package/dist/index.esm.min.mjs.map +0 -1
- package/dist/internal.cjs.min.cjs +0 -19
- package/dist/internal.cjs.min.cjs.map +0 -1
- package/dist/internal.esm.min.mjs +0 -19
- package/dist/internal.esm.min.mjs.map +0 -1
- package/dist/locales/customLocaleMapping.d.ts +0 -11
- package/dist/locales/determineLocale.d.ts +0 -1
- package/dist/locales/getLocaleDirection.d.ts +0 -1
- package/dist/locales/getLocaleEmoji.d.ts +0 -2
- package/dist/locales/getLocaleName.d.ts +0 -1
- package/dist/locales/getLocaleProperties.d.ts +0 -32
- package/dist/locales/getPluralForm.d.ts +0 -9
- package/dist/locales/getRegionProperties.d.ts +0 -7
- package/dist/locales/isSameDialect.d.ts +0 -1
- package/dist/locales/isSameLanguage.d.ts +0 -1
- package/dist/locales/isSupersetLocale.d.ts +0 -1
- package/dist/locales/isValidLocale.d.ts +0 -1
- package/dist/locales/requiresTranslation.d.ts +0 -1
- package/dist/locales/resolveAliasLocale.d.ts +0 -8
- package/dist/locales/resolveCanonicalLocale.d.ts +0 -8
- package/dist/logging/errors.d.ts +0 -10
- package/dist/logging/logger.d.ts +0 -117
- package/dist/logging/warnings.d.ts +0 -2
- package/dist/projects/getProjectData.d.ts +0 -1
- package/dist/settings/plurals.d.ts +0 -3
- package/dist/settings/settings.d.ts +0 -2
- package/dist/settings/settingsUrls.d.ts +0 -3
- package/dist/translate/api.d.ts +0 -1
- package/dist/translate/awaitJobs.d.ts +0 -19
- package/dist/translate/checkJobStatus.d.ts +0 -8
- package/dist/translate/createBranch.d.ts +0 -10
- package/dist/translate/createTag.d.ts +0 -19
- package/dist/translate/downloadFileBatch.d.ts +0 -1
- package/dist/translate/enqueueFiles.d.ts +0 -8
- package/dist/translate/getOrphanedFiles.d.ts +0 -8
- package/dist/translate/processFileMoves.d.ts +0 -25
- package/dist/translate/publishFiles.d.ts +0 -17
- package/dist/translate/queryBranchData.d.ts +0 -3
- package/dist/translate/queryFileData.d.ts +0 -42
- package/dist/translate/querySourceFile.d.ts +0 -1
- package/dist/translate/setupProject.d.ts +0 -11
- package/dist/translate/submitUserEditDiffs.d.ts +0 -12
- package/dist/translate/translateMany.d.ts +0 -1
- package/dist/translate/uploadSourceFiles.d.ts +0 -1
- package/dist/translate/uploadTranslations.d.ts +0 -1
- package/dist/translate/utils/apiRequest.d.ts +0 -1
- package/dist/translate/utils/batch.d.ts +0 -52
- package/dist/translate/utils/fetchWithTimeout.d.ts +0 -1
- package/dist/translate/utils/generateRequestHeaders.d.ts +0 -2
- package/dist/translate/utils/handleFetchError.d.ts +0 -1
- package/dist/translate/utils/validateResponse.d.ts +0 -1
- package/dist/types-dir/api/branch.d.ts +0 -10
- package/dist/types-dir/api/checkFileTranslations.d.ts +0 -37
- package/dist/types-dir/api/downloadFile.d.ts +0 -3
- package/dist/types-dir/api/downloadFileBatch.d.ts +0 -34
- package/dist/types-dir/api/enqueueEntries.d.ts +0 -21
- package/dist/types-dir/api/enqueueFiles.d.ts +0 -56
- package/dist/types-dir/api/entry.d.ts +0 -36
- package/dist/types-dir/api/fetchTranslations.d.ts +0 -11
- package/dist/types-dir/api/file.d.ts +0 -54
- package/dist/types-dir/api/project.d.ts +0 -7
- package/dist/types-dir/api/translate.d.ts +0 -34
- package/dist/types-dir/api/translateMany.d.ts +0 -5
- package/dist/types-dir/api/translationStatus.d.ts +0 -9
- package/dist/types-dir/api/uploadFiles.d.ts +0 -43
- package/dist/types-dir/jsx/content.d.ts +0 -61
- package/dist/types-dir/jsx/variables.d.ts +0 -9
- package/dist/types-dir/transformations.d.ts +0 -8
- package/dist/types.cjs.min.cjs +0 -2
- package/dist/types.cjs.min.cjs.map +0 -1
- package/dist/types.d.ts +0 -652
- package/dist/types.esm.min.mjs +0 -2
- package/dist/types.esm.min.mjs.map +0 -1
- package/dist/utils/base64.d.ts +0 -2
- package/dist/utils/isVariable.d.ts +0 -2
- package/dist/utils/minify.d.ts +0 -2
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { DataFormat } from '../jsx/content';
|
|
2
|
-
export type { Updates } from './enqueueFiles';
|
|
3
|
-
export type EnqueueEntriesOptions = {
|
|
4
|
-
timeout?: number;
|
|
5
|
-
sourceLocale?: string;
|
|
6
|
-
targetLocales?: string[];
|
|
7
|
-
dataFormat?: DataFormat;
|
|
8
|
-
version?: string;
|
|
9
|
-
description?: string;
|
|
10
|
-
requireApproval?: boolean;
|
|
11
|
-
modelProvider?: string;
|
|
12
|
-
};
|
|
13
|
-
export type EnqueueEntriesResult = {
|
|
14
|
-
versionId: string;
|
|
15
|
-
locales: string[];
|
|
16
|
-
message: string;
|
|
17
|
-
projectSettings: {
|
|
18
|
-
cdnEnabled: boolean;
|
|
19
|
-
requireApproval: boolean;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { JsxChildren } from '../jsx/content';
|
|
2
|
-
export type Updates = ({
|
|
3
|
-
metadata: Record<string, any> & {
|
|
4
|
-
staticId?: string;
|
|
5
|
-
};
|
|
6
|
-
} & ({
|
|
7
|
-
dataFormat: 'JSX';
|
|
8
|
-
source: JsxChildren;
|
|
9
|
-
} | {
|
|
10
|
-
dataFormat: 'ICU';
|
|
11
|
-
source: string;
|
|
12
|
-
} | {
|
|
13
|
-
dataFormat: 'I18NEXT';
|
|
14
|
-
source: string;
|
|
15
|
-
} | {
|
|
16
|
-
dataFormat: 'STRING';
|
|
17
|
-
source: string;
|
|
18
|
-
}))[];
|
|
19
|
-
/**
|
|
20
|
-
* Options for enqueueing files
|
|
21
|
-
* @param requireApproval - Whether to require approval for the files
|
|
22
|
-
* @param description - Optional description for the project
|
|
23
|
-
* @param sourceLocale - The project's source locale
|
|
24
|
-
* @param targetLocales - The locales to translate the files to
|
|
25
|
-
* @param version - Optional custom version ID to specify
|
|
26
|
-
* @param timeout - Optional timeout for the request
|
|
27
|
-
* @param modelProvider - Optional model provider to use
|
|
28
|
-
*/
|
|
29
|
-
export type EnqueueFilesOptions = {
|
|
30
|
-
requireApproval?: boolean;
|
|
31
|
-
description?: string;
|
|
32
|
-
sourceLocale?: string;
|
|
33
|
-
targetLocales: string[];
|
|
34
|
-
version?: string;
|
|
35
|
-
_versionId?: string;
|
|
36
|
-
timeout?: number;
|
|
37
|
-
modelProvider?: string;
|
|
38
|
-
force?: boolean;
|
|
39
|
-
};
|
|
40
|
-
export type RequiredEnqueueFilesOptions = EnqueueFilesOptions & Required<Pick<EnqueueFilesOptions, 'sourceLocale'>>;
|
|
41
|
-
export type EnqueueFilesResult = {
|
|
42
|
-
jobData: {
|
|
43
|
-
[jobId: string]: {
|
|
44
|
-
sourceFileId: string;
|
|
45
|
-
fileId: string;
|
|
46
|
-
versionId: string;
|
|
47
|
-
branchId: string;
|
|
48
|
-
targetLocale: string;
|
|
49
|
-
projectId: string;
|
|
50
|
-
force: boolean;
|
|
51
|
-
modelProvider?: string;
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
locales: string[];
|
|
55
|
-
message: string;
|
|
56
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Content, DataFormat } from '../../types';
|
|
2
|
-
/**
|
|
3
|
-
* ActionType is the type of action to perform on the request.
|
|
4
|
-
*
|
|
5
|
-
* @param fast - The fast action type (mini model).
|
|
6
|
-
*/
|
|
7
|
-
export type ActionType = 'fast';
|
|
8
|
-
/**
|
|
9
|
-
* EntryMetadata is the metadata for a GTRequest.
|
|
10
|
-
*
|
|
11
|
-
* @param context - The context of the request.
|
|
12
|
-
* @param id - The id of the request.
|
|
13
|
-
* @param maxChars - The maxChars of the request.
|
|
14
|
-
* @param hash - The hash of the request.
|
|
15
|
-
*/
|
|
16
|
-
export type EntryMetadata = {
|
|
17
|
-
id?: string;
|
|
18
|
-
hash?: string;
|
|
19
|
-
context?: string;
|
|
20
|
-
maxChars?: number;
|
|
21
|
-
dataFormat?: DataFormat;
|
|
22
|
-
actionType?: ActionType;
|
|
23
|
-
};
|
|
24
|
-
export type TranslateOptions = {
|
|
25
|
-
targetLocale: string;
|
|
26
|
-
sourceLocale?: string;
|
|
27
|
-
modelProvider?: string;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* TranslateManyEntry is the input type for translateMany.
|
|
31
|
-
* Can be a plain string or an object with source and entry metadata fields.
|
|
32
|
-
*/
|
|
33
|
-
export type TranslateManyEntry = string | {
|
|
34
|
-
source: Content;
|
|
35
|
-
metadata?: EntryMetadata;
|
|
36
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export type FetchTranslationsOptions = {
|
|
2
|
-
timeout?: number;
|
|
3
|
-
};
|
|
4
|
-
export type RetrievedTranslation = {
|
|
5
|
-
locale: string;
|
|
6
|
-
translation: any;
|
|
7
|
-
};
|
|
8
|
-
export type RetrievedTranslations = RetrievedTranslation[];
|
|
9
|
-
export type FetchTranslationsResult = {
|
|
10
|
-
translations: RetrievedTranslations;
|
|
11
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { DataFormat } from '../jsx/content';
|
|
2
|
-
import { Updates } from './enqueueFiles';
|
|
3
|
-
export type FileFormat = 'GTJSON' | 'JSON' | 'YAML' | 'MDX' | 'MD' | 'TS' | 'JS' | 'HTML' | 'TXT' | 'TWILIO_CONTENT_JSON';
|
|
4
|
-
/**
|
|
5
|
-
* Metadata for files or entries
|
|
6
|
-
*/
|
|
7
|
-
type FormatMetadata = Record<string, any> | Updates[number]['metadata'];
|
|
8
|
-
/**
|
|
9
|
-
* File object structure for uploading files
|
|
10
|
-
* @see {@link FileReferenceOptionalBranchId}
|
|
11
|
-
* @property {string} content - Content of the file
|
|
12
|
-
* @property {string} locale - The locale of the file (e.g. 'en', 'de', 'es', etc.)
|
|
13
|
-
* @property {FormatMetadata} [formatMetadata] - Optional metadata for the file, specific to the format of the file
|
|
14
|
-
* @property {string} [incomingBranchId] - The ID of the incoming branch of the file
|
|
15
|
-
* @property {string} [checkedOutBranchId] - The ID of the checked out branch of the file
|
|
16
|
-
*/
|
|
17
|
-
export type FileToUpload = Omit<FileReference, 'branchId'> & {
|
|
18
|
-
content: string;
|
|
19
|
-
locale: string;
|
|
20
|
-
formatMetadata?: FormatMetadata;
|
|
21
|
-
branchId?: string;
|
|
22
|
-
incomingBranchId?: string;
|
|
23
|
-
checkedOutBranchId?: string;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* File object structure for referencing files
|
|
27
|
-
* @property {string} fileId - The ID of the file
|
|
28
|
-
* @property {string} versionId - The ID of the version of the file
|
|
29
|
-
* @property {string} branchId - The ID of the branch of the file
|
|
30
|
-
* @property {string} locale - The locale of the file (e.g. 'en', 'de', 'es', etc.)
|
|
31
|
-
* @property {string} fileName - The name of the file
|
|
32
|
-
* @property {FileFormat} fileFormat - The format of the file (JSON, MDX, MD, etc.)
|
|
33
|
-
* @property {DataFormat} [dataFormat] - Optional format of the data within the file
|
|
34
|
-
*/
|
|
35
|
-
export type FileReference = {
|
|
36
|
-
fileId: string;
|
|
37
|
-
versionId: string;
|
|
38
|
-
branchId: string;
|
|
39
|
-
fileName: string;
|
|
40
|
-
fileFormat: FileFormat;
|
|
41
|
-
dataFormat?: DataFormat;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* File reference object structure for referencing files
|
|
45
|
-
* @see {@link FileReference}
|
|
46
|
-
* @property {string} [branchId] - The ID of the branch of the file
|
|
47
|
-
*/
|
|
48
|
-
export type FileReferenceIds = Omit<FileReference, 'branchId' | 'fileName' | 'fileFormat' | 'dataFormat'> & {
|
|
49
|
-
branchId?: string;
|
|
50
|
-
fileName?: string;
|
|
51
|
-
fileFormat?: FileFormat;
|
|
52
|
-
dataFormat?: DataFormat;
|
|
53
|
-
};
|
|
54
|
-
export {};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { I18nextMessage, IcuMessage, JsxChildren, StringMessage } from '../jsx/content';
|
|
2
|
-
/**
|
|
3
|
-
* TranslationResultReference is used to store the reference for a translation result.
|
|
4
|
-
*/
|
|
5
|
-
export type TranslationResultReference = {
|
|
6
|
-
id?: string;
|
|
7
|
-
hash: string;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* TypedResult is a union type that represents the different types of translations that can be returned.
|
|
11
|
-
*/
|
|
12
|
-
export type TypedResult = {
|
|
13
|
-
translation: JsxChildren;
|
|
14
|
-
dataFormat: 'JSX';
|
|
15
|
-
} | {
|
|
16
|
-
translation: I18nextMessage | IcuMessage | StringMessage;
|
|
17
|
-
dataFormat: 'ICU' | 'I18NEXT' | 'STRING';
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* RequestError is a type that represents an error that occurred during a translation request.
|
|
21
|
-
*/
|
|
22
|
-
export type TranslationError = {
|
|
23
|
-
success: false;
|
|
24
|
-
error: string;
|
|
25
|
-
code: number;
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* RequestSuccess is a type that represents a successful translation request.
|
|
29
|
-
*/
|
|
30
|
-
export type RequestSuccess = TypedResult & {
|
|
31
|
-
success: true;
|
|
32
|
-
locale: string;
|
|
33
|
-
};
|
|
34
|
-
export type TranslationResult = RequestSuccess | TranslationError;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { DataFormat } from '../jsx/content';
|
|
2
|
-
import { FileFormat, FileReference } from './file';
|
|
3
|
-
/**
|
|
4
|
-
* Metadata stored alongside GTJSON file entries.
|
|
5
|
-
* Keys correspond to the entry id/hash in the GTJSON body.
|
|
6
|
-
*/
|
|
7
|
-
export type GTJsonFormatMetadata = Record<string, {
|
|
8
|
-
context?: string;
|
|
9
|
-
id?: string;
|
|
10
|
-
domain?: string;
|
|
11
|
-
maxChars?: number;
|
|
12
|
-
dataFormat?: 'JSX' | 'ICU' | 'I18NEXT';
|
|
13
|
-
requestVersion?: number;
|
|
14
|
-
approved_at?: string | null;
|
|
15
|
-
approved_by?: string | null;
|
|
16
|
-
hash?: string;
|
|
17
|
-
staticId?: string;
|
|
18
|
-
filePaths?: string[];
|
|
19
|
-
}>;
|
|
20
|
-
export type FileUpload = {
|
|
21
|
-
branchId?: string;
|
|
22
|
-
incomingBranchId?: string;
|
|
23
|
-
checkedOutBranchId?: string;
|
|
24
|
-
content: string;
|
|
25
|
-
fileName: string;
|
|
26
|
-
fileFormat: FileFormat;
|
|
27
|
-
dataFormat?: DataFormat;
|
|
28
|
-
locale: string;
|
|
29
|
-
formatMetadata?: GTJsonFormatMetadata;
|
|
30
|
-
versionId?: string;
|
|
31
|
-
fileId?: string;
|
|
32
|
-
};
|
|
33
|
-
export type UploadFilesOptions = {
|
|
34
|
-
sourceLocale: string;
|
|
35
|
-
modelProvider?: string;
|
|
36
|
-
timeout?: number;
|
|
37
|
-
};
|
|
38
|
-
export type UploadFilesResponse = {
|
|
39
|
-
uploadedFiles: FileReference[];
|
|
40
|
-
count: number;
|
|
41
|
-
message: string;
|
|
42
|
-
};
|
|
43
|
-
export type RequiredUploadFilesOptions = UploadFilesOptions & Required<Pick<UploadFilesOptions, 'sourceLocale'>>;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { Variable } from './variables';
|
|
2
|
-
/**
|
|
3
|
-
* Map of data-_gt properties to their corresponding React props
|
|
4
|
-
*/
|
|
5
|
-
export declare const HTML_CONTENT_PROPS: {
|
|
6
|
-
readonly pl: "placeholder";
|
|
7
|
-
readonly ti: "title";
|
|
8
|
-
readonly alt: "alt";
|
|
9
|
-
readonly arl: "aria-label";
|
|
10
|
-
readonly arb: "aria-labelledby";
|
|
11
|
-
readonly ard: "aria-describedby";
|
|
12
|
-
};
|
|
13
|
-
export type HtmlContentPropKeysRecord = Partial<Record<keyof typeof HTML_CONTENT_PROPS, string>>;
|
|
14
|
-
export type HtmlContentPropValuesRecord = Partial<Record<(typeof HTML_CONTENT_PROPS)[keyof typeof HTML_CONTENT_PROPS], string>>;
|
|
15
|
-
/**
|
|
16
|
-
* GTProp is an internal property used to contain data for translating and rendering elements.
|
|
17
|
-
* note, transformations are only read on the server side if they are 'plural' or 'branch'
|
|
18
|
-
*/
|
|
19
|
-
export type GTProp = {
|
|
20
|
-
b?: Record<string, JsxChildren>;
|
|
21
|
-
t?: 'p' | 'b';
|
|
22
|
-
} & HtmlContentPropKeysRecord;
|
|
23
|
-
export type JsxElement = {
|
|
24
|
-
t?: string;
|
|
25
|
-
i?: number;
|
|
26
|
-
d?: GTProp;
|
|
27
|
-
c?: JsxChildren;
|
|
28
|
-
};
|
|
29
|
-
export type JsxChild = string | JsxElement | Variable;
|
|
30
|
-
/**
|
|
31
|
-
* The format of the string content
|
|
32
|
-
*/
|
|
33
|
-
export type StringFormat = 'ICU' | 'I18NEXT' | 'STRING';
|
|
34
|
-
/**
|
|
35
|
-
* The format of the content
|
|
36
|
-
*/
|
|
37
|
-
export type DataFormat = 'JSX' | StringFormat;
|
|
38
|
-
/**
|
|
39
|
-
* String format content
|
|
40
|
-
*/
|
|
41
|
-
export type StringContent = IcuMessage | StringMessage | I18nextMessage;
|
|
42
|
-
/**
|
|
43
|
-
* A content type representing JSX, ICU, and I18next messages
|
|
44
|
-
*/
|
|
45
|
-
export type Content = JsxChildren | StringContent;
|
|
46
|
-
/**
|
|
47
|
-
* A content type representing JSX elements
|
|
48
|
-
*/
|
|
49
|
-
export type JsxChildren = JsxChild | JsxChild[];
|
|
50
|
-
/**
|
|
51
|
-
* A content type representing ICU messages
|
|
52
|
-
*/
|
|
53
|
-
export type IcuMessage = string;
|
|
54
|
-
/**
|
|
55
|
-
* A content type representing I18next messages
|
|
56
|
-
*/
|
|
57
|
-
export type I18nextMessage = string;
|
|
58
|
-
/**
|
|
59
|
-
* A content type representing plain strings
|
|
60
|
-
*/
|
|
61
|
-
export type StringMessage = string;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transformations are made from a prefix and a suffix.
|
|
3
|
-
*/
|
|
4
|
-
export type Transformation = BaseTransformation | `${BaseTransformation}-${InjectionType}`;
|
|
5
|
-
export type BaseTransformation = 'translate-client' | 'translate-server' | 'translate-runtime' | 'variable-variable' | 'variable-currency' | 'variable-datetime' | 'variable-number' | 'variable-relative-time' | 'plural' | 'branch' | 'derive';
|
|
6
|
-
export type TransformationPrefix = 'translate' | 'variable' | 'plural' | 'branch' | 'fragment' | 'derive';
|
|
7
|
-
export type VariableTransformationSuffix = 'variable' | 'number' | 'datetime' | 'currency' | 'relative-time';
|
|
8
|
-
export type InjectionType = 'automatic' | 'manual';
|
package/dist/types.cjs.min.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs.min.cjs","sources":["../src/types-dir/jsx/content.ts"],"sourcesContent":["import { Variable } from './variables';\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 * 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 t?: string; // tag name\n i?: number; // id\n d?: GTProp; // GT data\n c?: JsxChildren; // children\n};\n\nexport type JsxChild = string | JsxElement | Variable;\n\n/**\n * The format of the string content\n */\nexport type StringFormat = 'ICU' | 'I18NEXT' | 'STRING';\n\n/**\n * The format of the content\n */\nexport type DataFormat = 'JSX' | StringFormat;\n\n/**\n * String format content\n */\nexport type StringContent = IcuMessage | StringMessage | I18nextMessage;\n\n/**\n * A content type representing JSX, ICU, and I18next messages\n */\nexport type Content = JsxChildren | StringContent;\n\n/**\n * A content type representing JSX elements\n */\nexport type JsxChildren = JsxChild | JsxChild[];\n\n/**\n * A content type representing ICU messages\n */\nexport type IcuMessage = string;\n\n/**\n * A content type representing I18next messages\n */\nexport type I18nextMessage = string;\n\n/**\n * A content type representing plain strings\n */\nexport type StringMessage = string;\n"],"names":["pl","ti","alt","arl","arb","ard"],"mappings":"wCAKkC,CAChCA,GAAI,cACJC,GAAI,QACJC,IAAK,MACLC,IAAK,aACLC,IAAK,kBACLC,IAAK"}
|