@intlayer/core 8.12.5-canary.0 → 9.0.0-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/dist/cjs/deepTransformPlugins/getEditedContent.cjs +96 -0
  2. package/dist/cjs/deepTransformPlugins/getEditedContent.cjs.map +1 -0
  3. package/dist/cjs/deepTransformPlugins/index.cjs +3 -0
  4. package/dist/cjs/dictionaryManipulator/index.cjs +18 -0
  5. package/dist/cjs/dictionaryManipulator/mergeDictionaries.cjs +4 -1
  6. package/dist/cjs/dictionaryManipulator/mergeDictionaries.cjs.map +1 -1
  7. package/dist/cjs/dictionaryManipulator/mergeQualifiedDictionaries.cjs +70 -0
  8. package/dist/cjs/dictionaryManipulator/mergeQualifiedDictionaries.cjs.map +1 -0
  9. package/dist/cjs/dictionaryManipulator/qualifiedDictionary.cjs +302 -0
  10. package/dist/cjs/dictionaryManipulator/qualifiedDictionary.cjs.map +1 -0
  11. package/dist/cjs/index.cjs +26 -0
  12. package/dist/cjs/interpreter/getCollection.cjs +25 -0
  13. package/dist/cjs/interpreter/getCollection.cjs.map +1 -0
  14. package/dist/cjs/interpreter/getDictionary.cjs +26 -11
  15. package/dist/cjs/interpreter/getDictionary.cjs.map +1 -1
  16. package/dist/cjs/interpreter/getIntlayer.cjs +16 -3
  17. package/dist/cjs/interpreter/getIntlayer.cjs.map +1 -1
  18. package/dist/cjs/interpreter/getVariant.cjs +30 -0
  19. package/dist/cjs/interpreter/getVariant.cjs.map +1 -0
  20. package/dist/cjs/localization/getBrowserLocale.cjs +1 -1
  21. package/dist/cjs/localization/getBrowserLocale.cjs.map +1 -1
  22. package/dist/cjs/messageFormat/ICU.cjs +32 -2
  23. package/dist/cjs/messageFormat/ICU.cjs.map +1 -1
  24. package/dist/cjs/messageFormat/i18next.cjs +1 -1
  25. package/dist/cjs/messageFormat/i18next.cjs.map +1 -1
  26. package/dist/cjs/messageFormat/index.cjs +5 -0
  27. package/dist/cjs/messageFormat/resolveMessage.cjs +183 -0
  28. package/dist/cjs/messageFormat/resolveMessage.cjs.map +1 -0
  29. package/dist/cjs/messageFormat/vue-i18n.cjs +8 -9
  30. package/dist/cjs/messageFormat/vue-i18n.cjs.map +1 -1
  31. package/dist/cjs/transpiler/collection/collection.cjs +32 -0
  32. package/dist/cjs/transpiler/collection/collection.cjs.map +1 -0
  33. package/dist/cjs/transpiler/collection/index.cjs +4 -0
  34. package/dist/cjs/transpiler/markdown/getMarkdownMetadata.cjs +2 -3
  35. package/dist/cjs/transpiler/markdown/getMarkdownMetadata.cjs.map +1 -1
  36. package/dist/cjs/transpiler/variant/index.cjs +4 -0
  37. package/dist/cjs/transpiler/variant/variant.cjs +35 -0
  38. package/dist/cjs/transpiler/variant/variant.cjs.map +1 -0
  39. package/dist/cjs/utils/parseYaml.cjs +37 -17
  40. package/dist/cjs/utils/parseYaml.cjs.map +1 -1
  41. package/dist/esm/deepTransformPlugins/getEditedContent.mjs +92 -0
  42. package/dist/esm/deepTransformPlugins/getEditedContent.mjs.map +1 -0
  43. package/dist/esm/deepTransformPlugins/index.mjs +2 -1
  44. package/dist/esm/dictionaryManipulator/index.mjs +3 -1
  45. package/dist/esm/dictionaryManipulator/mergeDictionaries.mjs +4 -1
  46. package/dist/esm/dictionaryManipulator/mergeDictionaries.mjs.map +1 -1
  47. package/dist/esm/dictionaryManipulator/mergeQualifiedDictionaries.mjs +68 -0
  48. package/dist/esm/dictionaryManipulator/mergeQualifiedDictionaries.mjs.map +1 -0
  49. package/dist/esm/dictionaryManipulator/qualifiedDictionary.mjs +286 -0
  50. package/dist/esm/dictionaryManipulator/qualifiedDictionary.mjs.map +1 -0
  51. package/dist/esm/index.mjs +5 -1
  52. package/dist/esm/interpreter/getCollection.mjs +23 -0
  53. package/dist/esm/interpreter/getCollection.mjs.map +1 -0
  54. package/dist/esm/interpreter/getDictionary.mjs +26 -11
  55. package/dist/esm/interpreter/getDictionary.mjs.map +1 -1
  56. package/dist/esm/interpreter/getIntlayer.mjs +16 -3
  57. package/dist/esm/interpreter/getIntlayer.mjs.map +1 -1
  58. package/dist/esm/interpreter/getVariant.mjs +28 -0
  59. package/dist/esm/interpreter/getVariant.mjs.map +1 -0
  60. package/dist/esm/localization/getBrowserLocale.mjs +1 -1
  61. package/dist/esm/localization/getBrowserLocale.mjs.map +1 -1
  62. package/dist/esm/messageFormat/ICU.mjs +32 -2
  63. package/dist/esm/messageFormat/ICU.mjs.map +1 -1
  64. package/dist/esm/messageFormat/i18next.mjs +1 -1
  65. package/dist/esm/messageFormat/i18next.mjs.map +1 -1
  66. package/dist/esm/messageFormat/index.mjs +2 -1
  67. package/dist/esm/messageFormat/resolveMessage.mjs +177 -0
  68. package/dist/esm/messageFormat/resolveMessage.mjs.map +1 -0
  69. package/dist/esm/messageFormat/vue-i18n.mjs +8 -9
  70. package/dist/esm/messageFormat/vue-i18n.mjs.map +1 -1
  71. package/dist/esm/transpiler/collection/collection.mjs +30 -0
  72. package/dist/esm/transpiler/collection/collection.mjs.map +1 -0
  73. package/dist/esm/transpiler/collection/index.mjs +3 -0
  74. package/dist/esm/transpiler/markdown/getMarkdownMetadata.mjs +2 -3
  75. package/dist/esm/transpiler/markdown/getMarkdownMetadata.mjs.map +1 -1
  76. package/dist/esm/transpiler/variant/index.mjs +3 -0
  77. package/dist/esm/transpiler/variant/variant.mjs +33 -0
  78. package/dist/esm/transpiler/variant/variant.mjs.map +1 -0
  79. package/dist/esm/utils/parseYaml.mjs +37 -17
  80. package/dist/esm/utils/parseYaml.mjs.map +1 -1
  81. package/dist/types/@intlayer/core/dist/types/formatters/compact.d.ts +1 -0
  82. package/dist/types/@intlayer/core/dist/types/formatters/currency.d.ts +1 -0
  83. package/dist/types/@intlayer/core/dist/types/formatters/date.d.ts +1 -0
  84. package/dist/types/@intlayer/core/dist/types/formatters/index.d.ts +1 -0
  85. package/dist/types/@intlayer/core/dist/types/formatters/list.d.ts +1 -0
  86. package/dist/types/@intlayer/core/dist/types/formatters/number.d.ts +1 -0
  87. package/dist/types/@intlayer/core/dist/types/formatters/percentage.d.ts +1 -0
  88. package/dist/types/@intlayer/core/dist/types/formatters/relativeTime.d.ts +1 -0
  89. package/dist/types/@intlayer/core/dist/types/formatters/units.d.ts +1 -0
  90. package/dist/types/@intlayer/core/dist/types/interpreter/getCondition.d.ts +1 -0
  91. package/dist/types/@intlayer/core/dist/types/interpreter/getContent/deepTransform.d.ts +1 -0
  92. package/dist/types/@intlayer/core/dist/types/interpreter/getContent/getContent.d.ts +2 -0
  93. package/dist/types/@intlayer/core/dist/types/interpreter/getContent/plugins.d.ts +4 -0
  94. package/dist/types/@intlayer/core/dist/types/interpreter/getDictionary.d.ts +2 -0
  95. package/dist/types/@intlayer/core/dist/types/interpreter/getEnumeration.d.ts +1 -0
  96. package/dist/types/@intlayer/core/dist/types/interpreter/getIntlayer.d.ts +2 -0
  97. package/dist/types/@intlayer/core/dist/types/interpreter/getNesting.d.ts +2 -0
  98. package/dist/types/@intlayer/core/dist/types/interpreter/getPlural.d.ts +1 -0
  99. package/dist/types/@intlayer/core/dist/types/interpreter/getTranslation.d.ts +1 -0
  100. package/dist/types/@intlayer/core/dist/types/interpreter/getVariant.d.ts +1 -0
  101. package/dist/types/@intlayer/core/dist/types/interpreter/index.d.ts +1 -0
  102. package/dist/types/@intlayer/core/dist/types/intlayer/dist/types/index.d.ts +1 -0
  103. package/dist/types/@intlayer/core/dist/types/localization/generateSitemap.d.ts +2 -0
  104. package/dist/types/@intlayer/core/dist/types/localization/getBrowserLocale.d.ts +1 -0
  105. package/dist/types/@intlayer/core/dist/types/localization/getHTMLTextDir.d.ts +1 -0
  106. package/dist/types/@intlayer/core/dist/types/localization/getLocale.d.ts +1 -0
  107. package/dist/types/@intlayer/core/dist/types/localization/getLocaleFromPath.d.ts +1 -0
  108. package/dist/types/@intlayer/core/dist/types/localization/getLocaleLang.d.ts +1 -0
  109. package/dist/types/@intlayer/core/dist/types/localization/getLocaleName.d.ts +1 -0
  110. package/dist/types/@intlayer/core/dist/types/localization/getLocalizedUrl.d.ts +1 -0
  111. package/dist/types/@intlayer/core/dist/types/localization/getMultilingualUrls.d.ts +1 -0
  112. package/dist/types/@intlayer/core/dist/types/localization/getPathWithoutLocale.d.ts +1 -0
  113. package/dist/types/@intlayer/core/dist/types/localization/getPrefix.d.ts +3 -0
  114. package/dist/types/@intlayer/core/dist/types/localization/index.d.ts +1 -0
  115. package/dist/types/@intlayer/core/dist/types/localization/localeDetector.d.ts +1 -0
  116. package/dist/types/@intlayer/core/dist/types/localization/localeMapper.d.ts +2 -0
  117. package/dist/types/@intlayer/core/dist/types/localization/localeResolver.d.ts +2 -0
  118. package/dist/types/@intlayer/core/dist/types/localization/rewriteUtils.d.ts +3 -0
  119. package/dist/types/@intlayer/core/dist/types/localization/validatePrefix.d.ts +1 -0
  120. package/dist/types/@intlayer/core/dist/types/markdown/index.d.ts +1 -0
  121. package/dist/types/@intlayer/core/dist/types/transpiler/collection/collection.d.ts +1 -0
  122. package/dist/types/@intlayer/core/dist/types/transpiler/condition/condition.d.ts +1 -0
  123. package/dist/types/@intlayer/core/dist/types/transpiler/enumeration/enumeration.d.ts +1 -0
  124. package/dist/types/@intlayer/core/dist/types/transpiler/file/file.d.ts +1 -0
  125. package/dist/types/@intlayer/core/dist/types/transpiler/gender/gender.d.ts +1 -0
  126. package/dist/types/@intlayer/core/dist/types/transpiler/html/html.d.ts +1 -0
  127. package/dist/types/@intlayer/core/dist/types/transpiler/index.d.ts +1 -0
  128. package/dist/types/@intlayer/core/dist/types/transpiler/insertion/insertion.d.ts +1 -0
  129. package/dist/types/@intlayer/core/dist/types/transpiler/markdown/markdown.d.ts +1 -0
  130. package/dist/types/@intlayer/core/dist/types/transpiler/nesting/nesting.d.ts +2 -0
  131. package/dist/types/@intlayer/core/dist/types/transpiler/plural/plural.d.ts +1 -0
  132. package/dist/types/@intlayer/core/dist/types/transpiler/translation/translation.d.ts +2 -0
  133. package/dist/types/@intlayer/core/dist/types/transpiler/variant/variant.d.ts +1 -0
  134. package/dist/types/@intlayer/core/dist/types/utils/index.d.ts +1 -0
  135. package/dist/types/@intlayer/core/dist/types/utils/intl.d.ts +1 -0
  136. package/dist/types/@intlayer/core/dist/types/utils/isSameKeyPath.d.ts +1 -0
  137. package/dist/types/@intlayer/core/dist/types/utils/localeStorage.d.ts +2 -0
  138. package/dist/types/deepTransformPlugins/getEditedContent.d.ts +33 -0
  139. package/dist/types/deepTransformPlugins/getEditedContent.d.ts.map +1 -0
  140. package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts +6 -3
  141. package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts.map +1 -1
  142. package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts +6 -3
  143. package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts.map +1 -1
  144. package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts +4 -1
  145. package/dist/types/deepTransformPlugins/index.d.ts +2 -1
  146. package/dist/types/dictionaryManipulator/index.d.ts +3 -1
  147. package/dist/types/dictionaryManipulator/mergeQualifiedDictionaries.d.ts +22 -0
  148. package/dist/types/dictionaryManipulator/mergeQualifiedDictionaries.d.ts.map +1 -0
  149. package/dist/types/dictionaryManipulator/qualifiedDictionary.d.ts +176 -0
  150. package/dist/types/dictionaryManipulator/qualifiedDictionary.d.ts.map +1 -0
  151. package/dist/types/index.d.ts +6 -2
  152. package/dist/types/interpreter/getCollection.d.ts +19 -0
  153. package/dist/types/interpreter/getCollection.d.ts.map +1 -0
  154. package/dist/types/interpreter/getDictionary.d.ts +13 -7
  155. package/dist/types/interpreter/getDictionary.d.ts.map +1 -1
  156. package/dist/types/interpreter/getIntlayer.d.ts +13 -2
  157. package/dist/types/interpreter/getIntlayer.d.ts.map +1 -1
  158. package/dist/types/interpreter/getPlural.d.ts +1 -1
  159. package/dist/types/interpreter/getVariant.d.ts +26 -0
  160. package/dist/types/interpreter/getVariant.d.ts.map +1 -0
  161. package/dist/types/intlayer/dist/types/index.d.ts +4 -0
  162. package/dist/types/messageFormat/ICU.d.ts.map +1 -1
  163. package/dist/types/messageFormat/i18next.d.ts.map +1 -1
  164. package/dist/types/messageFormat/index.d.ts +2 -1
  165. package/dist/types/messageFormat/resolveMessage.d.ts +72 -0
  166. package/dist/types/messageFormat/resolveMessage.d.ts.map +1 -0
  167. package/dist/types/messageFormat/vue-i18n.d.ts.map +1 -1
  168. package/dist/types/transpiler/collection/collection.d.ts +34 -0
  169. package/dist/types/transpiler/collection/collection.d.ts.map +1 -0
  170. package/dist/types/transpiler/collection/index.d.ts +2 -0
  171. package/dist/types/transpiler/variant/index.d.ts +2 -0
  172. package/dist/types/transpiler/variant/variant.d.ts +43 -0
  173. package/dist/types/transpiler/variant/variant.d.ts.map +1 -0
  174. package/dist/types/utils/index.d.ts +2 -2
  175. package/dist/types/utils/parseYaml.d.ts +12 -2
  176. package/dist/types/utils/parseYaml.d.ts.map +1 -1
  177. package/package.json +7 -7
