react-intlayer 6.1.6-canary.0 → 7.0.0-canary.2

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 (351) hide show
  1. package/dist/cjs/IntlayerNode.cjs +17 -46
  2. package/dist/cjs/IntlayerNode.cjs.map +1 -1
  3. package/dist/cjs/UI/ContentSelector.cjs +96 -128
  4. package/dist/cjs/UI/ContentSelector.cjs.map +1 -1
  5. package/dist/cjs/_virtual/rolldown_runtime.cjs +25 -0
  6. package/dist/cjs/client/IntlayerProvider.cjs +64 -93
  7. package/dist/cjs/client/IntlayerProvider.cjs.map +1 -1
  8. package/dist/cjs/client/format/index.cjs +17 -50
  9. package/dist/cjs/client/format/useCompact.cjs +29 -39
  10. package/dist/cjs/client/format/useCompact.cjs.map +1 -1
  11. package/dist/cjs/client/format/useCurrency.cjs +43 -39
  12. package/dist/cjs/client/format/useCurrency.cjs.map +1 -1
  13. package/dist/cjs/client/format/useDate.cjs +45 -36
  14. package/dist/cjs/client/format/useDate.cjs.map +1 -1
  15. package/dist/cjs/client/format/useList.cjs +40 -39
  16. package/dist/cjs/client/format/useList.cjs.map +1 -1
  17. package/dist/cjs/client/format/useNumber.cjs +41 -39
  18. package/dist/cjs/client/format/useNumber.cjs.map +1 -1
  19. package/dist/cjs/client/format/usePercentage.cjs +37 -39
  20. package/dist/cjs/client/format/usePercentage.cjs.map +1 -1
  21. package/dist/cjs/client/format/useRelativeTime.cjs +37 -39
  22. package/dist/cjs/client/format/useRelativeTime.cjs.map +1 -1
  23. package/dist/cjs/client/format/useUnit.cjs +36 -39
  24. package/dist/cjs/client/format/useUnit.cjs.map +1 -1
  25. package/dist/cjs/client/index.cjs +31 -72
  26. package/dist/cjs/client/t.cjs +21 -34
  27. package/dist/cjs/client/t.cjs.map +1 -1
  28. package/dist/cjs/client/useDictionary.cjs +26 -36
  29. package/dist/cjs/client/useDictionary.cjs.map +1 -1
  30. package/dist/cjs/client/useDictionaryAsync.cjs +23 -52
  31. package/dist/cjs/client/useDictionaryAsync.cjs.map +1 -1
  32. package/dist/cjs/client/useDictionaryDynamic.cjs +24 -53
  33. package/dist/cjs/client/useDictionaryDynamic.cjs.map +1 -1
  34. package/dist/cjs/client/useI18n.cjs +45 -55
  35. package/dist/cjs/client/useI18n.cjs.map +1 -1
  36. package/dist/cjs/client/useIntlayer.cjs +28 -36
  37. package/dist/cjs/client/useIntlayer.cjs.map +1 -1
  38. package/dist/cjs/client/useLoadDynamic.cjs +21 -50
  39. package/dist/cjs/client/useLoadDynamic.cjs.map +1 -1
  40. package/dist/cjs/client/useLocale.cjs +39 -70
  41. package/dist/cjs/client/useLocale.cjs.map +1 -1
  42. package/dist/cjs/client/useLocaleBase.cjs +25 -53
  43. package/dist/cjs/client/useLocaleBase.cjs.map +1 -1
  44. package/dist/cjs/client/useLocaleStorage.cjs +63 -0
  45. package/dist/cjs/client/useLocaleStorage.cjs.map +1 -0
  46. package/dist/cjs/client/useTraduction.cjs +34 -35
  47. package/dist/cjs/client/useTraduction.cjs.map +1 -1
  48. package/dist/cjs/editor/ContentSelectorWrapper.cjs +55 -91
  49. package/dist/cjs/editor/ContentSelectorWrapper.cjs.map +1 -1
  50. package/dist/cjs/editor/IntlayerEditorProvider.cjs +45 -92
  51. package/dist/cjs/editor/IntlayerEditorProvider.cjs.map +1 -1
  52. package/dist/cjs/editor/index.cjs +3 -23
  53. package/dist/cjs/editor/useEditedContentRenderer.cjs +40 -59
  54. package/dist/cjs/editor/useEditedContentRenderer.cjs.map +1 -1
  55. package/dist/cjs/getDictionary.cjs +15 -40
  56. package/dist/cjs/getDictionary.cjs.map +1 -1
  57. package/dist/cjs/getIntlayer.cjs +15 -36
  58. package/dist/cjs/getIntlayer.cjs.map +1 -1
  59. package/dist/cjs/index.cjs +33 -75
  60. package/dist/cjs/markdown/MarkdownProvider.cjs +19 -39
  61. package/dist/cjs/markdown/MarkdownProvider.cjs.map +1 -1
  62. package/dist/cjs/markdown/MarkdownRenderer.cjs +39 -80
  63. package/dist/cjs/markdown/MarkdownRenderer.cjs.map +1 -1
  64. package/dist/cjs/markdown/index.cjs +7 -25
  65. package/dist/cjs/plugins.cjs +92 -119
  66. package/dist/cjs/plugins.cjs.map +1 -1
  67. package/dist/cjs/reactElement/renderReactElement.cjs +39 -59
  68. package/dist/cjs/reactElement/renderReactElement.cjs.map +1 -1
  69. package/dist/cjs/server/IntlayerServerProvider.cjs +33 -53
  70. package/dist/cjs/server/IntlayerServerProvider.cjs.map +1 -1
  71. package/dist/cjs/server/format/index.cjs +17 -50
  72. package/dist/cjs/server/format/useCompact.cjs +25 -35
  73. package/dist/cjs/server/format/useCompact.cjs.map +1 -1
  74. package/dist/cjs/server/format/useCurrency.cjs +36 -35
  75. package/dist/cjs/server/format/useCurrency.cjs.map +1 -1
  76. package/dist/cjs/server/format/useDate.cjs +41 -35
  77. package/dist/cjs/server/format/useDate.cjs.map +1 -1
  78. package/dist/cjs/server/format/useList.cjs +33 -35
  79. package/dist/cjs/server/format/useList.cjs.map +1 -1
  80. package/dist/cjs/server/format/useNumber.cjs +37 -35
  81. package/dist/cjs/server/format/useNumber.cjs.map +1 -1
  82. package/dist/cjs/server/format/usePercentage.cjs +33 -35
  83. package/dist/cjs/server/format/usePercentage.cjs.map +1 -1
  84. package/dist/cjs/server/format/useRelativeTime.cjs +33 -35
  85. package/dist/cjs/server/format/useRelativeTime.cjs.map +1 -1
  86. package/dist/cjs/server/format/useUnit.cjs +32 -35
  87. package/dist/cjs/server/format/useUnit.cjs.map +1 -1
  88. package/dist/cjs/server/index.cjs +21 -57
  89. package/dist/cjs/server/serverContext.cjs +40 -71
  90. package/dist/cjs/server/serverContext.cjs.map +1 -1
  91. package/dist/cjs/server/t.cjs +33 -33
  92. package/dist/cjs/server/t.cjs.map +1 -1
  93. package/dist/cjs/server/useDictionary.cjs +14 -32
  94. package/dist/cjs/server/useDictionary.cjs.map +1 -1
  95. package/dist/cjs/server/useDictionaryAsync.cjs +18 -44
  96. package/dist/cjs/server/useDictionaryAsync.cjs.map +1 -1
  97. package/dist/cjs/server/useDictionaryDynamic.cjs +19 -48
  98. package/dist/cjs/server/useDictionaryDynamic.cjs.map +1 -1
  99. package/dist/cjs/server/useI18n.cjs +35 -47
  100. package/dist/cjs/server/useI18n.cjs.map +1 -1
  101. package/dist/cjs/server/useIntlayer.cjs +14 -32
  102. package/dist/cjs/server/useIntlayer.cjs.map +1 -1
  103. package/dist/cjs/server/useLoadDynamic.cjs +11 -41
  104. package/dist/cjs/server/useLoadDynamic.cjs.map +1 -1
  105. package/dist/cjs/server/useLocale.cjs +21 -43
  106. package/dist/cjs/server/useLocale.cjs.map +1 -1
  107. package/dist/esm/IntlayerNode.mjs +13 -23
  108. package/dist/esm/IntlayerNode.mjs.map +1 -1
  109. package/dist/esm/UI/ContentSelector.mjs +92 -108
  110. package/dist/esm/UI/ContentSelector.mjs.map +1 -1
  111. package/dist/esm/client/IntlayerProvider.mjs +49 -53
  112. package/dist/esm/client/IntlayerProvider.mjs.map +1 -1
  113. package/dist/esm/client/format/index.mjs +2 -11
  114. package/dist/esm/client/format/useCompact.mjs +25 -14
  115. package/dist/esm/client/format/useCompact.mjs.map +1 -1
  116. package/dist/esm/client/format/useCurrency.mjs +39 -14
  117. package/dist/esm/client/format/useCurrency.mjs.map +1 -1
  118. package/dist/esm/client/format/useDate.mjs +41 -11
  119. package/dist/esm/client/format/useDate.mjs.map +1 -1
  120. package/dist/esm/client/format/useList.mjs +36 -14
  121. package/dist/esm/client/format/useList.mjs.map +1 -1
  122. package/dist/esm/client/format/useNumber.mjs +37 -14
  123. package/dist/esm/client/format/useNumber.mjs.map +1 -1
  124. package/dist/esm/client/format/usePercentage.mjs +33 -14
  125. package/dist/esm/client/format/usePercentage.mjs.map +1 -1
  126. package/dist/esm/client/format/useRelativeTime.mjs +33 -14
  127. package/dist/esm/client/format/useRelativeTime.mjs.map +1 -1
  128. package/dist/esm/client/format/useUnit.mjs +32 -14
  129. package/dist/esm/client/format/useUnit.mjs.map +1 -1
  130. package/dist/esm/client/index.mjs +5 -33
  131. package/dist/esm/client/t.mjs +17 -9
  132. package/dist/esm/client/t.mjs.map +1 -1
  133. package/dist/esm/client/useDictionary.mjs +23 -11
  134. package/dist/esm/client/useDictionary.mjs.map +1 -1
  135. package/dist/esm/client/useDictionaryAsync.mjs +18 -16
  136. package/dist/esm/client/useDictionaryAsync.mjs.map +1 -1
  137. package/dist/esm/client/useDictionaryDynamic.mjs +18 -16
  138. package/dist/esm/client/useDictionaryDynamic.mjs.map +1 -1
  139. package/dist/esm/client/useI18n.mjs +41 -30
  140. package/dist/esm/client/useI18n.mjs.map +1 -1
  141. package/dist/esm/client/useIntlayer.mjs +25 -11
  142. package/dist/esm/client/useIntlayer.mjs.map +1 -1
  143. package/dist/esm/client/useLoadDynamic.mjs +20 -26
  144. package/dist/esm/client/useLoadDynamic.mjs.map +1 -1
  145. package/dist/esm/client/useLocale.mjs +35 -35
  146. package/dist/esm/client/useLocale.mjs.map +1 -1
  147. package/dist/esm/client/useLocaleBase.mjs +20 -17
  148. package/dist/esm/client/useLocaleBase.mjs.map +1 -1
  149. package/dist/esm/client/useLocaleStorage.mjs +55 -0
  150. package/dist/esm/client/useLocaleStorage.mjs.map +1 -0
  151. package/dist/esm/client/useTraduction.mjs +30 -10
  152. package/dist/esm/client/useTraduction.mjs.map +1 -1
  153. package/dist/esm/editor/ContentSelectorWrapper.mjs +48 -70
  154. package/dist/esm/editor/ContentSelectorWrapper.mjs.map +1 -1
  155. package/dist/esm/editor/IntlayerEditorProvider.mjs +39 -61
  156. package/dist/esm/editor/IntlayerEditorProvider.mjs.map +1 -1
  157. package/dist/esm/editor/index.mjs +3 -2
  158. package/dist/esm/editor/useEditedContentRenderer.mjs +33 -32
  159. package/dist/esm/editor/useEditedContentRenderer.mjs.map +1 -1
  160. package/dist/esm/getDictionary.mjs +13 -22
  161. package/dist/esm/getDictionary.mjs.map +1 -1
  162. package/dist/esm/getIntlayer.mjs +13 -18
  163. package/dist/esm/getIntlayer.mjs.map +1 -1
  164. package/dist/esm/index.mjs +6 -35
  165. package/dist/esm/markdown/MarkdownProvider.mjs +14 -16
  166. package/dist/esm/markdown/MarkdownProvider.mjs.map +1 -1
  167. package/dist/esm/markdown/MarkdownRenderer.mjs +34 -57
  168. package/dist/esm/markdown/MarkdownRenderer.mjs.map +1 -1
  169. package/dist/esm/markdown/index.mjs +4 -3
  170. package/dist/esm/plugins.mjs +82 -92
  171. package/dist/esm/plugins.mjs.map +1 -1
  172. package/dist/esm/reactElement/renderReactElement.mjs +36 -34
  173. package/dist/esm/reactElement/renderReactElement.mjs.map +1 -1
  174. package/dist/esm/server/IntlayerServerProvider.mjs +22 -11
  175. package/dist/esm/server/IntlayerServerProvider.mjs.map +1 -1
  176. package/dist/esm/server/format/index.mjs +2 -11
  177. package/dist/esm/server/format/useCompact.mjs +22 -10
  178. package/dist/esm/server/format/useCompact.mjs.map +1 -1
  179. package/dist/esm/server/format/useCurrency.mjs +33 -10
  180. package/dist/esm/server/format/useCurrency.mjs.map +1 -1
  181. package/dist/esm/server/format/useDate.mjs +38 -10
  182. package/dist/esm/server/format/useDate.mjs.map +1 -1
  183. package/dist/esm/server/format/useList.mjs +30 -10
  184. package/dist/esm/server/format/useList.mjs.map +1 -1
  185. package/dist/esm/server/format/useNumber.mjs +34 -10
  186. package/dist/esm/server/format/useNumber.mjs.map +1 -1
  187. package/dist/esm/server/format/usePercentage.mjs +30 -10
  188. package/dist/esm/server/format/usePercentage.mjs.map +1 -1
  189. package/dist/esm/server/format/useRelativeTime.mjs +30 -10
  190. package/dist/esm/server/format/useRelativeTime.mjs.map +1 -1
  191. package/dist/esm/server/format/useUnit.mjs +29 -10
  192. package/dist/esm/server/format/useUnit.mjs.map +1 -1
  193. package/dist/esm/server/index.mjs +4 -20
  194. package/dist/esm/server/serverContext.mjs +36 -35
  195. package/dist/esm/server/serverContext.mjs.map +1 -1
  196. package/dist/esm/server/t.mjs +30 -8
  197. package/dist/esm/server/t.mjs.map +1 -1
  198. package/dist/esm/server/useDictionary.mjs +12 -6
  199. package/dist/esm/server/useDictionary.mjs.map +1 -1
  200. package/dist/esm/server/useDictionaryAsync.mjs +14 -8
  201. package/dist/esm/server/useDictionaryAsync.mjs.map +1 -1
  202. package/dist/esm/server/useDictionaryDynamic.mjs +14 -11
  203. package/dist/esm/server/useDictionaryDynamic.mjs.map +1 -1
  204. package/dist/esm/server/useI18n.mjs +33 -21
  205. package/dist/esm/server/useI18n.mjs.map +1 -1
  206. package/dist/esm/server/useIntlayer.mjs +12 -6
  207. package/dist/esm/server/useIntlayer.mjs.map +1 -1
  208. package/dist/esm/server/useLoadDynamic.mjs +8 -6
  209. package/dist/esm/server/useLoadDynamic.mjs.map +1 -1
  210. package/dist/esm/server/useLocale.mjs +18 -8
  211. package/dist/esm/server/useLocale.mjs.map +1 -1
  212. package/dist/types/IntlayerNode.d.ts +19 -12
  213. package/dist/types/IntlayerNode.d.ts.map +1 -1
  214. package/dist/types/UI/ContentSelector.d.ts +12 -9
  215. package/dist/types/UI/ContentSelector.d.ts.map +1 -1
  216. package/dist/types/client/IntlayerProvider.d.ts +21 -15
  217. package/dist/types/client/IntlayerProvider.d.ts.map +1 -1
  218. package/dist/types/client/format/index.d.ts +9 -9
  219. package/dist/types/client/format/useCompact.d.ts +8 -2
  220. package/dist/types/client/format/useCompact.d.ts.map +1 -1
  221. package/dist/types/client/format/useCurrency.d.ts +8 -2
  222. package/dist/types/client/format/useCurrency.d.ts.map +1 -1
  223. package/dist/types/client/format/useDate.d.ts +7 -2
  224. package/dist/types/client/format/useDate.d.ts.map +1 -1
  225. package/dist/types/client/format/useList.d.ts +8 -2
  226. package/dist/types/client/format/useList.d.ts.map +1 -1
  227. package/dist/types/client/format/useNumber.d.ts +8 -2
  228. package/dist/types/client/format/useNumber.d.ts.map +1 -1
  229. package/dist/types/client/format/usePercentage.d.ts +8 -2
  230. package/dist/types/client/format/usePercentage.d.ts.map +1 -1
  231. package/dist/types/client/format/useRelativeTime.d.ts +9 -3
  232. package/dist/types/client/format/useRelativeTime.d.ts.map +1 -1
  233. package/dist/types/client/format/useUnit.d.ts +8 -2
  234. package/dist/types/client/format/useUnit.d.ts.map +1 -1
  235. package/dist/types/client/index.d.ts +12 -19
  236. package/dist/types/client/t.d.ts +7 -3
  237. package/dist/types/client/t.d.ts.map +1 -1
  238. package/dist/types/client/useDictionary.d.ts +9 -3
  239. package/dist/types/client/useDictionary.d.ts.map +1 -1
  240. package/dist/types/client/useDictionaryAsync.d.ts +7 -3
  241. package/dist/types/client/useDictionaryAsync.d.ts.map +1 -1
  242. package/dist/types/client/useDictionaryDynamic.d.ts +9 -3
  243. package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -1
  244. package/dist/types/client/useI18n.d.ts +9 -5
  245. package/dist/types/client/useI18n.d.ts.map +1 -1
  246. package/dist/types/client/useIntlayer.d.ts +10 -5
  247. package/dist/types/client/useIntlayer.d.ts.map +1 -1
  248. package/dist/types/client/useLoadDynamic.d.ts +4 -1
  249. package/dist/types/client/useLoadDynamic.d.ts.map +1 -1
  250. package/dist/types/client/useLocale.d.ts +18 -10
  251. package/dist/types/client/useLocale.d.ts.map +1 -1
  252. package/dist/types/client/useLocaleBase.d.ts +10 -5
  253. package/dist/types/client/useLocaleBase.d.ts.map +1 -1
  254. package/dist/types/client/useLocaleStorage.d.ts +49 -0
  255. package/dist/types/client/useLocaleStorage.d.ts.map +1 -0
  256. package/dist/types/client/useTraduction.d.ts +7 -2
  257. package/dist/types/client/useTraduction.d.ts.map +1 -1
  258. package/dist/types/editor/ContentSelectorWrapper.d.ts +8 -4
  259. package/dist/types/editor/ContentSelectorWrapper.d.ts.map +1 -1
  260. package/dist/types/editor/IntlayerEditorProvider.d.ts +6 -2
  261. package/dist/types/editor/IntlayerEditorProvider.d.ts.map +1 -1
  262. package/dist/types/editor/index.d.ts +2 -2
  263. package/dist/types/editor/useEditedContentRenderer.d.ts +16 -10
  264. package/dist/types/editor/useEditedContentRenderer.d.ts.map +1 -1
  265. package/dist/types/getDictionary.d.ts +8 -4
  266. package/dist/types/getDictionary.d.ts.map +1 -1
  267. package/dist/types/getIntlayer.d.ts +8 -4
  268. package/dist/types/getIntlayer.d.ts.map +1 -1
  269. package/dist/types/index.d.ts +19 -17
  270. package/dist/types/index.d.ts.map +1 -1
  271. package/dist/types/markdown/MarkdownProvider.d.ts +8 -5
  272. package/dist/types/markdown/MarkdownProvider.d.ts.map +1 -1
  273. package/dist/types/markdown/MarkdownRenderer.d.ts +13 -11
  274. package/dist/types/markdown/MarkdownRenderer.d.ts.map +1 -1
  275. package/dist/types/markdown/index.d.ts +3 -3
  276. package/dist/types/plugins.d.ts +33 -27
  277. package/dist/types/plugins.d.ts.map +1 -1
  278. package/dist/types/reactElement/renderReactElement.d.ts +7 -2
  279. package/dist/types/reactElement/renderReactElement.d.ts.map +1 -1
  280. package/dist/types/server/IntlayerServerProvider.d.ts +25 -19
  281. package/dist/types/server/IntlayerServerProvider.d.ts.map +1 -1
  282. package/dist/types/server/format/index.d.ts +9 -9
  283. package/dist/types/server/format/useCompact.d.ts +7 -2
  284. package/dist/types/server/format/useCompact.d.ts.map +1 -1
  285. package/dist/types/server/format/useCurrency.d.ts +7 -2
  286. package/dist/types/server/format/useCurrency.d.ts.map +1 -1
  287. package/dist/types/server/format/useDate.d.ts +7 -2
  288. package/dist/types/server/format/useDate.d.ts.map +1 -1
  289. package/dist/types/server/format/useList.d.ts +7 -2
  290. package/dist/types/server/format/useList.d.ts.map +1 -1
  291. package/dist/types/server/format/useNumber.d.ts +7 -2
  292. package/dist/types/server/format/useNumber.d.ts.map +1 -1
  293. package/dist/types/server/format/usePercentage.d.ts +7 -2
  294. package/dist/types/server/format/usePercentage.d.ts.map +1 -1
  295. package/dist/types/server/format/useRelativeTime.d.ts +7 -2
  296. package/dist/types/server/format/useRelativeTime.d.ts.map +1 -1
  297. package/dist/types/server/format/useUnit.d.ts +7 -2
  298. package/dist/types/server/format/useUnit.d.ts.map +1 -1
  299. package/dist/types/server/index.d.ts +10 -10
  300. package/dist/types/server/serverContext.d.ts +23 -27
  301. package/dist/types/server/serverContext.d.ts.map +1 -1
  302. package/dist/types/server/t.d.ts +7 -3
  303. package/dist/types/server/t.d.ts.map +1 -1
  304. package/dist/types/server/useDictionary.d.ts +9 -3
  305. package/dist/types/server/useDictionary.d.ts.map +1 -1
  306. package/dist/types/server/useDictionaryAsync.d.ts +9 -3
  307. package/dist/types/server/useDictionaryAsync.d.ts.map +1 -1
  308. package/dist/types/server/useDictionaryDynamic.d.ts +9 -3
  309. package/dist/types/server/useDictionaryDynamic.d.ts.map +1 -1
  310. package/dist/types/server/useI18n.d.ts +9 -5
  311. package/dist/types/server/useI18n.d.ts.map +1 -1
  312. package/dist/types/server/useIntlayer.d.ts +9 -3
  313. package/dist/types/server/useIntlayer.d.ts.map +1 -1
  314. package/dist/types/server/useLoadDynamic.d.ts +4 -1
  315. package/dist/types/server/useLoadDynamic.d.ts.map +1 -1
  316. package/dist/types/server/useLocale.d.ts +11 -4
  317. package/dist/types/server/useLocale.d.ts.map +1 -1
  318. package/package.json +43 -49
  319. package/LICENSE +0 -202
  320. package/dist/cjs/client/format/index.cjs.map +0 -1
  321. package/dist/cjs/client/getBrowserLocale.cjs +0 -173
  322. package/dist/cjs/client/getBrowserLocale.cjs.map +0 -1
  323. package/dist/cjs/client/index.cjs.map +0 -1
  324. package/dist/cjs/client/useLocaleCookie.cjs +0 -60
  325. package/dist/cjs/client/useLocaleCookie.cjs.map +0 -1
  326. package/dist/cjs/editor/index.cjs.map +0 -1
  327. package/dist/cjs/index.cjs.map +0 -1
  328. package/dist/cjs/markdown/index.cjs.map +0 -1
  329. package/dist/cjs/server/format/index.cjs.map +0 -1
  330. package/dist/cjs/server/index.cjs.map +0 -1
  331. package/dist/esm/client/format/index.mjs.map +0 -1
  332. package/dist/esm/client/getBrowserLocale.mjs +0 -138
  333. package/dist/esm/client/getBrowserLocale.mjs.map +0 -1
  334. package/dist/esm/client/index.mjs.map +0 -1
  335. package/dist/esm/client/useLocaleCookie.mjs +0 -24
  336. package/dist/esm/client/useLocaleCookie.mjs.map +0 -1
  337. package/dist/esm/editor/index.mjs.map +0 -1
  338. package/dist/esm/index.mjs.map +0 -1
  339. package/dist/esm/markdown/index.mjs.map +0 -1
  340. package/dist/esm/server/format/index.mjs.map +0 -1
  341. package/dist/esm/server/index.mjs.map +0 -1
  342. package/dist/types/client/format/index.d.ts.map +0 -1
  343. package/dist/types/client/getBrowserLocale.d.ts +0 -25
  344. package/dist/types/client/getBrowserLocale.d.ts.map +0 -1
  345. package/dist/types/client/index.d.ts.map +0 -1
  346. package/dist/types/client/useLocaleCookie.d.ts +0 -17
  347. package/dist/types/client/useLocaleCookie.d.ts.map +0 -1
  348. package/dist/types/editor/index.d.ts.map +0 -1
  349. package/dist/types/markdown/index.d.ts.map +0 -1
  350. package/dist/types/server/format/index.d.ts.map +0 -1
  351. package/dist/types/server/index.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/useDictionaryDynamic.ts"],"sourcesContent":["'use client';\n\nimport configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/config/client';\nimport type {\n Dictionary,\n DictionaryKeys,\n LanguageContent,\n} from '@intlayer/core';\nimport { useContext, useMemo } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\nimport { useDictionary } from './useDictionary';\nimport { useLoadDynamic } from './useLoadDynamic';\n\n/**\n * On the server side, Hook that transform a dictionary and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useDictionaryDynamic = <\n T extends Dictionary,\n K extends DictionaryKeys,\n>(\n dictionaryPromise: LanguageContent<() => Promise<T>>,\n key: K,\n locale?: LocalesValues\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n const localeTarget = useMemo(\n () =>\n locale ??\n currentLocale ??\n configuration?.internationalization.defaultLocale,\n [currentLocale, locale]\n );\n\n const dictionary = useLoadDynamic<T>(\n `${String(key)}.${localeTarget}`,\n dictionaryPromise[localeTarget]!()\n ) as T;\n\n return useDictionary(dictionary, localeTarget);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA0B;AAO1B,mBAAoC;AACpC,8BAAsC;AACtC,2BAA8B;AAC9B,4BAA+B;AAOxB,MAAM,uBAAuB,CAIlC,mBACA,KACA,WACG;AACH,QAAM,EAAE,QAAQ,cAAc,QAAI,yBAAW,6CAAqB;AAClE,QAAM,mBAAe;AAAA,IACnB,MACE,UACA,iBACA,aAAAA,SAAe,qBAAqB;AAAA,IACtC,CAAC,eAAe,MAAM;AAAA,EACxB;AAEA,QAAM,iBAAa;AAAA,IACjB,GAAG,OAAO,GAAG,CAAC,IAAI,YAAY;AAAA,IAC9B,kBAAkB,YAAY,EAAG;AAAA,EACnC;AAEA,aAAO,oCAAc,YAAY,YAAY;AAC/C;","names":["configuration"]}
