react-intlayer 6.1.6 → 7.0.0-canary.3

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,22 +1,25 @@
1
- "use client";
2
- import configuration from "@intlayer/config/built";
3
- import { useContext } from "react";
1
+ 'use client';
2
+
3
+
4
4
  import { IntlayerClientContext } from "./IntlayerProvider.mjs";
5
+ import { useContext } from "react";
6
+ import configuration from "@intlayer/config/built";
7
+
8
+ //#region src/client/useLocaleBase.ts
5
9
  const { defaultLocale, locales: availableLocales } = configuration.internationalization;
10
+ /**
11
+ * On the client side, hook to get the current locale and all related fields
12
+ */
6
13
  const useLocaleBase = () => {
7
- const { locale, setLocale } = useContext(IntlayerClientContext);
8
- return {
9
- locale,
10
- // Current locale
11
- defaultLocale,
12
- // Principal locale defined in config
13
- availableLocales,
14
- // List of the available locales defined in config
15
- setLocale
16
- // Function to set the locale
17
- };
18
- };
19
- export {
20
- useLocaleBase
14
+ const { locale, setLocale } = useContext(IntlayerClientContext);
15
+ return {
16
+ locale,
17
+ defaultLocale,
18
+ availableLocales,
19
+ setLocale
20
+ };
21
21
  };
22
+
23
+ //#endregion
24
+ export { useLocaleBase };
22
25
  //# sourceMappingURL=useLocaleBase.mjs.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":";AAEA,OAAO,mBAAmB;AAC1B,SAAS,kBAAkB;AAC3B,SAAS,6BAA6B;AAEtC,MAAM,EAAE,eAAe,SAAS,iBAAiB,IAC/C,cAAc;AAKT,MAAM,gBAAgB,MAAM;AACjC,QAAM,EAAE,QAAQ,UAAU,IAAI,WAAW,qBAAqB;AAE9D,SAAO;AAAA,IACL;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"file":"useLocaleBase.mjs","names":[],"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,qBAC9B,cAAc;;;;AAKhB,MAAa,sBAAsB;CACjC,MAAM,EAAE,QAAQ,cAAc,WAAW,sBAAsB;AAE/D,QAAO;EACL;EACA;EACA;EACA;EACD"}
@@ -0,0 +1,55 @@
1
+ import { useMemo } from "react";
2
+ import { LocaleStorage, getLocaleFromStorage, localeStorageOptions, setLocaleInStorage as setLocaleInStorage$1 } from "@intlayer/core";
3
+
4
+ //#region src/client/useLocaleStorage.ts
5
+ /**
6
+ * Get the locale cookie
7
+ */
8
+ /**
9
+ * Get the locale cookie
10
+ */
11
+ const localeInStorage = getLocaleFromStorage(localeStorageOptions);
12
+ /**
13
+ * @deprecated Use localeInStorage instead
14
+ *
15
+ * Get the locale cookie
16
+ */
17
+ const localeCookie = localeInStorage;
18
+ /**
19
+ * Set the locale cookie
20
+ */
21
+ const setLocaleInStorage = (locale, isCookieEnabled) => setLocaleInStorage$1(locale, {
22
+ ...localeStorageOptions,
23
+ isCookieEnabled
24
+ });
25
+ /**
26
+ * @deprecated Use setLocaleInStorage instead
27
+ *
28
+ * Set the locale cookie
29
+ */
30
+ const setLocaleCookie = setLocaleInStorage;
31
+ /**
32
+ * Hook that provides the locale cookie and a function to set it
33
+ */
34
+ const useLocaleStorage = (isCookieEnabled) => useMemo(() => LocaleStorage({
35
+ ...localeStorageOptions,
36
+ isCookieEnabled
37
+ }), [isCookieEnabled]);
38
+ /**
39
+ * @deprecated Use useLocaleStorage instead
40
+ *
41
+ * For GDPR compliance, use useLocaleStorage instead
42
+ *
43
+ * Hook that provides the locale cookie and a function to set it
44
+ */
45
+ const useLocaleCookie = (isCookieEnabled) => {
46
+ const storage = useLocaleStorage(isCookieEnabled);
47
+ return {
48
+ localeCookie: storage.getLocale(),
49
+ setLocaleCookie: storage.setLocale
50
+ };
51
+ };
52
+
53
+ //#endregion
54
+ export { localeCookie, localeInStorage, setLocaleCookie, setLocaleInStorage, useLocaleCookie, useLocaleStorage };
55
+ //# sourceMappingURL=useLocaleStorage.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLocaleStorage.mjs","names":["setLocaleInStorageCore"],"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,kBAAkB,qBAAqB,qBAAqB;;;;;;AAMzE,MAAa,eAAe;;;;AAK5B,MAAa,sBACX,QACA,oBAEAA,qBAAuB,QAAQ;CAC7B,GAAG;CACH;CACD,CAAC;;;;;;AAOJ,MAAa,kBAAkB;;;;AAK/B,MAAa,oBAAoB,oBAC/B,cAEI,cAAc;CACZ,GAAG;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"}
@@ -1,14 +1,34 @@
1
- import { getTranslation } from "@intlayer/core";
2
- import { useContext, useMemo } from "react";
3
1
  import { IntlayerClientContext } from "./IntlayerProvider.mjs";
2
+ import { useContext, useMemo } from "react";
3
+ import { getTranslation } from "@intlayer/core";
4
+
5
+ //#region src/client/useTraduction.ts
6
+ /**
7
+ * On the client side, Hook that picking one dictionary by its id and return the content.
8
+ *
9
+ * If not locale found, it will return the content related to the default locale.
10
+ *
11
+ * Return either the content editor, or the content itself depending on the configuration.
12
+ *
13
+ * Usage:
14
+ *
15
+ * ```tsx
16
+ * const content = useTranslation<string>({
17
+ * en: 'Hello',
18
+ * fr: 'Bonjour',
19
+ * }, 'fr');
20
+ * // 'Bonjour'
21
+ * ```
22
+ *
23
+ * Using TypeScript:
24
+ * - this function will require each locale to be defined if defined in the project configuration.
25
+ * - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.
26
+ */
4
27
  const useTranslation = (languageContent) => {
5
- const { locale } = useContext(IntlayerClientContext);
6
- return useMemo(
7
- () => getTranslation(languageContent, locale),
8
- [languageContent, locale]
9
- );
10
- };
11
- export {
12
- useTranslation
28
+ const { locale } = useContext(IntlayerClientContext);
29
+ return useMemo(() => getTranslation(languageContent, locale), [languageContent, locale]);
13
30
  };
