angular-intlayer 8.4.4 → 8.4.6

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 (146) hide show
  1. package/dist/cjs/_virtual/_@oxc-project_runtime@0.115.0/helpers/decorate.cjs +11 -0
  2. package/dist/cjs/_virtual/_@oxc-project_runtime@0.115.0/helpers/decorateMetadata.cjs +8 -0
  3. package/dist/cjs/_virtual/_rolldown/runtime.cjs +29 -0
  4. package/dist/cjs/client/index.cjs +28 -1
  5. package/dist/cjs/client/installIntlayer.cjs +77 -1
  6. package/dist/cjs/client/installIntlayer.cjs.map +1 -1
  7. package/dist/cjs/client/useDictionary.cjs +15 -1
  8. package/dist/cjs/client/useDictionary.cjs.map +1 -1
  9. package/dist/cjs/client/useDictionaryAsync.cjs +24 -1
  10. package/dist/cjs/client/useDictionaryAsync.cjs.map +1 -1
  11. package/dist/cjs/client/useDictionaryDynamic.cjs +25 -1
  12. package/dist/cjs/client/useDictionaryDynamic.cjs.map +1 -1
  13. package/dist/cjs/client/useIntl.cjs +40 -1
  14. package/dist/cjs/client/useIntl.cjs.map +1 -1
  15. package/dist/cjs/client/useIntlayer.cjs +44 -1
  16. package/dist/cjs/client/useIntlayer.cjs.map +1 -1
  17. package/dist/cjs/client/useLoadDynamic.cjs +28 -1
  18. package/dist/cjs/client/useLoadDynamic.cjs.map +1 -1
  19. package/dist/cjs/client/useLocale.cjs +60 -1
  20. package/dist/cjs/client/useLocale.cjs.map +1 -1
  21. package/dist/cjs/client/useLocaleStorage.cjs +61 -1
  22. package/dist/cjs/client/useLocaleStorage.cjs.map +1 -1
  23. package/dist/cjs/editor/ContentSelector.component.cjs +38 -1
  24. package/dist/cjs/editor/ContentSelector.component.cjs.map +1 -0
  25. package/dist/cjs/editor/useEditor.cjs +31 -1
  26. package/dist/cjs/editor/useEditor.cjs.map +1 -1
  27. package/dist/cjs/getDictionary.cjs +10 -1
  28. package/dist/cjs/getDictionary.cjs.map +1 -1
  29. package/dist/cjs/getIntlayer.cjs +10 -1
  30. package/dist/cjs/getIntlayer.cjs.map +1 -1
  31. package/dist/cjs/index.cjs +50 -1
  32. package/dist/cjs/markdown/index.cjs +13 -1
  33. package/dist/cjs/markdown/installIntlayerMarkdown.cjs +79 -1
  34. package/dist/cjs/markdown/installIntlayerMarkdown.cjs.map +1 -1
  35. package/dist/cjs/plugins.cjs +232 -1
  36. package/dist/cjs/plugins.cjs.map +1 -1
  37. package/dist/cjs/renderIntlayerNode.cjs +28 -1
  38. package/dist/cjs/renderIntlayerNode.cjs.map +1 -1
  39. package/dist/cjs/webpack/index.cjs +4 -1
  40. package/dist/cjs/webpack/mergeConfig.cjs +45 -1
  41. package/dist/cjs/webpack/mergeConfig.cjs.map +1 -1
  42. package/dist/esm/_virtual/_@oxc-project_runtime@0.115.0/helpers/decorate.mjs +10 -0
  43. package/dist/esm/_virtual/_@oxc-project_runtime@0.115.0/helpers/decorateMetadata.mjs +7 -0
  44. package/dist/esm/client/index.mjs +10 -1
  45. package/dist/esm/client/installIntlayer.mjs +65 -1
  46. package/dist/esm/client/installIntlayer.mjs.map +1 -1
  47. package/dist/esm/client/useDictionary.mjs +13 -1
  48. package/dist/esm/client/useDictionary.mjs.map +1 -1
  49. package/dist/esm/client/useDictionaryAsync.mjs +21 -1
  50. package/dist/esm/client/useDictionaryAsync.mjs.map +1 -1
  51. package/dist/esm/client/useDictionaryDynamic.mjs +22 -1
  52. package/dist/esm/client/useDictionaryDynamic.mjs.map +1 -1
  53. package/dist/esm/client/useIntl.mjs +38 -1
  54. package/dist/esm/client/useIntl.mjs.map +1 -1
  55. package/dist/esm/client/useIntlayer.mjs +41 -1
  56. package/dist/esm/client/useIntlayer.mjs.map +1 -1
  57. package/dist/esm/client/useLoadDynamic.mjs +26 -1
  58. package/dist/esm/client/useLoadDynamic.mjs.map +1 -1
  59. package/dist/esm/client/useLocale.mjs +57 -1
  60. package/dist/esm/client/useLocale.mjs.map +1 -1
  61. package/dist/esm/client/useLocaleStorage.mjs +54 -1
  62. package/dist/esm/client/useLocaleStorage.mjs.map +1 -1
  63. package/dist/esm/editor/ContentSelector.component.mjs +31 -1
  64. package/dist/esm/editor/ContentSelector.component.mjs.map +1 -0
  65. package/dist/esm/editor/useEditor.mjs +29 -1
  66. package/dist/esm/editor/useEditor.mjs.map +1 -1
  67. package/dist/esm/getDictionary.mjs +8 -1
  68. package/dist/esm/getDictionary.mjs.map +1 -1
  69. package/dist/esm/getIntlayer.mjs +8 -1
  70. package/dist/esm/getIntlayer.mjs.map +1 -1
  71. package/dist/esm/index.mjs +14 -1
  72. package/dist/esm/markdown/index.mjs +3 -1
  73. package/dist/esm/markdown/installIntlayerMarkdown.mjs +68 -1
  74. package/dist/esm/markdown/installIntlayerMarkdown.mjs.map +1 -1
  75. package/dist/esm/plugins.mjs +223 -1
  76. package/dist/esm/plugins.mjs.map +1 -1
  77. package/dist/esm/renderIntlayerNode.mjs +26 -1
  78. package/dist/esm/renderIntlayerNode.mjs.map +1 -1
  79. package/dist/esm/webpack/index.mjs +3 -1
  80. package/dist/esm/webpack/mergeConfig.mjs +43 -1
  81. package/dist/esm/webpack/mergeConfig.mjs.map +1 -1
  82. package/dist/types/client/index.d.ts +8 -8
  83. package/dist/types/client/installIntlayer.d.ts +50 -2
  84. package/dist/types/client/installIntlayer.d.ts.map +1 -0
  85. package/dist/types/client/useDictionary.d.ts +10 -2
  86. package/dist/types/client/useDictionary.d.ts.map +1 -0
  87. package/dist/types/client/useDictionaryAsync.d.ts +14 -2
  88. package/dist/types/client/useDictionaryAsync.d.ts.map +1 -0
  89. package/dist/types/client/useDictionaryDynamic.d.ts +17 -2
  90. package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -0
  91. package/dist/types/client/useIntl.d.ts +33 -2
  92. package/dist/types/client/useIntl.d.ts.map +1 -0
  93. package/dist/types/client/useIntlayer.d.ts +38 -2
  94. package/dist/types/client/useIntlayer.d.ts.map +1 -0
  95. package/dist/types/client/useLoadDynamic.d.ts +11 -2
  96. package/dist/types/client/useLoadDynamic.d.ts.map +1 -0
  97. package/dist/types/client/useLocale.d.ts +48 -2
  98. package/dist/types/client/useLocale.d.ts.map +1 -0
  99. package/dist/types/getDictionary.d.ts +9 -2
  100. package/dist/types/getDictionary.d.ts.map +1 -0
  101. package/dist/types/getIntlayer.d.ts +8 -2
  102. package/dist/types/getIntlayer.d.ts.map +1 -0
  103. package/dist/types/index.d.ts +21 -13
  104. package/dist/types/index.d.ts.map +1 -0
  105. package/dist/types/markdown/index.d.ts +1 -1
  106. package/dist/types/markdown/installIntlayerMarkdown.d.ts +36 -2
  107. package/dist/types/markdown/installIntlayerMarkdown.d.ts.map +1 -0
  108. package/dist/types/plugins.d.ts +90 -2
  109. package/dist/types/plugins.d.ts.map +1 -0
  110. package/dist/types/webpack/index.d.ts +2 -5
  111. package/dist/types/webpack/mergeConfig.d.ts +5 -2
  112. package/dist/types/webpack/mergeConfig.d.ts.map +1 -0
  113. package/package.json +8 -8
  114. package/dist/cjs/ContentSelector.component-Dfy-4WRH.cjs +0 -9
  115. package/dist/cjs/ContentSelector.component-Dfy-4WRH.cjs.map +0 -1
  116. package/dist/cjs/chunk-Bmb41Sf3.cjs +0 -1
  117. package/dist/cjs/decorate-B_4qGGx3.cjs +0 -1
  118. package/dist/esm/ContentSelector.component-B9Uvy9gY.mjs +0 -9
  119. package/dist/esm/ContentSelector.component-B9Uvy9gY.mjs.map +0 -1
  120. package/dist/esm/decorate-EVKP5RjP.mjs +0 -1
  121. package/dist/types/getDictionary-DDjZzxAC.d.ts +0 -9
  122. package/dist/types/getDictionary-DDjZzxAC.d.ts.map +0 -1
  123. package/dist/types/getIntlayer-CWM6qsJJ.d.ts +0 -8
  124. package/dist/types/getIntlayer-CWM6qsJJ.d.ts.map +0 -1
  125. package/dist/types/index-Cf8zm5QQ.d.ts +0 -1
  126. package/dist/types/index-D5QAgZ5v.d.ts +0 -22
  127. package/dist/types/index-D5QAgZ5v.d.ts.map +0 -1
  128. package/dist/types/installIntlayer-Ce7kST5N.d.ts +0 -50
  129. package/dist/types/installIntlayer-Ce7kST5N.d.ts.map +0 -1
  130. package/dist/types/installIntlayerMarkdown-BIU3FTDH.d.ts +0 -36
  131. package/dist/types/installIntlayerMarkdown-BIU3FTDH.d.ts.map +0 -1
  132. package/dist/types/plugins-C_v3w-vC.d.ts +0 -89
  133. package/dist/types/plugins-C_v3w-vC.d.ts.map +0 -1
  134. package/dist/types/useDictionary-Dq9yu0X_.d.ts +0 -10
  135. package/dist/types/useDictionary-Dq9yu0X_.d.ts.map +0 -1
  136. package/dist/types/useDictionaryAsync-BYUsr8w4.d.ts +0 -14
  137. package/dist/types/useDictionaryAsync-BYUsr8w4.d.ts.map +0 -1
  138. package/dist/types/useIntl-CHizZCR2.d.ts +0 -33
  139. package/dist/types/useIntl-CHizZCR2.d.ts.map +0 -1
  140. package/dist/types/useIntlayer-m3n_upwm.d.ts +0 -38
  141. package/dist/types/useIntlayer-m3n_upwm.d.ts.map +0 -1
  142. package/dist/types/useLoadDynamic-C4pltPcC.d.ts +0 -11
  143. package/dist/types/useLoadDynamic-C4pltPcC.d.ts.map +0 -1
  144. package/dist/types/useLocale-BzfAmXlx.d.ts +0 -48
  145. package/dist/types/useLocale-BzfAmXlx.d.ts.map +0 -1
  146. package/dist/types/webpack/index.d.ts.map +0 -1
