angular-intlayer 8.3.3 → 8.4.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 (141) hide show
  1. package/dist/cjs/client/useDictionary.cjs +1 -1
  2. package/dist/cjs/client/useIntlayer.cjs +1 -1
  3. package/dist/cjs/client/useLocaleStorage.cjs +1 -1
  4. package/dist/cjs/editor/ContentSelector.component.cjs +9 -0
  5. package/dist/cjs/editor/ContentSelector.component.cjs.map +1 -0
  6. package/dist/cjs/editor/useEditor.cjs +1 -1
  7. package/dist/cjs/editor/useEditor.cjs.map +1 -1
  8. package/dist/cjs/index.cjs +1 -1
  9. package/dist/cjs/plugins.cjs +1 -1
  10. package/dist/cjs/plugins.cjs.map +1 -1
  11. package/dist/esm/client/useDictionary.mjs +1 -1
  12. package/dist/esm/client/useIntlayer.mjs +1 -1
  13. package/dist/esm/client/useLocaleStorage.mjs +1 -1
  14. package/dist/esm/editor/ContentSelector.component.mjs +9 -0
  15. package/dist/esm/editor/ContentSelector.component.mjs.map +1 -0
  16. package/dist/esm/editor/useEditor.mjs +1 -1
  17. package/dist/esm/editor/useEditor.mjs.map +1 -1
  18. package/dist/esm/index.mjs +1 -1
  19. package/dist/esm/plugins.mjs +1 -1
  20. package/dist/esm/plugins.mjs.map +1 -1
  21. package/dist/types/client/useDictionaryDynamic.d.ts +2 -2
  22. package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -1
  23. package/dist/types/client/useLocale.d.ts +3 -3
  24. package/dist/types/client/useLocaleStorage.d.ts +5 -5
  25. package/dist/types/client/useLocaleStorage.d.ts.map +1 -1
  26. package/dist/types/editor/ContentSelector.component.d.ts +9 -0
  27. package/dist/types/editor/ContentSelector.component.d.ts.map +1 -0
  28. package/dist/types/editor/useEditor.d.ts.map +1 -1
  29. package/package.json +9 -9
  30. package/dist/cjs/UI/ContentSelector.component.cjs +0 -20
  31. package/dist/cjs/UI/ContentSelector.component.cjs.map +0 -1
  32. package/dist/cjs/editor/ContentSelectorWrapper.component.cjs +0 -11
  33. package/dist/cjs/editor/ContentSelectorWrapper.component.cjs.map +0 -1
  34. package/dist/cjs/editor/EditedContentRenderer.component.cjs +0 -2
  35. package/dist/cjs/editor/EditedContentRenderer.component.cjs.map +0 -1
  36. package/dist/cjs/editor/EditorSelectorRenderer.component.cjs +0 -14
  37. package/dist/cjs/editor/EditorSelectorRenderer.component.cjs.map +0 -1
  38. package/dist/cjs/editor/communicator.cjs +0 -2
  39. package/dist/cjs/editor/communicator.cjs.map +0 -1
  40. package/dist/cjs/editor/configuration.cjs +0 -2
  41. package/dist/cjs/editor/configuration.cjs.map +0 -1
  42. package/dist/cjs/editor/createSharedComposable.cjs +0 -2
  43. package/dist/cjs/editor/createSharedComposable.cjs.map +0 -1
  44. package/dist/cjs/editor/dictionariesRecord.cjs +0 -2
  45. package/dist/cjs/editor/dictionariesRecord.cjs.map +0 -1
  46. package/dist/cjs/editor/editedContent.cjs +0 -2
  47. package/dist/cjs/editor/editedContent.cjs.map +0 -1
  48. package/dist/cjs/editor/editorEnabled.cjs +0 -2
  49. package/dist/cjs/editor/editorEnabled.cjs.map +0 -1
  50. package/dist/cjs/editor/editorLocale.cjs +0 -2
  51. package/dist/cjs/editor/editorLocale.cjs.map +0 -1
  52. package/dist/cjs/editor/focusDictionary.cjs +0 -2
  53. package/dist/cjs/editor/focusDictionary.cjs.map +0 -1
  54. package/dist/cjs/editor/index.cjs +0 -1
  55. package/dist/cjs/editor/installIntlayerEditor.cjs +0 -2
  56. package/dist/cjs/editor/installIntlayerEditor.cjs.map +0 -1
  57. package/dist/cjs/editor/useCrossFrameMessageListener.cjs +0 -2
  58. package/dist/cjs/editor/useCrossFrameMessageListener.cjs.map +0 -1
  59. package/dist/cjs/editor/useCrossFrameState.cjs +0 -2
  60. package/dist/cjs/editor/useCrossFrameState.cjs.map +0 -1
  61. package/dist/cjs/editor/useCrossURLPathState.cjs +0 -2
  62. package/dist/cjs/editor/useCrossURLPathState.cjs.map +0 -1
  63. package/dist/cjs/editor/useEditedContentRenderer.cjs +0 -2
  64. package/dist/cjs/editor/useEditedContentRenderer.cjs.map +0 -1
  65. package/dist/cjs/editor/useIframeClickInterceptor.cjs +0 -2
  66. package/dist/cjs/editor/useIframeClickInterceptor.cjs.map +0 -1
  67. package/dist/esm/UI/ContentSelector.component.mjs +0 -20
  68. package/dist/esm/UI/ContentSelector.component.mjs.map +0 -1
  69. package/dist/esm/editor/ContentSelectorWrapper.component.mjs +0 -11
  70. package/dist/esm/editor/ContentSelectorWrapper.component.mjs.map +0 -1
  71. package/dist/esm/editor/EditedContentRenderer.component.mjs +0 -2
  72. package/dist/esm/editor/EditedContentRenderer.component.mjs.map +0 -1
  73. package/dist/esm/editor/EditorSelectorRenderer.component.mjs +0 -14
  74. package/dist/esm/editor/EditorSelectorRenderer.component.mjs.map +0 -1
  75. package/dist/esm/editor/communicator.mjs +0 -2
  76. package/dist/esm/editor/communicator.mjs.map +0 -1
  77. package/dist/esm/editor/configuration.mjs +0 -2
  78. package/dist/esm/editor/configuration.mjs.map +0 -1
  79. package/dist/esm/editor/createSharedComposable.mjs +0 -2
  80. package/dist/esm/editor/createSharedComposable.mjs.map +0 -1
  81. package/dist/esm/editor/dictionariesRecord.mjs +0 -2
  82. package/dist/esm/editor/dictionariesRecord.mjs.map +0 -1
  83. package/dist/esm/editor/editedContent.mjs +0 -2
  84. package/dist/esm/editor/editedContent.mjs.map +0 -1
  85. package/dist/esm/editor/editorEnabled.mjs +0 -2
  86. package/dist/esm/editor/editorEnabled.mjs.map +0 -1
  87. package/dist/esm/editor/editorLocale.mjs +0 -2
  88. package/dist/esm/editor/editorLocale.mjs.map +0 -1
  89. package/dist/esm/editor/focusDictionary.mjs +0 -2
  90. package/dist/esm/editor/focusDictionary.mjs.map +0 -1
  91. package/dist/esm/editor/index.mjs +0 -1
  92. package/dist/esm/editor/installIntlayerEditor.mjs +0 -2
  93. package/dist/esm/editor/installIntlayerEditor.mjs.map +0 -1
  94. package/dist/esm/editor/useCrossFrameMessageListener.mjs +0 -2
  95. package/dist/esm/editor/useCrossFrameMessageListener.mjs.map +0 -1
  96. package/dist/esm/editor/useCrossFrameState.mjs +0 -2
  97. package/dist/esm/editor/useCrossFrameState.mjs.map +0 -1
  98. package/dist/esm/editor/useCrossURLPathState.mjs +0 -2
  99. package/dist/esm/editor/useCrossURLPathState.mjs.map +0 -1
  100. package/dist/esm/editor/useEditedContentRenderer.mjs +0 -2
  101. package/dist/esm/editor/useEditedContentRenderer.mjs.map +0 -1
  102. package/dist/esm/editor/useIframeClickInterceptor.mjs +0 -2
  103. package/dist/esm/editor/useIframeClickInterceptor.mjs.map +0 -1
  104. package/dist/types/UI/ContentSelector.component.d.ts +0 -34
  105. package/dist/types/UI/ContentSelector.component.d.ts.map +0 -1
  106. package/dist/types/editor/ContentSelectorWrapper.component.d.ts +0 -24
  107. package/dist/types/editor/ContentSelectorWrapper.component.d.ts.map +0 -1
  108. package/dist/types/editor/EditedContentRenderer.component.d.ts +0 -24
  109. package/dist/types/editor/EditedContentRenderer.component.d.ts.map +0 -1
  110. package/dist/types/editor/EditorSelectorRenderer.component.d.ts +0 -17
  111. package/dist/types/editor/EditorSelectorRenderer.component.d.ts.map +0 -1
  112. package/dist/types/editor/communicator.d.ts +0 -32
  113. package/dist/types/editor/communicator.d.ts.map +0 -1
  114. package/dist/types/editor/configuration.d.ts +0 -5
  115. package/dist/types/editor/configuration.d.ts.map +0 -1
  116. package/dist/types/editor/createSharedComposable.d.ts +0 -16
  117. package/dist/types/editor/createSharedComposable.d.ts.map +0 -1
  118. package/dist/types/editor/dictionariesRecord.d.ts +0 -19
  119. package/dist/types/editor/dictionariesRecord.d.ts.map +0 -1
  120. package/dist/types/editor/editedContent.d.ts +0 -23
  121. package/dist/types/editor/editedContent.d.ts.map +0 -1
  122. package/dist/types/editor/editorEnabled.d.ts +0 -20
  123. package/dist/types/editor/editorEnabled.d.ts.map +0 -1
  124. package/dist/types/editor/editorLocale.d.ts +0 -6
  125. package/dist/types/editor/editorLocale.d.ts.map +0 -1
  126. package/dist/types/editor/focusDictionary.d.ts +0 -27
  127. package/dist/types/editor/focusDictionary.d.ts.map +0 -1
  128. package/dist/types/editor/index.d.ts +0 -5
  129. package/dist/types/editor/installIntlayerEditor.d.ts +0 -22
  130. package/dist/types/editor/installIntlayerEditor.d.ts.map +0 -1
  131. package/dist/types/editor/useCrossFrameMessageListener.d.ts +0 -15
  132. package/dist/types/editor/useCrossFrameMessageListener.d.ts.map +0 -1
  133. package/dist/types/editor/useCrossFrameState.d.ts +0 -26
  134. package/dist/types/editor/useCrossFrameState.d.ts.map +0 -1
  135. package/dist/types/editor/useCrossURLPathState.d.ts +0 -21
  136. package/dist/types/editor/useCrossURLPathState.d.ts.map +0 -1
  137. package/dist/types/editor/useEditedContentRenderer.d.ts +0 -21
  138. package/dist/types/editor/useEditedContentRenderer.d.ts.map +0 -1
  139. package/dist/types/editor/useIframeClickInterceptor.d.ts +0 -14
  140. package/dist/types/editor/useIframeClickInterceptor.d.ts.map +0 -1
  141. package/dist/types/intlayer/dist/types/index.d.ts +0 -3
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./installIntlayer.cjs`),t=require(`../getDictionary.cjs`);let n=require(`@angular/core`);const r=(r,i)=>{let a=(0,n.inject)(e.INTLAYER_TOKEN),o=(0,n.computed)(()=>i??a?.locale());return(0,n.computed)(()=>t.getDictionary(r,o()))};exports.useDictionary=r;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../getDictionary.cjs`),t=require(`./installIntlayer.cjs`);let n=require(`@angular/core`);const r=(r,i)=>{let a=(0,n.inject)(t.INTLAYER_TOKEN),o=(0,n.computed)(()=>i??a?.locale());return(0,n.computed)(()=>e.getDictionary(r,o()))};exports.useDictionary=r;
2
2
  //# sourceMappingURL=useDictionary.cjs.map
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./installIntlayer.cjs`),t=require(`../getIntlayer.cjs`);let n=require(`@angular/core`);const r=e=>!!e&&typeof e==`object`&&typeof e.__update==`function`,i=(r,i)=>{let a=(0,n.inject)(e.INTLAYER_TOKEN),o=(0,n.computed)(()=>i??a.locale());return(0,n.computed)(()=>t.getIntlayer(r,o()))};exports.isUpdatableNode=r,exports.useIntlayer=i;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../getIntlayer.cjs`),t=require(`./installIntlayer.cjs`);let n=require(`@angular/core`);const r=e=>!!e&&typeof e==`object`&&typeof e.__update==`function`,i=(r,i)=>{let a=(0,n.inject)(t.INTLAYER_TOKEN),o=(0,n.computed)(()=>i??a.locale());return(0,n.computed)(()=>e.getIntlayer(r,o()))};exports.isUpdatableNode=r,exports.useIntlayer=i;
2
2
  //# sourceMappingURL=useIntlayer.cjs.map
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`@intlayer/core/utils`),t=require(`@intlayer/core/localization`);const n=(0,e.getLocaleFromStorage)(t.localeStorageOptions),r=n,i=(n,r)=>(0,e.setLocaleInStorage)(n,{...t.localeStorageOptions,isCookieEnabled:r}),a=i,o=n=>(0,e.LocaleStorage)({...t.localeStorageOptions,isCookieEnabled:n}),s=e=>{let t=o(e);return{localeCookie:t.getLocale(),setLocaleCookie:t.setLocale}};exports.localeCookie=r,exports.localeInStorage=n,exports.setLocaleCookie=a,exports.setLocaleInStorage=i,exports.useLocaleCookie=s,exports.useLocaleStorage=o;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`@intlayer/core/localization`),t=require(`@intlayer/core/utils`);const n=(0,t.getLocaleFromStorage)(e.localeStorageOptions),r=n,i=(n,r)=>(0,t.setLocaleInStorage)(n,{...e.localeStorageOptions,isCookieEnabled:r}),a=i,o=n=>(0,t.LocaleStorage)({...e.localeStorageOptions,isCookieEnabled:n}),s=e=>{let t=o(e);return{localeCookie:t.getLocale(),setLocaleCookie:t.setLocale}};exports.localeCookie=r,exports.localeInStorage=n,exports.setLocaleCookie=a,exports.setLocaleInStorage=i,exports.useLocaleCookie=s,exports.useLocaleStorage=o;
2
2
  //# sourceMappingURL=useLocaleStorage.cjs.map
