angular-intlayer 8.3.2 → 8.3.4

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 (96) hide show
  1. package/dist/cjs/editor/ContentSelectorWrapper.component.cjs +14 -9
  2. package/dist/cjs/editor/ContentSelectorWrapper.component.cjs.map +1 -1
  3. package/dist/cjs/editor/EditedContentRenderer.component.cjs +1 -1
  4. package/dist/cjs/editor/EditedContentRenderer.component.cjs.map +1 -1
  5. package/dist/cjs/editor/communicator.cjs +1 -1
  6. package/dist/cjs/editor/communicator.cjs.map +1 -1
  7. package/dist/cjs/editor/configuration.cjs +1 -1
  8. package/dist/cjs/editor/configuration.cjs.map +1 -1
  9. package/dist/cjs/editor/dictionariesRecord.cjs +1 -1
  10. package/dist/cjs/editor/dictionariesRecord.cjs.map +1 -1
  11. package/dist/cjs/editor/editedContent.cjs +1 -1
  12. package/dist/cjs/editor/editedContent.cjs.map +1 -1
  13. package/dist/cjs/editor/editorEnabled.cjs +1 -1
  14. package/dist/cjs/editor/editorEnabled.cjs.map +1 -1
  15. package/dist/cjs/editor/editorLocale.cjs +1 -1
  16. package/dist/cjs/editor/editorLocale.cjs.map +1 -1
  17. package/dist/cjs/editor/focusDictionary.cjs +1 -1
  18. package/dist/cjs/editor/focusDictionary.cjs.map +1 -1
  19. package/dist/cjs/editor/index.cjs +1 -1
  20. package/dist/cjs/editor/installIntlayerEditor.cjs +1 -1
  21. package/dist/cjs/editor/installIntlayerEditor.cjs.map +1 -1
  22. package/dist/cjs/editor/useCrossFrameMessageListener.cjs +1 -1
  23. package/dist/cjs/editor/useCrossFrameMessageListener.cjs.map +1 -1
  24. package/dist/cjs/editor/useCrossFrameState.cjs +1 -1
  25. package/dist/cjs/editor/useCrossFrameState.cjs.map +1 -1
  26. package/dist/cjs/editor/useCrossURLPathState.cjs +1 -1
  27. package/dist/cjs/editor/useCrossURLPathState.cjs.map +1 -1
  28. package/dist/cjs/editor/useEditor.cjs +1 -1
  29. package/dist/cjs/editor/useEditor.cjs.map +1 -1
  30. package/dist/cjs/editor/useIframeClickInterceptor.cjs +1 -1
  31. package/dist/cjs/editor/useIframeClickInterceptor.cjs.map +1 -1
  32. package/dist/esm/editor/ContentSelectorWrapper.component.mjs +14 -9
  33. package/dist/esm/editor/ContentSelectorWrapper.component.mjs.map +1 -1
  34. package/dist/esm/editor/EditedContentRenderer.component.mjs +1 -1
  35. package/dist/esm/editor/EditedContentRenderer.component.mjs.map +1 -1
  36. package/dist/esm/editor/communicator.mjs +1 -1
  37. package/dist/esm/editor/communicator.mjs.map +1 -1
  38. package/dist/esm/editor/configuration.mjs +1 -1
  39. package/dist/esm/editor/configuration.mjs.map +1 -1
  40. package/dist/esm/editor/dictionariesRecord.mjs +1 -1
  41. package/dist/esm/editor/dictionariesRecord.mjs.map +1 -1
  42. package/dist/esm/editor/editedContent.mjs +1 -1
  43. package/dist/esm/editor/editedContent.mjs.map +1 -1
  44. package/dist/esm/editor/editorEnabled.mjs +1 -1
  45. package/dist/esm/editor/editorEnabled.mjs.map +1 -1
  46. package/dist/esm/editor/editorLocale.mjs +1 -1
  47. package/dist/esm/editor/editorLocale.mjs.map +1 -1
  48. package/dist/esm/editor/focusDictionary.mjs +1 -1
  49. package/dist/esm/editor/focusDictionary.mjs.map +1 -1
  50. package/dist/esm/editor/index.mjs +1 -1
  51. package/dist/esm/editor/installIntlayerEditor.mjs +1 -1
  52. package/dist/esm/editor/installIntlayerEditor.mjs.map +1 -1
  53. package/dist/esm/editor/useCrossFrameMessageListener.mjs +1 -1
  54. package/dist/esm/editor/useCrossFrameMessageListener.mjs.map +1 -1
  55. package/dist/esm/editor/useCrossFrameState.mjs +1 -1
  56. package/dist/esm/editor/useCrossFrameState.mjs.map +1 -1
  57. package/dist/esm/editor/useCrossURLPathState.mjs +1 -1
  58. package/dist/esm/editor/useCrossURLPathState.mjs.map +1 -1
  59. package/dist/esm/editor/useEditor.mjs +1 -1
  60. package/dist/esm/editor/useEditor.mjs.map +1 -1
  61. package/dist/esm/editor/useIframeClickInterceptor.mjs +1 -1
  62. package/dist/esm/editor/useIframeClickInterceptor.mjs.map +1 -1
  63. package/dist/types/client/useDictionaryDynamic.d.ts +2 -2
  64. package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -1
  65. package/dist/types/client/useLocale.d.ts +3 -3
  66. package/dist/types/client/useLocaleStorage.d.ts +5 -5
  67. package/dist/types/client/useLocaleStorage.d.ts.map +1 -1
  68. package/dist/types/editor/ContentSelectorWrapper.component.d.ts +9 -12
  69. package/dist/types/editor/ContentSelectorWrapper.component.d.ts.map +1 -1
  70. package/dist/types/editor/communicator.d.ts +3 -27
  71. package/dist/types/editor/communicator.d.ts.map +1 -1
  72. package/dist/types/editor/configuration.d.ts +4 -1
  73. package/dist/types/editor/configuration.d.ts.map +1 -1
  74. package/dist/types/editor/dictionariesRecord.d.ts +6 -12
  75. package/dist/types/editor/dictionariesRecord.d.ts.map +1 -1
  76. package/dist/types/editor/editedContent.d.ts +27 -16
  77. package/dist/types/editor/editedContent.d.ts.map +1 -1
  78. package/dist/types/editor/editorEnabled.d.ts +4 -15
  79. package/dist/types/editor/editorEnabled.d.ts.map +1 -1
  80. package/dist/types/editor/editorLocale.d.ts.map +1 -1
  81. package/dist/types/editor/focusDictionary.d.ts +6 -20
  82. package/dist/types/editor/focusDictionary.d.ts.map +1 -1
  83. package/dist/types/editor/index.d.ts +13 -2
  84. package/dist/types/editor/installIntlayerEditor.d.ts +4 -17
  85. package/dist/types/editor/installIntlayerEditor.d.ts.map +1 -1
  86. package/dist/types/editor/useCrossFrameMessageListener.d.ts +0 -8
  87. package/dist/types/editor/useCrossFrameMessageListener.d.ts.map +1 -1
  88. package/dist/types/editor/useCrossFrameState.d.ts +2 -16
  89. package/dist/types/editor/useCrossFrameState.d.ts.map +1 -1
  90. package/dist/types/editor/useCrossURLPathState.d.ts +2 -17
  91. package/dist/types/editor/useCrossURLPathState.d.ts.map +1 -1
  92. package/dist/types/editor/useEditor.d.ts.map +1 -1
  93. package/dist/types/editor/useIframeClickInterceptor.d.ts +0 -8
  94. package/dist/types/editor/useIframeClickInterceptor.d.ts.map +1 -1
  95. package/dist/types/intlayer/dist/types/index.d.ts +3 -0
  96. package/package.json +9 -9
@@ -1,11 +1,16 @@
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
- >
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./installIntlayerEditor.cjs`),t=require(`./editorEnabled.cjs`),n=require(`./focusDictionary.cjs`),r=require(`../_virtual/_@oxc-project_runtime@0.115.0/helpers/decorateMetadata.cjs`),i=require(`../_virtual/_@oxc-project_runtime@0.115.0/helpers/decorate.cjs`);let a=require(`@intlayer/types/nodeType`),o=require(`@angular/common`),s=require(`@angular/core`),c=require(`@intlayer/core/utils`),l=require(`@intlayer/editor`),u=class{dictionaryKey;keyPath;focusDictionary=n.useFocusDictionary();editorEnabled=t.useEditorEnabled();manager=e.getEditorStateManager();ngOnInit(){(0,l.defineIntlayerElements)()}get filteredKeyPath(){return this.keyPath.filter(e=>e.type!==a.NodeType.Translation)}isSelected=(0,s.computed)(()=>{let e=this.focusDictionary.focusedContent();return e?.dictionaryKey===this.dictionaryKey&&(e.keyPath?.length??0)>0&&(0,c.isSameKeyPath)(e.keyPath??[],this.filteredKeyPath)});enabled=(0,s.computed)(()=>this.editorEnabled.enabled());handlePress(){this.focusDictionary.setFocusedContent?.({dictionaryKey:this.dictionaryKey,keyPath:this.filteredKeyPath})}handleHover(){this.manager?.messenger.send(`${l.MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,{dictionaryKey:this.dictionaryKey,keyPath:this.filteredKeyPath})}handleUnhover(){this.manager?.messenger.send(`${l.MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,null)}};i.__decorate([(0,s.Input)(),r.__decorateMetadata(`design:type`,String)],u.prototype,`dictionaryKey`,void 0),i.__decorate([(0,s.Input)(),r.__decorateMetadata(`design:type`,Array)],u.prototype,`keyPath`,void 0),u=i.__decorate([(0,s.Component)({selector:`app-content-selector-wrapper`,standalone:!0,imports:[o.CommonModule],schemas:[o.CUSTOM_ELEMENTS_SCHEMA],template:`
2
+ <ng-container *ngIf="enabled(); else plainContent">
3
+ <intlayer-content-selector
4
+ [attr.is-selecting]="isSelected() || null"
5
+ (intlayer:press)="handlePress()"
6
+ (intlayer:hover)="handleHover()"
7
+ (intlayer:unhover)="handleUnhover()"
8
+ >
9
+ <ng-content></ng-content>
10
+ </intlayer-content-selector>
11
+ </ng-container>
12
+ <ng-template #plainContent>
7
13
  <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}});
14
+ </ng-template>
15
+ `})],u),Object.defineProperty(exports,`ContentSelectorWrapperComponent`,{enumerable:!0,get:function(){return u}});
11
16
  //# sourceMappingURL=ContentSelectorWrapper.component.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ContentSelectorWrapper.component.cjs","names":["useFocusDictionary","useEditorEnabled","NodeType","CommonModule","ContentSelectorComponent"],"sources":["../../../src/editor/ContentSelectorWrapper.component.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, computed, Input } from '@angular/core';\nimport type { NodeProps } from '@intlayer/core/interpreter';\nimport { isSameKeyPath } from '@intlayer/core/utils';\nimport { NodeType } from '@intlayer/types/nodeType';\nimport { ContentSelectorComponent } from '../UI/ContentSelector.component';\nimport { useEditorEnabled } from './editorEnabled';\nimport { useFocusDictionary } from './focusDictionary';\nimport { useEditor } from './useEditor';\n\n/**\n * Combine your NodeProps (which include dictionaryKey & keyPath)\n * with any other div-like attributes.\n */\nexport interface ContentSelectorWrapperProps extends NodeProps {\n [key: string]: any;\n}\n\n@Component({\n selector: 'app-content-selector-wrapper',\n standalone: true,\n imports: [CommonModule, ContentSelectorComponent],\n template: `\n <app-content-selector\n *ngIf=\"enabled()\"\n (press)=\"handleSelect()\"\n [isSelecting]=\"isSelected()\"\n >\n <ng-content></ng-content>\n </app-content-selector>\n <ng-content *ngIf=\"!enabled()\"></ng-content>\n `,\n})\nexport class ContentSelectorWrapperComponent {\n @Input() dictionaryKey!: string;\n @Input() keyPath!: any[];\n\n // pull in the editor state & focus API\n private focusDictionary = useFocusDictionary();\n private editorEnabled = useEditorEnabled();\n\n constructor() {\n useEditor();\n }\n\n // compute whether this node is the current focus\n isSelected = computed(() => {\n const focusedContent = this.focusDictionary.focusedContent();\n return (\n focusedContent?.dictionaryKey === this.dictionaryKey &&\n (focusedContent.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(focusedContent.keyPath ?? [], this.keyPath)\n );\n });\n\n enabled = computed(() => this.editorEnabled.enabled());\n\n // when the selector is clicked, update focus\n handleSelect() {\n this.focusDictionary.setFocusedContent({\n dictionaryKey: this.dictionaryKey,\n keyPath: this.keyPath.filter((key) => key.type !== NodeType.Translation),\n });\n }\n}\n"],"mappings":"4iBAiCO,EAAA,KAAsC,CAC3C,cACA,QAGA,gBAA0BA,EAAAA,oBAAoB,CAC9C,cAAwBC,EAAAA,kBAAkB,CAE1C,aAAc,CACZ,EAAA,WAAW,CAIb,YAAA,EAAA,EAAA,cAA4B,CAC1B,IAAM,EAAiB,KAAK,gBAAgB,gBAAgB,CAC5D,OACE,GAAgB,gBAAkB,KAAK,gBACtC,EAAe,SAAS,QAAU,GAAK,IAAA,EAAA,EAAA,eAC1B,EAAe,SAAW,EAAE,CAAE,KAAK,QAAQ,EAE3D,CAEF,SAAA,EAAA,EAAA,cAAyB,KAAK,cAAc,SAAS,CAAC,CAGtD,cAAe,CACb,KAAK,gBAAgB,kBAAkB,CACrC,cAAe,KAAK,cACpB,QAAS,KAAK,QAAQ,OAAQ,GAAQ,EAAI,OAASC,EAAAA,SAAS,YAAY,CACzE,CAAC,8BA5BI,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,iCAjBC,CACT,SAAU,+BACV,WAAY,GACZ,QAAS,CAACC,EAAAA,aAAcC,EAAAA,yBAAyB,CACjD,SAAU;;;;;;;;;IAUX,CAAC,CAAA,EAAA,mBAAA,oBAAA,EAAA,CAAA,CAAA,CAAA,EAAA"}
