angular-intlayer 8.1.2 → 8.1.3

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 (168) hide show
  1. package/dist/cjs/UI/ContentSelector.component.cjs +2 -116
  2. package/dist/cjs/UI/ContentSelector.component.cjs.map +1 -1
  3. package/dist/cjs/_virtual/_@oxc-project_runtime@0.112.0/helpers/decorate.cjs +1 -11
  4. package/dist/cjs/_virtual/_@oxc-project_runtime@0.112.0/helpers/decorateMetadata.cjs +1 -8
  5. package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -29
  6. package/dist/cjs/client/index.cjs +1 -28
  7. package/dist/cjs/client/installIntlayer.cjs +1 -77
  8. package/dist/cjs/client/installIntlayer.cjs.map +1 -1
  9. package/dist/cjs/client/useDictionary.cjs +1 -15
  10. package/dist/cjs/client/useDictionary.cjs.map +1 -1
  11. package/dist/cjs/client/useDictionaryAsync.cjs +1 -24
  12. package/dist/cjs/client/useDictionaryAsync.cjs.map +1 -1
  13. package/dist/cjs/client/useDictionaryDynamic.cjs +1 -25
  14. package/dist/cjs/client/useDictionaryDynamic.cjs.map +1 -1
  15. package/dist/cjs/client/useIntl.cjs +1 -40
  16. package/dist/cjs/client/useIntl.cjs.map +1 -1
  17. package/dist/cjs/client/useIntlayer.cjs +1 -44
  18. package/dist/cjs/client/useIntlayer.cjs.map +1 -1
  19. package/dist/cjs/client/useLoadDynamic.cjs +1 -28
  20. package/dist/cjs/client/useLoadDynamic.cjs.map +1 -1
  21. package/dist/cjs/client/useLocale.cjs +1 -60
  22. package/dist/cjs/client/useLocale.cjs.map +1 -1
  23. package/dist/cjs/client/useLocaleStorage.cjs +1 -60
  24. package/dist/cjs/client/useLocaleStorage.cjs.map +1 -1
  25. package/dist/cjs/editor/ContentSelectorWrapper.component.cjs +2 -51
  26. package/dist/cjs/editor/ContentSelectorWrapper.component.cjs.map +1 -1
  27. package/dist/cjs/editor/EditedContentRenderer.component.cjs +1 -54
  28. package/dist/cjs/editor/EditedContentRenderer.component.cjs.map +1 -1
  29. package/dist/cjs/editor/EditorSelectorRenderer.component.cjs +2 -35
  30. package/dist/cjs/editor/EditorSelectorRenderer.component.cjs.map +1 -1
  31. package/dist/cjs/editor/communicator.cjs +1 -63
  32. package/dist/cjs/editor/communicator.cjs.map +1 -1
  33. package/dist/cjs/editor/configuration.cjs +1 -22
  34. package/dist/cjs/editor/configuration.cjs.map +1 -1
  35. package/dist/cjs/editor/createSharedComposable.cjs +1 -50
  36. package/dist/cjs/editor/createSharedComposable.cjs.map +1 -1
  37. package/dist/cjs/editor/dictionariesRecord.cjs +1 -49
  38. package/dist/cjs/editor/dictionariesRecord.cjs.map +1 -1
  39. package/dist/cjs/editor/editedContent.cjs +1 -61
  40. package/dist/cjs/editor/editedContent.cjs.map +1 -1
  41. package/dist/cjs/editor/editorEnabled.cjs +1 -49
  42. package/dist/cjs/editor/editorEnabled.cjs.map +1 -1
  43. package/dist/cjs/editor/editorLocale.cjs +1 -21
  44. package/dist/cjs/editor/editorLocale.cjs.map +1 -1
  45. package/dist/cjs/editor/focusDictionary.cjs +1 -62
  46. package/dist/cjs/editor/focusDictionary.cjs.map +1 -1
  47. package/dist/cjs/editor/index.cjs +1 -25
  48. package/dist/cjs/editor/installIntlayerEditor.cjs +1 -52
  49. package/dist/cjs/editor/installIntlayerEditor.cjs.map +1 -1
  50. package/dist/cjs/editor/useCrossFrameMessageListener.cjs +1 -73
  51. package/dist/cjs/editor/useCrossFrameMessageListener.cjs.map +1 -1
  52. package/dist/cjs/editor/useCrossFrameState.cjs +1 -114
  53. package/dist/cjs/editor/useCrossFrameState.cjs.map +1 -1
  54. package/dist/cjs/editor/useCrossURLPathState.cjs +1 -65
  55. package/dist/cjs/editor/useCrossURLPathState.cjs.map +1 -1
  56. package/dist/cjs/editor/useEditedContentRenderer.cjs +1 -35
  57. package/dist/cjs/editor/useEditedContentRenderer.cjs.map +1 -1
  58. package/dist/cjs/editor/useEditor.cjs +1 -24
  59. package/dist/cjs/editor/useEditor.cjs.map +1 -1
  60. package/dist/cjs/editor/useIframeClickInterceptor.cjs +1 -39
  61. package/dist/cjs/editor/useIframeClickInterceptor.cjs.map +1 -1
  62. package/dist/cjs/getDictionary.cjs +1 -17
  63. package/dist/cjs/getDictionary.cjs.map +1 -1
  64. package/dist/cjs/getIntlayer.cjs +1 -18
  65. package/dist/cjs/getIntlayer.cjs.map +1 -1
  66. package/dist/cjs/index.cjs +1 -49
  67. package/dist/cjs/markdown/index.cjs +1 -13
  68. package/dist/cjs/markdown/installIntlayerMarkdown.cjs +1 -79
  69. package/dist/cjs/markdown/installIntlayerMarkdown.cjs.map +1 -1
  70. package/dist/cjs/plugins.cjs +1 -188
  71. package/dist/cjs/plugins.cjs.map +1 -1
  72. package/dist/cjs/renderIntlayerNode.cjs +1 -28
  73. package/dist/cjs/renderIntlayerNode.cjs.map +1 -1
  74. package/dist/cjs/webpack/index.cjs +1 -4
  75. package/dist/cjs/webpack/mergeConfig.cjs +1 -44
  76. package/dist/cjs/webpack/mergeConfig.cjs.map +1 -1
  77. package/dist/esm/UI/ContentSelector.component.mjs +2 -109
  78. package/dist/esm/UI/ContentSelector.component.mjs.map +1 -1
  79. package/dist/esm/_virtual/_@oxc-project_runtime@0.112.0/helpers/decorate.mjs +1 -10
  80. package/dist/esm/_virtual/_@oxc-project_runtime@0.112.0/helpers/decorateMetadata.mjs +1 -7
  81. package/dist/esm/client/index.mjs +1 -10
  82. package/dist/esm/client/installIntlayer.mjs +1 -65
  83. package/dist/esm/client/installIntlayer.mjs.map +1 -1
  84. package/dist/esm/client/useDictionary.mjs +1 -13
  85. package/dist/esm/client/useDictionary.mjs.map +1 -1
  86. package/dist/esm/client/useDictionaryAsync.mjs +1 -21
  87. package/dist/esm/client/useDictionaryAsync.mjs.map +1 -1
  88. package/dist/esm/client/useDictionaryDynamic.mjs +1 -22
  89. package/dist/esm/client/useDictionaryDynamic.mjs.map +1 -1
  90. package/dist/esm/client/useIntl.mjs +1 -38
  91. package/dist/esm/client/useIntl.mjs.map +1 -1
  92. package/dist/esm/client/useIntlayer.mjs +1 -41
  93. package/dist/esm/client/useIntlayer.mjs.map +1 -1
  94. package/dist/esm/client/useLoadDynamic.mjs +1 -26
  95. package/dist/esm/client/useLoadDynamic.mjs.map +1 -1
  96. package/dist/esm/client/useLocale.mjs +1 -57
  97. package/dist/esm/client/useLocale.mjs.map +1 -1
  98. package/dist/esm/client/useLocaleStorage.mjs +1 -53
  99. package/dist/esm/client/useLocaleStorage.mjs.map +1 -1
  100. package/dist/esm/editor/ContentSelectorWrapper.component.mjs +2 -44
  101. package/dist/esm/editor/ContentSelectorWrapper.component.mjs.map +1 -1
  102. package/dist/esm/editor/EditedContentRenderer.component.mjs +1 -47
  103. package/dist/esm/editor/EditedContentRenderer.component.mjs.map +1 -1
  104. package/dist/esm/editor/EditorSelectorRenderer.component.mjs +2 -28
  105. package/dist/esm/editor/EditorSelectorRenderer.component.mjs.map +1 -1
  106. package/dist/esm/editor/communicator.mjs +1 -58
  107. package/dist/esm/editor/communicator.mjs.map +1 -1
  108. package/dist/esm/editor/configuration.mjs +1 -19
  109. package/dist/esm/editor/configuration.mjs.map +1 -1
  110. package/dist/esm/editor/createSharedComposable.mjs +1 -47
  111. package/dist/esm/editor/createSharedComposable.mjs.map +1 -1
  112. package/dist/esm/editor/dictionariesRecord.mjs +1 -45
  113. package/dist/esm/editor/dictionariesRecord.mjs.map +1 -1
  114. package/dist/esm/editor/editedContent.mjs +1 -57
  115. package/dist/esm/editor/editedContent.mjs.map +1 -1
  116. package/dist/esm/editor/editorEnabled.mjs +1 -45
  117. package/dist/esm/editor/editorEnabled.mjs.map +1 -1
  118. package/dist/esm/editor/editorLocale.mjs +1 -19
  119. package/dist/esm/editor/editorLocale.mjs.map +1 -1
  120. package/dist/esm/editor/focusDictionary.mjs +1 -58
  121. package/dist/esm/editor/focusDictionary.mjs.map +1 -1
  122. package/dist/esm/editor/index.mjs +1 -6
  123. package/dist/esm/editor/installIntlayerEditor.mjs +1 -49
  124. package/dist/esm/editor/installIntlayerEditor.mjs.map +1 -1
  125. package/dist/esm/editor/useCrossFrameMessageListener.mjs +1 -71
  126. package/dist/esm/editor/useCrossFrameMessageListener.mjs.map +1 -1
  127. package/dist/esm/editor/useCrossFrameState.mjs +1 -112
  128. package/dist/esm/editor/useCrossFrameState.mjs.map +1 -1
  129. package/dist/esm/editor/useCrossURLPathState.mjs +1 -62
  130. package/dist/esm/editor/useCrossURLPathState.mjs.map +1 -1
  131. package/dist/esm/editor/useEditedContentRenderer.mjs +1 -26
  132. package/dist/esm/editor/useEditedContentRenderer.mjs.map +1 -1
  133. package/dist/esm/editor/useEditor.mjs +1 -23
  134. package/dist/esm/editor/useEditor.mjs.map +1 -1
  135. package/dist/esm/editor/useIframeClickInterceptor.mjs +1 -36
  136. package/dist/esm/editor/useIframeClickInterceptor.mjs.map +1 -1
  137. package/dist/esm/getDictionary.mjs +1 -15
  138. package/dist/esm/getDictionary.mjs.map +1 -1
  139. package/dist/esm/getIntlayer.mjs +1 -16
  140. package/dist/esm/getIntlayer.mjs.map +1 -1
  141. package/dist/esm/index.mjs +1 -14
  142. package/dist/esm/markdown/index.mjs +1 -3
  143. package/dist/esm/markdown/installIntlayerMarkdown.mjs +1 -68
  144. package/dist/esm/markdown/installIntlayerMarkdown.mjs.map +1 -1
  145. package/dist/esm/plugins.mjs +1 -182
  146. package/dist/esm/plugins.mjs.map +1 -1
  147. package/dist/esm/renderIntlayerNode.mjs +1 -26
  148. package/dist/esm/renderIntlayerNode.mjs.map +1 -1
  149. package/dist/esm/webpack/index.mjs +1 -3
  150. package/dist/esm/webpack/mergeConfig.mjs +1 -42
  151. package/dist/esm/webpack/mergeConfig.mjs.map +1 -1
  152. package/dist/types/client/useDictionaryDynamic.d.ts +2 -2
  153. package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -1
  154. package/dist/types/editor/ContentSelectorWrapper.component.d.ts +1 -1
  155. package/dist/types/editor/ContentSelectorWrapper.component.d.ts.map +1 -1
  156. package/dist/types/editor/EditorSelectorRenderer.component.d.ts +1 -1
  157. package/dist/types/getDictionary.d.ts +3 -3
  158. package/dist/types/getDictionary.d.ts.map +1 -1
  159. package/dist/types/getIntlayer.d.ts +1 -1
  160. package/dist/types/getIntlayer.d.ts.map +1 -1
  161. package/dist/types/index.d.ts +1 -1
  162. package/dist/types/index.d.ts.map +1 -1
  163. package/dist/types/markdown/installIntlayerMarkdown.d.ts +1 -1
  164. package/dist/types/markdown/installIntlayerMarkdown.d.ts.map +1 -1
  165. package/dist/types/plugins.d.ts +1 -1
  166. package/dist/types/plugins.d.ts.map +1 -1
  167. package/dist/types/webpack/mergeConfig.d.ts.map +1 -1
  168. package/package.json +8 -8
