@intlayer/core 9.0.2 → 9.1.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.
- package/dist/cjs/dictionaryManipulator/editDictionaryByKeyPath.cjs +5 -5
- package/dist/cjs/dictionaryManipulator/editDictionaryByKeyPath.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getContentNodeByKeyPath.cjs +1 -1
- package/dist/cjs/dictionaryManipulator/getContentNodeByKeyPath.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getDefaultNode.cjs +15 -0
- package/dist/cjs/dictionaryManipulator/getDefaultNode.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getEmptyNode.cjs +1 -1
- package/dist/cjs/dictionaryManipulator/getEmptyNode.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getNodeChildren.cjs +1 -1
- package/dist/cjs/dictionaryManipulator/getNodeChildren.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getNodeType.cjs +30 -22
- package/dist/cjs/dictionaryManipulator/getNodeType.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/index.cjs +1 -0
- package/dist/cjs/dictionaryManipulator/mergeQualifiedDictionaries.cjs +25 -2
- package/dist/cjs/dictionaryManipulator/mergeQualifiedDictionaries.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/qualifiedDictionary.cjs +42 -13
- package/dist/cjs/dictionaryManipulator/qualifiedDictionary.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/qualifiedDictionary.test-d.cjs +92 -0
- package/dist/cjs/dictionaryManipulator/qualifiedDictionary.test-d.cjs.map +1 -0
- package/dist/cjs/dictionaryManipulator/removeContentNodeByKeyPath.cjs +1 -1
- package/dist/cjs/dictionaryManipulator/removeContentNodeByKeyPath.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/renameContentNodeByKeyPath.cjs +1 -1
- package/dist/cjs/dictionaryManipulator/renameContentNodeByKeyPath.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/updateNodeChildren.cjs +1 -1
- package/dist/cjs/dictionaryManipulator/updateNodeChildren.cjs.map +1 -1
- package/dist/cjs/index.cjs +8 -0
- package/dist/cjs/interpreter/getContent/getContent.cjs +2 -1
- package/dist/cjs/interpreter/getContent/getContent.cjs.map +1 -1
- package/dist/cjs/interpreter/getContent/index.cjs +1 -0
- package/dist/cjs/interpreter/getContent/plugins.cjs +28 -0
- package/dist/cjs/interpreter/getContent/plugins.cjs.map +1 -1
- package/dist/cjs/interpreter/getDictionary.cjs.map +1 -1
- package/dist/cjs/interpreter/getIntlayer.cjs.map +1 -1
- package/dist/cjs/interpreter/getSelect.cjs +36 -0
- package/dist/cjs/interpreter/getSelect.cjs.map +1 -0
- package/dist/cjs/interpreter/index.cjs +5 -0
- package/dist/cjs/messageFormat/ICU.cjs +23 -6
- package/dist/cjs/messageFormat/ICU.cjs.map +1 -1
- package/dist/cjs/messageFormat/i18next.cjs +24 -6
- package/dist/cjs/messageFormat/i18next.cjs.map +1 -1
- package/dist/cjs/messageFormat/resolveMessage.cjs +8 -0
- package/dist/cjs/messageFormat/resolveMessage.cjs.map +1 -1
- package/dist/cjs/messageFormat/vue-i18n.cjs +11 -2
- package/dist/cjs/messageFormat/vue-i18n.cjs.map +1 -1
- package/dist/cjs/transpiler/index.cjs +2 -0
- package/dist/cjs/transpiler/select/index.cjs +4 -0
- package/dist/cjs/transpiler/select/select.cjs +42 -0
- package/dist/cjs/transpiler/select/select.cjs.map +1 -0
- package/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.mjs +5 -5
- package/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.mjs +1 -1
- package/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getDefaultNode.mjs +15 -0
- package/dist/esm/dictionaryManipulator/getDefaultNode.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getEmptyNode.mjs +1 -1
- package/dist/esm/dictionaryManipulator/getEmptyNode.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getNodeChildren.mjs +1 -1
- package/dist/esm/dictionaryManipulator/getNodeChildren.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getNodeType.mjs +30 -22
- package/dist/esm/dictionaryManipulator/getNodeType.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/index.mjs +2 -2
- package/dist/esm/dictionaryManipulator/mergeQualifiedDictionaries.mjs +26 -3
- package/dist/esm/dictionaryManipulator/mergeQualifiedDictionaries.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/qualifiedDictionary.mjs +42 -14
- package/dist/esm/dictionaryManipulator/qualifiedDictionary.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/qualifiedDictionary.test-d.mjs +92 -0
- package/dist/esm/dictionaryManipulator/qualifiedDictionary.test-d.mjs.map +1 -0
- package/dist/esm/dictionaryManipulator/removeContentNodeByKeyPath.mjs +1 -1
- package/dist/esm/dictionaryManipulator/removeContentNodeByKeyPath.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.mjs +1 -1
- package/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/updateNodeChildren.mjs +1 -1
- package/dist/esm/dictionaryManipulator/updateNodeChildren.mjs.map +1 -1
- package/dist/esm/index.mjs +6 -3
- package/dist/esm/interpreter/getContent/getContent.mjs +3 -2
- package/dist/esm/interpreter/getContent/getContent.mjs.map +1 -1
- package/dist/esm/interpreter/getContent/index.mjs +2 -2
- package/dist/esm/interpreter/getContent/plugins.mjs +28 -1
- package/dist/esm/interpreter/getContent/plugins.mjs.map +1 -1
- package/dist/esm/interpreter/getDictionary.mjs.map +1 -1
- package/dist/esm/interpreter/getIntlayer.mjs.map +1 -1
- package/dist/esm/interpreter/getSelect.mjs +34 -0
- package/dist/esm/interpreter/getSelect.mjs.map +1 -0
- package/dist/esm/interpreter/index.mjs +4 -2
- package/dist/esm/messageFormat/ICU.mjs +23 -6
- package/dist/esm/messageFormat/ICU.mjs.map +1 -1
- package/dist/esm/messageFormat/i18next.mjs +24 -6
- package/dist/esm/messageFormat/i18next.mjs.map +1 -1
- package/dist/esm/messageFormat/resolveMessage.mjs +8 -0
- package/dist/esm/messageFormat/resolveMessage.mjs.map +1 -1
- package/dist/esm/messageFormat/vue-i18n.mjs +11 -2
- package/dist/esm/messageFormat/vue-i18n.mjs.map +1 -1
- package/dist/esm/transpiler/index.mjs +2 -1
- package/dist/esm/transpiler/select/index.mjs +3 -0
- package/dist/esm/transpiler/select/select.mjs +41 -0
- package/dist/esm/transpiler/select/select.mjs.map +1 -0
- package/dist/types/dictionaryManipulator/getNodeType.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/index.d.ts +2 -2
- package/dist/types/dictionaryManipulator/mergeQualifiedDictionaries.d.ts +4 -1
- package/dist/types/dictionaryManipulator/mergeQualifiedDictionaries.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/qualifiedDictionary.d.ts +16 -8
- package/dist/types/dictionaryManipulator/qualifiedDictionary.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/qualifiedDictionary.test-d.d.ts +1 -0
- package/dist/types/index.d.ts +6 -3
- package/dist/types/interpreter/getContent/getContent.d.ts.map +1 -1
- package/dist/types/interpreter/getContent/index.d.ts +2 -2
- package/dist/types/interpreter/getContent/plugins.d.ts +22 -1
- package/dist/types/interpreter/getContent/plugins.d.ts.map +1 -1
- package/dist/types/interpreter/getDictionary.d.ts +2 -2
- package/dist/types/interpreter/getDictionary.d.ts.map +1 -1
- package/dist/types/interpreter/getIntlayer.d.ts +2 -2
- package/dist/types/interpreter/getIntlayer.d.ts.map +1 -1
- package/dist/types/interpreter/getSelect.d.ts +31 -0
- package/dist/types/interpreter/getSelect.d.ts.map +1 -0
- package/dist/types/interpreter/index.d.ts +4 -2
- package/dist/types/messageFormat/ICU.d.ts.map +1 -1
- package/dist/types/messageFormat/i18next.d.ts.map +1 -1
- package/dist/types/messageFormat/resolveMessage.d.ts.map +1 -1
- package/dist/types/messageFormat/vue-i18n.d.ts.map +1 -1
- package/dist/types/transpiler/index.d.ts +3 -1
- package/dist/types/transpiler/select/index.d.ts +2 -0
- package/dist/types/transpiler/select/select.d.ts +62 -0
- package/dist/types/transpiler/select/select.d.ts.map +1 -0
- package/package.json +7 -7
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { SELECT, formatNodeType } from "@intlayer/types/nodeType";
|
|
2
|
+
|
|
3
|
+
//#region src/transpiler/select/select.ts
|
|
4
|
+
/**
|
|
5
|
+
* Function intended to be used to build intlayer dictionaries.
|
|
6
|
+
*
|
|
7
|
+
* Allow to pick a content based on an arbitrary string value — the equivalent
|
|
8
|
+
* of an ICU `{value, select, …}` message, or of a `switch` statement in the
|
|
9
|
+
* application code.
|
|
10
|
+
*
|
|
11
|
+
* Use it when the discriminant is neither a quantity (`enu`), a boolean
|
|
12
|
+
* (`cond`), nor a gender (`gender`).
|
|
13
|
+
*
|
|
14
|
+
* Usage:
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* select({
|
|
18
|
+
* draft: 'This post is a draft',
|
|
19
|
+
* published: 'This post is live',
|
|
20
|
+
* scheduled: 'This post is scheduled',
|
|
21
|
+
* fallback: 'Unknown status',
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* When no `fallback` key is provided, the last key declared is used as the
|
|
26
|
+
* fallback value — the same contract as `cond()` and `gender()`.
|
|
27
|
+
*
|
|
28
|
+
* Prefer `select()` over indexing a plain object (`content.status[value]`):
|
|
29
|
+
* a dynamic computed access cannot be resolved statically by the Intlayer
|
|
30
|
+
* compiler, which forces the whole branch to be kept and its keys to stay
|
|
31
|
+
* un-minified.
|
|
32
|
+
*
|
|
33
|
+
* @param content - The map of cases to content.
|
|
34
|
+
* @param variable - Optional name of the variable being selected on. Preserved
|
|
35
|
+
* for the ICU / i18next round-trip; unused at runtime.
|
|
36
|
+
*/
|
|
37
|
+
const select = (content, variable) => formatNodeType(SELECT, content, { variable });
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { select };
|
|
41
|
+
//# sourceMappingURL=select.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.mjs","names":[],"sources":["../../../../src/transpiler/select/select.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, SELECT } from '@intlayer/types/nodeType';\n\n/**\n * Map of arbitrary string cases to their content.\n *\n * Every key is a case the application can switch on (`'Draft'`, `'Published'`,\n * `'Scheduled'`, …). The optional `fallback` key is picked when the provided\n * value matches no declared case.\n */\nexport type SelectContentStates<Content = unknown> = {\n [caseKey: string]: Content;\n} & {\n fallback?: Content;\n};\n\nexport type SelectContent<\n States extends SelectContentStates = SelectContentStates,\n> = TypedNodeModel<\n typeof SELECT,\n States,\n {\n /**\n * Name of the variable the cases are selected on.\n *\n * Purely informational at runtime — the selector is passed explicitly by\n * the caller. It is preserved so content imported from, or exported to, an\n * ICU `{publishType, select, …}` message keeps its variable name across\n * the round-trip.\n */\n variable?: string;\n }\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on an arbitrary string value — the equivalent\n * of an ICU `{value, select, …}` message, or of a `switch` statement in the\n * application code.\n *\n * Use it when the discriminant is neither a quantity (`enu`), a boolean\n * (`cond`), nor a gender (`gender`).\n *\n * Usage:\n *\n * ```ts\n * select({\n * draft: 'This post is a draft',\n * published: 'This post is live',\n * scheduled: 'This post is scheduled',\n * fallback: 'Unknown status',\n * });\n * ```\n *\n * When no `fallback` key is provided, the last key declared is used as the\n * fallback value — the same contract as `cond()` and `gender()`.\n *\n * Prefer `select()` over indexing a plain object (`content.status[value]`):\n * a dynamic computed access cannot be resolved statically by the Intlayer\n * compiler, which forces the whole branch to be kept and its keys to stay\n * un-minified.\n *\n * @param content - The map of cases to content.\n * @param variable - Optional name of the variable being selected on. Preserved\n * for the ICU / i18next round-trip; unused at runtime.\n */\nconst select = <const States extends SelectContentStates>(\n content?: States,\n variable?: string\n): SelectContent<States> =>\n formatNodeType(SELECT, content as States, { variable });\n\nexport { select };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmEA,MAAM,UACJ,SACA,aAEA,eAAe,QAAQ,SAAmB,EAAE,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNodeType.d.ts","names":[],"sources":["../../../src/dictionaryManipulator/getNodeType.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"getNodeType.d.ts","names":[],"sources":["../../../src/dictionaryManipulator/getNodeType.ts"],"mappings":";;;cAsDa,cAAW,SAAa,gBAAc"}
|
|
@@ -8,8 +8,8 @@ import { mergeDictionaries } from "./mergeDictionaries.js";
|
|
|
8
8
|
import { mergeQualifiedDictionaries } from "./mergeQualifiedDictionaries.js";
|
|
9
9
|
import { normalizeDictionaries, normalizeDictionary } from "./normalizeDictionary.js";
|
|
10
10
|
import { orderDictionaries } from "./orderDictionaries.js";
|
|
11
|
-
import { COMPOSITE_ID_SEPARATOR, DynamicDictionaryLoader, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree, getDictionaryCompositeIds, getDictionaryQualifierIds, getDictionaryQualifierTypes, getDictionarySelectorCacheKey, getVariantIds, isQualifiedDictionaryGroup, isQualifiedDynamicLoaderMap, parseDictionarySelector, reconstructQualifiedEntry, resolveQualifiedDictionary, resolveQualifiedDynamicContent, resolveQualifiedDynamicContentAsync, serializeVariant } from "./qualifiedDictionary.js";
|
|
11
|
+
import { COMPOSITE_ID_SEPARATOR, DEFAULT_VARIANT_ID, DynamicDictionaryLoader, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree, getDictionaryCompositeIds, getDictionaryQualifierIds, getDictionaryQualifierTypes, getDictionarySelectorCacheKey, getVariantIds, isQualifiedDictionaryGroup, isQualifiedDynamicLoaderMap, parseDictionarySelector, reconstructQualifiedEntry, resolveQualifiedDictionary, resolveQualifiedDynamicContent, resolveQualifiedDynamicContentAsync, serializeVariant } from "./qualifiedDictionary.js";
|
|
12
12
|
import { removeContentNodeByKeyPath } from "./removeContentNodeByKeyPath.js";
|
|
13
13
|
import { renameContentNodeByKeyPath } from "./renameContentNodeByKeyPath.js";
|
|
14
14
|
import { updateNodeChildren } from "./updateNodeChildren.js";
|
|
15
|
-
export { COMPOSITE_ID_SEPARATOR, DynamicDictionaryLoader, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree, editDictionaryByKeyPath, getContentNodeByKeyPath, getDefaultNode, getDictionaryCompositeIds, getDictionaryQualifierIds, getDictionaryQualifierTypes, getDictionarySelectorCacheKey, getEmptyNode, getNodeChildren, getNodeType, getVariantIds, isQualifiedDictionaryGroup, isQualifiedDynamicLoaderMap, mergeDictionaries, mergeQualifiedDictionaries, normalizeDictionaries, normalizeDictionary, orderDictionaries, parseDictionarySelector, reconstructQualifiedEntry, removeContentNodeByKeyPath, renameContentNodeByKeyPath, resolveQualifiedDictionary, resolveQualifiedDynamicContent, resolveQualifiedDynamicContentAsync, serializeVariant, updateNodeChildren };
|
|
15
|
+
export { COMPOSITE_ID_SEPARATOR, DEFAULT_VARIANT_ID, DynamicDictionaryLoader, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree, editDictionaryByKeyPath, getContentNodeByKeyPath, getDefaultNode, getDictionaryCompositeIds, getDictionaryQualifierIds, getDictionaryQualifierTypes, getDictionarySelectorCacheKey, getEmptyNode, getNodeChildren, getNodeType, getVariantIds, isQualifiedDictionaryGroup, isQualifiedDynamicLoaderMap, mergeDictionaries, mergeQualifiedDictionaries, normalizeDictionaries, normalizeDictionary, orderDictionaries, parseDictionarySelector, reconstructQualifiedEntry, removeContentNodeByKeyPath, renameContentNodeByKeyPath, resolveQualifiedDictionary, resolveQualifiedDynamicContent, resolveQualifiedDynamicContentAsync, serializeVariant, updateNodeChildren };
|
|
@@ -10,7 +10,10 @@ import { Dictionary, QualifiedDictionaryGroup } from "@intlayer/types/dictionary
|
|
|
10
10
|
* `variant → item`). Dictionaries are grouped by their composite id
|
|
11
11
|
* (one segment per dimension), merged within each group (locale completion /
|
|
12
12
|
* priority overrides preserved), and a `QualifiedDictionaryGroup` is returned.
|
|
13
|
-
* Unqualified siblings act as shared base content merged into every entry
|
|
13
|
+
* Unqualified siblings act as shared base content merged into every entry —
|
|
14
|
+
* and, on a variant-only key, also materialize the `default` entry when no
|
|
15
|
+
* declaration claims it. Every other variant entry then inherits from that
|
|
16
|
+
* `default` entry, so a variant only declares the fields it overrides.
|
|
14
17
|
*
|
|
15
18
|
* Every qualified entry must declare ALL dimensions of the group; an entry that
|
|
16
19
|
* declares only a subset is ambiguous and is rejected with an error log.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeQualifiedDictionaries.d.ts","names":[],"sources":["../../../src/dictionaryManipulator/mergeQualifiedDictionaries.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"mergeQualifiedDictionaries.d.ts","names":[],"sources":["../../../src/dictionaryManipulator/mergeQualifiedDictionaries.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;cAkCa,6BAA0B,cACvB,iBACb,aAAa"}
|
|
@@ -12,6 +12,12 @@ declare const QUALIFIER_ORDER: readonly ["variant", "item"];
|
|
|
12
12
|
* the chunk path separator in dynamic mode.
|
|
13
13
|
*/
|
|
14
14
|
declare const COMPOSITE_ID_SEPARATOR = "/";
|
|
15
|
+
/**
|
|
16
|
+
* Identity of the implicit fallback variant. A selector that pins no variant
|
|
17
|
+
* resolves to it, and a variant that declares no entry of its own falls back to
|
|
18
|
+
* it — so a key only has to ship the entries that actually differ.
|
|
19
|
+
*/
|
|
20
|
+
declare const DEFAULT_VARIANT_ID = "default";
|
|
15
21
|
/**
|
|
16
22
|
* Canonical serialization of a single variant value into its identity string —
|
|
17
23
|
* the variant segment of a composite id, the chunk directory name in dynamic
|
|
@@ -86,8 +92,10 @@ declare const reconstructQualifiedEntry: (group: QualifiedDictionaryGroup, compo
|
|
|
86
92
|
* - Plain dictionary → returned as-is (selector ignored)
|
|
87
93
|
* - `item` declared but not selected → every matching entry ordered by index
|
|
88
94
|
* - `item` selected → the matching entry or null
|
|
89
|
-
* - `variant` defaults to the `default` entry when not selected
|
|
90
|
-
*
|
|
95
|
+
* - `variant` defaults to the `default` entry when not selected, and falls back
|
|
96
|
+
* to it when the selected variant declares no entry of its own; an object
|
|
97
|
+
* variant resolves only when the selector provides an equal object (or, again,
|
|
98
|
+
* through the `default` fallback)
|
|
91
99
|
*
|
|
92
100
|
* Dimensions compose: e.g. a variant × item key with `{ variant: 'promo' }`
|
|
93
101
|
* returns every promo item as an array; adding `{ item: 2 }` narrows to one.
|
|
@@ -150,11 +158,11 @@ declare const isQualifiedDynamicLoaderMap: (value: unknown) => value is Qualifie
|
|
|
150
158
|
* loading only the chunk(s) the selector actually targets.
|
|
151
159
|
*
|
|
152
160
|
* Walks the nested loader tree one dimension at a time (canonical order
|
|
153
|
-
* `variant → item`): `variant`
|
|
154
|
-
*
|
|
155
|
-
* or — when no item is given — expands
|
|
156
|
-
* axis). Semantics mirror
|
|
157
|
-
* static modes behave alike.
|
|
161
|
+
* `variant → item`): `variant` descends by the serialized id, falling back to
|
|
162
|
+
* `default` when the selected variant has no chunk of its own, and `item`
|
|
163
|
+
* either narrows to the selected index or — when no item is given — expands
|
|
164
|
+
* into every sibling chunk (the collection axis). Semantics mirror
|
|
165
|
+
* {@link resolveQualifiedDictionary} so dynamic and static modes behave alike.
|
|
158
166
|
*
|
|
159
167
|
* The Suspense mechanism is injected through `loadChunk` so the same logic
|
|
160
168
|
* serves both the client (suspender cache) and the server (`react.use`). Every
|
|
@@ -195,5 +203,5 @@ declare const resolveQualifiedDynamicContentAsync: <Content>(params: {
|
|
|
195
203
|
transform: (dictionary: Dictionary) => Content;
|
|
196
204
|
}) => Promise<Content | Content[] | null>;
|
|
197
205
|
//#endregion
|
|
198
|
-
export { COMPOSITE_ID_SEPARATOR, DynamicDictionaryLoader, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree, getDictionaryCompositeIds, getDictionaryQualifierIds, getDictionaryQualifierTypes, getDictionarySelectorCacheKey, getVariantIds, isQualifiedDictionaryGroup, isQualifiedDynamicLoaderMap, parseDictionarySelector, reconstructQualifiedEntry, resolveQualifiedDictionary, resolveQualifiedDynamicContent, resolveQualifiedDynamicContentAsync, serializeVariant };
|
|
206
|
+
export { COMPOSITE_ID_SEPARATOR, DEFAULT_VARIANT_ID, DynamicDictionaryLoader, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree, getDictionaryCompositeIds, getDictionaryQualifierIds, getDictionaryQualifierTypes, getDictionarySelectorCacheKey, getVariantIds, isQualifiedDictionaryGroup, isQualifiedDynamicLoaderMap, parseDictionarySelector, reconstructQualifiedEntry, resolveQualifiedDictionary, resolveQualifiedDynamicContent, resolveQualifiedDynamicContentAsync, serializeVariant };
|
|
199
207
|
//# sourceMappingURL=qualifiedDictionary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qualifiedDictionary.d.ts","names":[],"sources":["../../../src/dictionaryManipulator/qualifiedDictionary.ts"],"mappings":";;;;;;;;cAca;;;;;cASA;;;;;;;;;;;;;;;;;;;cAqDA,mBAAgB,SAClB;;;;;;;;cAuBE,gBAAa,SACf;;;;;;cAeE,8BAA2B,YAC1B,eACX;;;;;;;;;cAmBU,4BAAyB,YACxB,YAAU,eACP;;;;;;;cAcJ,4BAAyB,YACxB,YAAU,gBACN;;;;;;
|
|
1
|
+
{"version":3,"file":"qualifiedDictionary.d.ts","names":[],"sources":["../../../src/dictionaryManipulator/qualifiedDictionary.ts"],"mappings":";;;;;;;;cAca;;;;;cASA;;;;;;cAOA;;;;;;;;;;;;;;;;;;;cAqDA,mBAAgB,SAClB;;;;;;;;cAuBE,gBAAa,SACf;;;;;;cAeE,8BAA2B,YAC1B,eACX;;;;;;;;;cAmBU,4BAAyB,YACxB,YAAU,eACP;;;;;;;cAcJ,4BAAyB,YACxB,YAAU,gBACN;;;;;;cA0EL,6BAA0B,mBAEpC,SAAS;;;;;;;;;;;;cAkBC,4BAAyB,OAC7B,0BAAwB,wBAE9B;;;;;;;;;;;;;;;;cAkCU,6BAA0B,mBAClB,aAAa,0BAAwB,WAC7C,uBACV,aAAa;;;;;cAoDH,0BAA2B,UAAU,eAAa,mBAC1C,IAAI;EACpB,SAAS;EAAG,WAAW;;;;;;cAef,gCAA6B,WAC7B;;;;;;;cAwBA;;;;KAKD,gCAAgC,QAAQ;;;;;KAMxC;GACT,kBAAkB,6BAA6B;;;;;;;;;;;;;;KAetC;GACT,8BAA8B;GAC9B,iBAAiB,6BAA6B;;;;;;cAOpC,8BAA2B,mBAErC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;cAkHC,iCAAkC,SAAO;EACpD,WAAW;EACX;EACA;EACA,UAAU;EACV,YAAY,kBAAkB,SAAS,QAAQ,gBAAgB;EAC/D,YAAY,YAAY,eAAe;MACrC,UAAU;;;;;;;;;;;;cAkCD,sCAA6C,SAAO;EAC/D,WAAW;EACX;EACA;EACA,UAAU;EACV,YAAY,YAAY,eAAe;MACrC,QAAQ,UAAU"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -13,19 +13,22 @@ import { MarkdownContent, MarkdownContentConstructor, md as markdown } from "./t
|
|
|
13
13
|
import { MarkdownValidationResult, validateMarkdown } from "./transpiler/markdown/validateMarkdown.js";
|
|
14
14
|
import { DotPath, NestedContent, NestedContentState, ValidDotPathsFor, nest as nesting } from "./transpiler/nesting/nesting.js";
|
|
15
15
|
import { PluralCategory, PluralContent, PluralContentState, plural } from "./transpiler/plural/plural.js";
|
|
16
|
+
import { SelectContent, SelectContentStates, select } from "./transpiler/select/select.js";
|
|
16
17
|
import { TranslationContent, t as translation } from "./transpiler/translation/translation.js";
|
|
17
18
|
import "./transpiler/index.js";
|
|
18
19
|
import { getCondition } from "./interpreter/getCondition.js";
|
|
19
20
|
import { GetNestingResult, getNesting } from "./interpreter/getNesting.js";
|
|
20
|
-
import { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, PluralCond, TranslationCond, UnionKeys, ValueAtKey, conditionPlugin, enumerationPlugin, fallbackPlugin, filePlugin, genderPlugin, insertionPlugin, nestedPlugin, pluralPlugin, translationPlugin } from "./interpreter/getContent/plugins.js";
|
|
21
|
+
import { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, PluralCond, SelectCond, SelectSelector, TranslationCond, UnionKeys, ValueAtKey, conditionPlugin, enumerationPlugin, fallbackPlugin, filePlugin, genderPlugin, insertionPlugin, nestedPlugin, pluralPlugin, selectPlugin, translationPlugin } from "./interpreter/getContent/plugins.js";
|
|
21
22
|
import { deepTransformNode } from "./interpreter/getContent/deepTransform.js";
|
|
22
23
|
import { getBasePlugins, getContent } from "./interpreter/getContent/getContent.js";
|
|
23
24
|
import { getDictionary } from "./interpreter/getDictionary.js";
|
|
24
25
|
import { findMatchingCondition, getEnumeration } from "./interpreter/getEnumeration.js";
|
|
26
|
+
import { getGender } from "./interpreter/getGender.js";
|
|
25
27
|
import { getHTML } from "./interpreter/getHTML.js";
|
|
26
28
|
import { getInsertion } from "./interpreter/getInsertion.js";
|
|
27
29
|
import { getIntlayer } from "./interpreter/getIntlayer.js";
|
|
28
30
|
import { getPlural } from "./interpreter/getPlural.js";
|
|
31
|
+
import { getSelect } from "./interpreter/getSelect.js";
|
|
29
32
|
import { getTranslation } from "./interpreter/getTranslation.js";
|
|
30
33
|
import { InterpolableNode, getInterpolableContent, isInterpolableWrapperNode, rebuildInterpolableContent, transformInterpolableNode } from "./interpreter/interpolableNode.js";
|
|
31
34
|
import { splitInsertionTemplate } from "./interpreter/splitAndJoinInsertion.js";
|
|
@@ -51,7 +54,7 @@ import { mergeDictionaries } from "./dictionaryManipulator/mergeDictionaries.js"
|
|
|
51
54
|
import { mergeQualifiedDictionaries } from "./dictionaryManipulator/mergeQualifiedDictionaries.js";
|
|
52
55
|
import { normalizeDictionaries, normalizeDictionary } from "./dictionaryManipulator/normalizeDictionary.js";
|
|
53
56
|
import { orderDictionaries } from "./dictionaryManipulator/orderDictionaries.js";
|
|
54
|
-
import { COMPOSITE_ID_SEPARATOR, DynamicDictionaryLoader, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree, getDictionaryCompositeIds, getDictionaryQualifierIds, getDictionaryQualifierTypes, getDictionarySelectorCacheKey, getVariantIds, isQualifiedDictionaryGroup, isQualifiedDynamicLoaderMap, parseDictionarySelector, reconstructQualifiedEntry, resolveQualifiedDictionary, resolveQualifiedDynamicContent, resolveQualifiedDynamicContentAsync, serializeVariant } from "./dictionaryManipulator/qualifiedDictionary.js";
|
|
57
|
+
import { COMPOSITE_ID_SEPARATOR, DEFAULT_VARIANT_ID, DynamicDictionaryLoader, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree, getDictionaryCompositeIds, getDictionaryQualifierIds, getDictionaryQualifierTypes, getDictionarySelectorCacheKey, getVariantIds, isQualifiedDictionaryGroup, isQualifiedDynamicLoaderMap, parseDictionarySelector, reconstructQualifiedEntry, resolveQualifiedDictionary, resolveQualifiedDynamicContent, resolveQualifiedDynamicContentAsync, serializeVariant } from "./dictionaryManipulator/qualifiedDictionary.js";
|
|
55
58
|
import { removeContentNodeByKeyPath } from "./dictionaryManipulator/removeContentNodeByKeyPath.js";
|
|
56
59
|
import { renameContentNodeByKeyPath } from "./dictionaryManipulator/renameContentNodeByKeyPath.js";
|
|
57
60
|
import { updateNodeChildren } from "./dictionaryManipulator/updateNodeChildren.js";
|
|
@@ -107,4 +110,4 @@ import { CookieBuildAttributes, LocaleStorage, LocaleStorageClient, LocaleStorag
|
|
|
107
110
|
import { YamlRecord, YamlValue, parseYaml } from "./utils/parseYaml.js";
|
|
108
111
|
import { stringifyYaml } from "./utils/stringifyYaml.js";
|
|
109
112
|
import "./utils/index.js";
|
|
110
|
-
export { ATTRIBUTES_TO_SANITIZE, ATTRIBUTE_TO_NODE_PROP_MAP, ATTR_EXTRACTOR_R, BLOCKQUOTE_ALERT_R, BLOCKQUOTE_R, BLOCKQUOTE_TRIM_LEFT_MULTILINE_R, BLOCK_END_R, BREAK_LINE_R, BREAK_THEMATIC_R, type BlockQuoteNode, type BoldTextNode, type BreakLineNode, type BreakThematicNode, CAPTURE_LETTER_AFTER_HYPHEN, CODE_BLOCK_FENCED_R, CODE_BLOCK_R, CODE_INLINE_R, COMPOSITE_ID_SEPARATOR, CONSECUTIVE_NEWLINE_R, CR_NEWLINE_R, CUSTOM_COMPONENT_R, CachedIntl, CachedIntl as Intl, type CodeBlockNode, type CodeFencedNode, type CodeInlineNode, type CompileOptions, type ComponentOverrides, ConditionCond, ConditionContent, ConditionContentStates, CookieBuildAttributes, type CustomComponentNode, DO_NOT_PROCESS_HTML_ELEMENTS, DURATION_DELAY_TRIGGER, DateTimePreset, DeepTransformContent, DotPath, DynamicDictionaryLoader, type ElementType, EnterFormat, EnumerationCond, EnumerationContent, EnumerationContentState, type EscapedTextNode, FOOTNOTE_R, FOOTNOTE_REFERENCE_R, FORMFEED_R, FRONT_MATTER_R, FileCond, type FileContent, type FileContentConstructor, type FootnoteNode, type FootnoteReferenceNode, type GFMTaskNode, GFM_TASK_R, Gender, GenderCond, GenderContent, GenderContentStates, type GenerateSitemapOptions, GetNestingResult, type GetPrefixOptions, type GetPrefixResult, HEADING_ATX_COMPLIANT_R, HEADING_R, HEADING_SETEXT_R, type HTMLCommentNode, HTMLContent, HTMLContentConstructor, type HTMLNode, type HTMLSelfClosingNode, type HTMLTag, HTMLTagsType, HTMLValidationIssue, HTMLValidationResult, HTML_BLOCK_ELEMENT_R, HTML_CHAR_CODE_R, HTML_COMMENT_R, HTML_CUSTOM_ATTR_R, HTML_LEFT_TRIM_AMOUNT_R, HTML_SELF_CLOSING_ELEMENT_R, HTML_TAGS, type HeadingNode, type HeadingSetextNode, IInterpreterPlugin, IInterpreterPluginState, INLINE_SKIP_R, INTERPOLATION_R, type ImageNode, InsertionCond, InsertionContent, InsertionContentConstructor, InterpolableNode, IntlConstructorName, IsAny, type ItalicTextNode, JsonValue, LINK_AUTOLINK_BARE_URL_R, LINK_AUTOLINK_R, LIST_LOOKBEHIND_R, LOOKAHEAD, type LinkAngleBraceNode, type LinkBareURLNode, type LinkNode, ListType, type LocaleDomainMap, LocaleStorage, LocaleStorageClient, LocaleStorageClientOptions, LocaleStorageOptions, LocaleStorageServer, LocaleStorageServerOptions, type LocalizedPathResult, MarkdownContent, MarkdownContentConstructor, type MarkdownContext, type MarkdownOptions, type MarkdownRuntime, type HTMLValidationIssue as MarkdownValidationIssue, MarkdownValidationResult, type MarkedTextNode, MessageFormatDialect, MessageValues, NAMED_CODES_TO_UNICODE, NP_TABLE_R, NestedCond, NestedContent, NestedContentState, type NestedParser, type NewlineNode, NodeProps, ORDERED, ORDERED_LIST_BULLET, ORDERED_LIST_ITEM_PREFIX, ORDERED_LIST_ITEM_PREFIX_R, ORDERED_LIST_ITEM_R, ORDERED_LIST_R, type OrderedListNode, PARAGRAPH_R, type ParagraphNode, type ParseState, ParsedMarkdown, type Parser, type ParserResult, Plugins, PluralCategory, PluralCond, PluralContent, PluralContentState, PortableObject, Priority, PriorityValue, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree, REFERENCE_IMAGE_OR_LINK, REFERENCE_IMAGE_R, REFERENCE_LINK_R, type ReferenceImageNode, type ReferenceLinkNode, type ReferenceNode, type RenderRuleHook, type Rule, type RuleOutput, RuleType, RuleTypeValue, type Rules, SHORTCODE_R, SHOULD_RENDER_AS_BLOCK_R, type SitemapUrlEntry, type StrikethroughTextNode, TABLE_CENTER_ALIGN, TABLE_LEFT_ALIGN, TABLE_RIGHT_ALIGN, TABLE_TRIM_PIPES, TAB_R, TEXT_BOLD_R, TEXT_EMPHASIZED_R, TEXT_ESCAPED_R, TEXT_MARKED_R, TEXT_PLAIN_R, TEXT_STRIKETHROUGHED_R, TRIM_STARTING_NEWLINES, type TableNode, type TableSeparatorNode, TaggedMessageToken, type TextNode, TranslationCond, TranslationContent, UNESCAPE_R, UNORDERED, UNORDERED_LIST_BULLET, UNORDERED_LIST_ITEM_PREFIX, UNORDERED_LIST_ITEM_PREFIX_R, UNORDERED_LIST_ITEM_R, UNORDERED_LIST_R, UnionKeys, type UnorderedListNode, VOID_HTML_ELEMENTS, ValidDotPathsFor, ValueAtKey, WrappedIntl, YamlRecord, YamlValue, allowInline, anyScopeRegex, attributeValueToNodePropValue, bindIntl, blockRegex, buildMaskPlugin, captureNothing, checkIsURLAbsolute, checkMissingLocalesPlugin, compact, comparePaths, compile, compileWithOptions, condition as cond, conditionPlugin, createCompiler, createRenderer, currency, cx, date, deepTransformNode, editDictionaryByKeyPath, enumeration as enu, enumerationPlugin, fallbackPlugin, type file, type fileContent, filePlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, findMatchingCondition, gender, genderPlugin, generateListItemPrefix, generateListItemPrefixRegex, generateListItemRegex, generateListRegex, generateSitemap, generateSitemapUrl, get, getBasePlugins, getBrowserLocale, getCachedIntl, getCanonicalPath, getCondition, getContent, getContentNodeByKeyPath, getCookie, getDefaultNode, getDictionary, getDictionaryCompositeIds, getDictionaryQualifierIds, getDictionaryQualifierTypes, getDictionarySelectorCacheKey, getDomainHostname, getDomainOrigin, getEditedContent, getEditedDictionary, getEmptyNode, getEnumeration, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getHTML, getHTMLTextDir, getInsertion, getInsertionValues, getInternalPath, getInterpolableContent, getIntlayer, getLocale, getLocaleFromDomain, getLocaleFromPath, getLocaleFromStorage, getLocaleFromStorageClient, getLocaleFromStorageServer, getLocaleLang, getLocaleName, getLocalizedContent, getLocalizedPath, getLocalizedUrl, getMarkdownMetadata, getMaskContent, getMissingLocalesContent, getMissingLocalesContentFromDictionary, getMultilingualDictionary, getMultilingualUrls, getNesting, getNodeChildren, getNodeType, getPathWithoutLocale, getPerLocaleDictionary, getPlural, getPrefix, getReplacedValuesContent, getRewritePath, getRewriteRules, getSplittedContent, getSplittedDictionaryContent, getTranslation, getVariantIds, html, i18nextToIntlayerFormatter, icuToIntlayerFormatter, inlineRegex, insertion as insert, insertContentInDictionary, insertionPlugin, interpolateMessage, intlayerToI18nextFormatter, intlayerToICUFormatter, intlayerToPortableObjectFormatter, intlayerToVueI18nFormatter, isInterpolableWrapperNode, isLocaleExclusiveOnDomain, isQualifiedDictionaryGroup, isQualifiedDynamicLoaderMap, isSameKeyPath, isValidElement, list, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, localeStorageOptions, markdown as md, mergeDictionaries, mergeQualifiedDictionaries, navigatePath, nesting as nest, nestedPlugin, normalizeAttributeKey, normalizeDictionaries, normalizeDictionary, normalizePath, normalizeWhitespace, number, orderDictionaries, parseBlock, parseCaptureInline, parseDictionarySelector, parseInline, parseMarkdown, parseSimpleInline, parseStyleAttribute, parseTableAlign, parseTableAlignCapture, parseTableCells, parseTableRow, parseTaggedMessage, parseYaml, parserFor, percentage, plural, pluralPlugin, portableObjectToIntlayerFormatter, presets, qualifies, rebuildInterpolableContent, reconstructQualifiedEntry, relativeTime, removeContentNodeByKeyPath, renameContentNodeByKeyPath, renderFor, renderMarkdownAst, renderNothing, resolveMessage, resolveMessageNode, resolveQualifiedDictionary, resolveQualifiedDynamicContent, resolveQualifiedDynamicContentAsync, sanitizer, serializeVariant, setLocaleInStorage, setLocaleInStorageClient, setLocaleInStorageServer, simpleInlineRegex, slugify, some, splitInsertionTemplate, startsWith, stringifyYaml, translation as t, transformInterpolableNode, translationPlugin, trimEnd, trimLeadingWhitespaceOutsideFences, unescapeString, units, unquote, updateNodeChildren, validateHTML, validateMarkdown, validatePrefix, vueI18nToIntlayerFormatter };
|
|
113
|
+
export { ATTRIBUTES_TO_SANITIZE, ATTRIBUTE_TO_NODE_PROP_MAP, ATTR_EXTRACTOR_R, BLOCKQUOTE_ALERT_R, BLOCKQUOTE_R, BLOCKQUOTE_TRIM_LEFT_MULTILINE_R, BLOCK_END_R, BREAK_LINE_R, BREAK_THEMATIC_R, type BlockQuoteNode, type BoldTextNode, type BreakLineNode, type BreakThematicNode, CAPTURE_LETTER_AFTER_HYPHEN, CODE_BLOCK_FENCED_R, CODE_BLOCK_R, CODE_INLINE_R, COMPOSITE_ID_SEPARATOR, CONSECUTIVE_NEWLINE_R, CR_NEWLINE_R, CUSTOM_COMPONENT_R, CachedIntl, CachedIntl as Intl, type CodeBlockNode, type CodeFencedNode, type CodeInlineNode, type CompileOptions, type ComponentOverrides, ConditionCond, ConditionContent, ConditionContentStates, CookieBuildAttributes, type CustomComponentNode, DEFAULT_VARIANT_ID, DO_NOT_PROCESS_HTML_ELEMENTS, DURATION_DELAY_TRIGGER, DateTimePreset, DeepTransformContent, DotPath, DynamicDictionaryLoader, type ElementType, EnterFormat, EnumerationCond, EnumerationContent, EnumerationContentState, type EscapedTextNode, FOOTNOTE_R, FOOTNOTE_REFERENCE_R, FORMFEED_R, FRONT_MATTER_R, FileCond, type FileContent, type FileContentConstructor, type FootnoteNode, type FootnoteReferenceNode, type GFMTaskNode, GFM_TASK_R, Gender, GenderCond, GenderContent, GenderContentStates, type GenerateSitemapOptions, GetNestingResult, type GetPrefixOptions, type GetPrefixResult, HEADING_ATX_COMPLIANT_R, HEADING_R, HEADING_SETEXT_R, type HTMLCommentNode, HTMLContent, HTMLContentConstructor, type HTMLNode, type HTMLSelfClosingNode, type HTMLTag, HTMLTagsType, HTMLValidationIssue, HTMLValidationResult, HTML_BLOCK_ELEMENT_R, HTML_CHAR_CODE_R, HTML_COMMENT_R, HTML_CUSTOM_ATTR_R, HTML_LEFT_TRIM_AMOUNT_R, HTML_SELF_CLOSING_ELEMENT_R, HTML_TAGS, type HeadingNode, type HeadingSetextNode, IInterpreterPlugin, IInterpreterPluginState, INLINE_SKIP_R, INTERPOLATION_R, type ImageNode, InsertionCond, InsertionContent, InsertionContentConstructor, InterpolableNode, IntlConstructorName, IsAny, type ItalicTextNode, JsonValue, LINK_AUTOLINK_BARE_URL_R, LINK_AUTOLINK_R, LIST_LOOKBEHIND_R, LOOKAHEAD, type LinkAngleBraceNode, type LinkBareURLNode, type LinkNode, ListType, type LocaleDomainMap, LocaleStorage, LocaleStorageClient, LocaleStorageClientOptions, LocaleStorageOptions, LocaleStorageServer, LocaleStorageServerOptions, type LocalizedPathResult, MarkdownContent, MarkdownContentConstructor, type MarkdownContext, type MarkdownOptions, type MarkdownRuntime, type HTMLValidationIssue as MarkdownValidationIssue, MarkdownValidationResult, type MarkedTextNode, MessageFormatDialect, MessageValues, NAMED_CODES_TO_UNICODE, NP_TABLE_R, NestedCond, NestedContent, NestedContentState, type NestedParser, type NewlineNode, NodeProps, ORDERED, ORDERED_LIST_BULLET, ORDERED_LIST_ITEM_PREFIX, ORDERED_LIST_ITEM_PREFIX_R, ORDERED_LIST_ITEM_R, ORDERED_LIST_R, type OrderedListNode, PARAGRAPH_R, type ParagraphNode, type ParseState, ParsedMarkdown, type Parser, type ParserResult, Plugins, PluralCategory, PluralCond, PluralContent, PluralContentState, PortableObject, Priority, PriorityValue, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree, REFERENCE_IMAGE_OR_LINK, REFERENCE_IMAGE_R, REFERENCE_LINK_R, type ReferenceImageNode, type ReferenceLinkNode, type ReferenceNode, type RenderRuleHook, type Rule, type RuleOutput, RuleType, RuleTypeValue, type Rules, SHORTCODE_R, SHOULD_RENDER_AS_BLOCK_R, SelectCond, SelectContent, SelectContentStates, SelectSelector, type SitemapUrlEntry, type StrikethroughTextNode, TABLE_CENTER_ALIGN, TABLE_LEFT_ALIGN, TABLE_RIGHT_ALIGN, TABLE_TRIM_PIPES, TAB_R, TEXT_BOLD_R, TEXT_EMPHASIZED_R, TEXT_ESCAPED_R, TEXT_MARKED_R, TEXT_PLAIN_R, TEXT_STRIKETHROUGHED_R, TRIM_STARTING_NEWLINES, type TableNode, type TableSeparatorNode, TaggedMessageToken, type TextNode, TranslationCond, TranslationContent, UNESCAPE_R, UNORDERED, UNORDERED_LIST_BULLET, UNORDERED_LIST_ITEM_PREFIX, UNORDERED_LIST_ITEM_PREFIX_R, UNORDERED_LIST_ITEM_R, UNORDERED_LIST_R, UnionKeys, type UnorderedListNode, VOID_HTML_ELEMENTS, ValidDotPathsFor, ValueAtKey, WrappedIntl, YamlRecord, YamlValue, allowInline, anyScopeRegex, attributeValueToNodePropValue, bindIntl, blockRegex, buildMaskPlugin, captureNothing, checkIsURLAbsolute, checkMissingLocalesPlugin, compact, comparePaths, compile, compileWithOptions, condition as cond, conditionPlugin, createCompiler, createRenderer, currency, cx, date, deepTransformNode, editDictionaryByKeyPath, enumeration as enu, enumerationPlugin, fallbackPlugin, type file, type fileContent, filePlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, findMatchingCondition, gender, genderPlugin, generateListItemPrefix, generateListItemPrefixRegex, generateListItemRegex, generateListRegex, generateSitemap, generateSitemapUrl, get, getBasePlugins, getBrowserLocale, getCachedIntl, getCanonicalPath, getCondition, getContent, getContentNodeByKeyPath, getCookie, getDefaultNode, getDictionary, getDictionaryCompositeIds, getDictionaryQualifierIds, getDictionaryQualifierTypes, getDictionarySelectorCacheKey, getDomainHostname, getDomainOrigin, getEditedContent, getEditedDictionary, getEmptyNode, getEnumeration, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getGender, getHTML, getHTMLTextDir, getInsertion, getInsertionValues, getInternalPath, getInterpolableContent, getIntlayer, getLocale, getLocaleFromDomain, getLocaleFromPath, getLocaleFromStorage, getLocaleFromStorageClient, getLocaleFromStorageServer, getLocaleLang, getLocaleName, getLocalizedContent, getLocalizedPath, getLocalizedUrl, getMarkdownMetadata, getMaskContent, getMissingLocalesContent, getMissingLocalesContentFromDictionary, getMultilingualDictionary, getMultilingualUrls, getNesting, getNodeChildren, getNodeType, getPathWithoutLocale, getPerLocaleDictionary, getPlural, getPrefix, getReplacedValuesContent, getRewritePath, getRewriteRules, getSelect, getSplittedContent, getSplittedDictionaryContent, getTranslation, getVariantIds, html, i18nextToIntlayerFormatter, icuToIntlayerFormatter, inlineRegex, insertion as insert, insertContentInDictionary, insertionPlugin, interpolateMessage, intlayerToI18nextFormatter, intlayerToICUFormatter, intlayerToPortableObjectFormatter, intlayerToVueI18nFormatter, isInterpolableWrapperNode, isLocaleExclusiveOnDomain, isQualifiedDictionaryGroup, isQualifiedDynamicLoaderMap, isSameKeyPath, isValidElement, list, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, localeStorageOptions, markdown as md, mergeDictionaries, mergeQualifiedDictionaries, navigatePath, nesting as nest, nestedPlugin, normalizeAttributeKey, normalizeDictionaries, normalizeDictionary, normalizePath, normalizeWhitespace, number, orderDictionaries, parseBlock, parseCaptureInline, parseDictionarySelector, parseInline, parseMarkdown, parseSimpleInline, parseStyleAttribute, parseTableAlign, parseTableAlignCapture, parseTableCells, parseTableRow, parseTaggedMessage, parseYaml, parserFor, percentage, plural, pluralPlugin, portableObjectToIntlayerFormatter, presets, qualifies, rebuildInterpolableContent, reconstructQualifiedEntry, relativeTime, removeContentNodeByKeyPath, renameContentNodeByKeyPath, renderFor, renderMarkdownAst, renderNothing, resolveMessage, resolveMessageNode, resolveQualifiedDictionary, resolveQualifiedDynamicContent, resolveQualifiedDynamicContentAsync, sanitizer, select, selectPlugin, serializeVariant, setLocaleInStorage, setLocaleInStorageClient, setLocaleInStorageServer, simpleInlineRegex, slugify, some, splitInsertionTemplate, startsWith, stringifyYaml, translation as t, transformInterpolableNode, translationPlugin, trimEnd, trimLeadingWhitespaceOutsideFences, unescapeString, units, unquote, updateNodeChildren, validateHTML, validateMarkdown, validatePrefix, vueI18nToIntlayerFormatter };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getContent.d.ts","names":[],"sources":["../../../../src/interpreter/getContent/getContent.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"getContent.d.ts","names":[],"sources":["../../../../src/interpreter/getContent/getContent.ts"],"mappings":";;;;cAsBa,iBAAc,SAChB,eAAa,uBAErB;;;;;;;cAqBU,mBACL,UAAU,mBACV,UAAU,gBAAgB,iBAAe,MAEzC,GAAC,WACI,WAAS,UACX,cAKH,qBAAqB,GAAG,yBAAyB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, PluralCond, TranslationCond, UnionKeys, ValueAtKey, conditionPlugin, enumerationPlugin, fallbackPlugin, filePlugin, genderPlugin, insertionPlugin, nestedPlugin, pluralPlugin, translationPlugin } from "./plugins.js";
|
|
1
|
+
import { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, PluralCond, SelectCond, SelectSelector, TranslationCond, UnionKeys, ValueAtKey, conditionPlugin, enumerationPlugin, fallbackPlugin, filePlugin, genderPlugin, insertionPlugin, nestedPlugin, pluralPlugin, selectPlugin, translationPlugin } from "./plugins.js";
|
|
2
2
|
import { deepTransformNode } from "./deepTransform.js";
|
|
3
3
|
import { getBasePlugins, getContent } from "./getContent.js";
|
|
4
|
-
export { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, PluralCond, TranslationCond, UnionKeys, ValueAtKey, conditionPlugin, deepTransformNode, enumerationPlugin, fallbackPlugin, filePlugin, genderPlugin, getBasePlugins, getContent, insertionPlugin, nestedPlugin, pluralPlugin, translationPlugin };
|
|
4
|
+
export { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, PluralCond, SelectCond, SelectSelector, TranslationCond, UnionKeys, ValueAtKey, conditionPlugin, deepTransformNode, enumerationPlugin, fallbackPlugin, filePlugin, genderPlugin, getBasePlugins, getContent, insertionPlugin, nestedPlugin, pluralPlugin, selectPlugin, translationPlugin };
|
|
@@ -94,6 +94,25 @@ type GenderCond<T, S, _L> = T extends {
|
|
|
94
94
|
} ? (value: Gender) => DeepTransformContent<T[typeof NodeTypes.GENDER][keyof T[typeof NodeTypes.GENDER]], S> : never;
|
|
95
95
|
/** Gender plugin. Replaces node with a function that takes gender => string. */
|
|
96
96
|
declare const genderPlugin: Plugins;
|
|
97
|
+
/** ---------------------------------------------
|
|
98
|
+
* SELECT PLUGIN
|
|
99
|
+
* --------------------------------------------- */
|
|
100
|
+
/**
|
|
101
|
+
* Accepted selector for a select node.
|
|
102
|
+
*
|
|
103
|
+
* When the node declares a `fallback` case, any string is accepted (the
|
|
104
|
+
* fallback covers the unmatched values) while the declared cases still
|
|
105
|
+
* autocomplete. Without a `fallback`, only the declared cases are accepted.
|
|
106
|
+
*/
|
|
107
|
+
type SelectSelector<States> = 'fallback' extends keyof States ? Exclude<keyof States & string, 'fallback'> | (string & {}) : keyof States & string;
|
|
108
|
+
type SelectCond<T, S, _L> = T extends {
|
|
109
|
+
nodeType: NodeType | string;
|
|
110
|
+
[NodeTypes.SELECT]: object;
|
|
111
|
+
} ? (value: SelectSelector<T[typeof NodeTypes.SELECT]> | {
|
|
112
|
+
value: SelectSelector<T[typeof NodeTypes.SELECT]>;
|
|
113
|
+
}) => DeepTransformContent<T[typeof NodeTypes.SELECT][keyof T[typeof NodeTypes.SELECT]], S> : never;
|
|
114
|
+
/** Select plugin. Replaces node with a function that takes a string => content. */
|
|
115
|
+
declare const selectPlugin: Plugins;
|
|
97
116
|
/** ---------------------------------------------
|
|
98
117
|
* NESTED PLUGIN
|
|
99
118
|
* --------------------------------------------- */
|
|
@@ -149,6 +168,7 @@ interface IInterpreterPlugin<T, S, L extends LocalesValues> {
|
|
|
149
168
|
condition: ConditionCond<T, S, L>;
|
|
150
169
|
insertion: InsertionCond<T, S, L>;
|
|
151
170
|
gender: GenderCond<T, S, L>;
|
|
171
|
+
select: SelectCond<T, S, L>;
|
|
152
172
|
nested: NestedCond<T, S, L>;
|
|
153
173
|
file: FileCond<T, S, L>;
|
|
154
174
|
}
|
|
@@ -162,6 +182,7 @@ type IInterpreterPluginState = {
|
|
|
162
182
|
condition: true;
|
|
163
183
|
insertion: true;
|
|
164
184
|
gender: true;
|
|
185
|
+
select: true;
|
|
165
186
|
nested: true;
|
|
166
187
|
file: true;
|
|
167
188
|
};
|
|
@@ -179,5 +200,5 @@ type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
|
179
200
|
*/
|
|
180
201
|
type DeepTransformContent<T, S = IInterpreterPluginState, L extends LocalesValues = DeclaredLocales> = IsAny<T> extends true ? T : CheckApplyPlugin<T, keyof IInterpreterPlugin<T, S, L>, S, L> extends never ? Traverse<T, S, L> : CheckApplyPlugin<T, keyof IInterpreterPlugin<T, S, L>, S, L>;
|
|
181
202
|
//#endregion
|
|
182
|
-
export { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, PluralCond, TranslationCond, UnionKeys, ValueAtKey, conditionPlugin, enumerationPlugin, fallbackPlugin, filePlugin, genderPlugin, insertionPlugin, nestedPlugin, pluralPlugin, translationPlugin };
|
|
203
|
+
export { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, PluralCond, SelectCond, SelectSelector, TranslationCond, UnionKeys, ValueAtKey, conditionPlugin, enumerationPlugin, fallbackPlugin, filePlugin, genderPlugin, insertionPlugin, nestedPlugin, pluralPlugin, selectPlugin, translationPlugin };
|
|
183
204
|
//# sourceMappingURL=plugins.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","names":[],"sources":["../../../../src/interpreter/getContent/plugins.ts"],"mappings":";;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","names":[],"sources":["../../../../src/interpreter/getContent/plugins.ts"],"mappings":";;;;;;;;;;;;;;;;;;;KAkDY;EACV;EACA,YAAY;EACZ,YACE,WACA,OAAO,WACP,cAAc,WAAW,OAAO;;;;;;;cAUvB,gBAAgB;;;;KAUjB,UAAU,KAAK,0BAA0B;KACzC,WAAW,GAAG,KAAK,oBAC3B,gBAAgB,IACd,EAAE;KAII,gBAAgB,GAAG,GAAG,UAAU,iBAAiB;EAC3D,UAAU;GACT,UAAU,oBAAoB;IAE7B,UAAU,OAAO,wBACf,QAAQ,WAAW,OAAO,2BAErB,KAAK,UAAU,QAAQ,MAAM,gBAAgB,IAC1C,gBAAgB,EAAE,KAChB,EAAE,GAAG,KACL,WAAW,QAAQ,IAAI,KACzB,WAAW,QAAQ,IAAI,qBACb,WACd,qBAAqB,SAAS,cAE/B,gBAAgB,IAAI,EAAE,KAAK,QAAQ,mBAAkB,WACpD,qBAAqB,SAAS;;cAM3B,oBAAiB,QACpB,eAAa,WACV,kBACV;;;;KAkCS,gBAAgB,GAAG,GAAG,MAAM;EACtC,UAAU;GACT,UAAU;KAGP,qBACG,qBACH,SAAS,UAAU,mBAAmB,SAAS,UAAU,eACzD;;cAKO,mBAAmB;;;;KAyCpB,WAAW,GAAG,GAAG,MAAM;EACjC,UAAU;GACT,UAAU;KAGP;EAAgB;GAAgB;MAC7B,qBACH,SAAS,UAAU,cAAc,SAAS,UAAU,UACpD;;;;;;cAWO,eAAY,SAAa,kBAAgB;;;;KA+F1C,cAAc,GAAG,GAAG,MAAM;EACpC,UAAU;GACT,UAAU;KAGP;EAAmB;MAChB,qBACH,SAAS,UAAU,iBAAiB,SAAS,UAAU,aACvD;;cAKO,iBAAiB;;;;KAyClB,cAAc,GAAG,GAAG,MAAM;EACpC,UAAU;GACT,UAAU,kBAAkB;EAC7B;KAGI,WACG,KAAK,6CAEL,mBACD,6BAA6B,KAC7B,qBAAqB,GAAG;;cAInB,iBAAiB;;;;KAgFlB,WAAW,GAAG,GAAG,MAAM;EACjC,UAAU;GACT,UAAU;KAGP,OAAO,WACJ,qBACH,SAAS,UAAU,cAAc,SAAS,UAAU,UACpD;;cAKO,cAAc;;;;;;;;;;;KAuCf,eAAe,mCAAmC,SAC1D,cAAc,qDACR;KAEE,WAAW,GAAG,GAAG,MAAM;EACjC,UAAU;GACT,UAAU;KAGP,OACI,eAAe,SAAS,UAAU;EAChC,OAAO,eAAe,SAAS,UAAU;MAC5C,qBACH,SAAS,UAAU,cAAc,SAAS,UAAU,UACpD;;cAKO,cAAc;;;;KAyCf,WAAW,GAAG,GAAG,MAAM;EACjC,UAAU;GACT,UAAU,eAAe;IAExB;EACE,qBAAqB,UAAU;EAC/B,aAAa;IAEb,iBAAiB,GAAG,GAAG;;cAKhB,eAAY,SAAa,kBAAgB;;;;KAuB1C,SAAS,GAAG,GAAG,MAAM;EAC/B,UAAU;GACT,UAAU;EACX;IAEE,6BAA6B;;cAIpB,YAAY;;;;;;;;UAsBR;EACf;EACA,SAAS;EACT,UAAU;EACV,SAAS;EACT;EACA;;;;;;;EAOA;;;;;;UAOe,mBAAmB,GAAG,GAAG,UAAU;EAClD,aAAa,gBAAgB,GAAG,GAAG;EACnC,aAAa,gBAAgB,GAAG,GAAG;EACnC,QAAQ,WAAW,GAAG,GAAG;EACzB,WAAW,cAAc,GAAG,GAAG;EAC/B,WAAW,cAAc,GAAG,GAAG;EAC/B,QAAQ,WAAW,GAAG,GAAG;EACzB,QAAQ,WAAW,GAAG,GAAG;EACzB,QAAQ,WAAW,GAAG,GAAG;EACzB,MAAM,SAAS,GAAG,GAAG;;;;;KAMX;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;;KAMG,iBACH,GACA,gBAAgB,mBAAmB,GAAG,GAAG,IACzC,GACA,UAAU,gBAAgB,mBACxB,gBAAgB,IAEhB,EAAE,kBAEA,mBAAmB,GAAG,GAAG,GAAG,2BAG1B,mBAAmB,GAAG,GAAG,GAAG;;;;KAO/B,SAAS,GAAG,GAAG,UAAU,gBAAgB,mBAC5C,UAAU,oBAAoB,KAC1B,MAAM,qBAAqB,GAAG,GAAG,MACjC,sBACK,WAAW,IAAI,qBAAqB,EAAE,IAAI,GAAG,QAChD;KAEI,MAAM,mBAAmB;;;;KAKzB,qBACV,GACA,IAAI,yBACJ,UAAU,gBAAgB,mBAE1B,MAAM,kBACF,IACA,iBAAiB,SAAS,mBAAmB,GAAG,GAAG,IAAI,GAAG,mBAExD,SAAS,GAAG,GAAG,KAEf,iBAAiB,SAAS,mBAAmB,GAAG,GAAG,IAAI,GAAG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DeepTransformContent, IInterpreterPluginState, Plugins } from "./getContent/plugins.js";
|
|
2
2
|
import "./getContent/index.js";
|
|
3
3
|
import { Dictionary, DictionarySelector, QualifiedDictionaryGroup, ResolveQualifiedDictionaryContent } from "@intlayer/types/dictionary";
|
|
4
|
-
import { DeclaredLocales, ExtractSelectorLocale
|
|
4
|
+
import { DeclaredLocales, ExtractSelectorLocale } from "@intlayer/types/module_augmentation";
|
|
5
5
|
//#region src/interpreter/getDictionary.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* Transforms a dictionary in a single pass, applying each plugin as needed.
|
|
@@ -17,7 +17,7 @@ import { DeclaredLocales, ExtractSelectorLocale, LocalesValues } from "@intlayer
|
|
|
17
17
|
* @param plugins An array of NodeTransformer that define how to transform recognized nodes.
|
|
18
18
|
* If omitted, we’ll use a default set of plugins.
|
|
19
19
|
*/
|
|
20
|
-
declare const getDictionary: <const T extends Dictionary | QualifiedDictionaryGroup, const A extends
|
|
20
|
+
declare const getDictionary: <const T extends Dictionary | QualifiedDictionaryGroup, const A extends DeclaredLocales | DictionarySelector = DeclaredLocales>(dictionary: T, localeOrSelector?: A, plugins?: Plugins[]) => DeepTransformContent<ResolveQualifiedDictionaryContent<T, A>, IInterpreterPluginState, ExtractSelectorLocale<A>>;
|
|
21
21
|
//#endregion
|
|
22
22
|
export { getDictionary };
|
|
23
23
|
//# sourceMappingURL=getDictionary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDictionary.d.ts","names":[],"sources":["../../../src/interpreter/getDictionary.ts"],"mappings":";;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"getDictionary.d.ts","names":[],"sources":["../../../src/interpreter/getDictionary.ts"],"mappings":";;;;;;;;;;;;;;;;;;;cAoCa,sBACL,UAAU,aAAa,gCACvB,UAAU,kBAAkB,qBAAqB,iBAAe,YAE1D,GAAC,mBACM,GAAC,UACV,cACT,qBACD,kCAAkC,GAAG,IACrC,yBACA,sBAAsB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DeepTransformContent, IInterpreterPluginState, Plugins } from "./getContent/plugins.js";
|
|
2
2
|
import "./getContent/index.js";
|
|
3
3
|
import { DictionarySelector } from "@intlayer/types/dictionary";
|
|
4
|
-
import { DeclaredLocales, DictionaryKeys, DictionaryRegistryResult, ExtractSelectorLocale
|
|
4
|
+
import { DeclaredLocales, DictionaryKeys, DictionaryRegistryResult, ExtractSelectorLocale } from "@intlayer/types/module_augmentation";
|
|
5
5
|
//#region src/interpreter/getIntlayer.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* Picks one dictionary by its key and returns its content for the given
|
|
@@ -13,7 +13,7 @@ import { DeclaredLocales, DictionaryKeys, DictionaryRegistryResult, ExtractSelec
|
|
|
13
13
|
* - `{ variant: { id: 'prod_abc', userId: '123' } }` — structured variant
|
|
14
14
|
* - `locale` can be combined with any selector: `{ item: 2, locale: 'fr' }`
|
|
15
15
|
*/
|
|
16
|
-
declare const getIntlayer: <const T extends DictionaryKeys, const A extends
|
|
16
|
+
declare const getIntlayer: <const T extends DictionaryKeys, const A extends DeclaredLocales | DictionarySelector = DeclaredLocales>(key: T, localeOrSelector?: A, plugins?: Plugins[]) => DeepTransformContent<DictionaryRegistryResult<T, A>, IInterpreterPluginState, ExtractSelectorLocale<A>>;
|
|
17
17
|
//#endregion
|
|
18
18
|
export { getIntlayer };
|
|
19
19
|
//# sourceMappingURL=getIntlayer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getIntlayer.d.ts","names":[],"sources":["../../../src/interpreter/getIntlayer.ts"],"mappings":";;;;;;;;;;;;;;;cAkEa,oBACL,UAAU,sBACV,UAAU,
|
|
1
|
+
{"version":3,"file":"getIntlayer.d.ts","names":[],"sources":["../../../src/interpreter/getIntlayer.ts"],"mappings":";;;;;;;;;;;;;;;cAkEa,oBACL,UAAU,sBACV,UAAU,kBAAkB,qBAAqB,iBAAe,KAEjE,GAAC,mBACa,GAAC,UACV,cACT,qBACD,yBAAyB,GAAG,IAC5B,yBACA,sBAAsB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SelectContentStates } from "../transpiler/select/select.js";
|
|
2
|
+
import "../transpiler/index.js";
|
|
3
|
+
//#region src/interpreter/getSelect.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Picks content from a select map based on an arbitrary string value.
|
|
6
|
+
*
|
|
7
|
+
* Resolution order:
|
|
8
|
+
* 1. Exact match on the provided value.
|
|
9
|
+
* 2. The `fallback` key.
|
|
10
|
+
* 3. The `other` key — kept for content imported from an ICU `select` message,
|
|
11
|
+
* where the catch-all case is named `other`.
|
|
12
|
+
* 4. The last declared key, so a select node never resolves to `undefined`.
|
|
13
|
+
*
|
|
14
|
+
* @param selectContent - A map of string cases to content.
|
|
15
|
+
* @param value - The value to match against the declared cases.
|
|
16
|
+
* @returns The matching content.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const content = getSelect({
|
|
21
|
+
* draft: 'This post is a draft',
|
|
22
|
+
* published: 'This post is live',
|
|
23
|
+
* fallback: 'Unknown status',
|
|
24
|
+
* }, 'published');
|
|
25
|
+
* // 'This post is live'
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
declare const getSelect: <const Content>(selectContent: SelectContentStates<Content>, value?: string) => Content;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { getSelect };
|
|
31
|
+
//# sourceMappingURL=getSelect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSelect.d.ts","names":[],"sources":["../../../src/interpreter/getSelect.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;cA0Ba,kBAAmB,SAAO,eACtB,oBAAoB,UAAQ,mBAE1C"}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { getCondition } from "./getCondition.js";
|
|
2
2
|
import { GetNestingResult, getNesting } from "./getNesting.js";
|
|
3
|
-
import { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, PluralCond, TranslationCond, UnionKeys, ValueAtKey, conditionPlugin, enumerationPlugin, fallbackPlugin, filePlugin, genderPlugin, insertionPlugin, nestedPlugin, pluralPlugin, translationPlugin } from "./getContent/plugins.js";
|
|
3
|
+
import { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, PluralCond, SelectCond, SelectSelector, TranslationCond, UnionKeys, ValueAtKey, conditionPlugin, enumerationPlugin, fallbackPlugin, filePlugin, genderPlugin, insertionPlugin, nestedPlugin, pluralPlugin, selectPlugin, translationPlugin } from "./getContent/plugins.js";
|
|
4
4
|
import { deepTransformNode } from "./getContent/deepTransform.js";
|
|
5
5
|
import { getBasePlugins, getContent } from "./getContent/getContent.js";
|
|
6
6
|
import "./getContent/index.js";
|
|
7
7
|
import { getDictionary } from "./getDictionary.js";
|
|
8
8
|
import { findMatchingCondition, getEnumeration } from "./getEnumeration.js";
|
|
9
|
+
import { getGender } from "./getGender.js";
|
|
9
10
|
import { getHTML } from "./getHTML.js";
|
|
10
11
|
import { getInsertion } from "./getInsertion.js";
|
|
11
12
|
import { getIntlayer } from "./getIntlayer.js";
|
|
12
13
|
import { getPlural } from "./getPlural.js";
|
|
14
|
+
import { getSelect } from "./getSelect.js";
|
|
13
15
|
import { getTranslation } from "./getTranslation.js";
|
|
14
16
|
import { InterpolableNode, getInterpolableContent, isInterpolableWrapperNode, rebuildInterpolableContent, transformInterpolableNode } from "./interpolableNode.js";
|
|
15
17
|
import { splitInsertionTemplate } from "./splitAndJoinInsertion.js";
|
|
16
|
-
export { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, GetNestingResult, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, InterpolableNode, IsAny, NestedCond, NodeProps, Plugins, PluralCond, TranslationCond, UnionKeys, ValueAtKey, conditionPlugin, deepTransformNode, enumerationPlugin, fallbackPlugin, filePlugin, findMatchingCondition, genderPlugin, getBasePlugins, getCondition, getContent, getDictionary, getEnumeration, getHTML, getInsertion, getInterpolableContent, getIntlayer, getNesting, getPlural, getTranslation, insertionPlugin, isInterpolableWrapperNode, nestedPlugin, pluralPlugin, rebuildInterpolableContent, splitInsertionTemplate, transformInterpolableNode, translationPlugin };
|
|
18
|
+
export { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, GetNestingResult, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, InterpolableNode, IsAny, NestedCond, NodeProps, Plugins, PluralCond, SelectCond, SelectSelector, TranslationCond, UnionKeys, ValueAtKey, conditionPlugin, deepTransformNode, enumerationPlugin, fallbackPlugin, filePlugin, findMatchingCondition, genderPlugin, getBasePlugins, getCondition, getContent, getDictionary, getEnumeration, getGender, getHTML, getInsertion, getInterpolableContent, getIntlayer, getNesting, getPlural, getSelect, getTranslation, insertionPlugin, isInterpolableWrapperNode, nestedPlugin, pluralPlugin, rebuildInterpolableContent, selectPlugin, splitInsertionTemplate, transformInterpolableNode, translationPlugin };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ICU.d.ts","names":[],"sources":["../../../src/messageFormat/ICU.ts"],"mappings":";;KAkDY,+CAKR;GACG,cAAc;;
|
|
1
|
+
{"version":3,"file":"ICU.d.ts","names":[],"sources":["../../../src/messageFormat/ICU.ts"],"mappings":";;KAkDY,+CAKR;GACG,cAAc;;cAknBR,yBAAsB,SACxB,0BACR;cAQU,yBAAsB,SACxB,0BACR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18next.d.ts","names":[],"sources":["../../../src/messageFormat/i18next.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"i18next.d.ts","names":[],"sources":["../../../src/messageFormat/i18next.ts"],"mappings":";;;cAklBa,6BAA0B,SAC5B,0BACR;cAQU,6BAA0B,SAC5B,cACR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveMessage.d.ts","names":[],"sources":["../../../src/messageFormat/resolveMessage.ts"],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"resolveMessage.d.ts","names":[],"sources":["../../../src/messageFormat/resolveMessage.ts"],"mappings":";;;;;;;;;;;;;;;KAyBY;;KAGA,gBAAgB;;;;;;;;;cAsFf,qBAAkB,kBACb,SACR,eAAa,SACb;;;;;;;;;cAkCG,qBAAkB,eAChB,SACL,eAAa,SACb;;;;;;;;;;;;;;;;;;;cA2JG,iBAAc,kBACT,SACR,eAAa,SACb,eAAa,UACZ;;KAaC;EAEN;EAAa,UAAU;;;;;;;;;cAShB,qBAAkB,oBAAsB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vue-i18n.d.ts","names":[],"sources":["../../../src/messageFormat/vue-i18n.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"vue-i18n.d.ts","names":[],"sources":["../../../src/messageFormat/vue-i18n.ts"],"mappings":";;;cAoVa,6BAA0B,SAC5B,0BACR;cAQU,6BAA0B,SAC5B,cACR"}
|
|
@@ -21,6 +21,8 @@ import { DotPath, NestedContent, NestedContentState, ValidDotPathsFor, nest as n
|
|
|
21
21
|
import "./nesting/index.js";
|
|
22
22
|
import { PluralCategory, PluralContent, PluralContentState, plural } from "./plural/plural.js";
|
|
23
23
|
import "./plural/index.js";
|
|
24
|
+
import { SelectContent, SelectContentStates, select } from "./select/select.js";
|
|
25
|
+
import "./select/index.js";
|
|
24
26
|
import { TranslationContent, t as translation } from "./translation/translation.js";
|
|
25
27
|
import "./translation/index.js";
|
|
26
|
-
export { ConditionContent, ConditionContentStates, DotPath, EnterFormat, EnumerationContent, EnumerationContentState, type FileContent, type FileContentConstructor, Gender, GenderContent, GenderContentStates, HTMLContent, HTMLContentConstructor, HTMLTagsType, HTMLValidationIssue, HTMLValidationResult, HTML_TAGS, InsertionContent, InsertionContentConstructor, MarkdownContent, MarkdownContentConstructor, type HTMLValidationIssue as MarkdownValidationIssue, MarkdownValidationResult, NestedContent, NestedContentState, PluralCategory, PluralContent, PluralContentState, TranslationContent, VOID_HTML_ELEMENTS, ValidDotPathsFor, condition as cond, enumeration as enu, type file, type fileContent, gender, getInsertionValues, getMarkdownMetadata, html, insertion as insert, markdown as md, nesting as nest, plural, translation as t, validateHTML, validateMarkdown };
|
|
28
|
+
export { ConditionContent, ConditionContentStates, DotPath, EnterFormat, EnumerationContent, EnumerationContentState, type FileContent, type FileContentConstructor, Gender, GenderContent, GenderContentStates, HTMLContent, HTMLContentConstructor, HTMLTagsType, HTMLValidationIssue, HTMLValidationResult, HTML_TAGS, InsertionContent, InsertionContentConstructor, MarkdownContent, MarkdownContentConstructor, type HTMLValidationIssue as MarkdownValidationIssue, MarkdownValidationResult, NestedContent, NestedContentState, PluralCategory, PluralContent, PluralContentState, SelectContent, SelectContentStates, TranslationContent, VOID_HTML_ELEMENTS, ValidDotPathsFor, condition as cond, enumeration as enu, type file, type fileContent, gender, getInsertionValues, getMarkdownMetadata, html, insertion as insert, markdown as md, nesting as nest, plural, select, translation as t, validateHTML, validateMarkdown };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { SELECT, TypedNodeModel } from "@intlayer/types/nodeType";
|
|
2
|
+
//#region src/transpiler/select/select.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Map of arbitrary string cases to their content.
|
|
5
|
+
*
|
|
6
|
+
* Every key is a case the application can switch on (`'Draft'`, `'Published'`,
|
|
7
|
+
* `'Scheduled'`, …). The optional `fallback` key is picked when the provided
|
|
8
|
+
* value matches no declared case.
|
|
9
|
+
*/
|
|
10
|
+
type SelectContentStates<Content = unknown> = {
|
|
11
|
+
[caseKey: string]: Content;
|
|
12
|
+
} & {
|
|
13
|
+
fallback?: Content;
|
|
14
|
+
};
|
|
15
|
+
type SelectContent<States extends SelectContentStates = SelectContentStates> = TypedNodeModel<typeof SELECT, States, {
|
|
16
|
+
/**
|
|
17
|
+
* Name of the variable the cases are selected on.
|
|
18
|
+
*
|
|
19
|
+
* Purely informational at runtime — the selector is passed explicitly by
|
|
20
|
+
* the caller. It is preserved so content imported from, or exported to, an
|
|
21
|
+
* ICU `{publishType, select, …}` message keeps its variable name across
|
|
22
|
+
* the round-trip.
|
|
23
|
+
*/
|
|
24
|
+
variable?: string;
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* Function intended to be used to build intlayer dictionaries.
|
|
28
|
+
*
|
|
29
|
+
* Allow to pick a content based on an arbitrary string value — the equivalent
|
|
30
|
+
* of an ICU `{value, select, …}` message, or of a `switch` statement in the
|
|
31
|
+
* application code.
|
|
32
|
+
*
|
|
33
|
+
* Use it when the discriminant is neither a quantity (`enu`), a boolean
|
|
34
|
+
* (`cond`), nor a gender (`gender`).
|
|
35
|
+
*
|
|
36
|
+
* Usage:
|
|
37
|
+
*
|
|
38
|
+
* ```ts
|
|
39
|
+
* select({
|
|
40
|
+
* draft: 'This post is a draft',
|
|
41
|
+
* published: 'This post is live',
|
|
42
|
+
* scheduled: 'This post is scheduled',
|
|
43
|
+
* fallback: 'Unknown status',
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* When no `fallback` key is provided, the last key declared is used as the
|
|
48
|
+
* fallback value — the same contract as `cond()` and `gender()`.
|
|
49
|
+
*
|
|
50
|
+
* Prefer `select()` over indexing a plain object (`content.status[value]`):
|
|
51
|
+
* a dynamic computed access cannot be resolved statically by the Intlayer
|
|
52
|
+
* compiler, which forces the whole branch to be kept and its keys to stay
|
|
53
|
+
* un-minified.
|
|
54
|
+
*
|
|
55
|
+
* @param content - The map of cases to content.
|
|
56
|
+
* @param variable - Optional name of the variable being selected on. Preserved
|
|
57
|
+
* for the ICU / i18next round-trip; unused at runtime.
|
|
58
|
+
*/
|
|
59
|
+
declare const select: <const States extends SelectContentStates>(content?: States, variable?: string) => SelectContent<States>;
|
|
60
|
+
//#endregion
|
|
61
|
+
export { SelectContent, SelectContentStates, select };
|
|
62
|
+
//# sourceMappingURL=select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.d.ts","names":[],"sources":["../../../../src/transpiler/select/select.ts"],"mappings":";;;;;;;;;KAUY,oBAAoB;GAC7B,kBAAkB;;EAEnB,WAAW;;KAGD,cACV,eAAe,sBAAsB,uBACnC,sBACK,QACP;;;;;;;;;EAUE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAqCE,eAAgB,eAAe,qBAAmB,UAC5C,QAAM,sBAEf,cAAc"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/core",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.1.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.",
|
|
6
6
|
"keywords": [
|
|
@@ -172,15 +172,15 @@
|
|
|
172
172
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
173
173
|
},
|
|
174
174
|
"dependencies": {
|
|
175
|
-
"@intlayer/api": "9.
|
|
176
|
-
"@intlayer/config": "9.
|
|
177
|
-
"@intlayer/dictionaries-entry": "9.
|
|
178
|
-
"@intlayer/types": "9.
|
|
179
|
-
"@intlayer/unmerged-dictionaries-entry": "9.
|
|
175
|
+
"@intlayer/api": "9.1.1",
|
|
176
|
+
"@intlayer/config": "9.1.1",
|
|
177
|
+
"@intlayer/dictionaries-entry": "9.1.1",
|
|
178
|
+
"@intlayer/types": "9.1.1",
|
|
179
|
+
"@intlayer/unmerged-dictionaries-entry": "9.1.1",
|
|
180
180
|
"defu": "6.1.7"
|
|
181
181
|
},
|
|
182
182
|
"devDependencies": {
|
|
183
|
-
"@types/node": "26.1.
|
|
183
|
+
"@types/node": "26.1.2",
|
|
184
184
|
"@utils/ts-config": "1.0.4",
|
|
185
185
|
"@utils/ts-config-types": "1.0.4",
|
|
186
186
|
"@utils/tsdown-config": "1.0.4",
|