1
+ {"version":3,"file":"ContentSelectorWrapper.component.cjs","names":["useFocusDictionary","useEditorEnabled","getEditorStateManager","NodeType","MessageKey","CommonModule","CUSTOM_ELEMENTS_SCHEMA"],"sources":["../../../src/editor/ContentSelectorWrapper.component.ts"],"sourcesContent":["import { CommonModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/common';\nimport { Component, computed, Input, type OnInit } from '@angular/core';\nimport type { NodeProps } from '@intlayer/core/interpreter';\nimport { isSameKeyPath } from '@intlayer/core/utils';\nimport { defineIntlayerElements, MessageKey } from '@intlayer/editor';\nimport { NodeType } from '@intlayer/types/nodeType';\nimport { useEditorEnabled } from './editorEnabled';\nimport { useFocusDictionary } from './focusDictionary';\nimport { getEditorStateManager } from './installIntlayerEditor';\n\n@Component({\n selector: 'app-content-selector-wrapper',\n standalone: true,\n imports: [CommonModule],\n schemas: [CUSTOM_ELEMENTS_SCHEMA],\n template: `\n <ng-container *ngIf=\"enabled(); else plainContent\">\n <intlayer-content-selector\n [attr.is-selecting]=\"isSelected() || null\"\n (intlayer:press)=\"handlePress()\"\n (intlayer:hover)=\"handleHover()\"\n (intlayer:unhover)=\"handleUnhover()\"\n >\n <ng-content></ng-content>\n </intlayer-content-selector>\n </ng-container>\n <ng-template #plainContent>\n <ng-content></ng-content>\n </ng-template>\n `,\n})\nexport class ContentSelectorWrapperComponent implements OnInit {\n @Input() dictionaryKey!: string;\n @Input() keyPath!: any[];\n\n private focusDictionary = useFocusDictionary();\n private editorEnabled = useEditorEnabled();\n private manager = getEditorStateManager();\n\n ngOnInit() {\n defineIntlayerElements();\n }\n\n get filteredKeyPath() {\n return this.keyPath.filter((key) => key.type !== NodeType.Translation);\n }\n\n isSelected = computed(() => {\n const focused = this.focusDictionary.focusedContent();\n return (\n focused?.dictionaryKey === this.dictionaryKey &&\n (focused.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(focused.keyPath ?? [], this.filteredKeyPath)\n );\n });\n\n enabled = computed(() => this.editorEnabled.enabled());\n\n handlePress() {\n this.focusDictionary.setFocusedContent?.({\n dictionaryKey: this.dictionaryKey,\n keyPath: this.filteredKeyPath,\n });\n }\n\n handleHover() {\n this.manager?.messenger.send(\n `${MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,\n { dictionaryKey: this.dictionaryKey, keyPath: this.filteredKeyPath }\n );\n }\n\n handleUnhover() {\n this.manager?.messenger.send(\n `${MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,\n null\n );\n }\n}\n"],"mappings":"qiBA+BO,EAAA,KAAwD,CAC7D,cACA,QAEA,gBAA0BA,EAAAA,oBAAoB,CAC9C,cAAwBC,EAAAA,kBAAkB,CAC1C,QAAkBC,EAAAA,uBAAuB,CAEzC,UAAW,EACT,EAAA,EAAA,yBAAwB,CAG1B,IAAI,iBAAkB,CACpB,OAAO,KAAK,QAAQ,OAAQ,GAAQ,EAAI,OAASC,EAAAA,SAAS,YAAY,CAGxE,YAAA,EAAA,EAAA,cAA4B,CAC1B,IAAM,EAAU,KAAK,gBAAgB,gBAAgB,CACrD,OACE,GAAS,gBAAkB,KAAK,gBAC/B,EAAQ,SAAS,QAAU,GAAK,IAAA,EAAA,EAAA,eACnB,EAAQ,SAAW,EAAE,CAAE,KAAK,gBAAgB,EAE5D,CAEF,SAAA,EAAA,EAAA,cAAyB,KAAK,cAAc,SAAS,CAAC,CAEtD,aAAc,CACZ,KAAK,gBAAgB,oBAAoB,CACvC,cAAe,KAAK,cACpB,QAAS,KAAK,gBACf,CAAC,CAGJ,aAAc,CACZ,KAAK,SAAS,UAAU,KACtB,GAAGC,EAAAA,WAAW,iCAAiC,OAC/C,CAAE,cAAe,KAAK,cAAe,QAAS,KAAK,gBAAiB,CACrE,CAGH,eAAgB,CACd,KAAK,SAAS,UAAU,KACtB,GAAGA,EAAAA,WAAW,iCAAiC,OAC/C,KACD,8BA5CK,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,iCAvBC,CACT,SAAU,+BACV,WAAY,GACZ,QAAS,CAACC,EAAAA,aAAa,CACvB,QAAS,CAACC,EAAAA,uBAAuB,CACjC,SAAU;;;;;;;;;;;;;;IAeX,CAAC,CAAA,CAAA,EAAA"}
@@ -1,2 +1,2 @@
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(`./useEditedContentRenderer.cjs`);let r=require(`@intlayer/core/interpreter`),i=require(`@angular/common`),a=require(`@angular/core`),o=class{dictionaryKey;keyPath;locale;fallback=(0,a.signal)(``);rawContent=(0,a.computed)(()=>n.useEditedContentRenderer(this.dictionaryKey,this.keyPath,this.fallback));renderedContent=(0,a.computed)(()=>{let e=this.rawContent();if(typeof e==`object`&&e){let t=(0,r.getContent)(e,{dictionaryKey:this.dictionaryKey,keyPath:this.keyPath},this.locale);return typeof t==`string`?t:(console.error(`Incorrect edited content format. Content type: ${typeof t}. Expected string. Value ${JSON.stringify(t)}`),this.fallback())}return e()})};t.__decorate([(0,a.Input)(),e.__decorateMetadata(`design:type`,String)],o.prototype,`dictionaryKey`,void 0),t.__decorate([(0,a.Input)(),e.__decorateMetadata(`design:type`,Array)],o.prototype,`keyPath`,void 0),t.__decorate([(0,a.Input)(),e.__decorateMetadata(`design:type`,Object)],o.prototype,`locale`,void 0),o=t.__decorate([(0,a.Component)({selector:`app-edited-content-renderer`,standalone:!0,imports:[i.CommonModule],template:` <span [innerHTML]="renderedContent()"></span> `})],o),Object.defineProperty(exports,`EditedContentRendererComponent`,{enumerable:!0,get:function(){return o}});
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(`./useEditedContentRenderer.cjs`);let r=require(`@intlayer/core/interpreter`),i=require(`@angular/common`),a=require(`@angular/core`),o=class{dictionaryKey;keyPath;locale;fallback=(0,a.signal)(``);rawContent=(0,a.computed)(()=>n.useEditedContentRenderer(this.dictionaryKey,this.keyPath,this.fallback));renderedContent=(0,a.computed)(()=>{let e=this.rawContent();if(typeof e==`object`&&e){let t=(0,r.getContent)(e,{dictionaryKey:this.dictionaryKey,keyPath:this.keyPath,locale:this.locale},(0,r.getBasePlugins)(this.locale));return typeof t==`string`?t:(console.error(`Incorrect edited content format. Content type: ${typeof t}. Expected string. Value ${JSON.stringify(t)}`),this.fallback())}return e()})};t.__decorate([(0,a.Input)(),e.__decorateMetadata(`design:type`,String)],o.prototype,`dictionaryKey`,void 0),t.__decorate([(0,a.Input)(),e.__decorateMetadata(`design:type`,Array)],o.prototype,`keyPath`,void 0),t.__decorate([(0,a.Input)(),e.__decorateMetadata(`design:type`,Object)],o.prototype,`locale`,void 0),o=t.__decorate([(0,a.Component)({selector:`app-edited-content-renderer`,standalone:!0,imports:[i.CommonModule],template:` <span [innerHTML]="renderedContent()"></span> `})],o),Object.defineProperty(exports,`EditedContentRendererComponent`,{enumerable:!0,get:function(){return o}});
2
2
  //# sourceMappingURL=EditedContentRenderer.component.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"EditedContentRenderer.component.cjs","names":["useEditedContentRenderer","CommonModule"],"sources":["../../../src/editor/EditedContentRenderer.component.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, computed, Input, signal } from '@angular/core';\nimport { getContent } from '@intlayer/core/interpreter';\nimport type { ContentNode } from '@intlayer/types/dictionary';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport { useEditedContentRenderer } from './useEditedContentRenderer';\n\nexport interface EditedContentRendererProps {\n dictionaryKey: string;\n keyPath: KeyPath[];\n locale?: Locale;\n}\n\n@Component({\n selector: 'app-edited-content-renderer',\n standalone: true,\n imports: [CommonModule],\n template: ` <span [innerHTML]=\"renderedContent()\"></span> `,\n})\nexport class EditedContentRendererComponent {\n @Input() dictionaryKey!: string;\n @Input() keyPath!: KeyPath[];\n @Input() locale?: Locale;\n\n private fallback = signal('');\n\n private rawContent = computed(() => {\n return useEditedContentRenderer(\n this.dictionaryKey,\n this.keyPath,\n this.fallback\n );\n });\n\n /**\n * Object → getContent → string, same as the React version.\n */\n renderedContent = computed(() => {\n const rawContentValue = this.rawContent();\n\n if (typeof rawContentValue === 'object' && rawContentValue !== null) {\n const transformed = getContent(\n rawContentValue as ContentNode,\n {\n dictionaryKey: this.dictionaryKey,\n keyPath: this.keyPath,\n },\n this.locale\n );\n\n if (typeof transformed !== 'string') {\n console.error(\n `Incorrect edited content format. Content type: ${typeof transformed}. Expected string. Value ${JSON.stringify(\n transformed\n )}`\n );\n return this.fallback();\n }\n return transformed;\n }\n\n return rawContentValue() as string;\n });\n}\n"],"mappings":"saAoBO,EAAA,KAAqC,CAC1C,cACA,QACA,OAEA,UAAQ,EAAA,EAAA,QAAkB,GAAG,CAE7B,YAAQ,EAAA,EAAA,cACCA,EAAAA,yBACL,KAAK,cACL,KAAK,QACL,KAAK,SACN,CACD,CAKF,iBAAA,EAAA,EAAA,cAAiC,CAC/B,IAAM,EAAkB,KAAK,YAAY,CAEzC,GAAI,OAAO,GAAoB,UAAY,EAA0B,CACnE,IAAM,GAAA,EAAA,EAAA,YACJ,EACA,CACE,cAAe,KAAK,cACpB,QAAS,KAAK,QACf,CACD,KAAK,OACN,CAUD,OARI,OAAO,GAAgB,SAQpB,GAPL,QAAQ,MACN,kDAAkD,OAAO,EAAY,2BAA2B,KAAK,UACnG,EACD,GACF,CACM,KAAK,UAAU,EAK1B,OAAO,GAAiB,EACxB,6BA1CM,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,4BACA,CAAA,EAAA,mBAAA,cAAA,OAAA,CAAA,CAAA,EAAA,UAAA,SAAA,IAAA,GAAA,iCATC,CACT,SAAU,8BACV,WAAY,GACZ,QAAS,CAACC,EAAAA,aAAa,CACvB,SAAU,kDACX,CAAC,CAAA,CAAA,EAAA"}
1
+ {"version":3,"file":"EditedContentRenderer.component.cjs","names":["useEditedContentRenderer","CommonModule"],"sources":["../../../src/editor/EditedContentRenderer.component.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, computed, Input, signal } from '@angular/core';\nimport { getBasePlugins, getContent } from '@intlayer/core/interpreter';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { ContentNode } from '@intlayer/types/dictionary';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport { useEditedContentRenderer } from './useEditedContentRenderer';\n\nexport interface EditedContentRendererProps {\n dictionaryKey: string;\n keyPath: KeyPath[];\n locale?: Locale;\n}\n\n@Component({\n selector: 'app-edited-content-renderer',\n standalone: true,\n imports: [CommonModule],\n template: ` <span [innerHTML]=\"renderedContent()\"></span> `,\n})\nexport class EditedContentRendererComponent {\n @Input() dictionaryKey!: string;\n @Input() keyPath!: KeyPath[];\n @Input() locale?: Locale;\n\n private fallback = signal('');\n\n private rawContent = computed(() => {\n return useEditedContentRenderer(\n this.dictionaryKey,\n this.keyPath,\n this.fallback\n );\n });\n\n /**\n * Object → getContent → string, same as the React version.\n */\n renderedContent = computed(() => {\n const rawContentValue = this.rawContent();\n\n if (typeof rawContentValue === 'object' && rawContentValue !== null) {\n const transformed = getContent(\n rawContentValue as ContentNode,\n {\n dictionaryKey: this.dictionaryKey,\n keyPath: this.keyPath,\n locale: this.locale,\n },\n getBasePlugins(this.locale)\n );\n\n if (typeof transformed !== 'string') {\n console.error(\n `Incorrect edited content format. Content type: ${typeof transformed}. Expected string. Value ${JSON.stringify(\n transformed\n )}`\n );\n return this.fallback();\n }\n return transformed;\n }\n\n return rawContentValue() as string;\n });\n}\n"],"mappings":"saAoBO,EAAA,KAAqC,CAC1C,cACA,QACA,OAEA,UAAQ,EAAA,EAAA,QAAkB,GAAG,CAE7B,YAAQ,EAAA,EAAA,cACCA,EAAAA,yBACL,KAAK,cACL,KAAK,QACL,KAAK,SACN,CACD,CAKF,iBAAA,EAAA,EAAA,cAAiC,CAC/B,IAAM,EAAkB,KAAK,YAAY,CAEzC,GAAI,OAAO,GAAoB,UAAY,EAA0B,CACnE,IAAM,GAAA,EAAA,EAAA,YACJ,EACA,CACE,cAAe,KAAK,cACpB,QAAS,KAAK,QACd,OAAQ,KAAK,OACd,EAAA,EAAA,EAAA,gBACc,KAAK,OAAO,CAC5B,CAUD,OARI,OAAO,GAAgB,SAQpB,GAPL,QAAQ,MACN,kDAAkD,OAAO,EAAY,2BAA2B,KAAK,UACnG,EACD,GACF,CACM,KAAK,UAAU,EAK1B,OAAO,GAAiB,EACxB,6BA3CM,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,4BACA,CAAA,EAAA,mBAAA,cAAA,OAAA,CAAA,CAAA,EAAA,UAAA,SAAA,IAAA,GAAA,iCATC,CACT,SAAU,8BACV,WAAY,GACZ,QAAS,CAACC,EAAAA,aAAa,CACvB,SAAU,kDACX,CAAC,CAAA,CAAA,EAAA"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`);let t=require(`@intlayer/config/built`);t=e.__toESM(t);const n=()=>Math.random().toString(36).slice(2),{editor:r}=t.default,i={postMessage:()=>null,allowedOrigins:[r?.applicationURL,r?.editorURL,r?.cmsURL],senderId:``};let a=null;const o=(e={postMessage:()=>null})=>a||(a={...i,...e,senderId:n()},a),s=(e,t={postMessage:()=>null})=>{o(t)},c=()=>{try{return o()||i}catch{return console.warn(`useCommunicator: Error accessing communicator. Returning default communicator.`),{postMessage:()=>null,senderId:``}}};exports.createCommunicator=o,exports.installCommunicator=s,exports.useCommunicator=c;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./installIntlayerEditor.cjs`),t=()=>{let t=e.getEditorStateManager();return t?{postMessage:e=>t.messenger.send(e.type,e.data),senderId:t.messenger.senderId}:null};exports.useCommunicator=t;
2
2
  //# sourceMappingURL=communicator.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"communicator.cjs","names":["configuration"],"sources":["../../../src/editor/communicator.ts"],"sourcesContent":["import type { Injector } from '@angular/core';\nimport configuration from '@intlayer/config/built';\n\nconst randomUUID = () => Math.random().toString(36).slice(2);\n\n/**\n * Interface defining a cross-frame communicator\n */\nexport type Communicator = {\n postMessage: typeof window.postMessage;\n allowedOrigins?: string[];\n senderId: string;\n};\n\n/**\n * Configuration options for the communicator\n */\nexport type CommunicatorOptions = Omit<Communicator, 'senderId'>;\n\nconst { editor } = configuration;\n\n/**\n * Default values for the communicator\n */\nconst defaultValue: Communicator = {\n postMessage: () => null,\n allowedOrigins: [\n editor?.applicationURL,\n editor?.editorURL,\n editor?.cmsURL,\n ] as string[],\n senderId: '',\n};\n\n/**\n * Singleton instance\n */\nlet instance: Communicator | null = null;\n\nconst _INTLAYER_COMMUNICATOR_SYMBOL = Symbol('Communicator');\n\n/**\n * Creates a communicator client\n * @param options - Options for configuring the communicator\n */\nexport const createCommunicator = (\n options: CommunicatorOptions = { postMessage: () => null }\n) => {\n if (instance) return instance;\n\n instance = {\n ...defaultValue,\n ...options,\n senderId: randomUUID(),\n };\n\n return instance;\n};\n\n/**\n * Helper to install the Intlayer communicator into the injector\n */\nexport const installCommunicator = (\n _injector: Injector,\n options: CommunicatorOptions = { postMessage: () => null }\n) => {\n const _client = createCommunicator(options);\n\n // Angular doesn't have a direct equivalent to Vue's app.provide\n // The client is stored as a singleton and accessed via createCommunicator\n};\n\n/**\n * Hook to access the communicator\n * @returns The communicator instance\n */\nexport const useCommunicator = (): Communicator => {\n try {\n const communicator = createCommunicator();\n return communicator || defaultValue;\n } catch (_error) {\n console.warn(\n 'useCommunicator: Error accessing communicator. Returning default communicator.'\n );\n return {\n postMessage: () => null,\n senderId: '',\n };\n }\n};\n"],"mappings":"+KAGA,MAAM,MAAmB,KAAK,QAAQ,CAAC,SAAS,GAAG,CAAC,MAAM,EAAE,CAgBtD,CAAE,UAAWA,EAAAA,QAKb,EAA6B,CACjC,gBAAmB,KACnB,eAAgB,CACd,GAAQ,eACR,GAAQ,UACR,GAAQ,OACT,CACD,SAAU,GACX,CAKD,IAAI,EAAgC,KAQpC,MAAa,GACX,EAA+B,CAAE,gBAAmB,KAAM,GAEtD,IAEJ,EAAW,CACT,GAAG,EACH,GAAG,EACH,SAAU,GAAY,CACvB,CAEM,GAMI,GACX,EACA,EAA+B,CAAE,gBAAmB,KAAM,GACvD,CACa,EAAmB,EAAQ,EAUhC,MAAsC,CACjD,GAAI,CAEF,OADqB,GAAoB,EAClB,OACR,CAIf,OAHA,QAAQ,KACN,iFACD,CACM,CACL,gBAAmB,KACnB,SAAU,GACX"}