@@ -1,50 +1,2 @@
1
- import { installCommunicator } from "./communicator.mjs";
2
- import { installEditorEnabled } from "./editorEnabled.mjs";
3
- import { installFocusDictionary } from "./focusDictionary.mjs";
4
- import { installDictionariesRecord } from "./dictionariesRecord.mjs";
5
- import { installEditedContent } from "./editedContent.mjs";
6
- import configuration from "@intlayer/config/built";
7
-
8
- //#region src/editor/installIntlayerEditor.ts
9
- const { editor } = configuration;
10
- const { applicationURL, editorURL, cmsURL } = editor ?? {};
11
- const postMessage = (data) => {
12
- if (typeof window === "undefined") return;
13
- if (!(window.self !== window.top)) return;
14
- if (editor.applicationURL.length > 0) window.postMessage(data, editor.applicationURL);
15
- if (editor.editorURL.length > 0) window.parent.postMessage(data, editor.editorURL);
16
- if (editor.cmsURL.length > 0) window.parent.postMessage(data, editor.cmsURL);
17
- };
18
- /**
19
- * Angular-side replacement for the former <IntlayerEditorProvider> React component.
20
- *
21
- * Call **once** in your Angular application's bootstrap function or main module:
22
- *
23
- * ```typescript
24
- * import { bootstrapApplication } from '@angular/platform-browser';
25
- * import { AppComponent } from './app/app.component';
26
- * import { installIntlayerEditor } from 'angular-intlayer';
27
- *
28
- * bootstrapApplication(AppComponent).then(appRef => {
29
- * installIntlayerEditor(appRef.injector);
30
- * });
31
- * ```
32
- */
33
- const installIntlayerEditor = (injector) => {
34
- installCommunicator(injector, {
35
- postMessage,
36
- allowedOrigins: [
37
- applicationURL,
38
- editorURL,
39
- cmsURL
40
- ]
41
- });
42
- installEditorEnabled(injector);
43
- installDictionariesRecord(injector);
44
- installEditedContent(injector);
45
- installFocusDictionary(injector);
46
- };
47
-
48
- //#endregion
49
- export { installIntlayerEditor };
1
+ import{installCommunicator as e}from"./communicator.mjs";import{installEditorEnabled as t}from"./editorEnabled.mjs";import{installFocusDictionary as n}from"./focusDictionary.mjs";import{installDictionariesRecord as r}from"./dictionariesRecord.mjs";import{installEditedContent as i}from"./editedContent.mjs";import a from"@intlayer/config/built";const{editor:o}=a,{applicationURL:s,editorURL:c,cmsURL:l}=o??{},u=e=>{typeof window>`u`||window.self!==window.top&&(o.applicationURL.length>0&&window.postMessage(e,o.applicationURL),o.editorURL.length>0&&window.parent.postMessage(e,o.editorURL),o.cmsURL.length>0&&window.parent.postMessage(e,o.cmsURL))},d=a=>{e(a,{postMessage:u,allowedOrigins:[s,c,l]}),t(a),r(a),i(a),n(a)};export{d as installIntlayerEditor};
50
2
  //# sourceMappingURL=installIntlayerEditor.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"installIntlayerEditor.mjs","names":[],"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":";;;;;;;;AAQA,MAAM,EAAE,WAAW;AACnB,MAAM,EAAE,gBAAgB,WAAW,WAAW,UAAU,EAAE;AAE1D,MAAM,eAAe,SAAc;AACjC,KAAI,OAAO,WAAW,YAAa;AAInC,KAAI,EAFe,OAAO,SAAS,OAAO,KAEzB;AAEjB,KAAI,OAAO,eAAe,SAAS,EACjC,QAAO,YAAY,MAAM,OAAO,eAAe;AAGjD,KAAI,OAAO,UAAU,SAAS,EAC5B,QAAO,OAAO,YAAY,MAAM,OAAO,UAAU;AAGnD,KAAI,OAAO,OAAO,SAAS,EACzB,QAAO,OAAO,YAAY,MAAM,OAAO,OAAO;;;;;;;;;;;;;;;;;AAmBlD,MAAa,yBAAyB,aAA6B;AAKjE,qBAAoB,UAAU;EAC5B;EACA,gBAAgB;GAAC;GAAgB;GAAW;GAAO;EACpD,CAAC;AACF,sBAAqB,SAAS;AAC9B,2BAA0B,SAAS;AACnC,sBAAqB,SAAS;AAC9B,wBAAuB,SAAS"}
