angular-intlayer 6.1.6 → 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 (237) hide show
  1. package/dist/cjs/UI/ContentSelector.component.cjs +94 -121
  2. package/dist/cjs/UI/ContentSelector.component.cjs.map +1 -1
  3. package/dist/cjs/_virtual/rolldown_runtime.cjs +25 -0
  4. package/dist/cjs/client/index.cjs +19 -35
  5. package/dist/cjs/client/installIntlayer.cjs +39 -68
  6. package/dist/cjs/client/installIntlayer.cjs.map +1 -1
  7. package/dist/cjs/client/useDictionary.cjs +13 -36
  8. package/dist/cjs/client/useDictionary.cjs.map +1 -1
  9. package/dist/cjs/client/useDictionaryAsync.cjs +23 -48
  10. package/dist/cjs/client/useDictionaryAsync.cjs.map +1 -1
  11. package/dist/cjs/client/useDictionaryDynamic.cjs +24 -52
  12. package/dist/cjs/client/useDictionaryDynamic.cjs.map +1 -1
  13. package/dist/cjs/client/useIntlayer.cjs +16 -36
  14. package/dist/cjs/client/useIntlayer.cjs.map +1 -1
  15. package/dist/cjs/client/useLoadDynamic.cjs +26 -42
  16. package/dist/cjs/client/useLoadDynamic.cjs.map +1 -1
  17. package/dist/cjs/client/useLocale.cjs +35 -67
  18. package/dist/cjs/client/useLocale.cjs.map +1 -1
  19. package/dist/cjs/client/useLocaleStorage.cjs +61 -0
  20. package/dist/cjs/client/useLocaleStorage.cjs.map +1 -0
  21. package/dist/cjs/editor/ContentSelectorWrapper.component.cjs +41 -63
  22. package/dist/cjs/editor/ContentSelectorWrapper.component.cjs.map +1 -1
  23. package/dist/cjs/editor/EditedContentRenderer.component.cjs +44 -75
  24. package/dist/cjs/editor/EditedContentRenderer.component.cjs.map +1 -1
  25. package/dist/cjs/editor/EditorSelectorRenderer.component.cjs +25 -45
  26. package/dist/cjs/editor/EditorSelectorRenderer.component.cjs.map +1 -1
  27. package/dist/cjs/editor/communicator.cjs +55 -73
  28. package/dist/cjs/editor/communicator.cjs.map +1 -1
  29. package/dist/cjs/editor/configuration.cjs +21 -54
  30. package/dist/cjs/editor/configuration.cjs.map +1 -1
  31. package/dist/cjs/editor/createSharedComposable.cjs +46 -63
  32. package/dist/cjs/editor/createSharedComposable.cjs.map +1 -1
  33. package/dist/cjs/editor/dictionariesRecord.cjs +47 -77
  34. package/dist/cjs/editor/dictionariesRecord.cjs.map +1 -1
  35. package/dist/cjs/editor/editedContent.cjs +58 -71
  36. package/dist/cjs/editor/editedContent.cjs.map +1 -1
  37. package/dist/cjs/editor/editorEnabled.cjs +45 -70
  38. package/dist/cjs/editor/editorEnabled.cjs.map +1 -1
  39. package/dist/cjs/editor/editorLocale.cjs +21 -45
  40. package/dist/cjs/editor/editorLocale.cjs.map +1 -1
  41. package/dist/cjs/editor/focusDictionary.cjs +58 -74
  42. package/dist/cjs/editor/focusDictionary.cjs.map +1 -1
  43. package/dist/cjs/editor/index.cjs +9 -38
  44. package/dist/cjs/editor/installIntlayerEditor.cjs +46 -64
  45. package/dist/cjs/editor/installIntlayerEditor.cjs.map +1 -1
  46. package/dist/cjs/editor/useCrossFrameMessageListener.cjs +63 -72
  47. package/dist/cjs/editor/useCrossFrameMessageListener.cjs.map +1 -1
  48. package/dist/cjs/editor/useCrossFrameState.cjs +108 -88
  49. package/dist/cjs/editor/useCrossFrameState.cjs.map +1 -1
  50. package/dist/cjs/editor/useCrossURLPathState.cjs +64 -69
  51. package/dist/cjs/editor/useCrossURLPathState.cjs.map +1 -1
  52. package/dist/cjs/editor/useEditedContentRenderer.cjs +25 -54
  53. package/dist/cjs/editor/useEditedContentRenderer.cjs.map +1 -1
  54. package/dist/cjs/editor/useEditor.cjs +22 -44
  55. package/dist/cjs/editor/useEditor.cjs.map +1 -1
  56. package/dist/cjs/editor/useIframeClickInterceptor.cjs +38 -59
  57. package/dist/cjs/editor/useIframeClickInterceptor.cjs.map +1 -1
  58. package/dist/cjs/getDictionary.cjs +14 -39
  59. package/dist/cjs/getDictionary.cjs.map +1 -1
  60. package/dist/cjs/getIntlayer.cjs +14 -35
  61. package/dist/cjs/getIntlayer.cjs.map +1 -1
  62. package/dist/cjs/index.cjs +32 -31
  63. package/dist/cjs/markdown/index.cjs +6 -23
  64. package/dist/cjs/markdown/installIntlayerMarkdown.cjs +33 -60
  65. package/dist/cjs/markdown/installIntlayerMarkdown.cjs.map +1 -1
  66. package/dist/cjs/plugins.cjs +77 -108
  67. package/dist/cjs/plugins.cjs.map +1 -1
  68. package/dist/cjs/renderIntlayerNode.cjs +16 -56
  69. package/dist/cjs/renderIntlayerNode.cjs.map +1 -1
  70. package/dist/cjs/webpack/index.cjs +3 -23
  71. package/dist/cjs/webpack/mergeConfig.cjs +33 -68
  72. package/dist/cjs/webpack/mergeConfig.cjs.map +1 -1
  73. package/dist/esm/UI/ContentSelector.component.mjs +89 -104
  74. package/dist/esm/UI/ContentSelector.component.mjs.map +1 -1
  75. package/dist/esm/client/index.mjs +9 -8
  76. package/dist/esm/client/installIntlayer.mjs +29 -27
  77. package/dist/esm/client/installIntlayer.mjs.map +1 -1
  78. package/dist/esm/client/useDictionary.mjs +10 -11
  79. package/dist/esm/client/useDictionary.mjs.map +1 -1
  80. package/dist/esm/client/useDictionaryAsync.mjs +18 -12
  81. package/dist/esm/client/useDictionaryAsync.mjs.map +1 -1
  82. package/dist/esm/client/useDictionaryDynamic.mjs +18 -15
  83. package/dist/esm/client/useDictionaryDynamic.mjs.map +1 -1
  84. package/dist/esm/client/useIntlayer.mjs +12 -10
  85. package/dist/esm/client/useIntlayer.mjs.map +1 -1
  86. package/dist/esm/client/useLoadDynamic.mjs +23 -17
  87. package/dist/esm/client/useLoadDynamic.mjs.map +1 -1
  88. package/dist/esm/client/useLocale.mjs +30 -31
  89. package/dist/esm/client/useLocale.mjs.map +1 -1
  90. package/dist/esm/client/useLocaleStorage.mjs +54 -0
  91. package/dist/esm/client/useLocaleStorage.mjs.map +1 -0
  92. package/dist/esm/editor/ContentSelectorWrapper.component.mjs +32 -34
  93. package/dist/esm/editor/ContentSelectorWrapper.component.mjs.map +1 -1
  94. package/dist/esm/editor/EditedContentRenderer.component.mjs +38 -49
  95. package/dist/esm/editor/EditedContentRenderer.component.mjs.map +1 -1
  96. package/dist/esm/editor/EditorSelectorRenderer.component.mjs +19 -18
  97. package/dist/esm/editor/EditorSelectorRenderer.component.mjs.map +1 -1
  98. package/dist/esm/editor/communicator.mjs +48 -35
  99. package/dist/esm/editor/communicator.mjs.map +1 -1
  100. package/dist/esm/editor/configuration.mjs +15 -18
  101. package/dist/esm/editor/configuration.mjs.map +1 -1
  102. package/dist/esm/editor/createSharedComposable.mjs +42 -37
  103. package/dist/esm/editor/createSharedComposable.mjs.map +1 -1
  104. package/dist/esm/editor/dictionariesRecord.mjs +38 -38
  105. package/dist/esm/editor/dictionariesRecord.mjs.map +1 -1
  106. package/dist/esm/editor/editedContent.mjs +49 -42
  107. package/dist/esm/editor/editedContent.mjs.map +1 -1
  108. package/dist/esm/editor/editorEnabled.mjs +37 -41
  109. package/dist/esm/editor/editorEnabled.mjs.map +1 -1
  110. package/dist/esm/editor/editorLocale.mjs +15 -18
  111. package/dist/esm/editor/editorLocale.mjs.map +1 -1
  112. package/dist/esm/editor/focusDictionary.mjs +50 -45
  113. package/dist/esm/editor/focusDictionary.mjs.map +1 -1
  114. package/dist/esm/editor/index.mjs +3 -7
  115. package/dist/esm/editor/installIntlayerEditor.mjs +40 -26
  116. package/dist/esm/editor/installIntlayerEditor.mjs.map +1 -1
  117. package/dist/esm/editor/useCrossFrameMessageListener.mjs +58 -46
  118. package/dist/esm/editor/useCrossFrameMessageListener.mjs.map +1 -1
  119. package/dist/esm/editor/useCrossFrameState.mjs +104 -62
  120. package/dist/esm/editor/useCrossFrameState.mjs.map +1 -1
  121. package/dist/esm/editor/useCrossURLPathState.mjs +57 -41
  122. package/dist/esm/editor/useCrossURLPathState.mjs.map +1 -1
  123. package/dist/esm/editor/useEditedContentRenderer.mjs +21 -33
  124. package/dist/esm/editor/useEditedContentRenderer.mjs.map +1 -1
  125. package/dist/esm/editor/useEditor.mjs +16 -14
  126. package/dist/esm/editor/useEditor.mjs.map +1 -1
  127. package/dist/esm/editor/useIframeClickInterceptor.mjs +30 -30
  128. package/dist/esm/editor/useIframeClickInterceptor.mjs.map +1 -1
  129. package/dist/esm/getDictionary.mjs +12 -20
  130. package/dist/esm/getDictionary.mjs.map +1 -1
  131. package/dist/esm/getIntlayer.mjs +12 -16
  132. package/dist/esm/getIntlayer.mjs.map +1 -1
  133. package/dist/esm/index.mjs +13 -6
  134. package/dist/esm/markdown/index.mjs +3 -2
  135. package/dist/esm/markdown/installIntlayerMarkdown.mjs +27 -32
  136. package/dist/esm/markdown/installIntlayerMarkdown.mjs.map +1 -1
  137. package/dist/esm/plugins.mjs +70 -83
  138. package/dist/esm/plugins.mjs.map +1 -1
  139. package/dist/esm/renderIntlayerNode.mjs +15 -32
  140. package/dist/esm/renderIntlayerNode.mjs.map +1 -1
  141. package/dist/esm/webpack/index.mjs +3 -2
  142. package/dist/esm/webpack/mergeConfig.mjs +25 -31
  143. package/dist/esm/webpack/mergeConfig.mjs.map +1 -1
  144. package/dist/types/UI/ContentSelector.component.d.ts +32 -30
  145. package/dist/types/UI/ContentSelector.component.d.ts.map +1 -1
  146. package/dist/types/client/index.d.ts +8 -8
  147. package/dist/types/client/installIntlayer.d.ts +15 -9
  148. package/dist/types/client/installIntlayer.d.ts.map +1 -1
  149. package/dist/types/client/useDictionary.d.ts +7 -4
  150. package/dist/types/client/useDictionary.d.ts.map +1 -1
  151. package/dist/types/client/useDictionaryAsync.d.ts +7 -3
  152. package/dist/types/client/useDictionaryAsync.d.ts.map +1 -1
  153. package/dist/types/client/useDictionaryDynamic.d.ts +9 -3
  154. package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -1
  155. package/dist/types/client/useIntlayer.d.ts +9 -7
  156. package/dist/types/client/useIntlayer.d.ts.map +1 -1
  157. package/dist/types/client/useLoadDynamic.d.ts +4 -1
  158. package/dist/types/client/useLoadDynamic.d.ts.map +1 -1
  159. package/dist/types/client/useLocale.d.ts +17 -8
  160. package/dist/types/client/useLocale.d.ts.map +1 -1
  161. package/dist/types/client/useLocaleStorage.d.ts +49 -0
  162. package/dist/types/client/useLocaleStorage.d.ts.map +1 -0
  163. package/dist/types/editor/ContentSelectorWrapper.component.d.ts +18 -12
  164. package/dist/types/editor/ContentSelectorWrapper.component.d.ts.map +1 -1
  165. package/dist/types/editor/EditedContentRenderer.component.d.ts +20 -16
  166. package/dist/types/editor/EditedContentRenderer.component.d.ts.map +1 -1
  167. package/dist/types/editor/EditorSelectorRenderer.component.d.ts +11 -6
  168. package/dist/types/editor/EditorSelectorRenderer.component.d.ts.map +1 -1
  169. package/dist/types/editor/communicator.d.ts +14 -9
  170. package/dist/types/editor/communicator.d.ts.map +1 -1
  171. package/dist/types/editor/configuration.d.ts +4 -1
  172. package/dist/types/editor/configuration.d.ts.map +1 -1
  173. package/dist/types/editor/createSharedComposable.d.ts +6 -4
  174. package/dist/types/editor/createSharedComposable.d.ts.map +1 -1
  175. package/dist/types/editor/dictionariesRecord.d.ts +13 -10
  176. package/dist/types/editor/dictionariesRecord.d.ts.map +1 -1
  177. package/dist/types/editor/editedContent.d.ts +13 -10
  178. package/dist/types/editor/editedContent.d.ts.map +1 -1
  179. package/dist/types/editor/editorEnabled.d.ts +12 -8
  180. package/dist/types/editor/editorEnabled.d.ts.map +1 -1
  181. package/dist/types/editor/editorLocale.d.ts +6 -2
  182. package/dist/types/editor/editorLocale.d.ts.map +1 -1
  183. package/dist/types/editor/focusDictionary.d.ts +16 -13
  184. package/dist/types/editor/focusDictionary.d.ts.map +1 -1
  185. package/dist/types/editor/index.d.ts +5 -5
  186. package/dist/types/editor/installIntlayerEditor.d.ts +7 -2
  187. package/dist/types/editor/installIntlayerEditor.d.ts.map +1 -1
  188. package/dist/types/editor/useCrossFrameMessageListener.d.ts +7 -2
  189. package/dist/types/editor/useCrossFrameMessageListener.d.ts.map +1 -1
  190. package/dist/types/editor/useCrossFrameState.d.ts +12 -8
  191. package/dist/types/editor/useCrossFrameState.d.ts.map +1 -1
  192. package/dist/types/editor/useCrossURLPathState.d.ts +9 -3
  193. package/dist/types/editor/useCrossURLPathState.d.ts.map +1 -1
  194. package/dist/types/editor/useEditedContentRenderer.d.ts +15 -11
  195. package/dist/types/editor/useEditedContentRenderer.d.ts.map +1 -1
  196. package/dist/types/editor/useEditor.d.ts +4 -1
  197. package/dist/types/editor/useEditor.d.ts.map +1 -1
  198. package/dist/types/editor/useIframeClickInterceptor.d.ts +5 -2
  199. package/dist/types/editor/useIframeClickInterceptor.d.ts.map +1 -1
  200. package/dist/types/getDictionary.d.ts +8 -4
  201. package/dist/types/getDictionary.d.ts.map +1 -1
  202. package/dist/types/getIntlayer.d.ts +8 -4
  203. package/dist/types/getIntlayer.d.ts.map +1 -1
  204. package/dist/types/index.d.ts +16 -8
  205. package/dist/types/index.d.ts.map +1 -1
  206. package/dist/types/markdown/index.d.ts +2 -2
  207. package/dist/types/markdown/installIntlayerMarkdown.d.ts +15 -12
  208. package/dist/types/markdown/installIntlayerMarkdown.d.ts.map +1 -1
  209. package/dist/types/plugins.d.ts +29 -23
  210. package/dist/types/plugins.d.ts.map +1 -1
  211. package/dist/types/renderIntlayerNode.d.ts +16 -10
  212. package/dist/types/renderIntlayerNode.d.ts.map +1 -1
  213. package/dist/types/webpack/index.d.ts +2 -2
  214. package/dist/types/webpack/mergeConfig.d.ts +5 -2
  215. package/dist/types/webpack/mergeConfig.d.ts.map +1 -1
  216. package/package.json +43 -49
  217. package/LICENSE +0 -202
  218. package/dist/cjs/client/index.cjs.map +0 -1
  219. package/dist/cjs/client/useLocaleCookie.cjs +0 -60
  220. package/dist/cjs/client/useLocaleCookie.cjs.map +0 -1
  221. package/dist/cjs/editor/index.cjs.map +0 -1
  222. package/dist/cjs/index.cjs.map +0 -1
  223. package/dist/cjs/markdown/index.cjs.map +0 -1
  224. package/dist/cjs/webpack/index.cjs.map +0 -1
  225. package/dist/esm/client/index.mjs.map +0 -1
  226. package/dist/esm/client/useLocaleCookie.mjs +0 -24
  227. package/dist/esm/client/useLocaleCookie.mjs.map +0 -1
  228. package/dist/esm/editor/index.mjs.map +0 -1
  229. package/dist/esm/index.mjs.map +0 -1
  230. package/dist/esm/markdown/index.mjs.map +0 -1
  231. package/dist/esm/webpack/index.mjs.map +0 -1
  232. package/dist/types/client/index.d.ts.map +0 -1
  233. package/dist/types/client/useLocaleCookie.d.ts +0 -17
  234. package/dist/types/client/useLocaleCookie.d.ts.map +0 -1
  235. package/dist/types/editor/index.d.ts.map +0 -1
  236. package/dist/types/markdown/index.d.ts.map +0 -1
  237. package/dist/types/webpack/index.d.ts.map +0 -1