1
+ {"version":3,"file":"communicator.cjs","names":["getEditorStateManager"],"sources":["../../../src/editor/communicator.ts"],"sourcesContent":["import { getEditorStateManager } from './installIntlayerEditor';\n\nexport const useCommunicator = () => {\n const manager = getEditorStateManager();\n if (!manager) return null;\n return {\n postMessage: (data: any) => manager.messenger.send(data.type, data.data),\n senderId: manager.messenger.senderId,\n };\n};\n"],"mappings":"kHAEa,MAAwB,CACnC,IAAM,EAAUA,EAAAA,uBAAuB,CAEvC,OADK,EACE,CACL,YAAc,GAAc,EAAQ,UAAU,KAAK,EAAK,KAAM,EAAK,KAAK,CACxE,SAAU,EAAQ,UAAU,SAC7B,CAJoB"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`./useCrossFrameState.cjs`);let n=require(`@intlayer/config/built`);n=e.__toESM(n);let r=require(`@angular/core`),i=require(`@intlayer/editor`);const a=()=>{let[e,a]=t.useCrossFrameState(i.MessageKey.INTLAYER_CONFIGURATION);try{(0,r.inject)(r.DestroyRef,{optional:!0})&&(e()||a(n.default))}catch{console.warn(`useConfiguration called outside injection context; configuration may not be synchronized.`)}};exports.useConfiguration=a;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./installIntlayerEditor.cjs`);let t=require(`@angular/core`);const n=()=>{let n=e.getEditorStateManager(),r=(0,t.signal)(n?.configuration.value);if(n){let e=e=>r.set(e.detail);n.configuration.addEventListener(`change`,e);try{(0,t.inject)(t.DestroyRef,{optional:!0})?.onDestroy(()=>n.configuration.removeEventListener(`change`,e))}catch{}}return r.asReadonly()};exports.useConfiguration=n;
2
2
  //# sourceMappingURL=configuration.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.cjs","names":["useCrossFrameState","MessageKey","DestroyRef","configuration"],"sources":["../../../src/editor/configuration.ts"],"sourcesContent":["import { DestroyRef, inject } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport { MessageKey } from '@intlayer/editor';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { useCrossFrameState } from './useCrossFrameState';\n\nexport const useConfiguration = () => {\n const [pushedConfiguration, setConfiguration] =\n useCrossFrameState<IntlayerConfig>(MessageKey.INTLAYER_CONFIGURATION);\n\n // Use Angular's injection context instead of Vue's onMounted\n try {\n const destroyRef = inject(DestroyRef, { optional: true });\n\n if (destroyRef) {\n // Execute immediately since Angular doesn't have the same lifecycle hooks\n if (!pushedConfiguration()) {\n setConfiguration(configuration);\n }\n }\n } catch {\n console.warn(\n 'useConfiguration called outside injection context; ' +\n 'configuration may not be synchronized.'\n );\n }\n};\n"],"mappings":"kRAMA,MAAa,MAAyB,CACpC,GAAM,CAAC,EAAqB,GAC1BA,EAAAA,mBAAmCC,EAAAA,WAAW,uBAAuB,CAGvE,GAAI,EAGF,EAAA,EAAA,QAF0BC,EAAAA,WAAY,CAAE,SAAU,GAAM,CAAC,GAIlD,GAAqB,EACxB,EAAiBC,EAAAA,QAAc,OAG7B,CACN,QAAQ,KACN,4FAED"}
1
+ {"version":3,"file":"configuration.cjs","names":["getEditorStateManager","DestroyRef"],"sources":["../../../src/editor/configuration.ts"],"sourcesContent":["import { DestroyRef, inject, signal } from '@angular/core';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { getEditorStateManager } from './installIntlayerEditor';\n\nexport const useConfiguration = () => {\n const manager = getEditorStateManager();\n const config = signal<IntlayerConfig | undefined>(\n manager?.configuration.value\n );\n\n if (manager) {\n const handler = (e: Event) =>\n config.set((e as CustomEvent<IntlayerConfig>).detail);\n manager.configuration.addEventListener('change', handler);\n\n try {\n const destroyRef = inject(DestroyRef, { optional: true });\n destroyRef?.onDestroy(() =>\n manager.configuration.removeEventListener('change', handler)\n );\n } catch {}\n }\n\n return config.asReadonly();\n};\n"],"mappings":"8LAIA,MAAa,MAAyB,CACpC,IAAM,EAAUA,EAAAA,uBAAuB,CACjC,GAAA,EAAA,EAAA,QACJ,GAAS,cAAc,MACxB,CAED,GAAI,EAAS,CACX,IAAM,EAAW,GACf,EAAO,IAAK,EAAkC,OAAO,CACvD,EAAQ,cAAc,iBAAiB,SAAU,EAAQ,CAEzD,GAAI,EAEF,EAAA,EAAA,QAD0BC,EAAAA,WAAY,CAAE,SAAU,GAAM,CAAC,EAC7C,cACV,EAAQ,cAAc,oBAAoB,SAAU,EAAQ,CAC7D,MACK,GAGV,OAAO,EAAO,YAAY"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./createSharedComposable.cjs`),t=require(`./useCrossFrameState.cjs`);let n=require(`@angular/core`),r=require(`@intlayer/editor`),i=null;const a=()=>{if(i)return i;let e=(0,n.signal)(void 0);return i={localeDictionaries:e.asReadonly(),setLocaleDictionaries:t=>{e.set(t??{})},setLocaleDictionary(t){let n=e();e.set({...n,[t.localId]:t})}},i},o=e=>{a()},s=e.createSharedComposable(()=>{let e=a();if(!e)throw Error(`DictionariesRecord state not found`);let[i,o]=t.useCrossFrameState(r.MessageKey.INTLAYER_LOCALE_DICTIONARIES_CHANGED,void 0);(0,n.effect)(()=>{o(e.localeDictionaries())})});exports.createDictionaryRecordClient=a,exports.installDictionariesRecord=o,exports.useDictionariesRecord=s;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./installIntlayerEditor.cjs`);let t=require(`@angular/core`);const n=()=>{let n=e.getEditorStateManager(),r=(0,t.signal)(n?.localeDictionaries.value??{});if(n){let e=e=>r.set(e.detail??{});n.localeDictionaries.addEventListener(`change`,e);try{(0,t.inject)(t.DestroyRef,{optional:!0})?.onDestroy(()=>n.localeDictionaries.removeEventListener(`change`,e))}catch{}}return{localeDictionaries:r.asReadonly(),setLocaleDictionaries:e=>n?.localeDictionaries.set(e),setLocaleDictionary:e=>n?.setLocaleDictionary(e)}};exports.useDictionariesRecord=n;
2
2
  //# sourceMappingURL=dictionariesRecord.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"dictionariesRecord.cjs","names":["createSharedComposable","useCrossFrameState","MessageKey"],"sources":["../../../src/editor/dictionariesRecord.ts"],"sourcesContent":["import { effect, type Injector, type Signal, signal } from '@angular/core';\nimport { MessageKey } from '@intlayer/editor';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { createSharedComposable } from './createSharedComposable';\nimport { useCrossFrameState } from './useCrossFrameState';\n\n/**\n * Singleton instance\n */\nlet instance: DictionariesRecordClient | null = null;\n\nexport type DictionaryContent = Record<Dictionary['key'], Dictionary>;\n\ntype DictionariesRecordClient = {\n localeDictionaries: Signal<DictionaryContent>;\n setLocaleDictionaries: (newValue: DictionaryContent) => void;\n setLocaleDictionary: (dictionary: Dictionary) => void;\n};\n\nexport const createDictionaryRecordClient = () => {\n if (instance) return instance;\n\n const localeDictionariesSignal = signal<DictionaryContent | undefined>(\n undefined\n );\n\n instance = {\n localeDictionaries:\n localeDictionariesSignal.asReadonly() as Signal<DictionaryContent>,\n\n setLocaleDictionaries: (newValue) => {\n localeDictionariesSignal.set(newValue ?? {});\n },\n\n setLocaleDictionary(dictionary) {\n const current = localeDictionariesSignal();\n localeDictionariesSignal.set({\n ...current,\n [dictionary.localId!]: dictionary,\n });\n },\n };\n\n return instance;\n};\n\n/**\n * Helper to install the provider into the injector\n */\nexport const installDictionariesRecord = (_injector: Injector) => {\n const _client = createDictionaryRecordClient();\n\n // Angular doesn't have a direct equivalent to Vue's app.provide\n // The client is stored as a singleton and accessed via createDictionaryRecordClient\n};\n\nexport const useDictionariesRecord = createSharedComposable(() => {\n const client = createDictionaryRecordClient();\n\n if (!client) {\n throw new Error('DictionariesRecord state not found');\n }\n\n const [_dictionariesRecord, setDictionariesRecord] =\n useCrossFrameState<DictionaryContent>(\n MessageKey.INTLAYER_LOCALE_DICTIONARIES_CHANGED,\n undefined\n );\n\n // Use Angular effects instead of Vue watchers\n effect(() => {\n const newValue = client.localeDictionaries();\n setDictionariesRecord(newValue); // its undefined but shouldnt\n });\n});\n"],"mappings":"mQASI,EAA4C,KAUhD,MAAa,MAAqC,CAChD,GAAI,EAAU,OAAO,EAErB,IAAM,GAAA,EAAA,EAAA,QACJ,IAAA,GACD,CAmBD,MAjBA,GAAW,CACT,mBACE,EAAyB,YAAY,CAEvC,sBAAwB,GAAa,CACnC,EAAyB,IAAI,GAAY,EAAE,CAAC,EAG9C,oBAAoB,EAAY,CAC9B,IAAM,EAAU,GAA0B,CAC1C,EAAyB,IAAI,CAC3B,GAAG,GACF,EAAW,SAAW,EACxB,CAAC,EAEL,CAEM,GAMI,EAA6B,GAAwB,CAChD,GAA8B,EAMnC,EAAwBA,EAAAA,2BAA6B,CAChE,IAAM,EAAS,GAA8B,CAE7C,GAAI,CAAC,EACH,MAAU,MAAM,qCAAqC,CAGvD,GAAM,CAAC,EAAqB,GAC1BC,EAAAA,mBACEC,EAAAA,WAAW,qCACX,IAAA,GACD,EAGH,EAAA,EAAA,YAAa,CAEX,EADiB,EAAO,oBAAoB,CACb,EAC/B,EACF"}
1
+ {"version":3,"file":"dictionariesRecord.cjs","names":["getEditorStateManager","DestroyRef"],"sources":["../../../src/editor/dictionariesRecord.ts"],"sourcesContent":["import { DestroyRef, inject, signal } from '@angular/core';\nimport type { DictionaryContent } from '@intlayer/editor';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { getEditorStateManager } from './installIntlayerEditor';\n\nexport type { DictionaryContent };\n\nexport const useDictionariesRecord = () => {\n const manager = getEditorStateManager();\n const localeDictionaries = signal<DictionaryContent>(\n manager?.localeDictionaries.value ?? {}\n );\n\n if (manager) {\n const handler = (e: Event) =>\n localeDictionaries.set(\n (e as CustomEvent<DictionaryContent>).detail ?? {}\n );\n manager.localeDictionaries.addEventListener('change', handler);\n\n try {\n const destroyRef = inject(DestroyRef, { optional: true });\n destroyRef?.onDestroy(() =>\n manager.localeDictionaries.removeEventListener('change', handler)\n );\n } catch {}\n }\n\n return {\n localeDictionaries: localeDictionaries.asReadonly(),\n setLocaleDictionaries: (value: DictionaryContent) =>\n manager?.localeDictionaries.set(value),\n setLocaleDictionary: (dictionary: Dictionary) =>\n manager?.setLocaleDictionary(dictionary),\n };\n};\n"],"mappings":"8LAOA,MAAa,MAA8B,CACzC,IAAM,EAAUA,EAAAA,uBAAuB,CACjC,GAAA,EAAA,EAAA,QACJ,GAAS,mBAAmB,OAAS,EAAE,CACxC,CAED,GAAI,EAAS,CACX,IAAM,EAAW,GACf,EAAmB,IAChB,EAAqC,QAAU,EAAE,CACnD,CACH,EAAQ,mBAAmB,iBAAiB,SAAU,EAAQ,CAE9D,GAAI,EAEF,EAAA,EAAA,QAD0BC,EAAAA,WAAY,CAAE,SAAU,GAAM,CAAC,EAC7C,cACV,EAAQ,mBAAmB,oBAAoB,SAAU,EAAQ,CAClE,MACK,GAGV,MAAO,CACL,mBAAoB,EAAmB,YAAY,CACnD,sBAAwB,GACtB,GAAS,mBAAmB,IAAI,EAAM,CACxC,oBAAsB,GACpB,GAAS,oBAAoB,EAAW,CAC3C"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./createSharedComposable.cjs`),t=require(`./useCrossFrameState.cjs`);let n=require(`@angular/core`),r=require(`@intlayer/editor`),i=require(`@intlayer/core/dictionaryManipulator`),a=null;const o=()=>{if(a)return a;let e=(0,n.signal)({});return a={editedContent:e.asReadonly(),getEditedContentValue:(t,n)=>{let r=e();if(!r)return;if(t.includes(`:local:`)||t.includes(`:remote:`))return(0,i.getContentNodeByKeyPath)(r?.[t]?.content??{},n);let a=Object.keys(r).filter(e=>e.startsWith(`${t}:`));for(let e of a){let t=(0,i.getContentNodeByKeyPath)(r?.[e]?.content??{},n);if(t)return t}},setEditedContent:t=>{e.set(t)}},a},s=e=>{o()},c=e.createSharedComposable(()=>{let e=o();if(!e)throw Error(`EditedContent state not found`);let[i,a]=t.useCrossFrameState(r.MessageKey.INTLAYER_EDITED_CONTENT_CHANGED,{});return(0,n.effect)(()=>{let t=i();e.setEditedContent(t??{})}),(0,n.effect)(()=>{a(e.editedContent())}),e});exports.createEditedContentClient=o,exports.installEditedContent=s,exports.useEditedContent=c;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./installIntlayerEditor.cjs`);let t=require(`@angular/core`);const n=()=>{let n=e.getEditorStateManager(),r=(0,t.signal)(n?.editedContent.value);if(n){let e=e=>r.set(e.detail);n.editedContent.addEventListener(`change`,e);try{(0,t.inject)(t.DestroyRef,{optional:!0})?.onDestroy(()=>n.editedContent.removeEventListener(`change`,e))}catch{}}return{editedContent:r.asReadonly(),setEditedContentState:e=>n?.editedContent.set(e),setEditedDictionary:e=>n?.setEditedDictionary(e),setEditedContent:(e,t)=>n?.setEditedContent(e,t),addEditedContent:(e,t,r,i)=>n?.addContent(e,t,r,i),renameEditedContent:(e,t,r)=>n?.renameContent(e,t,r),removeEditedContent:(e,t)=>n?.removeContent(e,t),restoreEditedContent:e=>n?.restoreContent(e),clearEditedDictionaryContent:e=>n?.clearContent(e),clearEditedContent:()=>n?.clearAllContent(),getEditedContentValue:(e,t)=>n?.getContentValue(e,t)}},r=()=>{let{editedContent:e,...t}=n();return t};exports.useEditedContent=n,exports.useEditedContentActions=r;
2
2
  //# sourceMappingURL=editedContent.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"editedContent.cjs","names":["createSharedComposable","useCrossFrameState","MessageKey"],"sources":["../../../src/editor/editedContent.ts"],"sourcesContent":["import { effect, type Injector, type Signal, signal } from '@angular/core';\nimport { getContentNodeByKeyPath } from '@intlayer/core/dictionaryManipulator';\nimport { MessageKey } from '@intlayer/editor';\nimport type { ContentNode, Dictionary, LocalDictionaryId } from '@intlayer/types/dictionary';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport { createSharedComposable } from './createSharedComposable';\nimport { useCrossFrameState } from './useCrossFrameState';\n\nexport type EditedContent = Record<Dictionary['key'], Dictionary>;\n\ntype EditedContentClient = {\n editedContent: Signal<EditedContent>;\n setEditedContent: (editedContent: EditedContent) => void;\n getEditedContentValue: (\n localDictionaryIdOrKey: LocalDictionaryId | Dictionary['key'] | string,\n keyPath: KeyPath[]\n ) => ContentNode | undefined;\n};\n\n/**\n * Singleton instance\n */\nlet instance: EditedContentClient | null = null;\n\nconst _INTLAYER_EDITED_CONTENT_SYMBOL = Symbol('EditedContent');\n\n/**\n * Creates an edited content client\n */\nexport const createEditedContentClient = () => {\n if (instance) return instance;\n\n const editedContentSignal = signal<EditedContent>({});\n\n instance = {\n editedContent: editedContentSignal.asReadonly(),\n getEditedContentValue: (\n localDictionaryIdOrKey: LocalDictionaryId | Dictionary['key'] | string,\n keyPath: KeyPath[]\n ): ContentNode | undefined => {\n const editedContent = editedContentSignal();\n\n if (!editedContent) return undefined;\n\n const isDictionaryId =\n localDictionaryIdOrKey.includes(':local:') ||\n localDictionaryIdOrKey.includes(':remote:');\n\n if (isDictionaryId) {\n const currentContent =\n editedContent?.[localDictionaryIdOrKey as LocalDictionaryId]\n ?.content ?? {};\n\n const contentNode = getContentNodeByKeyPath(currentContent, keyPath);\n\n return contentNode;\n }\n\n const filteredDictionariesLocalId = Object.keys(editedContent).filter(\n (key) => key.startsWith(`${localDictionaryIdOrKey}:`)\n );\n\n for (const localDictionaryId of filteredDictionariesLocalId) {\n const currentContent =\n editedContent?.[localDictionaryId as LocalDictionaryId]?.content ??\n {};\n const contentNode = getContentNodeByKeyPath(currentContent, keyPath);\n\n if (contentNode) return contentNode;\n }\n\n return undefined;\n },\n setEditedContent: (editedContent: EditedContent) => {\n editedContentSignal.set(editedContent);\n },\n };\n\n return instance;\n};\n\n/**\n * Helper to install the edited content into the injector\n */\nexport const installEditedContent = (_injector: Injector) => {\n const _client = createEditedContentClient();\n\n // Angular doesn't have a direct equivalent to Vue's app.provide\n // The client is stored as a singleton and accessed via createEditedContentClient\n};\n\nexport const useEditedContent = createSharedComposable(() => {\n const client = createEditedContentClient();\n\n if (!client) {\n throw new Error('EditedContent state not found');\n }\n\n const [edited, setEdited] = useCrossFrameState<EditedContent>(\n MessageKey.INTLAYER_EDITED_CONTENT_CHANGED,\n {}\n );\n\n // Use Angular effects instead of Vue watchers\n effect(() => {\n const newValue = edited();\n client.setEditedContent(newValue ?? {});\n });\n\n effect(() => {\n const newValue = client.editedContent();\n setEdited(newValue);\n });\n\n return client;\n});\n"],"mappings":"qTAsBI,EAAuC,KAO3C,MAAa,MAAkC,CAC7C,GAAI,EAAU,OAAO,EAErB,IAAM,GAAA,EAAA,EAAA,QAA4C,EAAE,CAAC,CA8CrD,MA5CA,GAAW,CACT,cAAe,EAAoB,YAAY,CAC/C,uBACE,EACA,IAC4B,CAC5B,IAAM,EAAgB,GAAqB,CAE3C,GAAI,CAAC,EAAe,OAMpB,GAHE,EAAuB,SAAS,UAAU,EAC1C,EAAuB,SAAS,WAAW,CAS3C,OAAA,EAAA,EAAA,yBALE,IAAgB,IACZ,SAAW,EAAE,CAEyC,EAAQ,CAKtE,IAAM,EAA8B,OAAO,KAAK,EAAc,CAAC,OAC5D,GAAQ,EAAI,WAAW,GAAG,EAAuB,GAAG,CACtD,CAED,IAAK,IAAM,KAAqB,EAA6B,CAI3D,IAAM,GAAA,EAAA,EAAA,yBAFJ,IAAgB,IAAyC,SACzD,EAAE,CACwD,EAAQ,CAEpE,GAAI,EAAa,OAAO,IAK5B,iBAAmB,GAAiC,CAClD,EAAoB,IAAI,EAAc,EAEzC,CAEM,GAMI,EAAwB,GAAwB,CAC3C,GAA2B,EAMhC,EAAmBA,EAAAA,2BAA6B,CAC3D,IAAM,EAAS,GAA2B,CAE1C,GAAI,CAAC,EACH,MAAU,MAAM,gCAAgC,CAGlD,GAAM,CAAC,EAAQ,GAAaC,EAAAA,mBAC1BC,EAAAA,WAAW,gCACX,EAAE,CACH,CAaD,OAVA,EAAA,EAAA,YAAa,CACX,IAAM,EAAW,GAAQ,CACzB,EAAO,iBAAiB,GAAY,EAAE,CAAC,EACvC,EAEF,EAAA,EAAA,YAAa,CAEX,EADiB,EAAO,eAAe,CACpB,EACnB,CAEK,GACP"}
1
+ {"version":3,"file":"editedContent.cjs","names":["getEditorStateManager","DestroyRef"],"sources":["../../../src/editor/editedContent.ts"],"sourcesContent":["import { DestroyRef, inject, signal } from '@angular/core';\nimport type { DictionaryContent } from '@intlayer/editor';\nimport type {\n ContentNode,\n Dictionary,\n LocalDictionaryId,\n} from '@intlayer/types/dictionary';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport { getEditorStateManager } from './installIntlayerEditor';\n\nexport const useEditedContent = () => {\n const manager = getEditorStateManager();\n const editedContent = signal<DictionaryContent | undefined>(\n manager?.editedContent.value\n );\n\n if (manager) {\n const handler = (e: Event) =>\n editedContent.set((e as CustomEvent<DictionaryContent>).detail);\n manager.editedContent.addEventListener('change', handler);\n\n try {\n const destroyRef = inject(DestroyRef, { optional: true });\n destroyRef?.onDestroy(() =>\n manager.editedContent.removeEventListener('change', handler)\n );\n } catch {}\n }\n\n return {\n editedContent: editedContent.asReadonly(),\n setEditedContentState: (value: DictionaryContent) =>\n manager?.editedContent.set(value),\n setEditedDictionary: (dict: Dictionary) =>\n manager?.setEditedDictionary(dict),\n setEditedContent: (\n localId: LocalDictionaryId,\n value: Dictionary['content']\n ) => manager?.setEditedContent(localId, value),\n addEditedContent: (\n localId: LocalDictionaryId,\n value: ContentNode,\n keyPath?: KeyPath[],\n overwrite?: boolean\n ) => manager?.addContent(localId, value, keyPath, overwrite),\n renameEditedContent: (\n localId: LocalDictionaryId,\n newKey: KeyPath['key'],\n keyPath?: KeyPath[]\n ) => manager?.renameContent(localId, newKey, keyPath),\n removeEditedContent: (localId: LocalDictionaryId, keyPath: KeyPath[]) =>\n manager?.removeContent(localId, keyPath),\n restoreEditedContent: (localId: LocalDictionaryId) =>\n manager?.restoreContent(localId),\n clearEditedDictionaryContent: (localId: LocalDictionaryId) =>\n manager?.clearContent(localId),\n clearEditedContent: () => manager?.clearAllContent(),\n getEditedContentValue: (\n localIdOrKey: LocalDictionaryId | string,\n keyPath: KeyPath[]\n ): ContentNode | undefined =>\n manager?.getContentValue(localIdOrKey, keyPath),\n };\n};\n\nexport const useEditedContentActions = () => {\n const actions = useEditedContent();\n const { editedContent, ...rest } = actions;\n return rest;\n};\n"],"mappings":"8LAUA,MAAa,MAAyB,CACpC,IAAM,EAAUA,EAAAA,uBAAuB,CACjC,GAAA,EAAA,EAAA,QACJ,GAAS,cAAc,MACxB,CAED,GAAI,EAAS,CACX,IAAM,EAAW,GACf,EAAc,IAAK,EAAqC,OAAO,CACjE,EAAQ,cAAc,iBAAiB,SAAU,EAAQ,CAEzD,GAAI,EAEF,EAAA,EAAA,QAD0BC,EAAAA,WAAY,CAAE,SAAU,GAAM,CAAC,EAC7C,cACV,EAAQ,cAAc,oBAAoB,SAAU,EAAQ,CAC7D,MACK,GAGV,MAAO,CACL,cAAe,EAAc,YAAY,CACzC,sBAAwB,GACtB,GAAS,cAAc,IAAI,EAAM,CACnC,oBAAsB,GACpB,GAAS,oBAAoB,EAAK,CACpC,kBACE,EACA,IACG,GAAS,iBAAiB,EAAS,EAAM,CAC9C,kBACE,EACA,EACA,EACA,IACG,GAAS,WAAW,EAAS,EAAO,EAAS,EAAU,CAC5D,qBACE,EACA,EACA,IACG,GAAS,cAAc,EAAS,EAAQ,EAAQ,CACrD,qBAAsB,EAA4B,IAChD,GAAS,cAAc,EAAS,EAAQ,CAC1C,qBAAuB,GACrB,GAAS,eAAe,EAAQ,CAClC,6BAA+B,GAC7B,GAAS,aAAa,EAAQ,CAChC,uBAA0B,GAAS,iBAAiB,CACpD,uBACE,EACA,IAEA,GAAS,gBAAgB,EAAc,EAAQ,CAClD,EAGU,MAAgC,CAE3C,GAAM,CAAE,gBAAe,GAAG,GADV,GAAkB,CAElC,OAAO"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./createSharedComposable.cjs`),t=require(`./useCrossFrameMessageListener.cjs`);let n=require(`@angular/core`),r=require(`@intlayer/editor`),i=null;const a=()=>{if(i)return i;let e=(0,n.signal)(!1),t=(0,n.signal)(!1),r=(0,n.computed)(()=>e()&&t());return i={wrapperEnabled:e.asReadonly(),isInIframe:t.asReadonly(),enabled:r},i},o=e=>{a()},s=e.createSharedComposable(()=>{let e=a();if(!e)throw Error(`EditorEnabled state not found`);return t.useCrossFrameMessageListener(`${r.MessageKey.INTLAYER_EDITOR_ENABLED}/post`,t=>{e.wrapperEnabled.set(t)}),(0,n.effect)(()=>{typeof window<`u`&&e.isInIframe.set(window.self!==window.top)},{allowSignalWrites:!0}),e});exports.createEditorEnabledClient=a,exports.installEditorEnabled=o,exports.useEditorEnabled=s;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./installIntlayerEditor.cjs`);let t=require(`@angular/core`);const n=()=>{let n=e.getEditorStateManager(),r=(0,t.signal)(n?.editorEnabled.value??!1);if(n){let e=e=>r.set(e.detail);n.editorEnabled.addEventListener(`change`,e);try{(0,t.inject)(t.DestroyRef,{optional:!0})?.onDestroy(()=>n.editorEnabled.removeEventListener(`change`,e))}catch{}}return{enabled:r.asReadonly()}};exports.useEditorEnabled=n;
2
2
  //# sourceMappingURL=editorEnabled.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"editorEnabled.cjs","names":["createSharedComposable","MessageKey"],"sources":["../../../src/editor/editorEnabled.ts"],"sourcesContent":["import {\n computed,\n effect,\n type Injector,\n type Signal,\n signal,\n} from '@angular/core';\nimport { MessageKey } from '@intlayer/editor';\nimport { createSharedComposable } from './createSharedComposable';\nimport { useCrossFrameMessageListener } from './useCrossFrameMessageListener';\n\n/* ------------------------------------------------------------------ */\n/* public type – identical to the React version */\n/* ------------------------------------------------------------------ */\nexport type EditorEnabledStateProps = {\n wrapperEnabled: Signal<boolean>;\n isInIframe: Signal<boolean>;\n enabled: Signal<boolean>;\n};\n\n/**\n * Singleton instance\n */\nlet instance: EditorEnabledStateProps | null = null;\n\nconst _INTLAYER_EDITOR_ENABLED_SYMBOL = Symbol('EditorEnabled');\n\n/**\n * Creates an editor wrapperEnabled client\n */\nexport const createEditorEnabledClient = () => {\n if (instance) return instance;\n\n const wrapperEnabledSignal = signal(false);\n const isInIframeSignal = signal(false);\n const enabledSignal = computed(\n () => wrapperEnabledSignal() && isInIframeSignal()\n );\n\n instance = {\n wrapperEnabled: wrapperEnabledSignal.asReadonly(),\n isInIframe: isInIframeSignal.asReadonly(),\n enabled: enabledSignal,\n };\n\n return instance;\n};\n\n/**\n * Helper to install the editor wrapperEnabled state into the injector\n */\nexport const installEditorEnabled = (_injector: Injector) => {\n const _client = createEditorEnabledClient();\n\n // Angular doesn't have a direct equivalent to Vue's app.provide\n // The client is stored as a singleton and accessed via createEditorEnabledClient\n};\n\nexport const useEditorEnabled = createSharedComposable(() => {\n const client = createEditorEnabledClient();\n\n if (!client) {\n throw new Error('EditorEnabled state not found');\n }\n\n // Listen for the iframe parent if the editor send a message `INTLAYER_EDITOR_ENABLED`\n useCrossFrameMessageListener<boolean>(\n `${MessageKey.INTLAYER_EDITOR_ENABLED}/post`,\n (data) => {\n (client.wrapperEnabled as any).set(data);\n }\n );\n\n // Use effect to set up the iframe check immediately\n effect(\n () => {\n if (typeof window !== 'undefined') {\n (client.isInIframe as any).set(window.self !== window.top);\n }\n },\n { allowSignalWrites: true }\n );\n\n return client;\n});\n"],"mappings":"6QAuBI,EAA2C,KAO/C,MAAa,MAAkC,CAC7C,GAAI,EAAU,OAAO,EAErB,IAAM,GAAA,EAAA,EAAA,QAA8B,GAAM,CACpC,GAAA,EAAA,EAAA,QAA0B,GAAM,CAChC,GAAA,EAAA,EAAA,cACE,GAAsB,EAAI,GAAkB,CACnD,CAQD,MANA,GAAW,CACT,eAAgB,EAAqB,YAAY,CACjD,WAAY,EAAiB,YAAY,CACzC,QAAS,EACV,CAEM,GAMI,EAAwB,GAAwB,CAC3C,GAA2B,EAMhC,EAAmBA,EAAAA,2BAA6B,CAC3D,IAAM,EAAS,GAA2B,CAE1C,GAAI,CAAC,EACH,MAAU,MAAM,gCAAgC,CAqBlD,OAjBA,EAAA,6BACE,GAAGC,EAAAA,WAAW,wBAAwB,OACrC,GAAS,CACP,EAAO,eAAuB,IAAI,EAAK,EAE3C,EAGD,EAAA,EAAA,YACQ,CACA,OAAO,OAAW,KACnB,EAAO,WAAmB,IAAI,OAAO,OAAS,OAAO,IAAI,EAG9D,CAAE,kBAAmB,GAAM,CAC5B,CAEM,GACP"}
1
+ {"version":3,"file":"editorEnabled.cjs","names":["getEditorStateManager","DestroyRef"],"sources":["../../../src/editor/editorEnabled.ts"],"sourcesContent":["import { DestroyRef, inject, signal } from '@angular/core';\nimport { getEditorStateManager } from './installIntlayerEditor';\n\nexport const useEditorEnabled = () => {\n const manager = getEditorStateManager();\n const enabled = signal<boolean>(manager?.editorEnabled.value ?? false);\n\n if (manager) {\n const handler = (e: Event) =>\n enabled.set((e as CustomEvent<boolean>).detail);\n manager.editorEnabled.addEventListener('change', handler);\n\n try {\n const destroyRef = inject(DestroyRef, { optional: true });\n destroyRef?.onDestroy(() =>\n manager.editorEnabled.removeEventListener('change', handler)\n );\n } catch {}\n }\n\n return { enabled: enabled.asReadonly() };\n};\n"],"mappings":"8LAGA,MAAa,MAAyB,CACpC,IAAM,EAAUA,EAAAA,uBAAuB,CACjC,GAAA,EAAA,EAAA,QAA0B,GAAS,cAAc,OAAS,GAAM,CAEtE,GAAI,EAAS,CACX,IAAM,EAAW,GACf,EAAQ,IAAK,EAA2B,OAAO,CACjD,EAAQ,cAAc,iBAAiB,SAAU,EAAQ,CAEzD,GAAI,EAEF,EAAA,EAAA,QAD0BC,EAAAA,WAAY,CAAE,SAAU,GAAM,CAAC,EAC7C,cACV,EAAQ,cAAc,oBAAoB,SAAU,EAAQ,CAC7D,MACK,GAGV,MAAO,CAAE,QAAS,EAAQ,YAAY,CAAE"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./createSharedComposable.cjs`),t=require(`./useCrossFrameState.cjs`),n=require(`../client/installIntlayer.cjs`);let r=require(`@angular/core`),i=require(`@intlayer/editor`);const a=e.createSharedComposable(()=>{let e=(0,r.inject)(n.INTLAYER_TOKEN);if(!e)throw Error(`IntlayerEditor state not found`);let[a,o]=t.useCrossFrameState(i.MessageKey.INTLAYER_CURRENT_LOCALE);return(0,r.effect)(()=>{o(e.locale())}),e});exports.useEditorLocale=a;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./installIntlayerEditor.cjs`),t=require(`../client/installIntlayer.cjs`);let n=require(`@angular/core`);const r=()=>{let r=e.getEditorStateManager(),i=(0,n.inject)(t.INTLAYER_TOKEN,{optional:!0});return i&&r&&(0,n.effect)(()=>{let e=i.locale();r.currentLocale.set(e)}),i};exports.useEditorLocale=r;
2
2
  //# sourceMappingURL=editorLocale.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"editorLocale.cjs","names":["createSharedComposable","INTLAYER_TOKEN","useCrossFrameState","MessageKey"],"sources":["../../../src/editor/editorLocale.ts"],"sourcesContent":["import { effect, inject } from '@angular/core';\nimport { MessageKey } from '@intlayer/editor';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from '../client';\nimport { createSharedComposable } from './createSharedComposable';\nimport { useCrossFrameState } from './useCrossFrameState';\n\nexport const useEditorLocale = createSharedComposable(() => {\n const client = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n if (!client) {\n throw new Error('IntlayerEditor state not found');\n }\n\n const [_data, setData] = useCrossFrameState<LocalesValues>(\n MessageKey.INTLAYER_CURRENT_LOCALE\n );\n\n // Use Angular effects instead of Vue watchers\n effect(() => {\n const newValue = client.locale();\n setData(newValue as Locale);\n });\n\n return client;\n});\n"],"mappings":"8SAQA,MAAa,EAAkBA,EAAAA,2BAA6B,CAC1D,IAAM,GAAA,EAAA,EAAA,QAAkCC,EAAAA,eAAe,CAEvD,GAAI,CAAC,EACH,MAAU,MAAM,iCAAiC,CAGnD,GAAM,CAAC,EAAO,GAAWC,EAAAA,mBACvBC,EAAAA,WAAW,wBACZ,CAQD,OALA,EAAA,EAAA,YAAa,CAEX,EADiB,EAAO,QAAQ,CACL,EAC3B,CAEK,GACP"}
1
+ {"version":3,"file":"editorLocale.cjs","names":["getEditorStateManager","INTLAYER_TOKEN"],"sources":["../../../src/editor/editorLocale.ts"],"sourcesContent":["import { effect, inject } from '@angular/core';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from '../client';\nimport { getEditorStateManager } from './installIntlayerEditor';\n\nexport const useEditorLocale = () => {\n const manager = getEditorStateManager();\n const client = inject<IntlayerProvider>(INTLAYER_TOKEN, {\n optional: true,\n } as any);\n\n if (client && manager) {\n effect(() => {\n const locale = client.locale();\n manager.currentLocale.set(locale as Locale);\n });\n }\n\n return client;\n};\n"],"mappings":"yOAKA,MAAa,MAAwB,CACnC,IAAM,EAAUA,EAAAA,uBAAuB,CACjC,GAAA,EAAA,EAAA,QAAkCC,EAAAA,eAAgB,CACtD,SAAU,GACX,CAAQ,CAST,OAPI,GAAU,IACZ,EAAA,EAAA,YAAa,CACX,IAAM,EAAS,EAAO,QAAQ,CAC9B,EAAQ,cAAc,IAAI,EAAiB,EAC3C,CAGG"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./createSharedComposable.cjs`),t=require(`./useCrossFrameState.cjs`);let n=require(`@angular/core`),r=require(`@intlayer/editor`),i=null;const a=()=>{if(i)return i;let e=(0,n.signal)(null),t=t=>{e.set(t)};return i={focusedContent:e.asReadonly(),setFocusedContent:t,setFocusedContentKeyPath:n=>{let r=e();r&&t({...r,keyPath:n})}},i},o=e=>{a()},s=e.createSharedComposable(()=>{let e=a(),[i,o]=t.useCrossFrameState(r.MessageKey.INTLAYER_FOCUSED_CONTENT_CHANGED);if(!e)throw Error(`FocusDictionary state not found`);return(0,n.effect)(()=>{let t=e.focusedContent();JSON.stringify(t)!==JSON.stringify(i())&&o(t)}),(0,n.effect)(()=>{let t=i();JSON.stringify(t)!==JSON.stringify(e.focusedContent())&&e.setFocusedContent(t??null)}),e});exports.createFocusDictionaryClient=a,exports.installFocusDictionary=o,exports.useFocusDictionary=s;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./installIntlayerEditor.cjs`);let t=require(`@angular/core`);const n=()=>{let n=e.getEditorStateManager(),r=(0,t.signal)(n?.focusedContent.value??null);if(n){let e=e=>r.set(e.detail);n.focusedContent.addEventListener(`change`,e);try{(0,t.inject)(t.DestroyRef,{optional:!0})?.onDestroy(()=>n.focusedContent.removeEventListener(`change`,e))}catch{}}return{focusedContent:r.asReadonly(),setFocusedContent:e=>n?.focusedContent.set(e),setFocusedContentKeyPath:e=>n?.setFocusedContentKeyPath(e)}};exports.useFocusDictionary=n;
2
2
  //# sourceMappingURL=focusDictionary.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"focusDictionary.cjs","names":["createSharedComposable","useCrossFrameState","MessageKey"],"sources":["../../../src/editor/focusDictionary.ts"],"sourcesContent":["import { effect, type Injector, type Signal, signal } from '@angular/core';\nimport { MessageKey } from '@intlayer/editor';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport { createSharedComposable } from './createSharedComposable';\nimport { useCrossFrameState } from './useCrossFrameState';\n\nexport type FileContent = {\n dictionaryKey: string;\n keyPath?: KeyPath[];\n dictionaryPath?: string;\n};\n\ntype FocusDictionaryClient = {\n focusedContent: Signal<FileContent | null>;\n setFocusedContent: (focussedContent: FileContent | null) => void;\n setFocusedContentKeyPath: (keyPath: KeyPath[]) => void;\n};\n\n/**\n * Singleton instance\n */\nlet instance: FocusDictionaryClient | null = null;\n\n/**\n * Creates a focus dictionary client\n */\nexport const createFocusDictionaryClient = () => {\n if (instance) return instance;\n\n const focusedContentSignal = signal<FileContent | null>(null);\n\n const setFocusedContent = (focussedContent: FileContent | null) => {\n focusedContentSignal.set(focussedContent);\n };\n\n const setFocusedContentKeyPath = (keyPath: KeyPath[]) => {\n const current = focusedContentSignal();\n if (!current) return;\n setFocusedContent({ ...current, keyPath });\n };\n\n instance = {\n focusedContent: focusedContentSignal.asReadonly(),\n setFocusedContent,\n setFocusedContentKeyPath,\n } as FocusDictionaryClient;\n\n return instance;\n};\n\n/**\n * Helper to install the focus dictionary into the injector\n */\nexport const installFocusDictionary = (_injector: Injector) => {\n const _client = createFocusDictionaryClient();\n\n // Angular doesn't have a direct equivalent to Vue's app.provide\n // The client is stored as a singleton and accessed via createFocusDictionaryClient\n};\n\n/** consumer */\nexport const useFocusDictionary = createSharedComposable(() => {\n const client = createFocusDictionaryClient();\n const [focusedContent, setFocusedContent] =\n useCrossFrameState<FileContent | null>(\n MessageKey.INTLAYER_FOCUSED_CONTENT_CHANGED\n );\n\n if (!client) {\n throw new Error('FocusDictionary state not found');\n }\n\n // Use Angular effects instead of Vue watchers\n // Watch local (client) and update cross-frame\n effect(() => {\n const newValue = client.focusedContent();\n if (JSON.stringify(newValue) !== JSON.stringify(focusedContent())) {\n setFocusedContent(newValue);\n }\n });\n\n // Watch cross-frame and update local\n effect(() => {\n const newValue = focusedContent();\n if (JSON.stringify(newValue) !== JSON.stringify(client.focusedContent())) {\n client.setFocusedContent(newValue ?? null);\n }\n });\n\n return client;\n});\n"],"mappings":"mQAqBI,EAAyC,KAK7C,MAAa,MAAoC,CAC/C,GAAI,EAAU,OAAO,EAErB,IAAM,GAAA,EAAA,EAAA,QAAkD,KAAK,CAEvD,EAAqB,GAAwC,CACjE,EAAqB,IAAI,EAAgB,EAe3C,MANA,GAAW,CACT,eAAgB,EAAqB,YAAY,CACjD,oBACA,yBATgC,GAAuB,CACvD,IAAM,EAAU,GAAsB,CACjC,GACL,EAAkB,CAAE,GAAG,EAAS,UAAS,CAAC,EAO3C,CAEM,GAMI,EAA0B,GAAwB,CAC7C,GAA6B,EAOlC,EAAqBA,EAAAA,2BAA6B,CAC7D,IAAM,EAAS,GAA6B,CACtC,CAAC,EAAgB,GACrBC,EAAAA,mBACEC,EAAAA,WAAW,iCACZ,CAEH,GAAI,CAAC,EACH,MAAU,MAAM,kCAAkC,CAoBpD,OAfA,EAAA,EAAA,YAAa,CACX,IAAM,EAAW,EAAO,gBAAgB,CACpC,KAAK,UAAU,EAAS,GAAK,KAAK,UAAU,GAAgB,CAAC,EAC/D,EAAkB,EAAS,EAE7B,EAGF,EAAA,EAAA,YAAa,CACX,IAAM,EAAW,GAAgB,CAC7B,KAAK,UAAU,EAAS,GAAK,KAAK,UAAU,EAAO,gBAAgB,CAAC,EACtE,EAAO,kBAAkB,GAAY,KAAK,EAE5C,CAEK,GACP"}
1
+ {"version":3,"file":"focusDictionary.cjs","names":["getEditorStateManager","DestroyRef"],"sources":["../../../src/editor/focusDictionary.ts"],"sourcesContent":["import { DestroyRef, inject, signal } from '@angular/core';\nimport type { FileContent } from '@intlayer/editor';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport { getEditorStateManager } from './installIntlayerEditor';\n\nexport type { FileContent };\n\nexport const useFocusDictionary = () => {\n const manager = getEditorStateManager();\n const focusedContent = signal<FileContent | null>(\n manager?.focusedContent.value ?? null\n );\n\n if (manager) {\n const handler = (e: Event) =>\n focusedContent.set((e as CustomEvent<FileContent | null>).detail);\n manager.focusedContent.addEventListener('change', handler);\n\n try {\n const destroyRef = inject(DestroyRef, { optional: true });\n destroyRef?.onDestroy(() =>\n manager.focusedContent.removeEventListener('change', handler)\n );\n } catch {}\n }\n\n return {\n focusedContent: focusedContent.asReadonly(),\n setFocusedContent: (value: FileContent | null) =>\n manager?.focusedContent.set(value),\n setFocusedContentKeyPath: (keyPath: KeyPath[]) =>\n manager?.setFocusedContentKeyPath(keyPath),\n };\n};\n"],"mappings":"8LAOA,MAAa,MAA2B,CACtC,IAAM,EAAUA,EAAAA,uBAAuB,CACjC,GAAA,EAAA,EAAA,QACJ,GAAS,eAAe,OAAS,KAClC,CAED,GAAI,EAAS,CACX,IAAM,EAAW,GACf,EAAe,IAAK,EAAsC,OAAO,CACnE,EAAQ,eAAe,iBAAiB,SAAU,EAAQ,CAE1D,GAAI,EAEF,EAAA,EAAA,QAD0BC,EAAAA,WAAY,CAAE,SAAU,GAAM,CAAC,EAC7C,cACV,EAAQ,eAAe,oBAAoB,SAAU,EAAQ,CAC9D,MACK,GAGV,MAAO,CACL,eAAgB,EAAe,YAAY,CAC3C,kBAAoB,GAClB,GAAS,eAAe,IAAI,EAAM,CACpC,yBAA2B,GACzB,GAAS,yBAAyB,EAAQ,CAC7C"}
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./ContentSelectorWrapper.component.cjs`),t=require(`./EditedContentRenderer.component.cjs`),n=require(`./EditorSelectorRenderer.component.cjs`),r=require(`./installIntlayerEditor.cjs`);Object.defineProperty(exports,`ContentSelectorWrapperComponent`,{enumerable:!0,get:function(){return e.ContentSelectorWrapperComponent}}),Object.defineProperty(exports,`EditedContentRendererComponent`,{enumerable:!0,get:function(){return t.EditedContentRendererComponent}}),Object.defineProperty(exports,`EditorSelectorRendererComponent`,{enumerable:!0,get:function(){return n.EditorSelectorRendererComponent}}),exports.installIntlayerEditor=r.installIntlayerEditor;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./installIntlayerEditor.cjs`),t=require(`./editorEnabled.cjs`),n=require(`./focusDictionary.cjs`),r=require(`./ContentSelectorWrapper.component.cjs`),i=require(`./communicator.cjs`),a=require(`./configuration.cjs`),o=require(`./dictionariesRecord.cjs`),s=require(`./EditedContentRenderer.component.cjs`),c=require(`./EditorSelectorRenderer.component.cjs`),l=require(`./editedContent.cjs`),u=require(`./editorLocale.cjs`),d=require(`./useCrossFrameMessageListener.cjs`),f=require(`./useCrossFrameState.cjs`),p=require(`./useIframeClickInterceptor.cjs`),m=require(`./useEditor.cjs`);Object.defineProperty(exports,`ContentSelectorWrapperComponent`,{enumerable:!0,get:function(){return r.ContentSelectorWrapperComponent}}),Object.defineProperty(exports,`EditedContentRendererComponent`,{enumerable:!0,get:function(){return s.EditedContentRendererComponent}}),Object.defineProperty(exports,`EditorSelectorRendererComponent`,{enumerable:!0,get:function(){return c.EditorSelectorRendererComponent}}),exports.getEditorStateManager=e.getEditorStateManager,exports.installIntlayerEditor=e.installIntlayerEditor,exports.useCommunicator=i.useCommunicator,exports.useConfiguration=a.useConfiguration,exports.useCrossFrameMessageListener=d.useCrossFrameMessageListener,exports.useCrossFrameState=f.useCrossFrameState,exports.useDictionariesRecord=o.useDictionariesRecord,exports.useEditedContent=l.useEditedContent,exports.useEditedContentActions=l.useEditedContentActions,exports.useEditor=m.useEditor,exports.useEditorEnabled=t.useEditorEnabled,exports.useEditorLocale=u.useEditorLocale,exports.useFocusDictionary=n.useFocusDictionary,exports.useIframeClickInterceptor=p.useIframeClickInterceptor,exports.useIframeClickMerger=p.useIframeClickMerger;
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`./communicator.cjs`),n=require(`./editorEnabled.cjs`),r=require(`./focusDictionary.cjs`),i=require(`./dictionariesRecord.cjs`),a=require(`./editedContent.cjs`);let o=require(`@intlayer/config/built`);o=e.__toESM(o);const{editor:s}=o.default,{applicationURL:c,editorURL:l,cmsURL:u}=s??{},d=e=>{typeof window>`u`||window.self!==window.top&&(s.applicationURL.length>0&&window.postMessage(e,s.applicationURL),s.editorURL.length>0&&window.parent.postMessage(e,s.editorURL),s.cmsURL.length>0&&window.parent.postMessage(e,s.cmsURL))},f=e=>{t.installCommunicator(e,{postMessage:d,allowedOrigins:[c,l,u]}),n.installEditorEnabled(e),i.installDictionariesRecord(e),a.installEditedContent(e),r.installFocusDictionary(e)};exports.installIntlayerEditor=f;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`);let t=require(`@intlayer/config/built`);t=e.__toESM(t);let n=require(`@intlayer/editor`);const{editor:r}=t.default??{},i=()=>({allowedOrigins:[r?.applicationURL,r?.editorURL,r?.cmsURL].filter(Boolean),postMessageFn:(e,t)=>{typeof window>`u`||window.self!==window.top&&(window.parent?.postMessage(e,t),window.postMessage(e,t))}});let a=null;const o=e=>{if(a)return;let r=new n.EditorStateManager({mode:`client`,messenger:i(),configuration:t.default});a=r,(0,n.defineIntlayerElements)(),r.start()},s=()=>a;exports.getEditorStateManager=s,exports.installIntlayerEditor=o;
2
2
  //# sourceMappingURL=installIntlayerEditor.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"installIntlayerEditor.cjs","names":["configuration"],"sources":["../../../src/editor/installIntlayerEditor.ts"],"sourcesContent":["import type { Injector } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport { installCommunicator } from './communicator';\nimport { installDictionariesRecord } from './dictionariesRecord';\nimport { installEditedContent } from './editedContent';\nimport { installEditorEnabled } from './editorEnabled';\nimport { installFocusDictionary } from './focusDictionary';\n\nconst { editor } = configuration;\nconst { applicationURL, editorURL, cmsURL } = editor ?? {};\n\nconst postMessage = (data: any) => {\n if (typeof window === 'undefined') return;\n\n const isInIframe = window.self !== window.top;\n\n if (!isInIframe) return;\n\n if (editor.applicationURL.length > 0) {\n window.postMessage(data, editor.applicationURL);\n }\n\n if (editor.editorURL.length > 0) {\n window.parent.postMessage(data, editor.editorURL);\n }\n\n if (editor.cmsURL.length > 0) {\n window.parent.postMessage(data, editor.cmsURL);\n }\n};\n\n/**\n * Angular-side replacement for the former <IntlayerEditorProvider> React component.\n *\n * Call **once** in your Angular application's bootstrap function or main module:\n *\n * ```typescript\n * import { bootstrapApplication } from '@angular/platform-browser';\n * import { AppComponent } from './app/app.component';\n * import { installIntlayerEditor } from 'angular-intlayer';\n *\n * bootstrapApplication(AppComponent).then(appRef => {\n * installIntlayerEditor(appRef.injector);\n * });\n * ```\n */\nexport const installIntlayerEditor = (injector: Injector): void => {\n /* ---------------------------------------------------------------------\n * 1. Base providers – always on\n * -------------------------------------------------------------------*/\n\n installCommunicator(injector, {\n postMessage,\n allowedOrigins: [applicationURL, editorURL, cmsURL] as string[],\n });\n installEditorEnabled(injector);\n installDictionariesRecord(injector);\n installEditedContent(injector);\n installFocusDictionary(injector);\n};\n"],"mappings":"0VAQA,KAAM,CAAE,UAAWA,EAAAA,QACb,CAAE,iBAAgB,YAAW,UAAW,GAAU,EAAE,CAEpD,EAAe,GAAc,CAC7B,OAAO,OAAW,KAEH,OAAO,OAAS,OAAO,MAItC,EAAO,eAAe,OAAS,GACjC,OAAO,YAAY,EAAM,EAAO,eAAe,CAG7C,EAAO,UAAU,OAAS,GAC5B,OAAO,OAAO,YAAY,EAAM,EAAO,UAAU,CAG/C,EAAO,OAAO,OAAS,GACzB,OAAO,OAAO,YAAY,EAAM,EAAO,OAAO,GAmBrC,EAAyB,GAA6B,CAKjE,EAAA,oBAAoB,EAAU,CAC5B,cACA,eAAgB,CAAC,EAAgB,EAAW,EAAO,CACpD,CAAC,CACF,EAAA,qBAAqB,EAAS,CAC9B,EAAA,0BAA0B,EAAS,CACnC,EAAA,qBAAqB,EAAS,CAC9B,EAAA,uBAAuB,EAAS"}