1
+ {"version":3,"file":"installIntlayerEditor.mjs","names":[],"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":"yVAQA,KAAM,CAAE,UAAW,EACb,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,EAAoB,EAAU,CAC5B,cACA,eAAgB,CAAC,EAAgB,EAAW,EAAO,CACpD,CAAC,CACF,EAAqB,EAAS,CAC9B,EAA0B,EAAS,CACnC,EAAqB,EAAS,CAC9B,EAAuB,EAAS"}
@@ -1,72 +1,2 @@
1
- 'use client';
2
-
3
- import { useCommunicator } from "./communicator.mjs";
4
- import { DestroyRef, inject } from "@angular/core";
5
- import { compareUrls } from "@intlayer/editor";
6
-
7
- //#region src/editor/useCrossFrameMessageListener.ts
8
- /** Map<key, Set<callback>> */
9
- const subscribers = /* @__PURE__ */ new Map();
10
- /** True once we've attached the single window listener */
11
- let windowListenerAttached = false;
12
- /** Helper to add/remove a callback for a key */
13
- const addSubscriber = (key, cb) => {
14
- let set = subscribers.get(key);
15
- if (!set) {
16
- set = /* @__PURE__ */ new Set();
17
- subscribers.set(key, set);
18
- }
19
- set.add(cb);
20
- };
21
- const removeSubscriber = (key, cb) => {
22
- const set = subscribers.get(key);
23
- if (!set) return;
24
- set.delete(cb);
25
- if (set.size === 0) subscribers.delete(key);
26
- };
27
- /** The one global window listener */
28
- const ensureGlobalListener = (allowedOrigins, selfId) => {
29
- if (windowListenerAttached) return;
30
- window.addEventListener("message", (event) => {
31
- const { type, data, senderId } = event.data ?? {};
32
- if (!type) return;
33
- if (senderId === selfId) return;
34
- if (!allowedOrigins || allowedOrigins.includes("*") || allowedOrigins.some((o) => compareUrls(o, event.origin))) subscribers.get(type)?.forEach((cb) => {
35
- cb(data);
36
- });
37
- });
38
- windowListenerAttached = true;
39
- };
40
- /**
41
- * useCrossFrameMessageListener
42
- *
43
- * @template S - type of the message payload
44
- * @param key message type we care about
45
- * @param onEventTriggered optional callback when a matching message arrives
46
- * @returns postMessage(data?) helper scoped to this key
47
- */
48
- const useCrossFrameMessageListener = (key, onEventTriggered) => {
49
- const { allowedOrigins, postMessage, senderId } = useCommunicator();
50
- ensureGlobalListener(allowedOrigins, senderId);
51
- if (onEventTriggered) {
52
- addSubscriber(key, onEventTriggered);
53
- try {
54
- const destroyRef = inject(DestroyRef, { optional: true });
55
- if (destroyRef) destroyRef.onDestroy(() => removeSubscriber(key, onEventTriggered));
56
- } catch {
57
- console.warn("useCrossFrameMessageListener called outside injection context; cleanup may not be available.");
58
- }
59
- }
60
- const postMessageWrapper = (data) => {
61
- postMessage({
62
- type: key,
63
- data,
64
- senderId
65
- });
66
- };
67
- return postMessageWrapper;
68
- };
69
-
70
- //#endregion
71
- export { useCrossFrameMessageListener };
1
+ "use client";import{useCommunicator as e}from"./communicator.mjs";import{DestroyRef as t,inject as n}from"@angular/core";import{compareUrls as r}from"@intlayer/editor";const i=new Map;let a=!1;const o=(e,t)=>{let n=i.get(e);n||(n=new Set,i.set(e,n)),n.add(t)},s=(e,t)=>{let n=i.get(e);n&&(n.delete(t),n.size===0&&i.delete(e))},c=(e,t)=>{a||=(window.addEventListener(`message`,n=>{let{type:a,data:o,senderId:s}=n.data??{};a&&s!==t&&(!e||e.includes(`*`)||e.some(e=>r(e,n.origin)))&&i.get(a)?.forEach(e=>{e(o)})}),!0)},l=(r,i)=>{let{allowedOrigins:a,postMessage:l,senderId:u}=e();if(c(a,u),i){o(r,i);try{let e=n(t,{optional:!0});e&&e.onDestroy(()=>s(r,i))}catch{console.warn(`useCrossFrameMessageListener called outside injection context; cleanup may not be available.`)}}return e=>{l({type:r,data:e,senderId:u})}};export{l as useCrossFrameMessageListener};
72
2
  //# sourceMappingURL=useCrossFrameMessageListener.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCrossFrameMessageListener.mjs","names":[],"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":";;;;;;;;AAUA,MAAM,8BAAc,IAAI,KAAyB;;AAGjD,IAAI,yBAAyB;;AAG7B,MAAM,iBAAiB,KAAa,OAAc;CAChD,IAAI,MAAM,YAAY,IAAI,IAAI;AAC9B,KAAI,CAAC,KAAK;AACR,wBAAM,IAAI,KAAK;AACf,cAAY,IAAI,KAAK,IAAI;;AAE3B,KAAI,IAAI,GAAG;;AAGb,MAAM,oBAAoB,KAAa,OAAc;CACnD,MAAM,MAAM,YAAY,IAAI,IAAI;AAChC,KAAI,CAAC,IAAK;AACV,KAAI,OAAO,GAAG;AACd,KAAI,IAAI,SAAS,EAAG,aAAY,OAAO,IAAI;;;AAI7C,MAAM,wBACJ,gBACA,WACG;AACH,KAAI,uBAAwB;AAC5B,QAAO,iBAAiB,YAAY,UAAU;EAC5C,MAAM,EAAE,MAAM,MAAM,aAAa,MAAM,QAAQ,EAAE;AACjD,MAAI,CAAC,KAAM;AACX,MAAI,aAAa,OAAQ;AAGzB,MACE,CAAC,kBACD,eAAe,SAAS,IAAI,IAC5B,eAAe,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,CAGxD,aAAY,IAAI,KAAK,EAAE,SAAS,OAAO;AACrC,MAAG,KAAK;IACR;GAEJ;AACF,0BAAyB;;;;;;;;;;AAY3B,MAAa,gCACX,KACA,qBACG;CAEH,MAAM,EAAE,gBAAgB,aAAa,aAAa,iBAAiB;AAGnE,sBAAqB,gBAAgB,SAAS;AAG9C,KAAI,kBAAkB;AACpB,gBAAc,KAAK,iBAA0B;AAG7C,MAAI;GACF,MAAM,aAAa,OAAO,YAAY,EAAE,UAAU,MAAM,CAAC;AACzD,OAAI,WACF,YAAW,gBACT,iBAAiB,KAAK,iBAA0B,CACjD;UAEG;AAEN,WAAQ,KACN,+FAED;;;CAKL,MAAM,sBAAsB,SAAa;AACvC,cAAY;GAAE,MAAM;GAAK;GAAM;GAAU,CAAC;;AAG5C,QAAO"}