@@ -1,2 +1,58 @@
1
- import{INTLAYER_TOKEN as e}from"./installIntlayer.mjs";import{setLocaleInStorage as t}from"./useLocaleStorage.mjs";import n from"@intlayer/config/built";import{computed as r,inject as i}from"@angular/core";const a=({isCookieEnabled:a,onLocaleChange:o}={})=>{let{defaultLocale:s,locales:c}=n?.internationalization??{},l=i(e),u=r(()=>l?.locale()??s),d=r(()=>l?.isCookieEnabled()??!0);return{locale:u,defaultLocale:s,availableLocales:c,setLocale:e=>{if(!c?.map(String).includes(e)){console.error(`Locale ${e} is not available`);return}l&&l.setLocale(e),t(e,a??d()??!0),o?.(e)}}};export{a as useLocale};
1
+ import { INTLAYER_TOKEN } from "./installIntlayer.mjs";
2
+ import { setLocaleInStorage } from "./useLocaleStorage.mjs";
3
+ import configuration from "@intlayer/config/built";
4
+ import { computed, inject } from "@angular/core";
5
+
6
+ //#region src/client/useLocale.ts
7
+ /**
8
+ * Angular hook to manage the current locale and related functions.
9
+ *
10
+ * @param props - Optional configuration for locale management.
11
+ * @returns An object containing the current locale (signal), default locale, available locales, and a function to update the locale.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import { Component } from '@angular/core';
16
+ * import { useLocale } from 'angular-intlayer';
17
+ *
18
+ * @Component({
19
+ * standalone: true,
20
+ * selector: 'app-locale-switcher',
21
+ * template: `
22
+ * <select [value]="locale()" (change)="setLocale($any($event.target).value)">
23
+ * @for (loc of availableLocales; track loc) {
24
+ * <option [value]="loc">{{ loc }}</option>
25
+ * }
26
+ * </select>
27
+ * `,
28
+ * })
29
+ * export class LocaleSwitcher {
30
+ * const { locale, setLocale, availableLocales } = useLocale();
31
+ * }
32
+ * ```
33
+ */
34
+ const useLocale = ({ isCookieEnabled, onLocaleChange } = {}) => {
35
+ const { defaultLocale, locales: availableLocales } = configuration?.internationalization ?? {};
36
+ const intlayer = inject(INTLAYER_TOKEN);
37
+ const locale = computed(() => intlayer?.locale() ?? defaultLocale);
38
+ const isCookieEnabledContext = computed(() => intlayer?.isCookieEnabled() ?? true);
39
+ const setLocale = (newLocale) => {
40
+ if (!availableLocales?.map(String).includes(newLocale)) {
41
+ console.error(`Locale ${newLocale} is not available`);
42
+ return;
43
+ }
44
+ if (intlayer) intlayer.setLocale(newLocale);
45
+ setLocaleInStorage(newLocale, isCookieEnabled ?? isCookieEnabledContext() ?? true);
46
+ onLocaleChange?.(newLocale);
47
+ };
48
+ return {
49
+ locale,
50
+ defaultLocale,
51
+ availableLocales,
52
+ setLocale
53
+ };
54
+ };
55
+
56
+ //#endregion
57
+ export { useLocale };
2
58
  //# sourceMappingURL=useLocale.mjs.map