1
+ {"version":3,"file":"installIntlayerEditor.cjs","names":["configuration","EditorStateManager"],"sources":["../../../src/editor/installIntlayerEditor.ts"],"sourcesContent":["import type { Injector } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport {\n defineIntlayerElements,\n EditorStateManager,\n type MessengerConfig,\n} from '@intlayer/editor';\n\nconst { editor } = configuration ?? {};\n\nconst buildDefaultMessengerConfig = (): MessengerConfig => ({\n allowedOrigins: [\n editor?.applicationURL,\n editor?.editorURL,\n editor?.cmsURL,\n ].filter(Boolean) as string[],\n postMessageFn: (payload, origin) => {\n if (typeof window === 'undefined') return;\n const isInIframe = window.self !== window.top;\n if (!isInIframe) return;\n window.parent?.postMessage(payload, origin);\n window.postMessage(payload, origin);\n },\n});\n\nlet globalManager: EditorStateManager | null = null;\n\nexport const installIntlayerEditor = (_injector: Injector): void => {\n if (globalManager) return;\n\n const manager = new EditorStateManager({\n mode: 'client',\n messenger: buildDefaultMessengerConfig(),\n configuration,\n });\n\n globalManager = manager;\n defineIntlayerElements();\n manager.start();\n};\n\nexport const getEditorStateManager = (): EditorStateManager | null =>\n globalManager;\n"],"mappings":"iNAQA,KAAM,CAAE,UAAWA,EAAAA,SAAiB,EAAE,CAEhC,OAAsD,CAC1D,eAAgB,CACd,GAAQ,eACR,GAAQ,UACR,GAAQ,OACT,CAAC,OAAO,QAAQ,CACjB,eAAgB,EAAS,IAAW,CAC9B,OAAO,OAAW,KACH,OAAO,OAAS,OAAO,MAE1C,OAAO,QAAQ,YAAY,EAAS,EAAO,CAC3C,OAAO,YAAY,EAAS,EAAO,GAEtC,EAED,IAAI,EAA2C,KAE/C,MAAa,EAAyB,GAA8B,CAClE,GAAI,EAAe,OAEnB,IAAM,EAAU,IAAIC,EAAAA,mBAAmB,CACrC,KAAM,SACN,UAAW,GAA6B,CACxC,cAAA,EAAA,QACD,CAAC,CAEF,EAAgB,GAChB,EAAA,EAAA,yBAAwB,CACxB,EAAQ,OAAO,EAGJ,MACX"}
@@ -1,2 +1,2 @@
1
- "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./communicator.cjs`);let t=require(`@angular/core`),n=require(`@intlayer/editor`);const r=new Map;let i=!1;const a=(e,t)=>{let n=r.get(e);n||(n=new Set,r.set(e,n)),n.add(t)},o=(e,t)=>{let n=r.get(e);n&&(n.delete(t),n.size===0&&r.delete(e))},s=(e,t)=>{i||=(window.addEventListener(`message`,i=>{let{type:a,data:o,senderId:s}=i.data??{};a&&s!==t&&(!e||e.includes(`*`)||e.some(e=>(0,n.compareUrls)(e,i.origin)))&&r.get(a)?.forEach(e=>{e(o)})}),!0)},c=(n,r)=>{let{allowedOrigins:i,postMessage:c,senderId:l}=e.useCommunicator();if(s(i,l),r){a(n,r);try{let e=(0,t.inject)(t.DestroyRef,{optional:!0});e&&e.onDestroy(()=>o(n,r))}catch{console.warn(`useCrossFrameMessageListener called outside injection context; cleanup may not be available.`)}}return e=>{c({type:n,data:e,senderId:l})}};exports.useCrossFrameMessageListener=c;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./installIntlayerEditor.cjs`);let t=require(`@angular/core`);const n=(n,r)=>{let i=e.getEditorStateManager();if(r&&i){let e=i.messenger.subscribe(n,r);try{(0,t.inject)(t.DestroyRef,{optional:!0})?.onDestroy(e)}catch{}}return e=>i?.messenger.send(n,e)};exports.useCrossFrameMessageListener=n;
2
2
  //# sourceMappingURL=useCrossFrameMessageListener.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCrossFrameMessageListener.cjs","names":["useCommunicator","DestroyRef"],"sources":["../../../src/editor/useCrossFrameMessageListener.ts"],"sourcesContent":["'use client';\n\nimport { DestroyRef, inject } from '@angular/core';\nimport { compareUrls, type MessageKey } from '@intlayer/editor';\nimport { useCommunicator } from './communicator';\n\n// ---------- module-level singletons ----------\ntype AnyFn = (data: unknown) => void;\n\n/** Map<key, Set<callback>> */\nconst subscribers = new Map<string, Set<AnyFn>>();\n\n/** True once we've attached the single window listener */\nlet windowListenerAttached = false;\n\n/** Helper to add/remove a callback for a key */\nconst addSubscriber = (key: string, cb: AnyFn) => {\n let set = subscribers.get(key);\n if (!set) {\n set = new Set();\n subscribers.set(key, set);\n }\n set.add(cb);\n};\n\nconst removeSubscriber = (key: string, cb: AnyFn) => {\n const set = subscribers.get(key);\n if (!set) return;\n set.delete(cb);\n if (set.size === 0) subscribers.delete(key);\n};\n\n/** The one global window listener */\nconst ensureGlobalListener = (\n allowedOrigins: string[] | undefined,\n selfId: string\n) => {\n if (windowListenerAttached) return;\n window.addEventListener('message', (event) => {\n const { type, data, senderId } = event.data ?? {};\n if (!type) return; // guard malformed messages\n if (senderId === selfId) return; // ignore my own\n\n // origin check\n if (\n !allowedOrigins ||\n allowedOrigins.includes('*') ||\n allowedOrigins.some((o) => compareUrls(o, event.origin))\n ) {\n // broadcast to everyone interested in this key\n subscribers.get(type)?.forEach((cb) => {\n cb(data);\n });\n }\n });\n windowListenerAttached = true;\n};\n// ---------- end module-level code ----------\n\n/**\n * useCrossFrameMessageListener\n *\n * @template S - type of the message payload\n * @param key message type we care about\n * @param onEventTriggered optional callback when a matching message arrives\n * @returns postMessage(data?) helper scoped to this key\n */\nexport const useCrossFrameMessageListener = <S>(\n key: `${MessageKey}` | `${MessageKey}/post` | `${MessageKey}/get`,\n onEventTriggered?: (data: S) => void\n) => {\n // Communicator is the same for everyone, so it's fine to call every time.\n const { allowedOrigins, postMessage, senderId } = useCommunicator();\n\n // --- 1. make sure the global listener exists ----\n ensureGlobalListener(allowedOrigins, senderId);\n\n // --- 2. register this caller's callback (if any) ---\n if (onEventTriggered) {\n addSubscriber(key, onEventTriggered as AnyFn);\n\n // Use Angular's DestroyRef for cleanup instead of Vue's onScopeDispose\n try {\n const destroyRef = inject(DestroyRef, { optional: true });\n if (destroyRef) {\n destroyRef.onDestroy(() =>\n removeSubscriber(key, onEventTriggered as AnyFn)\n );\n }\n } catch {\n // If called outside injection context, no cleanup available\n console.warn(\n 'useCrossFrameMessageListener called outside injection context; ' +\n 'cleanup may not be available.'\n );\n }\n }\n\n // --- 3. return a wrapper that tags outgoing messages with our key ---\n const postMessageWrapper = (data?: S) => {\n postMessage({ type: key, data, senderId });\n };\n\n return postMessageWrapper;\n};\n"],"mappings":"gOAUA,MAAM,EAAc,IAAI,IAGxB,IAAI,EAAyB,GAG7B,MAAM,GAAiB,EAAa,IAAc,CAChD,IAAI,EAAM,EAAY,IAAI,EAAI,CACzB,IACH,EAAM,IAAI,IACV,EAAY,IAAI,EAAK,EAAI,EAE3B,EAAI,IAAI,EAAG,EAGP,GAAoB,EAAa,IAAc,CACnD,IAAM,EAAM,EAAY,IAAI,EAAI,CAC3B,IACL,EAAI,OAAO,EAAG,CACV,EAAI,OAAS,GAAG,EAAY,OAAO,EAAI,GAIvC,GACJ,EACA,IACG,CACC,AAkBJ,KAjBA,OAAO,iBAAiB,UAAY,GAAU,CAC5C,GAAM,CAAE,OAAM,OAAM,YAAa,EAAM,MAAQ,EAAE,CAC5C,GACD,IAAa,IAIf,CAAC,GACD,EAAe,SAAS,IAAI,EAC5B,EAAe,KAAM,IAAA,EAAA,EAAA,aAAkB,EAAG,EAAM,OAAO,CAAC,GAGxD,EAAY,IAAI,EAAK,EAAE,QAAS,GAAO,CACrC,EAAG,EAAK,EACR,EAEJ,CACuB,KAYd,GACX,EACA,IACG,CAEH,GAAM,CAAE,iBAAgB,cAAa,YAAaA,EAAAA,iBAAiB,CAMnE,GAHA,EAAqB,EAAgB,EAAS,CAG1C,EAAkB,CACpB,EAAc,EAAK,EAA0B,CAG7C,GAAI,CACF,IAAM,GAAA,EAAA,EAAA,QAAoBC,EAAAA,WAAY,CAAE,SAAU,GAAM,CAAC,CACrD,GACF,EAAW,cACT,EAAiB,EAAK,EAA0B,CACjD,MAEG,CAEN,QAAQ,KACN,+FAED,EASL,MAJ4B,IAAa,CACvC,EAAY,CAAE,KAAM,EAAK,OAAM,WAAU,CAAC"}