@@ -0,0 +1,9 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../_virtual/_@oxc-project_runtime@0.115.0/helpers/decorateMetadata.cjs`),t=require(`../_virtual/_@oxc-project_runtime@0.115.0/helpers/decorate.cjs`);let n=require(`@angular/core`),r=class{dictionaryKey;keyPath;get keyPathJson(){return JSON.stringify(this.keyPath)}};t.__decorate([(0,n.Input)(),e.__decorateMetadata(`design:type`,String)],r.prototype,`dictionaryKey`,void 0),t.__decorate([(0,n.Input)(),e.__decorateMetadata(`design:type`,Array)],r.prototype,`keyPath`,void 0),r=t.__decorate([(0,n.Component)({selector:`app-content-selector-wrapper`,standalone:!0,schemas:[n.CUSTOM_ELEMENTS_SCHEMA],template:`
2
+ <intlayer-content-selector-wrapper
3
+ [attr.key-path]="keyPathJson"
4
+ [attr.dictionary-key]="dictionaryKey"
5
+ >
6
+ <ng-content></ng-content>
7
+ </intlayer-content-selector-wrapper>
8
+ `})],r),Object.defineProperty(exports,`ContentSelectorWrapperComponent`,{enumerable:!0,get:function(){return r}});
9
+ //# sourceMappingURL=ContentSelector.component.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentSelector.component.cjs","names":["CUSTOM_ELEMENTS_SCHEMA"],"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":"qTAeO,EAAA,KAAsC,CAC3C,cACA,QAEA,IAAI,aAAc,CAChB,OAAO,KAAK,UAAU,KAAK,QAAQ,8BAJ7B,CAAA,EAAA,mBAAA,cAAA,OAAA,CAAA,CAAA,EAAA,UAAA,gBAAA,IAAA,GAAA,4BACA,CAAA,EAAA,mBAAA,cAAA,MAAA,CAAA,CAAA,EAAA,UAAA,UAAA,IAAA,GAAA,iCAfC,CACT,SAAU,+BACV,WAAY,GACZ,QAAS,CAACA,EAAAA,uBAAuB,CACjC,SAAU;;;;;;;IAQX,CAAC,CAAA,CAAA,EAAA"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./createSharedComposable.cjs`),t=require(`./editorEnabled.cjs`),n=require(`./focusDictionary.cjs`),r=require(`./configuration.cjs`),i=require(`./dictionariesRecord.cjs`),a=require(`./editorLocale.cjs`),o=require(`./useCrossURLPathState.cjs`),s=require(`./useIframeClickInterceptor.cjs`),c=e.createSharedComposable(()=>{r.useConfiguration(),t.useEditorEnabled(),n.useFocusDictionary(),s.useIframeClickMerger(),o.useCrossURLPathSetter(),a.useEditorLocale(),i.useDictionariesRecord(),a.useEditorLocale()});exports.useEditor=c;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../client/installIntlayer.cjs`);let t=require(`@angular/core`),n=require(`@intlayer/editor/isEnabled`);const r=()=>{if(!n.isEnabled)return;let r=(0,t.inject)(t.DestroyRef,{optional:!0}),i=(0,t.inject)(e.INTLAYER_TOKEN,{optional:!0}),a=(0,t.inject)(t.Injector);import(`@intlayer/editor`).then(({initEditorClient:e})=>{let n=e();if(i){let e=(0,t.runInInjectionContext)(a,()=>(0,t.effect)(()=>{let e=i.locale();e&&n.currentLocale.set(e)}));r?.onDestroy(()=>e.destroy())}}),r?.onDestroy(()=>{import(`@intlayer/editor`).then(({stopEditorClient:e})=>{e()})})};exports.useEditor=r;
2
2
  //# sourceMappingURL=useEditor.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEditor.cjs","names":["createSharedComposable"],"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":"mXASa,EAAYA,EAAAA,2BAA6B,CACpD,EAAA,kBAAkB,CAClB,EAAA,kBAAkB,CAClB,EAAA,oBAAoB,CACpB,EAAA,sBAAsB,CACtB,EAAA,uBAAuB,CACvB,EAAA,iBAAiB,CACjB,EAAA,uBAAuB,CACvB,EAAA,iBAAiB,EACjB"}
1
+ {"version":3,"file":"useEditor.cjs","names":["isEnabled","DestroyRef","INTLAYER_TOKEN","Injector"],"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 (!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":"wOAWA,MAAa,MAAkB,CAC7B,GAAI,CAACA,EAAAA,UAAW,OAEhB,IAAM,GAAA,EAAA,EAAA,QAAoBC,EAAAA,WAAY,CAAE,SAAU,GAAM,CAAC,CACnD,GAAA,EAAA,EAAA,QAAkCC,EAAAA,eAAgB,CACtD,SAAU,GACX,CAAQ,CACH,GAAA,EAAA,EAAA,QAAkBC,EAAAA,SAAS,CAEjC,OAAO,oBAAoB,MAAM,CAAE,sBAAuB,CACxD,IAAM,EAAU,GAAkB,CAElC,GAAI,EAAQ,CACV,IAAM,GAAA,EAAA,EAAA,uBAAkC,OAAA,EAAA,EAAA,YACzB,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 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./client/installIntlayer.cjs`),t=require(`./getDictionary.cjs`),n=require(`./client/useDictionary.cjs`),r=require(`./client/useDictionaryAsync.cjs`),i=require(`./client/useLoadDynamic.cjs`),a=require(`./client/useDictionaryDynamic.cjs`),o=require(`./client/useIntl.cjs`),s=require(`./client/useIntlayer.cjs`),c=require(`./client/useLocale.cjs`),l=require(`./markdown/installIntlayerMarkdown.cjs`),u=require(`./plugins.cjs`),d=require(`./getIntlayer.cjs`);exports.INTLAYER_MARKDOWN_TOKEN=l.INTLAYER_MARKDOWN_TOKEN,exports.INTLAYER_TOKEN=e.INTLAYER_TOKEN,Object.defineProperty(exports,`IntlayerMarkdownService`,{enumerable:!0,get:function(){return l.IntlayerMarkdownService}}),Object.defineProperty(exports,`IntlayerProvider`,{enumerable:!0,get:function(){return e.IntlayerProvider}}),exports.createIntlayerClient=e.createIntlayerClient,exports.createIntlayerMarkdownProvider=l.createIntlayerMarkdownProvider,exports.getDictionary=t.getDictionary,exports.getIntlayer=d.getIntlayer,exports.getPlugins=u.getPlugins,exports.htmlPlugin=u.htmlPlugin,exports.htmlRuntime=l.htmlRuntime,exports.insertionPlugin=u.insertionPlugin,exports.installIntlayer=e.installIntlayer,exports.intlayerNodePlugins=u.intlayerNodePlugins,exports.isUpdatableNode=s.isUpdatableNode,exports.markdownPlugin=u.markdownPlugin,exports.markdownStringPlugin=u.markdownStringPlugin,exports.provideIntlayer=e.provideIntlayer,exports.useDictionary=n.useDictionary,exports.useDictionaryAsync=r.useDictionaryAsync,exports.useDictionaryDynamic=a.useDictionaryDynamic,exports.useIntl=o.useIntl,exports.useIntlayer=s.useIntlayer,exports.useLoadDynamic=i.useLoadDynamic,exports.useLocale=c.useLocale,exports.useMarkdown=l.useMarkdown;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./markdown/installIntlayerMarkdown.cjs`),t=require(`./plugins.cjs`),n=require(`./getIntlayer.cjs`),r=require(`./getDictionary.cjs`),i=require(`./client/installIntlayer.cjs`),a=require(`./client/useDictionary.cjs`),o=require(`./client/useDictionaryAsync.cjs`),s=require(`./client/useLoadDynamic.cjs`),c=require(`./client/useDictionaryDynamic.cjs`),l=require(`./client/useIntl.cjs`),u=require(`./client/useIntlayer.cjs`),d=require(`./client/useLocale.cjs`);exports.INTLAYER_MARKDOWN_TOKEN=e.INTLAYER_MARKDOWN_TOKEN,exports.INTLAYER_TOKEN=i.INTLAYER_TOKEN,Object.defineProperty(exports,`IntlayerMarkdownService`,{enumerable:!0,get:function(){return e.IntlayerMarkdownService}}),Object.defineProperty(exports,`IntlayerProvider`,{enumerable:!0,get:function(){return i.IntlayerProvider}}),exports.createIntlayerClient=i.createIntlayerClient,exports.createIntlayerMarkdownProvider=e.createIntlayerMarkdownProvider,exports.getDictionary=r.getDictionary,exports.getIntlayer=n.getIntlayer,exports.getPlugins=t.getPlugins,exports.htmlPlugin=t.htmlPlugin,exports.htmlRuntime=e.htmlRuntime,exports.insertionPlugin=t.insertionPlugin,exports.installIntlayer=i.installIntlayer,exports.intlayerNodePlugins=t.intlayerNodePlugins,exports.isUpdatableNode=u.isUpdatableNode,exports.markdownPlugin=t.markdownPlugin,exports.markdownStringPlugin=t.markdownStringPlugin,exports.provideIntlayer=i.provideIntlayer,exports.useDictionary=a.useDictionary,exports.useDictionaryAsync=o.useDictionaryAsync,exports.useDictionaryDynamic=c.useDictionaryDynamic,exports.useIntl=l.useIntl,exports.useIntlayer=u.useIntlayer,exports.useLoadDynamic=s.useLoadDynamic,exports.useLocale=d.useLocale,exports.useMarkdown=e.useMarkdown;
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./_virtual/_rolldown/runtime.cjs`),t=require(`./renderIntlayerNode.cjs`),n=require(`./editor/ContentSelectorWrapper.component.cjs`),r=require(`./markdown/installIntlayerMarkdown.cjs`);let i=require(`@intlayer/core/interpreter`),a=require(`@intlayer/config/built`);a=e.__toESM(a);let o=require(`@intlayer/core/markdown`),s=require(`@intlayer/types/nodeType`);const c=(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)}}),l={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(e,{children:r,...i})=>t.renderIntlayerNode({...i,value:r,children:()=>({component:a.default?.editor.enabled?n.ContentSelectorWrapperComponent:r,props:{dictionaryKey:i.dictionaryKey,keyPath:i.keyPath},children:r})})},u={id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,i,a)=>{let{plugins:s,...l}=i,u=a((0,o.getMarkdownMetadata)(e),{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(n,r)=>t.renderIntlayerNode({...r,value:n,children:e})}],dictionaryKey:l.dictionaryKey,keyPath:[]}),d=i=>t.renderIntlayerNode({...l,value:e,children:()=>({component:n.ContentSelectorWrapperComponent,props:{dictionaryKey:l.dictionaryKey,keyPath:l.keyPath,...i},children:()=>{let{renderMarkdown:t}=r.useMarkdown();return t(e,i)}}),additionalProps:{metadata:u}}),f=(t,n)=>new Proxy(t,{get(t,i,a){return i===`value`?e:i===`metadata`?u:i===`toString`||i===Symbol.toPrimitive?()=>(0,o.compile)(e,{runtime:n?c(r.htmlRuntime,n):r.htmlRuntime}):i===`use`?e=>{let t={...n,...e};return f(d(t),t)}:Reflect.get(t,i,a)}});return f(d())}},d={id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===s.NodeType.Markdown,transform:(e,t,n)=>{let r=[...t.keyPath,{type:s.NodeType.Markdown}],i=e[s.NodeType.Markdown];return n(i,{...t,children:i,keyPath:r,plugins:[u,...t.plugins??[]]})}},f={id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===s.NodeType.HTML,transform:(e,i)=>{let a=e[s.NodeType.HTML],{plugins:l,...u}=i,d=e=>t.renderIntlayerNode({...u,value:a,children:()=>({component:n.ContentSelectorWrapperComponent,props:{dictionaryKey:u.dictionaryKey,keyPath:u.keyPath,...e},children:a})}),f=(e,t)=>new Proxy(e,{get(e,n,i){return n===`value`?a:n===`toString`||n===Symbol.toPrimitive?()=>!t||typeof t==`object`&&Object.keys(t).length===0?String(a):(0,o.compile)(a,{runtime:c(r.htmlRuntime,t)}):n===`use`?e=>{let n={...t,...e};return f(d(n),n)}:Reflect.get(e,n,i)}});return f(d())}},p={id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===s.NodeType.Insertion,transform:(e,n)=>{let{plugins:r,...i}=n,a=(t={})=>{let n=e.insertion;return t&&Object.entries(t).forEach(([e,t])=>{n=n.replace(RegExp(`{{\\s*${e}\\s*}}`,`g`),String(t))}),n};return t.renderIntlayerNode({...i,value:a,children:a})}},m=(e,t=!0)=>[(0,i.translationPlugin)(e??a.default.internationalization.defaultLocale,t?a.default.internationalization.defaultLocale:void 0),i.enumerationPlugin,i.conditionPlugin,(0,i.nestedPlugin)(e??a.default.internationalization.defaultLocale),i.filePlugin,i.genderPlugin,l,d,f,p];exports.getPlugins=m,exports.htmlPlugin=f,exports.insertionPlugin=p,exports.intlayerNodePlugins=l,exports.markdownPlugin=d,exports.markdownStringPlugin=u;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./_virtual/_rolldown/runtime.cjs`),t=require(`./renderIntlayerNode.cjs`),n=require(`./editor/ContentSelector.component.cjs`),r=require(`./markdown/installIntlayerMarkdown.cjs`);let i=require(`@intlayer/core/interpreter`),a=require(`@intlayer/config/built`);a=e.__toESM(a);let o=require(`@intlayer/core/markdown`),s=require(`@intlayer/types/nodeType`);const c=(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)}}),l={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(e,{children:r,...i})=>t.renderIntlayerNode({...i,value:r,children:()=>({component:a.default?.editor.enabled?n.ContentSelectorWrapperComponent:r,props:{dictionaryKey:i.dictionaryKey,keyPath:i.keyPath},children:r})})},u={id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,i,a)=>{let{plugins:s,...l}=i,u=a((0,o.getMarkdownMetadata)(e),{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(n,r)=>t.renderIntlayerNode({...r,value:n,children:e})}],dictionaryKey:l.dictionaryKey,keyPath:[]}),d=i=>t.renderIntlayerNode({...l,value:e,children:()=>({component:n.ContentSelectorWrapperComponent,props:{dictionaryKey:l.dictionaryKey,keyPath:l.keyPath,...i},children:()=>{let{renderMarkdown:t}=r.useMarkdown();return t(e,i)}}),additionalProps:{metadata:u}}),f=(t,n)=>new Proxy(t,{get(t,i,a){return i===`value`?e:i===`metadata`?u:i===`toString`||i===Symbol.toPrimitive?()=>(0,o.compile)(e,{runtime:n?c(r.htmlRuntime,n):r.htmlRuntime}):i===`use`?e=>{let t={...n,...e};return f(d(t),t)}:Reflect.get(t,i,a)}});return f(d())}},d={id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===s.NodeType.Markdown,transform:(e,t,n)=>{let r=[...t.keyPath,{type:s.NodeType.Markdown}],i=e[s.NodeType.Markdown];return n(i,{...t,children:i,keyPath:r,plugins:[u,...t.plugins??[]]})}},f={id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===s.NodeType.HTML,transform:(e,i)=>{let a=e[s.NodeType.HTML],{plugins:l,...u}=i,d=e=>t.renderIntlayerNode({...u,value:a,children:()=>({component:n.ContentSelectorWrapperComponent,props:{dictionaryKey:u.dictionaryKey,keyPath:u.keyPath,...e},children:a})}),f=(e,t)=>new Proxy(e,{get(e,n,i){return n===`value`?a:n===`toString`||n===Symbol.toPrimitive?()=>!t||typeof t==`object`&&Object.keys(t).length===0?String(a):(0,o.compile)(a,{runtime:c(r.htmlRuntime,t)}):n===`use`?e=>{let n={...t,...e};return f(d(n),n)}:Reflect.get(e,n,i)}});return f(d())}},p={id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===s.NodeType.Insertion,transform:(e,n)=>{let{plugins:r,...i}=n,a=(t={})=>{let n=e.insertion;return t&&Object.entries(t).forEach(([e,t])=>{n=n.replace(RegExp(`{{\\s*${e}\\s*}}`,`g`),String(t))}),n};return t.renderIntlayerNode({...i,value:a,children:a})}},m=(e,t=!0)=>[(0,i.translationPlugin)(e??a.default.internationalization.defaultLocale,t?a.default.internationalization.defaultLocale:void 0),i.enumerationPlugin,i.conditionPlugin,(0,i.nestedPlugin)(e??a.default.internationalization.defaultLocale),i.filePlugin,i.genderPlugin,l,d,f,p];exports.getPlugins=m,exports.htmlPlugin=f,exports.insertionPlugin=p,exports.intlayerNodePlugins=l,exports.markdownPlugin=d,exports.markdownStringPlugin=u;
2
2
  //# sourceMappingURL=plugins.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.cjs","names":["renderIntlayerNode","configuration","ContentSelectorWrapperComponent","useMarkdown","htmlRuntime","NodeType","enumerationPlugin","conditionPlugin","filePlugin","genderPlugin"],"sources":["../../src/plugins.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport {\n conditionPlugin,\n type DeepTransformContent as DeepTransformContentCore,\n enumerationPlugin,\n filePlugin,\n genderPlugin,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n nestedPlugin,\n type Plugins,\n translationPlugin,\n} from '@intlayer/core/interpreter';\nimport {\n compile,\n getMarkdownMetadata,\n type MarkdownContent,\n} from '@intlayer/core/markdown';\nimport type { HTMLContent, InsertionContent } from '@intlayer/core/transpiler';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { NodeType } from '@intlayer/types/nodeType';\nimport { ContentSelectorWrapperComponent } from './editor';\nimport { htmlRuntime, useMarkdown } from './markdown/installIntlayerMarkdown';\nimport { renderIntlayerNode } from './renderIntlayerNode';\n\n/** ---------------------------------------------\n * UTILS\n * --------------------------------------------- */\n\nconst createRuntimeWithOverides = (baseRuntime: any, overrides: any) => ({\n ...baseRuntime,\n createElement: (tag: string, props: any, ...children: any[]) => {\n const override = overrides?.[tag];\n\n if (override) {\n const newProps = { ...props, ...override };\n\n // Merge class attributes intelligently\n const originalClass = props?.class || props?.className;\n const overrideClass = override.class || override.className;\n\n if (originalClass && overrideClass) {\n newProps.class = `${originalClass} ${overrideClass}`;\n newProps.className = undefined;\n }\n\n return baseRuntime.createElement(tag, newProps, ...children);\n }\n\n return baseRuntime.createElement(tag, props, ...children);\n },\n});\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: configuration?.editor.enabled\n ? ContentSelectorWrapperComponent\n : children,\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 const render = (components?: any) =>\n renderIntlayerNode({\n ...rest,\n value: node,\n children: () => ({\n component: ContentSelectorWrapperComponent,\n props: {\n dictionaryKey: rest.dictionaryKey,\n keyPath: rest.keyPath,\n ...components,\n },\n children: () => {\n const { renderMarkdown } = useMarkdown();\n return renderMarkdown(node, components);\n },\n }),\n additionalProps: {\n metadata: metadataNodes,\n },\n });\n\n const createProxy = (element: any, components?: any) =>\n new Proxy(element, {\n get(target, prop, receiver) {\n if (prop === 'value') {\n return node;\n }\n if (prop === 'metadata') {\n return metadataNodes;\n }\n\n if (prop === 'toString') {\n return () => {\n const runtime = components\n ? createRuntimeWithOverides(htmlRuntime, components)\n : htmlRuntime;\n return compile(node, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === Symbol.toPrimitive) {\n return () => {\n const runtime = components\n ? createRuntimeWithOverides(htmlRuntime, components)\n : htmlRuntime;\n return compile(node, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === 'use') {\n return (newComponents?: any) => {\n const mergedComponents = { ...components, ...newComponents };\n return createProxy(render(mergedComponents), mergedComponents);\n };\n }\n\n return Reflect.get(target, prop, receiver);\n },\n }) as any;\n\n return createProxy(render() as any);\n },\n};\n\nexport type MarkdownCond<T, _S, _L extends LocalesValues> = T extends {\n nodeType: NodeType | string;\n [NodeType.Markdown]: infer M;\n tags?: infer U;\n metadata?: infer V;\n}\n ? IntlayerNode<\n M,\n {\n use: (components?: Record<keyof U, any>) => any;\n metadata: DeepTransformContent<V>;\n }\n >\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 * HTML PLUGIN\n * --------------------------------------------- */\n\n/**\n * HTML conditional type.\n *\n * This ensures type safety:\n * - `html('<div>Hello <CustomComponent /></div>').use({ CustomComponent: ... })` - optional but typed\n */\nexport type HTMLPluginCond<T, _S, _L> = T extends {\n nodeType: NodeType | string;\n [NodeType.HTML]: infer I;\n tags?: infer U;\n}\n ? IntlayerNode<\n I,\n {\n use: (components?: Record<keyof U, any>) => any;\n }\n >\n : never;\n\n/** HTML plugin. Replaces node with a function that takes components => IntlayerNode. */\nexport const htmlPlugin: Plugins = {\n id: 'html-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.HTML,\n\n transform: (node: HTMLContent<string>, props) => {\n const html = node[NodeType.HTML];\n const { plugins, ...rest } = props;\n\n // Type-safe render function that accepts properly typed components\n const render = (userComponents?: any) =>\n renderIntlayerNode({\n ...rest,\n value: html,\n children: () => ({\n component: ContentSelectorWrapperComponent,\n props: {\n dictionaryKey: rest.dictionaryKey,\n keyPath: rest.keyPath,\n ...userComponents,\n },\n children: html,\n }),\n });\n\n const createProxy = (element: any, components?: any) =>\n new Proxy(element, {\n get(target, prop, receiver) {\n if (prop === 'value') {\n return html;\n }\n\n if (prop === 'toString') {\n return () => {\n if (\n !components ||\n (typeof components === 'object' &&\n Object.keys(components).length === 0)\n ) {\n return String(html);\n }\n const runtime = createRuntimeWithOverides(\n htmlRuntime,\n components\n );\n return compile(html, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === Symbol.toPrimitive) {\n return () => {\n if (\n !components ||\n (typeof components === 'object' &&\n Object.keys(components).length === 0)\n ) {\n return String(html);\n }\n const runtime = createRuntimeWithOverides(\n htmlRuntime,\n components\n );\n return compile(html, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === 'use') {\n // Return a properly typed function based on custom components\n return (userComponents?: any) => {\n const mergedComponents = { ...components, ...userComponents };\n return createProxy(render(mergedComponents), mergedComponents);\n };\n }\n\n return Reflect.get(target, prop, receiver);\n },\n }) as any;\n\n return createProxy(render() as any);\n },\n};\n\n/** ---------------------------------------------\n * INSERTION PLUGIN\n * --------------------------------------------- */\n\n/**\n * Insertion conditional type.\n */\nexport type InsertionPluginCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeType.Insertion]: infer _I;\n}\n ? (args: Record<string, string | number>) => string\n : never;\n\nexport const insertionPlugin: Plugins = {\n id: 'insertion-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Insertion,\n transform: (node: InsertionContent, props) => {\n const { plugins, ...rest } = props;\n\n // Return a function that performs the interpolation\n const render = (args: Record<string, string | number> = {}) => {\n let text = node.insertion as string;\n if (args) {\n Object.entries(args).forEach(([key, value]) => {\n text = text.replace(\n new RegExp(`{{\\\\s*${key}\\\\s*}}`, 'g'),\n String(value)\n );\n });\n }\n return text;\n };\n\n return renderIntlayerNode({\n ...rest,\n value: render as any,\n children: render,\n });\n },\n};\n\nexport interface IInterpreterPluginAngular<T, S, L extends LocalesValues> {\n angularIntlayerNode: IntlayerNodeCond<T>;\n angularMarkdown: MarkdownCond<T, S, L>;\n angularHtml: HTMLPluginCond<T, S, L>;\n angularInsertion: InsertionPluginCond<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 = Omit<\n IInterpreterPluginStateCore,\n 'insertion' // Remove insertion type from core package\n> & {\n angularIntlayerNode: true;\n angularMarkdown: true;\n angularHtml: true;\n angularInsertion: true;\n};\n\nexport type DeepTransformContent<\n T,\n L extends LocalesValues = DeclaredLocales,\n> = DeepTransformContentCore<T, IInterpreterPluginState, L>;\n\n/**\n * Get the plugins array for Angular content transformation.\n * This function is used by both getIntlayer and getDictionary to ensure consistent plugin configuration.\n */\nexport const getPlugins = (\n locale?: LocalesValues,\n fallback: boolean = true\n): Plugins[] => [\n translationPlugin(\n locale ?? configuration.internationalization.defaultLocale,\n fallback ? configuration.internationalization.defaultLocale : undefined\n ),\n enumerationPlugin,\n conditionPlugin,\n nestedPlugin(locale ?? configuration.internationalization.defaultLocale),\n filePlugin,\n genderPlugin,\n intlayerNodePlugins,\n markdownPlugin,\n htmlPlugin,\n insertionPlugin,\n];\n"],"mappings":"0bAgCA,MAAM,GAA6B,EAAkB,KAAoB,CACvE,GAAG,EACH,eAAgB,EAAa,EAAY,GAAG,IAAoB,CAC9D,IAAM,EAAW,IAAY,GAE7B,GAAI,EAAU,CACZ,IAAM,EAAW,CAAE,GAAG,EAAO,GAAG,EAAU,CAGpC,EAAgB,GAAO,OAAS,GAAO,UACvC,EAAgB,EAAS,OAAS,EAAS,UAOjD,OALI,GAAiB,IACnB,EAAS,MAAQ,GAAG,EAAc,GAAG,IACrC,EAAS,UAAY,IAAA,IAGhB,EAAY,cAAc,EAAK,EAAU,GAAG,EAAS,CAG9D,OAAO,EAAY,cAAc,EAAK,EAAO,GAAG,EAAS,EAE5D,EAiBY,EAA+B,CAC1C,GAAI,uBACJ,UAAY,GACV,OAAO,GAAS,UAChB,OAAO,GAAS,UAChB,OAAO,GAAS,SAClB,WAAY,EAAO,CAAE,WAAU,GAAG,KAChCA,EAA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C7D,OAAO,EAAY,EAAO,EAAiB,CAAE,EAAiB,EAI3D,QAAQ,IAAI,EAAQ,EAAM,EAAS,EAE7C,CAAC,CAEJ,OAAO,EAAY,GAAQ,CAAQ,EAEtC,CAgBY,EAA2B,CACtC,GAAI,mBACJ,UAAY,GACV,OAAO,GAAS,UAAY,GAAM,WAAaC,EAAAA,SAAS,UAC1D,WAAY,EAAwB,IAAU,CAC5C,GAAM,CAAE,UAAS,GAAG,GAAS,EAGvB,GAAU,EAAwC,EAAE,GAAK,CAC7D,IAAI,EAAO,EAAK,UAShB,OARI,GACF,OAAO,QAAQ,EAAK,CAAC,SAAS,CAAC,EAAK,KAAW,CAC7C,EAAO,EAAK,QACN,OAAO,SAAS,EAAI,QAAS,IAAI,CACrC,OAAO,EAAM,CACd,EACD,CAEG,GAGT,OAAOL,EAAAA,mBAAmB,CACxB,GAAG,EACH,MAAO,EACP,SAAU,EACX,CAAC,EAEL,CAiCY,GACX,EACA,EAAoB,KACN,yBAEZ,GAAUC,EAAAA,QAAc,qBAAqB,cAC7C,EAAWA,EAAAA,QAAc,qBAAqB,cAAgB,IAAA,GAC/D,CACDK,EAAAA,kBACAC,EAAAA,mCACa,GAAUN,EAAAA,QAAc,qBAAqB,cAAc,CACxEO,EAAAA,WACAC,EAAAA,aACA,EACA,EACA,EACA,EACD"}
1
+ {"version":3,"file":"plugins.cjs","names":["renderIntlayerNode","configuration","ContentSelectorWrapperComponent","useMarkdown","htmlRuntime","NodeType","enumerationPlugin","conditionPlugin","filePlugin","genderPlugin"],"sources":["../../src/plugins.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport {\n conditionPlugin,\n type DeepTransformContent as DeepTransformContentCore,\n enumerationPlugin,\n filePlugin,\n genderPlugin,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n nestedPlugin,\n type Plugins,\n translationPlugin,\n} from '@intlayer/core/interpreter';\nimport {\n compile,\n getMarkdownMetadata,\n type MarkdownContent,\n} from '@intlayer/core/markdown';\nimport type { HTMLContent, InsertionContent } from '@intlayer/core/transpiler';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { NodeType } from '@intlayer/types/nodeType';\nimport { ContentSelectorWrapperComponent } from './editor/ContentSelector.component';\nimport { htmlRuntime, useMarkdown } from './markdown/installIntlayerMarkdown';\nimport { renderIntlayerNode } from './renderIntlayerNode';\n\n/** ---------------------------------------------\n * UTILS\n * --------------------------------------------- */\n\nconst createRuntimeWithOverides = (baseRuntime: any, overrides: any) => ({\n ...baseRuntime,\n createElement: (tag: string, props: any, ...children: any[]) => {\n const override = overrides?.[tag];\n\n if (override) {\n const newProps = { ...props, ...override };\n\n // Merge class attributes intelligently\n const originalClass = props?.class || props?.className;\n const overrideClass = override.class || override.className;\n\n if (originalClass && overrideClass) {\n newProps.class = `${originalClass} ${overrideClass}`;\n newProps.className = undefined;\n }\n\n return baseRuntime.createElement(tag, newProps, ...children);\n }\n\n return baseRuntime.createElement(tag, props, ...children);\n },\n});\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: configuration?.editor.enabled\n ? ContentSelectorWrapperComponent\n : children,\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 const render = (components?: any) =>\n renderIntlayerNode({\n ...rest,\n value: node,\n children: () => ({\n component: ContentSelectorWrapperComponent,\n props: {\n dictionaryKey: rest.dictionaryKey,\n keyPath: rest.keyPath,\n ...components,\n },\n children: () => {\n const { renderMarkdown } = useMarkdown();\n return renderMarkdown(node, components);\n },\n }),\n additionalProps: {\n metadata: metadataNodes,\n },\n });\n\n const createProxy = (element: any, components?: any) =>\n new Proxy(element, {\n get(target, prop, receiver) {\n if (prop === 'value') {\n return node;\n }\n if (prop === 'metadata') {\n return metadataNodes;\n }\n\n if (prop === 'toString') {\n return () => {\n const runtime = components\n ? createRuntimeWithOverides(htmlRuntime, components)\n : htmlRuntime;\n return compile(node, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === Symbol.toPrimitive) {\n return () => {\n const runtime = components\n ? createRuntimeWithOverides(htmlRuntime, components)\n : htmlRuntime;\n return compile(node, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === 'use') {\n return (newComponents?: any) => {\n const mergedComponents = { ...components, ...newComponents };\n return createProxy(render(mergedComponents), mergedComponents);\n };\n }\n\n return Reflect.get(target, prop, receiver);\n },\n }) as any;\n\n return createProxy(render() as any);\n },\n};\n\nexport type MarkdownCond<T, _S, _L extends LocalesValues> = T extends {\n nodeType: NodeType | string;\n [NodeType.Markdown]: infer M;\n tags?: infer U;\n metadata?: infer V;\n}\n ? IntlayerNode<\n M,\n {\n use: (components?: Record<keyof U, any>) => any;\n metadata: DeepTransformContent<V>;\n }\n >\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 * HTML PLUGIN\n * --------------------------------------------- */\n\n/**\n * HTML conditional type.\n *\n * This ensures type safety:\n * - `html('<div>Hello <CustomComponent /></div>').use({ CustomComponent: ... })` - optional but typed\n */\nexport type HTMLPluginCond<T, _S, _L> = T extends {\n nodeType: NodeType | string;\n [NodeType.HTML]: infer I;\n tags?: infer U;\n}\n ? IntlayerNode<\n I,\n {\n use: (components?: Record<keyof U, any>) => any;\n }\n >\n : never;\n\n/** HTML plugin. Replaces node with a function that takes components => IntlayerNode. */\nexport const htmlPlugin: Plugins = {\n id: 'html-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.HTML,\n\n transform: (node: HTMLContent<string>, props) => {\n const html = node[NodeType.HTML];\n const { plugins, ...rest } = props;\n\n // Type-safe render function that accepts properly typed components\n const render = (userComponents?: any) =>\n renderIntlayerNode({\n ...rest,\n value: html,\n children: () => ({\n component: ContentSelectorWrapperComponent,\n props: {\n dictionaryKey: rest.dictionaryKey,\n keyPath: rest.keyPath,\n ...userComponents,\n },\n children: html,\n }),\n });\n\n const createProxy = (element: any, components?: any) =>\n new Proxy(element, {\n get(target, prop, receiver) {\n if (prop === 'value') {\n return html;\n }\n\n if (prop === 'toString') {\n return () => {\n if (\n !components ||\n (typeof components === 'object' &&\n Object.keys(components).length === 0)\n ) {\n return String(html);\n }\n const runtime = createRuntimeWithOverides(\n htmlRuntime,\n components\n );\n return compile(html, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === Symbol.toPrimitive) {\n return () => {\n if (\n !components ||\n (typeof components === 'object' &&\n Object.keys(components).length === 0)\n ) {\n return String(html);\n }\n const runtime = createRuntimeWithOverides(\n htmlRuntime,\n components\n );\n return compile(html, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === 'use') {\n // Return a properly typed function based on custom components\n return (userComponents?: any) => {\n const mergedComponents = { ...components, ...userComponents };\n return createProxy(render(mergedComponents), mergedComponents);\n };\n }\n\n return Reflect.get(target, prop, receiver);\n },\n }) as any;\n\n return createProxy(render() as any);\n },\n};\n\n/** ---------------------------------------------\n * INSERTION PLUGIN\n * --------------------------------------------- */\n\n/**\n * Insertion conditional type.\n */\nexport type InsertionPluginCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeType.Insertion]: infer _I;\n}\n ? (args: Record<string, string | number>) => string\n : never;\n\nexport const insertionPlugin: Plugins = {\n id: 'insertion-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Insertion,\n transform: (node: InsertionContent, props) => {\n const { plugins, ...rest } = props;\n\n // Return a function that performs the interpolation\n const render = (args: Record<string, string | number> = {}) => {\n let text = node.insertion as string;\n if (args) {\n Object.entries(args).forEach(([key, value]) => {\n text = text.replace(\n new RegExp(`{{\\\\s*${key}\\\\s*}}`, 'g'),\n String(value)\n );\n });\n }\n return text;\n };\n\n return renderIntlayerNode({\n ...rest,\n value: render as any,\n children: render,\n });\n },\n};\n\nexport interface IInterpreterPluginAngular<T, S, L extends LocalesValues> {\n angularIntlayerNode: IntlayerNodeCond<T>;\n angularMarkdown: MarkdownCond<T, S, L>;\n angularHtml: HTMLPluginCond<T, S, L>;\n angularInsertion: InsertionPluginCond<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 = Omit<\n IInterpreterPluginStateCore,\n 'insertion' // Remove insertion type from core package\n> & {\n angularIntlayerNode: true;\n angularMarkdown: true;\n angularHtml: true;\n angularInsertion: true;\n};\n\nexport type DeepTransformContent<\n T,\n L extends LocalesValues = DeclaredLocales,\n> = DeepTransformContentCore<T, IInterpreterPluginState, L>;\n\n/**\n * Get the plugins array for Angular content transformation.\n * This function is used by both getIntlayer and getDictionary to ensure consistent plugin configuration.\n */\nexport const getPlugins = (\n locale?: LocalesValues,\n fallback: boolean = true\n): Plugins[] => [\n translationPlugin(\n locale ?? configuration.internationalization.defaultLocale,\n fallback ? configuration.internationalization.defaultLocale : undefined\n ),\n enumerationPlugin,\n conditionPlugin,\n nestedPlugin(locale ?? configuration.internationalization.defaultLocale),\n filePlugin,\n genderPlugin,\n intlayerNodePlugins,\n markdownPlugin,\n htmlPlugin,\n insertionPlugin,\n];\n"],"mappings":"mbAgCA,MAAM,GAA6B,EAAkB,KAAoB,CACvE,GAAG,EACH,eAAgB,EAAa,EAAY,GAAG,IAAoB,CAC9D,IAAM,EAAW,IAAY,GAE7B,GAAI,EAAU,CACZ,IAAM,EAAW,CAAE,GAAG,EAAO,GAAG,EAAU,CAGpC,EAAgB,GAAO,OAAS,GAAO,UACvC,EAAgB,EAAS,OAAS,EAAS,UAOjD,OALI,GAAiB,IACnB,EAAS,MAAQ,GAAG,EAAc,GAAG,IACrC,EAAS,UAAY,IAAA,IAGhB,EAAY,cAAc,EAAK,EAAU,GAAG,EAAS,CAG9D,OAAO,EAAY,cAAc,EAAK,EAAO,GAAG,EAAS,EAE5D,EAiBY,EAA+B,CAC1C,GAAI,uBAC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,EAAAA,YACA,EACD,CAGA,CAAC,CAIF,IAAS,MAEH,GAAyB,CAC/B,IAAM,EAAmB,CAAE,GAAG,EAAY,GAAG,EAAgB,CAC7D,OAAO,EAAY,EAAO,EAAiB,CAAE,EAAiB,EAI3D,QAAQ,IAAI,EAAQ,EAAM,EAAS,EAE7C,CAAC,CAEJ,OAAO,EAAY,GAAQ,CAAQ,EAEtC,CAgBY,EAA2B,CACtC,GAAI,mBACJ,UAAY,GACV,OAAO,GAAS,UAAY,GAAM,WAAaC,EAAAA,SAAS,UAC1D,WAAY,EAAwB,IAAU,CAC5C,GAAM,CAAE,UAAS,GAAG,GAAS,EAGvB,GAAU,EAAwC,EAAE,GAAK,CAC7D,IAAI,EAAO,EAAK,UAShB,OARI,GACF,OAAO,QAAQ,EAAK,CAAC,SAAS,CAAC,EAAK,KAAW,CAC7C,EAAO,EAAK,QACN,OAAO,SAAS,EAAI,QAAS,IAAI,CACrC,OAAO,EAAM,CACd,EACD,CAEG,GAGT,OAAOL,EAAAA,mBAAmB,CACxB,GAAG,EACH,MAAO,EACP,SAAU,EACX,CAAC,EAEL,CAiCY,GACX,EACA,EAAoB,KACN,yBAEZ,GAAUC,EAAAA,QAAc,qBAAqB,cAC7C,EAAWA,EAAAA,QAAc,qBAAqB,cAAgB,IAAA,GAC/D,CACDK,EAAAA,kBACAC,EAAAA,mCACa,GAAUN,EAAAA,QAAc,qBAAqB,cAAc,CACxEO,EAAAA,WACAC,EAAAA,aACA,EACA,EACA,EACA,EACD"}
@@ -1,2 +1,2 @@
1
- import{INTLAYER_TOKEN as e}from"./installIntlayer.mjs";import{getDictionary as t}from"../getDictionary.mjs";import{computed as n,inject as r}from"@angular/core";const i=(i,a)=>{let o=r(e),s=n(()=>a??o?.locale());return n(()=>t(i,s()))};export{i as useDictionary};
1
+ import{getDictionary as e}from"../getDictionary.mjs";import{INTLAYER_TOKEN as t}from"./installIntlayer.mjs";import{computed as n,inject as r}from"@angular/core";const i=(i,a)=>{let o=r(t),s=n(()=>a??o?.locale());return n(()=>e(i,s()))};export{i as useDictionary};
2
2
  //# sourceMappingURL=useDictionary.mjs.map
@@ -1,2 +1,2 @@
1
- import{INTLAYER_TOKEN as e}from"./installIntlayer.mjs";import{getIntlayer as t}from"../getIntlayer.mjs";import{computed as n,inject as r}from"@angular/core";const i=e=>!!e&&typeof e==`object`&&typeof e.__update==`function`,a=(i,a)=>{let o=r(e),s=n(()=>a??o.locale());return n(()=>t(i,s()))};export{i as isUpdatableNode,a as useIntlayer};
1
+ import{getIntlayer as e}from"../getIntlayer.mjs";import{INTLAYER_TOKEN as t}from"./installIntlayer.mjs";import{computed as n,inject as r}from"@angular/core";const i=e=>!!e&&typeof e==`object`&&typeof e.__update==`function`,a=(i,a)=>{let o=r(t),s=n(()=>a??o.locale());return n(()=>e(i,s()))};export{i as isUpdatableNode,a as useIntlayer};
2
2
  //# sourceMappingURL=useIntlayer.mjs.map
@@ -1,2 +1,2 @@
1
- import{LocaleStorage as e,getLocaleFromStorage as t,setLocaleInStorage as n}from"@intlayer/core/utils";import{localeStorageOptions as r}from"@intlayer/core/localization";const i=t(r),a=i,o=(e,t)=>n(e,{...r,isCookieEnabled:t}),s=o,c=t=>e({...r,isCookieEnabled:t}),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 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};
2
2
  //# sourceMappingURL=useLocaleStorage.mjs.map
@@ -0,0 +1,9 @@
1
+ import{__decorateMetadata as e}from"../_virtual/_@oxc-project_runtime@0.115.0/helpers/decorateMetadata.mjs";import{__decorate as t}from"../_virtual/_@oxc-project_runtime@0.115.0/helpers/decorate.mjs";import{CUSTOM_ELEMENTS_SCHEMA as n,Component as r,Input as i}from"@angular/core";let a=class{dictionaryKey;keyPath;get keyPathJson(){return JSON.stringify(this.keyPath)}};t([i(),e(`design:type`,String)],a.prototype,`dictionaryKey`,void 0),t([i(),e(`design:type`,Array)],a.prototype,`keyPath`,void 0),a=t([r({selector:`app-content-selector-wrapper`,standalone:!0,schemas:[n],template:`
2
+ <intlayer-content-selector-wrapper
3
+ [attr.key-path]="keyPathJson"
4
+ [attr.dictionary-key]="dictionaryKey"
5
+ >
6
+ <ng-content></ng-content>
7
+ </intlayer-content-selector-wrapper>
8
+ `})],a);export{a as ContentSelectorWrapperComponent};
9
+ //# 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":"yRAeO,IAAA,EAAA,KAAsC,CAC3C,cACA,QAEA,IAAI,aAAc,CAChB,OAAO,KAAK,UAAU,KAAK,QAAQ,MAJpC,GAAO,CAAA,EAAA,cAAA,OAAA,CAAA,CAAA,EAAA,UAAA,gBAAA,IAAA,GAAA,IACP,GAAO,CAAA,EAAA,cAAA,MAAA,CAAA,CAAA,EAAA,UAAA,UAAA,IAAA,GAAA,MAfT,EAAU,CACT,SAAU,+BACV,WAAY,GACZ,QAAS,CAAC,EAAuB,CACjC,SAAU;;;;;;;IAQX,CAAC,CAAA,CAAA,EAAA"}
@@ -1,2 +1,2 @@
1
- import{createSharedComposable as e}from"./createSharedComposable.mjs";import{useEditorEnabled as t}from"./editorEnabled.mjs";import{useFocusDictionary as n}from"./focusDictionary.mjs";import{useConfiguration as r}from"./configuration.mjs";import{useDictionariesRecord as i}from"./dictionariesRecord.mjs";import{useEditorLocale as a}from"./editorLocale.mjs";import{useCrossURLPathSetter as o}from"./useCrossURLPathState.mjs";import{useIframeClickMerger as s}from"./useIframeClickInterceptor.mjs";const c=e(()=>{r(),t(),n(),s(),o(),a(),i(),a()});export{c as useEditor};
1
+ import{INTLAYER_TOKEN as e}from"../client/installIntlayer.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(!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};
2
2
  //# sourceMappingURL=useEditor.mjs.map
@@ -1 +1 @@
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":"+eASA,MAAa,EAAY,MAA6B,CACpD,GAAkB,CAClB,GAAkB,CAClB,GAAoB,CACpB,GAAsB,CACtB,GAAuB,CACvB,GAAiB,CACjB,GAAuB,CACvB,GAAiB,EACjB"}
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 (!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":"kOAWA,MAAa,MAAkB,CAC7B,GAAI,CAAC,EAAW,OAEhB,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 +1 @@
1
- import{INTLAYER_TOKEN as e,IntlayerProvider as t,createIntlayerClient as n,installIntlayer as r,provideIntlayer as i}from"./client/installIntlayer.mjs";import{getDictionary as a}from"./getDictionary.mjs";import{useDictionary as o}from"./client/useDictionary.mjs";import{useDictionaryAsync as s}from"./client/useDictionaryAsync.mjs";import{useLoadDynamic as c}from"./client/useLoadDynamic.mjs";import{useDictionaryDynamic as l}from"./client/useDictionaryDynamic.mjs";import{useIntl as u}from"./client/useIntl.mjs";import{isUpdatableNode as d,useIntlayer as f}from"./client/useIntlayer.mjs";import{useLocale as p}from"./client/useLocale.mjs";import{INTLAYER_MARKDOWN_TOKEN as m,IntlayerMarkdownService as h,createIntlayerMarkdownProvider as g,htmlRuntime as _,useMarkdown as v}from"./markdown/installIntlayerMarkdown.mjs";import{getPlugins as y,htmlPlugin as b,insertionPlugin as x,intlayerNodePlugins as S,markdownPlugin as C,markdownStringPlugin as w}from"./plugins.mjs";import{getIntlayer as T}from"./getIntlayer.mjs";export{m as INTLAYER_MARKDOWN_TOKEN,e as INTLAYER_TOKEN,h as IntlayerMarkdownService,t as IntlayerProvider,n as createIntlayerClient,g as createIntlayerMarkdownProvider,a as getDictionary,T as getIntlayer,y as getPlugins,b as htmlPlugin,_ as htmlRuntime,x as insertionPlugin,r as installIntlayer,S as intlayerNodePlugins,d as isUpdatableNode,C as markdownPlugin,w as markdownStringPlugin,i as provideIntlayer,o as useDictionary,s as useDictionaryAsync,l as useDictionaryDynamic,u as useIntl,f as useIntlayer,c as useLoadDynamic,p as useLocale,v as useMarkdown};
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";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,2 +1,2 @@
1
- import{renderIntlayerNode as e}from"./renderIntlayerNode.mjs";import{ContentSelectorWrapperComponent as t}from"./editor/ContentSelectorWrapper.component.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:[]}),u=n=>e({...c,value:i,children:()=>({component:t,props:{dictionaryKey:c.dictionaryKey,keyPath:c.keyPath,...n},children:()=>{let{renderMarkdown:e}=r();return e(i,n)}}),additionalProps:{metadata:l}}),p=(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 p(u(n),n)}:Reflect.get(e,r,a)}});return p(u())}},_={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:()=>({component:t,props:{dictionaryKey:s.dictionaryKey,keyPath:s.keyPath,...n},children: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 as e}from"./renderIntlayerNode.mjs";import{ContentSelectorWrapperComponent as t}from"./editor/ContentSelector.component.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:[]}),u=n=>e({...c,value:i,children:()=>({component:t,props:{dictionaryKey:c.dictionaryKey,keyPath:c.keyPath,...n},children:()=>{let{renderMarkdown:e}=r();return e(i,n)}}),additionalProps:{metadata:l}}),p=(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 p(u(n),n)}:Reflect.get(e,r,a)}});return p(u())}},_={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:()=>({component:t,props:{dictionaryKey:s.dictionaryKey,keyPath:s.keyPath,...n},children: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};
2
2
  //# sourceMappingURL=plugins.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.mjs","names":[],"sources":["../../src/plugins.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport {\n conditionPlugin,\n type DeepTransformContent as DeepTransformContentCore,\n enumerationPlugin,\n filePlugin,\n genderPlugin,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n nestedPlugin,\n type Plugins,\n translationPlugin,\n} from '@intlayer/core/interpreter';\nimport {\n compile,\n getMarkdownMetadata,\n type MarkdownContent,\n} from '@intlayer/core/markdown';\nimport type { HTMLContent, InsertionContent } from '@intlayer/core/transpiler';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { NodeType } from '@intlayer/types/nodeType';\nimport { ContentSelectorWrapperComponent } from './editor';\nimport { htmlRuntime, useMarkdown } from './markdown/installIntlayerMarkdown';\nimport { renderIntlayerNode } from './renderIntlayerNode';\n\n/** ---------------------------------------------\n * UTILS\n * --------------------------------------------- */\n\nconst createRuntimeWithOverides = (baseRuntime: any, overrides: any) => ({\n ...baseRuntime,\n createElement: (tag: string, props: any, ...children: any[]) => {\n const override = overrides?.[tag];\n\n if (override) {\n const newProps = { ...props, ...override };\n\n // Merge class attributes intelligently\n const originalClass = props?.class || props?.className;\n const overrideClass = override.class || override.className;\n\n if (originalClass && overrideClass) {\n newProps.class = `${originalClass} ${overrideClass}`;\n newProps.className = undefined;\n }\n\n return baseRuntime.createElement(tag, newProps, ...children);\n }\n\n return baseRuntime.createElement(tag, props, ...children);\n },\n});\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: configuration?.editor.enabled\n ? ContentSelectorWrapperComponent\n : children,\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 const render = (components?: any) =>\n renderIntlayerNode({\n ...rest,\n value: node,\n children: () => ({\n component: ContentSelectorWrapperComponent,\n props: {\n dictionaryKey: rest.dictionaryKey,\n keyPath: rest.keyPath,\n ...components,\n },\n children: () => {\n const { renderMarkdown } = useMarkdown();\n return renderMarkdown(node, components);\n },\n }),\n additionalProps: {\n metadata: metadataNodes,\n },\n });\n\n const createProxy = (element: any, components?: any) =>\n new Proxy(element, {\n get(target, prop, receiver) {\n if (prop === 'value') {\n return node;\n }\n if (prop === 'metadata') {\n return metadataNodes;\n }\n\n if (prop === 'toString') {\n return () => {\n const runtime = components\n ? createRuntimeWithOverides(htmlRuntime, components)\n : htmlRuntime;\n return compile(node, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === Symbol.toPrimitive) {\n return () => {\n const runtime = components\n ? createRuntimeWithOverides(htmlRuntime, components)\n : htmlRuntime;\n return compile(node, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === 'use') {\n return (newComponents?: any) => {\n const mergedComponents = { ...components, ...newComponents };\n return createProxy(render(mergedComponents), mergedComponents);\n };\n }\n\n return Reflect.get(target, prop, receiver);\n },\n }) as any;\n\n return createProxy(render() as any);\n },\n};\n\nexport type MarkdownCond<T, _S, _L extends LocalesValues> = T extends {\n nodeType: NodeType | string;\n [NodeType.Markdown]: infer M;\n tags?: infer U;\n metadata?: infer V;\n}\n ? IntlayerNode<\n M,\n {\n use: (components?: Record<keyof U, any>) => any;\n metadata: DeepTransformContent<V>;\n }\n >\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 * HTML PLUGIN\n * --------------------------------------------- */\n\n/**\n * HTML conditional type.\n *\n * This ensures type safety:\n * - `html('<div>Hello <CustomComponent /></div>').use({ CustomComponent: ... })` - optional but typed\n */\nexport type HTMLPluginCond<T, _S, _L> = T extends {\n nodeType: NodeType | string;\n [NodeType.HTML]: infer I;\n tags?: infer U;\n}\n ? IntlayerNode<\n I,\n {\n use: (components?: Record<keyof U, any>) => any;\n }\n >\n : never;\n\n/** HTML plugin. Replaces node with a function that takes components => IntlayerNode. */\nexport const htmlPlugin: Plugins = {\n id: 'html-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.HTML,\n\n transform: (node: HTMLContent<string>, props) => {\n const html = node[NodeType.HTML];\n const { plugins, ...rest } = props;\n\n // Type-safe render function that accepts properly typed components\n const render = (userComponents?: any) =>\n renderIntlayerNode({\n ...rest,\n value: html,\n children: () => ({\n component: ContentSelectorWrapperComponent,\n props: {\n dictionaryKey: rest.dictionaryKey,\n keyPath: rest.keyPath,\n ...userComponents,\n },\n children: html,\n }),\n });\n\n const createProxy = (element: any, components?: any) =>\n new Proxy(element, {\n get(target, prop, receiver) {\n if (prop === 'value') {\n return html;\n }\n\n if (prop === 'toString') {\n return () => {\n if (\n !components ||\n (typeof components === 'object' &&\n Object.keys(components).length === 0)\n ) {\n return String(html);\n }\n const runtime = createRuntimeWithOverides(\n htmlRuntime,\n components\n );\n return compile(html, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === Symbol.toPrimitive) {\n return () => {\n if (\n !components ||\n (typeof components === 'object' &&\n Object.keys(components).length === 0)\n ) {\n return String(html);\n }\n const runtime = createRuntimeWithOverides(\n htmlRuntime,\n components\n );\n return compile(html, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === 'use') {\n // Return a properly typed function based on custom components\n return (userComponents?: any) => {\n const mergedComponents = { ...components, ...userComponents };\n return createProxy(render(mergedComponents), mergedComponents);\n };\n }\n\n return Reflect.get(target, prop, receiver);\n },\n }) as any;\n\n return createProxy(render() as any);\n },\n};\n\n/** ---------------------------------------------\n * INSERTION PLUGIN\n * --------------------------------------------- */\n\n/**\n * Insertion conditional type.\n */\nexport type InsertionPluginCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeType.Insertion]: infer _I;\n}\n ? (args: Record<string, string | number>) => string\n : never;\n\nexport const insertionPlugin: Plugins = {\n id: 'insertion-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Insertion,\n transform: (node: InsertionContent, props) => {\n const { plugins, ...rest } = props;\n\n // Return a function that performs the interpolation\n const render = (args: Record<string, string | number> = {}) => {\n let text = node.insertion as string;\n if (args) {\n Object.entries(args).forEach(([key, value]) => {\n text = text.replace(\n new RegExp(`{{\\\\s*${key}\\\\s*}}`, 'g'),\n String(value)\n );\n });\n }\n return text;\n };\n\n return renderIntlayerNode({\n ...rest,\n value: render as any,\n children: render,\n });\n },\n};\n\nexport interface IInterpreterPluginAngular<T, S, L extends LocalesValues> {\n angularIntlayerNode: IntlayerNodeCond<T>;\n angularMarkdown: MarkdownCond<T, S, L>;\n angularHtml: HTMLPluginCond<T, S, L>;\n angularInsertion: InsertionPluginCond<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 = Omit<\n IInterpreterPluginStateCore,\n 'insertion' // Remove insertion type from core package\n> & {\n angularIntlayerNode: true;\n angularMarkdown: true;\n angularHtml: true;\n angularInsertion: true;\n};\n\nexport type DeepTransformContent<\n T,\n L extends LocalesValues = DeclaredLocales,\n> = DeepTransformContentCore<T, IInterpreterPluginState, L>;\n\n/**\n * Get the plugins array for Angular content transformation.\n * This function is used by both getIntlayer and getDictionary to ensure consistent plugin configuration.\n */\nexport const getPlugins = (\n locale?: LocalesValues,\n fallback: boolean = true\n): Plugins[] => [\n translationPlugin(\n locale ?? configuration.internationalization.defaultLocale,\n fallback ? configuration.internationalization.defaultLocale : undefined\n ),\n enumerationPlugin,\n conditionPlugin,\n nestedPlugin(locale ?? configuration.internationalization.defaultLocale),\n filePlugin,\n genderPlugin,\n intlayerNodePlugins,\n markdownPlugin,\n htmlPlugin,\n insertionPlugin,\n];\n"],"mappings":"wjBAgCA,MAAM,GAA6B,EAAkB,KAAoB,CACvE,GAAG,EACH,eAAgB,EAAa,EAAY,GAAG,IAAoB,CAC9D,IAAM,EAAW,IAAY,GAE7B,GAAI,EAAU,CACZ,IAAM,EAAW,CAAE,GAAG,EAAO,GAAG,EAAU,CAGpC,EAAgB,GAAO,OAAS,GAAO,UACvC,EAAgB,EAAS,OAAS,EAAS,UAOjD,OALI,GAAiB,IACnB,EAAS,MAAQ,GAAG,EAAc,GAAG,IACrC,EAAS,UAAY,IAAA,IAGhB,EAAY,cAAc,EAAK,EAAU,GAAG,EAAS,CAG9D,OAAO,EAAY,cAAc,EAAK,EAAO,GAAG,EAAS,EAE5D,EAiBY,EAA+B,CAC1C,GAAI,uBACJ,UAAY,GACV,OAAO,GAAS,UAChB,OAAO,GAAS,UAChB,OAAO,GAAS,SAClB,WAAY,EAAO,CAAE,WAAU,GAAG,KAChC,EAAmB,CACjB,GAAG,EACH,MAAO,EACP,cAAiB,CACf,UAAW,GAAe,OAAO,QAC7B,EACA,EACJ,MAAO,CACL,cAAe,EAAK,cACpB,QAAS,EAAK,QACf,CACS,WACX,EACF,CAAC,CACL,CAWY,EAAgC,CAC3C,GAAI,yBACJ,UAAY,GAAS,OAAO,GAAS,SACrC,WAAY,EAAc,EAAO,IAAsB,CACrD,GAAM,CACJ,UACA,GAAG,GACD,EAoBE,EAAgB,EAlBL,EAAoB,EAAK,CAkBQ,CAChD,QAAS,CAjBsB,CAC/B,GAAI,2BACJ,UAAY,GACV,OAAO,GAAiB,UACxB,OAAO,GAAiB,UACxB,OAAO,GAAiB,WACxB,CAAC,EACH,WAAY,EAAc,IACxB,EAAmB,CACjB,GAAG,EACH,MAAO,EACP,SAAU,EACX,CAAC,CACL,CAI2B,CAC1B,cAAe,EAAK,cACpB,QAAS,EAAE,CACZ,CAAC,CA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 {"version":3,"file":"plugins.mjs","names":[],"sources":["../../src/plugins.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport {\n conditionPlugin,\n type DeepTransformContent as DeepTransformContentCore,\n enumerationPlugin,\n filePlugin,\n genderPlugin,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n nestedPlugin,\n type Plugins,\n translationPlugin,\n} from '@intlayer/core/interpreter';\nimport {\n compile,\n getMarkdownMetadata,\n type MarkdownContent,\n} from '@intlayer/core/markdown';\nimport type { HTMLContent, InsertionContent } from '@intlayer/core/transpiler';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { NodeType } from '@intlayer/types/nodeType';\nimport { ContentSelectorWrapperComponent } from './editor/ContentSelector.component';\nimport { htmlRuntime, useMarkdown } from './markdown/installIntlayerMarkdown';\nimport { renderIntlayerNode } from './renderIntlayerNode';\n\n/** ---------------------------------------------\n * UTILS\n * --------------------------------------------- */\n\nconst createRuntimeWithOverides = (baseRuntime: any, overrides: any) => ({\n ...baseRuntime,\n createElement: (tag: string, props: any, ...children: any[]) => {\n const override = overrides?.[tag];\n\n if (override) {\n const newProps = { ...props, ...override };\n\n // Merge class attributes intelligently\n const originalClass = props?.class || props?.className;\n const overrideClass = override.class || override.className;\n\n if (originalClass && overrideClass) {\n newProps.class = `${originalClass} ${overrideClass}`;\n newProps.className = undefined;\n }\n\n return baseRuntime.createElement(tag, newProps, ...children);\n }\n\n return baseRuntime.createElement(tag, props, ...children);\n },\n});\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: configuration?.editor.enabled\n ? ContentSelectorWrapperComponent\n : children,\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 const render = (components?: any) =>\n renderIntlayerNode({\n ...rest,\n value: node,\n children: () => ({\n component: ContentSelectorWrapperComponent,\n props: {\n dictionaryKey: rest.dictionaryKey,\n keyPath: rest.keyPath,\n ...components,\n },\n children: () => {\n const { renderMarkdown } = useMarkdown();\n return renderMarkdown(node, components);\n },\n }),\n additionalProps: {\n metadata: metadataNodes,\n },\n });\n\n const createProxy = (element: any, components?: any) =>\n new Proxy(element, {\n get(target, prop, receiver) {\n if (prop === 'value') {\n return node;\n }\n if (prop === 'metadata') {\n return metadataNodes;\n }\n\n if (prop === 'toString') {\n return () => {\n const runtime = components\n ? createRuntimeWithOverides(htmlRuntime, components)\n : htmlRuntime;\n return compile(node, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === Symbol.toPrimitive) {\n return () => {\n const runtime = components\n ? createRuntimeWithOverides(htmlRuntime, components)\n : htmlRuntime;\n return compile(node, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === 'use') {\n return (newComponents?: any) => {\n const mergedComponents = { ...components, ...newComponents };\n return createProxy(render(mergedComponents), mergedComponents);\n };\n }\n\n return Reflect.get(target, prop, receiver);\n },\n }) as any;\n\n return createProxy(render() as any);\n },\n};\n\nexport type MarkdownCond<T, _S, _L extends LocalesValues> = T extends {\n nodeType: NodeType | string;\n [NodeType.Markdown]: infer M;\n tags?: infer U;\n metadata?: infer V;\n}\n ? IntlayerNode<\n M,\n {\n use: (components?: Record<keyof U, any>) => any;\n metadata: DeepTransformContent<V>;\n }\n >\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 * HTML PLUGIN\n * --------------------------------------------- */\n\n/**\n * HTML conditional type.\n *\n * This ensures type safety:\n * - `html('<div>Hello <CustomComponent /></div>').use({ CustomComponent: ... })` - optional but typed\n */\nexport type HTMLPluginCond<T, _S, _L> = T extends {\n nodeType: NodeType | string;\n [NodeType.HTML]: infer I;\n tags?: infer U;\n}\n ? IntlayerNode<\n I,\n {\n use: (components?: Record<keyof U, any>) => any;\n }\n >\n : never;\n\n/** HTML plugin. Replaces node with a function that takes components => IntlayerNode. */\nexport const htmlPlugin: Plugins = {\n id: 'html-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.HTML,\n\n transform: (node: HTMLContent<string>, props) => {\n const html = node[NodeType.HTML];\n const { plugins, ...rest } = props;\n\n // Type-safe render function that accepts properly typed components\n const render = (userComponents?: any) =>\n renderIntlayerNode({\n ...rest,\n value: html,\n children: () => ({\n component: ContentSelectorWrapperComponent,\n props: {\n dictionaryKey: rest.dictionaryKey,\n keyPath: rest.keyPath,\n ...userComponents,\n },\n children: html,\n }),\n });\n\n const createProxy = (element: any, components?: any) =>\n new Proxy(element, {\n get(target, prop, receiver) {\n if (prop === 'value') {\n return html;\n }\n\n if (prop === 'toString') {\n return () => {\n if (\n !components ||\n (typeof components === 'object' &&\n Object.keys(components).length === 0)\n ) {\n return String(html);\n }\n const runtime = createRuntimeWithOverides(\n htmlRuntime,\n components\n );\n return compile(html, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === Symbol.toPrimitive) {\n return () => {\n if (\n !components ||\n (typeof components === 'object' &&\n Object.keys(components).length === 0)\n ) {\n return String(html);\n }\n const runtime = createRuntimeWithOverides(\n htmlRuntime,\n components\n );\n return compile(html, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === 'use') {\n // Return a properly typed function based on custom components\n return (userComponents?: any) => {\n const mergedComponents = { ...components, ...userComponents };\n return createProxy(render(mergedComponents), mergedComponents);\n };\n }\n\n return Reflect.get(target, prop, receiver);\n },\n }) as any;\n\n return createProxy(render() as any);\n },\n};\n\n/** ---------------------------------------------\n * INSERTION PLUGIN\n * --------------------------------------------- */\n\n/**\n * Insertion conditional type.\n */\nexport type InsertionPluginCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeType.Insertion]: infer _I;\n}\n ? (args: Record<string, string | number>) => string\n : never;\n\nexport const insertionPlugin: Plugins = {\n id: 'insertion-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Insertion,\n transform: (node: InsertionContent, props) => {\n const { plugins, ...rest } = props;\n\n // Return a function that performs the interpolation\n const render = (args: Record<string, string | number> = {}) => {\n let text = node.insertion as string;\n if (args) {\n Object.entries(args).forEach(([key, value]) => {\n text = text.replace(\n new RegExp(`{{\\\\s*${key}\\\\s*}}`, 'g'),\n String(value)\n );\n });\n }\n return text;\n };\n\n return renderIntlayerNode({\n ...rest,\n value: render as any,\n children: render,\n });\n },\n};\n\nexport interface IInterpreterPluginAngular<T, S, L extends LocalesValues> {\n angularIntlayerNode: IntlayerNodeCond<T>;\n angularMarkdown: MarkdownCond<T, S, L>;\n angularHtml: HTMLPluginCond<T, S, L>;\n angularInsertion: InsertionPluginCond<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 = Omit<\n IInterpreterPluginStateCore,\n 'insertion' // Remove insertion type from core package\n> & {\n angularIntlayerNode: true;\n angularMarkdown: true;\n angularHtml: true;\n angularInsertion: true;\n};\n\nexport type DeepTransformContent<\n T,\n L extends LocalesValues = DeclaredLocales,\n> = DeepTransformContentCore<T, IInterpreterPluginState, L>;\n\n/**\n * Get the plugins array for Angular content transformation.\n * This function is used by both getIntlayer and getDictionary to ensure consistent plugin configuration.\n */\nexport const getPlugins = (\n locale?: LocalesValues,\n fallback: boolean = true\n): Plugins[] => [\n translationPlugin(\n locale ?? configuration.internationalization.defaultLocale,\n fallback ? configuration.internationalization.defaultLocale : undefined\n ),\n enumerationPlugin,\n conditionPlugin,\n nestedPlugin(locale ?? configuration.internationalization.defaultLocale),\n filePlugin,\n genderPlugin,\n intlayerNodePlugins,\n markdownPlugin,\n htmlPlugin,\n insertionPlugin,\n];\n"],"mappings":"ijBAgCA,MAAM,GAA6B,EAAkB,KAAoB,CACvE,GAAG,EACH,eAAgB,EAAa,EAAY,GAAG,IAAoB,CAC9D,IAAM,EAAW,IAAY,GAE7B,GAAI,EAAU,CACZ,IAAM,EA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AS,OAAO,gBAGd,CAAC,GACA,OAAO,GAAe,UACrB,OAAO,KAAK,EAAW,CAAC,SAAW,EAE9B,OAAO,EAAK,CAMd,EAAQ,EAAM,CACnB,QALc,EACd,EACA,EACD,CAGA,CAAC,CAIF,IAAS,MAEH,GAAyB,CAC/B,IAAM,EAAmB,CAAE,GAAG,EAAY,GAAG,EAAgB,CAC7D,OAAO,EAAY,EAAO,EAAiB,CAAE,EAAiB,EAI3D,QAAQ,IAAI,EAAQ,EAAM,EAAS,EAE7C,CAAC,CAEJ,OAAO,EAAY,GAAQ,CAAQ,EAEtC,CAgBY,EAA2B,CACtC,GAAI,mBACJ,UAAY,GACV,OAAO,GAAS,UAAY,GAAM,WAAa,EAAS,UAC1D,WAAY,EAAwB,IAAU,CAC5C,GAAM,CAAE,UAAS,GAAG,GAAS,EAGvB,GAAU,EAAwC,EAAE,GAAK,CAC7D,IAAI,EAAO,EAAK,UAShB,OARI,GACF,OAAO,QAAQ,EAAK,CAAC,SAAS,CAAC,EAAK,KAAW,CAC7C,EAAO,EAAK,QACN,OAAO,SAAS,EAAI,QAAS,IAAI,CACrC,OAAO,EAAM,CACd,EACD,CAEG,GAGT,OAAO,EAAmB,CACxB,GAAG,EACH,MAAO,EACP,SAAU,EACX,CAAC,EAEL,CAiCY,GACX,EACA,EAAoB,KACN,CACd,EACE,GAAU,EAAc,qBAAqB,cAC7C,EAAW,EAAc,qBAAqB,cAAgB,IAAA,GAC/D,CACD,EACA,EACA,EAAa,GAAU,EAAc,qBAAqB,cAAc,CACxE,EACA,EACA,EACA,EACA,EACA,EACD"}
@@ -1,9 +1,9 @@
1
1
  import { IInterpreterPluginState as IInterpreterPluginState$1 } from "../plugins.js";
2
- import { Locale } from "../intlayer/dist/types/index.js";
3
2
  import * as _angular_core0 from "@angular/core";
4
3
  import { DictionaryKeys, LocalesValues, StrictModeLocaleMap } from "@intlayer/types/module_augmentation";
5
4
  import { Dictionary } from "@intlayer/types/dictionary";
6
5
  import * as _intlayer_core_interpreter0 from "@intlayer/core/interpreter";
6
+ import * as _intlayer_types_allLocales0 from "@intlayer/types/allLocales";
7
7
 
8
8
  //#region src/client/useDictionaryDynamic.d.ts
9
9
  /**
@@ -11,7 +11,7 @@ import * as _intlayer_core_interpreter0 from "@intlayer/core/interpreter";
11
11
  *
12
12
  * If the locale is not provided, it will use the locale from the client context
13
13
  */
14
- declare const useDictionaryDynamic: <T extends Dictionary, K extends DictionaryKeys>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, key: K, locale?: LocalesValues) => _angular_core0.Signal<_intlayer_core_interpreter0.DeepTransformContent<T["content"], IInterpreterPluginState$1, Locale>>;
14
+ declare const useDictionaryDynamic: <T extends Dictionary, K extends DictionaryKeys>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, key: K, locale?: LocalesValues) => _angular_core0.Signal<_intlayer_core_interpreter0.DeepTransformContent<T["content"], IInterpreterPluginState$1, _intlayer_types_allLocales0.Locale>>;
15
15
  //#endregion
16
16
  export { useDictionaryDynamic };
17
17
  //# sourceMappingURL=useDictionaryDynamic.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionaryDynamic.d.ts","names":[],"sources":["../../../src/client/useDictionaryDynamic.ts"],"mappings":";;;;;;;;;;;;;cAea,oBAAA,aACD,UAAA,YACA,cAAA,EAEV,iBAAA,EAAmB,mBAAA,OAA0B,OAAA,CAAQ,CAAA,IACrD,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,aAAA,KAAa,cAAA,CAAA,MAAA,CAAA,2BAAA,CAAA,oBAAA,CAAA,CAAA,aAAA,yBAAA,EAAA,MAAA"}
1
+ {"version":3,"file":"useDictionaryDynamic.d.ts","names":[],"sources":["../../../src/client/useDictionaryDynamic.ts"],"mappings":";;;;;;;;;;;;;cAea,oBAAA,aACD,UAAA,YACA,cAAA,EAEV,iBAAA,EAAmB,mBAAA,OAA0B,OAAA,CAAQ,CAAA,IACrD,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,aAAA,KAAa,cAAA,CAAA,MAAA,CAAA,2BAAA,CAAA,oBAAA,CAAA,CAAA,aAAA,yBAAA,EAAA,2BAAA,CAAA,MAAA"}
@@ -1,6 +1,6 @@
1
- import { Locale } from "../intlayer/dist/types/index.js";
2
1
  import * as _angular_core0 from "@angular/core";
3
2
  import { LocalesValues } from "@intlayer/types/module_augmentation";
3
+ import * as _intlayer_types_allLocales0 from "@intlayer/types/allLocales";
4
4
 
5
5
  //#region src/client/useLocale.d.ts
6
6
  type useLocaleProps = {
@@ -39,8 +39,8 @@ declare const useLocale: ({
39
39
  onLocaleChange
40
40
  }?: useLocaleProps) => {
41
41
  locale: _angular_core0.Signal<"af" | "af-ZA" | "sq" | "sq-AL" | "am" | "am-ET" | "ar" | "ar-DZ" | "ar-BH" | "ar-TD" | "ar-KM" | "ar-DJ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MR" | "ar-MA" | "ar-OM" | "ar-PS" | "ar-QA" | "ar-SA" | "ar-SO" | "ar-SD" | "ar-SY" | "ar-TN" | "ar-AE" | "ar-YE" | "hy" | "hy-AM" | "az" | "az-AZ" | "eu" | "eu-ES" | "be" | "be-BY" | "bn" | "bn-BD" | "bn-IN" | "bn-MM" | "bs" | "bs-BA" | "bg" | "bg-BG" | "my" | "my-MM" | "ca" | "ca-ES" | "zh" | "zh-HK" | "zh-MO" | "zh-Hans" | "zh-CN" | "zh-SG" | "zh-TW" | "zh-Hant" | "hr" | "hr-BA" | "hr-HR" | "cs" | "cs-CZ" | "da" | "da-DK" | "dv" | "dv-MV" | "nl" | "nl-BE" | "nl-NL" | "en" | "en-AU" | "en-BZ" | "en-BW" | "en-CA" | "en-CB" | "en-GH" | "en-HK" | "en-IN" | "en-IE" | "en-JM" | "en-KE" | "en-MY" | "en-NZ" | "en-NG" | "en-PK" | "en-PH" | "en-SG" | "en-ZA" | "en-TZ" | "en-TT" | "en-UG" | "en-GB" | "en-US" | "en-ZW" | "eo" | "et" | "et-EE" | "fo" | "fo-FO" | "fa" | "fa-IR" | "fi" | "fi-FI" | "fr" | "fr-BE" | "fr-CA" | "fr-FR" | "fr-LU" | "fr-MC" | "fr-CH" | "mk" | "mk-MK" | "gl" | "gl-ES" | "ka" | "ka-GE" | "de" | "de-AT" | "de-DE" | "de-LI" | "de-LU" | "de-CH" | "el" | "el-GR" | "gu" | "gu-IN" | "he" | "he-IL" | "hi" | "hi-IN" | "hu" | "hu-HU" | "is" | "is-IS" | "id" | "id-ID" | "ga" | "ga-IE" | "it" | "it-IT" | "it-CH" | "ja" | "ja-JP" | "kn" | "kn-IN" | "kk" | "kk-KZ" | "km" | "km-KH" | "kok" | "kok-IN" | "ko" | "ko-KR" | "ku" | "ku-TR" | "ky" | "ky-KG" | "lo" | "lo-LA" | "lv" | "lv-LV" | "lt" | "lt-LT" | "dsb" | "dsb-DE" | "mg-MG" | "ms" | "ml" | "ml-IN" | "ms-BN" | "ms-MY" | "mt" | "mt-MT" | "mi" | "mi-NZ" | "mr" | "mr-IN" | "mn" | "mn-MN" | "ne" | "ne-NP" | "ns" | "ns-ZA" | "no" | "nb" | "nb-NO" | "nn" | "nn-NO" | "ps" | "ps-AR" | "pl" | "pl-PL" | "pt" | "pt-BR" | "pt-CV" | "pt-GW" | "pt-MO" | "pt-MZ" | "pt-PT" | "pt-ST" | "pt-TL" | "pa" | "pa-IN" | "qu" | "qu-BO" | "qu-EC" | "qu-PE" | "ro" | "ro-MD" | "ro-RO" | "rm" | "rm-CH" | "ru" | "ru-MD" | "ru-RU" | "se" | "se-FI" | "se-NO" | "se-SE" | "sa" | "sa-IN" | "gd" | "gd-GB" | "sr-Cyrl" | "sr-BA" | "sr-RS" | "sr" | "sr-SP" | "si" | "si-LK" | "sk" | "sk-SK" | "sl" | "sl-SI" | "es" | "es-AR" | "es-BO" | "es-CL" | "es-CO" | "es-CR" | "es-CU" | "es-DO" | "es-EC" | "es-SV" | "es-GT" | "es-HN" | "es-MX" | "es-NI" | "es-PA" | "es-PY" | "es-PE" | "es-PR" | "es-ES" | "es-US" | "es-UY" | "es-VE" | "sw" | "sw-KE" | "sv" | "sv-FI" | "sv-SE" | "syr" | "syr-SY" | "tl" | "tl-PH" | "ta" | "ta-IN" | "tt" | "tt-RU" | "te" | "te-IN" | "th" | "th-TH" | "ts" | "tn" | "tn-ZA" | "tr" | "tr-TR" | "uk" | "uk-UA" | "hsb" | "hsb-DE" | "ur" | "ur-PK" | "uz" | "uz-UZ" | "ve" | "ve-ZA" | "vi" | "vi-VN" | "cy" | "cy-GB" | "xh" | "xh-ZA" | "yi" | "yi-001" | "yo" | "yo-NG" | "zu" | "zu-ZA" | (string & {})>;
42
- defaultLocale: Locale;
43
- availableLocales: Locale[];
42
+ defaultLocale: _intlayer_types_allLocales0.Locale;
43
+ availableLocales: _intlayer_types_allLocales0.Locale[];
44
44
  setLocale: (newLocale: LocalesValues) => void;
45
45
  };
46
46
  //#endregion
@@ -1,5 +1,5 @@
1
- import { Locale } from "../intlayer/dist/types/index.js";
2
1
  import { LocalesValues } from "@intlayer/types/module_augmentation";
2
+ import * as _intlayer_types_allLocales0 from "@intlayer/types/allLocales";
3
3
 
4
4
  //#region src/client/useLocaleStorage.d.ts
5
5
  /**
@@ -8,13 +8,13 @@ import { LocalesValues } from "@intlayer/types/module_augmentation";
8
8
  /**
9
9
  * Get the locale cookie
10
10
  */
11
- declare const localeInStorage: Locale;
11
+ declare const localeInStorage: _intlayer_types_allLocales0.Locale;
12
12
  /**
13
13
  * @deprecated Use localeInStorage instead
14
14
  *
15
15
  * Get the locale cookie
16
16
  */
17
- declare const localeCookie: Locale;
17
+ declare const localeCookie: _intlayer_types_allLocales0.Locale;
18
18
  /**
19
19
  * Set the locale cookie
20
20
  */
@@ -29,7 +29,7 @@ declare const setLocaleCookie: (locale: LocalesValues, isCookieEnabled: boolean)
29
29
  * Hook that provides the locale storage and a function to set it
30
30
  */
31
31
  declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
32
- getLocale: () => Locale;
32
+ getLocale: () => _intlayer_types_allLocales0.Locale;
33
33
  setLocale: (locale: LocalesValues) => void;
34
34
  };
35
35
  /**
@@ -40,7 +40,7 @@ declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
40
40
  * Hook that provides the locale cookie and a function to set it
41
41
  */
42
42
  declare const useLocaleCookie: (isCookieEnabled?: boolean) => {
43
- localeCookie: Locale;
43
+ localeCookie: _intlayer_types_allLocales0.Locale;
44
44
  setLocaleCookie: (locale: LocalesValues) => void;
45
45
  };
46
46
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"useLocaleStorage.d.ts","names":[],"sources":["../../../src/client/useLocaleStorage.ts"],"mappings":";;;;;;;AAcA;;;AAAA,cAAa,eAAA,EAA4D,MAAA;;AAMzE;;;;cAAa,YAAA,EAA8B,MAAA;AAK3C;;;AAAA,cAAa,kBAAA,GACX,MAAA,EAAQ,aAAA,EACR,eAAA;;;;;;cAYW,eAAA,GAAe,MAAA,EAblB,aAAA,EAAa,eAAA;;;;cAkBV,gBAAA,GAAoB,eAAA;mBAI7B,MAAA;sBAAA,aAAA;AAAA;;AAJJ;;;;;;cAaa,eAAA,GAAmB,eAAA;gBAO/B,MAAA;4BAAA,aAAA;AAAA"}
1
+ {"version":3,"file":"useLocaleStorage.d.ts","names":[],"sources":["../../../src/client/useLocaleStorage.ts"],"mappings":";;;;;;;AAcA;;;AAAA,cAAa,eAAA,EAA4D,2BAAA,CAA7C,MAAA;;AAM5B;;;;cAAa,YAAA,EAA8B,2BAAA,CAAlB,MAAA;AAKzB;;;AAAA,cAAa,kBAAA,GACX,MAAA,EAAQ,aAAA,EACR,eAAA;;;;;;cAYW,eAAA,GAAe,MAAA,EAblB,aAAA,EAAa,eAAA;;;;cAkBV,gBAAA,GAAoB,eAAA;mBAI7B,2BAAA,CAAA,MAAA;sBAAA,aAAA;AAAA;;AAJJ;;;;;;cAaa,eAAA,GAAmB,eAAA;gBAO/B,2BAAA,CAAA,MAAA;4BAAA,aAAA;AAAA"}
@@ -0,0 +1,9 @@
1
+ //#region src/editor/ContentSelector.component.d.ts
2
+ declare class ContentSelectorWrapperComponent {
3
+ dictionaryKey: string;
4
+ keyPath: any[];
5
+ get keyPathJson(): string;
6
+ }
7
+ //#endregion
8
+ export { ContentSelectorWrapperComponent };
9
+ //# sourceMappingURL=ContentSelector.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentSelector.component.d.ts","names":[],"sources":["../../../src/editor/ContentSelector.component.ts"],"mappings":";cAea,+BAAA;EACF,aAAA;EACA,OAAA;EAAA,IAEL,WAAA,CAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useEditor.d.ts","names":[],"sources":["../../../src/editor/useEditor.ts"],"mappings":";cASa,SAAA"}
1
+ {"version":3,"file":"useEditor.d.ts","names":[],"sources":["../../../src/editor/useEditor.ts"],"mappings":";cAWa,SAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "angular-intlayer",
3
- "version": "8.3.3",
3
+ "version": "8.4.0-canary.0",
4
4
  "private": false,
5
5
  "description": "Easily internationalize i18n your Angular applications with type-safe multilingual content management.",
6
6
  "keywords": [
@@ -86,13 +86,13 @@
86
86
  "dependencies": {
87
87
  "@babel/plugin-syntax-import-attributes": "^7.28.6",
88
88
  "@babel/preset-env": "^7.29.0",
89
- "@intlayer/chokidar": "8.3.3",
90
- "@intlayer/config": "8.3.3",
91
- "@intlayer/core": "8.3.3",
92
- "@intlayer/dictionaries-entry": "8.3.3",
93
- "@intlayer/editor": "8.3.3",
94
- "@intlayer/types": "8.3.3",
95
- "@intlayer/webpack": "8.3.3",
89
+ "@intlayer/chokidar": "8.4.0-canary.0",
90
+ "@intlayer/config": "8.4.0-canary.0",
91
+ "@intlayer/core": "8.4.0-canary.0",
92
+ "@intlayer/dictionaries-entry": "8.4.0-canary.0",
93
+ "@intlayer/editor": "8.4.0-canary.0",
94
+ "@intlayer/types": "8.4.0-canary.0",
95
+ "@intlayer/webpack": "8.4.0-canary.0",
96
96
  "babel-loader": "^10.1.1",
97
97
  "defu": "6.1.4"
98
98
  },
@@ -103,7 +103,7 @@
103
103
  "@utils/ts-config-types": "1.0.4",
104
104
  "@utils/tsdown-config": "1.0.4",
105
105
  "rimraf": "6.1.3",
106
- "tsdown": "0.21.2",
106
+ "tsdown": "0.21.4",
107
107
  "typescript": "5.9.3",
108
108
  "vitest": "4.1.0"
109
109
  },
@@ -1,20 +0,0 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../_virtual/_@oxc-project_runtime@0.115.0/helpers/decorateMetadata.cjs`),t=require(`../_virtual/_@oxc-project_runtime@0.115.0/helpers/decorate.cjs`);let n=require(`@angular/common`),r=require(`@angular/core`);var i;let a=class{onClickOutside;pressDuration;isSelecting;click=new r.EventEmitter;press=new r.EventEmitter;containerRef;isHovered=(0,r.signal)(!1);isSelectingState=(0,r.signal)(!1);pressTimerRef=null;isSelectingComputed=(0,r.computed)(()=>this.isSelecting??this.isSelectingState());isStringSlot=(0,r.computed)(()=>!0);ngOnInit(){this.isSelectingState.set(this.isSelecting??!1)}ngOnDestroy(){this.clearPressTimer()}onDocumentMouseDown(e){this.handleClickOutside(e)}handleOnLongPress(){this.isSelectingState.set(!0),this.press.emit()}startPressTimer(){this.pressTimerRef=setTimeout(()=>{this.handleOnLongPress()},this.pressDuration??250)}clearPressTimer(){this.pressTimerRef&&=(clearTimeout(this.pressTimerRef),null)}handleMouseDown(){this.clearPressTimer(),this.startPressTimer()}handleMouseUp(){this.isHovered.set(!1),this.clearPressTimer()}handleClickOutside(e){this.containerRef?.nativeElement&&!this.containerRef.nativeElement.contains(e.target)&&(this.isSelectingState.set(!1),this.onClickOutside?.())}handleClick(e){this.isSelectingComputed()&&(e.preventDefault(),e.stopPropagation()),this.click.emit(e)}handleBlur(){this.isSelectingState.set(!1)}onMouseEnter(){this.isHovered.set(!0)}getContainerStyle(){return{display:this.isStringSlot()?`inline`:`inline-block`,cursor:`pointer`,userSelect:`none`,borderRadius:`0.375rem`,outlineWidth:`2px`,outlineOffset:`4px`,outlineStyle:`solid`,outlineColor:this.isSelectingComputed()||this.isHovered()?`inherit`:`transparent`,transition:`all 100ms 50ms ease-in-out`}}};t.__decorate([(0,r.Input)(),e.__decorateMetadata(`design:type`,Function)],a.prototype,`onClickOutside`,void 0),t.__decorate([(0,r.Input)(),e.__decorateMetadata(`design:type`,Number)],a.prototype,`pressDuration`,void 0),t.__decorate([(0,r.Input)(),e.__decorateMetadata(`design:type`,Boolean)],a.prototype,`isSelecting`,void 0),t.__decorate([(0,r.Output)(),e.__decorateMetadata(`design:type`,Object)],a.prototype,`click`,void 0),t.__decorate([(0,r.Output)(),e.__decorateMetadata(`design:type`,Object)],a.prototype,`press`,void 0),t.__decorate([(0,r.ViewChild)(`containerRef`,{static:!0}),e.__decorateMetadata(`design:type`,Object)],a.prototype,`containerRef`,void 0),t.__decorate([(0,r.HostListener)(`document:mousedown`,[`$event`]),e.__decorateMetadata(`design:type`,Function),e.__decorateMetadata(`design:paramtypes`,[typeof(i=typeof MouseEvent<`u`&&MouseEvent)==`function`?i:Object]),e.__decorateMetadata(`design:returntype`,void 0)],a.prototype,`onDocumentMouseDown`,null),a=t.__decorate([(0,r.Component)({selector:`app-content-selector`,template:`
2
- <span
3
- #containerRef
4
- role="button"
5
- tabindex="0"
6
- (click)="handleClick($event)"
7
- (mousedown)="handleMouseDown()"
8
- (mouseup)="handleMouseUp()"
9
- (mouseleave)="handleMouseUp()"
10
- (touchstart)="handleMouseDown()"
11
- (touchend)="handleMouseUp()"
12
- (touchcancel)="handleMouseUp()"
13
- (blur)="handleBlur()"
14
- (mouseenter)="onMouseEnter()"
15
- [ngStyle]="getContainerStyle()"
16
- >
17
- <ng-content></ng-content>
18
- </span>
19
- `,standalone:!0,imports:[n.CommonModule]})],a),Object.defineProperty(exports,`ContentSelectorComponent`,{enumerable:!0,get:function(){return a}});
20
- //# sourceMappingURL=ContentSelector.component.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ContentSelector.component.cjs","names":["EventEmitter","CommonModule"],"sources":["../../../src/UI/ContentSelector.component.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport {\n Component,\n computed,\n type ElementRef,\n EventEmitter,\n HostListener,\n Input,\n type OnDestroy,\n type OnInit,\n Output,\n signal,\n ViewChild,\n} from '@angular/core';\n\nconst DEFAULT_PRESS_DETECT_DURATION = 250;\n\n@Component({\n selector: 'app-content-selector',\n template: `\n <span\n #containerRef\n role=\"button\"\n tabindex=\"0\"\n (click)=\"handleClick($event)\"\n (mousedown)=\"handleMouseDown()\"\n (mouseup)=\"handleMouseUp()\"\n (mouseleave)=\"handleMouseUp()\"\n (touchstart)=\"handleMouseDown()\"\n (touchend)=\"handleMouseUp()\"\n (touchcancel)=\"handleMouseUp()\"\n (blur)=\"handleBlur()\"\n (mouseenter)=\"onMouseEnter()\"\n [ngStyle]=\"getContainerStyle()\"\n >\n <ng-content></ng-content>\n </span>\n `,\n standalone: true,\n imports: [CommonModule],\n})\nexport class ContentSelectorComponent implements OnInit, OnDestroy {\n @Input() onClickOutside?: () => void;\n @Input() pressDuration?: number;\n @Input() isSelecting?: boolean;\n\n @Output() click = new EventEmitter<MouseEvent>();\n @Output() press = new EventEmitter<void>();\n\n @ViewChild('containerRef', { static: true })\n containerRef!: ElementRef<HTMLSpanElement>;\n\n private isHovered = signal(false);\n private isSelectingState = signal(false);\n private pressTimerRef: ReturnType<typeof setTimeout> | null = null;\n\n private readonly isSelectingComputed = computed(\n () => this.isSelecting ?? this.isSelectingState()\n );\n\n private readonly isStringSlot = computed(() => {\n // In Angular, we can't easily detect if content is just text\n // This would need to be determined differently or simplified\n return true; // Simplified for now\n });\n\n ngOnInit(): void {\n this.isSelectingState.set(this.isSelecting ?? false);\n }\n\n ngOnDestroy(): void {\n this.clearPressTimer();\n }\n\n @HostListener('document:mousedown', ['$event'])\n onDocumentMouseDown(event: MouseEvent): void {\n this.handleClickOutside(event);\n }\n\n private handleOnLongPress(): void {\n this.isSelectingState.set(true);\n this.press.emit();\n }\n\n private startPressTimer(): void {\n this.pressTimerRef = setTimeout(() => {\n this.handleOnLongPress();\n }, this.pressDuration ?? DEFAULT_PRESS_DETECT_DURATION);\n }\n\n private clearPressTimer(): void {\n if (this.pressTimerRef) {\n clearTimeout(this.pressTimerRef);\n this.pressTimerRef = null;\n }\n }\n\n handleMouseDown(): void {\n this.clearPressTimer();\n this.startPressTimer();\n }\n\n handleMouseUp(): void {\n this.isHovered.set(false);\n this.clearPressTimer();\n }\n\n private handleClickOutside(event: MouseEvent): void {\n if (\n this.containerRef?.nativeElement &&\n !this.containerRef.nativeElement.contains(event.target as Node)\n ) {\n this.isSelectingState.set(false);\n this.onClickOutside?.();\n }\n }\n\n handleClick(e: MouseEvent): void {\n if (this.isSelectingComputed()) {\n e.preventDefault();\n e.stopPropagation();\n }\n this.click.emit(e);\n }\n\n handleBlur(): void {\n this.isSelectingState.set(false);\n }\n\n onMouseEnter(): void {\n this.isHovered.set(true);\n }\n\n getContainerStyle(): { [key: string]: any } {\n return {\n display: this.isStringSlot() ? 'inline' : 'inline-block',\n cursor: 'pointer',\n userSelect: 'none',\n borderRadius: '0.375rem',\n outlineWidth: '2px',\n outlineOffset: '4px',\n outlineStyle: 'solid',\n outlineColor:\n this.isSelectingComputed() || this.isHovered()\n ? 'inherit'\n : 'transparent',\n transition: 'all 100ms 50ms ease-in-out',\n };\n }\n}\n"],"mappings":"wVAyCO,IAAA,EAAA,KAA4D,CACjE,eACA,cACA,YAEA,MAAkB,IAAIA,EAAAA,aACtB,MAAkB,IAAIA,EAAAA,aAEtB,aAGA,WAAQ,EAAA,EAAA,QAAmB,GAAM,CACjC,kBAAQ,EAAA,EAAA,QAA0B,GAAM,CACxC,cAA8D,KAE9D,qBAAiB,EAAA,EAAA,cACT,KAAK,aAAe,KAAK,kBAAkB,CAClD,CAED,cAAiB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4BACA,CAAA,EAAA,mBAAA,cAAA,QAAA,CAAA,CAAA,EAAA,UAAA,cAAA,IAAA,GAAA,6BAEC,CAAA,EAAA,mBAAA,cAAA,OAAA,CAAA,CAAA,EAAA,UAAA,QAAA,IAAA,GAAA,6BACA,CAAA,EAAA,mBAAA,cAAA,OAAA,CAAA,CAAA,EAAA,UAAA,QAAA,IAAA,GAAA,+BAEE,eAAgB,CAAE,OAAQ,GAAM,CAAC,CAAA,EAAA,mBAAA,cAAA,OAAA,CAAA,CAAA,EAAA,UAAA,eAAA,IAAA,GAAA,kCAyB9B,qBAAsB,CAAC,SAAS,CAAC,qRAzDtC,CACT,SAAU,uBACV,SAAU;;;;;;;;;;;;;;;;;;IAmBV,WAAY,GACZ,QAAS,CAACC,EAAAA,aAAa,CACxB,CAAC,CAAA,CAAA,EAAA"}
@@ -1,11 +0,0 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../_virtual/_@oxc-project_runtime@0.115.0/helpers/decorateMetadata.cjs`),t=require(`../_virtual/_@oxc-project_runtime@0.115.0/helpers/decorate.cjs`),n=require(`../UI/ContentSelector.component.cjs`),r=require(`./editorEnabled.cjs`),i=require(`./focusDictionary.cjs`),a=require(`./useEditor.cjs`);let o=require(`@intlayer/types/nodeType`),s=require(`@angular/common`),c=require(`@angular/core`),l=require(`@intlayer/core/utils`),u=class{dictionaryKey;keyPath;focusDictionary=i.useFocusDictionary();editorEnabled=r.useEditorEnabled();constructor(){a.useEditor()}isSelected=(0,c.computed)(()=>{let e=this.focusDictionary.focusedContent();return e?.dictionaryKey===this.dictionaryKey&&(e.keyPath?.length??0)>0&&(0,l.isSameKeyPath)(e.keyPath??[],this.keyPath)});enabled=(0,c.computed)(()=>this.editorEnabled.enabled());handleSelect(){this.focusDictionary.setFocusedContent({dictionaryKey:this.dictionaryKey,keyPath:this.keyPath.filter(e=>e.type!==o.NodeType.Translation)})}};t.__decorate([(0,c.Input)(),e.__decorateMetadata(`design:type`,String)],u.prototype,`dictionaryKey`,void 0),t.__decorate([(0,c.Input)(),e.__decorateMetadata(`design:type`,Array)],u.prototype,`keyPath`,void 0),u=t.__decorate([(0,c.Component)({selector:`app-content-selector-wrapper`,standalone:!0,imports:[s.CommonModule,n.ContentSelectorComponent],template:`
2
- <app-content-selector
3
- *ngIf="enabled()"
4
- (press)="handleSelect()"
5
- [isSelecting]="isSelected()"
6
- >
7
- <ng-content></ng-content>
8
- </app-content-selector>
9
- <ng-content *ngIf="!enabled()"></ng-content>
10
- `}),e.__decorateMetadata(`design:paramtypes`,[])],u),Object.defineProperty(exports,`ContentSelectorWrapperComponent`,{enumerable:!0,get:function(){return u}});
11
- //# sourceMappingURL=ContentSelectorWrapper.component.cjs.map