angular-intlayer 6.1.6 → 7.0.0-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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,37 +1,25 @@
1
- import {
2
- computed,
3
- inject,
4
- Injectable,
5
- InjectionToken
6
- } from "@angular/core";
1
+ import { Injectable, InjectionToken, computed, inject } from "@angular/core";
2
+
3
+ //#region src/editor/useEditedContentRenderer.ts
7
4
  const EDITED_CONTENT_ACTIONS_TOKEN = new InjectionToken("editedContentActions");
8
- @Injectable({
9
- providedIn: "root"
10
- })
11
- class EditedContentRendererService {
12
- /**
13
- * Mirrors the React hook one-for-one.
14
- */
15
- useEditedContentRenderer(dictionaryKey, keyPath, fallback) {
16
- const editedContentContext = inject(EDITED_CONTENT_ACTIONS_TOKEN, {
17
- optional: true
18
- });
19
- return computed(() => {
20
- const edited = editedContentContext?.getEditedContentValue(
21
- dictionaryKey,
22
- keyPath
23
- );
24
- return edited ?? fallback;
25
- });
26
- }
27
- }
28
- const useEditedContentRenderer = (dictionaryKey, keyPath, fallback) => {
29
- const service = inject(EditedContentRendererService);
30
- return service.useEditedContentRenderer(dictionaryKey, keyPath, fallback);
5
+ var EditedContentRendererService = @Injectable({ providedIn: "root" }) class {
6
+ /**
7
+ * Mirrors the React hook one-for-one.
8
+ */
9
+ useEditedContentRenderer(dictionaryKey, keyPath, fallback) {
10
+ const editedContentContext = inject(EDITED_CONTENT_ACTIONS_TOKEN, { optional: true });
11
+ return computed(() => {
12
+ return editedContentContext?.getEditedContentValue(dictionaryKey, keyPath) ?? fallback;
13
+ });
14
+ }
31
15
  };
32
- export {
33
- EDITED_CONTENT_ACTIONS_TOKEN,
34
- EditedContentRendererService,
35
- useEditedContentRenderer
16
+ /**
17
+ * Standalone function that can be used like the Vue composable
18
+ */
19
+ const useEditedContentRenderer = (dictionaryKey, keyPath, fallback) => {
20
+ return inject(EditedContentRendererService).useEditedContentRenderer(dictionaryKey, keyPath, fallback);
36
21
  };
22
+
23
+ //#endregion
24
+ export { EDITED_CONTENT_ACTIONS_TOKEN, EditedContentRendererService, useEditedContentRenderer };
37
25
  //# sourceMappingURL=useEditedContentRenderer.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/editor/useEditedContentRenderer.ts"],"sourcesContent":["import {\n computed,\n inject,\n Injectable,\n InjectionToken,\n Signal,\n} from '@angular/core';\nimport { type KeyPath } from '@intlayer/core';\n\nexport interface EditedContentActions {\n getEditedContentValue(dictionaryKey: string, keyPath: KeyPath[]): unknown;\n}\n\nexport const EDITED_CONTENT_ACTIONS_TOKEN =\n new InjectionToken<EditedContentActions | null>('editedContentActions');\n\n@Injectable({\n providedIn: 'root',\n})\nexport class EditedContentRendererService {\n /**\n * Mirrors the React hook one-for-one.\n */\n useEditedContentRenderer(\n dictionaryKey: string,\n keyPath: KeyPath[],\n fallback: unknown\n ): Signal<unknown> {\n const editedContentContext = inject(EDITED_CONTENT_ACTIONS_TOKEN, {\n optional: true,\n });\n\n return computed(() => {\n const edited = editedContentContext?.getEditedContentValue(\n dictionaryKey,\n keyPath\n ) as string | undefined;\n\n return edited ?? fallback;\n });\n }\n}\n\n/**\n * Standalone function that can be used like the Vue composable\n */\nexport const useEditedContentRenderer = (\n dictionaryKey: string,\n keyPath: KeyPath[],\n fallback: unknown\n): Signal<unknown> => {\n const service = inject(EditedContentRendererService);\n return service.useEditedContentRenderer(dictionaryKey, keyPath, fallback);\n};\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAOA,MAAM,+BACX,IAAI,eAA4C,sBAAsB;AAExE,CAAC,WAAW;AAAA,EACV,YAAY;AACd,CAAC;AACM,MAAM,6BAA6B;AAAA;AAAA;AAAA;AAAA,EAIxC,yBACE,eACA,SACA,UACiB;AACjB,UAAM,uBAAuB,OAAO,8BAA8B;AAAA,MAChE,UAAU;AAAA,IACZ,CAAC;AAED,WAAO,SAAS,MAAM;AACpB,YAAM,SAAS,sBAAsB;AAAA,QACnC;AAAA,QACA;AAAA,MACF;AAEA,aAAO,UAAU;AAAA,IACnB,CAAC;AAAA,EACH;AACF;AAKO,MAAM,2BAA2B,CACtC,eACA,SACA,aACoB;AACpB,QAAM,UAAU,OAAO,4BAA4B;AACnD,SAAO,QAAQ,yBAAyB,eAAe,SAAS,QAAQ;AAC1E;","names":[]}
1
+ {"version":3,"file":"useEditedContentRenderer.mjs","names":[],"sources":["../../../src/editor/useEditedContentRenderer.ts"],"sourcesContent":["import {\n computed,\n Injectable,\n InjectionToken,\n inject,\n type Signal,\n} from '@angular/core';\nimport type { KeyPath } from '@intlayer/types';\n\nexport interface EditedContentActions {\n getEditedContentValue(dictionaryKey: string, keyPath: KeyPath[]): unknown;\n}\n\nexport const EDITED_CONTENT_ACTIONS_TOKEN =\n new InjectionToken<EditedContentActions | null>('editedContentActions');\n\n@Injectable({\n providedIn: 'root',\n})\nexport class EditedContentRendererService {\n /**\n * Mirrors the React hook one-for-one.\n */\n useEditedContentRenderer(\n dictionaryKey: string,\n keyPath: KeyPath[],\n fallback: unknown\n ): Signal<unknown> {\n const editedContentContext = inject(EDITED_CONTENT_ACTIONS_TOKEN, {\n optional: true,\n });\n\n return computed(() => {\n const edited = editedContentContext?.getEditedContentValue(\n dictionaryKey,\n keyPath\n ) as string | undefined;\n\n return edited ?? fallback;\n });\n }\n}\n\n/**\n * Standalone function that can be used like the Vue composable\n */\nexport const useEditedContentRenderer = (\n dictionaryKey: string,\n keyPath: KeyPath[],\n fallback: unknown\n): Signal<unknown> => {\n const service = inject(EditedContentRendererService);\n return service.useEditedContentRenderer(dictionaryKey, keyPath, fallback);\n};\n"],"mappings":";;;AAaA,MAAa,+BACX,IAAI,eAA4C,uBAAuB;AAKzE,IAAa,+BAHb,CAAC,WAAW,EACV,YAAY,QACb,CAAC,CACF,MAA0C;;;;CAIxC,yBACE,eACA,SACA,UACiB;EACjB,MAAM,uBAAuB,OAAO,8BAA8B,EAChE,UAAU,MACX,CAAC;AAEF,SAAO,eAAe;AAMpB,UALe,sBAAsB,sBACnC,eACA,QACD,IAEgB;IACjB;;;;;;AAON,MAAa,4BACX,eACA,SACA,aACoB;AAEpB,QADgB,OAAO,6BAA6B,CACrC,yBAAyB,eAAe,SAAS,SAAS"}
@@ -1,22 +1,24 @@
1
- import { useConfiguration } from "./configuration.mjs";
2
1
  import { createSharedComposable } from "./createSharedComposable.mjs";
3
- import { useDictionariesRecord } from "./dictionariesRecord.mjs";
4
2
  import { useEditorEnabled } from "./editorEnabled.mjs";
5
- import { useEditorLocale } from "./editorLocale.mjs";
6
3
  import { useFocusDictionary } from "./focusDictionary.mjs";
4
+ import { useConfiguration } from "./configuration.mjs";
5
+ import { useDictionariesRecord } from "./dictionariesRecord.mjs";
6
+ import { useEditorLocale } from "./editorLocale.mjs";
7
7
  import { useCrossURLPathSetter } from "./useCrossURLPathState.mjs";
8
8
  import { useIframeClickMerger } from "./useIframeClickInterceptor.mjs";
9
+
10
+ //#region src/editor/useEditor.ts
9
11
  const useEditor = createSharedComposable(() => {
10
- useConfiguration();
11
- useEditorEnabled();
12
- useFocusDictionary();
13
- useIframeClickMerger();
14
- useCrossURLPathSetter();
15
- useEditorLocale();
16
- useDictionariesRecord();
17
- useEditorLocale();
12
+ useConfiguration();
13
+ useEditorEnabled();
14
+ useFocusDictionary();
15
+ useIframeClickMerger();
16
+ useCrossURLPathSetter();
17
+ useEditorLocale();
18
+ useDictionariesRecord();
19
+ useEditorLocale();
18
20
  });
19
- export {
20
- useEditor
21
- };
21
+
22
+ //#endregion
23
+ export { useEditor };
22
24
  //# sourceMappingURL=useEditor.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/editor/useEditor.ts"],"sourcesContent":["import { useConfiguration } from './configuration';\nimport { createSharedComposable } from './createSharedComposable';\nimport { useDictionariesRecord } from './dictionariesRecord';\nimport { useEditorEnabled } from './editorEnabled';\nimport { useEditorLocale } from './editorLocale';\nimport { useFocusDictionary } from './focusDictionary';\nimport { useCrossURLPathSetter } from './useCrossURLPathState';\nimport { useIframeClickMerger } from './useIframeClickInterceptor';\n\nexport const useEditor = createSharedComposable(() => {\n useConfiguration();\n useEditorEnabled();\n useFocusDictionary();\n useIframeClickMerger();\n useCrossURLPathSetter();\n useEditorLocale();\n useDictionariesRecord();\n useEditorLocale();\n});\n"],"mappings":"AAAA,SAAS,wBAAwB;AACjC,SAAS,8BAA8B;AACvC,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,0BAA0B;AACnC,SAAS,6BAA6B;AACtC,SAAS,4BAA4B;AAE9B,MAAM,YAAY,uBAAuB,MAAM;AACpD,mBAAiB;AACjB,mBAAiB;AACjB,qBAAmB;AACnB,uBAAqB;AACrB,wBAAsB;AACtB,kBAAgB;AAChB,wBAAsB;AACtB,kBAAgB;AAClB,CAAC;","names":[]}
1
+ {"version":3,"file":"useEditor.mjs","names":[],"sources":["../../../src/editor/useEditor.ts"],"sourcesContent":["import { useConfiguration } from './configuration';\nimport { createSharedComposable } from './createSharedComposable';\nimport { useDictionariesRecord } from './dictionariesRecord';\nimport { useEditorEnabled } from './editorEnabled';\nimport { useEditorLocale } from './editorLocale';\nimport { useFocusDictionary } from './focusDictionary';\nimport { useCrossURLPathSetter } from './useCrossURLPathState';\nimport { useIframeClickMerger } from './useIframeClickInterceptor';\n\nexport const useEditor = createSharedComposable(() => {\n useConfiguration();\n useEditorEnabled();\n useFocusDictionary();\n useIframeClickMerger();\n useCrossURLPathSetter();\n useEditorLocale();\n useDictionariesRecord();\n useEditorLocale();\n});\n"],"mappings":";;;;;;;;;;AASA,MAAa,YAAY,6BAA6B;AACpD,mBAAkB;AAClB,mBAAkB;AAClB,qBAAoB;AACpB,uBAAsB;AACtB,wBAAuB;AACvB,kBAAiB;AACjB,wBAAuB;AACvB,kBAAiB;EACjB"}
@@ -1,37 +1,37 @@
1
- import { DestroyRef, inject } from "@angular/core";
2
- import { MessageKey, mergeIframeClick } from "@intlayer/editor";
3
1
  import { createSharedComposable } from "./createSharedComposable.mjs";
4
2
  import { useCrossFrameMessageListener } from "./useCrossFrameMessageListener.mjs";
3
+ import { DestroyRef, inject } from "@angular/core";
4
+ import { MessageKey, mergeIframeClick } from "@intlayer/editor";
5
+
6
+ //#region src/editor/useIframeClickInterceptor.ts
7
+ /**
8
+ * Hook that intercepts clicks in the iframe and sends them to the parent window
9
+ * This allows the parent window to know when the iframe is clicked
10
+ */
5
11
  const useIframeClickInterceptor = createSharedComposable(() => {
6
- const postMessage = useCrossFrameMessageListener(
7
- MessageKey.INTLAYER_IFRAME_CLICKED
8
- );
9
- const handler = () => {
10
- postMessage();
11
- };
12
- try {
13
- const destroyRef = inject(DestroyRef, { optional: true });
14
- if (destroyRef && typeof window !== "undefined") {
15
- window.addEventListener("mousedown", handler);
16
- destroyRef.onDestroy(
17
- () => window.removeEventListener("mousedown", handler)
18
- );
19
- }
20
- } catch {
21
- console.warn(
22
- "useIframeClickInterceptor called outside injection context; event listener setup may not be available."
23
- );
24
- }
12
+ const postMessage = useCrossFrameMessageListener(MessageKey.INTLAYER_IFRAME_CLICKED);
13
+ const handler = () => {
14
+ postMessage();
15
+ };
16
+ try {
17
+ const destroyRef = inject(DestroyRef, { optional: true });
18
+ if (destroyRef && typeof window !== "undefined") {
19
+ window.addEventListener("mousedown", handler);
20
+ destroyRef.onDestroy(() => window.removeEventListener("mousedown", handler));
21
+ }
22
+ } catch {
23
+ console.warn("useIframeClickInterceptor called outside injection context; event listener setup may not be available.");
24
+ }
25
25
  });
26
+ /**
27
+ * Hook for the parent window to listen for iframe clicks and merge them
28
+ * This makes iframe clicks behave as if they happened in the parent window
29
+ */
26
30
  const useIframeClickMerger = createSharedComposable(() => {
27
- useIframeClickInterceptor();
28
- useCrossFrameMessageListener(
29
- MessageKey.INTLAYER_IFRAME_CLICKED,
30
- mergeIframeClick
31
- );
31
+ useIframeClickInterceptor();
32
+ useCrossFrameMessageListener(MessageKey.INTLAYER_IFRAME_CLICKED, mergeIframeClick);
32
33
  });
33
- export {
34
- useIframeClickInterceptor,
35
- useIframeClickMerger
36
- };
34
+
35
+ //#endregion
36
+ export { useIframeClickInterceptor, useIframeClickMerger };
37
37
  //# sourceMappingURL=useIframeClickInterceptor.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/editor/useIframeClickInterceptor.ts"],"sourcesContent":["import { DestroyRef, inject } from '@angular/core';\nimport { MessageKey, mergeIframeClick } from '@intlayer/editor';\nimport { createSharedComposable } from './createSharedComposable';\nimport { useCrossFrameMessageListener } from './useCrossFrameMessageListener';\n\n/* ─────────────────────────────────────────────\n 1. \"Interceptor\" – send a postMessage when\n the editor iframe itself is clicked.\n────────────────────────────────────────────── */\n/**\n * Hook that intercepts clicks in the iframe and sends them to the parent window\n * This allows the parent window to know when the iframe is clicked\n */\nexport const useIframeClickInterceptor = createSharedComposable(() => {\n const postMessage = useCrossFrameMessageListener<undefined>(\n MessageKey.INTLAYER_IFRAME_CLICKED\n );\n\n const handler = () => {\n postMessage();\n };\n\n // Use Angular's DestroyRef for cleanup instead of Vue's lifecycle hooks\n try {\n const destroyRef = inject(DestroyRef, { optional: true });\n\n if (destroyRef && typeof window !== 'undefined') {\n // Set up event listener immediately\n window.addEventListener('mousedown', handler);\n\n // Clean up on destroy\n destroyRef.onDestroy(() =>\n window.removeEventListener('mousedown', handler)\n );\n }\n } catch {\n console.warn(\n 'useIframeClickInterceptor called outside injection context; ' +\n 'event listener setup may not be available.'\n );\n }\n});\n\n/**\n * Hook for the parent window to listen for iframe clicks and merge them\n * This makes iframe clicks behave as if they happened in the parent window\n */\nexport const useIframeClickMerger = createSharedComposable(() => {\n useIframeClickInterceptor();\n\n useCrossFrameMessageListener<MessageEvent>(\n MessageKey.INTLAYER_IFRAME_CLICKED,\n mergeIframeClick\n );\n});\n"],"mappings":"AAAA,SAAS,YAAY,cAAc;AACnC,SAAS,YAAY,wBAAwB;AAC7C,SAAS,8BAA8B;AACvC,SAAS,oCAAoC;AAUtC,MAAM,4BAA4B,uBAAuB,MAAM;AACpE,QAAM,cAAc;AAAA,IAClB,WAAW;AAAA,EACb;AAEA,QAAM,UAAU,MAAM;AACpB,gBAAY;AAAA,EACd;AAGA,MAAI;AACF,UAAM,aAAa,OAAO,YAAY,EAAE,UAAU,KAAK,CAAC;AAExD,QAAI,cAAc,OAAO,WAAW,aAAa;AAE/C,aAAO,iBAAiB,aAAa,OAAO;AAG5C,iBAAW;AAAA,QAAU,MACnB,OAAO,oBAAoB,aAAa,OAAO;AAAA,MACjD;AAAA,IACF;AAAA,EACF,QAAQ;AACN,YAAQ;AAAA,MACN;AAAA,IAEF;AAAA,EACF;AACF,CAAC;AAMM,MAAM,uBAAuB,uBAAuB,MAAM;AAC/D,4BAA0B;AAE1B;AAAA,IACE,WAAW;AAAA,IACX;AAAA,EACF;AACF,CAAC;","names":[]}
1
+ {"version":3,"file":"useIframeClickInterceptor.mjs","names":[],"sources":["../../../src/editor/useIframeClickInterceptor.ts"],"sourcesContent":["import { DestroyRef, inject } from '@angular/core';\nimport { MessageKey, mergeIframeClick } from '@intlayer/editor';\nimport { createSharedComposable } from './createSharedComposable';\nimport { useCrossFrameMessageListener } from './useCrossFrameMessageListener';\n\n/* ─────────────────────────────────────────────\n 1. \"Interceptor\" – send a postMessage when\n the editor iframe itself is clicked.\n────────────────────────────────────────────── */\n/**\n * Hook that intercepts clicks in the iframe and sends them to the parent window\n * This allows the parent window to know when the iframe is clicked\n */\nexport const useIframeClickInterceptor = createSharedComposable(() => {\n const postMessage = useCrossFrameMessageListener<undefined>(\n MessageKey.INTLAYER_IFRAME_CLICKED\n );\n\n const handler = () => {\n postMessage();\n };\n\n // Use Angular's DestroyRef for cleanup instead of Vue's lifecycle hooks\n try {\n const destroyRef = inject(DestroyRef, { optional: true });\n\n if (destroyRef && typeof window !== 'undefined') {\n // Set up event listener immediately\n window.addEventListener('mousedown', handler);\n\n // Clean up on destroy\n destroyRef.onDestroy(() =>\n window.removeEventListener('mousedown', handler)\n );\n }\n } catch {\n console.warn(\n 'useIframeClickInterceptor called outside injection context; ' +\n 'event listener setup may not be available.'\n );\n }\n});\n\n/**\n * Hook for the parent window to listen for iframe clicks and merge them\n * This makes iframe clicks behave as if they happened in the parent window\n */\nexport const useIframeClickMerger = createSharedComposable(() => {\n useIframeClickInterceptor();\n\n useCrossFrameMessageListener<MessageEvent>(\n MessageKey.INTLAYER_IFRAME_CLICKED,\n mergeIframeClick\n );\n});\n"],"mappings":";;;;;;;;;;AAaA,MAAa,4BAA4B,6BAA6B;CACpE,MAAM,cAAc,6BAClB,WAAW,wBACZ;CAED,MAAM,gBAAgB;AACpB,eAAa;;AAIf,KAAI;EACF,MAAM,aAAa,OAAO,YAAY,EAAE,UAAU,MAAM,CAAC;AAEzD,MAAI,cAAc,OAAO,WAAW,aAAa;AAE/C,UAAO,iBAAiB,aAAa,QAAQ;AAG7C,cAAW,gBACT,OAAO,oBAAoB,aAAa,QAAQ,CACjD;;SAEG;AACN,UAAQ,KACN,yGAED;;EAEH;;;;;AAMF,MAAa,uBAAuB,6BAA6B;AAC/D,4BAA2B;AAE3B,8BACE,WAAW,yBACX,iBACD;EACD"}
@@ -1,23 +1,15 @@
1
- import {
2
- getDictionary as getDictionaryCore
3
- } from "@intlayer/core";
4
- import {
5
- intlayerNodePlugins,
6
- markdownPlugin
7
- } from "./plugins.mjs";
1
+ import { intlayerNodePlugins, markdownPlugin } from "./plugins.mjs";
2
+ import { getDictionary as getDictionary$1 } from "@intlayer/core";
3
+
4
+ //#region src/getDictionary.ts
8
5
  const getDictionary = (dictionary, locale, additionalPlugins) => {
9
- const plugins = [
10
- intlayerNodePlugins,
11
- markdownPlugin,
12
- ...additionalPlugins ?? []
13
- ];
14
- return getDictionaryCore(
15
- dictionary,
16
- locale,
17
- plugins
18
- );
19
- };
20
- export {
21
- getDictionary
6
+ return getDictionary$1(dictionary, locale, [
7
+ intlayerNodePlugins,
8
+ markdownPlugin,
9
+ ...additionalPlugins ?? []
10
+ ]);
22
11
  };
12
+
13
+ //#endregion
14
+ export { getDictionary };
23
15
  //# sourceMappingURL=getDictionary.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/getDictionary.ts"],"sourcesContent":["import type { Locales, LocalesValues } from '@intlayer/config/client';\nimport {\n Dictionary,\n Plugins,\n getDictionary as getDictionaryCore,\n} from '@intlayer/core';\nimport {\n DeepTransformContent,\n intlayerNodePlugins,\n markdownPlugin,\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 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,OACK;AAEA,MAAM,gBAAgB,CAI3B,YACA,QACA,sBACG;AACH,QAAM,UAAqB;AAAA,IACzB;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 { intlayerNodePlugins, markdownPlugin } 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) => {\n const plugins: Plugins[] = [\n intlayerNodePlugins,\n markdownPlugin,\n ...(additionalPlugins ?? []),\n ];\n\n return getDictionaryCore<T, L>(dictionary, locale, plugins);\n};\n"],"mappings":";;;;AAWA,MAAa,iBAIX,YACA,QACA,sBACG;AAOH,QAAOA,gBAAwB,YAAY,QANhB;EACzB;EACA;EACA,GAAI,qBAAqB,EAAE;EAC5B,CAE0D"}
@@ -1,19 +1,15 @@
1
- import {
2
- getIntlayer as getIntlayerCore
3
- } from "@intlayer/core";
4
- import {
5
- intlayerNodePlugins,
6
- markdownPlugin
7
- } from "./plugins.mjs";
1
+ import { intlayerNodePlugins, markdownPlugin } from "./plugins.mjs";
2
+ import { getIntlayer as getIntlayer$1 } from "@intlayer/core";
3
+
4
+ //#region src/getIntlayer.ts
8
5
  const getIntlayer = (key, locale, additionalPlugins) => {
9
- const plugins = [
10
- intlayerNodePlugins,
11
- markdownPlugin,
12
- ...additionalPlugins ?? []
13
- ];
14
- return getIntlayerCore(key, locale, plugins);
15
- };
16
- export {
17
- getIntlayer
6
+ return getIntlayer$1(key, locale, [
7
+ intlayerNodePlugins,
8
+ markdownPlugin,
9
+ ...additionalPlugins ?? []
10
+ ]);
18
11
  };
12
+
13
+ //#endregion
14
+ export { getIntlayer };
19
15
  //# sourceMappingURL=getIntlayer.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/getIntlayer.ts"],"sourcesContent":["import {\n DictionaryKeys,\n getIntlayer as getIntlayerCore,\n Plugins,\n} from '@intlayer/core';\n// @ts-ignore intlayer declared for module augmentation\nimport type { IntlayerDictionaryTypesConnector, LocalesValues } from 'intlayer';\nimport {\n DeepTransformContent,\n intlayerNodePlugins,\n markdownPlugin,\n} from './plugins';\n\nexport const getIntlayer = <T extends DictionaryKeys, L extends LocalesValues>(\n key: T,\n locale?: L,\n additionalPlugins?: Plugins[]\n) => {\n const plugins: Plugins[] = [\n intlayerNodePlugins,\n markdownPlugin,\n ...(additionalPlugins ?? []),\n ];\n\n return getIntlayerCore(key, locale, plugins) as any as DeepTransformContent<\n IntlayerDictionaryTypesConnector[T]['content']\n >;\n};\n"],"mappings":"AAAA;AAAA,EAEE,eAAe;AAAA,OAEV;AAGP;AAAA,EAEE;AAAA,EACA;AAAA,OACK;AAEA,MAAM,cAAc,CACzB,KACA,QACA,sBACG;AACH,QAAM,UAAqB;AAAA,IACzB;AAAA,IACA;AAAA,IACA,GAAI,qBAAqB,CAAC;AAAA,EAC5B;AAEA,SAAO,gBAAgB,KAAK,QAAQ,OAAO;AAG7C;","names":[]}
1
+ {"version":3,"file":"getIntlayer.mjs","names":["getIntlayerCore"],"sources":["../../src/getIntlayer.ts"],"sourcesContent":["import { getIntlayer as getIntlayerCore, type Plugins } from '@intlayer/core';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionaryRegistryContent,\n LocalesValues,\n} from '@intlayer/types';\nimport {\n type DeepTransformContent,\n intlayerNodePlugins,\n markdownPlugin,\n} from './plugins';\n\nexport const getIntlayer = <\n T extends DictionaryKeys,\n L extends LocalesValues = DeclaredLocales,\n>(\n key: T,\n locale?: L,\n additionalPlugins?: Plugins[]\n) => {\n const plugins: Plugins[] = [\n intlayerNodePlugins,\n markdownPlugin,\n ...(additionalPlugins ?? []),\n ];\n\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n return getIntlayerCore<T, L>(key, locale, plugins) as DeepTransformContent<\n DictionaryRegistryContent<T>\n >;\n};\n"],"mappings":";;;;AAaA,MAAa,eAIX,KACA,QACA,sBACG;AAQH,QAAOA,cAAsB,KAAK,QAPP;EACzB;EACA;EACA,GAAI,qBAAqB,EAAE;EAC5B,CAGiD"}
@@ -1,6 +1,13 @@
1
- export * from "./client/index.mjs";
2
- export * from "./getDictionary.mjs";
3
- export * from "./getIntlayer.mjs";
4
- export * from "./markdown/index.mjs";
5
- export * from "./plugins.mjs";
6
- //# sourceMappingURL=index.mjs.map
1
+ import { INTLAYER_TOKEN, IntlayerProvider, createIntlayerClient, installIntlayer } from "./client/installIntlayer.mjs";
2
+ import { useDictionary } from "./client/useDictionary.mjs";
3
+ import { useDictionaryAsync } from "./client/useDictionaryAsync.mjs";
4
+ import { useLoadDynamic } from "./client/useLoadDynamic.mjs";
5
+ import { useDictionaryDynamic } from "./client/useDictionaryDynamic.mjs";
6
+ import { getIntlayer } from "./getIntlayer.mjs";
7
+ import { isUpdatableNode, useIntlayer } from "./client/useIntlayer.mjs";
8
+ import { useLocale } from "./client/useLocale.mjs";
9
+ import { INTLAYER_MARKDOWN_TOKEN, IntlayerMarkdownService, createIntlayerMarkdownProvider, useMarkdown } from "./markdown/installIntlayerMarkdown.mjs";
10
+ import { intlayerNodePlugins, markdownPlugin, markdownStringPlugin } from "./plugins.mjs";
11
+ import { getDictionary } from "./getDictionary.mjs";
12
+
13
+ export { INTLAYER_MARKDOWN_TOKEN, INTLAYER_TOKEN, IntlayerMarkdownService, IntlayerProvider, createIntlayerClient, createIntlayerMarkdownProvider, getDictionary, getIntlayer, installIntlayer, intlayerNodePlugins, isUpdatableNode, markdownPlugin, markdownStringPlugin, useDictionary, useDictionaryAsync, useDictionaryDynamic, useIntlayer, useLoadDynamic, useLocale, useMarkdown };
@@ -1,2 +1,3 @@
1
- export * from "./installIntlayerMarkdown.mjs";
2
- //# sourceMappingURL=index.mjs.map
1
+ import { INTLAYER_MARKDOWN_TOKEN, IntlayerMarkdownService, createIntlayerMarkdownProvider, useMarkdown } from "./installIntlayerMarkdown.mjs";
2
+
3
+ export { INTLAYER_MARKDOWN_TOKEN, IntlayerMarkdownService, createIntlayerMarkdownProvider, useMarkdown };
@@ -1,39 +1,34 @@
1
- import { inject, Injectable, InjectionToken } from "@angular/core";
1
+ import { Injectable, InjectionToken, inject } from "@angular/core";
2
+
3
+ //#region src/markdown/installIntlayerMarkdown.ts
2
4
  const INTLAYER_MARKDOWN_TOKEN = new InjectionToken("intlayerMarkdown");
5
+ /**
6
+ * Default markdown renderer that returns the markdown as is
7
+ */
3
8
  const defaultMarkdownRenderer = (markdown) => markdown;
9
+ /**
10
+ * Create IntlayerMarkdown provider configuration
11
+ */
4
12
  const createIntlayerMarkdownProvider = (renderMarkdown = defaultMarkdownRenderer) => ({
5
- provide: INTLAYER_MARKDOWN_TOKEN,
6
- useValue: {
7
- renderMarkdown
8
- }
13
+ provide: INTLAYER_MARKDOWN_TOKEN,
14
+ useValue: { renderMarkdown }
9
15
  });
10
- @Injectable({
11
- providedIn: "root"
12
- })
13
- class IntlayerMarkdownService {
14
- markdownProvider = inject(INTLAYER_MARKDOWN_TOKEN, {
15
- optional: true
16
- });
17
- renderMarkdown(markdown) {
18
- if (!this.markdownProvider) {
19
- return markdown;
20
- }
21
- return this.markdownProvider.renderMarkdown(markdown);
22
- }
23
- }
24
- const useMarkdown = () => {
25
- const markdownProvider = inject(INTLAYER_MARKDOWN_TOKEN, { optional: true });
26
- if (!markdownProvider) {
27
- return {
28
- renderMarkdown: defaultMarkdownRenderer
29
- };
30
- }
31
- return markdownProvider;
16
+ var IntlayerMarkdownService = @Injectable({ providedIn: "root" }) class {
17
+ markdownProvider = inject(INTLAYER_MARKDOWN_TOKEN, { optional: true });
18
+ renderMarkdown(markdown) {
19
+ if (!this.markdownProvider) return markdown;
20
+ return this.markdownProvider.renderMarkdown(markdown);
21
+ }
32
22
  };
33
- export {
34
- INTLAYER_MARKDOWN_TOKEN,
35
- IntlayerMarkdownService,
36
- createIntlayerMarkdownProvider,
37
- useMarkdown
23
+ /**
24
+ * Function to inject markdown provider
25
+ */
26
+ const useMarkdown = () => {
27
+ const markdownProvider = inject(INTLAYER_MARKDOWN_TOKEN, { optional: true });
28
+ if (!markdownProvider) return { renderMarkdown: defaultMarkdownRenderer };
29
+ return markdownProvider;
38
30
  };
31
+
32
+ //#endregion
33
+ export { INTLAYER_MARKDOWN_TOKEN, IntlayerMarkdownService, createIntlayerMarkdownProvider, useMarkdown };
39
34
  //# sourceMappingURL=installIntlayerMarkdown.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/markdown/installIntlayerMarkdown.ts"],"sourcesContent":["import { inject, Injectable, InjectionToken, TemplateRef } from '@angular/core';\n\nexport const INTLAYER_MARKDOWN_TOKEN =\n new InjectionToken<IntlayerMarkdownProvider>('intlayerMarkdown');\n\ntype RenderMarkdownFunction = (markdown: string) => string | TemplateRef<any>;\n\nexport type IntlayerMarkdownProvider = {\n renderMarkdown: RenderMarkdownFunction;\n};\n\n/**\n * Default markdown renderer that returns the markdown as is\n */\nconst defaultMarkdownRenderer: RenderMarkdownFunction = (markdown: string) =>\n markdown;\n\n/**\n * Create IntlayerMarkdown provider configuration\n */\nexport const createIntlayerMarkdownProvider = (\n renderMarkdown: RenderMarkdownFunction = defaultMarkdownRenderer\n) => ({\n provide: INTLAYER_MARKDOWN_TOKEN,\n useValue: {\n renderMarkdown,\n } as IntlayerMarkdownProvider,\n});\n\n/**\n * Injectable service for markdown rendering\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class IntlayerMarkdownService {\n private markdownProvider = inject(INTLAYER_MARKDOWN_TOKEN, {\n optional: true,\n });\n\n renderMarkdown(markdown: string): string | TemplateRef<any> {\n if (!this.markdownProvider) {\n return markdown; // Fallback to returning markdown as is\n }\n return this.markdownProvider.renderMarkdown(markdown);\n }\n}\n\n/**\n * Function to inject markdown provider\n */\nexport const useMarkdown = (): IntlayerMarkdownProvider => {\n const markdownProvider = inject(INTLAYER_MARKDOWN_TOKEN, { optional: true });\n\n if (!markdownProvider) {\n return {\n renderMarkdown: defaultMarkdownRenderer,\n };\n }\n\n return markdownProvider;\n};\n"],"mappings":"AAAA,SAAS,QAAQ,YAAY,sBAAmC;AAEzD,MAAM,0BACX,IAAI,eAAyC,kBAAkB;AAWjE,MAAM,0BAAkD,CAAC,aACvD;AAKK,MAAM,iCAAiC,CAC5C,iBAAyC,6BACrC;AAAA,EACJ,SAAS;AAAA,EACT,UAAU;AAAA,IACR;AAAA,EACF;AACF;AAKA,CAAC,WAAW;AAAA,EACV,YAAY;AACd,CAAC;AACM,MAAM,wBAAwB;AAAA,EAC3B,mBAAmB,OAAO,yBAAyB;AAAA,IACzD,UAAU;AAAA,EACZ,CAAC;AAAA,EAED,eAAe,UAA6C;AAC1D,QAAI,CAAC,KAAK,kBAAkB;AAC1B,aAAO;AAAA,IACT;AACA,WAAO,KAAK,iBAAiB,eAAe,QAAQ;AAAA,EACtD;AACF;AAKO,MAAM,cAAc,MAAgC;AACzD,QAAM,mBAAmB,OAAO,yBAAyB,EAAE,UAAU,KAAK,CAAC;AAE3E,MAAI,CAAC,kBAAkB;AACrB,WAAO;AAAA,MACL,gBAAgB;AAAA,IAClB;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"file":"installIntlayerMarkdown.mjs","names":["defaultMarkdownRenderer: RenderMarkdownFunction"],"sources":["../../../src/markdown/installIntlayerMarkdown.ts"],"sourcesContent":["import {\n Injectable,\n InjectionToken,\n inject,\n type TemplateRef,\n} from '@angular/core';\n\nexport const INTLAYER_MARKDOWN_TOKEN =\n new InjectionToken<IntlayerMarkdownProvider>('intlayerMarkdown');\n\ntype RenderMarkdownFunction = (markdown: string) => string | TemplateRef<any>;\n\nexport type IntlayerMarkdownProvider = {\n renderMarkdown: RenderMarkdownFunction;\n};\n\n/**\n * Default markdown renderer that returns the markdown as is\n */\nconst defaultMarkdownRenderer: RenderMarkdownFunction = (markdown: string) =>\n markdown;\n\n/**\n * Create IntlayerMarkdown provider configuration\n */\nexport const createIntlayerMarkdownProvider = (\n renderMarkdown: RenderMarkdownFunction = defaultMarkdownRenderer\n) => ({\n provide: INTLAYER_MARKDOWN_TOKEN,\n useValue: {\n renderMarkdown,\n } as IntlayerMarkdownProvider,\n});\n\n/**\n * Injectable service for markdown rendering\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class IntlayerMarkdownService {\n private markdownProvider = inject(INTLAYER_MARKDOWN_TOKEN, {\n optional: true,\n });\n\n renderMarkdown(markdown: string): string | TemplateRef<any> {\n if (!this.markdownProvider) {\n return markdown; // Fallback to returning markdown as is\n }\n return this.markdownProvider.renderMarkdown(markdown);\n }\n}\n\n/**\n * Function to inject markdown provider\n */\nexport const useMarkdown = (): IntlayerMarkdownProvider => {\n const markdownProvider = inject(INTLAYER_MARKDOWN_TOKEN, { optional: true });\n\n if (!markdownProvider) {\n return {\n renderMarkdown: defaultMarkdownRenderer,\n };\n }\n\n return markdownProvider;\n};\n"],"mappings":";;;AAOA,MAAa,0BACX,IAAI,eAAyC,mBAAmB;;;;AAWlE,MAAMA,2BAAmD,aACvD;;;;AAKF,MAAa,kCACX,iBAAyC,6BACrC;CACJ,SAAS;CACT,UAAU,EACR,gBACD;CACF;AAQD,IAAa,0BAHb,CAAC,WAAW,EACV,YAAY,QACb,CAAC,CACF,MAAqC;CACnC,AAAQ,mBAAmB,OAAO,yBAAyB,EACzD,UAAU,MACX,CAAC;CAEF,eAAe,UAA6C;AAC1D,MAAI,CAAC,KAAK,iBACR,QAAO;AAET,SAAO,KAAK,iBAAiB,eAAe,SAAS;;;;;;AAOzD,MAAa,oBAA8C;CACzD,MAAM,mBAAmB,OAAO,yBAAyB,EAAE,UAAU,MAAM,CAAC;AAE5E,KAAI,CAAC,iBACH,QAAO,EACL,gBAAgB,yBACjB;AAGH,QAAO"}
@@ -1,92 +1,79 @@
1
- import {
2
- getMarkdownMetadata,
3
- NodeType
4
- } from "@intlayer/core";
5
- import { ContentSelectorWrapperComponent } from "./editor/index.mjs";
1
+ import { ContentSelectorWrapperComponent } from "./editor/ContentSelectorWrapper.component.mjs";
6
2
  import { useMarkdown } from "./markdown/installIntlayerMarkdown.mjs";
7
3
  import { renderIntlayerNode } from "./renderIntlayerNode.mjs";
4
+ import { getMarkdownMetadata } from "@intlayer/core";
5
+ import { NodeType } from "@intlayer/types";
6
+
7
+ //#region src/plugins.ts
8
+ /** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
8
9
  const intlayerNodePlugins = {
9
- id: "intlayer-node-plugin",
10
- canHandle: (node) => typeof node === "bigint" || typeof node === "string" || typeof node === "number",
11
- transform: (_node, { children, ...rest }) => renderIntlayerNode({
12
- ...rest,
13
- value: children,
14
- children: () => ({
15
- component: ContentSelectorWrapperComponent,
16
- props: {
17
- dictionaryKey: rest.dictionaryKey,
18
- keyPath: rest.keyPath
19
- },
20
- children
21
- })
22
- })
10
+ id: "intlayer-node-plugin",
11
+ canHandle: (node) => typeof node === "bigint" || typeof node === "string" || typeof node === "number",
12
+ transform: (_node, { children,...rest }) => renderIntlayerNode({
13
+ ...rest,
14
+ value: children,
15
+ children: () => ({
16
+ component: ContentSelectorWrapperComponent,
17
+ props: {
18
+ dictionaryKey: rest.dictionaryKey,
19
+ keyPath: rest.keyPath
20
+ },
21
+ children
22
+ })
23
+ })
23
24
  };
25
+ /** Markdown string plugin. Replaces string node with a component that render the markdown. */
24
26
  const markdownStringPlugin = {
25
- id: "markdown-string-plugin",
26
- canHandle: (node) => typeof node === "string",
27
- transform: (node, props, deepTransformNode) => {
28
- const {
29
- plugins,
30
- // Removed to avoid next error - Functions cannot be passed directly to Client Components
31
- ...rest
32
- } = props;
33
- const metadata = getMarkdownMetadata(node);
34
- const metadataPlugins = {
35
- id: "markdown-metadata-plugin",
36
- canHandle: (metadataNode) => typeof metadataNode === "string" || typeof metadataNode === "number" || typeof metadataNode === "boolean" || !metadataNode,
37
- transform: (metadataNode, props2) => renderIntlayerNode({
38
- ...props2,
39
- value: metadataNode,
40
- children: node
41
- })
42
- };
43
- const metadataNodes = deepTransformNode(metadata, {
44
- plugins: [metadataPlugins],
45
- dictionaryKey: rest.dictionaryKey,
46
- keyPath: []
47
- });
48
- return renderIntlayerNode({
49
- ...props,
50
- value: node,
51
- children: () => ({
52
- component: ContentSelectorWrapperComponent,
53
- props: {
54
- dictionaryKey: rest.dictionaryKey,
55
- keyPath: rest.keyPath
56
- },
57
- children: () => {
58
- const { renderMarkdown } = useMarkdown();
59
- return renderMarkdown(node);
60
- }
61
- }),
62
- additionalProps: {
63
- metadata: metadataNodes
64
- }
65
- });
66
- }
27
+ id: "markdown-string-plugin",
28
+ canHandle: (node) => typeof node === "string",
29
+ transform: (node, props, deepTransformNode) => {
30
+ const { plugins,...rest } = props;
31
+ const metadataNodes = deepTransformNode(getMarkdownMetadata(node), {
32
+ plugins: [{
33
+ id: "markdown-metadata-plugin",
34
+ canHandle: (metadataNode) => typeof metadataNode === "string" || typeof metadataNode === "number" || typeof metadataNode === "boolean" || !metadataNode,
35
+ transform: (metadataNode, props$1) => renderIntlayerNode({
36
+ ...props$1,
37
+ value: metadataNode,
38
+ children: node
39
+ })
40
+ }],
41
+ dictionaryKey: rest.dictionaryKey,
42
+ keyPath: []
43
+ });
44
+ return renderIntlayerNode({
45
+ ...props,
46
+ value: node,
47
+ children: () => ({
48
+ component: ContentSelectorWrapperComponent,
49
+ props: {
50
+ dictionaryKey: rest.dictionaryKey,
51
+ keyPath: rest.keyPath
52
+ },
53
+ children: () => {
54
+ const { renderMarkdown } = useMarkdown();
55
+ return renderMarkdown(node);
56
+ }
57
+ }),
58
+ additionalProps: { metadata: metadataNodes }
59
+ });
60
+ }
67
61
  };
68
62
  const markdownPlugin = {
69
- id: "markdown-plugin",
70
- canHandle: (node) => typeof node === "object" && node?.nodeType === NodeType.Markdown,
71
- transform: (node, props, deepTransformNode) => {
72
- const newKeyPath = [
73
- ...props.keyPath,
74
- {
75
- type: NodeType.Markdown
76
- }
77
- ];
78
- const children = node[NodeType.Markdown];
79
- return deepTransformNode(children, {
80
- ...props,
81
- children,
82
- keyPath: newKeyPath,
83
- plugins: [markdownStringPlugin, ...props.plugins ?? []]
84
- });
85
- }
86
- };
87
- export {
88
- intlayerNodePlugins,
89
- markdownPlugin,
90
- markdownStringPlugin
63
+ id: "markdown-plugin",
64
+ canHandle: (node) => typeof node === "object" && node?.nodeType === NodeType.Markdown,
65
+ transform: (node, props, deepTransformNode) => {
66
+ const newKeyPath = [...props.keyPath, { type: NodeType.Markdown }];
67
+ const children = node[NodeType.Markdown];
68
+ return deepTransformNode(children, {
69
+ ...props,
70
+ children,
71
+ keyPath: newKeyPath,
72
+ plugins: [markdownStringPlugin, ...props.plugins ?? []]
73
+ });
74
+ }
91
75
  };
76
+
77
+ //#endregion
78
+ export { intlayerNodePlugins, markdownPlugin, markdownStringPlugin };
92
79
  //# sourceMappingURL=plugins.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/plugins.ts"],"sourcesContent":["import {\n getMarkdownMetadata,\n KeyPath,\n MarkdownContent,\n NodeType,\n type DeepTransformContent as DeepTransformContentCore,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n type Plugins,\n} from '@intlayer/core';\nimport { ContentSelectorWrapperComponent } from './editor';\nimport { useMarkdown } from './markdown/installIntlayerMarkdown';\nimport { renderIntlayerNode } from './renderIntlayerNode';\n\n/** ---------------------------------------------\n * INTLAYER NODE PLUGIN\n * --------------------------------------------- */\n\nexport type IntlayerNodeCond<T> = T extends number | string\n ? IntlayerNode<T>\n : never;\n\nexport interface IntlayerNode<T, P = {}> {\n value: T;\n children?: any;\n additionalProps?: P;\n}\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const intlayerNodePlugins: Plugins = {\n id: 'intlayer-node-plugin',\n canHandle: (node) =>\n typeof node === 'bigint' ||\n typeof node === 'string' ||\n typeof node === 'number',\n transform: (_node, { children, ...rest }) =>\n renderIntlayerNode({\n ...rest,\n value: children,\n children: () => ({\n component: ContentSelectorWrapperComponent,\n props: {\n dictionaryKey: rest.dictionaryKey,\n keyPath: rest.keyPath,\n },\n children: children,\n }),\n }),\n};\n\n/**\n * MARKDOWN PLUGIN\n */\n\nexport type MarkdownStringCond<T> = T extends string\n ? IntlayerNode<string, { metadata: DeepTransformContent<string> }>\n : never;\n\n/** Markdown string plugin. Replaces string node with a component that render the markdown. */\nexport const markdownStringPlugin: Plugins = {\n id: 'markdown-string-plugin',\n canHandle: (node) => typeof node === 'string',\n transform: (node: string, props, deepTransformNode) => {\n const {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n } = props;\n\n const metadata = getMarkdownMetadata(node);\n\n const metadataPlugins: Plugins = {\n id: 'markdown-metadata-plugin',\n canHandle: (metadataNode) =>\n typeof metadataNode === 'string' ||\n typeof metadataNode === 'number' ||\n typeof metadataNode === 'boolean' ||\n !metadataNode,\n transform: (metadataNode, props) =>\n renderIntlayerNode({\n ...props,\n value: metadataNode,\n children: node,\n }),\n };\n\n // Transform metadata while keeping the same structure\n const metadataNodes = deepTransformNode(metadata, {\n plugins: [metadataPlugins],\n dictionaryKey: rest.dictionaryKey,\n keyPath: [],\n });\n\n return renderIntlayerNode({\n ...props,\n value: node,\n children: () => ({\n component: ContentSelectorWrapperComponent,\n props: {\n dictionaryKey: rest.dictionaryKey,\n keyPath: rest.keyPath,\n },\n children: () => {\n const { renderMarkdown } = useMarkdown();\n return renderMarkdown(node);\n },\n }),\n additionalProps: {\n metadata: metadataNodes,\n },\n });\n },\n};\n\nexport type MarkdownCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeType.Markdown]: infer M;\n metadata?: infer U;\n}\n ? IntlayerNode<DeepTransformContent<M>, { metadata: DeepTransformContent<U> }>\n : never;\n\nexport const markdownPlugin: Plugins = {\n id: 'markdown-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Markdown,\n transform: (node: MarkdownContent, props, deepTransformNode) => {\n const newKeyPath: KeyPath[] = [\n ...props.keyPath,\n {\n type: NodeType.Markdown,\n },\n ];\n\n const children = node[NodeType.Markdown];\n\n return deepTransformNode(children, {\n ...props,\n children,\n keyPath: newKeyPath,\n plugins: [markdownStringPlugin, ...(props.plugins ?? [])],\n });\n },\n};\n\n/** ---------------------------------------------\n * PLUGINS RESULT\n * --------------------------------------------- */\n\nexport interface IInterpreterPluginAngular<T> {\n intlayerNode: IntlayerNodeCond<T>;\n markdown: MarkdownCond<T>;\n}\n\n/**\n * Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution.\n *\n * Otherwise the the `angular-intlayer` plugins will override the types of `intlayer` functions.\n */\nexport type IInterpreterPluginState = IInterpreterPluginStateCore & {\n intlayerNode: true;\n markdown: true;\n};\n\nexport type DeepTransformContent<T> = DeepTransformContentCore<\n T,\n IInterpreterPluginState\n>;\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EAGA;AAAA,OAIK;AACP,SAAS,uCAAuC;AAChD,SAAS,mBAAmB;AAC5B,SAAS,0BAA0B;AAiB5B,MAAM,sBAA+B;AAAA,EAC1C,IAAI;AAAA,EACJ,WAAW,CAAC,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;AAAA,EAClB,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,KAAK,MACrC,mBAAmB;AAAA,IACjB,GAAG;AAAA,IACH,OAAO;AAAA,IACP,UAAU,OAAO;AAAA,MACf,WAAW;AAAA,MACX,OAAO;AAAA,QACL,eAAe,KAAK;AAAA,QACpB,SAAS,KAAK;AAAA,MAChB;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AACL;AAWO,MAAM,uBAAgC;AAAA,EAC3C,IAAI;AAAA,EACJ,WAAW,CAAC,SAAS,OAAO,SAAS;AAAA,EACrC,WAAW,CAAC,MAAc,OAAO,sBAAsB;AACrD,UAAM;AAAA,MACJ;AAAA;AAAA,MACA,GAAG;AAAA,IACL,IAAI;AAEJ,UAAM,WAAW,oBAAoB,IAAI;AAEzC,UAAM,kBAA2B;AAAA,MAC/B,IAAI;AAAA,MACJ,WAAW,CAAC,iBACV,OAAO,iBAAiB,YACxB,OAAO,iBAAiB,YACxB,OAAO,iBAAiB,aACxB,CAAC;AAAA,MACH,WAAW,CAAC,cAAcA,WACxB,mBAAmB;AAAA,QACjB,GAAGA;AAAA,QACH,OAAO;AAAA,QACP,UAAU;AAAA,MACZ,CAAC;AAAA,IACL;AAGA,UAAM,gBAAgB,kBAAkB,UAAU;AAAA,MAChD,SAAS,CAAC,eAAe;AAAA,MACzB,eAAe,KAAK;AAAA,MACpB,SAAS,CAAC;AAAA,IACZ,CAAC;AAED,WAAO,mBAAmB;AAAA,MACxB,GAAG;AAAA,MACH,OAAO;AAAA,MACP,UAAU,OAAO;AAAA,QACf,WAAW;AAAA,QACX,OAAO;AAAA,UACL,eAAe,KAAK;AAAA,UACpB,SAAS,KAAK;AAAA,QAChB;AAAA,QACA,UAAU,MAAM;AACd,gBAAM,EAAE,eAAe,IAAI,YAAY;AACvC,iBAAO,eAAe,IAAI;AAAA,QAC5B;AAAA,MACF;AAAA,MACA,iBAAiB;AAAA,QACf,UAAU;AAAA,MACZ;AAAA,IACF,CAAC;AAAA,EACH;AACF;AAUO,MAAM,iBAA0B;AAAA,EACrC,IAAI;AAAA,EACJ,WAAW,CAAC,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,SAAS;AAAA,EAC1D,WAAW,CAAC,MAAuB,OAAO,sBAAsB;AAC9D,UAAM,aAAwB;AAAA,MAC5B,GAAG,MAAM;AAAA,MACT;AAAA,QACE,MAAM,SAAS;AAAA,MACjB;AAAA,IACF;AAEA,UAAM,WAAW,KAAK,SAAS,QAAQ;AAEvC,WAAO,kBAAkB,UAAU;AAAA,MACjC,GAAG;AAAA,MACH;AAAA,MACA,SAAS;AAAA,MACT,SAAS,CAAC,sBAAsB,GAAI,MAAM,WAAW,CAAC,CAAE;AAAA,IAC1D,CAAC;AAAA,EACH;AACF;","names":["props"]}
1
+ {"version":3,"file":"plugins.mjs","names":["intlayerNodePlugins: Plugins","markdownStringPlugin: Plugins","props","markdownPlugin: Plugins","newKeyPath: KeyPath[]"],"sources":["../../src/plugins.ts"],"sourcesContent":["import {\n type DeepTransformContent as DeepTransformContentCore,\n getMarkdownMetadata,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n type MarkdownContent,\n type Plugins,\n} from '@intlayer/core';\nimport { type KeyPath, NodeType } from '@intlayer/types';\nimport { ContentSelectorWrapperComponent } from './editor';\nimport { useMarkdown } from './markdown/installIntlayerMarkdown';\nimport { renderIntlayerNode } from './renderIntlayerNode';\n\n/** ---------------------------------------------\n * INTLAYER NODE PLUGIN\n * --------------------------------------------- */\n\nexport type IntlayerNodeCond<T> = T extends number | string\n ? IntlayerNode<T>\n : never;\n\nexport interface IntlayerNode<T, P = {}> {\n value: T;\n children?: any;\n additionalProps?: P;\n}\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const intlayerNodePlugins: Plugins = {\n id: 'intlayer-node-plugin',\n canHandle: (node) =>\n typeof node === 'bigint' ||\n typeof node === 'string' ||\n typeof node === 'number',\n transform: (_node, { children, ...rest }) =>\n renderIntlayerNode({\n ...rest,\n value: children,\n children: () => ({\n component: ContentSelectorWrapperComponent,\n props: {\n dictionaryKey: rest.dictionaryKey,\n keyPath: rest.keyPath,\n },\n children: children,\n }),\n }),\n};\n\n/**\n * MARKDOWN PLUGIN\n */\n\nexport type MarkdownStringCond<T> = T extends string\n ? IntlayerNode<string, { metadata: DeepTransformContent<string> }>\n : never;\n\n/** Markdown string plugin. Replaces string node with a component that render the markdown. */\nexport const markdownStringPlugin: Plugins = {\n id: 'markdown-string-plugin',\n canHandle: (node) => typeof node === 'string',\n transform: (node: string, props, deepTransformNode) => {\n const {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n } = props;\n\n const metadata = getMarkdownMetadata(node);\n\n const metadataPlugins: Plugins = {\n id: 'markdown-metadata-plugin',\n canHandle: (metadataNode) =>\n typeof metadataNode === 'string' ||\n typeof metadataNode === 'number' ||\n typeof metadataNode === 'boolean' ||\n !metadataNode,\n transform: (metadataNode, props) =>\n renderIntlayerNode({\n ...props,\n value: metadataNode,\n children: node,\n }),\n };\n\n // Transform metadata while keeping the same structure\n const metadataNodes = deepTransformNode(metadata, {\n plugins: [metadataPlugins],\n dictionaryKey: rest.dictionaryKey,\n keyPath: [],\n });\n\n return renderIntlayerNode({\n ...props,\n value: node,\n children: () => ({\n component: ContentSelectorWrapperComponent,\n props: {\n dictionaryKey: rest.dictionaryKey,\n keyPath: rest.keyPath,\n },\n children: () => {\n const { renderMarkdown } = useMarkdown();\n return renderMarkdown(node);\n },\n }),\n additionalProps: {\n metadata: metadataNodes,\n },\n });\n },\n};\n\nexport type MarkdownCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeType.Markdown]: infer M;\n metadata?: infer U;\n}\n ? IntlayerNode<DeepTransformContent<M>, { metadata: DeepTransformContent<U> }>\n : never;\n\nexport const markdownPlugin: Plugins = {\n id: 'markdown-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Markdown,\n transform: (node: MarkdownContent, props, deepTransformNode) => {\n const newKeyPath: KeyPath[] = [\n ...props.keyPath,\n {\n type: NodeType.Markdown,\n },\n ];\n\n const children = node[NodeType.Markdown];\n\n return deepTransformNode(children, {\n ...props,\n children,\n keyPath: newKeyPath,\n plugins: [markdownStringPlugin, ...(props.plugins ?? [])],\n });\n },\n};\n\n/** ---------------------------------------------\n * PLUGINS RESULT\n * --------------------------------------------- */\n\nexport interface IInterpreterPluginAngular<T> {\n intlayerNode: IntlayerNodeCond<T>;\n markdown: MarkdownCond<T>;\n}\n\n/**\n * Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution.\n *\n * Otherwise the the `angular-intlayer` plugins will override the types of `intlayer` functions.\n */\nexport type IInterpreterPluginState = IInterpreterPluginStateCore & {\n intlayerNode: true;\n markdown: true;\n};\n\nexport type DeepTransformContent<T> = DeepTransformContentCore<\n T,\n IInterpreterPluginState\n>;\n"],"mappings":";;;;;;;;AA2BA,MAAaA,sBAA+B;CAC1C,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;CAClB,YAAY,OAAO,EAAE,SAAU,GAAG,WAChC,mBAAmB;EACjB,GAAG;EACH,OAAO;EACP,iBAAiB;GACf,WAAW;GACX,OAAO;IACL,eAAe,KAAK;IACpB,SAAS,KAAK;IACf;GACS;GACX;EACF,CAAC;CACL;;AAWD,MAAaC,uBAAgC;CAC3C,IAAI;CACJ,YAAY,SAAS,OAAO,SAAS;CACrC,YAAY,MAAc,OAAO,sBAAsB;EACrD,MAAM,EACJ,QACA,GAAG,SACD;EAoBJ,MAAM,gBAAgB,kBAlBL,oBAAoB,KAAK,EAkBQ;GAChD,SAAS,CAjBsB;IAC/B,IAAI;IACJ,YAAY,iBACV,OAAO,iBAAiB,YACxB,OAAO,iBAAiB,YACxB,OAAO,iBAAiB,aACxB,CAAC;IACH,YAAY,cAAc,YACxB,mBAAmB;KACjB,GAAGC;KACH,OAAO;KACP,UAAU;KACX,CAAC;IACL,CAI2B;GAC1B,eAAe,KAAK;GACpB,SAAS,EAAE;GACZ,CAAC;AAEF,SAAO,mBAAmB;GACxB,GAAG;GACH,OAAO;GACP,iBAAiB;IACf,WAAW;IACX,OAAO;KACL,eAAe,KAAK;KACpB,SAAS,KAAK;KACf;IACD,gBAAgB;KACd,MAAM,EAAE,mBAAmB,aAAa;AACxC,YAAO,eAAe,KAAK;;IAE9B;GACD,iBAAiB,EACf,UAAU,eACX;GACF,CAAC;;CAEL;AAUD,MAAaC,iBAA0B;CACrC,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,SAAS;CAC1D,YAAY,MAAuB,OAAO,sBAAsB;EAC9D,MAAMC,aAAwB,CAC5B,GAAG,MAAM,SACT,EACE,MAAM,SAAS,UAChB,CACF;EAED,MAAM,WAAW,KAAK,SAAS;AAE/B,SAAO,kBAAkB,UAAU;GACjC,GAAG;GACH;GACA,SAAS;GACT,SAAS,CAAC,sBAAsB,GAAI,MAAM,WAAW,EAAE,CAAE;GAC1D,CAAC;;CAEL"}