1
+ {"version":3,"file":"useCrossFrameMessageListener.mjs","names":[],"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":"wKAUA,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,GAAM,EAAY,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,YAAa,GAAiB,CAMnE,GAHA,EAAqB,EAAgB,EAAS,CAG1C,EAAkB,CACpB,EAAc,EAAK,EAA0B,CAG7C,GAAI,CACF,IAAM,EAAa,EAAO,EAAY,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,113 +1,2 @@
1
- import { useCommunicator } from "./communicator.mjs";
2
- import { useCrossFrameMessageListener } from "./useCrossFrameMessageListener.mjs";
3
- import { signal } from "@angular/core";
4
-
5
- //#region src/editor/useCrossFrameState.ts
6
- const crossFrameStateCache = /* @__PURE__ */ new Map();
7
- /**
8
- * Utility to resolve either a value or an updater function (mirrors React's `setState`).
9
- */
10
- const resolveState = (state, prevState) => {
11
- if (typeof state === "function") return state(prevState);
12
- return state;
13
- };
14
- /**
15
- * Creates a plain object copy that can be safely serialized
16
- * for postMessage communication
17
- */
18
- const toSerializable = (obj) => {
19
- if (obj === null || obj === void 0) return obj;
20
- return JSON.parse(JSON.stringify(obj));
21
- };
22
- /**
23
- * Angular replacement for Vue's cross-frame state composable.
24
- * It synchronises a reactive value across frames/windows via the `postMessage` API.
25
- *
26
- * @template S The type of the state being synchronised.
27
- * @param key Unique key identifying this state channel.
28
- * @param initialState Initial value (or lazy factory) for the state.
29
- * @param options Control flags for emitting/receiving updates.
30
- *
31
- * @returns `[stateSignal, setState, postState]`
32
- * - `stateSignal` – Angular `Signal<S | undefined>` holding the current state.
33
- * - `setState` – Setter with the same API as React's `setState`.
34
- * - `postState` – Manually broadcast the current state (useful after mutations outside `setState`).
35
- */
36
- const useCrossFrameState = (key, initialState, options = {
37
- emit: true,
38
- receive: true
39
- }) => {
40
- if (crossFrameStateCache.has(key)) {
41
- const { state, setState, postState } = crossFrameStateCache.get(key);
42
- return [
43
- state,
44
- setState,
45
- postState
46
- ];
47
- }
48
- const { emit = true, receive = true } = options;
49
- /**
50
- * Internal reactive state using Angular signals.
51
- * We resolve the initial value here to avoid one extra render (same idea as in the React version).
52
- */
53
- const stateSignal = signal(resolveState(initialState));
54
- const { postMessage, senderId } = useCommunicator();
55
- /**
56
- * Broadcast the given value if emitting is allowed and the communicator is ready.
57
- */
58
- const broadcastState = (value) => {
59
- if (!emit || typeof postMessage !== "function" || typeof value === "undefined") return;
60
- postMessage({
61
- type: `${key}/post`,
62
- data: value,
63
- senderId
64
- });
65
- };
66
- /**
67
- * Setter that mirrors React's `setState` signature (supports value or updater fn).
68
- */
69
- const setState = (valueOrUpdater) => {
70
- const serialised = toSerializable(resolveState(valueOrUpdater, stateSignal()));
71
- stateSignal.set(serialised);
72
- broadcastState(serialised);
73
- };
74
- /**
75
- * Manually broadcast the current state to peers.
76
- */
77
- const postState = () => {
78
- if (typeof postMessage !== "function") return;
79
- postMessage({
80
- type: `${key}/post`,
81
- data: stateSignal(),
82
- senderId
83
- });
84
- };
85
- broadcastState(stateSignal());
86
- if (receive && typeof postMessage === "function" && typeof stateSignal() === "undefined") postMessage({
87
- type: `${key}/get`,
88
- senderId
89
- });
90
- useCrossFrameMessageListener(`${key}/post`, receive ? (data) => {
91
- stateSignal.set(data);
92
- } : void 0);
93
- const handleGetMessage = (_, originSenderId) => {
94
- if (!emit) return;
95
- if (originSenderId === senderId) return;
96
- broadcastState(stateSignal());
97
- };
98
- useCrossFrameMessageListener(`${key}/get`, emit ? handleGetMessage : void 0);
99
- crossFrameStateCache.set(key, {
100
- state: stateSignal,
101
- setState,
102
- postState
103
- });
104
- return [
105
- stateSignal,
106
- setState,
107
- postState
108
- ];
109
- };
110
-
111
- //#endregion
112
- export { useCrossFrameState };
1
+ import{useCommunicator as e}from"./communicator.mjs";import{useCrossFrameMessageListener as t}from"./useCrossFrameMessageListener.mjs";import{signal as n}from"@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=n(i(s)),{postMessage:f,senderId:p}=e(),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(`${o}/post`,u?e=>{d.set(e)}:void 0),t(`${o}/get`,l?(e,t)=>{l&&t!==p&&m(d())}:void 0),r.set(o,{state:d,setState:h,postState:g}),[d,h,g]};export{o as useCrossFrameState};
113
2
  //# sourceMappingURL=useCrossFrameState.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCrossFrameState.mjs","names":[],"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":";;;;;AAYA,MAAM,uCAAuB,IAAI,KAO9B;;;;AAKH,MAAM,gBACJ,OACA,cACkB;AAClB,KAAI,OAAO,UAAU,WACnB,QAAQ,MAA0B,UAAU;AAE9C,QAAO;;;;;;AAOT,MAAM,kBAAqB,QAAc;AACvC,KAAI,QAAQ,QAAQ,QAAQ,OAAW,QAAO;AAE9C,QAAO,KAAK,MAAM,KAAK,UAAU,IAAI,CAAC;;;;;;;;;;;;;;;;AAiBxC,MAAa,sBACX,KACA,cACA,UAAkC;CAAE,MAAM;CAAM,SAAS;CAAM,KAK5D;AACH,KAAI,qBAAqB,IAAI,IAAI,EAAE;EAEjC,MAAM,EAAE,OAAO,UAAU,cAAc,qBAAqB,IAAI,IAAI;AACpE,SAAO;GAAC;GAAO;GAAU;GAAU;;CAGrC,MAAM,EAAE,OAAO,MAAM,UAAU,SAAS;;;;;CAMxC,MAAM,cAAc,OAAsB,aAAgB,aAAa,CAAC;CAGxE,MAAM,EAAE,aAAa,aAAa,iBAAiB;;;;CAKnD,MAAM,kBAAkB,UAAyB;AAC/C,MACE,CAAC,QACD,OAAO,gBAAgB,cACvB,OAAO,UAAU,YAEjB;AACF,cAAY;GACV,MAAM,GAAG,IAAI;GACb,MAAM;GACN;GACD,CAAC;;;;;CAMJ,MAAM,YAAY,mBAAqD;EAErE,MAAM,aAAa,eADN,aAAgB,gBAAuB,aAAa,CAAC,CAC3B;AACvC,cAAY,IAAI,WAAW;AAC3B,iBAAe,WAAW;;;;;CAM5B,MAAM,kBAAkB;AACtB,MAAI,OAAO,gBAAgB,WAAY;AACvC,cAAY;GACV,MAAM,GAAG,IAAI;GACb,MAAM,aAAa;GACnB;GACD,CAAC;;AAIJ,gBAAe,aAAa,CAAC;AAG7B,KACE,WACA,OAAO,gBAAgB,cACvB,OAAO,aAAa,KAAK,YAEzB,aAAY;EAAE,MAAM,GAAG,IAAI;EAAO;EAAU,CAAC;AAM/C,8BACE,GAAG,IAAI,QACP,WACK,SAAS;AACR,cAAY,IAAI,KAAK;KAEvB,OACL;CAGD,MAAM,oBAAoB,GAAY,mBAA4B;AAChE,MAAI,CAAC,KAAM;AACX,MAAI,mBAAmB,SAAU;AACjC,iBAAe,aAAa,CAAC;;AAG/B,8BACE,GAAG,IAAI,OACP,OAAO,mBAAmB,OAC3B;AAGD,sBAAqB,IAAI,KAAK;EAAE,OAAO;EAAa;EAAU;EAAW,CAAC;AAE1E,QAAO;EAAC;EAAsC;EAAU;EAAU"}
1
+ {"version":3,"file":"useCrossFrameState.mjs","names":[],"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":"8KAYA,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,EAAc,EAAsB,EAAgB,EAAa,CAAC,CAGlE,CAAE,cAAa,YAAa,GAAiB,CAK7C,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,EACE,GAAG,EAAI,OACP,EACK,GAAS,CACR,EAAY,IAAI,EAAK,EAEvB,IAAA,GACL,CASD,EACE,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,63 +1,2 @@
1
- import { useCrossFrameState } from "./useCrossFrameState.mjs";
2
- import { DestroyRef, inject } from "@angular/core";
3
- import { MessageKey } from "@intlayer/editor";
4
-
5
- //#region src/editor/useCrossURLPathState.ts
6
- /**
7
- * Hook to create and manage a cross-frame synchronized URL path state
8
- * @param initial - The initial URL path
9
- * @param opts - Options for controlling emit and receive behavior
10
- * @returns A tuple containing [state signal, setState function, forceSync function]
11
- */
12
- const useCrossURLPathState = (initial, opts) => useCrossFrameState(MessageKey.INTLAYER_URL_CHANGE, initial, opts);
13
- /**
14
- * Hook for host applications to push URL path changes into the shared state
15
- * This also monkey patches history methods to capture navigation events
16
- * @param initial - The initial URL path
17
- * @returns A tuple containing [state signal, setState function]
18
- */
19
- const useCrossURLPathSetter = (initial) => {
20
- const [state, setState] = useCrossURLPathState(initial, {
21
- emit: true,
22
- receive: false
23
- });
24
- let originalPushState;
25
- let originalReplaceState;
26
- const update = () => setState(window.location.pathname);
27
- try {
28
- const destroyRef = inject(DestroyRef, { optional: true });
29
- if (destroyRef && typeof window !== "undefined") {
30
- originalPushState = history.pushState;
31
- originalReplaceState = history.replaceState;
32
- /**
33
- * Wraps a history function to dispatch a custom event when called
34
- * @param fn - The history function to wrap
35
- * @returns The wrapped function
36
- */
37
- const wrap = (fn) => (...args) => {
38
- fn.apply(history, args);
39
- window.dispatchEvent(new Event("locationchange"));
40
- };
41
- history.pushState = wrap(originalPushState);
42
- history.replaceState = wrap(originalReplaceState);
43
- window.addEventListener("locationchange", update);
44
- window.addEventListener("popstate", update);
45
- window.addEventListener("hashchange", update);
46
- update();
47
- destroyRef.onDestroy(() => {
48
- window.removeEventListener("locationchange", update);
49
- window.removeEventListener("popstate", update);
50
- window.removeEventListener("hashchange", update);
51
- if (originalPushState) history.pushState = originalPushState;
52
- if (originalReplaceState) history.replaceState = originalReplaceState;
53
- });
54
- }
55
- } catch {
56
- console.warn("useCrossURLPathSetter called outside injection context; URL path synchronization may not be available.");
57
- }
58
- return [state, setState];
59
- };
60
-
61
- //#endregion
62
- export { useCrossURLPathSetter, useCrossURLPathState };
1
+ import{useCrossFrameState as e}from"./useCrossFrameState.mjs";import{DestroyRef as t,inject as n}from"@angular/core";import{MessageKey as r}from"@intlayer/editor";const i=(t,n)=>e(r.INTLAYER_URL_CHANGE,t,n),a=e=>{let[r,a]=i(e,{emit:!0,receive:!1}),o,s,c=()=>a(window.location.pathname);try{let e=n(t,{optional:!0});if(e&&typeof window<`u`){o=history.pushState,s=history.replaceState;let t=e=>(...t)=>{e.apply(history,t),window.dispatchEvent(new Event(`locationchange`))};history.pushState=t(o),history.replaceState=t(s),window.addEventListener(`locationchange`,c),window.addEventListener(`popstate`,c),window.addEventListener(`hashchange`,c),c(),e.onDestroy(()=>{window.removeEventListener(`locationchange`,c),window.removeEventListener(`popstate`,c),window.removeEventListener(`hashchange`,c),o&&(history.pushState=o),s&&(history.replaceState=s)})}}catch{console.warn(`useCrossURLPathSetter called outside injection context; URL path synchronization may not be available.`)}return[r,a]};export{a as useCrossURLPathSetter,i as useCrossURLPathState};
63
2
  //# sourceMappingURL=useCrossURLPathState.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCrossURLPathState.mjs","names":[],"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":";;;;;;;;;;;AAUA,MAAa,wBACX,SACA,SACG,mBAA2B,WAAW,qBAAqB,SAAS,KAAK;;;;;;;AAQ9E,MAAa,yBAAyB,YAAqB;CACzD,MAAM,CAAC,OAAO,YAAY,qBAAqB,SAAS;EACtD,MAAM;EACN,SAAS;EACV,CAAC;CAGF,IAAI;CACJ,IAAI;CAGJ,MAAM,eAAe,SAAS,OAAO,SAAS,SAAS;AAGvD,KAAI;EACF,MAAM,aAAa,OAAO,YAAY,EAAE,UAAU,MAAM,CAAC;AAEzD,MAAI,cAAc,OAAO,WAAW,aAAa;AAE/C,uBAAoB,QAAQ;AAC5B,0BAAuB,QAAQ;;;;;;GAO/B,MAAM,QACH,QACA,GAAG,SAA+C;AACjD,OAAG,MAAM,SAAS,KAAK;AACvB,WAAO,cAAc,IAAI,MAAM,iBAAiB,CAAC;;AAIrD,WAAQ,YAAY,KAAK,kBAAkB;AAC3C,WAAQ,eAAe,KAAK,qBAAqB;AAGjD,UAAO,iBAAiB,kBAAkB,OAAO;AACjD,UAAO,iBAAiB,YAAY,OAAO;AAC3C,UAAO,iBAAiB,cAAc,OAAO;AAG7C,WAAQ;AAGR,cAAW,gBAAgB;AACzB,WAAO,oBAAoB,kBAAkB,OAAO;AACpD,WAAO,oBAAoB,YAAY,OAAO;AAC9C,WAAO,oBAAoB,cAAc,OAAO;AAGhD,QAAI,kBAAmB,SAAQ,YAAY;AAC3C,QAAI,qBAAsB,SAAQ,eAAe;KACjD;;SAEE;AACN,UAAQ,KACN,yGAED;;AAGH,QAAO,CAAC,OAAO,SAAS"}
1
+ {"version":3,"file":"useCrossURLPathState.mjs","names":[],"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":"mKAUA,MAAa,GACX,EACA,IACG,EAA2B,EAAW,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,EAAa,EAAO,EAAY,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,27 +1,2 @@
1
- import { __decorate } from "../_virtual/_@oxc-project_runtime@0.112.0/helpers/decorate.mjs";
2
- import { Injectable, InjectionToken, computed, inject } from "@angular/core";
3
-
4
- //#region src/editor/useEditedContentRenderer.ts
5
- const EDITED_CONTENT_ACTIONS_TOKEN = new InjectionToken("editedContentActions");
6
- let EditedContentRendererService = class EditedContentRendererService {
7
- /**
8
- * Mirrors the React hook one-for-one.
9
- */
10
- useEditedContentRenderer(dictionaryKey, keyPath, fallback) {
11
- const editedContentContext = inject(EDITED_CONTENT_ACTIONS_TOKEN, { optional: true });
12
- return computed(() => {
13
- return editedContentContext?.getEditedContentValue(dictionaryKey, keyPath) ?? fallback;
14
- });
15
- }
16
- };
17
- EditedContentRendererService = __decorate([Injectable({ providedIn: "root" })], EditedContentRendererService);
18
- /**
19
- * Standalone function that can be used like the Vue composable
20
- */
21
- const useEditedContentRenderer = (dictionaryKey, keyPath, fallback) => {
22
- return inject(EditedContentRendererService).useEditedContentRenderer(dictionaryKey, keyPath, fallback);
23
- };
24
-
25
- //#endregion
26
- export { EDITED_CONTENT_ACTIONS_TOKEN, EditedContentRendererService, useEditedContentRenderer };
1
+ import{__decorate as e}from"../_virtual/_@oxc-project_runtime@0.112.0/helpers/decorate.mjs";import{Injectable as t,InjectionToken as n,computed as r,inject as i}from"@angular/core";const a=new n(`editedContentActions`);let o=class{useEditedContentRenderer(e,t,n){let o=i(a,{optional:!0});return r(()=>o?.getEditedContentValue(e,t)??n)}};o=e([t({providedIn:`root`})],o);const s=(e,t,n)=>i(o).useEditedContentRenderer(e,t,n);export{a as EDITED_CONTENT_ACTIONS_TOKEN,o as EditedContentRendererService,s as useEditedContentRenderer};
27
2
  //# sourceMappingURL=useEditedContentRenderer.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEditedContentRenderer.mjs","names":[],"sources":["../../../src/editor/useEditedContentRenderer.ts"],"sourcesContent":["import {\n computed,\n Injectable,\n InjectionToken,\n inject,\n type Signal,\n} from '@angular/core';\nimport type { KeyPath } from '@intlayer/types';\n\nexport interface EditedContentActions {\n getEditedContentValue(dictionaryKey: string, keyPath: KeyPath[]): unknown;\n}\n\nexport const EDITED_CONTENT_ACTIONS_TOKEN =\n new InjectionToken<EditedContentActions | null>('editedContentActions');\n\n@Injectable({\n providedIn: 'root',\n})\nexport class EditedContentRendererService {\n /**\n * Mirrors the React hook one-for-one.\n */\n useEditedContentRenderer(\n dictionaryKey: string,\n keyPath: KeyPath[],\n fallback: unknown\n ): Signal<unknown> {\n const editedContentContext = inject(EDITED_CONTENT_ACTIONS_TOKEN, {\n optional: true,\n });\n\n return computed(() => {\n const edited = editedContentContext?.getEditedContentValue(\n dictionaryKey,\n keyPath\n ) as string | undefined;\n\n return edited ?? fallback;\n });\n }\n}\n\n/**\n * Standalone function that can be used like the Vue composable\n */\nexport const useEditedContentRenderer = (\n dictionaryKey: string,\n keyPath: KeyPath[],\n fallback: unknown\n): Signal<unknown> => {\n const service = inject(EditedContentRendererService);\n return service.useEditedContentRenderer(dictionaryKey, keyPath, fallback);\n};\n"],"mappings":";;;;AAaA,MAAa,+BACX,IAAI,eAA4C,uBAAuB;AAKlE,yCAAM,6BAA6B;;;;CAIxC,yBACE,eACA,SACA,UACiB;EACjB,MAAM,uBAAuB,OAAO,8BAA8B,EAChE,UAAU,MACX,CAAC;AAEF,SAAO,eAAe;AAMpB,UALe,sBAAsB,sBACnC,eACA,QACD,IAEgB;IACjB;;;2CAvBL,WAAW,EACV,YAAY,QACb,CAAC;;;;AA4BF,MAAa,4BACX,eACA,SACA,aACoB;AAEpB,QADgB,OAAO,6BAA6B,CACrC,yBAAyB,eAAe,SAAS,SAAS"}
1
+ {"version":3,"file":"useEditedContentRenderer.mjs","names":[],"sources":["../../../src/editor/useEditedContentRenderer.ts"],"sourcesContent":["import {\n computed,\n Injectable,\n InjectionToken,\n inject,\n type Signal,\n} from '@angular/core';\nimport type { KeyPath } from '@intlayer/types';\n\nexport interface EditedContentActions {\n getEditedContentValue(dictionaryKey: string, keyPath: KeyPath[]): unknown;\n}\n\nexport const EDITED_CONTENT_ACTIONS_TOKEN =\n new InjectionToken<EditedContentActions | null>('editedContentActions');\n\n@Injectable({\n providedIn: 'root',\n})\nexport class EditedContentRendererService {\n /**\n * Mirrors the React hook one-for-one.\n */\n useEditedContentRenderer(\n dictionaryKey: string,\n keyPath: KeyPath[],\n fallback: unknown\n ): Signal<unknown> {\n const editedContentContext = inject(EDITED_CONTENT_ACTIONS_TOKEN, {\n optional: true,\n });\n\n return computed(() => {\n const edited = editedContentContext?.getEditedContentValue(\n dictionaryKey,\n keyPath\n ) as string | undefined;\n\n return edited ?? fallback;\n });\n }\n}\n\n/**\n * Standalone function that can be used like the Vue composable\n */\nexport const useEditedContentRenderer = (\n dictionaryKey: string,\n keyPath: KeyPath[],\n fallback: unknown\n): Signal<unknown> => {\n const service = inject(EditedContentRendererService);\n return service.useEditedContentRenderer(dictionaryKey, keyPath, fallback);\n};\n"],"mappings":"qLAaA,MAAa,EACX,IAAI,EAA4C,uBAAuB,CAKlE,IAAA,EAAA,KAAmC,CAIxC,yBACE,EACA,EACA,EACiB,CACjB,IAAM,EAAuB,EAAO,EAA8B,CAChE,SAAU,GACX,CAAC,CAEF,OAAO,MACU,GAAsB,sBACnC,EACA,EACD,EAEgB,EACjB,QAvBL,EAAW,CACV,WAAY,OACb,CAAC,CAAA,CAAA,EAAA,CA4BF,MAAa,GACX,EACA,EACA,IAEgB,EAAO,EAA6B,CACrC,yBAAyB,EAAe,EAAS,EAAS"}
@@ -1,24 +1,2 @@
1
- import { createSharedComposable } from "./createSharedComposable.mjs";
2
- import { useEditorEnabled } from "./editorEnabled.mjs";
3
- import { useFocusDictionary } from "./focusDictionary.mjs";
4
- import { useConfiguration } from "./configuration.mjs";
5
- import { useDictionariesRecord } from "./dictionariesRecord.mjs";
6
- import { useEditorLocale } from "./editorLocale.mjs";
7
- import { useCrossURLPathSetter } from "./useCrossURLPathState.mjs";
8
- import { useIframeClickMerger } from "./useIframeClickInterceptor.mjs";
9
-
10
- //#region src/editor/useEditor.ts
11
- const useEditor = createSharedComposable(() => {
12
- useConfiguration();
13
- useEditorEnabled();
14
- useFocusDictionary();
15
- useIframeClickMerger();
16
- useCrossURLPathSetter();
17
- useEditorLocale();
18
- useDictionariesRecord();
19
- useEditorLocale();
20
- });
21
-
22
- //#endregion
23
- export { useEditor };
1
+ import{createSharedComposable as e}from"./createSharedComposable.mjs";import{useEditorEnabled as t}from"./editorEnabled.mjs";import{useFocusDictionary as n}from"./focusDictionary.mjs";import{useConfiguration as r}from"./configuration.mjs";import{useDictionariesRecord as i}from"./dictionariesRecord.mjs";import{useEditorLocale as a}from"./editorLocale.mjs";import{useCrossURLPathSetter as o}from"./useCrossURLPathState.mjs";import{useIframeClickMerger as s}from"./useIframeClickInterceptor.mjs";const c=e(()=>{r(),t(),n(),s(),o(),a(),i(),a()});export{c as useEditor};
24
2
  //# sourceMappingURL=useEditor.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEditor.mjs","names":[],"sources":["../../../src/editor/useEditor.ts"],"sourcesContent":["import { useConfiguration } from './configuration';\nimport { createSharedComposable } from './createSharedComposable';\nimport { useDictionariesRecord } from './dictionariesRecord';\nimport { useEditorEnabled } from './editorEnabled';\nimport { useEditorLocale } from './editorLocale';\nimport { useFocusDictionary } from './focusDictionary';\nimport { useCrossURLPathSetter } from './useCrossURLPathState';\nimport { useIframeClickMerger } from './useIframeClickInterceptor';\n\nexport const useEditor = createSharedComposable(() => {\n useConfiguration();\n useEditorEnabled();\n useFocusDictionary();\n useIframeClickMerger();\n useCrossURLPathSetter();\n useEditorLocale();\n useDictionariesRecord();\n useEditorLocale();\n});\n"],"mappings":";;;;;;;;;;AASA,MAAa,YAAY,6BAA6B;AACpD,mBAAkB;AAClB,mBAAkB;AAClB,qBAAoB;AACpB,uBAAsB;AACtB,wBAAuB;AACvB,kBAAiB;AACjB,wBAAuB;AACvB,kBAAiB;EACjB"}
1
+ {"version":3,"file":"useEditor.mjs","names":[],"sources":["../../../src/editor/useEditor.ts"],"sourcesContent":["import { useConfiguration } from './configuration';\nimport { createSharedComposable } from './createSharedComposable';\nimport { useDictionariesRecord } from './dictionariesRecord';\nimport { useEditorEnabled } from './editorEnabled';\nimport { useEditorLocale } from './editorLocale';\nimport { useFocusDictionary } from './focusDictionary';\nimport { useCrossURLPathSetter } from './useCrossURLPathState';\nimport { useIframeClickMerger } from './useIframeClickInterceptor';\n\nexport const useEditor = createSharedComposable(() => {\n useConfiguration();\n useEditorEnabled();\n useFocusDictionary();\n useIframeClickMerger();\n useCrossURLPathSetter();\n useEditorLocale();\n useDictionariesRecord();\n useEditorLocale();\n});\n"],"mappings":"+eASA,MAAa,EAAY,MAA6B,CACpD,GAAkB,CAClB,GAAkB,CAClB,GAAoB,CACpB,GAAsB,CACtB,GAAuB,CACvB,GAAiB,CACjB,GAAuB,CACvB,GAAiB,EACjB"}
@@ -1,37 +1,2 @@
1
- import { createSharedComposable } from "./createSharedComposable.mjs";
2
- import { useCrossFrameMessageListener } from "./useCrossFrameMessageListener.mjs";
3
- import { DestroyRef, inject } from "@angular/core";
4
- import { MessageKey, mergeIframeClick } from "@intlayer/editor";
5
-
6
- //#region src/editor/useIframeClickInterceptor.ts
7
- /**
8
- * Hook that intercepts clicks in the iframe and sends them to the parent window
9
- * This allows the parent window to know when the iframe is clicked
10
- */
11
- const useIframeClickInterceptor = createSharedComposable(() => {
12
- const postMessage = useCrossFrameMessageListener(MessageKey.INTLAYER_IFRAME_CLICKED);
13
- const handler = () => {
14
- postMessage();
15
- };
16
- try {
17
- const destroyRef = inject(DestroyRef, { optional: true });
18
- if (destroyRef && typeof window !== "undefined") {
19
- window.addEventListener("mousedown", handler);
20
- destroyRef.onDestroy(() => window.removeEventListener("mousedown", handler));
21
- }
22
- } catch {
23
- console.warn("useIframeClickInterceptor called outside injection context; event listener setup may not be available.");
24
- }
25
- });
26
- /**
27
- * Hook for the parent window to listen for iframe clicks and merge them
28
- * This makes iframe clicks behave as if they happened in the parent window
29
- */
30
- const useIframeClickMerger = createSharedComposable(() => {
31
- useIframeClickInterceptor();
32
- useCrossFrameMessageListener(MessageKey.INTLAYER_IFRAME_CLICKED, mergeIframeClick);
33
- });
34
-
35
- //#endregion
36
- export { useIframeClickInterceptor, useIframeClickMerger };
1
+ import{createSharedComposable as e}from"./createSharedComposable.mjs";import{useCrossFrameMessageListener as t}from"./useCrossFrameMessageListener.mjs";import{DestroyRef as n,inject as r}from"@angular/core";import{MessageKey as i,mergeIframeClick as a}from"@intlayer/editor";const o=e(()=>{let e=t(i.INTLAYER_IFRAME_CLICKED),a=()=>{e()};try{let e=r(n,{optional:!0});e&&typeof window<`u`&&(window.addEventListener(`mousedown`,a),e.onDestroy(()=>window.removeEventListener(`mousedown`,a)))}catch{console.warn(`useIframeClickInterceptor called outside injection context; event listener setup may not be available.`)}}),s=e(()=>{o(),t(i.INTLAYER_IFRAME_CLICKED,a)});export{o as useIframeClickInterceptor,s as useIframeClickMerger};
37
2
  //# sourceMappingURL=useIframeClickInterceptor.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useIframeClickInterceptor.mjs","names":[],"sources":["../../../src/editor/useIframeClickInterceptor.ts"],"sourcesContent":["import { DestroyRef, inject } from '@angular/core';\nimport { MessageKey, mergeIframeClick } from '@intlayer/editor';\nimport { createSharedComposable } from './createSharedComposable';\nimport { useCrossFrameMessageListener } from './useCrossFrameMessageListener';\n\n/* ─────────────────────────────────────────────\n 1. \"Interceptor\" – send a postMessage when\n the editor iframe itself is clicked.\n────────────────────────────────────────────── */\n/**\n * Hook that intercepts clicks in the iframe and sends them to the parent window\n * This allows the parent window to know when the iframe is clicked\n */\nexport const useIframeClickInterceptor = createSharedComposable(() => {\n const postMessage = useCrossFrameMessageListener<undefined>(\n MessageKey.INTLAYER_IFRAME_CLICKED\n );\n\n const handler = () => {\n postMessage();\n };\n\n // Use Angular's DestroyRef for cleanup instead of Vue's lifecycle hooks\n try {\n const destroyRef = inject(DestroyRef, { optional: true });\n\n if (destroyRef && typeof window !== 'undefined') {\n // Set up event listener immediately\n window.addEventListener('mousedown', handler);\n\n // Clean up on destroy\n destroyRef.onDestroy(() =>\n window.removeEventListener('mousedown', handler)\n );\n }\n } catch {\n console.warn(\n 'useIframeClickInterceptor called outside injection context; ' +\n 'event listener setup may not be available.'\n );\n }\n});\n\n/**\n * Hook for the parent window to listen for iframe clicks and merge them\n * This makes iframe clicks behave as if they happened in the parent window\n */\nexport const useIframeClickMerger = createSharedComposable(() => {\n useIframeClickInterceptor();\n\n useCrossFrameMessageListener<MessageEvent>(\n MessageKey.INTLAYER_IFRAME_CLICKED,\n mergeIframeClick\n );\n});\n"],"mappings":";;;;;;;;;;AAaA,MAAa,4BAA4B,6BAA6B;CACpE,MAAM,cAAc,6BAClB,WAAW,wBACZ;CAED,MAAM,gBAAgB;AACpB,eAAa;;AAIf,KAAI;EACF,MAAM,aAAa,OAAO,YAAY,EAAE,UAAU,MAAM,CAAC;AAEzD,MAAI,cAAc,OAAO,WAAW,aAAa;AAE/C,UAAO,iBAAiB,aAAa,QAAQ;AAG7C,cAAW,gBACT,OAAO,oBAAoB,aAAa,QAAQ,CACjD;;SAEG;AACN,UAAQ,KACN,yGAED;;EAEH;;;;;AAMF,MAAa,uBAAuB,6BAA6B;AAC/D,4BAA2B;AAE3B,8BACE,WAAW,yBACX,iBACD;EACD"}
1
+ {"version":3,"file":"useIframeClickInterceptor.mjs","names":[],"sources":["../../../src/editor/useIframeClickInterceptor.ts"],"sourcesContent":["import { DestroyRef, inject } from '@angular/core';\nimport { MessageKey, mergeIframeClick } from '@intlayer/editor';\nimport { createSharedComposable } from './createSharedComposable';\nimport { useCrossFrameMessageListener } from './useCrossFrameMessageListener';\n\n/* ─────────────────────────────────────────────\n 1. \"Interceptor\" – send a postMessage when\n the editor iframe itself is clicked.\n────────────────────────────────────────────── */\n/**\n * Hook that intercepts clicks in the iframe and sends them to the parent window\n * This allows the parent window to know when the iframe is clicked\n */\nexport const useIframeClickInterceptor = createSharedComposable(() => {\n const postMessage = useCrossFrameMessageListener<undefined>(\n MessageKey.INTLAYER_IFRAME_CLICKED\n );\n\n const handler = () => {\n postMessage();\n };\n\n // Use Angular's DestroyRef for cleanup instead of Vue's lifecycle hooks\n try {\n const destroyRef = inject(DestroyRef, { optional: true });\n\n if (destroyRef && typeof window !== 'undefined') {\n // Set up event listener immediately\n window.addEventListener('mousedown', handler);\n\n // Clean up on destroy\n destroyRef.onDestroy(() =>\n window.removeEventListener('mousedown', handler)\n );\n }\n } catch {\n console.warn(\n 'useIframeClickInterceptor called outside injection context; ' +\n 'event listener setup may not be available.'\n );\n }\n});\n\n/**\n * Hook for the parent window to listen for iframe clicks and merge them\n * This makes iframe clicks behave as if they happened in the parent window\n */\nexport const useIframeClickMerger = createSharedComposable(() => {\n useIframeClickInterceptor();\n\n useCrossFrameMessageListener<MessageEvent>(\n MessageKey.INTLAYER_IFRAME_CLICKED,\n mergeIframeClick\n );\n});\n"],"mappings":"mRAaA,MAAa,EAA4B,MAA6B,CACpE,IAAM,EAAc,EAClB,EAAW,wBACZ,CAEK,MAAgB,CACpB,GAAa,EAIf,GAAI,CACF,IAAM,EAAa,EAAO,EAAY,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,EAAuB,MAA6B,CAC/D,GAA2B,CAE3B,EACE,EAAW,wBACX,EACD,EACD"}
@@ -1,16 +1,2 @@
1
- import { htmlPlugin, intlayerNodePlugins, markdownPlugin } from "./plugins.mjs";
2
- import { getDictionary as getDictionary$1 } from "@intlayer/core";
3
-
4
- //#region src/getDictionary.ts
5
- const getDictionary = (dictionary, locale, additionalPlugins) => {
6
- return getDictionary$1(dictionary, locale, [
7
- intlayerNodePlugins,
8
- markdownPlugin,
9
- htmlPlugin,
10
- ...additionalPlugins ?? []
11
- ]);
12
- };
13
-
14
- //#endregion
15
- export { getDictionary };
1
+ import{htmlPlugin as e,intlayerNodePlugins as t,markdownPlugin as n}from"./plugins.mjs";import{getDictionary as r}from"@intlayer/core/interpreter";const i=(i,a,o)=>r(i,a,[t,n,e,...o??[]]);export{i as getDictionary};
16
2
  //# sourceMappingURL=getDictionary.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"getDictionary.mjs","names":["getDictionaryCore"],"sources":["../../src/getDictionary.ts"],"sourcesContent":["import {\n getDictionary as getDictionaryCore,\n type Plugins,\n} from '@intlayer/core';\nimport type {\n DeclaredLocales,\n Dictionary,\n LocalesValues,\n} from '@intlayer/types';\nimport { htmlPlugin, intlayerNodePlugins, markdownPlugin } from './plugins';\n\nexport const getDictionary = <\n T extends Dictionary,\n L extends LocalesValues = DeclaredLocales,\n>(\n dictionary: T,\n locale?: L,\n additionalPlugins?: Plugins[]\n) => {\n const plugins: Plugins[] = [\n intlayerNodePlugins,\n markdownPlugin,\n htmlPlugin,\n ...(additionalPlugins ?? []),\n ];\n\n return getDictionaryCore<T, L>(dictionary, locale, plugins);\n};\n"],"mappings":";;;;AAWA,MAAa,iBAIX,YACA,QACA,sBACG;AAQH,QAAOA,gBAAwB,YAAY,QAPhB;EACzB;EACA;EACA;EACA,GAAI,qBAAqB,EAAE;EAC5B,CAE0D"}
1
+ {"version":3,"file":"getDictionary.mjs","names":["getDictionaryCore"],"sources":["../../src/getDictionary.ts"],"sourcesContent":["import {\n getDictionary as getDictionaryCore,\n type Plugins,\n} from '@intlayer/core/interpreter';\nimport type {\n DeclaredLocales,\n Dictionary,\n LocalesValues,\n} from '@intlayer/types';\nimport { htmlPlugin, intlayerNodePlugins, markdownPlugin } from './plugins';\n\nexport const getDictionary = <\n T extends Dictionary,\n L extends LocalesValues = DeclaredLocales,\n>(\n dictionary: T,\n locale?: L,\n additionalPlugins?: Plugins[]\n) => {\n const plugins: Plugins[] = [\n intlayerNodePlugins,\n markdownPlugin,\n htmlPlugin,\n ...(additionalPlugins ?? []),\n ];\n\n return getDictionaryCore<T, L>(dictionary, locale, plugins);\n};\n"],"mappings":"mJAWA,MAAa,GAIX,EACA,EACA,IASOA,EAAwB,EAAY,EAPhB,CACzB,EACA,EACA,EACA,GAAI,GAAqB,EAAE,CAC5B,CAE0D"}
@@ -1,17 +1,2 @@
1
- import { htmlPlugin, insertionPlugin, intlayerNodePlugins, markdownPlugin } from "./plugins.mjs";
2
- import { getIntlayer as getIntlayer$1 } from "@intlayer/core";
3
-
4
- //#region src/getIntlayer.ts
5
- const getIntlayer = (key, locale, additionalPlugins) => {
6
- return getIntlayer$1(key, locale, [
7
- intlayerNodePlugins,
8
- markdownPlugin,
9
- htmlPlugin,
10
- insertionPlugin,
11
- ...additionalPlugins ?? []
12
- ]);
13
- };
14
-
15
- //#endregion
16
- export { getIntlayer };
1
+ import{htmlPlugin as e,insertionPlugin as t,intlayerNodePlugins as n,markdownPlugin as r}from"./plugins.mjs";import{getIntlayer as i}from"@intlayer/core/interpreter";const a=(a,o,s)=>i(a,o,[n,r,e,t,...s??[]]);export{a as getIntlayer};
17
2
  //# sourceMappingURL=getIntlayer.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"getIntlayer.mjs","names":["getIntlayerCore"],"sources":["../../src/getIntlayer.ts"],"sourcesContent":["import { getIntlayer as getIntlayerCore, type Plugins } from '@intlayer/core';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionaryRegistryContent,\n LocalesValues,\n} from '@intlayer/types';\nimport {\n type DeepTransformContent,\n htmlPlugin,\n insertionPlugin,\n intlayerNodePlugins,\n markdownPlugin,\n} from './plugins';\n\nexport const getIntlayer = <\n T extends DictionaryKeys,\n L extends LocalesValues = DeclaredLocales,\n>(\n key: T,\n locale?: L,\n additionalPlugins?: Plugins[]\n) => {\n const plugins: Plugins[] = [\n intlayerNodePlugins,\n markdownPlugin,\n htmlPlugin,\n insertionPlugin,\n ...(additionalPlugins ?? []),\n ];\n\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n return getIntlayerCore<T, L>(key, locale, plugins) as DeepTransformContent<\n DictionaryRegistryContent<T>\n >;\n};\n"],"mappings":";;;;AAeA,MAAa,eAIX,KACA,QACA,sBACG;AAUH,QAAOA,cAAsB,KAAK,QATP;EACzB;EACA;EACA;EACA;EACA,GAAI,qBAAqB,EAAE;EAC5B,CAGiD"}
1
+ {"version":3,"file":"getIntlayer.mjs","names":["getIntlayerCore"],"sources":["../../src/getIntlayer.ts"],"sourcesContent":["import {\n getIntlayer as getIntlayerCore,\n type Plugins,\n} from '@intlayer/core/interpreter';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionaryRegistryContent,\n LocalesValues,\n} from '@intlayer/types';\nimport {\n type DeepTransformContent,\n htmlPlugin,\n insertionPlugin,\n intlayerNodePlugins,\n markdownPlugin,\n} from './plugins';\n\nexport const getIntlayer = <\n T extends DictionaryKeys,\n L extends LocalesValues = DeclaredLocales,\n>(\n key: T,\n locale?: L,\n additionalPlugins?: Plugins[]\n) => {\n const plugins: Plugins[] = [\n intlayerNodePlugins,\n markdownPlugin,\n htmlPlugin,\n insertionPlugin,\n ...(additionalPlugins ?? []),\n ];\n\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n return getIntlayerCore<T, L>(key, locale, plugins) as DeepTransformContent<\n DictionaryRegistryContent<T>\n >;\n};\n"],"mappings":"sKAkBA,MAAa,GAIX,EACA,EACA,IAWOA,EAAsB,EAAK,EATP,CACzB,EACA,EACA,EACA,EACA,GAAI,GAAqB,EAAE,CAC5B,CAGiD"}