31
+
32
+ //#endregion
33
+ export { useTranslation };
14
34
  //# sourceMappingURL=useTraduction.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/useTraduction.ts"],"sourcesContent":["import { getTranslation, type LanguageContent } from '@intlayer/core';\nimport { useContext, useMemo } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\n/**\n * On the client side, Hook that picking one dictionary by its id and return the content.\n *\n * If not locale found, it will return the content related to the default locale.\n *\n * Return either the content editor, or the content itself depending on the configuration.\n *\n * Usage:\n *\n * ```tsx\n * const content = useTranslation<string>({\n * en: 'Hello',\n * fr: 'Bonjour',\n * }, 'fr');\n * // 'Bonjour'\n * ```\n *\n * Using TypeScript:\n * - this function will require each locale to be defined if defined in the project configuration.\n * - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.\n */\nexport const useTranslation = <Content = string>(\n languageContent: LanguageContent<Content>\n): Content => {\n const { locale } = useContext(IntlayerClientContext);\n\n return useMemo(\n () => getTranslation(languageContent, locale),\n [languageContent, locale]\n );\n};\n"],"mappings":"AAAA,SAAS,sBAA4C;AACrD,SAAS,YAAY,eAAe;AACpC,SAAS,6BAA6B;AAuB/B,MAAM,iBAAiB,CAC5B,oBACY;AACZ,QAAM,EAAE,OAAO,IAAI,WAAW,qBAAqB;AAEnD,SAAO;AAAA,IACL,MAAM,eAAe,iBAAiB,MAAM;AAAA,IAC5C,CAAC,iBAAiB,MAAM;AAAA,EAC1B;AACF;","names":[]}