1
+ {"version":3,"file":"useCrossFrameMessageListener.cjs","names":["getEditorStateManager","DestroyRef"],"sources":["../../../src/editor/useCrossFrameMessageListener.ts"],"sourcesContent":["import { DestroyRef, inject } from '@angular/core';\nimport type { MessageKey } from '@intlayer/editor';\nimport { getEditorStateManager } from './installIntlayerEditor';\n\nexport const useCrossFrameMessageListener = <S>(\n key: `${MessageKey}` | `${MessageKey}/post` | `${MessageKey}/get`,\n onEventTriggered?: (data: S) => void\n) => {\n const manager = getEditorStateManager();\n\n if (onEventTriggered && manager) {\n const unsub = manager.messenger.subscribe(\n key,\n onEventTriggered as (data: unknown) => void\n );\n\n try {\n const destroyRef = inject(DestroyRef, { optional: true });\n destroyRef?.onDestroy(unsub);\n } catch {}\n }\n\n return (data?: S) => manager?.messenger.send(key, data);\n};\n"],"mappings":"8LAIA,MAAa,GACX,EACA,IACG,CACH,IAAM,EAAUA,EAAAA,uBAAuB,CAEvC,GAAI,GAAoB,EAAS,CAC/B,IAAM,EAAQ,EAAQ,UAAU,UAC9B,EACA,EACD,CAED,GAAI,EAEF,EAAA,EAAA,QAD0BC,EAAAA,WAAY,CAAE,SAAU,GAAM,CAAC,EAC7C,UAAU,EAAM,MACtB,GAGV,MAAQ,IAAa,GAAS,UAAU,KAAK,EAAK,EAAK"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./communicator.cjs`),t=require(`./useCrossFrameMessageListener.cjs`);let n=require(`@angular/core`);const r=new Map,i=(e,t)=>typeof e==`function`?e(t):e,a=e=>e==null?e:JSON.parse(JSON.stringify(e)),o=(o,s,c={emit:!0,receive:!0})=>{if(r.has(o)){let{state:e,setState:t,postState:n}=r.get(o);return[e,t,n]}let{emit:l=!0,receive:u=!0}=c,d=(0,n.signal)(i(s)),{postMessage:f,senderId:p}=e.useCommunicator()??{},m=e=>{!l||typeof f!=`function`||e===void 0||f({type:`${o}/post`,data:e,senderId:p})},h=e=>{let t=a(i(e,d()));d.set(t),m(t)},g=()=>{typeof f==`function`&&f({type:`${o}/post`,data:d(),senderId:p})};return m(d()),u&&typeof f==`function`&&d()===void 0&&f({type:`${o}/get`,senderId:p}),t.useCrossFrameMessageListener(`${o}/post`,u?e=>{d.set(e)}:void 0),t.useCrossFrameMessageListener(`${o}/get`,l?(e,t)=>{l&&t!==p&&m(d())}:void 0),r.set(o,{state:d,setState:h,postState:g}),[d,h,g]};exports.useCrossFrameState=o;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./installIntlayerEditor.cjs`);let t=require(`@angular/core`),n=require(`@intlayer/editor`);const r=(r,i,a={emit:!0,receive:!0})=>{let o=e.getEditorStateManager(),{emit:s=!0,receive:c=!0}=a,l=(0,t.signal)(i);if(o){let e=new n.CrossFrameStateManager(r,o.messenger,{emit:s,receive:c,initialValue:i});e.start();let a=e=>{l.set(e.detail)};e.addEventListener(`change`,a);try{(0,t.inject)(t.DestroyRef,{optional:!0})?.onDestroy(()=>{e.removeEventListener(`change`,a),e.stop()})}catch{}return[l.asReadonly(),t=>e.set(t),()=>e.postCurrentValue()]}return[l.asReadonly(),e=>l.set(e),()=>{}]};exports.useCrossFrameState=r;
2
2
  //# sourceMappingURL=useCrossFrameState.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCrossFrameState.cjs","names":["useCommunicator"],"sources":["../../../src/editor/useCrossFrameState.ts"],"sourcesContent":["import { type Signal, signal } from '@angular/core';\nimport type { MessageKey } from '@intlayer/editor';\nimport { useCommunicator } from './communicator';\nimport { useCrossFrameMessageListener } from './useCrossFrameMessageListener';\n\nexport type CrossFrameStateOptions = {\n /** Whether to broadcast state changes to other instances (default: true) */\n emit?: boolean;\n /** Whether to listen for state updates from other instances (default: true) */\n receive?: boolean;\n};\n\nconst crossFrameStateCache = new Map<\n string,\n {\n state: Signal<any>;\n setState: (v: any | ((prev: any) => any)) => void;\n postState: () => void;\n }\n>();\n\n/**\n * Utility to resolve either a value or an updater function (mirrors React's `setState`).\n */\nconst resolveState = <S>(\n state: S | ((prev?: S) => S) | undefined,\n prevState?: S\n): S | undefined => {\n if (typeof state === 'function') {\n return (state as (prev?: S) => S)(prevState);\n }\n return state as S;\n};\n\n/**\n * Creates a plain object copy that can be safely serialized\n * for postMessage communication\n */\nconst toSerializable = <T>(obj: T): T => {\n if (obj === null || obj === undefined) return obj;\n // Using parse/stringify for a quick deep clone to remove reactivity\n return JSON.parse(JSON.stringify(obj));\n};\n\n/**\n * Angular replacement for Vue's cross-frame state composable.\n * It synchronises a reactive value across frames/windows via the `postMessage` API.\n *\n * @template S The type of the state being synchronised.\n * @param key Unique key identifying this state channel.\n * @param initialState Initial value (or lazy factory) for the state.\n * @param options Control flags for emitting/receiving updates.\n *\n * @returns `[stateSignal, setState, postState]`\n * - `stateSignal` – Angular `Signal<S | undefined>` holding the current state.\n * - `setState` – Setter with the same API as React's `setState`.\n * - `postState` – Manually broadcast the current state (useful after mutations outside `setState`).\n */\nexport const useCrossFrameState = <S>(\n key: `${MessageKey}`,\n initialState?: S | (() => S),\n options: CrossFrameStateOptions = { emit: true, receive: true }\n): [\n Signal<S | undefined>,\n (v: S | ((prev: S | undefined) => S)) => void,\n () => void,\n] => {\n if (crossFrameStateCache.has(key)) {\n // Return the existing instance\n const { state, setState, postState } = crossFrameStateCache.get(key)!;\n return [state, setState, postState];\n }\n\n const { emit = true, receive = true } = options;\n\n /**\n * Internal reactive state using Angular signals.\n * We resolve the initial value here to avoid one extra render (same idea as in the React version).\n */\n const stateSignal = signal<S | undefined>(resolveState<S>(initialState));\n\n // Get communicator within injection context\n const { postMessage, senderId } = useCommunicator() ?? {};\n\n /**\n * Broadcast the given value if emitting is allowed and the communicator is ready.\n */\n const broadcastState = (value: S | undefined) => {\n if (\n !emit ||\n typeof postMessage !== 'function' ||\n typeof value === 'undefined'\n )\n return;\n postMessage({\n type: `${key}/post`,\n data: value,\n senderId,\n });\n };\n\n /**\n * Setter that mirrors React's `setState` signature (supports value or updater fn).\n */\n const setState = (valueOrUpdater: S | ((prev: S | undefined) => S)) => {\n const next = resolveState<S>(valueOrUpdater as any, stateSignal());\n const serialised = toSerializable(next);\n stateSignal.set(serialised);\n broadcastState(serialised);\n };\n\n /**\n * Manually broadcast the current state to peers.\n */\n const postState = () => {\n if (typeof postMessage !== 'function') return;\n postMessage({\n type: `${key}/post`,\n data: stateSignal(),\n senderId,\n });\n };\n\n // Emit the initial state (if any) right away so that peers can pick it up.\n broadcastState(stateSignal());\n\n // If we are in receive mode but have no state yet, ask peers for theirs.\n if (\n receive &&\n typeof postMessage === 'function' &&\n typeof stateSignal() === 'undefined'\n ) {\n postMessage({ type: `${key}/get`, senderId });\n }\n\n /* ───────────────────── Incoming messages ───────────────────── */\n\n // 1. Updates posted by other frames\n useCrossFrameMessageListener<S>(\n `${key}/post`,\n receive\n ? (data) => {\n stateSignal.set(data);\n }\n : undefined\n );\n\n // 2. Requests from peers asking for our current value\n const handleGetMessage = (_: unknown, originSenderId?: string) => {\n if (!emit) return;\n if (originSenderId === senderId) return; // Don't respond to our own request\n broadcastState(stateSignal());\n };\n\n useCrossFrameMessageListener(\n `${key}/get`,\n emit ? handleGetMessage : undefined\n );\n\n // Cache this instance\n crossFrameStateCache.set(key, { state: stateSignal, setState, postState });\n\n return [stateSignal as Signal<S | undefined>, setState, postState];\n};\n"],"mappings":"qOAYA,MAAM,EAAuB,IAAI,IAY3B,GACJ,EACA,IAEI,OAAO,GAAU,WACX,EAA0B,EAAU,CAEvC,EAOH,EAAqB,GACrB,GAAQ,KAAkC,EAEvC,KAAK,MAAM,KAAK,UAAU,EAAI,CAAC,CAiB3B,GACX,EACA,EACA,EAAkC,CAAE,KAAM,GAAM,QAAS,GAAM,GAK5D,CACH,GAAI,EAAqB,IAAI,EAAI,CAAE,CAEjC,GAAM,CAAE,QAAO,WAAU,aAAc,EAAqB,IAAI,EAAI,CACpE,MAAO,CAAC,EAAO,EAAU,EAAU,CAGrC,GAAM,CAAE,OAAO,GAAM,UAAU,IAAS,EAMlC,GAAA,EAAA,EAAA,QAAoC,EAAgB,EAAa,CAAC,CAGlE,CAAE,cAAa,YAAaA,EAAAA,iBAAiB,EAAI,EAAE,CAKnD,EAAkB,GAAyB,CAE7C,CAAC,GACD,OAAO,GAAgB,YAChB,IAAU,QAGnB,EAAY,CACV,KAAM,GAAG,EAAI,OACb,KAAM,EACN,WACD,CAAC,EAME,EAAY,GAAqD,CAErE,IAAM,EAAa,EADN,EAAgB,EAAuB,GAAa,CAAC,CAC3B,CACvC,EAAY,IAAI,EAAW,CAC3B,EAAe,EAAW,EAMtB,MAAkB,CAClB,OAAO,GAAgB,YAC3B,EAAY,CACV,KAAM,GAAG,EAAI,OACb,KAAM,GAAa,CACnB,WACD,CAAC,EA0CJ,OAtCA,EAAe,GAAa,CAAC,CAI3B,GACA,OAAO,GAAgB,YAChB,GAAa,GAAK,QAEzB,EAAY,CAAE,KAAM,GAAG,EAAI,MAAO,WAAU,CAAC,CAM/C,EAAA,6BACE,GAAG,EAAI,OACP,EACK,GAAS,CACR,EAAY,IAAI,EAAK,EAEvB,IAAA,GACL,CASD,EAAA,6BACE,GAAG,EAAI,MACP,GARwB,EAAY,IAA4B,CAC3D,GACD,IAAmB,GACvB,EAAe,GAAa,CAAC,EAKH,IAAA,GAC3B,CAGD,EAAqB,IAAI,EAAK,CAAE,MAAO,EAAa,WAAU,YAAW,CAAC,CAEnE,CAAC,EAAsC,EAAU,EAAU"}