@@ -0,0 +1,26 @@
1
+ import { VariantContentState } from "../transpiler/variant/variant.js";
2
+
3
+ //#region src/interpreter/getVariant.d.ts
4
+ /**
5
+ * Resolves a variant node to its selected alternative.
6
+ *
7
+ * Falls back to `control` when the requested `variantKey` does not exist in
8
+ * the node or when no key is specified.
9
+ *
10
+ * @param variantContent - The map of variant alternatives.
11
+ * @param variantKey - Optional name of the alternative to select.
12
+ * @returns The resolved content for the requested variant.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const node = { control: 'Welcome', black_friday: 'Up to 50% off' };
17
+ *
18
+ * getVariant(node); // 'Welcome'
19
+ * getVariant(node, 'black_friday'); // 'Up to 50% off'
20
+ * getVariant(node, 'nonexistent'); // 'Welcome' (fallback to control)
21
+ * ```
22
+ */
23
+ declare const getVariant: <T>(variantContent: VariantContentState<T>, variantKey?: string) => T;
24
+ //#endregion
25
+ export { getVariant };
26
+ //# sourceMappingURL=getVariant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getVariant.d.ts","names":[],"sources":["../../../src/interpreter/getVariant.ts"],"mappings":";;;;;AAqBA;;;;;;;;;;;;;;;;;cAAa,UAAA,MACX,cAAA,EAAgB,mBAAA,CAAoB,CAAA,GACpC,UAAA,cACC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { Dictionary } from "@intlayer/types/dictionary";
2
+ import { LocalesValues as LocalesValues$1 } from "@intlayer/types/module_augmentation";
3
+ import { IntlayerConfig } from "@intlayer/types/config";
4
+ export { type LocalesValues$1 as LocalesValues };
@@ -1 +1 @@
1
- {"version":3,"file":"ICU.d.ts","names":[],"sources":["../../../src/messageFormat/ICU.ts"],"mappings":";;;KA6CY,SAAA,sCAKR,SAAA;EAAA,CACG,GAAA,WAAc,SAAA;AAAA;AAAA,cAkiBR,sBAAA,GACX,OAAA,EAAS,UAAA,gBACR,SAAA;AAAA,cAQU,sBAAA,GACX,OAAA,EAAS,UAAA,gBACR,SAAA"}
1
+ {"version":3,"file":"ICU.d.ts","names":[],"sources":["../../../src/messageFormat/ICU.ts"],"mappings":";;;KAkDY,SAAA,sCAKR,SAAA;EAAA,CACG,GAAA,WAAc,SAAA;AAAA;AAAA,cAwlBR,sBAAA,GACX,OAAA,EAAS,UAAA,gBACR,SAAA;AAAA,cAQU,sBAAA,GACX,OAAA,EAAS,UAAA,gBACR,SAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"i18next.d.ts","names":[],"sources":["../../../src/messageFormat/i18next.ts"],"mappings":";;;;cAqjBa,0BAAA,GACX,OAAA,EAAS,UAAA,gBACR,SAAA;AAAA,cAQU,0BAAA,GACX,OAAA,EAAS,SAAA,KACR,UAAA"}
1
+ {"version":3,"file":"i18next.d.ts","names":[],"sources":["../../../src/messageFormat/i18next.ts"],"mappings":";;;;cAsjBa,0BAAA,GACX,OAAA,EAAS,UAAA,gBACR,SAAA;AAAA,cAQU,0BAAA,GACX,OAAA,EAAS,SAAA,KACR,UAAA"}
@@ -1,5 +1,6 @@
1
1
  import { JsonValue, icuToIntlayerFormatter, intlayerToICUFormatter } from "./ICU.js";
2
2
  import { i18nextToIntlayerFormatter, intlayerToI18nextFormatter } from "./i18next.js";
3
3
  import { PortableObject, intlayerToPortableObjectFormatter, portableObjectToIntlayerFormatter } from "./po.js";
4
+ import { MessageFormatDialect, MessageValues, TaggedMessageToken, interpolateMessage, parseTaggedMessage, resolveMessage, resolveMessageNode } from "./resolveMessage.js";
4
5
  import { intlayerToVueI18nFormatter, vueI18nToIntlayerFormatter } from "./vue-i18n.js";
5
- export { JsonValue, PortableObject, i18nextToIntlayerFormatter, icuToIntlayerFormatter, intlayerToI18nextFormatter, intlayerToICUFormatter, intlayerToPortableObjectFormatter, intlayerToVueI18nFormatter, portableObjectToIntlayerFormatter, vueI18nToIntlayerFormatter };
6
+ export { JsonValue, MessageFormatDialect, MessageValues, PortableObject, TaggedMessageToken, i18nextToIntlayerFormatter, icuToIntlayerFormatter, interpolateMessage, intlayerToI18nextFormatter, intlayerToICUFormatter, intlayerToPortableObjectFormatter, intlayerToVueI18nFormatter, parseTaggedMessage, portableObjectToIntlayerFormatter, resolveMessage, resolveMessageNode, vueI18nToIntlayerFormatter };
@@ -0,0 +1,72 @@
1
+ import { LocalesValues } from "@intlayer/types/module_augmentation";
2
+
3
+ //#region src/messageFormat/resolveMessage.d.ts
4
+ /**
5
+ * Runtime counterpart of the `messageFormat` converters.
6
+ *
7
+ * The converters (`icuToIntlayerFormatter`, `i18nextToIntlayerFormatter`,
8
+ * `vueI18nToIntlayerFormatter`) turn library-specific message syntax into
9
+ * intlayer nodes (`insert`, `plural`, `enu`, `gender`, `html`). This module
10
+ * resolves those nodes — or raw message strings — into a final string using
11
+ * the provided interpolation values and locale.
12
+ *
13
+ * It is the mutualized resolution engine used by the compat adapter packages
14
+ * (`@intlayer/i18next`, `@intlayer/next-intl`, `@intlayer/vue-i18n`, …).
15
+ */
16
+ /** Message syntax dialect of the source i18n library. */
17
+ type MessageFormatDialect = 'icu' | 'i18next' | 'vue-i18n';
18
+ /** Interpolation values passed alongside a translation lookup. */
19
+ type MessageValues = Record<string, unknown>;
20
+ /**
21
+ * Interpolates a message template with values.
22
+ *
23
+ * Handles, in order:
24
+ * 1. Intlayer insertions `{{name}}` (whitespace-tolerant, dotted paths)
25
+ * 2. ICU formatted arguments `{value, number}` / `{ts, date, long}`
26
+ * 3. Bare single-brace arguments `{name}` (ICU / vue-i18n simple args)
27
+ */
28
+ declare const interpolateMessage: (template: string, values?: MessageValues, locale?: LocalesValues) => string;
29
+ /**
30
+ * Resolves an intlayer message node tree (as produced by the
31
+ * `*ToIntlayerFormatter` converters, or already present in a built
32
+ * dictionary) into its final value using interpolation values and locale.
33
+ *
34
+ * Function nodes (produced by the interpreter plugins for `insertion`,
35
+ * `enumeration` and `plural` content) are invoked with the values.
36
+ */
37
+ declare const resolveMessageNode: (node: unknown, values?: MessageValues, locale?: LocalesValues) => unknown;
38
+ /**
39
+ * Resolves a raw message — string in a library dialect, or an intlayer node
40
+ * tree — into a final string using interpolation values and locale.
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * resolveMessage('Hello {name}', { name: 'John' }, 'en', 'icu');
45
+ * // 'Hello John'
46
+ *
47
+ * resolveMessage(
48
+ * '{count, plural, one {# item} other {# items}}',
49
+ * { count: 3 },
50
+ * 'en',
51
+ * 'icu'
52
+ * );
53
+ * // '3 items'
54
+ * ```
55
+ */
56
+ declare const resolveMessage: (message: unknown, values?: MessageValues, locale?: LocalesValues, dialect?: MessageFormatDialect) => string;
57
+ /** A parsed token of a tagged message: plain text or a tag with children. */
58
+ type TaggedMessageToken = string | {
59
+ tag: string;
60
+ children: TaggedMessageToken[];
61
+ };
62
+ /**
63
+ * Tokenizes a message containing XML-like tags (`'Visit <link>the docs</link>'`,
64
+ * `'hello <1>{{name}}</1>'`, `'line<br/>break'`) into a token tree.
65
+ *
66
+ * Used by rich-text renderers (`t.rich`, `<Trans components>`,
67
+ * `<i18n-t>` slots) to map tags to framework elements.
68
+ */
69
+ declare const parseTaggedMessage: (message: string) => TaggedMessageToken[];
70
+ //#endregion
71
+ export { MessageFormatDialect, MessageValues, TaggedMessageToken, interpolateMessage, parseTaggedMessage, resolveMessage, resolveMessageNode };
72
+ //# sourceMappingURL=resolveMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveMessage.d.ts","names":[],"sources":["../../../src/messageFormat/resolveMessage.ts"],"mappings":";;;;;AAwBA;;;;;AAGA;;;;;AAsFA;AAAA,KAzFY,oBAAA;;KAGA,aAAA,GAAgB,MAAA;;;;;;;;AA2H5B;cArCa,kBAAA,GACX,QAAA,UACA,MAAA,GAAQ,aAAA,EACR,MAAA,GAAQ,aAAA;;;;;;;;;cAkCG,kBAAA,GACX,IAAA,WACA,MAAA,GAAQ,aAAA,EACR,MAAA,GAAQ,aAAA;AA6IV;;;;;;;;;;;;;;;;;AAiBA;AAjBA,cAAa,cAAA,GACX,OAAA,WACA,MAAA,GAAQ,aAAA,EACR,MAAA,GAAQ,aAAA,EACR,OAAA,GAAS,oBAAA;;KAaC,kBAAA;EAEN,GAAA;EAAa,QAAA,EAAU,kBAAA;AAAA;;;AAS7B;;;;;cAAa,kBAAA,GAAsB,OAAA,aAAkB,kBAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"vue-i18n.d.ts","names":[],"sources":["../../../src/messageFormat/vue-i18n.ts"],"mappings":";;;;cA2Ta,0BAAA,GACX,OAAA,EAAS,UAAA,gBACR,SAAA;AAAA,cAQU,0BAAA,GACX,OAAA,EAAS,SAAA,KACR,UAAA"}
1
+ {"version":3,"file":"vue-i18n.d.ts","names":[],"sources":["../../../src/messageFormat/vue-i18n.ts"],"mappings":";;;;cAoUa,0BAAA,GACX,OAAA,EAAS,UAAA,gBACR,SAAA;AAAA,cAQU,0BAAA,GACX,OAAA,EAAS,SAAA,KACR,UAAA"}
@@ -0,0 +1,34 @@
1
+ import { COLLECTION } from "@intlayer/types/nodeType";
2
+
3
+ //#region src/transpiler/collection/collection.d.ts
4
+ /**
5
+ * Shape of a collection node stored in the dictionary JSON.
6
+ * Items may contain any other node type (translations, conditions, etc.).
7
+ */
8
+ type CollectionContent<T = unknown> = {
9
+ nodeType: typeof COLLECTION;
10
+ collection: T[];
11
+ };
12
+ /**
13
+ * Declares an ordered list of content items inside a dictionary.
14
+ *
15
+ * At runtime, `useIntlayer('my-key')` returns all items as an array.
16
+ * `useIntlayer('my-key', { item: 2 })` returns only the item at index 2.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * import { t, collection } from 'intlayer';
21
+ *
22
+ * export default {
23
+ * key: 'faq',
24
+ * content: collection([
25
+ * { question: t({ en: 'What is Intlayer?' }), answer: t({ en: '...' }) },
26
+ * { question: t({ en: 'Is it free?' }), answer: t({ en: '...' }) },
27
+ * ]),
28
+ * } satisfies Dictionary;
29
+ * ```
30
+ */
31
+ declare const collection: <T>(items: T[]) => CollectionContent<T>;
32
+ //#endregion
33
+ export { CollectionContent, collection };
34
+ //# sourceMappingURL=collection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collection.d.ts","names":[],"sources":["../../../../src/transpiler/collection/collection.ts"],"mappings":";;;;;AAMA;;KAAY,iBAAA;EACV,QAAA,SAAiB,UAAA;EACjB,UAAA,EAAY,CAAA;AAAA;;;;;;AAsBd;;;;;;;;;;;;;;cAAa,UAAA,MAAiB,KAAA,EAAO,CAAA,OAAM,iBAAA,CAAkB,CAAA"}
@@ -0,0 +1,2 @@
1
+ import { CollectionContent, collection } from "./collection.js";
2
+ export { CollectionContent, collection };
@@ -0,0 +1,2 @@
1
+ import { VariantContent, VariantContentState, variant } from "./variant.js";
2
+ export { VariantContent, VariantContentState, variant };
@@ -0,0 +1,43 @@
1
+ import { VARIANT } from "@intlayer/types/nodeType";
2
+
3
+ //#region src/transpiler/variant/variant.d.ts
4
+ /**
5
+ * Shape of a variant node stored in the dictionary JSON.
6
+ * `control` is the mandatory default/fallback key; all other keys are
7
+ * optional named experiment branches.
8
+ */
9
+ type VariantContentState<T = unknown> = {
10
+ control: T;
11
+ } & Record<string, T>;
12
+ type VariantContent<T = unknown> = {
13
+ nodeType: typeof VARIANT;
14
+ variant: VariantContentState<T>;
15
+ };
16
+ /**
17
+ * Declares a set of named content alternatives for A/B testing or feature flags.
18
+ *
19
+ * The `control` key is mandatory and acts as the default when no variant is
20
+ * selected. At runtime, `useIntlayer('my-key')` returns the `control` variant.
21
+ * `useIntlayer('my-key', { variant: 'black_friday' })` returns that variant.
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * import { t, variant } from 'intlayer';
26
+ *
27
+ * export default {
28
+ * key: 'hero-banner',
29
+ * content: {
30
+ * headline: variant({
31
+ * control: t({ en: 'Welcome', fr: 'Bienvenue' }),
32
+ * black_friday: t({ en: 'Up to 50% off', fr: 'Jusqu\'à -50 %' }),
33
+ * }),
34
+ * },
35
+ * } satisfies Dictionary;
36
+ * ```
37
+ */
38
+ declare const variant: <T>(variants: {
39
+ control: T;
40
+ } & Partial<Record<string, T>>) => VariantContent<T>;
41
+ //#endregion
42
+ export { VariantContent, VariantContentState, variant };
43
+ //# sourceMappingURL=variant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variant.d.ts","names":[],"sources":["../../../../src/transpiler/variant/variant.ts"],"mappings":";;;;;AAOA;;;KAAY,mBAAA;EAAqC,OAAA,EAAS,CAAA;AAAA,IAAM,MAAA,SAE9D,CAAA;AAAA,KAGU,cAAA;EACV,QAAA,SAAiB,OAAA;EACjB,OAAA,EAAS,mBAAA,CAAoB,CAAA;AAAA;;;;;;AAF/B;;;;;;;;;;;;;;;;AA2BA;cAAa,OAAA,MACX,QAAA;EAAY,OAAA,EAAS,CAAA;AAAA,IAAM,OAAA,CAAQ,MAAA,SAAe,CAAA,OACjD,cAAA,CAAe,CAAA"}
@@ -4,6 +4,6 @@ import { getCookie } from "./getCookie.js";
4
4
  import { isSameKeyPath } from "./isSameKeyPath.js";
5
5
  import { isValidElement } from "./isValidReactElement.js";
6
6
  import { CookieBuildAttributes, LocaleStorage, LocaleStorageClient, LocaleStorageClientOptions, LocaleStorageOptions, LocaleStorageServer, LocaleStorageServerOptions, getLocaleFromStorage, getLocaleFromStorageClient, getLocaleFromStorageServer, localeStorageOptions, setLocaleInStorage, setLocaleInStorageClient, setLocaleInStorageServer } from "./localeStorage.js";
7
- import { parseYaml } from "./parseYaml.js";
7
+ import { YamlRecord, YamlValue, parseYaml } from "./parseYaml.js";
8
8
  import { stringifyYaml } from "./stringifyYaml.js";
9
- export { CachedIntl, CachedIntl as Intl, CookieBuildAttributes, LocaleStorage, LocaleStorageClient, LocaleStorageClientOptions, LocaleStorageOptions, LocaleStorageServer, LocaleStorageServerOptions, WrappedIntl, bindIntl, checkIsURLAbsolute, getCachedIntl, getCookie, getLocaleFromStorage, getLocaleFromStorageClient, getLocaleFromStorageServer, isSameKeyPath, isValidElement, localeStorageOptions, parseYaml, setLocaleInStorage, setLocaleInStorageClient, setLocaleInStorageServer, stringifyYaml };
9
+ export { CachedIntl, CachedIntl as Intl, CookieBuildAttributes, LocaleStorage, LocaleStorageClient, LocaleStorageClientOptions, LocaleStorageOptions, LocaleStorageServer, LocaleStorageServerOptions, WrappedIntl, YamlRecord, YamlValue, bindIntl, checkIsURLAbsolute, getCachedIntl, getCookie, getLocaleFromStorage, getLocaleFromStorageClient, getLocaleFromStorageServer, isSameKeyPath, isValidElement, localeStorageOptions, parseYaml, setLocaleInStorage, setLocaleInStorageClient, setLocaleInStorageServer, stringifyYaml };
@@ -1,5 +1,15 @@
1
1
  //#region src/utils/parseYaml.d.ts
2
- declare const parseYaml: <T = any>(input: string) => T | null;
2
+ interface YamlRecord {
3
+ [key: string]: YamlValue;
4
+ }
5
+ type YamlValue = string | number | YamlValue[] | YamlRecord;
6
+ /**
7
+ * Parses a YAML/JSON-like string into a typed value.
8
+ * Supports scalars, quoted strings, inline arrays/objects, and indented YAML syntax.
9
+ * Boolean/null literals (true, false, null, yes, no, etc.) are preserved as strings,
10
+ * not coerced to their native JS equivalents.
11
+ */
12
+ declare const parseYaml: <T = YamlValue>(input: string) => T | null;
3
13
  //#endregion
4
- export { parseYaml };
14
+ export { YamlRecord, YamlValue, parseYaml };
5
15
  //# sourceMappingURL=parseYaml.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parseYaml.d.ts","names":[],"sources":["../../../src/utils/parseYaml.ts"],"mappings":";cAca,SAAA,YAAsB,KAAA,aAAgB,CAAA"}
1
+ {"version":3,"file":"parseYaml.d.ts","names":[],"sources":["../../../src/utils/parseYaml.ts"],"mappings":";UAciB,UAAA;EAAA,CACd,GAAA,WAAc,SAAA;AAAA;AAAA,KAEL,SAAA,qBAA8B,SAAA,KAAc,UAAA;;;AAAxD;;;;cAQa,SAAA,OAAiB,SAAA,EAAW,KAAA,aAAgB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/core",
3
- "version": "8.12.5-canary.0",
3
+ "version": "9.0.0-canary.0",
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": "8.12.5-canary.0",
176
- "@intlayer/config": "8.12.5-canary.0",
177
- "@intlayer/dictionaries-entry": "8.12.5-canary.0",
178
- "@intlayer/types": "8.12.5-canary.0",
179
- "@intlayer/unmerged-dictionaries-entry": "8.12.5-canary.0",
175
+ "@intlayer/api": "9.0.0-canary.0",
176
+ "@intlayer/config": "9.0.0-canary.0",
177
+ "@intlayer/dictionaries-entry": "9.0.0-canary.0",
178
+ "@intlayer/types": "9.0.0-canary.0",
179
+ "@intlayer/unmerged-dictionaries-entry": "9.0.0-canary.0",
180
180
  "defu": "6.1.7"
181
181
  },
182
182
  "devDependencies": {
183
- "@types/node": "25.9.2",
183
+ "@types/node": "25.9.3",
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",