@@ -1 +1 @@
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/module_augmentation';\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 * Angular hook to manage the current locale and related functions.\n *\n * @param props - Optional configuration for locale management.\n * @returns An object containing the current locale (signal), default locale, available locales, and a function to update the locale.\n *\n * @example\n * ```ts\n * import { Component } from '@angular/core';\n * import { useLocale } from 'angular-intlayer';\n *\n * @Component({\n * standalone: true,\n * selector: 'app-locale-switcher',\n * template: `\n * <select [value]=\"locale()\" (change)=\"setLocale($any($event.target).value)\">\n * @for (loc of availableLocales; track loc) {\n * <option [value]=\"loc\">{{ loc }}</option>\n * }\n * </select>\n * `,\n * })\n * export class LocaleSwitcher {\n * const { locale, setLocale, availableLocales } = useLocale();\n * }\n * ```\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":"8MAsCA,MAAa,GAAa,CACxB,kBACA,kBACkB,EAAE,GAAK,CACzB,GAAM,CAAE,gBAAe,QAAS,GAC9B,GAAe,sBAAwB,EAAE,CACrC,EAAW,EAAyB,EAAe,CAGnD,EAAS,MAAe,GAAU,QAAQ,EAAI,EAAc,CAC5D,EAAyB,MACvB,GAAU,iBAAiB,EAAI,GACtC,CAkBD,MAAO,CACL,SACA,gBACA,mBACA,UApBiB,GAA6B,CAC9C,GAAI,CAAC,GAAkB,IAAI,OAAO,CAAC,SAAS,EAAU,CAAE,CACtD,QAAQ,MAAM,UAAU,EAAU,mBAAmB,CACrD,OAGE,GACF,EAAS,UAAU,EAAU,CAE/B,EACE,EACA,GAAmB,GAAwB,EAAI,GAChD,CACD,IAAiB,EAAU,EAQ5B"}
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/module_augmentation';\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 * Angular hook to manage the current locale and related functions.\n *\n * @param props - Optional configuration for locale management.\n * @returns An object containing the current locale (signal), default locale, available locales, and a function to update the locale.\n *\n * @example\n * ```ts\n * import { Component } from '@angular/core';\n * import { useLocale } from 'angular-intlayer';\n *\n * @Component({\n * standalone: true,\n * selector: 'app-locale-switcher',\n * template: `\n * <select [value]=\"locale()\" (change)=\"setLocale($any($event.target).value)\">\n * @for (loc of availableLocales; track loc) {\n * <option [value]=\"loc\">{{ loc }}</option>\n * }\n * </select>\n * `,\n * })\n * export class LocaleSwitcher {\n * const { locale, setLocale, availableLocales } = useLocale();\n * }\n * ```\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,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"}
@@ -1,2 +1,55 @@
1
- import{localeStorageOptions as e}from"@intlayer/core/localization";import{LocaleStorage as t,getLocaleFromStorage as n,setLocaleInStorage as r}from"@intlayer/core/utils";const i=n(e),a=i,o=(t,n)=>r(t,{...e,isCookieEnabled:n}),s=o,c=n=>t({...e,isCookieEnabled:n}),l=e=>{let t=c(e);return{localeCookie:t.getLocale(),setLocaleCookie:t.setLocale}};export{a as localeCookie,i as localeInStorage,s as setLocaleCookie,o as setLocaleInStorage,l as useLocaleCookie,c as useLocaleStorage};
1
+ import { localeStorageOptions } from "@intlayer/core/localization";
2
+ import { LocaleStorage, getLocaleFromStorage, setLocaleInStorage as setLocaleInStorage$1 } from "@intlayer/core/utils";
3
+
4
+ //#region src/client/useLocaleStorage.ts
5
+ /**
6
+ * Get the locale cookie
7
+ */
8
+ /**
9
+ * Get the locale cookie
10
+ */
11
+ const localeInStorage = getLocaleFromStorage(localeStorageOptions);
12
+ /**
13
+ * @deprecated Use localeInStorage instead
14
+ *
15
+ * Get the locale cookie
16
+ */
17
+ const localeCookie = localeInStorage;
18
+ /**
19
+ * Set the locale cookie
20
+ */
21
+ const setLocaleInStorage = (locale, isCookieEnabled) => setLocaleInStorage$1(locale, {
22
+ ...localeStorageOptions,
23
+ isCookieEnabled
24
+ });
25
+ /**
26
+ * @deprecated Use setLocaleInStorage instead
27
+ *
28
+ * Set the locale cookie
29
+ */
30
+ const setLocaleCookie = setLocaleInStorage;
31
+ /**
32
+ * Hook that provides the locale storage and a function to set it
33
+ */
34
+ const useLocaleStorage = (isCookieEnabled) => LocaleStorage({
35
+ ...localeStorageOptions,
36
+ isCookieEnabled
37
+ });
38
+ /**
39
+ * @deprecated Use useLocaleStorage instead
40
+ *
41
+ * For GDPR compliance, use useLocaleStorage instead
42
+ *
43
+ * Hook that provides the locale cookie and a function to set it
44
+ */
45
+ const useLocaleCookie = (isCookieEnabled) => {
46
+ const storage = useLocaleStorage(isCookieEnabled);
47
+ return {
48
+ localeCookie: storage.getLocale(),
49
+ setLocaleCookie: storage.setLocale
50
+ };
51
+ };
52
+
53
+ //#endregion
54
+ export { localeCookie, localeInStorage, setLocaleCookie, setLocaleInStorage, useLocaleCookie, useLocaleStorage };
2
55
  //# sourceMappingURL=useLocaleStorage.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLocaleStorage.mjs","names":["setLocaleInStorageCore"],"sources":["../../../src/client/useLocaleStorage.ts"],"sourcesContent":["import { localeStorageOptions } from '@intlayer/core/localization';\nimport {\n getLocaleFromStorage,\n LocaleStorage,\n setLocaleInStorage as setLocaleInStorageCore,\n} from '@intlayer/core/utils';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\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":"0KAcA,MAAa,EAAkB,EAAqB,EAAqB,CAM5D,EAAe,EAKf,GACX,EACA,IAEAA,EAAuB,EAAQ,CAC7B,GAAG,EACH,kBACD,CAAC,CAOS,EAAkB,EAKlB,EAAoB,GAC/B,EAAc,CACZ,GAAG,EACH,kBACD,CAAC,CASS,EAAmB,GAA8B,CAC5D,IAAM,EAAU,EAAiB,EAAgB,CAEjD,MAAO,CACL,aAAc,EAAQ,WAAW,CACjC,gBAAiB,EAAQ,UAC1B"}