@@ -1,35 +1,34 @@
1
+ import { INTLAYER_TOKEN } from "./installIntlayer.mjs";
2
+ import { setLocaleInStorage } from "./useLocaleStorage.mjs";
1
3
  import { computed, inject } from "@angular/core";
2
4
  import configuration from "@intlayer/config/built";
3
- import { INTLAYER_TOKEN } from "./installIntlayer.mjs";
4
- import { useLocaleCookie } from "./useLocaleCookie.mjs";
5
- const useLocale = ({ onLocaleChange } = {}) => {
6
- const { defaultLocale, locales: availableLocales } = configuration?.internationalization ?? {};
7
- const intlayer = inject(INTLAYER_TOKEN);
8
- const { setLocaleCookie } = useLocaleCookie();
9
- const locale = computed(() => intlayer?.locale() ?? defaultLocale);
10
- const setLocale = (newLocale) => {
11
- if (!availableLocales?.map(String).includes(newLocale)) {
12
- console.error(`Locale ${newLocale} is not available`);
13
- return;
14
- }
15
- if (intlayer) {
16
- intlayer.setLocale(newLocale);
17
- }
18
- setLocaleCookie(newLocale);
19
- onLocaleChange?.(newLocale);
20
- };
21
- return {
22
- locale,
23
- // Current locale
24
- defaultLocale,
25
- // Principal locale defined in config
26
- availableLocales,
27
- // List of the available locales defined in config
28
- setLocale
29
- // Function to set the locale
30
- };
31
- };
32
- export {
33
- useLocale
5
+
6
+ //#region src/client/useLocale.ts
7
+ /**
8
+ * On the client side, composable to get the current locale and all related fields
9
+ */
10
+ const useLocale = ({ isCookieEnabled, onLocaleChange } = {}) => {
11
+ const { defaultLocale, locales: availableLocales } = configuration?.internationalization ?? {};
12
+ const intlayer = inject(INTLAYER_TOKEN);
13
+ const locale = computed(() => intlayer?.locale() ?? defaultLocale);
14
+ const isCookieEnabledContext = computed(() => intlayer?.isCookieEnabled() ?? true);
15
+ const setLocale = (newLocale) => {
16
+ if (!availableLocales?.map(String).includes(newLocale)) {
17
+ console.error(`Locale ${newLocale} is not available`);
18
+ return;
19
+ }
20
+ if (intlayer) intlayer.setLocale(newLocale);
21
+ setLocaleInStorage(newLocale, isCookieEnabled ?? isCookieEnabledContext() ?? true);
22
+ onLocaleChange?.(newLocale);
23
+ };
24
+ return {
25
+ locale,
26
+ defaultLocale,
27
+ availableLocales,
28
+ setLocale
29
+ };
34
30
  };
31
+
32
+ //#endregion
33
+ export { useLocale };
35
34
  //# sourceMappingURL=useLocale.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["import { computed, inject } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/config/client';\nimport { INTLAYER_TOKEN, IntlayerProvider } from './installIntlayer';\nimport { useLocaleCookie } from './useLocaleCookie';\n\ntype useLocaleProps = {\n onLocaleChange?: (locale: LocalesValues) => void;\n};\n\n/**\n * On the client side, composable to get the current locale and all related fields\n */\nexport const useLocale = ({ onLocaleChange }: useLocaleProps = {}) => {\n const { defaultLocale, locales: availableLocales } =\n configuration?.internationalization ?? {};\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n const { setLocaleCookie } = useLocaleCookie();\n\n // Create a reactive reference for the locale\n const locale = computed(() => intlayer?.locale() ?? defaultLocale);\n\n const setLocale = (newLocale: LocalesValues) => {\n if (!availableLocales?.map(String).includes(newLocale)) {\n console.error(`Locale ${newLocale} is not available`);\n return;\n }\n\n if (intlayer) {\n intlayer.setLocale(newLocale);\n }\n setLocaleCookie(newLocale);\n onLocaleChange?.(newLocale);\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,SAAS,UAAU,cAAc;AACjC,OAAO,mBAAmB;AAE1B,SAAS,sBAAwC;AACjD,SAAS,uBAAuB;AASzB,MAAM,YAAY,CAAC,EAAE,eAAe,IAAoB,CAAC,MAAM;AACpE,QAAM,EAAE,eAAe,SAAS,iBAAiB,IAC/C,eAAe,wBAAwB,CAAC;AAC1C,QAAM,WAAW,OAAyB,cAAc;AACxD,QAAM,EAAE,gBAAgB,IAAI,gBAAgB;AAG5C,QAAM,SAAS,SAAS,MAAM,UAAU,OAAO,KAAK,aAAa;AAEjE,QAAM,YAAY,CAAC,cAA6B;AAC9C,QAAI,CAAC,kBAAkB,IAAI,MAAM,EAAE,SAAS,SAAS,GAAG;AACtD,cAAQ,MAAM,UAAU,SAAS,mBAAmB;AACpD;AAAA,IACF;AAEA,QAAI,UAAU;AACZ,eAAS,UAAU,SAAS;AAAA,IAC9B;AACA,oBAAgB,SAAS;AACzB,qBAAiB,SAAS;AAAA,EAC5B;AAEA,SAAO;AAAA,IACL;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"file":"useLocale.mjs","names":[],"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["import { computed, inject } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\nimport { setLocaleInStorage } from './useLocaleStorage';\n\ntype useLocaleProps = {\n isCookieEnabled?: boolean;\n onLocaleChange?: (locale: LocalesValues) => void;\n};\n\n/**\n * On the client side, composable to get the current locale and all related fields\n */\nexport const useLocale = ({\n isCookieEnabled,\n onLocaleChange,\n}: useLocaleProps = {}) => {\n const { defaultLocale, locales: availableLocales } =\n configuration?.internationalization ?? {};\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n // Create a reactive reference for the locale\n const locale = computed(() => intlayer?.locale() ?? defaultLocale);\n const isCookieEnabledContext = computed(\n () => intlayer?.isCookieEnabled() ?? true\n );\n\n const setLocale = (newLocale: LocalesValues) => {\n if (!availableLocales?.map(String).includes(newLocale)) {\n console.error(`Locale ${newLocale} is not available`);\n return;\n }\n\n if (intlayer) {\n intlayer.setLocale(newLocale);\n }\n setLocaleInStorage(\n newLocale,\n isCookieEnabled ?? isCookieEnabledContext() ?? true\n );\n onLocaleChange?.(newLocale);\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":";;;;;;;;;AAcA,MAAa,aAAa,EACxB,iBACA,mBACkB,EAAE,KAAK;CACzB,MAAM,EAAE,eAAe,SAAS,qBAC9B,eAAe,wBAAwB,EAAE;CAC3C,MAAM,WAAW,OAAyB,eAAe;CAGzD,MAAM,SAAS,eAAe,UAAU,QAAQ,IAAI,cAAc;CAClE,MAAM,yBAAyB,eACvB,UAAU,iBAAiB,IAAI,KACtC;CAED,MAAM,aAAa,cAA6B;AAC9C,MAAI,CAAC,kBAAkB,IAAI,OAAO,CAAC,SAAS,UAAU,EAAE;AACtD,WAAQ,MAAM,UAAU,UAAU,mBAAmB;AACrD;;AAGF,MAAI,SACF,UAAS,UAAU,UAAU;AAE/B,qBACE,WACA,mBAAmB,wBAAwB,IAAI,KAChD;AACD,mBAAiB,UAAU;;AAG7B,QAAO;EACL;EACA;EACA;EACA;EACD"}
@@ -0,0 +1,54 @@
1
+ import { LocaleStorage, getLocaleFromStorage, localeStorageOptions, setLocaleInStorage as setLocaleInStorage$1 } from "@intlayer/core";
2
+
3
+ //#region src/client/useLocaleStorage.ts
4
+ /**
5
+ * Get the locale cookie
6
+ */
7
+ /**
8
+ * Get the locale cookie
9
+ */
10
+ const localeInStorage = getLocaleFromStorage(localeStorageOptions);
11
+ /**
12
+ * @deprecated Use localeInStorage instead
13
+ *
14
+ * Get the locale cookie
15
+ */
16
+ const localeCookie = localeInStorage;
17
+ /**
18
+ * Set the locale cookie
19
+ */
20
+ const setLocaleInStorage = (locale, isCookieEnabled) => setLocaleInStorage$1(locale, {
21
+ ...localeStorageOptions,
22
+ isCookieEnabled
23
+ });
24
+ /**
25
+ * @deprecated Use setLocaleInStorage instead
26
+ *
27
+ * Set the locale cookie
28
+ */
29
+ const setLocaleCookie = setLocaleInStorage;
30
+ /**
31
+ * Hook that provides the locale storage and a function to set it
32
+ */
33
+ const useLocaleStorage = (isCookieEnabled) => LocaleStorage({
34
+ ...localeStorageOptions,
35
+ isCookieEnabled
36
+ });
37
+ /**
38
+ * @deprecated Use useLocaleStorage instead
39
+ *
40
+ * For GDPR compliance, use useLocaleStorage instead
41
+ *
42
+ * Hook that provides the locale cookie and a function to set it
43
+ */
44
+ const useLocaleCookie = (isCookieEnabled) => {
45
+ const storage = useLocaleStorage(isCookieEnabled);
46
+ return {
47
+ localeCookie: storage.getLocale(),
48
+ setLocaleCookie: storage.setLocale
49
+ };
50
+ };
51
+
52
+ //#endregion
53
+ export { localeCookie, localeInStorage, setLocaleCookie, setLocaleInStorage, useLocaleCookie, useLocaleStorage };
54
+ //# 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';\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 storage and a function to set it\n */\nexport const useLocaleStorage = (isCookieEnabled?: boolean) =>\n LocaleStorage({\n ...localeStorageOptions,\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":";;;;;;;;;AAcA,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,cAAc;CACZ,GAAG;CACH;CACD,CAAC;;;;;;;;AASJ,MAAa,mBAAmB,oBAA8B;CAC5D,MAAM,UAAU,iBAAiB,gBAAgB;AAEjD,QAAO;EACL,cAAc,QAAQ,WAAW;EACjC,iBAAiB,QAAQ;EAC1B"}
@@ -1,15 +1,17 @@
1
- import { CommonModule } from "@angular/common";
2
- import { Component, Input, computed } from "@angular/core";
3
- import { isSameKeyPath } from "@intlayer/core";
4
1
  import { ContentSelectorComponent } from "../UI/ContentSelector.component.mjs";
5
2
  import { useEditorEnabled } from "./editorEnabled.mjs";
6
3
  import { useFocusDictionary } from "./focusDictionary.mjs";
7
4
  import { useEditor } from "./useEditor.mjs";
8
- @Component({
9
- selector: "app-content-selector-wrapper",
10
- standalone: true,
11
- imports: [CommonModule, ContentSelectorComponent],
12
- template: `
5
+ import { isSameKeyPath } from "@intlayer/core";
6
+ import { CommonModule } from "@angular/common";
7
+ import { Component, Input, computed } from "@angular/core";
8
+
9
+ //#region src/editor/ContentSelectorWrapper.component.ts
10
+ var ContentSelectorWrapperComponent = @Component({
11
+ selector: "app-content-selector-wrapper",
12
+ standalone: true,
13
+ imports: [CommonModule, ContentSelectorComponent],
14
+ template: `
13
15
  <app-content-selector
14
16
  *ngIf="enabled()"
15
17
  (press)="handleSelect()"
@@ -19,31 +21,27 @@ import { useEditor } from "./useEditor.mjs";
19
21
  </app-content-selector>
20
22
  <ng-content *ngIf="!enabled()"></ng-content>
21
23
  `
22
- })
23
- class ContentSelectorWrapperComponent {
24
- @Input() dictionaryKey;
25
- @Input() keyPath;
26
- // pull in the editor state & focus API
27
- focusDictionary = useFocusDictionary();
28
- editorEnabled = useEditorEnabled();
29
- constructor() {
30
- useEditor();
31
- }
32
- // compute whether this node is the current focus
33
- isSelected = computed(() => {
34
- const focusedContent = this.focusDictionary.focusedContent();
35
- return focusedContent?.dictionaryKey === this.dictionaryKey && (focusedContent.keyPath?.length ?? 0) > 0 && isSameKeyPath(focusedContent.keyPath ?? [], this.keyPath);
36
- });
37
- enabled = computed(() => this.editorEnabled.enabled());
38
- // when the selector is clicked, update focus
39
- handleSelect() {
40
- this.focusDictionary.setFocusedContent({
41
- dictionaryKey: this.dictionaryKey,
42
- keyPath: this.keyPath
43
- });
44
- }
45
- }
46
- export {
47
- ContentSelectorWrapperComponent
24
+ }) class {
25
+ @Input() dictionaryKey;
26
+ @Input() keyPath;
27
+ focusDictionary = useFocusDictionary();
28
+ editorEnabled = useEditorEnabled();
29
+ constructor() {
30
+ useEditor();
31
+ }
32
+ isSelected = computed(() => {
33
+ const focusedContent = this.focusDictionary.focusedContent();
34
+ return focusedContent?.dictionaryKey === this.dictionaryKey && (focusedContent.keyPath?.length ?? 0) > 0 && isSameKeyPath(focusedContent.keyPath ?? [], this.keyPath);
35
+ });
36
+ enabled = computed(() => this.editorEnabled.enabled());
37
+ handleSelect() {
38
+ this.focusDictionary.setFocusedContent({
39
+ dictionaryKey: this.dictionaryKey,
40
+ keyPath: this.keyPath
41
+ });
42
+ }
48
43
  };
44
+
45
+ //#endregion
46
+ export { ContentSelectorWrapperComponent };
49
47
  //# sourceMappingURL=ContentSelectorWrapper.component.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/editor/ContentSelectorWrapper.component.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, Input, computed } from '@angular/core';\nimport { isSameKeyPath, type NodeProps } from '@intlayer/core';\nimport { ContentSelectorComponent } from '../UI/ContentSelector.component';\nimport { useEditorEnabled } from './editorEnabled';\nimport { useFocusDictionary } from './focusDictionary';\nimport { useEditor } from './useEditor';\n\n/**\n * Combine your NodeProps (which include dictionaryKey & keyPath)\n * with any other div-like attributes.\n */\nexport interface ContentSelectorWrapperProps extends NodeProps {\n [key: string]: any;\n}\n\n@Component({\n selector: 'app-content-selector-wrapper',\n standalone: true,\n imports: [CommonModule, ContentSelectorComponent],\n template: `\n <app-content-selector\n *ngIf=\"enabled()\"\n (press)=\"handleSelect()\"\n [isSelecting]=\"isSelected()\"\n >\n <ng-content></ng-content>\n </app-content-selector>\n <ng-content *ngIf=\"!enabled()\"></ng-content>\n `,\n})\nexport class ContentSelectorWrapperComponent {\n @Input() dictionaryKey!: string;\n @Input() keyPath!: any[];\n\n // pull in the editor state & focus API\n private focusDictionary = useFocusDictionary();\n private editorEnabled = useEditorEnabled();\n\n constructor() {\n useEditor();\n }\n\n // compute whether this node is the current focus\n isSelected = computed(() => {\n const focusedContent = this.focusDictionary.focusedContent();\n return (\n focusedContent?.dictionaryKey === this.dictionaryKey &&\n (focusedContent.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(focusedContent.keyPath ?? [], this.keyPath)\n );\n });\n\n enabled = computed(() => this.editorEnabled.enabled());\n\n // when the selector is clicked, update focus\n handleSelect() {\n this.focusDictionary.setFocusedContent({\n dictionaryKey: this.dictionaryKey,\n keyPath: this.keyPath,\n });\n }\n}\n"],"mappings":"AAAA,SAAS,oBAAoB;AAC7B,SAAS,WAAW,OAAO,gBAAgB;AAC3C,SAAS,qBAAqC;AAC9C,SAAS,gCAAgC;AACzC,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AACnC,SAAS,iBAAiB;AAU1B,CAAC,UAAU;AAAA,EACT,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,SAAS,CAAC,cAAc,wBAAwB;AAAA,EAChD,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUZ,CAAC;AACM,MAAM,gCAAgC;AAC3C,GAAC,MAAM,EAAE;AACT,GAAC,MAAM,EAAE;AAAA;AAAA,EAGD,kBAAkB,mBAAmB;AAAA,EACrC,gBAAgB,iBAAiB;AAAA,EAEzC,cAAc;AACZ,cAAU;AAAA,EACZ;AAAA;AAAA,EAGA,aAAa,SAAS,MAAM;AAC1B,UAAM,iBAAiB,KAAK,gBAAgB,eAAe;AAC3D,WACE,gBAAgB,kBAAkB,KAAK,kBACtC,eAAe,SAAS,UAAU,KAAK,KACxC,cAAc,eAAe,WAAW,CAAC,GAAG,KAAK,OAAO;AAAA,EAE5D,CAAC;AAAA,EAED,UAAU,SAAS,MAAM,KAAK,cAAc,QAAQ,CAAC;AAAA;AAAA,EAGrD,eAAe;AACb,SAAK,gBAAgB,kBAAkB;AAAA,MACrC,eAAe,KAAK;AAAA,MACpB,SAAS,KAAK;AAAA,IAChB,CAAC;AAAA,EACH;AACF;","names":[]}
1
+ {"version":3,"file":"ContentSelectorWrapper.component.mjs","names":[],"sources":["../../../src/editor/ContentSelectorWrapper.component.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, computed, Input } from '@angular/core';\nimport { isSameKeyPath, type NodeProps } from '@intlayer/core';\nimport { ContentSelectorComponent } from '../UI/ContentSelector.component';\nimport { useEditorEnabled } from './editorEnabled';\nimport { useFocusDictionary } from './focusDictionary';\nimport { useEditor } from './useEditor';\n\n/**\n * Combine your NodeProps (which include dictionaryKey & keyPath)\n * with any other div-like attributes.\n */\nexport interface ContentSelectorWrapperProps extends NodeProps {\n [key: string]: any;\n}\n\n@Component({\n selector: 'app-content-selector-wrapper',\n standalone: true,\n imports: [CommonModule, ContentSelectorComponent],\n template: `\n <app-content-selector\n *ngIf=\"enabled()\"\n (press)=\"handleSelect()\"\n [isSelecting]=\"isSelected()\"\n >\n <ng-content></ng-content>\n </app-content-selector>\n <ng-content *ngIf=\"!enabled()\"></ng-content>\n `,\n})\nexport class ContentSelectorWrapperComponent {\n @Input() dictionaryKey!: string;\n @Input() keyPath!: any[];\n\n // pull in the editor state & focus API\n private focusDictionary = useFocusDictionary();\n private editorEnabled = useEditorEnabled();\n\n constructor() {\n useEditor();\n }\n\n // compute whether this node is the current focus\n isSelected = computed(() => {\n const focusedContent = this.focusDictionary.focusedContent();\n return (\n focusedContent?.dictionaryKey === this.dictionaryKey &&\n (focusedContent.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(focusedContent.keyPath ?? [], this.keyPath)\n );\n });\n\n enabled = computed(() => this.editorEnabled.enabled());\n\n // when the selector is clicked, update focus\n handleSelect() {\n this.focusDictionary.setFocusedContent({\n dictionaryKey: this.dictionaryKey,\n keyPath: this.keyPath,\n });\n }\n}\n"],"mappings":";;;;;;;;;AA+BA,IAAa,kCAfb,CAAC,UAAU;CACT,UAAU;CACV,YAAY;CACZ,SAAS,CAAC,cAAc,yBAAyB;CACjD,UAAU;;;;;;;;;;CAUX,CAAC,CACF,MAA6C;CAC3C,CAAC,OAAO,CAAC;CACT,CAAC,OAAO,CAAC;CAGT,AAAQ,kBAAkB,oBAAoB;CAC9C,AAAQ,gBAAgB,kBAAkB;CAE1C,cAAc;AACZ,aAAW;;CAIb,aAAa,eAAe;EAC1B,MAAM,iBAAiB,KAAK,gBAAgB,gBAAgB;AAC5D,SACE,gBAAgB,kBAAkB,KAAK,kBACtC,eAAe,SAAS,UAAU,KAAK,KACxC,cAAc,eAAe,WAAW,EAAE,EAAE,KAAK,QAAQ;GAE3D;CAEF,UAAU,eAAe,KAAK,cAAc,SAAS,CAAC;CAGtD,eAAe;AACb,OAAK,gBAAgB,kBAAkB;GACrC,eAAe,KAAK;GACpB,SAAS,KAAK;GACf,CAAC"}
@@ -1,53 +1,42 @@
1
+ import { useEditedContentRenderer } from "./useEditedContentRenderer.mjs";
2
+ import { getContent } from "@intlayer/core";
1
3
  import { CommonModule } from "@angular/common";
2
4
  import { Component, Input, computed, signal } from "@angular/core";
3
- import { getContent } from "@intlayer/core";
4
- import { useEditedContentRenderer } from "./useEditedContentRenderer.mjs";
5
- @Component({
6
- selector: "app-edited-content-renderer",
7
- standalone: true,
8
- imports: [CommonModule],
9
- template: ` <span [innerHTML]="renderedContent()"></span> `
10
- })
11
- class EditedContentRendererComponent {
12
- @Input() dictionaryKey;
13
- @Input() keyPath;
14
- @Input() locale;
15
- fallback = signal("");
16
- rawContent = computed(() => {
17
- return useEditedContentRenderer(
18
- this.dictionaryKey,
19
- this.keyPath,
20
- this.fallback
21
- );
22
- });
23
- /**
24
- * Object getContent → string, same as the React version.
25
- */
26
- renderedContent = computed(() => {
27
- const rawContentValue = this.rawContent();
28
- if (typeof rawContentValue === "object" && rawContentValue !== null) {
29
- const transformed = getContent(
30
- rawContentValue,
31
- {
32
- dictionaryKey: this.dictionaryKey,
33
- keyPath: this.keyPath
34
- },
35
- this.locale
36
- );
37
- if (typeof transformed !== "string") {
38
- console.error(
39
- `Incorrect edited content format. Content type: ${typeof transformed}. Expected string. Value ${JSON.stringify(
40
- transformed
41
- )}`
42
- );
43
- return this.fallback();
44
- }
45
- return transformed;
46
- }
47
- return rawContentValue();
48
- });
49
- }
50
- export {
51
- EditedContentRendererComponent
5
+
6
+ //#region src/editor/EditedContentRenderer.component.ts
7
+ var EditedContentRendererComponent = @Component({
8
+ selector: "app-edited-content-renderer",
9
+ standalone: true,
10
+ imports: [CommonModule],
11
+ template: ` <span [innerHTML]="renderedContent()"></span> `
12
+ }) class {
13
+ @Input() dictionaryKey;
14
+ @Input() keyPath;
15
+ @Input() locale;
16
+ fallback = signal("");
17
+ rawContent = computed(() => {
18
+ return useEditedContentRenderer(this.dictionaryKey, this.keyPath, this.fallback);
19
+ });
20
+ /**
21
+ * Object → getContent → string, same as the React version.
22
+ */
23
+ renderedContent = computed(() => {
24
+ const rawContentValue = this.rawContent();
25
+ if (typeof rawContentValue === "object" && rawContentValue !== null) {
26
+ const transformed = getContent(rawContentValue, {
27
+ dictionaryKey: this.dictionaryKey,
28
+ keyPath: this.keyPath
29
+ }, this.locale);
30
+ if (typeof transformed !== "string") {
31
+ console.error(`Incorrect edited content format. Content type: ${typeof transformed}. Expected string. Value ${JSON.stringify(transformed)}`);
32
+ return this.fallback();
33
+ }
34
+ return transformed;
35
+ }
36
+ return rawContentValue();
37
+ });
52
38
  };
39
+
40
+ //#endregion
41
+ export { EditedContentRendererComponent };
53
42
  //# sourceMappingURL=EditedContentRenderer.component.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/editor/EditedContentRenderer.component.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, Input, computed, signal } from '@angular/core';\nimport type { Locales } from '@intlayer/config/client';\nimport { ContentNode, getContent, type KeyPath } from '@intlayer/core';\nimport { useEditedContentRenderer } from './useEditedContentRenderer';\n\nexport interface EditedContentRendererProps {\n dictionaryKey: string;\n keyPath: KeyPath[];\n locale?: Locales;\n}\n\n@Component({\n selector: 'app-edited-content-renderer',\n standalone: true,\n imports: [CommonModule],\n template: ` <span [innerHTML]=\"renderedContent()\"></span> `,\n})\nexport class EditedContentRendererComponent {\n @Input() dictionaryKey!: string;\n @Input() keyPath!: KeyPath[];\n @Input() locale?: Locales;\n\n private fallback = signal('');\n\n private rawContent = computed(() => {\n return useEditedContentRenderer(\n this.dictionaryKey,\n this.keyPath,\n this.fallback\n );\n });\n\n /**\n * Object → getContent → string, same as the React version.\n */\n renderedContent = computed(() => {\n const rawContentValue = this.rawContent();\n\n if (typeof rawContentValue === 'object' && rawContentValue !== null) {\n const transformed = getContent(\n rawContentValue as ContentNode,\n {\n dictionaryKey: this.dictionaryKey,\n keyPath: this.keyPath,\n },\n this.locale\n );\n\n if (typeof transformed !== 'string') {\n console.error(\n `Incorrect edited content format. Content type: ${typeof transformed}. Expected string. Value ${JSON.stringify(\n transformed\n )}`\n );\n return this.fallback();\n }\n return transformed;\n }\n\n return rawContentValue() as string;\n });\n}\n"],"mappings":"AAAA,SAAS,oBAAoB;AAC7B,SAAS,WAAW,OAAO,UAAU,cAAc;AAEnD,SAAsB,kBAAgC;AACtD,SAAS,gCAAgC;AAQzC,CAAC,UAAU;AAAA,EACT,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,SAAS,CAAC,YAAY;AAAA,EACtB,UAAU;AACZ,CAAC;AACM,MAAM,+BAA+B;AAC1C,GAAC,MAAM,EAAE;AACT,GAAC,MAAM,EAAE;AACT,GAAC,MAAM,EAAE;AAAA,EAED,WAAW,OAAO,EAAE;AAAA,EAEpB,aAAa,SAAS,MAAM;AAClC,WAAO;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,IACP;AAAA,EACF,CAAC;AAAA;AAAA;AAAA;AAAA,EAKD,kBAAkB,SAAS,MAAM;AAC/B,UAAM,kBAAkB,KAAK,WAAW;AAExC,QAAI,OAAO,oBAAoB,YAAY,oBAAoB,MAAM;AACnE,YAAM,cAAc;AAAA,QAClB;AAAA,QACA;AAAA,UACE,eAAe,KAAK;AAAA,UACpB,SAAS,KAAK;AAAA,QAChB;AAAA,QACA,KAAK;AAAA,MACP;AAEA,UAAI,OAAO,gBAAgB,UAAU;AACnC,gBAAQ;AAAA,UACN,kDAAkD,OAAO,WAAW,4BAA4B,KAAK;AAAA,YACnG;AAAA,UACF,CAAC;AAAA,QACH;AACA,eAAO,KAAK,SAAS;AAAA,MACvB;AACA,aAAO;AAAA,IACT;AAEA,WAAO,gBAAgB;AAAA,EACzB,CAAC;AACH;","names":[]}
1
+ {"version":3,"file":"EditedContentRenderer.component.mjs","names":[],"sources":["../../../src/editor/EditedContentRenderer.component.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, computed, Input, signal } from '@angular/core';\nimport { getContent } from '@intlayer/core';\nimport type { ContentNode, KeyPath, Locale } from '@intlayer/types';\nimport { useEditedContentRenderer } from './useEditedContentRenderer';\n\nexport interface EditedContentRendererProps {\n dictionaryKey: string;\n keyPath: KeyPath[];\n locale?: Locale;\n}\n\n@Component({\n selector: 'app-edited-content-renderer',\n standalone: true,\n imports: [CommonModule],\n template: ` <span [innerHTML]=\"renderedContent()\"></span> `,\n})\nexport class EditedContentRendererComponent {\n @Input() dictionaryKey!: string;\n @Input() keyPath!: KeyPath[];\n @Input() locale?: Locale;\n\n private fallback = signal('');\n\n private rawContent = computed(() => {\n return useEditedContentRenderer(\n this.dictionaryKey,\n this.keyPath,\n this.fallback\n );\n });\n\n /**\n * Object → getContent → string, same as the React version.\n */\n renderedContent = computed(() => {\n const rawContentValue = this.rawContent();\n\n if (typeof rawContentValue === 'object' && rawContentValue !== null) {\n const transformed = getContent(\n rawContentValue as ContentNode,\n {\n dictionaryKey: this.dictionaryKey,\n keyPath: this.keyPath,\n },\n this.locale\n );\n\n if (typeof transformed !== 'string') {\n console.error(\n `Incorrect edited content format. Content type: ${typeof transformed}. Expected string. Value ${JSON.stringify(\n transformed\n )}`\n );\n return this.fallback();\n }\n return transformed;\n }\n\n return rawContentValue() as string;\n });\n}\n"],"mappings":";;;;;;AAkBA,IAAa,iCANb,CAAC,UAAU;CACT,UAAU;CACV,YAAY;CACZ,SAAS,CAAC,aAAa;CACvB,UAAU;CACX,CAAC,CACF,MAA4C;CAC1C,CAAC,OAAO,CAAC;CACT,CAAC,OAAO,CAAC;CACT,CAAC,OAAO,CAAC;CAET,AAAQ,WAAW,OAAO,GAAG;CAE7B,AAAQ,aAAa,eAAe;AAClC,SAAO,yBACL,KAAK,eACL,KAAK,SACL,KAAK,SACN;GACD;;;;CAKF,kBAAkB,eAAe;EAC/B,MAAM,kBAAkB,KAAK,YAAY;AAEzC,MAAI,OAAO,oBAAoB,YAAY,oBAAoB,MAAM;GACnE,MAAM,cAAc,WAClB,iBACA;IACE,eAAe,KAAK;IACpB,SAAS,KAAK;IACf,EACD,KAAK,OACN;AAED,OAAI,OAAO,gBAAgB,UAAU;AACnC,YAAQ,MACN,kDAAkD,OAAO,YAAY,2BAA2B,KAAK,UACnG,YACD,GACF;AACD,WAAO,KAAK,UAAU;;AAExB,UAAO;;AAGT,SAAO,iBAAiB;GACxB"}
@@ -1,16 +1,18 @@
1
- import { CommonModule } from "@angular/common";
2
- import { Component, Input } from "@angular/core";
3
1
  import { ContentSelectorWrapperComponent } from "./ContentSelectorWrapper.component.mjs";
4
2
  import { EditedContentRendererComponent } from "./EditedContentRenderer.component.mjs";
5
- @Component({
6
- selector: "app-editor-selector-renderer",
7
- standalone: true,
8
- imports: [
9
- CommonModule,
10
- ContentSelectorWrapperComponent,
11
- EditedContentRendererComponent
12
- ],
13
- template: `
3
+ import { CommonModule } from "@angular/common";
4
+ import { Component, Input } from "@angular/core";
5
+
6
+ //#region src/editor/EditorSelectorRenderer.component.ts
7
+ var EditorSelectorRendererComponent = @Component({
8
+ selector: "app-editor-selector-renderer",
9
+ standalone: true,
10
+ imports: [
11
+ CommonModule,
12
+ ContentSelectorWrapperComponent,
13
+ EditedContentRendererComponent
14
+ ],
15
+ template: `
14
16
  <app-content-selector-wrapper
15
17
  [dictionaryKey]="dictionaryKey"
16
18
  [keyPath]="keyPath"
@@ -23,12 +25,11 @@ import { EditedContentRendererComponent } from "./EditedContentRenderer.componen
23
25
  </app-edited-content-renderer>
24
26
  </app-content-selector-wrapper>
25
27
  `
26
- })
27
- class EditorSelectorRendererComponent {
28
- @Input() dictionaryKey;
29
- @Input() keyPath;
30
- }
31
- export {
32
- EditorSelectorRendererComponent
28
+ }) class {
29
+ @Input() dictionaryKey;
30
+ @Input() keyPath;
33
31
  };
32
+
33
+ //#endregion
34
+ export { EditorSelectorRendererComponent };
34
35
  //# sourceMappingURL=EditorSelectorRenderer.component.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/editor/EditorSelectorRenderer.component.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, Input } from '@angular/core';\nimport { type NodeProps } from '@intlayer/core';\nimport { ContentSelectorWrapperComponent } from './ContentSelectorWrapper.component';\nimport { EditedContentRendererComponent } from './EditedContentRenderer.component';\n\n/**\n * Combine your NodeProps (which include dictionaryKey & keyPath)\n * with any other div-like attributes.\n */\nexport interface EditorSelectorRendererProps extends NodeProps {\n [key: string]: any;\n}\n\n@Component({\n selector: 'app-editor-selector-renderer',\n standalone: true,\n imports: [\n CommonModule,\n ContentSelectorWrapperComponent,\n EditedContentRendererComponent,\n ],\n template: `\n <app-content-selector-wrapper\n [dictionaryKey]=\"dictionaryKey\"\n [keyPath]=\"keyPath\"\n >\n <app-edited-content-renderer\n [dictionaryKey]=\"dictionaryKey\"\n [keyPath]=\"keyPath\"\n >\n <ng-content></ng-content>\n </app-edited-content-renderer>\n </app-content-selector-wrapper>\n `,\n})\nexport class EditorSelectorRendererComponent {\n @Input() dictionaryKey!: string;\n @Input() keyPath!: any[];\n}\n"],"mappings":"AAAA,SAAS,oBAAoB;AAC7B,SAAS,WAAW,aAAa;AAEjC,SAAS,uCAAuC;AAChD,SAAS,sCAAsC;AAU/C,CAAC,UAAU;AAAA,EACT,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,SAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaZ,CAAC;AACM,MAAM,gCAAgC;AAC3C,GAAC,MAAM,EAAE;AACT,GAAC,MAAM,EAAE;AACX;","names":[]}
1
+ {"version":3,"file":"EditorSelectorRenderer.component.mjs","names":[],"sources":["../../../src/editor/EditorSelectorRenderer.component.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, Input } from '@angular/core';\nimport type { NodeProps } from '@intlayer/core';\nimport { ContentSelectorWrapperComponent } from './ContentSelectorWrapper.component';\nimport { EditedContentRendererComponent } from './EditedContentRenderer.component';\n\n/**\n * Combine your NodeProps (which include dictionaryKey & keyPath)\n * with any other div-like attributes.\n */\nexport interface EditorSelectorRendererProps extends NodeProps {\n [key: string]: any;\n}\n\n@Component({\n selector: 'app-editor-selector-renderer',\n standalone: true,\n imports: [\n CommonModule,\n ContentSelectorWrapperComponent,\n EditedContentRendererComponent,\n ],\n template: `\n <app-content-selector-wrapper\n [dictionaryKey]=\"dictionaryKey\"\n [keyPath]=\"keyPath\"\n >\n <app-edited-content-renderer\n [dictionaryKey]=\"dictionaryKey\"\n [keyPath]=\"keyPath\"\n >\n <ng-content></ng-content>\n </app-edited-content-renderer>\n </app-content-selector-wrapper>\n `,\n})\nexport class EditorSelectorRendererComponent {\n @Input() dictionaryKey!: string;\n @Input() keyPath!: any[];\n}\n"],"mappings":";;;;;;AAoCA,IAAa,kCAtBb,CAAC,UAAU;CACT,UAAU;CACV,YAAY;CACZ,SAAS;EACP;EACA;EACA;EACD;CACD,UAAU;;;;;;;;;;;;;CAaX,CAAC,CACF,MAA6C;CAC3C,CAAC,OAAO,CAAC;CACT,CAAC,OAAO,CAAC"}
@@ -1,46 +1,59 @@
1
1
  import configuration from "@intlayer/config/built";
2
- import { v4 as uuid } from "uuid";
2
+ import { v4 } from "uuid";
3
+
4
+ //#region src/editor/communicator.ts
3
5
  const { editor } = configuration;
6
+ /**
7
+ * Default values for the communicator
8
+ */
4
9
  const defaultValue = {
5
- postMessage: () => null,
6
- allowedOrigins: [
7
- editor?.applicationURL,
8
- editor?.editorURL,
9
- editor?.cmsURL
10
- ],
11
- senderId: ""
10
+ postMessage: () => null,
11
+ allowedOrigins: [
12
+ editor?.applicationURL,
13
+ editor?.editorURL,
14
+ editor?.cmsURL
15
+ ],
16
+ senderId: ""
12
17
  };
18
+ /**
19
+ * Singleton instance
20
+ */
13
21
  let instance = null;
14
- const INTLAYER_COMMUNICATOR_SYMBOL = Symbol("Communicator");
22
+ /**
23
+ * Creates a communicator client
24
+ * @param options - Options for configuring the communicator
25
+ */
15
26
  const createCommunicator = (options = { postMessage: () => null }) => {
16
- if (instance) return instance;
17
- instance = {
18
- ...defaultValue,
19
- ...options,
20
- senderId: uuid()
21
- };
22
- return instance;
27
+ if (instance) return instance;
28
+ instance = {
29
+ ...defaultValue,
30
+ ...options,
31
+ senderId: v4()
32
+ };
33
+ return instance;
23
34
  };
24
- const installCommunicator = (injector, options = { postMessage: () => null }) => {
25
- const client = createCommunicator(options);
35
+ /**
36
+ * Helper to install the Intlayer communicator into the injector
37
+ */
38
+ const installCommunicator = (_injector, options = { postMessage: () => null }) => {
39
+ createCommunicator(options);
26
40
  };
41
+ /**
42
+ * Hook to access the communicator
43
+ * @returns The communicator instance
44
+ */
27
45
  const useCommunicator = () => {
28
- try {
29
- const communicator = createCommunicator();
30
- return communicator || defaultValue;
31
- } catch (error) {
32
- console.warn(
33
- "useCommunicator: Error accessing communicator. Returning default communicator."
34
- );
35
- return {
36
- postMessage: () => null,
37
- senderId: ""
38
- };
39
- }
40
- };
41
- export {
42
- createCommunicator,
43
- installCommunicator,
44
- useCommunicator
46
+ try {
47
+ return createCommunicator() || defaultValue;
48
+ } catch (_error) {
49
+ console.warn("useCommunicator: Error accessing communicator. Returning default communicator.");
50
+ return {
51
+ postMessage: () => null,
52
+ senderId: ""
53
+ };
54
+ }
45
55
  };
56
+
57
+ //#endregion
58
+ export { createCommunicator, installCommunicator, useCommunicator };
46
59
  //# sourceMappingURL=communicator.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/editor/communicator.ts"],"sourcesContent":["import { Injector } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport { v4 as uuid } from 'uuid';\n\n/**\n * Interface defining a cross-frame communicator\n */\nexport type Communicator = {\n postMessage: typeof window.postMessage;\n allowedOrigins?: string[];\n senderId: string;\n};\n\n/**\n * Configuration options for the communicator\n */\nexport type CommunicatorOptions = Omit<Communicator, 'senderId'>;\n\nconst { editor } = configuration;\n\n/**\n * Default values for the communicator\n */\nconst defaultValue: Communicator = {\n postMessage: () => null,\n allowedOrigins: [\n editor?.applicationURL,\n editor?.editorURL,\n editor?.cmsURL,\n ] as string[],\n senderId: '',\n};\n\n/**\n * Singleton instance\n */\nlet instance: Communicator | null = null;\n\nconst INTLAYER_COMMUNICATOR_SYMBOL = Symbol('Communicator');\n\n/**\n * Creates a communicator client\n * @param options - Options for configuring the communicator\n */\nexport const createCommunicator = (\n options: CommunicatorOptions = { postMessage: () => null }\n) => {\n if (instance) return instance;\n\n instance = {\n ...defaultValue,\n ...options,\n senderId: uuid(),\n };\n\n return instance;\n};\n\n/**\n * Helper to install the Intlayer communicator into the injector\n */\nexport const installCommunicator = (\n injector: Injector,\n options: CommunicatorOptions = { postMessage: () => null }\n) => {\n const client = createCommunicator(options);\n\n // Angular doesn't have a direct equivalent to Vue's app.provide\n // The client is stored as a singleton and accessed via createCommunicator\n};\n\n/**\n * Hook to access the communicator\n * @returns The communicator instance\n */\nexport const useCommunicator = (): Communicator => {\n try {\n const communicator = createCommunicator();\n return communicator || defaultValue;\n } catch (error) {\n console.warn(\n 'useCommunicator: Error accessing communicator. Returning default communicator.'\n );\n return {\n postMessage: () => null,\n senderId: '',\n };\n }\n};\n"],"mappings":"AACA,OAAO,mBAAmB;AAC1B,SAAS,MAAM,YAAY;AAgB3B,MAAM,EAAE,OAAO,IAAI;AAKnB,MAAM,eAA6B;AAAA,EACjC,aAAa,MAAM;AAAA,EACnB,gBAAgB;AAAA,IACd,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,EACV;AAAA,EACA,UAAU;AACZ;AAKA,IAAI,WAAgC;AAEpC,MAAM,+BAA+B,OAAO,cAAc;AAMnD,MAAM,qBAAqB,CAChC,UAA+B,EAAE,aAAa,MAAM,KAAK,MACtD;AACH,MAAI,SAAU,QAAO;AAErB,aAAW;AAAA,IACT,GAAG;AAAA,IACH,GAAG;AAAA,IACH,UAAU,KAAK;AAAA,EACjB;AAEA,SAAO;AACT;AAKO,MAAM,sBAAsB,CACjC,UACA,UAA+B,EAAE,aAAa,MAAM,KAAK,MACtD;AACH,QAAM,SAAS,mBAAmB,OAAO;AAI3C;AAMO,MAAM,kBAAkB,MAAoB;AACjD,MAAI;AACF,UAAM,eAAe,mBAAmB;AACxC,WAAO,gBAAgB;AAAA,EACzB,SAAS,OAAO;AACd,YAAQ;AAAA,MACN;AAAA,IACF;AACA,WAAO;AAAA,MACL,aAAa,MAAM;AAAA,MACnB,UAAU;AAAA,IACZ;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"file":"communicator.mjs","names":["defaultValue: Communicator","instance: Communicator | null","uuid"],"sources":["../../../src/editor/communicator.ts"],"sourcesContent":["import type { Injector } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport { v4 as uuid } from 'uuid';\n\n/**\n * Interface defining a cross-frame communicator\n */\nexport type Communicator = {\n postMessage: typeof window.postMessage;\n allowedOrigins?: string[];\n senderId: string;\n};\n\n/**\n * Configuration options for the communicator\n */\nexport type CommunicatorOptions = Omit<Communicator, 'senderId'>;\n\nconst { editor } = configuration;\n\n/**\n * Default values for the communicator\n */\nconst defaultValue: Communicator = {\n postMessage: () => null,\n allowedOrigins: [\n editor?.applicationURL,\n editor?.editorURL,\n editor?.cmsURL,\n ] as string[],\n senderId: '',\n};\n\n/**\n * Singleton instance\n */\nlet instance: Communicator | null = null;\n\nconst _INTLAYER_COMMUNICATOR_SYMBOL = Symbol('Communicator');\n\n/**\n * Creates a communicator client\n * @param options - Options for configuring the communicator\n */\nexport const createCommunicator = (\n options: CommunicatorOptions = { postMessage: () => null }\n) => {\n if (instance) return instance;\n\n instance = {\n ...defaultValue,\n ...options,\n senderId: uuid(),\n };\n\n return instance;\n};\n\n/**\n * Helper to install the Intlayer communicator into the injector\n */\nexport const installCommunicator = (\n _injector: Injector,\n options: CommunicatorOptions = { postMessage: () => null }\n) => {\n const _client = createCommunicator(options);\n\n // Angular doesn't have a direct equivalent to Vue's app.provide\n // The client is stored as a singleton and accessed via createCommunicator\n};\n\n/**\n * Hook to access the communicator\n * @returns The communicator instance\n */\nexport const useCommunicator = (): Communicator => {\n try {\n const communicator = createCommunicator();\n return communicator || defaultValue;\n } catch (_error) {\n console.warn(\n 'useCommunicator: Error accessing communicator. Returning default communicator.'\n );\n return {\n postMessage: () => null,\n senderId: '',\n };\n }\n};\n"],"mappings":";;;;AAkBA,MAAM,EAAE,WAAW;;;;AAKnB,MAAMA,eAA6B;CACjC,mBAAmB;CACnB,gBAAgB;EACd,QAAQ;EACR,QAAQ;EACR,QAAQ;EACT;CACD,UAAU;CACX;;;;AAKD,IAAIC,WAAgC;;;;;AAQpC,MAAa,sBACX,UAA+B,EAAE,mBAAmB,MAAM,KACvD;AACH,KAAI,SAAU,QAAO;AAErB,YAAW;EACT,GAAG;EACH,GAAG;EACH,UAAUC,IAAM;EACjB;AAED,QAAO;;;;;AAMT,MAAa,uBACX,WACA,UAA+B,EAAE,mBAAmB,MAAM,KACvD;AACa,oBAAmB,QAAQ;;;;;;AAU7C,MAAa,wBAAsC;AACjD,KAAI;AAEF,SADqB,oBAAoB,IAClB;UAChB,QAAQ;AACf,UAAQ,KACN,iFACD;AACD,SAAO;GACL,mBAAmB;GACnB,UAAU;GACX"}
@@ -1,23 +1,20 @@
1
+ import { useCrossFrameState } from "./useCrossFrameState.mjs";
1
2
  import { DestroyRef, inject } from "@angular/core";
2
- import configuration from "@intlayer/config/built";
3
3
  import { MessageKey } from "@intlayer/editor";
4
- import { useCrossFrameState } from "./useCrossFrameState.mjs";
4
+ import configuration from "@intlayer/config/built";
5
+
6
+ //#region src/editor/configuration.ts
5
7
  const useConfiguration = () => {
6
- const [pushedConfiguration, setConfiguration] = useCrossFrameState(MessageKey.INTLAYER_CONFIGURATION);
7
- try {
8
- const destroyRef = inject(DestroyRef, { optional: true });
9
- if (destroyRef) {
10
- if (!pushedConfiguration()) {
11
- setConfiguration(configuration);
12
- }
13
- }
14
- } catch {
15
- console.warn(
16
- "useConfiguration called outside injection context; configuration may not be synchronized."
17
- );
18
- }
19
- };
20
- export {
21
- useConfiguration
8
+ const [pushedConfiguration, setConfiguration] = useCrossFrameState(MessageKey.INTLAYER_CONFIGURATION);
9
+ try {
10
+ if (inject(DestroyRef, { optional: true })) {
11
+ if (!pushedConfiguration()) setConfiguration(configuration);
12
+ }
13
+ } catch {
14
+ console.warn("useConfiguration called outside injection context; configuration may not be synchronized.");
15
+ }
22
16
  };
17
+
18
+ //#endregion
19
+ export { useConfiguration };
23
20
  //# sourceMappingURL=configuration.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/editor/configuration.ts"],"sourcesContent":["import { DestroyRef, inject } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport { IntlayerConfig } from '@intlayer/config/client';\nimport { MessageKey } from '@intlayer/editor';\nimport { useCrossFrameState } from './useCrossFrameState';\n\nexport const useConfiguration = () => {\n const [pushedConfiguration, setConfiguration] =\n useCrossFrameState<IntlayerConfig>(MessageKey.INTLAYER_CONFIGURATION);\n\n // Use Angular's injection context instead of Vue's onMounted\n try {\n const destroyRef = inject(DestroyRef, { optional: true });\n\n if (destroyRef) {\n // Execute immediately since Angular doesn't have the same lifecycle hooks\n if (!pushedConfiguration()) {\n setConfiguration(configuration);\n }\n }\n } catch {\n console.warn(\n 'useConfiguration called outside injection context; ' +\n 'configuration may not be synchronized.'\n );\n }\n};\n"],"mappings":"AAAA,SAAS,YAAY,cAAc;AACnC,OAAO,mBAAmB;AAE1B,SAAS,kBAAkB;AAC3B,SAAS,0BAA0B;AAE5B,MAAM,mBAAmB,MAAM;AACpC,QAAM,CAAC,qBAAqB,gBAAgB,IAC1C,mBAAmC,WAAW,sBAAsB;AAGtE,MAAI;AACF,UAAM,aAAa,OAAO,YAAY,EAAE,UAAU,KAAK,CAAC;AAExD,QAAI,YAAY;AAEd,UAAI,CAAC,oBAAoB,GAAG;AAC1B,yBAAiB,aAAa;AAAA,MAChC;AAAA,IACF;AAAA,EACF,QAAQ;AACN,YAAQ;AAAA,MACN;AAAA,IAEF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"file":"configuration.mjs","names":[],"sources":["../../../src/editor/configuration.ts"],"sourcesContent":["import { DestroyRef, inject } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport { MessageKey } from '@intlayer/editor';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { useCrossFrameState } from './useCrossFrameState';\n\nexport const useConfiguration = () => {\n const [pushedConfiguration, setConfiguration] =\n useCrossFrameState<IntlayerConfig>(MessageKey.INTLAYER_CONFIGURATION);\n\n // Use Angular's injection context instead of Vue's onMounted\n try {\n const destroyRef = inject(DestroyRef, { optional: true });\n\n if (destroyRef) {\n // Execute immediately since Angular doesn't have the same lifecycle hooks\n if (!pushedConfiguration()) {\n setConfiguration(configuration);\n }\n }\n } catch {\n console.warn(\n 'useConfiguration called outside injection context; ' +\n 'configuration may not be synchronized.'\n );\n }\n};\n"],"mappings":";;;;;;AAMA,MAAa,yBAAyB;CACpC,MAAM,CAAC,qBAAqB,oBAC1B,mBAAmC,WAAW,uBAAuB;AAGvE,KAAI;AAGF,MAFmB,OAAO,YAAY,EAAE,UAAU,MAAM,CAAC,EAIvD;OAAI,CAAC,qBAAqB,CACxB,kBAAiB,cAAc;;SAG7B;AACN,UAAQ,KACN,4FAED"}