1
+ {"version":3,"file":"useCrossFrameState.cjs","names":["getEditorStateManager","CrossFrameStateManager","DestroyRef"],"sources":["../../../src/editor/useCrossFrameState.ts"],"sourcesContent":["import { DestroyRef, inject, type Signal, signal } from '@angular/core';\nimport { CrossFrameStateManager, type MessageKey } from '@intlayer/editor';\nimport { getEditorStateManager } from './installIntlayerEditor';\n\nexport type CrossFrameStateOptions = {\n emit?: boolean;\n receive?: boolean;\n};\n\nexport const useCrossFrameState = <S>(\n key: `${MessageKey}`,\n initialState?: S,\n options: CrossFrameStateOptions = { emit: true, receive: true }\n): [Signal<S | undefined>, (value: S) => void, () => void] => {\n const manager = getEditorStateManager();\n const { emit = true, receive = true } = options;\n const stateSignal = signal<S | undefined>(initialState);\n\n if (manager) {\n const stateManager = new CrossFrameStateManager<S>(key, manager.messenger, {\n emit,\n receive,\n initialValue: initialState,\n });\n stateManager.start();\n\n const handler = (e: Event) => {\n stateSignal.set((e as CustomEvent<S>).detail);\n };\n stateManager.addEventListener('change', handler);\n\n try {\n const destroyRef = inject(DestroyRef, { optional: true });\n destroyRef?.onDestroy(() => {\n stateManager.removeEventListener('change', handler);\n stateManager.stop();\n });\n } catch {}\n\n const setState = (value: S) => stateManager.set(value);\n const postState = () => stateManager.postCurrentValue();\n\n return [stateSignal.asReadonly(), setState, postState];\n }\n\n return [\n stateSignal.asReadonly(),\n (value: S) => stateSignal.set(value),\n () => {},\n ];\n};\n"],"mappings":"4NASA,MAAa,GACX,EACA,EACA,EAAkC,CAAE,KAAM,GAAM,QAAS,GAAM,GACH,CAC5D,IAAM,EAAUA,EAAAA,uBAAuB,CACjC,CAAE,OAAO,GAAM,UAAU,IAAS,EAClC,GAAA,EAAA,EAAA,QAAoC,EAAa,CAEvD,GAAI,EAAS,CACX,IAAM,EAAe,IAAIC,EAAAA,uBAA0B,EAAK,EAAQ,UAAW,CACzE,OACA,UACA,aAAc,EACf,CAAC,CACF,EAAa,OAAO,CAEpB,IAAM,EAAW,GAAa,CAC5B,EAAY,IAAK,EAAqB,OAAO,EAE/C,EAAa,iBAAiB,SAAU,EAAQ,CAEhD,GAAI,EAEF,EAAA,EAAA,QAD0BC,EAAAA,WAAY,CAAE,SAAU,GAAM,CAAC,EAC7C,cAAgB,CAC1B,EAAa,oBAAoB,SAAU,EAAQ,CACnD,EAAa,MAAM,EACnB,MACI,EAKR,MAAO,CAAC,EAAY,YAAY,CAHd,GAAa,EAAa,IAAI,EAAM,KAC9B,EAAa,kBAAkB,CAED,CAGxD,MAAO,CACL,EAAY,YAAY,CACvB,GAAa,EAAY,IAAI,EAAM,KAC9B,GACP"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./useCrossFrameState.cjs`);let t=require(`@angular/core`),n=require(`@intlayer/editor`);const r=(t,r)=>e.useCrossFrameState(n.MessageKey.INTLAYER_URL_CHANGE,t,r),i=e=>{let[n,i]=r(e,{emit:!0,receive:!1}),a,o,s=()=>i(window.location.pathname);try{let e=(0,t.inject)(t.DestroyRef,{optional:!0});if(e&&typeof window<`u`){a=history.pushState,o=history.replaceState;let t=e=>(...t)=>{e.apply(history,t),window.dispatchEvent(new Event(`locationchange`))};history.pushState=t(a),history.replaceState=t(o),window.addEventListener(`locationchange`,s),window.addEventListener(`popstate`,s),window.addEventListener(`hashchange`,s),s(),e.onDestroy(()=>{window.removeEventListener(`locationchange`,s),window.removeEventListener(`popstate`,s),window.removeEventListener(`hashchange`,s),a&&(history.pushState=a),o&&(history.replaceState=o)})}}catch{console.warn(`useCrossURLPathSetter called outside injection context; URL path synchronization may not be available.`)}return[n,i]};exports.useCrossURLPathSetter=i,exports.useCrossURLPathState=r;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=()=>{},t=()=>{};exports.useCrossURLPathSetter=e,exports.useCrossURLPathState=t;
2
2
  //# sourceMappingURL=useCrossURLPathState.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCrossURLPathState.cjs","names":["useCrossFrameState","MessageKey","DestroyRef"],"sources":["../../../src/editor/useCrossURLPathState.ts"],"sourcesContent":["import { DestroyRef, inject } from '@angular/core';\nimport { MessageKey } from '@intlayer/editor';\nimport { useCrossFrameState } from './useCrossFrameState';\n\n/**\n * Hook to create and manage a cross-frame synchronized URL path state\n * @param initial - The initial URL path\n * @param opts - Options for controlling emit and receive behavior\n * @returns A tuple containing [state signal, setState function, forceSync function]\n */\nexport const useCrossURLPathState = (\n initial?: string,\n opts?: Parameters<typeof useCrossFrameState>[2]\n) => useCrossFrameState<string>(MessageKey.INTLAYER_URL_CHANGE, initial, opts);\n\n/**\n * Hook for host applications to push URL path changes into the shared state\n * This also monkey patches history methods to capture navigation events\n * @param initial - The initial URL path\n * @returns A tuple containing [state signal, setState function]\n */\nexport const useCrossURLPathSetter = (initial?: string) => {\n const [state, setState] = useCrossURLPathState(initial, {\n emit: true,\n receive: false,\n });\n\n // Original history methods\n let originalPushState: typeof history.pushState;\n let originalReplaceState: typeof history.replaceState;\n\n // Function to update state with current pathname\n const update = () => setState(window.location.pathname);\n\n // Use Angular's DestroyRef for cleanup instead of Vue lifecycle hooks\n try {\n const destroyRef = inject(DestroyRef, { optional: true });\n\n if (destroyRef && typeof window !== 'undefined') {\n // Save original methods\n originalPushState = history.pushState;\n originalReplaceState = history.replaceState;\n\n /**\n * Wraps a history function to dispatch a custom event when called\n * @param fn - The history function to wrap\n * @returns The wrapped function\n */\n const wrap =\n (fn: typeof history.pushState) =>\n (...args: Parameters<typeof history.pushState>) => {\n fn.apply(history, args);\n window.dispatchEvent(new Event('locationchange'));\n };\n\n // Patch history methods\n history.pushState = wrap(originalPushState);\n history.replaceState = wrap(originalReplaceState);\n\n // Add event listeners\n window.addEventListener('locationchange', update);\n window.addEventListener('popstate', update);\n window.addEventListener('hashchange', update);\n\n // Initialize immediately\n update();\n\n // Clean up on destroy\n destroyRef.onDestroy(() => {\n window.removeEventListener('locationchange', update);\n window.removeEventListener('popstate', update);\n window.removeEventListener('hashchange', update);\n\n // Restore original history methods\n if (originalPushState) history.pushState = originalPushState;\n if (originalReplaceState) history.replaceState = originalReplaceState;\n });\n }\n } catch {\n console.warn(\n 'useCrossURLPathSetter called outside injection context; ' +\n 'URL path synchronization may not be available.'\n );\n }\n\n return [state, setState] as const;\n};\n"],"mappings":"yNAUA,MAAa,GACX,EACA,IACGA,EAAAA,mBAA2BC,EAAAA,WAAW,oBAAqB,EAAS,EAAK,CAQjE,EAAyB,GAAqB,CACzD,GAAM,CAAC,EAAO,GAAY,EAAqB,EAAS,CACtD,KAAM,GACN,QAAS,GACV,CAAC,CAGE,EACA,EAGE,MAAe,EAAS,OAAO,SAAS,SAAS,CAGvD,GAAI,CACF,IAAM,GAAA,EAAA,EAAA,QAAoBC,EAAAA,WAAY,CAAE,SAAU,GAAM,CAAC,CAEzD,GAAI,GAAc,OAAO,OAAW,IAAa,CAE/C,EAAoB,QAAQ,UAC5B,EAAuB,QAAQ,aAO/B,IAAM,EACH,IACA,GAAG,IAA+C,CACjD,EAAG,MAAM,QAAS,EAAK,CACvB,OAAO,cAAc,IAAI,MAAM,iBAAiB,CAAC,EAIrD,QAAQ,UAAY,EAAK,EAAkB,CAC3C,QAAQ,aAAe,EAAK,EAAqB,CAGjD,OAAO,iBAAiB,iBAAkB,EAAO,CACjD,OAAO,iBAAiB,WAAY,EAAO,CAC3C,OAAO,iBAAiB,aAAc,EAAO,CAG7C,GAAQ,CAGR,EAAW,cAAgB,CACzB,OAAO,oBAAoB,iBAAkB,EAAO,CACpD,OAAO,oBAAoB,WAAY,EAAO,CAC9C,OAAO,oBAAoB,aAAc,EAAO,CAG5C,IAAmB,QAAQ,UAAY,GACvC,IAAsB,QAAQ,aAAe,IACjD,OAEE,CACN,QAAQ,KACN,yGAED,CAGH,MAAO,CAAC,EAAO,EAAS"}
1
+ {"version":3,"file":"useCrossURLPathState.cjs","names":[],"sources":["../../../src/editor/useCrossURLPathState.ts"],"sourcesContent":["// UrlStateManager is started by EditorStateManager.start() in client mode.\n// Nothing extra needed here.\nexport const useCrossURLPathSetter = () => {\n // No-op: managed by EditorStateManager\n};\n\nexport const useCrossURLPathState = () => {\n // No-op: managed by EditorStateManager\n};\n"],"mappings":"mEAEA,MAAa,MAA8B,GAI9B,MAA6B"}
@@ -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`});const e=require(`./editorEnabled.cjs`),t=require(`./focusDictionary.cjs`),n=require(`./dictionariesRecord.cjs`),r=require(`./editorLocale.cjs`),i=require(`./useIframeClickInterceptor.cjs`),a=()=>{e.useEditorEnabled(),t.useFocusDictionary(),i.useIframeClickMerger(),r.useEditorLocale(),n.useDictionariesRecord()};exports.useEditor=a;
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":[],"sources":["../../../src/editor/useEditor.ts"],"sourcesContent":["import { useConfiguration } from './configuration';\nimport { useDictionariesRecord } from './dictionariesRecord';\nimport { useEditorEnabled } from './editorEnabled';\nimport { useEditorLocale } from './editorLocale';\nimport { useFocusDictionary } from './focusDictionary';\nimport { useIframeClickMerger } from './useIframeClickInterceptor';\n\nexport const useEditor = () => {\n useEditorEnabled();\n useFocusDictionary();\n useIframeClickMerger();\n useEditorLocale();\n useDictionariesRecord();\n};\n"],"mappings":"gQAOa,MAAkB,CAC7B,EAAA,kBAAkB,CAClB,EAAA,oBAAoB,CACpB,EAAA,sBAAsB,CACtB,EAAA,iBAAiB,CACjB,EAAA,uBAAuB"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./createSharedComposable.cjs`),t=require(`./useCrossFrameMessageListener.cjs`);let n=require(`@angular/core`),r=require(`@intlayer/editor`);const i=e.createSharedComposable(()=>{let e=t.useCrossFrameMessageListener(r.MessageKey.INTLAYER_IFRAME_CLICKED),i=()=>{e()};try{let e=(0,n.inject)(n.DestroyRef,{optional:!0});e&&typeof window<`u`&&(window.addEventListener(`mousedown`,i),e.onDestroy(()=>window.removeEventListener(`mousedown`,i)))}catch{console.warn(`useIframeClickInterceptor called outside injection context; event listener setup may not be available.`)}}),a=e.createSharedComposable(()=>{i(),t.useCrossFrameMessageListener(r.MessageKey.INTLAYER_IFRAME_CLICKED,r.mergeIframeClick)});exports.useIframeClickInterceptor=i,exports.useIframeClickMerger=a;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./useCrossFrameMessageListener.cjs`);let t=require(`@intlayer/editor`);const n=()=>{e.useCrossFrameMessageListener(t.MessageKey.INTLAYER_IFRAME_CLICKED)},r=()=>{e.useCrossFrameMessageListener(t.MessageKey.INTLAYER_IFRAME_CLICKED,t.mergeIframeClick)};exports.useIframeClickInterceptor=n,exports.useIframeClickMerger=r;
2
2
  //# sourceMappingURL=useIframeClickInterceptor.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useIframeClickInterceptor.cjs","names":["createSharedComposable","useCrossFrameMessageListener","MessageKey","DestroyRef","mergeIframeClick"],"sources":["../../../src/editor/useIframeClickInterceptor.ts"],"sourcesContent":["import { DestroyRef, inject } from '@angular/core';\nimport { MessageKey, mergeIframeClick } from '@intlayer/editor';\nimport { createSharedComposable } from './createSharedComposable';\nimport { useCrossFrameMessageListener } from './useCrossFrameMessageListener';\n\n/* ─────────────────────────────────────────────\n 1. \"Interceptor\" – send a postMessage when\n the editor iframe itself is clicked.\n────────────────────────────────────────────── */\n/**\n * Hook that intercepts clicks in the iframe and sends them to the parent window\n * This allows the parent window to know when the iframe is clicked\n */\nexport const useIframeClickInterceptor = createSharedComposable(() => {\n const postMessage = useCrossFrameMessageListener<undefined>(\n MessageKey.INTLAYER_IFRAME_CLICKED\n );\n\n const handler = () => {\n postMessage();\n };\n\n // Use Angular's DestroyRef for cleanup instead of Vue's lifecycle hooks\n try {\n const destroyRef = inject(DestroyRef, { optional: true });\n\n if (destroyRef && typeof window !== 'undefined') {\n // Set up event listener immediately\n window.addEventListener('mousedown', handler);\n\n // Clean up on destroy\n destroyRef.onDestroy(() =>\n window.removeEventListener('mousedown', handler)\n );\n }\n } catch {\n console.warn(\n 'useIframeClickInterceptor called outside injection context; ' +\n 'event listener setup may not be available.'\n );\n }\n});\n\n/**\n * Hook for the parent window to listen for iframe clicks and merge them\n * This makes iframe clicks behave as if they happened in the parent window\n */\nexport const useIframeClickMerger = createSharedComposable(() => {\n useIframeClickInterceptor();\n\n useCrossFrameMessageListener<MessageEvent>(\n MessageKey.INTLAYER_IFRAME_CLICKED,\n mergeIframeClick\n );\n});\n"],"mappings":"6QAaA,MAAa,EAA4BA,EAAAA,2BAA6B,CACpE,IAAM,EAAcC,EAAAA,6BAClBC,EAAAA,WAAW,wBACZ,CAEK,MAAgB,CACpB,GAAa,EAIf,GAAI,CACF,IAAM,GAAA,EAAA,EAAA,QAAoBC,EAAAA,WAAY,CAAE,SAAU,GAAM,CAAC,CAErD,GAAc,OAAO,OAAW,MAElC,OAAO,iBAAiB,YAAa,EAAQ,CAG7C,EAAW,cACT,OAAO,oBAAoB,YAAa,EAAQ,CACjD,OAEG,CACN,QAAQ,KACN,yGAED,GAEH,CAMW,EAAuBH,EAAAA,2BAA6B,CAC/D,GAA2B,CAE3B,EAAA,6BACEE,EAAAA,WAAW,wBACXE,EAAAA,iBACD,EACD"}