1
+ {"version":3,"file":"useLocaleStorage.mjs","names":["setLocaleInStorageCore"],"sources":["../../../src/client/useLocaleStorage.ts"],"sourcesContent":["import { localeStorageOptions } from '@intlayer/core/localization';\nimport {\n getLocaleFromStorage,\n LocaleStorage,\n setLocaleInStorage as setLocaleInStorageCore,\n} from '@intlayer/core/utils';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\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 +1,31 @@
1
- import{t as e}from"../ContentSelector.component-B9Uvy9gY.mjs";export{e as ContentSelectorWrapperComponent};
1
+ import { __decorateMetadata } from "../_virtual/_@oxc-project_runtime@0.115.0/helpers/decorateMetadata.mjs";
2
+ import { __decorate } from "../_virtual/_@oxc-project_runtime@0.115.0/helpers/decorate.mjs";
3
+ import { CUSTOM_ELEMENTS_SCHEMA, Component, Input } from "@angular/core";
4
+
5
+ //#region src/editor/ContentSelector.component.ts
6
+ let ContentSelectorWrapperComponent = class ContentSelectorWrapperComponent {
7
+ dictionaryKey;
8
+ keyPath;
9
+ get keyPathJson() {
10
+ return JSON.stringify(this.keyPath);
11
+ }
12
+ };
13
+ __decorate([Input(), __decorateMetadata("design:type", String)], ContentSelectorWrapperComponent.prototype, "dictionaryKey", void 0);
14
+ __decorate([Input(), __decorateMetadata("design:type", Array)], ContentSelectorWrapperComponent.prototype, "keyPath", void 0);
15
+ ContentSelectorWrapperComponent = __decorate([Component({
16
+ selector: "app-content-selector-wrapper",
17
+ standalone: true,
18
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
19
+ template: `
20
+ <intlayer-content-selector-wrapper
21
+ [attr.key-path]="keyPathJson"
22
+ [attr.dictionary-key]="dictionaryKey"
23
+ >
24
+ <ng-content></ng-content>
25
+ </intlayer-content-selector-wrapper>
26
+ `
27
+ })], ContentSelectorWrapperComponent);
28
+
29
+ //#endregion
30
+ export { ContentSelectorWrapperComponent };
31
+ //# sourceMappingURL=ContentSelector.component.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentSelector.component.mjs","names":[],"sources":["../../../src/editor/ContentSelector.component.ts"],"sourcesContent":["import { Component, CUSTOM_ELEMENTS_SCHEMA, Input } from '@angular/core';\n\n@Component({\n selector: 'app-content-selector-wrapper',\n standalone: true,\n schemas: [CUSTOM_ELEMENTS_SCHEMA],\n template: `\n <intlayer-content-selector-wrapper\n [attr.key-path]=\"keyPathJson\"\n [attr.dictionary-key]=\"dictionaryKey\"\n >\n <ng-content></ng-content>\n </intlayer-content-selector-wrapper>\n `,\n})\nexport class ContentSelectorWrapperComponent {\n @Input() dictionaryKey!: string;\n @Input() keyPath!: any[];\n\n get keyPathJson() {\n return JSON.stringify(this.keyPath);\n }\n}\n"],"mappings":";;;;;AAeO,4CAAM,gCAAgC;CAC3C,AAAS;CACT,AAAS;CAET,IAAI,cAAc;AAChB,SAAO,KAAK,UAAU,KAAK,QAAQ;;;YAJpC,OAAO;YACP,OAAO;8CAfT,UAAU;CACT,UAAU;CACV,YAAY;CACZ,SAAS,CAAC,uBAAuB;CACjC,UAAU;;;;;;;;CAQX,CAAC"}
@@ -1,2 +1,30 @@
1
- import{INTLAYER_TOKEN as e}from"../client/installIntlayer.mjs";import"../client/index.mjs";import{DestroyRef as t,Injector as n,effect as r,inject as i,runInInjectionContext as a}from"@angular/core";import{isEnabled as o}from"@intlayer/editor/isEnabled";const s=()=>{if(process.env.INTLAYER_EDITOR_ENABLED===`false`||!o)return;let s=i(t,{optional:!0}),c=i(e,{optional:!0}),l=i(n);import(`@intlayer/editor`).then(({initEditorClient:e})=>{let t=e();if(c){let e=a(l,()=>r(()=>{let e=c.locale();e&&t.currentLocale.set(e)}));s?.onDestroy(()=>e.destroy())}}),s?.onDestroy(()=>{import(`@intlayer/editor`).then(({stopEditorClient:e})=>{e()})})};export{s as useEditor};
1
+ import { INTLAYER_TOKEN } from "../client/installIntlayer.mjs";
2
+ import { DestroyRef, Injector, effect, inject, runInInjectionContext } from "@angular/core";
3
+ import { isEnabled } from "@intlayer/editor/isEnabled";
4
+
5
+ //#region src/editor/useEditor.ts
6
+ const useEditor = () => {
7
+ if (process.env.INTLAYER_EDITOR_ENABLED === "false" || !isEnabled) return;
8
+ const destroyRef = inject(DestroyRef, { optional: true });
9
+ const client = inject(INTLAYER_TOKEN, { optional: true });
10
+ const injector = inject(Injector);
11
+ import("@intlayer/editor").then(({ initEditorClient }) => {
12
+ const manager = initEditorClient();
13
+ if (client) {
14
+ const effectRef = runInInjectionContext(injector, () => effect(() => {
15
+ const locale = client.locale();
16
+ if (locale) manager.currentLocale.set(locale);
17
+ }));
18
+ destroyRef?.onDestroy(() => effectRef.destroy());
19
+ }
20
+ });
21
+ destroyRef?.onDestroy(() => {
22
+ import("@intlayer/editor").then(({ stopEditorClient }) => {
23
+ stopEditorClient();
24
+ });
25
+ });
26
+ };
27
+
28
+ //#endregion
29
+ export { useEditor };
2
30
  //# sourceMappingURL=useEditor.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEditor.mjs","names":[],"sources":["../../../src/editor/useEditor.ts"],"sourcesContent":["import {\n DestroyRef,\n effect,\n Injector,\n inject,\n runInInjectionContext,\n} from '@angular/core';\nimport { isEnabled } from '@intlayer/editor/isEnabled';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from '../client';\n\nexport const useEditor = () => {\n if (process.env.INTLAYER_EDITOR_ENABLED === 'false' || !isEnabled) return;\n\n const destroyRef = inject(DestroyRef, { optional: true });\n const client = inject<IntlayerProvider>(INTLAYER_TOKEN, {\n optional: true,\n } as any);\n const injector = inject(Injector);\n\n import('@intlayer/editor').then(({ initEditorClient }) => {\n const manager = initEditorClient();\n\n if (client) {\n const effectRef = runInInjectionContext(injector, () =>\n effect(() => {\n const locale = client.locale();\n if (locale) manager.currentLocale.set(locale as Locale);\n })\n );\n destroyRef?.onDestroy(() => effectRef.destroy());\n }\n });\n\n destroyRef?.onDestroy(() => {\n import('@intlayer/editor').then(({ stopEditorClient }) => {\n stopEditorClient();\n });\n });\n};\n"],"mappings":"8PAWA,MAAa,MAAkB,CAC7B,GAAI,QAAQ,IAAI,0BAA4B,SAAW,CAAC,EAAW,OAEnE,IAAM,EAAa,EAAO,EAAY,CAAE,SAAU,GAAM,CAAC,CACnD,EAAS,EAAyB,EAAgB,CACtD,SAAU,GACX,CAAQ,CACH,EAAW,EAAO,EAAS,CAEjC,OAAO,oBAAoB,MAAM,CAAE,sBAAuB,CACxD,IAAM,EAAU,GAAkB,CAElC,GAAI,EAAQ,CACV,IAAM,EAAY,EAAsB,MACtC,MAAa,CACX,IAAM,EAAS,EAAO,QAAQ,CAC1B,GAAQ,EAAQ,cAAc,IAAI,EAAiB,EACvD,CACH,CACD,GAAY,cAAgB,EAAU,SAAS,CAAC,GAElD,CAEF,GAAY,cAAgB,CAC1B,OAAO,oBAAoB,MAAM,CAAE,sBAAuB,CACxD,GAAkB,EAClB,EACF"}
1
+ {"version":3,"file":"useEditor.mjs","names":[],"sources":["../../../src/editor/useEditor.ts"],"sourcesContent":["import {\n DestroyRef,\n effect,\n Injector,\n inject,\n runInInjectionContext,\n} from '@angular/core';\nimport { isEnabled } from '@intlayer/editor/isEnabled';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from '../client';\n\nexport const useEditor = () => {\n if (process.env.INTLAYER_EDITOR_ENABLED === 'false' || !isEnabled) return;\n\n const destroyRef = inject(DestroyRef, { optional: true });\n const client = inject<IntlayerProvider>(INTLAYER_TOKEN, {\n optional: true,\n } as any);\n const injector = inject(Injector);\n\n import('@intlayer/editor').then(({ initEditorClient }) => {\n const manager = initEditorClient();\n\n if (client) {\n const effectRef = runInInjectionContext(injector, () =>\n effect(() => {\n const locale = client.locale();\n if (locale) manager.currentLocale.set(locale as Locale);\n })\n );\n destroyRef?.onDestroy(() => effectRef.destroy());\n }\n });\n\n destroyRef?.onDestroy(() => {\n import('@intlayer/editor').then(({ stopEditorClient }) => {\n stopEditorClient();\n });\n });\n};\n"],"mappings":";;;;;AAWA,MAAa,kBAAkB;AAC7B,KAAI,QAAQ,IAAI,4BAA4B,WAAW,CAAC,UAAW;CAEnE,MAAM,aAAa,OAAO,YAAY,EAAE,UAAU,MAAM,CAAC;CACzD,MAAM,SAAS,OAAyB,gBAAgB,EACtD,UAAU,MACX,CAAQ;CACT,MAAM,WAAW,OAAO,SAAS;AAEjC,QAAO,oBAAoB,MAAM,EAAE,uBAAuB;EACxD,MAAM,UAAU,kBAAkB;AAElC,MAAI,QAAQ;GACV,MAAM,YAAY,sBAAsB,gBACtC,aAAa;IACX,MAAM,SAAS,OAAO,QAAQ;AAC9B,QAAI,OAAQ,SAAQ,cAAc,IAAI,OAAiB;KACvD,CACH;AACD,eAAY,gBAAgB,UAAU,SAAS,CAAC;;GAElD;AAEF,aAAY,gBAAgB;AAC1B,SAAO,oBAAoB,MAAM,EAAE,uBAAuB;AACxD,qBAAkB;IAClB;GACF"}
@@ -1,2 +1,9 @@
1
- import{getPlugins as e}from"./plugins.mjs";import{getDictionary as t}from"@intlayer/core/interpreter";const n=(n,r)=>t(n,resolvedLocale,e(r));export{n as getDictionary};
1
+ import { getPlugins } from "./plugins.mjs";
2
+ import { getDictionary as getDictionary$1 } from "@intlayer/core/interpreter";
3
+
4
+ //#region src/getDictionary.ts
5
+ const getDictionary = (dictionary, locale) => getDictionary$1(dictionary, locale, getPlugins(locale));
6
+
7
+ //#endregion
8
+ export { getDictionary };
2
9
  //# sourceMappingURL=getDictionary.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"getDictionary.mjs","names":["getDictionaryCore"],"sources":["../../src/getDictionary.ts"],"sourcesContent":["import { getDictionary as getDictionaryCore } from '@intlayer/core/interpreter';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { getPlugins } from './plugins';\n\nexport const getDictionary = <\n T extends Dictionary,\n L extends LocalesValues = DeclaredLocales,\n>(\n dictionary: T,\n locale?: L\n) => getDictionaryCore<T, L>(dictionary, resolvedLocale, getPlugins(locale));\n"],"mappings":"sGAQA,MAAa,GAIX,EACA,IACGA,EAAwB,EAAY,eAAgB,EAAW,EAAO,CAAC"}
1
+ {"version":3,"file":"getDictionary.mjs","names":["getDictionaryCore"],"sources":["../../src/getDictionary.ts"],"sourcesContent":["import { getDictionary as getDictionaryCore } from '@intlayer/core/interpreter';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { getPlugins } from './plugins';\n\nexport const getDictionary = <\n T extends Dictionary,\n L extends LocalesValues = DeclaredLocales,\n>(\n dictionary: T,\n locale?: L\n) => getDictionaryCore<T, L>(dictionary, locale, getPlugins(locale));\n"],"mappings":";;;;AAQA,MAAa,iBAIX,YACA,WACGA,gBAAwB,YAAY,QAAQ,WAAW,OAAO,CAAC"}
@@ -1,2 +1,9 @@
1
- import{getPlugins as e}from"./plugins.mjs";import{getIntlayer as t}from"@intlayer/core/interpreter";const n=(n,r)=>t(n,r,e(r));export{n as getIntlayer};
1
+ import { getPlugins } from "./plugins.mjs";
2
+ import { getIntlayer as getIntlayer$1 } from "@intlayer/core/interpreter";
3
+
4
+ //#region src/getIntlayer.ts
5
+ const getIntlayer = (key, locale) => getIntlayer$1(key, locale, getPlugins(locale));
6
+
7
+ //#endregion
8
+ export { getIntlayer };
2
9
  //# sourceMappingURL=getIntlayer.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"getIntlayer.mjs","names":["getIntlayerCore"],"sources":["../../src/getIntlayer.ts"],"sourcesContent":["import { getIntlayer as getIntlayerCore } from '@intlayer/core/interpreter';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionaryRegistryContent,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { type DeepTransformContent, getPlugins } from './plugins';\n\nexport const getIntlayer = <\n T extends DictionaryKeys,\n L extends LocalesValues = DeclaredLocales,\n>(\n key: T,\n locale?: L\n) =>\n getIntlayerCore<T, L>(\n key,\n locale,\n getPlugins(locale)\n ) as DeepTransformContent<DictionaryRegistryContent<T>>;\n"],"mappings":"oGASA,MAAa,GAIX,EACA,IAEAA,EACE,EACA,EACA,EAAW,EAAO,CACnB"}
1
+ {"version":3,"file":"getIntlayer.mjs","names":["getIntlayerCore"],"sources":["../../src/getIntlayer.ts"],"sourcesContent":["import { getIntlayer as getIntlayerCore } from '@intlayer/core/interpreter';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionaryRegistryContent,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { type DeepTransformContent, getPlugins } from './plugins';\n\nexport const getIntlayer = <\n T extends DictionaryKeys,\n L extends LocalesValues = DeclaredLocales,\n>(\n key: T,\n locale?: L\n) =>\n getIntlayerCore<T, L>(\n key,\n locale,\n getPlugins(locale)\n ) as DeepTransformContent<DictionaryRegistryContent<T>>;\n"],"mappings":";;;;AASA,MAAa,eAIX,KACA,WAEAA,cACE,KACA,QACA,WAAW,OAAO,CACnB"}
@@ -1 +1,14 @@
1
- import{INTLAYER_MARKDOWN_TOKEN as e,IntlayerMarkdownService as t,createIntlayerMarkdownProvider as n,htmlRuntime as r,useMarkdown as i}from"./markdown/installIntlayerMarkdown.mjs";import{getPlugins as a,htmlPlugin as o,insertionPlugin as s,intlayerNodePlugins as c,markdownPlugin as l,markdownStringPlugin as u}from"./plugins.mjs";import{getIntlayer as d}from"./getIntlayer.mjs";import{getDictionary as f}from"./getDictionary.mjs";import{INTLAYER_TOKEN as p,IntlayerProvider as m,createIntlayerClient as h,installIntlayer as g,provideIntlayer as _}from"./client/installIntlayer.mjs";import{useDictionary as v}from"./client/useDictionary.mjs";import{useDictionaryAsync as y}from"./client/useDictionaryAsync.mjs";import{useLoadDynamic as b}from"./client/useLoadDynamic.mjs";import{useDictionaryDynamic as x}from"./client/useDictionaryDynamic.mjs";import{useIntl as S}from"./client/useIntl.mjs";import{isUpdatableNode as C,useIntlayer as w}from"./client/useIntlayer.mjs";import{useLocale as T}from"./client/useLocale.mjs";import"./client/index.mjs";import"./markdown/index.mjs";export{e as INTLAYER_MARKDOWN_TOKEN,p as INTLAYER_TOKEN,t as IntlayerMarkdownService,m as IntlayerProvider,h as createIntlayerClient,n as createIntlayerMarkdownProvider,f as getDictionary,d as getIntlayer,a as getPlugins,o as htmlPlugin,r as htmlRuntime,s as insertionPlugin,g as installIntlayer,c as intlayerNodePlugins,C as isUpdatableNode,l as markdownPlugin,u as markdownStringPlugin,_ as provideIntlayer,v as useDictionary,y as useDictionaryAsync,x as useDictionaryDynamic,S as useIntl,w as useIntlayer,b as useLoadDynamic,T as useLocale,i as useMarkdown};
1
+ import { getPlugins, htmlPlugin, insertionPlugin, intlayerNodePlugins, markdownPlugin, markdownStringPlugin } from "./plugins.mjs";
2
+ import { getIntlayer } from "./getIntlayer.mjs";
3
+ import { getDictionary } from "./getDictionary.mjs";
4
+ import { INTLAYER_TOKEN, IntlayerProvider, createIntlayerClient, installIntlayer, provideIntlayer } from "./client/installIntlayer.mjs";
5
+ import { useDictionary } from "./client/useDictionary.mjs";
6
+ import { useDictionaryAsync } from "./client/useDictionaryAsync.mjs";
7
+ import { useLoadDynamic } from "./client/useLoadDynamic.mjs";
8
+ import { useDictionaryDynamic } from "./client/useDictionaryDynamic.mjs";
9
+ import { useIntl } from "./client/useIntl.mjs";
10
+ import { isUpdatableNode, useIntlayer } from "./client/useIntlayer.mjs";
11
+ import { useLocale } from "./client/useLocale.mjs";
12
+ import { INTLAYER_MARKDOWN_TOKEN, IntlayerMarkdownService, createIntlayerMarkdownProvider, htmlRuntime, useMarkdown } from "./markdown/installIntlayerMarkdown.mjs";
13
+
14
+ export { INTLAYER_MARKDOWN_TOKEN, INTLAYER_TOKEN, IntlayerMarkdownService, IntlayerProvider, createIntlayerClient, createIntlayerMarkdownProvider, getDictionary, getIntlayer, getPlugins, htmlPlugin, htmlRuntime, insertionPlugin, installIntlayer, intlayerNodePlugins, isUpdatableNode, markdownPlugin, markdownStringPlugin, provideIntlayer, useDictionary, useDictionaryAsync, useDictionaryDynamic, useIntl, useIntlayer, useLoadDynamic, useLocale, useMarkdown };
@@ -1 +1,3 @@
1
- import{INTLAYER_MARKDOWN_TOKEN as e,IntlayerMarkdownService as t,createIntlayerMarkdownProvider as n,htmlRuntime as r,useMarkdown as i}from"./installIntlayerMarkdown.mjs";export{e as INTLAYER_MARKDOWN_TOKEN,t as IntlayerMarkdownService,n as createIntlayerMarkdownProvider,r as htmlRuntime,i as useMarkdown};
1
+ import { INTLAYER_MARKDOWN_TOKEN, IntlayerMarkdownService, createIntlayerMarkdownProvider, htmlRuntime, useMarkdown } from "./installIntlayerMarkdown.mjs";
2
+
3
+ export { INTLAYER_MARKDOWN_TOKEN, IntlayerMarkdownService, createIntlayerMarkdownProvider, htmlRuntime, useMarkdown };
@@ -1,2 +1,69 @@
1
- import{t as e}from"../decorate-EVKP5RjP.mjs";import{compile as t}from"@intlayer/core/markdown";import{Injectable as n,InjectionToken as r,inject as i}from"@angular/core";const a=new r(`intlayerMarkdown`),o={createElement:(e,t,...n)=>{if(typeof e!=`string`)return e===o.Fragment?n.join(``):``;let r=t?Object.entries(t).map(([e,t])=>e===`key`||t==null?``:`${e===`className`?`class`:e}="${String(t).replace(/"/g,`&quot;`)}"`).filter(Boolean).join(` `):``,i=n.join(``);return[`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`].includes(e)?`<${e} ${r} />`:`<${e}${r?` ${r}`:``}>${i}</${e}>`},cloneElement:(e,t)=>e,Fragment:Symbol(`Fragment`)},s=e=>t(e,{runtime:o}),c=(e=s)=>({provide:a,useValue:{renderMarkdown:e}});let l=class{markdownProvider=i(a,{optional:!0});renderMarkdown(e,t){return this.markdownProvider?this.markdownProvider.renderMarkdown(e,t):e}};l=e([n({providedIn:`root`})],l);const u=()=>i(a,{optional:!0})||{renderMarkdown:s};export{a as INTLAYER_MARKDOWN_TOKEN,l as IntlayerMarkdownService,c as createIntlayerMarkdownProvider,o as htmlRuntime,u as useMarkdown};
1
+ import { __decorate } from "../_virtual/_@oxc-project_runtime@0.115.0/helpers/decorate.mjs";
2
+ import { Injectable, InjectionToken, inject } from "@angular/core";
3
+ import { compile } from "@intlayer/core/markdown";
4
+
5
+ //#region src/markdown/installIntlayerMarkdown.ts
6
+ const INTLAYER_MARKDOWN_TOKEN = new InjectionToken("intlayerMarkdown");
7
+ const htmlRuntime = {
8
+ createElement: (tag, props, ...children) => {
9
+ if (typeof tag !== "string") {
10
+ if (tag === htmlRuntime.Fragment) return children.join("");
11
+ return "";
12
+ }
13
+ const attrs = props ? Object.entries(props).map(([k, v]) => {
14
+ if (k === "key" || v === void 0 || v === null) return "";
15
+ return `${k === "className" ? "class" : k}="${String(v).replace(/"/g, "&quot;")}"`;
16
+ }).filter(Boolean).join(" ") : "";
17
+ const childrenStr = children.join("");
18
+ if ([
19
+ "area",
20
+ "base",
21
+ "br",
22
+ "col",
23
+ "embed",
24
+ "hr",
25
+ "img",
26
+ "input",
27
+ "link",
28
+ "meta",
29
+ "param",
30
+ "source",
31
+ "track",
32
+ "wbr"
33
+ ].includes(tag)) return `<${tag} ${attrs} />`;
34
+ return `<${tag}${attrs ? ` ${attrs}` : ""}>${childrenStr}</${tag}>`;
35
+ },
36
+ cloneElement: (element, _props) => element,
37
+ Fragment: Symbol("Fragment")
38
+ };
39
+ /**
40
+ * Default markdown renderer that converts markdown to HTML string
41
+ */
42
+ const defaultMarkdownRenderer = (markdown) => compile(markdown, { runtime: htmlRuntime });
43
+ /**
44
+ * Create IntlayerMarkdown provider configuration
45
+ */
46
+ const createIntlayerMarkdownProvider = (renderMarkdown = defaultMarkdownRenderer) => ({
47
+ provide: INTLAYER_MARKDOWN_TOKEN,
48
+ useValue: { renderMarkdown }
49
+ });
50
+ let IntlayerMarkdownService = class IntlayerMarkdownService {
51
+ markdownProvider = inject(INTLAYER_MARKDOWN_TOKEN, { optional: true });
52
+ renderMarkdown(markdown, overrides) {
53
+ if (!this.markdownProvider) return markdown;
54
+ return this.markdownProvider.renderMarkdown(markdown, overrides);
55
+ }
56
+ };
57
+ IntlayerMarkdownService = __decorate([Injectable({ providedIn: "root" })], IntlayerMarkdownService);
58
+ /**
59
+ * Function to inject markdown provider
60
+ */
61
+ const useMarkdown = () => {
62
+ const markdownProvider = inject(INTLAYER_MARKDOWN_TOKEN, { optional: true });
63
+ if (!markdownProvider) return { renderMarkdown: defaultMarkdownRenderer };
64
+ return markdownProvider;
65
+ };
66
+
67
+ //#endregion
68
+ export { INTLAYER_MARKDOWN_TOKEN, IntlayerMarkdownService, createIntlayerMarkdownProvider, htmlRuntime, useMarkdown };
2
69
  //# sourceMappingURL=installIntlayerMarkdown.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"installIntlayerMarkdown.mjs","names":[],"sources":["../../../src/markdown/installIntlayerMarkdown.ts"],"sourcesContent":["import {\n Injectable,\n InjectionToken,\n inject,\n type TemplateRef,\n} from '@angular/core';\nimport type { MarkdownRuntime } from '@intlayer/core/markdown';\nimport { compile } from '@intlayer/core/markdown';\n\nexport const INTLAYER_MARKDOWN_TOKEN =\n new InjectionToken<IntlayerMarkdownProvider>('intlayerMarkdown');\n\ntype RenderMarkdownOptions = {\n components?: any;\n wrapper?: any;\n options?: any;\n};\n\ntype RenderMarkdownFunction = (\n markdown: string,\n overrides?: any | RenderMarkdownOptions\n) => string | TemplateRef<any>;\n\nexport type IntlayerMarkdownProvider = {\n renderMarkdown: RenderMarkdownFunction;\n};\n\n// Minimal runtime to generate HTML strings\nexport const htmlRuntime: MarkdownRuntime = {\n createElement: (tag: string | any, props: any, ...children: any[]) => {\n if (typeof tag !== 'string') {\n // Handle non-string tags if necessary (e.g. components), or fallback to div\n if (tag === htmlRuntime.Fragment) {\n return children.join('');\n }\n return '';\n }\n\n const attrs = props\n ? Object.entries(props)\n .map(([k, v]) => {\n if (k === 'key' || v === undefined || v === null) return '';\n const key = k === 'className' ? 'class' : k;\n return `${key}=\"${String(v).replace(/\"/g, '&quot;')}\"`;\n })\n .filter(Boolean)\n .join(' ')\n : '';\n\n const childrenStr = children.join('');\n const voidTags = [\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'input',\n 'link',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr',\n ];\n\n if (voidTags.includes(tag)) {\n return `<${tag} ${attrs} />`;\n }\n\n return `<${tag}${attrs ? ` ${attrs}` : ''}>${childrenStr}</${tag}>`;\n },\n cloneElement: (element: any, _props: any) => element, // Not really supported for strings\n Fragment: Symbol('Fragment'),\n};\n\n/**\n * Default markdown renderer that converts markdown to HTML string\n */\nconst defaultMarkdownRenderer: RenderMarkdownFunction = (markdown: string) =>\n compile(markdown, { runtime: htmlRuntime }) as string;\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, overrides?: any): string | TemplateRef<any> {\n if (!this.markdownProvider) {\n return markdown; // Fallback to returning markdown as is\n }\n return this.markdownProvider.renderMarkdown(markdown, overrides);\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":"0KASA,MAAa,EACX,IAAI,EAAyC,mBAAmB,CAkBrD,EAA+B,CAC1C,eAAgB,EAAmB,EAAY,GAAG,IAAoB,CACpE,GAAI,OAAO,GAAQ,SAKjB,OAHI,IAAQ,EAAY,SACf,EAAS,KAAK,GAAG,CAEnB,GAGT,IAAM,EAAQ,EACV,OAAO,QAAQ,EAAM,CAClB,KAAK,CAAC,EAAG,KACJ,IAAM,OAAS,GAAyB,KAAa,GAElD,GADK,IAAM,YAAc,QAAU,EAC5B,IAAI,OAAO,EAAE,CAAC,QAAQ,KAAM,SAAS,CAAC,GACpD,CACD,OAAO,QAAQ,CACf,KAAK,IAAI,CACZ,GAEE,EAAc,EAAS,KAAK,GAAG,CAsBrC,MArBiB,CACf,OACA,OACA,KACA,MACA,QACA,KACA,MACA,QACA,OACA,OACA,QACA,SACA,QACA,MACD,CAEY,SAAS,EAAI,CACjB,IAAI,EAAI,GAAG,EAAM,KAGnB,IAAI,IAAM,EAAQ,IAAI,IAAU,GAAG,GAAG,EAAY,IAAI,EAAI,IAEnE,cAAe,EAAc,IAAgB,EAC7C,SAAU,OAAO,WAAW,CAC7B,CAKK,EAAmD,GACvD,EAAQ,EAAU,CAAE,QAAS,EAAa,CAAC,CAKhC,GACX,EAAyC,KACrC,CACJ,QAAS,EACT,SAAU,CACR,iBACD,CACF,EAQM,IAAA,EAAA,KAA8B,CACnC,iBAA2B,EAAO,EAAyB,CACzD,SAAU,GACX,CAAC,CAEF,eAAe,EAAkB,EAA4C,CAI3E,OAHK,KAAK,iBAGH,KAAK,iBAAiB,eAAe,EAAU,EAAU,CAFvD,SAVZ,EAAW,CACV,WAAY,OACb,CAAC,CAAA,CAAA,EAAA,CAiBF,MAAa,MACc,EAAO,EAAyB,CAAE,SAAU,GAAM,CAAC,EAGnE,CACL,eAAgB,EACjB"}
1
+ {"version":3,"file":"installIntlayerMarkdown.mjs","names":[],"sources":["../../../src/markdown/installIntlayerMarkdown.ts"],"sourcesContent":["import {\n Injectable,\n InjectionToken,\n inject,\n type TemplateRef,\n} from '@angular/core';\nimport type { MarkdownRuntime } from '@intlayer/core/markdown';\nimport { compile } from '@intlayer/core/markdown';\n\nexport const INTLAYER_MARKDOWN_TOKEN =\n new InjectionToken<IntlayerMarkdownProvider>('intlayerMarkdown');\n\ntype RenderMarkdownOptions = {\n components?: any;\n wrapper?: any;\n options?: any;\n};\n\ntype RenderMarkdownFunction = (\n markdown: string,\n overrides?: any | RenderMarkdownOptions\n) => string | TemplateRef<any>;\n\nexport type IntlayerMarkdownProvider = {\n renderMarkdown: RenderMarkdownFunction;\n};\n\n// Minimal runtime to generate HTML strings\nexport const htmlRuntime: MarkdownRuntime = {\n createElement: (tag: string | any, props: any, ...children: any[]) => {\n if (typeof tag !== 'string') {\n // Handle non-string tags if necessary (e.g. components), or fallback to div\n if (tag === htmlRuntime.Fragment) {\n return children.join('');\n }\n return '';\n }\n\n const attrs = props\n ? Object.entries(props)\n .map(([k, v]) => {\n if (k === 'key' || v === undefined || v === null) return '';\n const key = k === 'className' ? 'class' : k;\n return `${key}=\"${String(v).replace(/\"/g, '&quot;')}\"`;\n })\n .filter(Boolean)\n .join(' ')\n : '';\n\n const childrenStr = children.join('');\n const voidTags = [\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'input',\n 'link',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr',\n ];\n\n if (voidTags.includes(tag)) {\n return `<${tag} ${attrs} />`;\n }\n\n return `<${tag}${attrs ? ` ${attrs}` : ''}>${childrenStr}</${tag}>`;\n },\n cloneElement: (element: any, _props: any) => element, // Not really supported for strings\n Fragment: Symbol('Fragment'),\n};\n\n/**\n * Default markdown renderer that converts markdown to HTML string\n */\nconst defaultMarkdownRenderer: RenderMarkdownFunction = (markdown: string) =>\n compile(markdown, { runtime: htmlRuntime }) as string;\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, overrides?: any): string | TemplateRef<any> {\n if (!this.markdownProvider) {\n return markdown; // Fallback to returning markdown as is\n }\n return this.markdownProvider.renderMarkdown(markdown, overrides);\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":";;;;;AASA,MAAa,0BACX,IAAI,eAAyC,mBAAmB;AAkBlE,MAAa,cAA+B;CAC1C,gBAAgB,KAAmB,OAAY,GAAG,aAAoB;AACpE,MAAI,OAAO,QAAQ,UAAU;AAE3B,OAAI,QAAQ,YAAY,SACtB,QAAO,SAAS,KAAK,GAAG;AAE1B,UAAO;;EAGT,MAAM,QAAQ,QACV,OAAO,QAAQ,MAAM,CAClB,KAAK,CAAC,GAAG,OAAO;AACf,OAAI,MAAM,SAAS,MAAM,UAAa,MAAM,KAAM,QAAO;AAEzD,UAAO,GADK,MAAM,cAAc,UAAU,EAC5B,IAAI,OAAO,EAAE,CAAC,QAAQ,MAAM,SAAS,CAAC;IACpD,CACD,OAAO,QAAQ,CACf,KAAK,IAAI,GACZ;EAEJ,MAAM,cAAc,SAAS,KAAK,GAAG;AAkBrC,MAjBiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CAEY,SAAS,IAAI,CACxB,QAAO,IAAI,IAAI,GAAG,MAAM;AAG1B,SAAO,IAAI,MAAM,QAAQ,IAAI,UAAU,GAAG,GAAG,YAAY,IAAI,IAAI;;CAEnE,eAAe,SAAc,WAAgB;CAC7C,UAAU,OAAO,WAAW;CAC7B;;;;AAKD,MAAM,2BAAmD,aACvD,QAAQ,UAAU,EAAE,SAAS,aAAa,CAAC;;;;AAK7C,MAAa,kCACX,iBAAyC,6BACrC;CACJ,SAAS;CACT,UAAU,EACR,gBACD;CACF;AAQM,oCAAM,wBAAwB;CACnC,AAAQ,mBAAmB,OAAO,yBAAyB,EACzD,UAAU,MACX,CAAC;CAEF,eAAe,UAAkB,WAA4C;AAC3E,MAAI,CAAC,KAAK,iBACR,QAAO;AAET,SAAO,KAAK,iBAAiB,eAAe,UAAU,UAAU;;;sCAZnE,WAAW,EACV,YAAY,QACb,CAAC;;;;AAiBF,MAAa,oBAA8C;CACzD,MAAM,mBAAmB,OAAO,yBAAyB,EAAE,UAAU,MAAM,CAAC;AAE5E,KAAI,CAAC,iBACH,QAAO,EACL,gBAAgB,yBACjB;AAGH,QAAO"}
@@ -1,2 +1,224 @@
1
- import{renderIntlayerNode as e}from"./renderIntlayerNode.mjs";import{t}from"./ContentSelector.component-B9Uvy9gY.mjs";import{htmlRuntime as n,useMarkdown as r}from"./markdown/installIntlayerMarkdown.mjs";import{conditionPlugin as i,enumerationPlugin as a,filePlugin as o,genderPlugin as s,nestedPlugin as c,translationPlugin as l}from"@intlayer/core/interpreter";import u from"@intlayer/config/built";import{compile as d,getMarkdownMetadata as f}from"@intlayer/core/markdown";import{NodeType as p}from"@intlayer/types/nodeType";const m=(e,t)=>({...e,createElement:(n,r,...i)=>{let a=t?.[n];if(a){let t={...r,...a},o=r?.class||r?.className,s=a.class||a.className;return o&&s&&(t.class=`${o} ${s}`,t.className=void 0),e.createElement(n,t,...i)}return e.createElement(n,r,...i)}}),h={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(n,{children:r,...i})=>e({...i,value:r,children:()=>({component:u?.editor.enabled?t:r,props:{dictionaryKey:i.dictionaryKey,keyPath:i.keyPath},children:r})})},g={id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(i,a,o)=>{let{plugins:s,...c}=a,l=o(f(i),{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(t,n)=>e({...n,value:t,children:i})}],dictionaryKey:c.dictionaryKey,keyPath:[]}),p=n=>e({...c,value:i,children:u?.editor.enabled?()=>({component:t,props:{dictionaryKey:c.dictionaryKey,keyPath:c.keyPath,...n},children:()=>{let{renderMarkdown:e}=r();return e(i,n)}}):()=>{let{renderMarkdown:e}=r();return e(i,n)},additionalProps:{metadata:l}}),h=(e,t)=>new Proxy(e,{get(e,r,a){return r===`value`?i:r===`metadata`?l:r===`toString`||r===Symbol.toPrimitive?()=>d(i,{runtime:t?m(n,t):n}):r===`use`?e=>{let n={...t,...e};return h(p(n),n)}:Reflect.get(e,r,a)}});return h(p())}},_={id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===p.Markdown,transform:(e,t,n)=>{let r=[...t.keyPath,{type:p.Markdown}],i=e[p.Markdown];return n(i,{...t,children:i,keyPath:r,plugins:[g,...t.plugins??[]]})}},v={id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===p.HTML,transform:(r,i)=>{let a=r[p.HTML],{plugins:o,...s}=i,c=n=>e({...s,value:a,children:u?.editor.enabled?()=>({component:t,props:{dictionaryKey:s.dictionaryKey,keyPath:s.keyPath,...n},children:a}):a}),l=(e,t)=>new Proxy(e,{get(e,r,i){return r===`value`?a:r===`toString`||r===Symbol.toPrimitive?()=>!t||typeof t==`object`&&Object.keys(t).length===0?String(a):d(a,{runtime:m(n,t)}):r===`use`?e=>{let n={...t,...e};return l(c(n),n)}:Reflect.get(e,r,i)}});return l(c())}},y={id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===p.Insertion,transform:(t,n)=>{let{plugins:r,...i}=n,a=(e={})=>{let n=t.insertion;return e&&Object.entries(e).forEach(([e,t])=>{n=n.replace(RegExp(`{{\\s*${e}\\s*}}`,`g`),String(t))}),n};return e({...i,value:a,children:a})}},b=(e,t=!0)=>[l(e??u.internationalization.defaultLocale,t?u.internationalization.defaultLocale:void 0),a,i,c(e??u.internationalization.defaultLocale),o,s,h,_,v,y];export{b as getPlugins,v as htmlPlugin,y as insertionPlugin,h as intlayerNodePlugins,_ as markdownPlugin,g as markdownStringPlugin};
1
+ import { renderIntlayerNode } from "./renderIntlayerNode.mjs";
2
+ import { ContentSelectorWrapperComponent } from "./editor/ContentSelector.component.mjs";
3
+ import { conditionPlugin, enumerationPlugin, filePlugin, genderPlugin, nestedPlugin, translationPlugin } from "@intlayer/core/interpreter";
4
+ import configuration from "@intlayer/config/built";
5
+ import * as NodeTypes from "@intlayer/types/nodeType";
6
+
7
+ //#region src/plugins.ts
8
+ let _getMarkdownMetadata = null;
9
+ let _compile = null;
10
+ import("@intlayer/core/markdown").then((m) => {
11
+ _getMarkdownMetadata = m.getMarkdownMetadata;
12
+ _compile = m.compile;
13
+ });
14
+ let _markdownInstall = null;
15
+ import("./markdown/installIntlayerMarkdown.mjs").then((m) => {
16
+ _markdownInstall = m;
17
+ });
18
+ /** ---------------------------------------------
19
+ * UTILS
20
+ * --------------------------------------------- */
21
+ const createRuntimeWithOverides = (baseRuntime, overrides) => ({
22
+ ...baseRuntime,
23
+ createElement: (tag, props, ...children) => {
24
+ const override = overrides?.[tag];
25
+ if (override) {
26
+ const newProps = {
27
+ ...props,
28
+ ...override
29
+ };
30
+ const originalClass = props?.class || props?.className;
31
+ const overrideClass = override.class || override.className;
32
+ if (originalClass && overrideClass) {
33
+ newProps.class = `${originalClass} ${overrideClass}`;
34
+ newProps.className = void 0;
35
+ }
36
+ return baseRuntime.createElement(tag, newProps, ...children);
37
+ }
38
+ return baseRuntime.createElement(tag, props, ...children);
39
+ }
40
+ });
41
+ /** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
42
+ const intlayerNodePlugins = {
43
+ id: "intlayer-node-plugin",
44
+ canHandle: (node) => typeof node === "bigint" || typeof node === "string" || typeof node === "number",
45
+ transform: (_node, { children, ...rest }) => renderIntlayerNode({
46
+ ...rest,
47
+ value: children,
48
+ children: () => ({
49
+ component: configuration?.editor.enabled ? ContentSelectorWrapperComponent : children,
50
+ props: {
51
+ dictionaryKey: rest.dictionaryKey,
52
+ keyPath: rest.keyPath
53
+ },
54
+ children
55
+ })
56
+ })
57
+ };
58
+ /** Markdown string plugin. Replaces string node with a component that render the markdown. */
59
+ const markdownStringPlugin = {
60
+ id: "markdown-string-plugin",
61
+ canHandle: (node) => typeof node === "string",
62
+ transform: (node, props, deepTransformNode) => {
63
+ const { plugins, ...rest } = props;
64
+ const metadataNodes = deepTransformNode(_getMarkdownMetadata?.(node) ?? {}, {
65
+ plugins: [{
66
+ id: "markdown-metadata-plugin",
67
+ canHandle: (metadataNode) => typeof metadataNode === "string" || typeof metadataNode === "number" || typeof metadataNode === "boolean" || !metadataNode,
68
+ transform: (metadataNode, props) => renderIntlayerNode({
69
+ ...props,
70
+ value: metadataNode,
71
+ children: node
72
+ })
73
+ }],
74
+ dictionaryKey: rest.dictionaryKey,
75
+ keyPath: []
76
+ });
77
+ const render = (components) => renderIntlayerNode({
78
+ ...rest,
79
+ value: node,
80
+ children: configuration?.editor.enabled ? () => ({
81
+ component: ContentSelectorWrapperComponent,
82
+ props: {
83
+ dictionaryKey: rest.dictionaryKey,
84
+ keyPath: rest.keyPath,
85
+ ...components
86
+ },
87
+ children: () => {
88
+ const { renderMarkdown } = _markdownInstall?.useMarkdown() ?? { renderMarkdown: () => node };
89
+ return renderMarkdown(node, components);
90
+ }
91
+ }) : () => {
92
+ const { renderMarkdown } = _markdownInstall?.useMarkdown() ?? { renderMarkdown: () => node };
93
+ return renderMarkdown(node, components);
94
+ },
95
+ additionalProps: { metadata: metadataNodes }
96
+ });
97
+ const createProxy = (element, components) => new Proxy(element, { get(target, prop, receiver) {
98
+ if (prop === "value") return node;
99
+ if (prop === "metadata") return metadataNodes;
100
+ if (prop === "toString") return () => {
101
+ const htmlRuntime = _markdownInstall?.htmlRuntime;
102
+ if (!htmlRuntime || !_compile) return node;
103
+ const runtime = components ? createRuntimeWithOverides(htmlRuntime, components) : htmlRuntime;
104
+ return _compile(node, { runtime });
105
+ };
106
+ if (prop === Symbol.toPrimitive) return () => {
107
+ const htmlRuntime = _markdownInstall?.htmlRuntime;
108
+ if (!htmlRuntime || !_compile) return node;
109
+ const runtime = components ? createRuntimeWithOverides(htmlRuntime, components) : htmlRuntime;
110
+ return _compile(node, { runtime });
111
+ };
112
+ if (prop === "use") return (newComponents) => {
113
+ const mergedComponents = {
114
+ ...components,
115
+ ...newComponents
116
+ };
117
+ return createProxy(render(mergedComponents), mergedComponents);
118
+ };
119
+ return Reflect.get(target, prop, receiver);
120
+ } });
121
+ return createProxy(render());
122
+ }
123
+ };
124
+ const markdownPlugin = {
125
+ id: "markdown-plugin",
126
+ canHandle: (node) => typeof node === "object" && node?.nodeType === NodeTypes.MARKDOWN,
127
+ transform: (node, props, deepTransformNode) => {
128
+ const newKeyPath = [...props.keyPath, { type: NodeTypes.MARKDOWN }];
129
+ const children = node[NodeTypes.MARKDOWN];
130
+ return deepTransformNode(children, {
131
+ ...props,
132
+ children,
133
+ keyPath: newKeyPath,
134
+ plugins: [markdownStringPlugin, ...props.plugins ?? []]
135
+ });
136
+ }
137
+ };
138
+ /** HTML plugin. Replaces node with a function that takes components => IntlayerNode. */
139
+ const htmlPlugin = {
140
+ id: "html-plugin",
141
+ canHandle: (node) => typeof node === "object" && node?.nodeType === NodeTypes.HTML,
142
+ transform: (node, props) => {
143
+ const html = node[NodeTypes.HTML];
144
+ const { plugins, ...rest } = props;
145
+ const render = (userComponents) => renderIntlayerNode({
146
+ ...rest,
147
+ value: html,
148
+ children: configuration?.editor.enabled ? () => ({
149
+ component: ContentSelectorWrapperComponent,
150
+ props: {
151
+ dictionaryKey: rest.dictionaryKey,
152
+ keyPath: rest.keyPath,
153
+ ...userComponents
154
+ },
155
+ children: html
156
+ }) : html
157
+ });
158
+ const createProxy = (element, components) => new Proxy(element, { get(target, prop, receiver) {
159
+ if (prop === "value") return html;
160
+ if (prop === "toString") return () => {
161
+ if (!components || typeof components === "object" && Object.keys(components).length === 0) return String(html);
162
+ const htmlRuntime = _markdownInstall?.htmlRuntime;
163
+ if (!htmlRuntime || !_compile) return String(html);
164
+ const runtime = createRuntimeWithOverides(htmlRuntime, components);
165
+ return _compile(html, { runtime });
166
+ };
167
+ if (prop === Symbol.toPrimitive) return () => {
168
+ if (!components || typeof components === "object" && Object.keys(components).length === 0) return String(html);
169
+ const htmlRuntime = _markdownInstall?.htmlRuntime;
170
+ if (!htmlRuntime || !_compile) return String(html);
171
+ const runtime = createRuntimeWithOverides(htmlRuntime, components);
172
+ return _compile(html, { runtime });
173
+ };
174
+ if (prop === "use") return (userComponents) => {
175
+ const mergedComponents = {
176
+ ...components,
177
+ ...userComponents
178
+ };
179
+ return createProxy(render(mergedComponents), mergedComponents);
180
+ };
181
+ return Reflect.get(target, prop, receiver);
182
+ } });
183
+ return createProxy(render());
184
+ }
185
+ };
186
+ const insertionPlugin = {
187
+ id: "insertion-plugin",
188
+ canHandle: (node) => typeof node === "object" && node?.nodeType === NodeTypes.INSERTION,
189
+ transform: (node, props) => {
190
+ const { plugins, ...rest } = props;
191
+ const render = (args = {}) => {
192
+ let text = node[NodeTypes.INSERTION];
193
+ if (args) Object.entries(args).forEach(([key, value]) => {
194
+ text = text.replace(new RegExp(`{{\\s*${key}\\s*}}`, "g"), String(value));
195
+ });
196
+ return text;
197
+ };
198
+ return renderIntlayerNode({
199
+ ...rest,
200
+ value: render,
201
+ children: render
202
+ });
203
+ }
204
+ };
205
+ /**
206
+ * Get the plugins array for Angular content transformation.
207
+ * This function is used by both getIntlayer and getDictionary to ensure consistent plugin configuration.
208
+ */
209
+ const getPlugins = (locale, fallback = true) => [
210
+ translationPlugin(locale ?? configuration.internationalization.defaultLocale, fallback ? configuration.internationalization.defaultLocale : void 0),
211
+ enumerationPlugin,
212
+ conditionPlugin,
213
+ nestedPlugin(locale ?? configuration.internationalization.defaultLocale),
214
+ filePlugin,
215
+ genderPlugin,
216
+ intlayerNodePlugins,
217
+ markdownPlugin,
218
+ htmlPlugin,
219
+ insertionPlugin
220
+ ];
221
+
222
+ //#endregion
223
+ export { getPlugins, htmlPlugin, insertionPlugin, intlayerNodePlugins, markdownPlugin, markdownStringPlugin };
2
224
  //# sourceMappingURL=plugins.mjs.map