1
+ {"version":3,"file":"useDictionaryDynamic.cjs","names":["IntlayerClientContext","configuration","useDictionary","useLoadDynamic"],"sources":["../../../src/client/useDictionaryDynamic.ts"],"sourcesContent":["'use client';\n\nimport configuration from '@intlayer/config/built';\nimport type {\n Dictionary,\n DictionaryKeys,\n LocalesValues,\n StrictModeLocaleMap,\n} from '@intlayer/types';\nimport { useContext, useMemo } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\nimport { useDictionary } from './useDictionary';\nimport { useLoadDynamic } from './useLoadDynamic';\n\n/**\n * On the server side, Hook that transform a dictionary and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useDictionaryDynamic = <\n T extends Dictionary,\n K extends DictionaryKeys,\n>(\n dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>,\n key: K,\n locale?: LocalesValues\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n const localeTarget = useMemo(\n () =>\n locale ??\n currentLocale ??\n configuration?.internationalization.defaultLocale,\n [currentLocale, locale]\n );\n\n const dictionary = useLoadDynamic<T>(\n `${String(key)}.${localeTarget}`,\n (dictionaryPromise as any)[localeTarget]?.()\n ) as T;\n\n return useDictionary(dictionary, localeTarget);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,MAAa,wBAIX,mBACA,KACA,WACG;CACH,MAAM,EAAE,QAAQ,wCAA6BA,sDAAsB;CACnE,MAAM,wCAEF,UACA,iBACAC,iCAAe,qBAAqB,eACtC,CAAC,eAAe,OAAO,CACxB;AAOD,QAAOC,2CALYC,6CACjB,GAAG,OAAO,IAAI,CAAC,GAAG,gBACjB,kBAA0B,iBAAiB,CAC7C,EAEgC,aAAa"}
@@ -1,58 +1,48 @@
1
- "use strict";
2
- "use client";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
- var useI18n_exports = {};
21
- __export(useI18n_exports, {
22
- useI18n: () => useI18n
23
- });
24
- module.exports = __toCommonJS(useI18n_exports);
25
- var import_intlayer = require("intlayer");
26
- var import_react = require("react");
27
- var import_IntlayerProvider = require('./IntlayerProvider.cjs');
1
+ 'use client';
2
+
3
+
4
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
5
+ const require_client_IntlayerProvider = require('./IntlayerProvider.cjs');
6
+ let react = require("react");
7
+ react = require_rolldown_runtime.__toESM(react);
8
+ let __intlayer_core = require("@intlayer/core");
9
+ __intlayer_core = require_rolldown_runtime.__toESM(__intlayer_core);
10
+
11
+ //#region src/client/useI18n.ts
12
+ /**
13
+ * Hook that provides a translation function `t()` for accessing nested content by key.
14
+ * This hook mimics the pattern found in libraries like i18next, next-intl, and vue-i18n.
15
+ *
16
+ * @param namespace - The dictionary key to scope translations to
17
+ * @param locale - Optional locale override. If not provided, uses the current context locale
18
+ * @returns A translation function `t(key)` that returns the translated content for the given key
19
+ *
20
+ * @example
21
+ * ```tsx
22
+ * const t = useI18n('IndexPage');
23
+ * const title = t('title'); // Returns translated string for 'IndexPage.title'
24
+ * const nestedContent = t('section.subtitle'); // Returns 'IndexPage.section.subtitle'
25
+ * // For attributes like `aria-label`, use `.value` to get the plain string
26
+ * const ariaLabel = t('button.ariaLabel').value; // 'Close modal'
27
+ * ```
28
+ */
28
29
  const useI18n = (namespace, locale) => {
29
- const { locale: currentLocale } = (0, import_react.useContext)(import_IntlayerProvider.IntlayerClientContext);
30
- const localeTarget = (0, import_react.useMemo)(
31
- () => locale ?? currentLocale,
32
- [currentLocale, locale]
33
- );
34
- let dictionaryContent = (0, import_react.useMemo)(
35
- () => (0, import_intlayer.getIntlayer)(namespace, localeTarget),
36
- [namespace, localeTarget]
37
- );
38
- const t = (path) => {
39
- if (!path) {
40
- return dictionaryContent;
41
- }
42
- const pathArray = path.split(".");
43
- let current = dictionaryContent;
44
- for (const key of pathArray) {
45
- current = current?.[key];
46
- if (current === void 0) {
47
- return dictionaryContent;
48
- }
49
- }
50
- return current;
51
- };
52
- return t;
30
+ const { locale: currentLocale } = (0, react.useContext)(require_client_IntlayerProvider.IntlayerClientContext);
31
+ const localeTarget = (0, react.useMemo)(() => locale ?? currentLocale, [currentLocale, locale]);
32
+ const dictionaryContent = (0, react.useMemo)(() => (0, __intlayer_core.getIntlayer)(namespace, localeTarget), [namespace, localeTarget]);
33
+ const t = (path) => {
34
+ if (!path) return dictionaryContent;
35
+ const pathArray = path.split(".");
36
+ let current = dictionaryContent;
37
+ for (const key of pathArray) {
38
+ current = current?.[key];
39
+ if (current === void 0) return dictionaryContent;
40
+ }
41
+ return current;
42
+ };
43
+ return t;
53
44
  };
54
- // Annotate the CommonJS export names for ESM import in node:
55
- 0 && (module.exports = {
56
- useI18n
57
- });
45
+
46
+ //#endregion
47
+ exports.useI18n = useI18n;
58
48
  //# sourceMappingURL=useI18n.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/useI18n.ts"],"sourcesContent":["'use client';\n\nimport type { LocalesValues } from '@intlayer/config/client';\nimport type {\n DictionaryKeys,\n GetSubPath,\n ValidDotPathsFor,\n} from '@intlayer/core';\nimport type { DeepTransformContent } from '../plugins';\n// @ts-ignore intlayer declared for module augmentation\nimport { getIntlayer, type IntlayerDictionaryTypesConnector } from 'intlayer';\nimport { useContext, useMemo } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\n/**\n * Hook that provides a translation function `t()` for accessing nested content by key.\n * This hook mimics the pattern found in libraries like i18next, next-intl, and vue-i18n.\n *\n * @param namespace - The dictionary key to scope translations to\n * @param locale - Optional locale override. If not provided, uses the current context locale\n * @returns A translation function `t(key)` that returns the translated content for the given key\n *\n * @example\n * ```tsx\n * const t = useI18n('IndexPage');\n * const title = t('title'); // Returns translated string for 'IndexPage.title'\n * const nestedContent = t('section.subtitle'); // Returns 'IndexPage.section.subtitle'\n * // For attributes like `aria-label`, use `.value` to get the plain string\n * const ariaLabel = t('button.ariaLabel').value; // 'Close modal'\n * ```\n */\nexport const useI18n = <T extends DictionaryKeys>(\n namespace: T,\n locale?: LocalesValues\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n const localeTarget = useMemo(\n () => locale ?? currentLocale,\n [currentLocale, locale]\n );\n\n // Get the dictionary content for the namespace\n let dictionaryContent: DeepTransformContent<\n IntlayerDictionaryTypesConnector[T]['content']\n > = useMemo(\n () => getIntlayer(namespace, localeTarget),\n [namespace, localeTarget]\n );\n\n // Return the translation function\n const t = <P extends ValidDotPathsFor<T>>(\n path: P\n ): GetSubPath<\n DeepTransformContent<IntlayerDictionaryTypesConnector[T]['content']>,\n P\n > => {\n if (!path) {\n return dictionaryContent as any;\n }\n\n const pathArray = (path as string).split('.');\n let current: any = dictionaryContent;\n\n for (const key of pathArray) {\n current = current?.[key];\n if (current === undefined) {\n // Return the whole dictionary as fallback if path is not found\n return dictionaryContent as any;\n }\n }\n\n return current;\n };\n\n return t;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,sBAAmE;AACnE,mBAAoC;AACpC,8BAAsC;AAmB/B,MAAM,UAAU,CACrB,WACA,WACG;AACH,QAAM,EAAE,QAAQ,cAAc,QAAI,yBAAW,6CAAqB;AAClE,QAAM,mBAAe;AAAA,IACnB,MAAM,UAAU;AAAA,IAChB,CAAC,eAAe,MAAM;AAAA,EACxB;AAGA,MAAI,wBAEA;AAAA,IACF,UAAM,6BAAY,WAAW,YAAY;AAAA,IACzC,CAAC,WAAW,YAAY;AAAA,EAC1B;AAGA,QAAM,IAAI,CACR,SAIG;AACH,QAAI,CAAC,MAAM;AACT,aAAO;AAAA,IACT;AAEA,UAAM,YAAa,KAAgB,MAAM,GAAG;AAC5C,QAAI,UAAe;AAEnB,eAAW,OAAO,WAAW;AAC3B,gBAAU,UAAU,GAAG;AACvB,UAAI,YAAY,QAAW;AAEzB,eAAO;AAAA,MACT;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"file":"useI18n.cjs","names":["IntlayerClientContext","dictionaryContent: DeepTransformContent<DictionaryRegistryContent<T>>","current: any"],"sources":["../../../src/client/useI18n.ts"],"sourcesContent":["'use client';\n\nimport { getIntlayer, type ValidDotPathsFor } from '@intlayer/core';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionaryRegistryContent,\n GetSubPath,\n LocalesValues,\n} from '@intlayer/types';\nimport { useContext, useMemo } from 'react';\nimport type { DeepTransformContent } from '../plugins';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\n/**\n * Hook that provides a translation function `t()` for accessing nested content by key.\n * This hook mimics the pattern found in libraries like i18next, next-intl, and vue-i18n.\n *\n * @param namespace - The dictionary key to scope translations to\n * @param locale - Optional locale override. If not provided, uses the current context locale\n * @returns A translation function `t(key)` that returns the translated content for the given key\n *\n * @example\n * ```tsx\n * const t = useI18n('IndexPage');\n * const title = t('title'); // Returns translated string for 'IndexPage.title'\n * const nestedContent = t('section.subtitle'); // Returns 'IndexPage.section.subtitle'\n * // For attributes like `aria-label`, use `.value` to get the plain string\n * const ariaLabel = t('button.ariaLabel').value; // 'Close modal'\n * ```\n */\nexport const useI18n = <\n T extends DictionaryKeys,\n L extends LocalesValues = DeclaredLocales,\n>(\n namespace: T,\n locale?: L\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n const localeTarget = useMemo(\n () => locale ?? currentLocale,\n [currentLocale, locale]\n );\n\n // Get the dictionary content for the namespace\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n const dictionaryContent: DeepTransformContent<DictionaryRegistryContent<T>> =\n useMemo(\n () => getIntlayer<T, L>(namespace, localeTarget as L),\n [namespace, localeTarget]\n );\n\n // Return the translation function\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n const t = <P extends ValidDotPathsFor<T>>(\n path: P\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n ): GetSubPath<DeepTransformContent<DictionaryRegistryContent<T>>, P> => {\n if (!path) {\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n return dictionaryContent as any;\n }\n\n const pathArray = (path as string).split('.');\n let current: any = dictionaryContent;\n\n for (const key of pathArray) {\n current = current?.[key];\n if (current === undefined) {\n // Return the whole dictionary as fallback if path is not found\n return dictionaryContent as any;\n }\n }\n\n return current;\n };\n\n return t;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAa,WAIX,WACA,WACG;CACH,MAAM,EAAE,QAAQ,wCAA6BA,sDAAsB;CACnE,MAAM,wCACE,UAAU,eAChB,CAAC,eAAe,OAAO,CACxB;CAID,MAAMC,8EAEsB,WAAW,aAAkB,EACrD,CAAC,WAAW,aAAa,CAC1B;CAIH,MAAM,KACJ,SAEsE;AACtE,MAAI,CAAC,KAEH,QAAO;EAGT,MAAM,YAAa,KAAgB,MAAM,IAAI;EAC7C,IAAIC,UAAe;AAEnB,OAAK,MAAM,OAAO,WAAW;AAC3B,aAAU,UAAU;AACpB,OAAI,YAAY,OAEd,QAAO;;AAIX,SAAO;;AAGT,QAAO"}
@@ -1,39 +1,31 @@
1
- "use strict";
2
- "use client";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
- var useIntlayer_exports = {};
21
- __export(useIntlayer_exports, {
22
- useIntlayer: () => useIntlayer
23
- });
24
- module.exports = __toCommonJS(useIntlayer_exports);
25
- var import_react = require("react");
26
- var import_getIntlayer = require('../getIntlayer.cjs');
27
- var import_IntlayerProvider = require('./IntlayerProvider.cjs');
1
+ 'use client';
2
+
3
+
4
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
5
+ const require_client_IntlayerProvider = require('./IntlayerProvider.cjs');
6
+ const require_getIntlayer = require('../getIntlayer.cjs');
7
+ let react = require("react");
8
+ react = require_rolldown_runtime.__toESM(react);
9
+
10
+ //#region src/client/useIntlayer.ts
11
+ /**
12
+ * On the client side, Hook that picking one dictionary by its key and return the content
13
+ *
14
+ * If the locale is not provided, it will use the locale from the client context
15
+ *
16
+ * When you need the raw string for attributes like `aria-label`, access the `.value` property of the returned content
17
+ */
28
18
  const useIntlayer = (key, locale) => {
29
- const { locale: currentLocale } = (0, import_react.useContext)(import_IntlayerProvider.IntlayerClientContext);
30
- return (0, import_react.useMemo)(() => {
31
- const localeTarget = locale ?? currentLocale;
32
- return (0, import_getIntlayer.getIntlayer)(key, localeTarget);
33
- }, [key, currentLocale, locale]);
19
+ const { locale: currentLocale } = (0, react.useContext)(require_client_IntlayerProvider.IntlayerClientContext);
20
+ return (0, react.useMemo)(() => {
21
+ return require_getIntlayer.getIntlayer(key, locale ?? currentLocale);
22
+ }, [
23
+ key,
24
+ currentLocale,
25
+ locale
26
+ ]);
34
27
  };
35
- // Annotate the CommonJS export names for ESM import in node:
36
- 0 && (module.exports = {
37
- useIntlayer
38
- });
28
+
29
+ //#endregion
30
+ exports.useIntlayer = useIntlayer;
39
31
  //# sourceMappingURL=useIntlayer.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/useIntlayer.ts"],"sourcesContent":["'use client';\n\nimport type { LocalesValues } from '@intlayer/config/client';\nimport type { DictionaryKeys } from '@intlayer/core';\n// @ts-ignore intlayer declared for module augmentation\nimport type { IntlayerDictionaryTypesConnector } from 'intlayer';\nimport { useContext, useMemo } from 'react';\nimport { getIntlayer } from '../getIntlayer';\nimport type { DeepTransformContent } from '../plugins';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\n/**\n * On the client side, Hook that picking one dictionary by its key and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n *\n * When you need the raw string for attributes like `aria-label`, access the `.value` property of the returned content\n */\nexport const useIntlayer = <T extends DictionaryKeys>(\n key: T,\n locale?: LocalesValues\n): DeepTransformContent<IntlayerDictionaryTypesConnector[T]['content']> => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n\n return useMemo(() => {\n const localeTarget = locale ?? currentLocale;\n\n return getIntlayer(key, localeTarget) as any;\n }, [key, currentLocale, locale]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,mBAAoC;AACpC,yBAA4B;AAE5B,8BAAsC;AAS/B,MAAM,cAAc,CACzB,KACA,WACyE;AACzE,QAAM,EAAE,QAAQ,cAAc,QAAI,yBAAW,6CAAqB;AAElE,aAAO,sBAAQ,MAAM;AACnB,UAAM,eAAe,UAAU;AAE/B,eAAO,gCAAY,KAAK,YAAY;AAAA,EACtC,GAAG,CAAC,KAAK,eAAe,MAAM,CAAC;AACjC;","names":[]}
1
+ {"version":3,"file":"useIntlayer.cjs","names":["IntlayerClientContext","getIntlayer"],"sources":["../../../src/client/useIntlayer.ts"],"sourcesContent":["'use client';\n\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n LocalesValues,\n} from '@intlayer/types';\nimport { useContext, useMemo } from 'react';\nimport { getIntlayer } from '../getIntlayer';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\n/**\n * On the client side, Hook that picking one dictionary by its key and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n *\n * When you need the raw string for attributes like `aria-label`, access the `.value` property of the returned content\n */\nexport const useIntlayer = <\n T extends DictionaryKeys,\n L extends LocalesValues = DeclaredLocales,\n>(\n key: T,\n locale?: L\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n\n return useMemo(() => {\n const localeTarget = locale ?? (currentLocale as L);\n\n return getIntlayer<T, L>(key, localeTarget);\n }, [key, currentLocale, locale]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,MAAa,eAIX,KACA,WACG;CACH,MAAM,EAAE,QAAQ,wCAA6BA,sDAAsB;AAEnE,iCAAqB;AAGnB,SAAOC,gCAAkB,KAFJ,UAAW,cAEW;IAC1C;EAAC;EAAK;EAAe;EAAO,CAAC"}
@@ -1,56 +1,27 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var useLoadDynamic_exports = {};
20
- __export(useLoadDynamic_exports, {
21
- useLoadDynamic: () => useLoadDynamic
22
- });
23
- module.exports = __toCommonJS(useLoadDynamic_exports);
1
+
2
+ //#region src/client/useLoadDynamic.ts
24
3
  const createSuspender = (promise) => {
25
- let status = "pending";
26
- let result;
27
- const suspender = promise.then(
28
- (r) => {
29
- status = "success";
30
- result = r;
31
- },
32
- (e) => {
33
- status = "error";
34
- result = e;
35
- }
36
- );
37
- return {
38
- read() {
39
- if (status === "pending") throw suspender;
40
- if (status === "error") throw result;
41
- return result;
42
- }
43
- };
4
+ let status = "pending";
5
+ let result;
6
+ const suspender = promise.then((r) => {
7
+ status = "success";
8
+ result = r;
9
+ }, (e) => {
10
+ status = "error";
11
+ result = e;
12
+ });
13
+ return { read() {
14
+ if (status === "pending") throw suspender;
15
+ if (status === "error") throw result;
16
+ return result;
17
+ } };
44
18
  };
45
19
  const cache = /* @__PURE__ */ new Map();
46
20
  const useLoadDynamic = (key, promise) => {
47
- if (!cache.has(key)) {
48
- cache.set(key, createSuspender(promise));
49
- }
50
- return cache.get(key).read();
21
+ if (!cache.has(key)) cache.set(key, createSuspender(promise));
22
+ return cache.get(key).read();
51
23
  };
52
- // Annotate the CommonJS export names for ESM import in node:
53
- 0 && (module.exports = {
54
- useLoadDynamic
55
- });
24
+
25
+ //#endregion
26
+ exports.useLoadDynamic = useLoadDynamic;
56
27
  //# sourceMappingURL=useLoadDynamic.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/useLoadDynamic.ts"],"sourcesContent":["type Status = 'pending' | 'success' | 'error';\n\nconst createSuspender = <T>(promise: Promise<T>) => {\n let status: Status = 'pending';\n let result: T;\n const suspender = promise.then(\n (r) => {\n status = 'success';\n result = r;\n },\n (e) => {\n status = 'error';\n result = e as any;\n }\n );\n\n return {\n read() {\n if (status === 'pending') throw suspender;\n if (status === 'error') throw result;\n return result!;\n },\n };\n};\n\nconst cache = new Map<string, ReturnType<typeof createSuspender>>();\n\nexport const useLoadDynamic = <T>(key: string, promise: Promise<T>): T => {\n if (!cache.has(key)) {\n cache.set(key, createSuspender(promise));\n }\n\n return (cache.get(key)! as ReturnType<typeof createSuspender>).read() as T;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,MAAM,kBAAkB,CAAI,YAAwB;AAClD,MAAI,SAAiB;AACrB,MAAI;AACJ,QAAM,YAAY,QAAQ;AAAA,IACxB,CAAC,MAAM;AACL,eAAS;AACT,eAAS;AAAA,IACX;AAAA,IACA,CAAC,MAAM;AACL,eAAS;AACT,eAAS;AAAA,IACX;AAAA,EACF;AAEA,SAAO;AAAA,IACL,OAAO;AACL,UAAI,WAAW,UAAW,OAAM;AAChC,UAAI,WAAW,QAAS,OAAM;AAC9B,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAEA,MAAM,QAAQ,oBAAI,IAAgD;AAE3D,MAAM,iBAAiB,CAAI,KAAa,YAA2B;AACxE,MAAI,CAAC,MAAM,IAAI,GAAG,GAAG;AACnB,UAAM,IAAI,KAAK,gBAAgB,OAAO,CAAC;AAAA,EACzC;AAEA,SAAQ,MAAM,IAAI,GAAG,EAA0C,KAAK;AACtE;","names":[]}
1
+ {"version":3,"file":"useLoadDynamic.cjs","names":["status: Status","result: T"],"sources":["../../../src/client/useLoadDynamic.ts"],"sourcesContent":["type Status = 'pending' | 'success' | 'error';\n\nconst createSuspender = <T>(promise: Promise<T>) => {\n let status: Status = 'pending';\n let result: T;\n const suspender = promise.then(\n (r) => {\n status = 'success';\n result = r;\n },\n (e) => {\n status = 'error';\n result = e as any;\n }\n );\n\n return {\n read() {\n if (status === 'pending') throw suspender;\n if (status === 'error') throw result;\n return result!;\n },\n };\n};\n\nconst cache = new Map<string, ReturnType<typeof createSuspender>>();\n\nexport const useLoadDynamic = <T>(key: string, promise: Promise<T>): T => {\n if (!cache.has(key)) {\n cache.set(key, createSuspender(promise));\n }\n\n return (cache.get(key)! as ReturnType<typeof createSuspender>).read() as T;\n};\n"],"mappings":";;AAEA,MAAM,mBAAsB,YAAwB;CAClD,IAAIA,SAAiB;CACrB,IAAIC;CACJ,MAAM,YAAY,QAAQ,MACvB,MAAM;AACL,WAAS;AACT,WAAS;KAEV,MAAM;AACL,WAAS;AACT,WAAS;GAEZ;AAED,QAAO,EACL,OAAO;AACL,MAAI,WAAW,UAAW,OAAM;AAChC,MAAI,WAAW,QAAS,OAAM;AAC9B,SAAO;IAEV;;AAGH,MAAM,wBAAQ,IAAI,KAAiD;AAEnE,MAAa,kBAAqB,KAAa,YAA2B;AACxE,KAAI,CAAC,MAAM,IAAI,IAAI,CACjB,OAAM,IAAI,KAAK,gBAAgB,QAAQ,CAAC;AAG1C,QAAQ,MAAM,IAAI,IAAI,CAAyC,MAAM"}
@@ -1,72 +1,41 @@
1
- "use strict";
2
- "use client";
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __export = (target, all) => {
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
1
+ 'use client';
2
+
3
+
4
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
5
+ const require_client_useLocaleStorage = require('./useLocaleStorage.cjs');
6
+ const require_client_IntlayerProvider = require('./IntlayerProvider.cjs');
7
+ let react = require("react");
8
+ react = require_rolldown_runtime.__toESM(react);
9
+ let __intlayer_config_built = require("@intlayer/config/built");
10
+ __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_built);
11
+
12
+ //#region src/client/useLocale.ts
13
+ /**
14
+ * On the client side, hook to get the current locale and all related fields
15
+ */
16
+ const useLocale = ({ isCookieEnabled, onLocaleChange } = {}) => {
17
+ const { defaultLocale, locales: availableLocales } = __intlayer_config_built.default?.internationalization ?? {};
18
+ const { locale, setLocale: setLocaleState, isCookieEnabled: isCookieEnabledContext } = (0, react.useContext)(require_client_IntlayerProvider.IntlayerClientContext);
19
+ return {
20
+ locale,
21
+ defaultLocale,
22
+ availableLocales,
23
+ setLocale: (0, react.useCallback)((locale$1) => {
24
+ if (!availableLocales?.map(String).includes(locale$1)) {
25
+ console.error(`Locale ${locale$1} is not available`);
26
+ return;
27
+ }
28
+ setLocaleState(locale$1);
29
+ require_client_useLocaleStorage.setLocaleInStorage(locale$1, isCookieEnabled ?? isCookieEnabledContext ?? true);
30
+ onLocaleChange?.(locale$1);
31
+ }, [
32
+ availableLocales,
33
+ onLocaleChange,
34
+ setLocaleState
35
+ ])
36
+ };
12
37
  };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
- }
19
- return to;
20
- };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
- var useLocale_exports = {};
31
- __export(useLocale_exports, {
32
- useLocale: () => useLocale
33
- });
34
- module.exports = __toCommonJS(useLocale_exports);
35
- var import_built = __toESM(require("@intlayer/config/built"));
36
- var import_react = require("react");
37
- var import_IntlayerProvider = require('./IntlayerProvider.cjs');
38
- var import_useLocaleCookie = require('./useLocaleCookie.cjs');
39
- const useLocale = ({ onLocaleChange } = {}) => {
40
- const { defaultLocale, locales: availableLocales } = import_built.default?.internationalization ?? {};
41
- const { locale, setLocale: setLocaleState } = (0, import_react.useContext)(
42
- import_IntlayerProvider.IntlayerClientContext
43
- );
44
- const { setLocaleCookie } = (0, import_useLocaleCookie.useLocaleCookie)();
45
- const setLocale = (0, import_react.useCallback)(
46
- (locale2) => {
47
- if (!availableLocales?.map(String).includes(locale2)) {
48
- console.error(`Locale ${locale2} is not available`);
49
- return;
50
- }
51
- setLocaleState(locale2);
52
- setLocaleCookie(locale2);
53
- onLocaleChange?.(locale2);
54
- },
55
- [availableLocales, onLocaleChange, setLocaleCookie, setLocaleState]
56
- );
57
- return {
58
- locale,
59
- // Current locale
60
- defaultLocale,
61
- // Principal locale defined in config
62
- availableLocales,
63
- // List of the available locales defined in config
64
- setLocale
65
- // Function to set the locale
66
- };
67
- };
68
- // Annotate the CommonJS export names for ESM import in node:
69
- 0 && (module.exports = {
70
- useLocale
71
- });
38
+
39
+ //#endregion
40
+ exports.useLocale = useLocale;
72
41
  //# sourceMappingURL=useLocale.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["'use client';\n\nimport configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/config/client';\nimport { useCallback, useContext } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\nimport { useLocaleCookie } from './useLocaleCookie';\n\ntype useLocaleProps = {\n onLocaleChange?: (locale: LocalesValues) => void;\n};\n\n/**\n * On the client side, hook to get the current locale and all related fields\n */\nexport const useLocale = ({ onLocaleChange }: useLocaleProps = {}) => {\n const { defaultLocale, locales: availableLocales } =\n configuration?.internationalization ?? {};\n\n const { locale, setLocale: setLocaleState } = useContext(\n IntlayerClientContext\n );\n const { setLocaleCookie } = useLocaleCookie();\n\n const setLocale = useCallback(\n (locale: LocalesValues) => {\n if (!availableLocales?.map(String).includes(locale)) {\n console.error(`Locale ${locale} is not available`);\n return;\n }\n\n setLocaleState(locale);\n setLocaleCookie(locale);\n onLocaleChange?.(locale);\n },\n [availableLocales, onLocaleChange, setLocaleCookie, setLocaleState]\n );\n\n return {\n locale, // Current locale\n defaultLocale, // Principal locale defined in config\n availableLocales, // List of the available locales defined in config\n setLocale, // Function to set the locale\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA0B;AAE1B,mBAAwC;AACxC,8BAAsC;AACtC,6BAAgC;AASzB,MAAM,YAAY,CAAC,EAAE,eAAe,IAAoB,CAAC,MAAM;AACpE,QAAM,EAAE,eAAe,SAAS,iBAAiB,IAC/C,aAAAA,SAAe,wBAAwB,CAAC;AAE1C,QAAM,EAAE,QAAQ,WAAW,eAAe,QAAI;AAAA,IAC5C;AAAA,EACF;AACA,QAAM,EAAE,gBAAgB,QAAI,wCAAgB;AAE5C,QAAM,gBAAY;AAAA,IAChB,CAACC,YAA0B;AACzB,UAAI,CAAC,kBAAkB,IAAI,MAAM,EAAE,SAASA,OAAM,GAAG;AACnD,gBAAQ,MAAM,UAAUA,OAAM,mBAAmB;AACjD;AAAA,MACF;AAEA,qBAAeA,OAAM;AACrB,sBAAgBA,OAAM;AACtB,uBAAiBA,OAAM;AAAA,IACzB;AAAA,IACA,CAAC,kBAAkB,gBAAgB,iBAAiB,cAAc;AAAA,EACpE;AAEA,SAAO;AAAA,IACL;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,EACF;AACF;","names":["configuration","locale"]}