1
+ {"version":3,"file":"useIframeClickInterceptor.cjs","names":["MessageKey","mergeIframeClick"],"sources":["../../../src/editor/useIframeClickInterceptor.ts"],"sourcesContent":["import { MessageKey, mergeIframeClick } from '@intlayer/editor';\nimport { useCrossFrameMessageListener } from './useCrossFrameMessageListener';\n\nexport const useIframeClickInterceptor = () => {\n useCrossFrameMessageListener<undefined>(MessageKey.INTLAYER_IFRAME_CLICKED);\n};\n\nexport const useIframeClickMerger = () => {\n useCrossFrameMessageListener<MessageEvent>(\n MessageKey.INTLAYER_IFRAME_CLICKED,\n mergeIframeClick\n );\n};\n"],"mappings":"wMAGA,MAAa,MAAkC,CAC7C,EAAA,6BAAwCA,EAAAA,WAAW,wBAAwB,EAGhE,MAA6B,CACxC,EAAA,6BACEA,EAAAA,WAAW,wBACXC,EAAAA,iBACD"}
@@ -1,11 +1,16 @@
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{ContentSelectorComponent as n}from"../UI/ContentSelector.component.mjs";import{useEditorEnabled as r}from"./editorEnabled.mjs";import{useFocusDictionary as i}from"./focusDictionary.mjs";import{useEditor as a}from"./useEditor.mjs";import{NodeType as o}from"@intlayer/types/nodeType";import{CommonModule as s}from"@angular/common";import{Component as c,Input as l,computed as u}from"@angular/core";import{isSameKeyPath as d}from"@intlayer/core/utils";let f=class{dictionaryKey;keyPath;focusDictionary=i();editorEnabled=r();constructor(){a()}isSelected=u(()=>{let e=this.focusDictionary.focusedContent();return e?.dictionaryKey===this.dictionaryKey&&(e.keyPath?.length??0)>0&&d(e.keyPath??[],this.keyPath)});enabled=u(()=>this.editorEnabled.enabled());handleSelect(){this.focusDictionary.setFocusedContent({dictionaryKey:this.dictionaryKey,keyPath:this.keyPath.filter(e=>e.type!==o.Translation)})}};t([l(),e(`design:type`,String)],f.prototype,`dictionaryKey`,void 0),t([l(),e(`design:type`,Array)],f.prototype,`keyPath`,void 0),f=t([c({selector:`app-content-selector-wrapper`,standalone:!0,imports:[s,n],template:`
2
- <app-content-selector
3
- *ngIf="enabled()"
4
- (press)="handleSelect()"
5
- [isSelecting]="isSelected()"
6
- >
1
+ import{getEditorStateManager as e}from"./installIntlayerEditor.mjs";import{useEditorEnabled as t}from"./editorEnabled.mjs";import{useFocusDictionary as n}from"./focusDictionary.mjs";import{__decorateMetadata as r}from"../_virtual/_@oxc-project_runtime@0.115.0/helpers/decorateMetadata.mjs";import{__decorate as i}from"../_virtual/_@oxc-project_runtime@0.115.0/helpers/decorate.mjs";import{NodeType as a}from"@intlayer/types/nodeType";import{CUSTOM_ELEMENTS_SCHEMA as o,CommonModule as s}from"@angular/common";import{Component as c,Input as l,computed as u}from"@angular/core";import{isSameKeyPath as d}from"@intlayer/core/utils";import{MessageKey as f,defineIntlayerElements as p}from"@intlayer/editor";let m=class{dictionaryKey;keyPath;focusDictionary=n();editorEnabled=t();manager=e();ngOnInit(){p()}get filteredKeyPath(){return this.keyPath.filter(e=>e.type!==a.Translation)}isSelected=u(()=>{let e=this.focusDictionary.focusedContent();return e?.dictionaryKey===this.dictionaryKey&&(e.keyPath?.length??0)>0&&d(e.keyPath??[],this.filteredKeyPath)});enabled=u(()=>this.editorEnabled.enabled());handlePress(){this.focusDictionary.setFocusedContent?.({dictionaryKey:this.dictionaryKey,keyPath:this.filteredKeyPath})}handleHover(){this.manager?.messenger.send(`${f.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,{dictionaryKey:this.dictionaryKey,keyPath:this.filteredKeyPath})}handleUnhover(){this.manager?.messenger.send(`${f.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,null)}};i([l(),r(`design:type`,String)],m.prototype,`dictionaryKey`,void 0),i([l(),r(`design:type`,Array)],m.prototype,`keyPath`,void 0),m=i([c({selector:`app-content-selector-wrapper`,standalone:!0,imports:[s],schemas:[o],template:`
2
+ <ng-container *ngIf="enabled(); else plainContent">
3
+ <intlayer-content-selector
4
+ [attr.is-selecting]="isSelected() || null"
5
+ (intlayer:press)="handlePress()"
6
+ (intlayer:hover)="handleHover()"
7
+ (intlayer:unhover)="handleUnhover()"
8
+ >
9
+ <ng-content></ng-content>
10
+ </intlayer-content-selector>
11
+ </ng-container>
12
+ <ng-template #plainContent>
7
13
  <ng-content></ng-content>
8
- </app-content-selector>
9
- <ng-content *ngIf="!enabled()"></ng-content>
10
- `}),e(`design:paramtypes`,[])],f);export{f as ContentSelectorWrapperComponent};
14
+ </ng-template>
15
+ `})],m);export{m as ContentSelectorWrapperComponent};
11
16
  //# sourceMappingURL=ContentSelectorWrapper.component.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ContentSelectorWrapper.component.mjs","names":[],"sources":["../../../src/editor/ContentSelectorWrapper.component.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, computed, Input } from '@angular/core';\nimport type { NodeProps } from '@intlayer/core/interpreter';\nimport { isSameKeyPath } from '@intlayer/core/utils';\nimport { NodeType } from '@intlayer/types/nodeType';\nimport { ContentSelectorComponent } from '../UI/ContentSelector.component';\nimport { useEditorEnabled } from './editorEnabled';\nimport { useFocusDictionary } from './focusDictionary';\nimport { useEditor } from './useEditor';\n\n/**\n * Combine your NodeProps (which include dictionaryKey & keyPath)\n * with any other div-like attributes.\n */\nexport interface ContentSelectorWrapperProps extends NodeProps {\n [key: string]: any;\n}\n\n@Component({\n selector: 'app-content-selector-wrapper',\n standalone: true,\n imports: [CommonModule, ContentSelectorComponent],\n template: `\n <app-content-selector\n *ngIf=\"enabled()\"\n (press)=\"handleSelect()\"\n [isSelecting]=\"isSelected()\"\n >\n <ng-content></ng-content>\n </app-content-selector>\n <ng-content *ngIf=\"!enabled()\"></ng-content>\n `,\n})\nexport class ContentSelectorWrapperComponent {\n @Input() dictionaryKey!: string;\n @Input() keyPath!: any[];\n\n // pull in the editor state & focus API\n private focusDictionary = useFocusDictionary();\n private editorEnabled = useEditorEnabled();\n\n constructor() {\n useEditor();\n }\n\n // compute whether this node is the current focus\n isSelected = computed(() => {\n const focusedContent = this.focusDictionary.focusedContent();\n return (\n focusedContent?.dictionaryKey === this.dictionaryKey &&\n (focusedContent.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(focusedContent.keyPath ?? [], this.keyPath)\n );\n });\n\n enabled = computed(() => this.editorEnabled.enabled());\n\n // when the selector is clicked, update focus\n handleSelect() {\n this.focusDictionary.setFocusedContent({\n dictionaryKey: this.dictionaryKey,\n keyPath: this.keyPath.filter((key) => key.type !== NodeType.Translation),\n });\n }\n}\n"],"mappings":"gpBAiCO,IAAA,EAAA,KAAsC,CAC3C,cACA,QAGA,gBAA0B,GAAoB,CAC9C,cAAwB,GAAkB,CAE1C,aAAc,CACZ,GAAW,CAIb,WAAa,MAAe,CAC1B,IAAM,EAAiB,KAAK,gBAAgB,gBAAgB,CAC5D,OACE,GAAgB,gBAAkB,KAAK,gBACtC,EAAe,SAAS,QAAU,GAAK,GACxC,EAAc,EAAe,SAAW,EAAE,CAAE,KAAK,QAAQ,EAE3D,CAEF,QAAU,MAAe,KAAK,cAAc,SAAS,CAAC,CAGtD,cAAe,CACb,KAAK,gBAAgB,kBAAkB,CACrC,cAAe,KAAK,cACpB,QAAS,KAAK,QAAQ,OAAQ,GAAQ,EAAI,OAAS,EAAS,YAAY,CACzE,CAAC,MA5BH,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,MAjBT,EAAU,CACT,SAAU,+BACV,WAAY,GACZ,QAAS,CAAC,EAAc,EAAyB,CACjD,SAAU;;;;;;;;;IAUX,CAAC,CAAA,EAAA,oBAAA,EAAA,CAAA,CAAA,CAAA,EAAA"}
1
+ {"version":3,"file":"ContentSelectorWrapper.component.mjs","names":[],"sources":["../../../src/editor/ContentSelectorWrapper.component.ts"],"sourcesContent":["import { CommonModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/common';\nimport { Component, computed, Input, type OnInit } from '@angular/core';\nimport type { NodeProps } from '@intlayer/core/interpreter';\nimport { isSameKeyPath } from '@intlayer/core/utils';\nimport { defineIntlayerElements, MessageKey } from '@intlayer/editor';\nimport { NodeType } from '@intlayer/types/nodeType';\nimport { useEditorEnabled } from './editorEnabled';\nimport { useFocusDictionary } from './focusDictionary';\nimport { getEditorStateManager } from './installIntlayerEditor';\n\n@Component({\n selector: 'app-content-selector-wrapper',\n standalone: true,\n imports: [CommonModule],\n schemas: [CUSTOM_ELEMENTS_SCHEMA],\n template: `\n <ng-container *ngIf=\"enabled(); else plainContent\">\n <intlayer-content-selector\n [attr.is-selecting]=\"isSelected() || null\"\n (intlayer:press)=\"handlePress()\"\n (intlayer:hover)=\"handleHover()\"\n (intlayer:unhover)=\"handleUnhover()\"\n >\n <ng-content></ng-content>\n </intlayer-content-selector>\n </ng-container>\n <ng-template #plainContent>\n <ng-content></ng-content>\n </ng-template>\n `,\n})\nexport class ContentSelectorWrapperComponent implements OnInit {\n @Input() dictionaryKey!: string;\n @Input() keyPath!: any[];\n\n private focusDictionary = useFocusDictionary();\n private editorEnabled = useEditorEnabled();\n private manager = getEditorStateManager();\n\n ngOnInit() {\n defineIntlayerElements();\n }\n\n get filteredKeyPath() {\n return this.keyPath.filter((key) => key.type !== NodeType.Translation);\n }\n\n isSelected = computed(() => {\n const focused = this.focusDictionary.focusedContent();\n return (\n focused?.dictionaryKey === this.dictionaryKey &&\n (focused.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(focused.keyPath ?? [], this.filteredKeyPath)\n );\n });\n\n enabled = computed(() => this.editorEnabled.enabled());\n\n handlePress() {\n this.focusDictionary.setFocusedContent?.({\n dictionaryKey: this.dictionaryKey,\n keyPath: this.filteredKeyPath,\n });\n }\n\n handleHover() {\n this.manager?.messenger.send(\n `${MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,\n { dictionaryKey: this.dictionaryKey, keyPath: this.filteredKeyPath }\n );\n }\n\n handleUnhover() {\n this.manager?.messenger.send(\n `${MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,\n null\n );\n }\n}\n"],"mappings":"+rBA+BO,IAAA,EAAA,KAAwD,CAC7D,cACA,QAEA,gBAA0B,GAAoB,CAC9C,cAAwB,GAAkB,CAC1C,QAAkB,GAAuB,CAEzC,UAAW,CACT,GAAwB,CAG1B,IAAI,iBAAkB,CACpB,OAAO,KAAK,QAAQ,OAAQ,GAAQ,EAAI,OAAS,EAAS,YAAY,CAGxE,WAAa,MAAe,CAC1B,IAAM,EAAU,KAAK,gBAAgB,gBAAgB,CACrD,OACE,GAAS,gBAAkB,KAAK,gBAC/B,EAAQ,SAAS,QAAU,GAAK,GACjC,EAAc,EAAQ,SAAW,EAAE,CAAE,KAAK,gBAAgB,EAE5D,CAEF,QAAU,MAAe,KAAK,cAAc,SAAS,CAAC,CAEtD,aAAc,CACZ,KAAK,gBAAgB,oBAAoB,CACvC,cAAe,KAAK,cACpB,QAAS,KAAK,gBACf,CAAC,CAGJ,aAAc,CACZ,KAAK,SAAS,UAAU,KACtB,GAAG,EAAW,iCAAiC,OAC/C,CAAE,cAAe,KAAK,cAAe,QAAS,KAAK,gBAAiB,CACrE,CAGH,eAAgB,CACd,KAAK,SAAS,UAAU,KACtB,GAAG,EAAW,iCAAiC,OAC/C,KACD,MA5CF,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,MAvBT,EAAU,CACT,SAAU,+BACV,WAAY,GACZ,QAAS,CAAC,EAAa,CACvB,QAAS,CAAC,EAAuB,CACjC,SAAU;;;;;;;;;;;;;;IAeX,CAAC,CAAA,CAAA,EAAA"}
@@ -1,2 +1,2 @@
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{useEditedContentRenderer as n}from"./useEditedContentRenderer.mjs";import{getContent as r}from"@intlayer/core/interpreter";import{CommonModule as i}from"@angular/common";import{Component as a,Input as o,computed as s,signal as c}from"@angular/core";let l=class{dictionaryKey;keyPath;locale;fallback=c(``);rawContent=s(()=>n(this.dictionaryKey,this.keyPath,this.fallback));renderedContent=s(()=>{let e=this.rawContent();if(typeof e==`object`&&e){let t=r(e,{dictionaryKey:this.dictionaryKey,keyPath:this.keyPath},this.locale);return typeof t==`string`?t:(console.error(`Incorrect edited content format. Content type: ${typeof t}. Expected string. Value ${JSON.stringify(t)}`),this.fallback())}return e()})};t([o(),e(`design:type`,String)],l.prototype,`dictionaryKey`,void 0),t([o(),e(`design:type`,Array)],l.prototype,`keyPath`,void 0),t([o(),e(`design:type`,Object)],l.prototype,`locale`,void 0),l=t([a({selector:`app-edited-content-renderer`,standalone:!0,imports:[i],template:` <span [innerHTML]="renderedContent()"></span> `})],l);export{l as EditedContentRendererComponent};
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{useEditedContentRenderer as n}from"./useEditedContentRenderer.mjs";import{getBasePlugins as r,getContent as i}from"@intlayer/core/interpreter";import{CommonModule as a}from"@angular/common";import{Component as o,Input as s,computed as c,signal as l}from"@angular/core";let u=class{dictionaryKey;keyPath;locale;fallback=l(``);rawContent=c(()=>n(this.dictionaryKey,this.keyPath,this.fallback));renderedContent=c(()=>{let e=this.rawContent();if(typeof e==`object`&&e){let t=i(e,{dictionaryKey:this.dictionaryKey,keyPath:this.keyPath,locale:this.locale},r(this.locale));return typeof t==`string`?t:(console.error(`Incorrect edited content format. Content type: ${typeof t}. Expected string. Value ${JSON.stringify(t)}`),this.fallback())}return e()})};t([s(),e(`design:type`,String)],u.prototype,`dictionaryKey`,void 0),t([s(),e(`design:type`,Array)],u.prototype,`keyPath`,void 0),t([s(),e(`design:type`,Object)],u.prototype,`locale`,void 0),u=t([o({selector:`app-edited-content-renderer`,standalone:!0,imports:[a],template:` <span [innerHTML]="renderedContent()"></span> `})],u);export{u as EditedContentRendererComponent};
2
2
  //# sourceMappingURL=EditedContentRenderer.component.mjs.map