1
+ {"version":3,"file":"useTraduction.mjs","names":[],"sources":["../../../src/client/useTraduction.ts"],"sourcesContent":["import { getTranslation } from '@intlayer/core';\nimport type { StrictModeLocaleMap } from '@intlayer/types';\nimport { useContext, useMemo } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\n\n/**\n * On the client side, Hook that picking one dictionary by its id and return the content.\n *\n * If not locale found, it will return the content related to the default locale.\n *\n * Return either the content editor, or the content itself depending on the configuration.\n *\n * Usage:\n *\n * ```tsx\n * const content = useTranslation<string>({\n * en: 'Hello',\n * fr: 'Bonjour',\n * }, 'fr');\n * // 'Bonjour'\n * ```\n *\n * Using TypeScript:\n * - this function will require each locale to be defined if defined in the project configuration.\n * - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.\n */\nexport const useTranslation = <Content = string>(\n languageContent: StrictModeLocaleMap<Content>\n): Content => {\n const { locale } = useContext(IntlayerClientContext);\n\n return useMemo(\n () => getTranslation(languageContent, locale),\n [languageContent, locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAa,kBACX,oBACY;CACZ,MAAM,EAAE,WAAW,WAAW,sBAAsB;AAEpD,QAAO,cACC,eAAe,iBAAiB,OAAO,EAC7C,CAAC,iBAAiB,OAAO,CAC1B"}
@@ -1,75 +1,53 @@
1
- "use client";
1
+ 'use client';
2
+
3
+
4
+ import { useIntlayerContext } from "../client/IntlayerProvider.mjs";
5
+ import { ContentSelector } from "../UI/ContentSelector.mjs";
6
+ import { useCallback, useMemo } from "react";
2
7
  import { jsx } from "react/jsx-runtime";
3
8
  import { isSameKeyPath } from "@intlayer/core";
4
- import {
5
- MessageKey,
6
- useCommunicator,
7
- useEditorEnabled,
8
- useFocusDictionary
9
- } from "@intlayer/editor-react";
10
- import { useCallback, useMemo } from "react";
11
- import { useIntlayerContext } from "../client/index.mjs";
12
- import { ContentSelector } from "../UI/ContentSelector.mjs";
13
- const ContentSelectorWrapperContent = ({
14
- children,
15
- dictionaryKey,
16
- keyPath
17
- }) => {
18
- const { focusedContent, setFocusedContent } = useFocusDictionary();
19
- const { postMessage, senderId } = useCommunicator();
20
- const handleSelect = useCallback(
21
- () => setFocusedContent({
22
- dictionaryKey,
23
- keyPath
24
- }),
25
- [dictionaryKey, keyPath]
26
- );
27
- const handleHover = useCallback(
28
- () => postMessage({
29
- type: `${MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,
30
- data: {
31
- dictionaryKey,
32
- keyPath
33
- },
34
- senderId
35
- }),
36
- [dictionaryKey, keyPath]
37
- );
38
- const handleUnhover = useCallback(
39
- () => postMessage({
40
- type: `${MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,
41
- data: null,
42
- senderId
43
- }),
44
- [senderId]
45
- );
46
- const isSelected = useMemo(
47
- () => (focusedContent?.dictionaryKey === dictionaryKey && (focusedContent?.keyPath?.length ?? 0) > 0 && isSameKeyPath(focusedContent?.keyPath ?? [], keyPath)) ?? false,
48
- [focusedContent, keyPath, dictionaryKey]
49
- );
50
- return /* @__PURE__ */ jsx(
51
- ContentSelector,
52
- {
53
- onPress: handleSelect,
54
- onHover: handleHover,
55
- onUnhover: handleUnhover,
56
- isSelecting: isSelected,
57
- children
58
- }
59
- );
60
- };
61
- const ContentSelectorRenderer = ({
62
- children,
63
- ...props
64
- }) => {
65
- const { enabled } = useEditorEnabled();
66
- const { disableEditor } = useIntlayerContext();
67
- if (enabled && !disableEditor) {
68
- return /* @__PURE__ */ jsx(ContentSelectorWrapperContent, { ...props, children });
69
- }
70
- return children;
9
+ import { MessageKey, useCommunicator, useEditorEnabled, useFocusDictionary } from "@intlayer/editor-react";
10
+
11
+ //#region src/editor/ContentSelectorWrapper.tsx
12
+ const ContentSelectorWrapperContent = ({ children, dictionaryKey, keyPath }) => {
13
+ const { focusedContent, setFocusedContent } = useFocusDictionary();
14
+ const { postMessage, senderId } = useCommunicator();
15
+ return /* @__PURE__ */ jsx(ContentSelector, {
16
+ onPress: useCallback(() => setFocusedContent({
17
+ dictionaryKey,
18
+ keyPath
19
+ }), [dictionaryKey, keyPath]),
20
+ onHover: useCallback(() => postMessage({
21
+ type: `${MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,
22
+ data: {
23
+ dictionaryKey,
24
+ keyPath
25
+ },
26
+ senderId
27
+ }), [dictionaryKey, keyPath]),
28
+ onUnhover: useCallback(() => postMessage({
29
+ type: `${MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,
30
+ data: null,
31
+ senderId
32
+ }), [senderId]),
33
+ isSelecting: useMemo(() => (focusedContent?.dictionaryKey === dictionaryKey && (focusedContent?.keyPath?.length ?? 0) > 0 && isSameKeyPath(focusedContent?.keyPath ?? [], keyPath)) ?? false, [
34
+ focusedContent,
35
+ keyPath,
36
+ dictionaryKey
37
+ ]),
38
+ children
39
+ });
71
40
  };
72
- export {
73
- ContentSelectorRenderer
41
+ const ContentSelectorRenderer = ({ children,...props }) => {
42
+ const { enabled } = useEditorEnabled();
43
+ const { disableEditor } = useIntlayerContext();
44
+ if (enabled && !disableEditor) return /* @__PURE__ */ jsx(ContentSelectorWrapperContent, {
45
+ ...props,
46
+ children
47
+ });
48
+ return children;
74
49
  };
50
+
51
+ //#endregion
52
+ export { ContentSelectorRenderer };
75
53
  //# sourceMappingURL=ContentSelectorWrapper.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/editor/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { type NodeProps, isSameKeyPath } from '@intlayer/core';\nimport {\n MessageKey,\n useCommunicator,\n useEditorEnabled,\n useFocusDictionary,\n} from '@intlayer/editor-react';\nimport { type FC, type HTMLAttributes, useCallback, useMemo } from 'react';\nimport { useIntlayerContext } from '../client';\nimport { ContentSelector } from '../UI/ContentSelector';\n\nexport type ContentSelectorWrapperProps = NodeProps &\n Omit<HTMLAttributes<HTMLDivElement>, 'children'>;\n\nconst ContentSelectorWrapperContent: FC<ContentSelectorWrapperProps> = ({\n children,\n dictionaryKey,\n keyPath,\n}) => {\n const { focusedContent, setFocusedContent } = useFocusDictionary();\n const { postMessage, senderId } = useCommunicator();\n\n const handleSelect = useCallback(\n () =>\n setFocusedContent({\n dictionaryKey,\n keyPath,\n }),\n [dictionaryKey, keyPath]\n );\n\n const handleHover = useCallback(\n () =>\n postMessage({\n type: `${MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,\n data: {\n dictionaryKey,\n keyPath,\n },\n senderId,\n }),\n [dictionaryKey, keyPath]\n );\n\n const handleUnhover = useCallback(\n () =>\n postMessage({\n type: `${MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,\n data: null,\n senderId,\n }),\n [senderId]\n );\n\n const isSelected = useMemo(\n () =>\n (focusedContent?.dictionaryKey === dictionaryKey &&\n (focusedContent?.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(focusedContent?.keyPath ?? [], keyPath)) ??\n false,\n [focusedContent, keyPath, dictionaryKey]\n );\n\n return (\n <ContentSelector\n onPress={handleSelect}\n onHover={handleHover}\n onUnhover={handleUnhover}\n isSelecting={isSelected}\n >\n {children}\n </ContentSelector>\n );\n};\n\nexport const ContentSelectorRenderer: FC<ContentSelectorWrapperProps> = ({\n children,\n ...props\n}) => {\n const { enabled } = useEditorEnabled();\n const { disableEditor } = useIntlayerContext();\n\n if (enabled && !disableEditor) {\n return (\n <ContentSelectorWrapperContent {...props}>\n {children}\n </ContentSelectorWrapperContent>\n );\n }\n\n return children;\n};\n"],"mappings":";AAkEI;AAhEJ,SAAyB,qBAAqB;AAC9C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAuC,aAAa,eAAe;AACnE,SAAS,0BAA0B;AACnC,SAAS,uBAAuB;AAKhC,MAAM,gCAAiE,CAAC;AAAA,EACtE;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,gBAAgB,kBAAkB,IAAI,mBAAmB;AACjE,QAAM,EAAE,aAAa,SAAS,IAAI,gBAAgB;AAElD,QAAM,eAAe;AAAA,IACnB,MACE,kBAAkB;AAAA,MAChB;AAAA,MACA;AAAA,IACF,CAAC;AAAA,IACH,CAAC,eAAe,OAAO;AAAA,EACzB;AAEA,QAAM,cAAc;AAAA,IAClB,MACE,YAAY;AAAA,MACV,MAAM,GAAG,WAAW,gCAAgC;AAAA,MACpD,MAAM;AAAA,QACJ;AAAA,QACA;AAAA,MACF;AAAA,MACA;AAAA,IACF,CAAC;AAAA,IACH,CAAC,eAAe,OAAO;AAAA,EACzB;AAEA,QAAM,gBAAgB;AAAA,IACpB,MACE,YAAY;AAAA,MACV,MAAM,GAAG,WAAW,gCAAgC;AAAA,MACpD,MAAM;AAAA,MACN;AAAA,IACF,CAAC;AAAA,IACH,CAAC,QAAQ;AAAA,EACX;AAEA,QAAM,aAAa;AAAA,IACjB,OACG,gBAAgB,kBAAkB,kBAChC,gBAAgB,SAAS,UAAU,KAAK,KACzC,cAAc,gBAAgB,WAAW,CAAC,GAAG,OAAO,MACtD;AAAA,IACF,CAAC,gBAAgB,SAAS,aAAa;AAAA,EACzC;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAS;AAAA,MACT,SAAS;AAAA,MACT,WAAW;AAAA,MACX,aAAa;AAAA,MAEZ;AAAA;AAAA,EACH;AAEJ;AAEO,MAAM,0BAA2D,CAAC;AAAA,EACvE;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,EAAE,QAAQ,IAAI,iBAAiB;AACrC,QAAM,EAAE,cAAc,IAAI,mBAAmB;AAE7C,MAAI,WAAW,CAAC,eAAe;AAC7B,WACE,oBAAC,iCAA+B,GAAG,OAChC,UACH;AAAA,EAEJ;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"file":"ContentSelectorWrapper.mjs","names":["ContentSelectorWrapperContent: FC<ContentSelectorWrapperProps>","ContentSelectorRenderer: FC<ContentSelectorWrapperProps>"],"sources":["../../../src/editor/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { isSameKeyPath, type NodeProps } from '@intlayer/core';\nimport {\n MessageKey,\n useCommunicator,\n useEditorEnabled,\n useFocusDictionary,\n} from '@intlayer/editor-react';\nimport { type FC, type HTMLAttributes, useCallback, useMemo } from 'react';\nimport { useIntlayerContext } from '../client';\nimport { ContentSelector } from '../UI/ContentSelector';\n\nexport type ContentSelectorWrapperProps = NodeProps &\n Omit<HTMLAttributes<HTMLDivElement>, 'children'>;\n\nconst ContentSelectorWrapperContent: FC<ContentSelectorWrapperProps> = ({\n children,\n dictionaryKey,\n keyPath,\n}) => {\n const { focusedContent, setFocusedContent } = useFocusDictionary();\n const { postMessage, senderId } = useCommunicator();\n\n const handleSelect = useCallback(\n () =>\n setFocusedContent({\n dictionaryKey,\n keyPath,\n }),\n [dictionaryKey, keyPath]\n );\n\n const handleHover = useCallback(\n () =>\n postMessage({\n type: `${MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,\n data: {\n dictionaryKey,\n keyPath,\n },\n senderId,\n }),\n [dictionaryKey, keyPath]\n );\n\n const handleUnhover = useCallback(\n () =>\n postMessage({\n type: `${MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,\n data: null,\n senderId,\n }),\n [senderId]\n );\n\n const isSelected = useMemo(\n () =>\n (focusedContent?.dictionaryKey === dictionaryKey &&\n (focusedContent?.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(focusedContent?.keyPath ?? [], keyPath)) ??\n false,\n [focusedContent, keyPath, dictionaryKey]\n );\n\n return (\n <ContentSelector\n onPress={handleSelect}\n onHover={handleHover}\n onUnhover={handleUnhover}\n isSelecting={isSelected}\n >\n {children}\n </ContentSelector>\n );\n};\n\nexport const ContentSelectorRenderer: FC<ContentSelectorWrapperProps> = ({\n children,\n ...props\n}) => {\n const { enabled } = useEditorEnabled();\n const { disableEditor } = useIntlayerContext();\n\n if (enabled && !disableEditor) {\n return (\n <ContentSelectorWrapperContent {...props}>\n {children}\n </ContentSelectorWrapperContent>\n );\n }\n\n return children;\n};\n"],"mappings":";;;;;;;;;;;AAgBA,MAAMA,iCAAkE,EACtE,UACA,eACA,cACI;CACJ,MAAM,EAAE,gBAAgB,sBAAsB,oBAAoB;CAClE,MAAM,EAAE,aAAa,aAAa,iBAAiB;AA2CnD,QACE,oBAAC;EACC,SA3CiB,kBAEjB,kBAAkB;GAChB;GACA;GACD,CAAC,EACJ,CAAC,eAAe,QAAQ,CACzB;EAqCG,SAnCgB,kBAEhB,YAAY;GACV,MAAM,GAAG,WAAW,iCAAiC;GACrD,MAAM;IACJ;IACA;IACD;GACD;GACD,CAAC,EACJ,CAAC,eAAe,QAAQ,CACzB;EAyBG,WAvBkB,kBAElB,YAAY;GACV,MAAM,GAAG,WAAW,iCAAiC;GACrD,MAAM;GACN;GACD,CAAC,EACJ,CAAC,SAAS,CACX;EAgBG,aAde,eAEd,gBAAgB,kBAAkB,kBAChC,gBAAgB,SAAS,UAAU,KAAK,KACzC,cAAc,gBAAgB,WAAW,EAAE,EAAE,QAAQ,KACvD,OACF;GAAC;GAAgB;GAAS;GAAc,CACzC;EASI;GACe;;AAItB,MAAaC,2BAA4D,EACvE,SACA,GAAG,YACC;CACJ,MAAM,EAAE,YAAY,kBAAkB;CACtC,MAAM,EAAE,kBAAkB,oBAAoB;AAE9C,KAAI,WAAW,CAAC,cACd,QACE,oBAAC;EAA8B,GAAI;EAChC;GAC6B;AAIpC,QAAO"}
@@ -1,70 +1,48 @@
1
- "use client";
1
+ 'use client';
2
+
3
+
2
4
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ import { EditorProvider, useCrossURLPathSetter, useEditorEnabled, useIframeClickInterceptor } from "@intlayer/editor-react";
3
6
  import configuration from "@intlayer/config/built";
4
- import {
5
- EditorProvider,
6
- useCrossURLPathSetter,
7
- useEditorEnabled,
8
- useIframeClickInterceptor
9
- } from "@intlayer/editor-react";
7
+
8
+ //#region src/editor/IntlayerEditorProvider.tsx
10
9
  const IntlayerEditorHooksEnabled = () => {
11
- useCrossURLPathSetter();
12
- useIframeClickInterceptor();
13
- return /* @__PURE__ */ jsx(Fragment, {});
10
+ /**
11
+ * URL Messages
12
+ */
13
+ useCrossURLPathSetter();
14
+ /**
15
+ * Click Messages
16
+ */
17
+ useIframeClickInterceptor();
18
+ return /* @__PURE__ */ jsx(Fragment, {});
14
19
  };
15
- const { editor } = configuration;
20
+ const { editor } = configuration ?? {};
16
21
  const IntlayerEditorHook = () => {
17
- const { enabled } = useEditorEnabled();
18
- return enabled ? /* @__PURE__ */ jsx(IntlayerEditorHooksEnabled, {}) : /* @__PURE__ */ jsx(Fragment, {});
22
+ const { enabled } = useEditorEnabled();
23
+ return enabled ? /* @__PURE__ */ jsx(IntlayerEditorHooksEnabled, {}) : /* @__PURE__ */ jsx(Fragment, {});
19
24
  };
20
25
  const IntlayerEditorProvider = ({ children }) => {
21
- return /* @__PURE__ */ jsxs(
22
- EditorProvider,
23
- {
24
- postMessage: (data) => {
25
- if (typeof window === "undefined") return;
26
- const isInIframe = window.self !== window.top;
27
- if (!isInIframe) return;
28
- if (editor.applicationURL.length > 0) {
29
- window?.postMessage(
30
- data,
31
- // Use to restrict the origin of the editor for security reasons.
32
- // Correspond to the current application URL to synchronize the locales states.
33
- editor.applicationURL
34
- );
35
- }
36
- if (editor.editorURL.length > 0) {
37
- window.parent?.postMessage(
38
- data,
39
- // Use to restrict the origin of the editor for security reasons.
40
- // Correspond to the editor URL to synchronize the locales states.
41
- editor.editorURL
42
- );
43
- }
44
- if (editor.cmsURL.length > 0) {
45
- window.parent?.postMessage(
46
- data,
47
- // Use to restrict the origin of the CMS for security reasons.
48
- // Correspond to the CMS URL.
49
- editor.cmsURL
50
- );
51
- }
52
- },
53
- allowedOrigins: [
54
- editor?.editorURL,
55
- editor?.cmsURL,
56
- editor?.applicationURL
57
- ],
58
- mode: "client",
59
- configuration,
60
- children: [
61
- /* @__PURE__ */ jsx(IntlayerEditorHook, {}),
62
- children
63
- ]
64
- }
65
- );
66
- };
67
- export {
68
- IntlayerEditorProvider
26
+ return /* @__PURE__ */ jsxs(EditorProvider, {
27
+ postMessage: (data) => {
28
+ if (typeof window === "undefined") return;
29
+ if (!editor) return;
30
+ if (!(window.self !== window.top)) return;
31
+ if (editor.applicationURL.length > 0) window?.postMessage(data, editor.applicationURL);
32
+ if (editor.editorURL.length > 0) window.parent?.postMessage(data, editor.editorURL);
33
+ if (editor.cmsURL.length > 0) window.parent?.postMessage(data, editor.cmsURL);
34
+ },
35
+ allowedOrigins: [
36
+ editor?.editorURL,
37
+ editor?.cmsURL,
38
+ editor?.applicationURL
39
+ ].filter(Boolean),
40
+ mode: "client",
41
+ configuration,
42
+ children: [/* @__PURE__ */ jsx(IntlayerEditorHook, {}), children]
43
+ });
69
44
  };
45
+
46
+ //#endregion
47
+ export { IntlayerEditorProvider };
70
48
  //# sourceMappingURL=IntlayerEditorProvider.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport configuration from '@intlayer/config/built';\nimport {\n EditorProvider,\n useCrossURLPathSetter,\n useEditorEnabled,\n useIframeClickInterceptor,\n} from '@intlayer/editor-react';\nimport { type FC, type PropsWithChildren } from 'react';\n\nconst IntlayerEditorHooksEnabled: FC = () => {\n /**\n * URL Messages\n */\n useCrossURLPathSetter();\n\n /**\n * Click Messages\n */\n useIframeClickInterceptor();\n\n return <></>;\n};\n\nconst { editor } = configuration;\n\nconst IntlayerEditorHook: FC = () => {\n const { enabled } = useEditorEnabled();\n\n return enabled ? <IntlayerEditorHooksEnabled /> : <></>;\n};\n\nexport const IntlayerEditorProvider: FC<PropsWithChildren> = ({ children }) => {\n return (\n <EditorProvider\n postMessage={(data: any) => {\n if (typeof window === 'undefined') return;\n\n const isInIframe = window.self !== window.top;\n if (!isInIframe) return;\n\n if (editor.applicationURL.length > 0) {\n window?.postMessage(\n data,\n // Use to restrict the origin of the editor for security reasons.\n // Correspond to the current application URL to synchronize the locales states.\n editor.applicationURL\n );\n }\n\n if (editor.editorURL.length > 0) {\n window.parent?.postMessage(\n data,\n // Use to restrict the origin of the editor for security reasons.\n // Correspond to the editor URL to synchronize the locales states.\n editor.editorURL\n );\n }\n\n if (editor.cmsURL.length > 0) {\n window.parent?.postMessage(\n data,\n // Use to restrict the origin of the CMS for security reasons.\n // Correspond to the CMS URL.\n editor.cmsURL\n );\n }\n }}\n allowedOrigins={[\n editor?.editorURL,\n editor?.cmsURL,\n editor?.applicationURL,\n ]}\n mode=\"client\"\n configuration={configuration}\n >\n <IntlayerEditorHook />\n {children}\n </EditorProvider>\n );\n};\n"],"mappings":";AAsBS,wBAaL,YAbK;AApBT,OAAO,mBAAmB;AAC1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,MAAM,6BAAiC,MAAM;AAI3C,wBAAsB;AAKtB,4BAA0B;AAE1B,SAAO,gCAAE;AACX;AAEA,MAAM,EAAE,OAAO,IAAI;AAEnB,MAAM,qBAAyB,MAAM;AACnC,QAAM,EAAE,QAAQ,IAAI,iBAAiB;AAErC,SAAO,UAAU,oBAAC,8BAA2B,IAAK,gCAAE;AACtD;AAEO,MAAM,yBAAgD,CAAC,EAAE,SAAS,MAAM;AAC7E,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAa,CAAC,SAAc;AAC1B,YAAI,OAAO,WAAW,YAAa;AAEnC,cAAM,aAAa,OAAO,SAAS,OAAO;AAC1C,YAAI,CAAC,WAAY;AAEjB,YAAI,OAAO,eAAe,SAAS,GAAG;AACpC,kBAAQ;AAAA,YACN;AAAA;AAAA;AAAA,YAGA,OAAO;AAAA,UACT;AAAA,QACF;AAEA,YAAI,OAAO,UAAU,SAAS,GAAG;AAC/B,iBAAO,QAAQ;AAAA,YACb;AAAA;AAAA;AAAA,YAGA,OAAO;AAAA,UACT;AAAA,QACF;AAEA,YAAI,OAAO,OAAO,SAAS,GAAG;AAC5B,iBAAO,QAAQ;AAAA,YACb;AAAA;AAAA;AAAA,YAGA,OAAO;AAAA,UACT;AAAA,QACF;AAAA,MACF;AAAA,MACA,gBAAgB;AAAA,QACd,QAAQ;AAAA,QACR,QAAQ;AAAA,QACR,QAAQ;AAAA,MACV;AAAA,MACA,MAAK;AAAA,MACL;AAAA,MAEA;AAAA,4BAAC,sBAAmB;AAAA,QACnB;AAAA;AAAA;AAAA,EACH;AAEJ;","names":[]}
1
+ {"version":3,"file":"IntlayerEditorProvider.mjs","names":["IntlayerEditorHooksEnabled: FC","IntlayerEditorHook: FC","IntlayerEditorProvider: FC<PropsWithChildren>"],"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport configuration from '@intlayer/config/built';\nimport {\n EditorProvider,\n useCrossURLPathSetter,\n useEditorEnabled,\n useIframeClickInterceptor,\n} from '@intlayer/editor-react';\nimport type { FC, PropsWithChildren } from 'react';\n\nconst IntlayerEditorHooksEnabled: FC = () => {\n /**\n * URL Messages\n */\n useCrossURLPathSetter();\n\n /**\n * Click Messages\n */\n useIframeClickInterceptor();\n\n return <></>;\n};\n\nconst { editor } = configuration ?? {};\n\nconst IntlayerEditorHook: FC = () => {\n const { enabled } = useEditorEnabled();\n\n return enabled ? <IntlayerEditorHooksEnabled /> : <></>;\n};\n\nexport const IntlayerEditorProvider: FC<PropsWithChildren> = ({ children }) => {\n return (\n <EditorProvider\n postMessage={(data: any) => {\n if (typeof window === 'undefined') return;\n if (!editor) return;\n\n const isInIframe = window.self !== window.top;\n if (!isInIframe) return;\n\n if (editor.applicationURL.length > 0) {\n window?.postMessage(\n data,\n // Use to restrict the origin of the editor for security reasons.\n // Correspond to the current application URL to synchronize the locales states.\n editor.applicationURL\n );\n }\n\n if (editor.editorURL.length > 0) {\n window.parent?.postMessage(\n data,\n // Use to restrict the origin of the editor for security reasons.\n // Correspond to the editor URL to synchronize the locales states.\n editor.editorURL\n );\n }\n\n if (editor.cmsURL.length > 0) {\n window.parent?.postMessage(\n data,\n // Use to restrict the origin of the CMS for security reasons.\n // Correspond to the CMS URL.\n editor.cmsURL\n );\n }\n }}\n allowedOrigins={\n [editor?.editorURL, editor?.cmsURL, editor?.applicationURL].filter(\n Boolean\n ) as string[]\n }\n mode=\"client\"\n configuration={configuration}\n >\n <IntlayerEditorHook />\n {children}\n </EditorProvider>\n );\n};\n"],"mappings":";;;;;;;;AAWA,MAAMA,mCAAuC;;;;AAI3C,wBAAuB;;;;AAKvB,4BAA2B;AAE3B,QAAO,iCAAK;;AAGd,MAAM,EAAE,WAAW,iBAAiB,EAAE;AAEtC,MAAMC,2BAA+B;CACnC,MAAM,EAAE,YAAY,kBAAkB;AAEtC,QAAO,UAAU,oBAAC,+BAA6B,GAAG,iCAAK;;AAGzD,MAAaC,0BAAiD,EAAE,eAAe;AAC7E,QACE,qBAAC;EACC,cAAc,SAAc;AAC1B,OAAI,OAAO,WAAW,YAAa;AACnC,OAAI,CAAC,OAAQ;AAGb,OAAI,EADe,OAAO,SAAS,OAAO,KACzB;AAEjB,OAAI,OAAO,eAAe,SAAS,EACjC,SAAQ,YACN,MAGA,OAAO,eACR;AAGH,OAAI,OAAO,UAAU,SAAS,EAC5B,QAAO,QAAQ,YACb,MAGA,OAAO,UACR;AAGH,OAAI,OAAO,OAAO,SAAS,EACzB,QAAO,QAAQ,YACb,MAGA,OAAO,OACR;;EAGL,gBACE;GAAC,QAAQ;GAAW,QAAQ;GAAQ,QAAQ;GAAe,CAAC,OAC1D,QACD;EAEH,MAAK;EACU;aAEf,oBAAC,uBAAqB,EACrB;GACc"}
@@ -1,2 +1,3 @@
1
- export * from "./ContentSelectorWrapper.mjs";
2
- //# sourceMappingURL=index.mjs.map
1
+ import { ContentSelectorRenderer } from "./ContentSelectorWrapper.mjs";
2
+
3
+ export { ContentSelectorRenderer };
@@ -1,38 +1,39 @@
1
- "use client";
1
+ 'use client';
2
+
3
+
4
+ import { ContentSelectorRenderer } from "./ContentSelectorWrapper.mjs";
5
+ import { createElement } from "react";
2
6
  import { getContent } from "@intlayer/core";
3
7
  import { useEditedContentActions } from "@intlayer/editor-react";
4
- const useEditedContentRenderer = ({
5
- dictionaryKey,
6
- keyPath,
7
- children
8
- }) => {
9
- const editedContentContext = useEditedContentActions();
10
- if (editedContentContext) {
11
- const editedValue = editedContentContext.getEditedContentValue(
12
- dictionaryKey,
13
- keyPath
14
- );
15
- const value = editedValue ?? children;
16
- return value;
17
- }
18
- return children;
8
+
9
+ //#region src/editor/useEditedContentRenderer.tsx
10
+ const useEditedContentRenderer = ({ dictionaryKey, keyPath, children }) => {
11
+ const editedContentContext = useEditedContentActions();
12
+ if (editedContentContext) return editedContentContext.getEditedContentValue(dictionaryKey, keyPath) ?? children;
13
+ return children;
19
14
  };
20
15
  const EditedContentRenderer = (props) => {
21
- const content = useEditedContentRenderer(props);
22
- if (typeof content === "object") {
23
- const transformedEditedContent = getContent(content, props, props.locale);
24
- if (typeof transformedEditedContent !== "string") {
25
- console.error(
26
- `Incorrect edited content format. Content type: ${typeof transformedEditedContent}. Expected string. Value ${JSON.stringify(transformedEditedContent)}`
27
- );
28
- return props.children;
29
- }
30
- return transformedEditedContent;
31
- }
32
- return content;
33
- };
34
- export {
35
- EditedContentRenderer,
36
- useEditedContentRenderer
16
+ const content = useEditedContentRenderer(props);
17
+ if (typeof content === "object") {
18
+ const transformedEditedContent = getContent(content, props, props.locale);
19
+ if (typeof transformedEditedContent !== "string") {
20
+ console.error(`Incorrect edited content format. Content type: ${typeof transformedEditedContent}. Expected string. Value ${JSON.stringify(transformedEditedContent)}`);
21
+ return /* @__PURE__ */ createElement(ContentSelectorRenderer, {
22
+ ...props,
23
+ key: props.children
24
+ }, props.children);
25
+ }
26
+ return /* @__PURE__ */ createElement(ContentSelectorRenderer, {
27
+ ...props,
28
+ key: props.children
29
+ }, transformedEditedContent);
30
+ }
31
+ return /* @__PURE__ */ createElement(ContentSelectorRenderer, {
32
+ ...props,
33
+ key: props.children
34
+ }, content);
37
35
  };
36
+
37
+ //#endregion
38
+ export { EditedContentRenderer, useEditedContentRenderer };
38
39
  //# sourceMappingURL=useEditedContentRenderer.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/editor/useEditedContentRenderer.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config/client';\nimport { getContent, type KeyPath } from '@intlayer/core';\nimport { useEditedContentActions } from '@intlayer/editor-react';\nimport type { FC } from 'react';\n\ntype EditedContentRendererProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n children: string;\n locale?: Locales;\n};\n\nexport const useEditedContentRenderer = ({\n dictionaryKey,\n keyPath,\n children,\n}: EditedContentRendererProps) => {\n const editedContentContext = useEditedContentActions();\n\n if (editedContentContext) {\n const editedValue = editedContentContext.getEditedContentValue(\n dictionaryKey,\n keyPath\n ) as string;\n\n const value = editedValue ?? children;\n\n return value;\n }\n\n return children;\n};\n\nexport const EditedContentRenderer: FC<EditedContentRendererProps> = (\n props\n) => {\n const content = useEditedContentRenderer(props);\n\n if (typeof content === 'object') {\n const transformedEditedContent = getContent(content, props, props.locale);\n\n if (typeof transformedEditedContent !== 'string') {\n console.error(\n `Incorrect edited content format. Content type: ${typeof transformedEditedContent}. Expected string. Value ${JSON.stringify(transformedEditedContent)}`\n );\n\n return props.children;\n }\n\n return transformedEditedContent;\n }\n\n return content;\n};\n"],"mappings":";AAGA,SAAS,kBAAgC;AACzC,SAAS,+BAA+B;AAUjC,MAAM,2BAA2B,CAAC;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AACF,MAAkC;AAChC,QAAM,uBAAuB,wBAAwB;AAErD,MAAI,sBAAsB;AACxB,UAAM,cAAc,qBAAqB;AAAA,MACvC;AAAA,MACA;AAAA,IACF;AAEA,UAAM,QAAQ,eAAe;AAE7B,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAEO,MAAM,wBAAwD,CACnE,UACG;AACH,QAAM,UAAU,yBAAyB,KAAK;AAE9C,MAAI,OAAO,YAAY,UAAU;AAC/B,UAAM,2BAA2B,WAAW,SAAS,OAAO,MAAM,MAAM;AAExE,QAAI,OAAO,6BAA6B,UAAU;AAChD,cAAQ;AAAA,QACN,kDAAkD,OAAO,wBAAwB,4BAA4B,KAAK,UAAU,wBAAwB,CAAC;AAAA,MACvJ;AAEA,aAAO,MAAM;AAAA,IACf;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"file":"useEditedContentRenderer.mjs","names":["EditedContentRenderer: FC<EditedContentRendererProps>"],"sources":["../../../src/editor/useEditedContentRenderer.tsx"],"sourcesContent":["'use client';\n\nimport { getContent } from '@intlayer/core';\nimport { useEditedContentActions } from '@intlayer/editor-react';\nimport type { KeyPath, Locale } from '@intlayer/types';\nimport type { FC } from 'react';\nimport { ContentSelectorRenderer } from './ContentSelectorWrapper';\n\ntype EditedContentRendererProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n children: string;\n locale?: Locale;\n};\n\nexport const useEditedContentRenderer = ({\n dictionaryKey,\n keyPath,\n children,\n}: EditedContentRendererProps) => {\n const editedContentContext = useEditedContentActions();\n\n if (editedContentContext) {\n const editedValue = editedContentContext.getEditedContentValue(\n dictionaryKey,\n keyPath\n ) as string;\n\n const value = editedValue ?? children;\n\n return value;\n }\n\n return children;\n};\n\nexport const EditedContentRenderer: FC<EditedContentRendererProps> = (\n props\n) => {\n const content = useEditedContentRenderer(props);\n\n if (typeof content === 'object') {\n const transformedEditedContent = getContent(content, props, props.locale);\n\n if (typeof transformedEditedContent !== 'string') {\n console.error(\n `Incorrect edited content format. Content type: ${typeof transformedEditedContent}. Expected string. Value ${JSON.stringify(transformedEditedContent)}`\n );\n\n return (\n <ContentSelectorRenderer {...props} key={props.children}>\n {props.children}\n </ContentSelectorRenderer>\n );\n }\n\n return (\n <ContentSelectorRenderer {...props} key={props.children}>\n {transformedEditedContent}\n </ContentSelectorRenderer>\n );\n }\n\n return (\n <ContentSelectorRenderer {...props} key={props.children}>\n {content}\n </ContentSelectorRenderer>\n );\n};\n"],"mappings":";;;;;;;;;AAeA,MAAa,4BAA4B,EACvC,eACA,SACA,eACgC;CAChC,MAAM,uBAAuB,yBAAyB;AAEtD,KAAI,qBAQF,QAPoB,qBAAqB,sBACvC,eACA,QACD,IAE4B;AAK/B,QAAO;;AAGT,MAAaA,yBACX,UACG;CACH,MAAM,UAAU,yBAAyB,MAAM;AAE/C,KAAI,OAAO,YAAY,UAAU;EAC/B,MAAM,2BAA2B,WAAW,SAAS,OAAO,MAAM,OAAO;AAEzE,MAAI,OAAO,6BAA6B,UAAU;AAChD,WAAQ,MACN,kDAAkD,OAAO,yBAAyB,2BAA2B,KAAK,UAAU,yBAAyB,GACtJ;AAED,UACE,8BAAC;IAAwB,GAAI;IAAO,KAAK,MAAM;MAC5C,MAAM,SACiB;;AAI9B,SACE,8BAAC;GAAwB,GAAI;GAAO,KAAK,MAAM;KAC5C,yBACuB;;AAI9B,QACE,8BAAC;EAAwB,GAAI;EAAO,KAAK,MAAM;IAC5C,QACuB"}
@@ -1,25 +1,16 @@
1
- import {
2
- getDictionary as getDictionaryCore
3
- } from "@intlayer/core";
4
- import {
5
- intlayerNodePlugins,
6
- markdownPlugin,
7
- reactNodePlugins
8
- } from "./plugins.mjs";
1
+ import { intlayerNodePlugins, markdownPlugin, reactNodePlugins } from "./plugins.mjs";
2
+ import { getDictionary as getDictionary$1 } from "@intlayer/core";
3
+
4
+ //#region src/getDictionary.ts
9
5
  const getDictionary = (dictionary, locale, additionalPlugins) => {
10
- const plugins = [
11
- intlayerNodePlugins,
12
- reactNodePlugins,
13
- markdownPlugin,
14
- ...additionalPlugins ?? []
15
- ];
16
- return getDictionaryCore(
17
- dictionary,
18
- locale,
19
- plugins
20
- );
21
- };
22
- export {
23
- getDictionary
6
+ return getDictionary$1(dictionary, locale, [
7
+ intlayerNodePlugins,
8
+ reactNodePlugins,
9
+ markdownPlugin,
10
+ ...additionalPlugins ?? []
11
+ ]);
24
12
  };
13
+
14
+ //#endregion
15
+ export { getDictionary };
25
16
  //# sourceMappingURL=getDictionary.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/getDictionary.ts"],"sourcesContent":["import type { Locales, LocalesValues } from '@intlayer/config/client';\nimport {\n type Dictionary,\n type Plugins,\n getDictionary as getDictionaryCore,\n} from '@intlayer/core';\nimport {\n type DeepTransformContent,\n intlayerNodePlugins,\n markdownPlugin,\n reactNodePlugins,\n} from './plugins';\n\nexport const getDictionary = <\n T extends Dictionary,\n L extends LocalesValues = Locales,\n>(\n dictionary: T,\n locale?: L,\n additionalPlugins?: Plugins[]\n) => {\n const plugins: Plugins[] = [\n intlayerNodePlugins,\n reactNodePlugins,\n markdownPlugin,\n ...(additionalPlugins ?? []),\n ];\n\n return getDictionaryCore(\n dictionary,\n locale,\n plugins\n ) as any as DeepTransformContent<T['content']>;\n};\n"],"mappings":"AACA;AAAA,EAGE,iBAAiB;AAAA,OACZ;AACP;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEA,MAAM,gBAAgB,CAI3B,YACA,QACA,sBACG;AACH,QAAM,UAAqB;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAI,qBAAqB,CAAC;AAAA,EAC5B;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"file":"getDictionary.mjs","names":["getDictionaryCore"],"sources":["../../src/getDictionary.ts"],"sourcesContent":["import {\n getDictionary as getDictionaryCore,\n type Plugins,\n} from '@intlayer/core';\nimport type {\n DeclaredLocales,\n Dictionary,\n LocalesValues,\n} from '@intlayer/types';\nimport {\n type DeepTransformContent,\n intlayerNodePlugins,\n markdownPlugin,\n reactNodePlugins,\n} from './plugins';\n\nexport const getDictionary = <\n T extends Dictionary,\n L extends LocalesValues = DeclaredLocales,\n>(\n dictionary: T,\n locale?: L,\n additionalPlugins?: Plugins[]\n): DeepTransformContent<T['content'], L> => {\n const plugins: Plugins[] = [\n intlayerNodePlugins,\n reactNodePlugins,\n markdownPlugin,\n ...(additionalPlugins ?? []),\n ];\n\n return getDictionaryCore(dictionary, locale, plugins) as any;\n};\n"],"mappings":";;;;AAgBA,MAAa,iBAIX,YACA,QACA,sBAC0C;AAQ1C,QAAOA,gBAAkB,YAAY,QAPV;EACzB;EACA;EACA;EACA,GAAI,qBAAqB,EAAE;EAC5B,CAEoD"}
@@ -1,21 +1,16 @@
1
- import {
2
- getIntlayer as getIntlayerCore
3
- } from "@intlayer/core";
4
- import {
5
- intlayerNodePlugins,
6
- markdownPlugin,
7
- reactNodePlugins
8
- } from "./plugins.mjs";
1
+ import { intlayerNodePlugins, markdownPlugin, reactNodePlugins } from "./plugins.mjs";
2
+ import { getIntlayer as getIntlayer$1 } from "@intlayer/core";
3
+
4
+ //#region src/getIntlayer.ts
9
5
  const getIntlayer = (key, locale, additionalPlugins) => {
10
- const plugins = [
11
- intlayerNodePlugins,
12
- reactNodePlugins,
13
- markdownPlugin,
14
- ...additionalPlugins ?? []
15
- ];
16
- return getIntlayerCore(key, locale, plugins);
17
- };
18
- export {
19
- getIntlayer
6
+ return getIntlayer$1(key, locale, [
7
+ intlayerNodePlugins,
8
+ reactNodePlugins,
9
+ markdownPlugin,
10
+ ...additionalPlugins ?? []
11
+ ]);
20
12
  };
13
+
14
+ //#endregion
15
+ export { getIntlayer };
21
16
  //# sourceMappingURL=getIntlayer.mjs.map