1
+ {"version":3,"file":"useLocale.cjs","names":["configuration","IntlayerClientContext","locale"],"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["'use client';\n\nimport configuration from '@intlayer/config/built';\nimport type { DeclaredLocales, LocalesValues } from '@intlayer/types';\nimport { useCallback, useContext } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\nimport { setLocaleInStorage } from './useLocaleStorage';\n\ntype UseLocaleProps = {\n isCookieEnabled?: boolean;\n onLocaleChange?: (locale: LocalesValues) => void;\n};\n\ntype UseLocaleResult = {\n locale: DeclaredLocales;\n defaultLocale: DeclaredLocales;\n availableLocales: DeclaredLocales[];\n setLocale: (locale: LocalesValues) => void;\n};\n\n/**\n * On the client side, hook to get the current locale and all related fields\n */\nexport const useLocale = ({\n isCookieEnabled,\n onLocaleChange,\n}: UseLocaleProps = {}): UseLocaleResult => {\n const { defaultLocale, locales: availableLocales } =\n configuration?.internationalization ?? {};\n\n const {\n locale,\n setLocale: setLocaleState,\n isCookieEnabled: isCookieEnabledContext,\n } = useContext(IntlayerClientContext);\n\n const setLocale = useCallback(\n (locale: LocalesValues) => {\n if (!availableLocales?.map(String).includes(locale)) {\n console.error(`Locale ${locale} is not available`);\n return;\n }\n\n setLocaleState(locale);\n setLocaleInStorage(\n locale,\n isCookieEnabled ?? isCookieEnabledContext ?? true\n );\n onLocaleChange?.(locale);\n },\n [availableLocales, onLocaleChange, setLocaleState]\n );\n\n return {\n locale, // Current locale\n defaultLocale, // Principal locale defined in config\n availableLocales, // List of the available locales defined in config\n setLocale, // Function to set the locale\n } as UseLocaleResult;\n};\n"],"mappings":";;;;;;;;;;;;;;;AAuBA,MAAa,aAAa,EACxB,iBACA,mBACkB,EAAE,KAAsB;CAC1C,MAAM,EAAE,eAAe,SAAS,qBAC9BA,iCAAe,wBAAwB,EAAE;CAE3C,MAAM,EACJ,QACA,WAAW,gBACX,iBAAiB,iDACJC,sDAAsB;AAmBrC,QAAO;EACL;EACA;EACA;EACA,mCApBC,aAA0B;AACzB,OAAI,CAAC,kBAAkB,IAAI,OAAO,CAAC,SAASC,SAAO,EAAE;AACnD,YAAQ,MAAM,UAAUA,SAAO,mBAAmB;AAClD;;AAGF,kBAAeA,SAAO;AACtB,sDACEA,UACA,mBAAmB,0BAA0B,KAC9C;AACD,oBAAiBA,SAAO;KAE1B;GAAC;GAAkB;GAAgB;GAAe,CACnD;EAOA"}
@@ -1,56 +1,28 @@
1
- "use strict";
2
- "use client";
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __export = (target, all) => {
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
- }
19
- return to;
20
- };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
- var useLocaleBase_exports = {};
31
- __export(useLocaleBase_exports, {
32
- useLocaleBase: () => useLocaleBase
33
- });
34
- module.exports = __toCommonJS(useLocaleBase_exports);
35
- var import_built = __toESM(require("@intlayer/config/built"));
36
- var import_react = require("react");
37
- var import_IntlayerProvider = require('./IntlayerProvider.cjs');
38
- const { defaultLocale, locales: availableLocales } = import_built.default.internationalization;
1
+ 'use client';
2
+
3
+
4
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
5
+ const require_client_IntlayerProvider = require('./IntlayerProvider.cjs');
6
+ let react = require("react");
7
+ react = require_rolldown_runtime.__toESM(react);
8
+ let __intlayer_config_built = require("@intlayer/config/built");
9
+ __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_built);
10
+
11
+ //#region src/client/useLocaleBase.ts
12
+ const { defaultLocale, locales: availableLocales } = __intlayer_config_built.default.internationalization;
13
+ /**
14
+ * On the client side, hook to get the current locale and all related fields
15
+ */
39
16
  const useLocaleBase = () => {
40
- const { locale, setLocale } = (0, import_react.useContext)(import_IntlayerProvider.IntlayerClientContext);
41
- return {
42
- locale,
43
- // Current locale
44
- defaultLocale,
45
- // Principal locale defined in config
46
- availableLocales,
47
- // List of the available locales defined in config
48
- setLocale
49
- // Function to set the locale
50
- };
17
+ const { locale, setLocale } = (0, react.useContext)(require_client_IntlayerProvider.IntlayerClientContext);
18
+ return {
19
+ locale,
20
+ defaultLocale,
21
+ availableLocales,
22
+ setLocale
23
+ };
51
24
  };
52
- // Annotate the CommonJS export names for ESM import in node:
53
- 0 && (module.exports = {
54
- useLocaleBase
55
- });
25
+
26
+ //#endregion
27
+ exports.useLocaleBase = useLocaleBase;
56
28
  //# sourceMappingURL=useLocaleBase.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/useLocaleBase.ts"],"sourcesContent":["'use client';\n\nimport configuration from '@intlayer/config/built';\nimport { useContext } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\nconst { defaultLocale, locales: availableLocales } =\n configuration.internationalization;\n\n/**\n * On the client side, hook to get the current locale and all related fields\n */\nexport const useLocaleBase = () => {\n const { locale, setLocale } = useContext(IntlayerClientContext);\n\n return {\n locale, // Current locale\n defaultLocale, // Principal locale defined in config\n availableLocales, // List of the available locales defined in config\n setLocale, // Function to set the locale\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA0B;AAC1B,mBAA2B;AAC3B,8BAAsC;AAEtC,MAAM,EAAE,eAAe,SAAS,iBAAiB,IAC/C,aAAAA,QAAc;AAKT,MAAM,gBAAgB,MAAM;AACjC,QAAM,EAAE,QAAQ,UAAU,QAAI,yBAAW,6CAAqB;AAE9D,SAAO;AAAA,IACL;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,EACF;AACF;","names":["configuration"]}
1
+ {"version":3,"file":"useLocaleBase.cjs","names":["configuration","IntlayerClientContext"],"sources":["../../../src/client/useLocaleBase.ts"],"sourcesContent":["'use client';\n\nimport configuration from '@intlayer/config/built';\nimport { useContext } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\nconst { defaultLocale, locales: availableLocales } =\n configuration.internationalization;\n\n/**\n * On the client side, hook to get the current locale and all related fields\n */\nexport const useLocaleBase = () => {\n const { locale, setLocale } = useContext(IntlayerClientContext);\n\n return {\n locale, // Current locale\n defaultLocale, // Principal locale defined in config\n availableLocales, // List of the available locales defined in config\n setLocale, // Function to set the locale\n };\n};\n"],"mappings":";;;;;;;;;;;AAMA,MAAM,EAAE,eAAe,SAAS,qBAC9BA,gCAAc;;;;AAKhB,MAAa,sBAAsB;CACjC,MAAM,EAAE,QAAQ,oCAAyBC,sDAAsB;AAE/D,QAAO;EACL;EACA;EACA;EACA;EACD"}
@@ -0,0 +1,63 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let react = require("react");
3
+ react = require_rolldown_runtime.__toESM(react);
4
+ let __intlayer_core = require("@intlayer/core");
5
+ __intlayer_core = require_rolldown_runtime.__toESM(__intlayer_core);
6
+
7
+ //#region src/client/useLocaleStorage.ts
8
+ /**
9
+ * Get the locale cookie
10
+ */
11
+ /**
12
+ * Get the locale cookie
13
+ */
14
+ const localeInStorage = (0, __intlayer_core.getLocaleFromStorage)(__intlayer_core.localeStorageOptions);
15
+ /**
16
+ * @deprecated Use localeInStorage instead
17
+ *
18
+ * Get the locale cookie
19
+ */
20
+ const localeCookie = localeInStorage;
21
+ /**
22
+ * Set the locale cookie
23
+ */
24
+ const setLocaleInStorage = (locale, isCookieEnabled) => (0, __intlayer_core.setLocaleInStorage)(locale, {
25
+ ...__intlayer_core.localeStorageOptions,
26
+ isCookieEnabled
27
+ });
28
+ /**
29
+ * @deprecated Use setLocaleInStorage instead
30
+ *
31
+ * Set the locale cookie
32
+ */
33
+ const setLocaleCookie = setLocaleInStorage;
34
+ /**
35
+ * Hook that provides the locale cookie and a function to set it
36
+ */
37
+ const useLocaleStorage = (isCookieEnabled) => (0, react.useMemo)(() => (0, __intlayer_core.LocaleStorage)({
38
+ ...__intlayer_core.localeStorageOptions,
39
+ isCookieEnabled
40
+ }), [isCookieEnabled]);
41
+ /**
42
+ * @deprecated Use useLocaleStorage instead
43
+ *
44
+ * For GDPR compliance, use useLocaleStorage instead
45
+ *
46
+ * Hook that provides the locale cookie and a function to set it
47
+ */
48
+ const useLocaleCookie = (isCookieEnabled) => {
49
+ const storage = useLocaleStorage(isCookieEnabled);
50
+ return {
51
+ localeCookie: storage.getLocale(),
52
+ setLocaleCookie: storage.setLocale
53
+ };
54
+ };
55
+
56
+ //#endregion
57
+ exports.localeCookie = localeCookie;
58
+ exports.localeInStorage = localeInStorage;
59
+ exports.setLocaleCookie = setLocaleCookie;
60
+ exports.setLocaleInStorage = setLocaleInStorage;
61
+ exports.useLocaleCookie = useLocaleCookie;
62
+ exports.useLocaleStorage = useLocaleStorage;
63
+ //# sourceMappingURL=useLocaleStorage.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLocaleStorage.cjs","names":["localeStorageOptions"],"sources":["../../../src/client/useLocaleStorage.ts"],"sourcesContent":["import {\n getLocaleFromStorage,\n LocaleStorage,\n localeStorageOptions,\n setLocaleInStorage as setLocaleInStorageCore,\n} from '@intlayer/core';\nimport type { LocalesValues } from '@intlayer/types';\nimport { useMemo } from 'react';\n\n/**\n * Get the locale cookie\n */\n/**\n * Get the locale cookie\n */\nexport const localeInStorage = getLocaleFromStorage(localeStorageOptions);\n/**\n * @deprecated Use localeInStorage instead\n *\n * Get the locale cookie\n */\nexport const localeCookie = localeInStorage;\n\n/**\n * Set the locale cookie\n */\nexport const setLocaleInStorage = (\n locale: LocalesValues,\n isCookieEnabled?: boolean\n) =>\n setLocaleInStorageCore(locale, {\n ...localeStorageOptions,\n isCookieEnabled,\n });\n\n/**\n * @deprecated Use setLocaleInStorage instead\n *\n * Set the locale cookie\n */\nexport const setLocaleCookie = setLocaleInStorage;\n\n/**\n * Hook that provides the locale cookie and a function to set it\n */\nexport const useLocaleStorage = (isCookieEnabled?: boolean) =>\n useMemo(\n () =>\n LocaleStorage({\n ...localeStorageOptions,\n isCookieEnabled,\n }),\n [isCookieEnabled]\n );\n\n/**\n * @deprecated Use useLocaleStorage instead\n *\n * For GDPR compliance, use useLocaleStorage instead\n *\n * Hook that provides the locale cookie and a function to set it\n */\nexport const useLocaleCookie = (isCookieEnabled?: boolean) => {\n const storage = useLocaleStorage(isCookieEnabled);\n\n return {\n localeCookie: storage.getLocale(),\n setLocaleCookie: storage.setLocale,\n };\n};\n"],"mappings":";;;;;;;;;;;;;AAeA,MAAa,4DAAuCA,qCAAqB;;;;;;AAMzE,MAAa,eAAe;;;;AAK5B,MAAa,sBACX,QACA,4DAEuB,QAAQ;CAC7B,GAAGA;CACH;CACD,CAAC;;;;;;AAOJ,MAAa,kBAAkB;;;;AAK/B,MAAa,oBAAoB,gFAGb;CACZ,GAAGA;CACH;CACD,CAAC,EACJ,CAAC,gBAAgB,CAClB;;;;;;;;AASH,MAAa,mBAAmB,oBAA8B;CAC5D,MAAM,UAAU,iBAAiB,gBAAgB;AAEjD,QAAO;EACL,cAAc,QAAQ,WAAW;EACjC,iBAAiB,QAAQ;EAC1B"}