angular-intlayer 6.1.6 → 7.0.0-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/dist/cjs/UI/ContentSelector.component.cjs +94 -121
  2. package/dist/cjs/UI/ContentSelector.component.cjs.map +1 -1
  3. package/dist/cjs/_virtual/rolldown_runtime.cjs +25 -0
  4. package/dist/cjs/client/index.cjs +19 -35
  5. package/dist/cjs/client/installIntlayer.cjs +39 -68
  6. package/dist/cjs/client/installIntlayer.cjs.map +1 -1
  7. package/dist/cjs/client/useDictionary.cjs +13 -36
  8. package/dist/cjs/client/useDictionary.cjs.map +1 -1
  9. package/dist/cjs/client/useDictionaryAsync.cjs +23 -48
  10. package/dist/cjs/client/useDictionaryAsync.cjs.map +1 -1
  11. package/dist/cjs/client/useDictionaryDynamic.cjs +24 -52
  12. package/dist/cjs/client/useDictionaryDynamic.cjs.map +1 -1
  13. package/dist/cjs/client/useIntlayer.cjs +16 -36
  14. package/dist/cjs/client/useIntlayer.cjs.map +1 -1
  15. package/dist/cjs/client/useLoadDynamic.cjs +26 -42
  16. package/dist/cjs/client/useLoadDynamic.cjs.map +1 -1
  17. package/dist/cjs/client/useLocale.cjs +35 -67
  18. package/dist/cjs/client/useLocale.cjs.map +1 -1
  19. package/dist/cjs/client/useLocaleStorage.cjs +61 -0
  20. package/dist/cjs/client/useLocaleStorage.cjs.map +1 -0
  21. package/dist/cjs/editor/ContentSelectorWrapper.component.cjs +41 -63
  22. package/dist/cjs/editor/ContentSelectorWrapper.component.cjs.map +1 -1
  23. package/dist/cjs/editor/EditedContentRenderer.component.cjs +44 -75
  24. package/dist/cjs/editor/EditedContentRenderer.component.cjs.map +1 -1
  25. package/dist/cjs/editor/EditorSelectorRenderer.component.cjs +25 -45
  26. package/dist/cjs/editor/EditorSelectorRenderer.component.cjs.map +1 -1
  27. package/dist/cjs/editor/communicator.cjs +55 -73
  28. package/dist/cjs/editor/communicator.cjs.map +1 -1
  29. package/dist/cjs/editor/configuration.cjs +21 -54
  30. package/dist/cjs/editor/configuration.cjs.map +1 -1
  31. package/dist/cjs/editor/createSharedComposable.cjs +46 -63
  32. package/dist/cjs/editor/createSharedComposable.cjs.map +1 -1
  33. package/dist/cjs/editor/dictionariesRecord.cjs +47 -77
  34. package/dist/cjs/editor/dictionariesRecord.cjs.map +1 -1
  35. package/dist/cjs/editor/editedContent.cjs +58 -71
  36. package/dist/cjs/editor/editedContent.cjs.map +1 -1
  37. package/dist/cjs/editor/editorEnabled.cjs +45 -70
  38. package/dist/cjs/editor/editorEnabled.cjs.map +1 -1
  39. package/dist/cjs/editor/editorLocale.cjs +21 -45
  40. package/dist/cjs/editor/editorLocale.cjs.map +1 -1
  41. package/dist/cjs/editor/focusDictionary.cjs +58 -74
  42. package/dist/cjs/editor/focusDictionary.cjs.map +1 -1
  43. package/dist/cjs/editor/index.cjs +9 -38
  44. package/dist/cjs/editor/installIntlayerEditor.cjs +46 -64
  45. package/dist/cjs/editor/installIntlayerEditor.cjs.map +1 -1
  46. package/dist/cjs/editor/useCrossFrameMessageListener.cjs +63 -72
  47. package/dist/cjs/editor/useCrossFrameMessageListener.cjs.map +1 -1
  48. package/dist/cjs/editor/useCrossFrameState.cjs +108 -88
  49. package/dist/cjs/editor/useCrossFrameState.cjs.map +1 -1
  50. package/dist/cjs/editor/useCrossURLPathState.cjs +64 -69
  51. package/dist/cjs/editor/useCrossURLPathState.cjs.map +1 -1
  52. package/dist/cjs/editor/useEditedContentRenderer.cjs +25 -54
  53. package/dist/cjs/editor/useEditedContentRenderer.cjs.map +1 -1
  54. package/dist/cjs/editor/useEditor.cjs +22 -44
  55. package/dist/cjs/editor/useEditor.cjs.map +1 -1
  56. package/dist/cjs/editor/useIframeClickInterceptor.cjs +38 -59
  57. package/dist/cjs/editor/useIframeClickInterceptor.cjs.map +1 -1
  58. package/dist/cjs/getDictionary.cjs +14 -39
  59. package/dist/cjs/getDictionary.cjs.map +1 -1
  60. package/dist/cjs/getIntlayer.cjs +14 -35
  61. package/dist/cjs/getIntlayer.cjs.map +1 -1
  62. package/dist/cjs/index.cjs +32 -31
  63. package/dist/cjs/markdown/index.cjs +6 -23
  64. package/dist/cjs/markdown/installIntlayerMarkdown.cjs +33 -60
  65. package/dist/cjs/markdown/installIntlayerMarkdown.cjs.map +1 -1
  66. package/dist/cjs/plugins.cjs +77 -108
  67. package/dist/cjs/plugins.cjs.map +1 -1
  68. package/dist/cjs/renderIntlayerNode.cjs +16 -56
  69. package/dist/cjs/renderIntlayerNode.cjs.map +1 -1
  70. package/dist/cjs/webpack/index.cjs +3 -23
  71. package/dist/cjs/webpack/mergeConfig.cjs +33 -68
  72. package/dist/cjs/webpack/mergeConfig.cjs.map +1 -1
  73. package/dist/esm/UI/ContentSelector.component.mjs +89 -104
  74. package/dist/esm/UI/ContentSelector.component.mjs.map +1 -1
  75. package/dist/esm/client/index.mjs +9 -8
  76. package/dist/esm/client/installIntlayer.mjs +29 -27
  77. package/dist/esm/client/installIntlayer.mjs.map +1 -1
  78. package/dist/esm/client/useDictionary.mjs +10 -11
  79. package/dist/esm/client/useDictionary.mjs.map +1 -1
  80. package/dist/esm/client/useDictionaryAsync.mjs +18 -12
  81. package/dist/esm/client/useDictionaryAsync.mjs.map +1 -1
  82. package/dist/esm/client/useDictionaryDynamic.mjs +18 -15
  83. package/dist/esm/client/useDictionaryDynamic.mjs.map +1 -1
  84. package/dist/esm/client/useIntlayer.mjs +12 -10
  85. package/dist/esm/client/useIntlayer.mjs.map +1 -1
  86. package/dist/esm/client/useLoadDynamic.mjs +23 -17
  87. package/dist/esm/client/useLoadDynamic.mjs.map +1 -1
  88. package/dist/esm/client/useLocale.mjs +30 -31
  89. package/dist/esm/client/useLocale.mjs.map +1 -1
  90. package/dist/esm/client/useLocaleStorage.mjs +54 -0
  91. package/dist/esm/client/useLocaleStorage.mjs.map +1 -0
  92. package/dist/esm/editor/ContentSelectorWrapper.component.mjs +32 -34
  93. package/dist/esm/editor/ContentSelectorWrapper.component.mjs.map +1 -1
  94. package/dist/esm/editor/EditedContentRenderer.component.mjs +38 -49
  95. package/dist/esm/editor/EditedContentRenderer.component.mjs.map +1 -1
  96. package/dist/esm/editor/EditorSelectorRenderer.component.mjs +19 -18
  97. package/dist/esm/editor/EditorSelectorRenderer.component.mjs.map +1 -1
  98. package/dist/esm/editor/communicator.mjs +48 -35
  99. package/dist/esm/editor/communicator.mjs.map +1 -1
  100. package/dist/esm/editor/configuration.mjs +15 -18
  101. package/dist/esm/editor/configuration.mjs.map +1 -1
  102. package/dist/esm/editor/createSharedComposable.mjs +42 -37
  103. package/dist/esm/editor/createSharedComposable.mjs.map +1 -1
  104. package/dist/esm/editor/dictionariesRecord.mjs +38 -38
  105. package/dist/esm/editor/dictionariesRecord.mjs.map +1 -1
  106. package/dist/esm/editor/editedContent.mjs +49 -42
  107. package/dist/esm/editor/editedContent.mjs.map +1 -1
  108. package/dist/esm/editor/editorEnabled.mjs +37 -41
  109. package/dist/esm/editor/editorEnabled.mjs.map +1 -1
  110. package/dist/esm/editor/editorLocale.mjs +15 -18
  111. package/dist/esm/editor/editorLocale.mjs.map +1 -1
  112. package/dist/esm/editor/focusDictionary.mjs +50 -45
  113. package/dist/esm/editor/focusDictionary.mjs.map +1 -1
  114. package/dist/esm/editor/index.mjs +3 -7
  115. package/dist/esm/editor/installIntlayerEditor.mjs +40 -26
  116. package/dist/esm/editor/installIntlayerEditor.mjs.map +1 -1
  117. package/dist/esm/editor/useCrossFrameMessageListener.mjs +58 -46
  118. package/dist/esm/editor/useCrossFrameMessageListener.mjs.map +1 -1
  119. package/dist/esm/editor/useCrossFrameState.mjs +104 -62
  120. package/dist/esm/editor/useCrossFrameState.mjs.map +1 -1
  121. package/dist/esm/editor/useCrossURLPathState.mjs +57 -41
  122. package/dist/esm/editor/useCrossURLPathState.mjs.map +1 -1
  123. package/dist/esm/editor/useEditedContentRenderer.mjs +21 -33
  124. package/dist/esm/editor/useEditedContentRenderer.mjs.map +1 -1
  125. package/dist/esm/editor/useEditor.mjs +16 -14
  126. package/dist/esm/editor/useEditor.mjs.map +1 -1
  127. package/dist/esm/editor/useIframeClickInterceptor.mjs +30 -30
  128. package/dist/esm/editor/useIframeClickInterceptor.mjs.map +1 -1
  129. package/dist/esm/getDictionary.mjs +12 -20
  130. package/dist/esm/getDictionary.mjs.map +1 -1
  131. package/dist/esm/getIntlayer.mjs +12 -16
  132. package/dist/esm/getIntlayer.mjs.map +1 -1
  133. package/dist/esm/index.mjs +13 -6
  134. package/dist/esm/markdown/index.mjs +3 -2
  135. package/dist/esm/markdown/installIntlayerMarkdown.mjs +27 -32
  136. package/dist/esm/markdown/installIntlayerMarkdown.mjs.map +1 -1
  137. package/dist/esm/plugins.mjs +70 -83
  138. package/dist/esm/plugins.mjs.map +1 -1
  139. package/dist/esm/renderIntlayerNode.mjs +15 -32
  140. package/dist/esm/renderIntlayerNode.mjs.map +1 -1
  141. package/dist/esm/webpack/index.mjs +3 -2
  142. package/dist/esm/webpack/mergeConfig.mjs +25 -31
  143. package/dist/esm/webpack/mergeConfig.mjs.map +1 -1
  144. package/dist/types/UI/ContentSelector.component.d.ts +32 -30
  145. package/dist/types/UI/ContentSelector.component.d.ts.map +1 -1
  146. package/dist/types/client/index.d.ts +8 -8
  147. package/dist/types/client/installIntlayer.d.ts +15 -9
  148. package/dist/types/client/installIntlayer.d.ts.map +1 -1
  149. package/dist/types/client/useDictionary.d.ts +7 -4
  150. package/dist/types/client/useDictionary.d.ts.map +1 -1
  151. package/dist/types/client/useDictionaryAsync.d.ts +7 -3
  152. package/dist/types/client/useDictionaryAsync.d.ts.map +1 -1
  153. package/dist/types/client/useDictionaryDynamic.d.ts +9 -3
  154. package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -1
  155. package/dist/types/client/useIntlayer.d.ts +9 -7
  156. package/dist/types/client/useIntlayer.d.ts.map +1 -1
  157. package/dist/types/client/useLoadDynamic.d.ts +4 -1
  158. package/dist/types/client/useLoadDynamic.d.ts.map +1 -1
  159. package/dist/types/client/useLocale.d.ts +17 -8
  160. package/dist/types/client/useLocale.d.ts.map +1 -1
  161. package/dist/types/client/useLocaleStorage.d.ts +49 -0
  162. package/dist/types/client/useLocaleStorage.d.ts.map +1 -0
  163. package/dist/types/editor/ContentSelectorWrapper.component.d.ts +18 -12
  164. package/dist/types/editor/ContentSelectorWrapper.component.d.ts.map +1 -1
  165. package/dist/types/editor/EditedContentRenderer.component.d.ts +20 -16
  166. package/dist/types/editor/EditedContentRenderer.component.d.ts.map +1 -1
  167. package/dist/types/editor/EditorSelectorRenderer.component.d.ts +11 -6
  168. package/dist/types/editor/EditorSelectorRenderer.component.d.ts.map +1 -1
  169. package/dist/types/editor/communicator.d.ts +14 -9
  170. package/dist/types/editor/communicator.d.ts.map +1 -1
  171. package/dist/types/editor/configuration.d.ts +4 -1
  172. package/dist/types/editor/configuration.d.ts.map +1 -1
  173. package/dist/types/editor/createSharedComposable.d.ts +6 -4
  174. package/dist/types/editor/createSharedComposable.d.ts.map +1 -1
  175. package/dist/types/editor/dictionariesRecord.d.ts +13 -10
  176. package/dist/types/editor/dictionariesRecord.d.ts.map +1 -1
  177. package/dist/types/editor/editedContent.d.ts +13 -10
  178. package/dist/types/editor/editedContent.d.ts.map +1 -1
  179. package/dist/types/editor/editorEnabled.d.ts +12 -8
  180. package/dist/types/editor/editorEnabled.d.ts.map +1 -1
  181. package/dist/types/editor/editorLocale.d.ts +6 -2
  182. package/dist/types/editor/editorLocale.d.ts.map +1 -1
  183. package/dist/types/editor/focusDictionary.d.ts +16 -13
  184. package/dist/types/editor/focusDictionary.d.ts.map +1 -1
  185. package/dist/types/editor/index.d.ts +5 -5
  186. package/dist/types/editor/installIntlayerEditor.d.ts +7 -2
  187. package/dist/types/editor/installIntlayerEditor.d.ts.map +1 -1
  188. package/dist/types/editor/useCrossFrameMessageListener.d.ts +7 -2
  189. package/dist/types/editor/useCrossFrameMessageListener.d.ts.map +1 -1
  190. package/dist/types/editor/useCrossFrameState.d.ts +12 -8
  191. package/dist/types/editor/useCrossFrameState.d.ts.map +1 -1
  192. package/dist/types/editor/useCrossURLPathState.d.ts +9 -3
  193. package/dist/types/editor/useCrossURLPathState.d.ts.map +1 -1
  194. package/dist/types/editor/useEditedContentRenderer.d.ts +15 -11
  195. package/dist/types/editor/useEditedContentRenderer.d.ts.map +1 -1
  196. package/dist/types/editor/useEditor.d.ts +4 -1
  197. package/dist/types/editor/useEditor.d.ts.map +1 -1
  198. package/dist/types/editor/useIframeClickInterceptor.d.ts +5 -2
  199. package/dist/types/editor/useIframeClickInterceptor.d.ts.map +1 -1
  200. package/dist/types/getDictionary.d.ts +8 -4
  201. package/dist/types/getDictionary.d.ts.map +1 -1
  202. package/dist/types/getIntlayer.d.ts +8 -4
  203. package/dist/types/getIntlayer.d.ts.map +1 -1
  204. package/dist/types/index.d.ts +16 -8
  205. package/dist/types/index.d.ts.map +1 -1
  206. package/dist/types/markdown/index.d.ts +2 -2
  207. package/dist/types/markdown/installIntlayerMarkdown.d.ts +15 -12
  208. package/dist/types/markdown/installIntlayerMarkdown.d.ts.map +1 -1
  209. package/dist/types/plugins.d.ts +29 -23
  210. package/dist/types/plugins.d.ts.map +1 -1
  211. package/dist/types/renderIntlayerNode.d.ts +16 -10
  212. package/dist/types/renderIntlayerNode.d.ts.map +1 -1
  213. package/dist/types/webpack/index.d.ts +2 -2
  214. package/dist/types/webpack/mergeConfig.d.ts +5 -2
  215. package/dist/types/webpack/mergeConfig.d.ts.map +1 -1
  216. package/package.json +43 -49
  217. package/LICENSE +0 -202
  218. package/dist/cjs/client/index.cjs.map +0 -1
  219. package/dist/cjs/client/useLocaleCookie.cjs +0 -60
  220. package/dist/cjs/client/useLocaleCookie.cjs.map +0 -1
  221. package/dist/cjs/editor/index.cjs.map +0 -1
  222. package/dist/cjs/index.cjs.map +0 -1
  223. package/dist/cjs/markdown/index.cjs.map +0 -1
  224. package/dist/cjs/webpack/index.cjs.map +0 -1
  225. package/dist/esm/client/index.mjs.map +0 -1
  226. package/dist/esm/client/useLocaleCookie.mjs +0 -24
  227. package/dist/esm/client/useLocaleCookie.mjs.map +0 -1
  228. package/dist/esm/editor/index.mjs.map +0 -1
  229. package/dist/esm/index.mjs.map +0 -1
  230. package/dist/esm/markdown/index.mjs.map +0 -1
  231. package/dist/esm/webpack/index.mjs.map +0 -1
  232. package/dist/types/client/index.d.ts.map +0 -1
  233. package/dist/types/client/useLocaleCookie.d.ts +0 -17
  234. package/dist/types/client/useLocaleCookie.d.ts.map +0 -1
  235. package/dist/types/editor/index.d.ts.map +0 -1
  236. package/dist/types/markdown/index.d.ts.map +0 -1
  237. package/dist/types/webpack/index.d.ts.map +0 -1
@@ -1,77 +1,46 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_editor_useEditedContentRenderer = require('./useEditedContentRenderer.cjs');
3
+ let __intlayer_core = require("@intlayer/core");
4
+ __intlayer_core = require_rolldown_runtime.__toESM(__intlayer_core);
5
+ let __angular_common = require("@angular/common");
6
+ __angular_common = require_rolldown_runtime.__toESM(__angular_common);
7
+ let __angular_core = require("@angular/core");
8
+ __angular_core = require_rolldown_runtime.__toESM(__angular_core);
9
+
10
+ //#region src/editor/EditedContentRenderer.component.ts
11
+ var EditedContentRendererComponent = @((0, __angular_core.Component)({
12
+ selector: "app-edited-content-renderer",
13
+ standalone: true,
14
+ imports: [__angular_common.CommonModule],
15
+ template: ` <span [innerHTML]="renderedContent()"></span> `
16
+ })) class {
17
+ @((0, __angular_core.Input)()) dictionaryKey;
18
+ @((0, __angular_core.Input)()) keyPath;
19
+ @((0, __angular_core.Input)()) locale;
20
+ fallback = (0, __angular_core.signal)("");
21
+ rawContent = (0, __angular_core.computed)(() => {
22
+ return require_editor_useEditedContentRenderer.useEditedContentRenderer(this.dictionaryKey, this.keyPath, this.fallback);
23
+ });
24
+ /**
25
+ * Object → getContent → string, same as the React version.
26
+ */
27
+ renderedContent = (0, __angular_core.computed)(() => {
28
+ const rawContentValue = this.rawContent();
29
+ if (typeof rawContentValue === "object" && rawContentValue !== null) {
30
+ const transformed = (0, __intlayer_core.getContent)(rawContentValue, {
31
+ dictionaryKey: this.dictionaryKey,
32
+ keyPath: this.keyPath
33
+ }, this.locale);
34
+ if (typeof transformed !== "string") {
35
+ console.error(`Incorrect edited content format. Content type: ${typeof transformed}. Expected string. Value ${JSON.stringify(transformed)}`);
36
+ return this.fallback();
37
+ }
38
+ return transformed;
39
+ }
40
+ return rawContentValue();
41
+ });
9
42
  };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var EditedContentRenderer_component_exports = {};
20
- __export(EditedContentRenderer_component_exports, {
21
- EditedContentRendererComponent: () => EditedContentRendererComponent
22
- });
23
- module.exports = __toCommonJS(EditedContentRenderer_component_exports);
24
- var import_common = require("@angular/common");
25
- var import_core = require("@angular/core");
26
- var import_core2 = require("@intlayer/core");
27
- var import_useEditedContentRenderer = require('./useEditedContentRenderer.cjs');
28
- @((0, import_core.Component)({
29
- selector: "app-edited-content-renderer",
30
- standalone: true,
31
- imports: [import_common.CommonModule],
32
- template: ` <span [innerHTML]="renderedContent()"></span> `
33
- }))
34
- class EditedContentRendererComponent {
35
- @((0, import_core.Input)()) dictionaryKey;
36
- @((0, import_core.Input)()) keyPath;
37
- @((0, import_core.Input)()) locale;
38
- fallback = (0, import_core.signal)("");
39
- rawContent = (0, import_core.computed)(() => {
40
- return (0, import_useEditedContentRenderer.useEditedContentRenderer)(
41
- this.dictionaryKey,
42
- this.keyPath,
43
- this.fallback
44
- );
45
- });
46
- /**
47
- * Object → getContent → string, same as the React version.
48
- */
49
- renderedContent = (0, import_core.computed)(() => {
50
- const rawContentValue = this.rawContent();
51
- if (typeof rawContentValue === "object" && rawContentValue !== null) {
52
- const transformed = (0, import_core2.getContent)(
53
- rawContentValue,
54
- {
55
- dictionaryKey: this.dictionaryKey,
56
- keyPath: this.keyPath
57
- },
58
- this.locale
59
- );
60
- if (typeof transformed !== "string") {
61
- console.error(
62
- `Incorrect edited content format. Content type: ${typeof transformed}. Expected string. Value ${JSON.stringify(
63
- transformed
64
- )}`
65
- );
66
- return this.fallback();
67
- }
68
- return transformed;
69
- }
70
- return rawContentValue();
71
- });
72
- }
73
- // Annotate the CommonJS export names for ESM import in node:
74
- 0 && (module.exports = {
75
- EditedContentRendererComponent
76
- });
43
+
44
+ //#endregion
45
+ exports.EditedContentRendererComponent = EditedContentRendererComponent;
77
46
  //# sourceMappingURL=EditedContentRenderer.component.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/editor/EditedContentRenderer.component.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, Input, computed, signal } from '@angular/core';\nimport type { Locales } from '@intlayer/config/client';\nimport { ContentNode, getContent, type KeyPath } from '@intlayer/core';\nimport { useEditedContentRenderer } from './useEditedContentRenderer';\n\nexport interface EditedContentRendererProps {\n dictionaryKey: string;\n keyPath: KeyPath[];\n locale?: Locales;\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?: Locales;\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":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA6B;AAC7B,kBAAmD;AAEnD,IAAAA,eAAsD;AACtD,sCAAyC;AAQzC,MAAC,uBAAU;AAAA,EACT,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,SAAS,CAAC,0BAAY;AAAA,EACtB,UAAU;AACZ,CAAC;AACM,MAAM,+BAA+B;AAC1C,QAAC,mBAAM,GAAE;AACT,QAAC,mBAAM,GAAE;AACT,QAAC,mBAAM,GAAE;AAAA,EAED,eAAW,oBAAO,EAAE;AAAA,EAEpB,iBAAa,sBAAS,MAAM;AAClC,eAAO;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,IACP;AAAA,EACF,CAAC;AAAA;AAAA;AAAA;AAAA,EAKD,sBAAkB,sBAAS,MAAM;AAC/B,UAAM,kBAAkB,KAAK,WAAW;AAExC,QAAI,OAAO,oBAAoB,YAAY,oBAAoB,MAAM;AACnE,YAAM,kBAAc;AAAA,QAClB;AAAA,QACA;AAAA,UACE,eAAe,KAAK;AAAA,UACpB,SAAS,KAAK;AAAA,QAChB;AAAA,QACA,KAAK;AAAA,MACP;AAEA,UAAI,OAAO,gBAAgB,UAAU;AACnC,gBAAQ;AAAA,UACN,kDAAkD,OAAO,WAAW,4BAA4B,KAAK;AAAA,YACnG;AAAA,UACF,CAAC;AAAA,QACH;AACA,eAAO,KAAK,SAAS;AAAA,MACvB;AACA,aAAO;AAAA,IACT;AAEA,WAAO,gBAAgB;AAAA,EACzB,CAAC;AACH;","names":["import_core"]}
1
+ {"version":3,"file":"EditedContentRenderer.component.cjs","names":["CommonModule","useEditedContentRenderer"],"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';\nimport type { ContentNode, KeyPath, Locale } from '@intlayer/types';\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":";;;;;;;;;;AAkBA,IAAa,iCANb,gCAAW;CACT,UAAU;CACV,YAAY;CACZ,SAAS,CAACA,8BAAa;CACvB,UAAU;CACX,CAAC,EACF,MAA4C;CAC1C,6BAAQ,EAAC;CACT,6BAAQ,EAAC;CACT,6BAAQ,EAAC;CAET,AAAQ,sCAAkB,GAAG;CAE7B,AAAQ,gDAA4B;AAClC,SAAOC,iEACL,KAAK,eACL,KAAK,SACL,KAAK,SACN;GACD;;;;CAKF,qDAAiC;EAC/B,MAAM,kBAAkB,KAAK,YAAY;AAEzC,MAAI,OAAO,oBAAoB,YAAY,oBAAoB,MAAM;GACnE,MAAM,8CACJ,iBACA;IACE,eAAe,KAAK;IACpB,SAAS,KAAK;IACf,EACD,KAAK,OACN;AAED,OAAI,OAAO,gBAAgB,UAAU;AACnC,YAAQ,MACN,kDAAkD,OAAO,YAAY,2BAA2B,KAAK,UACnG,YACD,GACF;AACD,WAAO,KAAK,UAAU;;AAExB,UAAO;;AAGT,SAAO,iBAAiB;GACxB"}
@@ -1,39 +1,21 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var EditorSelectorRenderer_component_exports = {};
20
- __export(EditorSelectorRenderer_component_exports, {
21
- EditorSelectorRendererComponent: () => EditorSelectorRendererComponent
22
- });
23
- module.exports = __toCommonJS(EditorSelectorRenderer_component_exports);
24
- var import_common = require("@angular/common");
25
- var import_core = require("@angular/core");
26
- var import_ContentSelectorWrapper = require('./ContentSelectorWrapper.component.cjs');
27
- var import_EditedContentRenderer = require('./EditedContentRenderer.component.cjs');
28
- @((0, import_core.Component)({
29
- selector: "app-editor-selector-renderer",
30
- standalone: true,
31
- imports: [
32
- import_common.CommonModule,
33
- import_ContentSelectorWrapper.ContentSelectorWrapperComponent,
34
- import_EditedContentRenderer.EditedContentRendererComponent
35
- ],
36
- template: `
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_editor_ContentSelectorWrapper_component = require('./ContentSelectorWrapper.component.cjs');
3
+ const require_editor_EditedContentRenderer_component = require('./EditedContentRenderer.component.cjs');
4
+ let __angular_common = require("@angular/common");
5
+ __angular_common = require_rolldown_runtime.__toESM(__angular_common);
6
+ let __angular_core = require("@angular/core");
7
+ __angular_core = require_rolldown_runtime.__toESM(__angular_core);
8
+
9
+ //#region src/editor/EditorSelectorRenderer.component.ts
10
+ var EditorSelectorRendererComponent = @((0, __angular_core.Component)({
11
+ selector: "app-editor-selector-renderer",
12
+ standalone: true,
13
+ imports: [
14
+ __angular_common.CommonModule,
15
+ require_editor_ContentSelectorWrapper_component.ContentSelectorWrapperComponent,
16
+ require_editor_EditedContentRenderer_component.EditedContentRendererComponent
17
+ ],
18
+ template: `
37
19
  <app-content-selector-wrapper
38
20
  [dictionaryKey]="dictionaryKey"
39
21
  [keyPath]="keyPath"
@@ -46,13 +28,11 @@ var import_EditedContentRenderer = require('./EditedContentRenderer.component.cj
46
28
  </app-edited-content-renderer>
47
29
  </app-content-selector-wrapper>
48
30
  `
49
- }))
50
- class EditorSelectorRendererComponent {
51
- @((0, import_core.Input)()) dictionaryKey;
52
- @((0, import_core.Input)()) keyPath;
53
- }
54
- // Annotate the CommonJS export names for ESM import in node:
55
- 0 && (module.exports = {
56
- EditorSelectorRendererComponent
57
- });
31
+ })) class {
32
+ @((0, __angular_core.Input)()) dictionaryKey;
33
+ @((0, __angular_core.Input)()) keyPath;
34
+ };
35
+
36
+ //#endregion
37
+ exports.EditorSelectorRendererComponent = EditorSelectorRendererComponent;
58
38
  //# sourceMappingURL=EditorSelectorRenderer.component.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/editor/EditorSelectorRenderer.component.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, Input } from '@angular/core';\nimport { type NodeProps } from '@intlayer/core';\nimport { ContentSelectorWrapperComponent } from './ContentSelectorWrapper.component';\nimport { EditedContentRendererComponent } from './EditedContentRenderer.component';\n\n/**\n * Combine your NodeProps (which include dictionaryKey & keyPath)\n * with any other div-like attributes.\n */\nexport interface EditorSelectorRendererProps extends NodeProps {\n [key: string]: any;\n}\n\n@Component({\n selector: 'app-editor-selector-renderer',\n standalone: true,\n imports: [\n CommonModule,\n ContentSelectorWrapperComponent,\n EditedContentRendererComponent,\n ],\n template: `\n <app-content-selector-wrapper\n [dictionaryKey]=\"dictionaryKey\"\n [keyPath]=\"keyPath\"\n >\n <app-edited-content-renderer\n [dictionaryKey]=\"dictionaryKey\"\n [keyPath]=\"keyPath\"\n >\n <ng-content></ng-content>\n </app-edited-content-renderer>\n </app-content-selector-wrapper>\n `,\n})\nexport class EditorSelectorRendererComponent {\n @Input() dictionaryKey!: string;\n @Input() keyPath!: any[];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA6B;AAC7B,kBAAiC;AAEjC,oCAAgD;AAChD,mCAA+C;AAU/C,MAAC,uBAAU;AAAA,EACT,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,SAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaZ,CAAC;AACM,MAAM,gCAAgC;AAC3C,QAAC,mBAAM,GAAE;AACT,QAAC,mBAAM,GAAE;AACX;","names":[]}
1
+ {"version":3,"file":"EditorSelectorRenderer.component.cjs","names":["CommonModule","ContentSelectorWrapperComponent","EditedContentRendererComponent"],"sources":["../../../src/editor/EditorSelectorRenderer.component.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, Input } from '@angular/core';\nimport type { NodeProps } from '@intlayer/core';\nimport { ContentSelectorWrapperComponent } from './ContentSelectorWrapper.component';\nimport { EditedContentRendererComponent } from './EditedContentRenderer.component';\n\n/**\n * Combine your NodeProps (which include dictionaryKey & keyPath)\n * with any other div-like attributes.\n */\nexport interface EditorSelectorRendererProps extends NodeProps {\n [key: string]: any;\n}\n\n@Component({\n selector: 'app-editor-selector-renderer',\n standalone: true,\n imports: [\n CommonModule,\n ContentSelectorWrapperComponent,\n EditedContentRendererComponent,\n ],\n template: `\n <app-content-selector-wrapper\n [dictionaryKey]=\"dictionaryKey\"\n [keyPath]=\"keyPath\"\n >\n <app-edited-content-renderer\n [dictionaryKey]=\"dictionaryKey\"\n [keyPath]=\"keyPath\"\n >\n <ng-content></ng-content>\n </app-edited-content-renderer>\n </app-content-selector-wrapper>\n `,\n})\nexport class EditorSelectorRendererComponent {\n @Input() dictionaryKey!: string;\n @Input() keyPath!: any[];\n}\n"],"mappings":";;;;;;;;;AAoCA,IAAa,kCAtBb,gCAAW;CACT,UAAU;CACV,YAAY;CACZ,SAAS;EACPA;EACAC;EACAC;EACD;CACD,UAAU;;;;;;;;;;;;;CAaX,CAAC,EACF,MAA6C;CAC3C,6BAAQ,EAAC;CACT,6BAAQ,EAAC"}
@@ -1,82 +1,64 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var communicator_exports = {};
30
- __export(communicator_exports, {
31
- createCommunicator: () => createCommunicator,
32
- installCommunicator: () => installCommunicator,
33
- useCommunicator: () => useCommunicator
34
- });
35
- module.exports = __toCommonJS(communicator_exports);
36
- var import_built = __toESM(require("@intlayer/config/built"));
37
- var import_uuid = require("uuid");
38
- const { editor } = import_built.default;
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let __intlayer_config_built = require("@intlayer/config/built");
3
+ __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_built);
4
+ let uuid = require("uuid");
5
+ uuid = require_rolldown_runtime.__toESM(uuid);
6
+
7
+ //#region src/editor/communicator.ts
8
+ const { editor } = __intlayer_config_built.default;
9
+ /**
10
+ * Default values for the communicator
11
+ */
39
12
  const defaultValue = {
40
- postMessage: () => null,
41
- allowedOrigins: [
42
- editor?.applicationURL,
43
- editor?.editorURL,
44
- editor?.cmsURL
45
- ],
46
- senderId: ""
13
+ postMessage: () => null,
14
+ allowedOrigins: [
15
+ editor?.applicationURL,
16
+ editor?.editorURL,
17
+ editor?.cmsURL
18
+ ],
19
+ senderId: ""
47
20
  };
21
+ /**
22
+ * Singleton instance
23
+ */
48
24
  let instance = null;
49
- const INTLAYER_COMMUNICATOR_SYMBOL = Symbol("Communicator");
25
+ /**
26
+ * Creates a communicator client
27
+ * @param options - Options for configuring the communicator
28
+ */
50
29
  const createCommunicator = (options = { postMessage: () => null }) => {
51
- if (instance) return instance;
52
- instance = {
53
- ...defaultValue,
54
- ...options,
55
- senderId: (0, import_uuid.v4)()
56
- };
57
- return instance;
30
+ if (instance) return instance;
31
+ instance = {
32
+ ...defaultValue,
33
+ ...options,
34
+ senderId: (0, uuid.v4)()
35
+ };
36
+ return instance;
58
37
  };
59
- const installCommunicator = (injector, options = { postMessage: () => null }) => {
60
- const client = createCommunicator(options);
38
+ /**
39
+ * Helper to install the Intlayer communicator into the injector
40
+ */
41
+ const installCommunicator = (_injector, options = { postMessage: () => null }) => {
42
+ createCommunicator(options);
61
43
  };
44
+ /**
45
+ * Hook to access the communicator
46
+ * @returns The communicator instance
47
+ */
62
48
  const useCommunicator = () => {
63
- try {
64
- const communicator = createCommunicator();
65
- return communicator || defaultValue;
66
- } catch (error) {
67
- console.warn(
68
- "useCommunicator: Error accessing communicator. Returning default communicator."
69
- );
70
- return {
71
- postMessage: () => null,
72
- senderId: ""
73
- };
74
- }
49
+ try {
50
+ return createCommunicator() || defaultValue;
51
+ } catch (_error) {
52
+ console.warn("useCommunicator: Error accessing communicator. Returning default communicator.");
53
+ return {
54
+ postMessage: () => null,
55
+ senderId: ""
56
+ };
57
+ }
75
58
  };
76
- // Annotate the CommonJS export names for ESM import in node:
77
- 0 && (module.exports = {
78
- createCommunicator,
79
- installCommunicator,
80
- useCommunicator
81
- });
59
+
60
+ //#endregion
61
+ exports.createCommunicator = createCommunicator;
62
+ exports.installCommunicator = installCommunicator;
63
+ exports.useCommunicator = useCommunicator;
82
64
  //# sourceMappingURL=communicator.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/editor/communicator.ts"],"sourcesContent":["import { Injector } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport { v4 as uuid } from 'uuid';\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: uuid(),\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA0B;AAC1B,kBAA2B;AAgB3B,MAAM,EAAE,OAAO,IAAI,aAAAA;AAKnB,MAAM,eAA6B;AAAA,EACjC,aAAa,MAAM;AAAA,EACnB,gBAAgB;AAAA,IACd,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,EACV;AAAA,EACA,UAAU;AACZ;AAKA,IAAI,WAAgC;AAEpC,MAAM,+BAA+B,OAAO,cAAc;AAMnD,MAAM,qBAAqB,CAChC,UAA+B,EAAE,aAAa,MAAM,KAAK,MACtD;AACH,MAAI,SAAU,QAAO;AAErB,aAAW;AAAA,IACT,GAAG;AAAA,IACH,GAAG;AAAA,IACH,cAAU,YAAAC,IAAK;AAAA,EACjB;AAEA,SAAO;AACT;AAKO,MAAM,sBAAsB,CACjC,UACA,UAA+B,EAAE,aAAa,MAAM,KAAK,MACtD;AACH,QAAM,SAAS,mBAAmB,OAAO;AAI3C;AAMO,MAAM,kBAAkB,MAAoB;AACjD,MAAI;AACF,UAAM,eAAe,mBAAmB;AACxC,WAAO,gBAAgB;AAAA,EACzB,SAAS,OAAO;AACd,YAAQ;AAAA,MACN;AAAA,IACF;AACA,WAAO;AAAA,MACL,aAAa,MAAM;AAAA,MACnB,UAAU;AAAA,IACZ;AAAA,EACF;AACF;","names":["configuration","uuid"]}
1
+ {"version":3,"file":"communicator.cjs","names":["configuration","defaultValue: Communicator","instance: Communicator | null"],"sources":["../../../src/editor/communicator.ts"],"sourcesContent":["import type { Injector } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport { v4 as uuid } from 'uuid';\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: uuid(),\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":";;;;;;;AAkBA,MAAM,EAAE,WAAWA;;;;AAKnB,MAAMC,eAA6B;CACjC,mBAAmB;CACnB,gBAAgB;EACd,QAAQ;EACR,QAAQ;EACR,QAAQ;EACT;CACD,UAAU;CACX;;;;AAKD,IAAIC,WAAgC;;;;;AAQpC,MAAa,sBACX,UAA+B,EAAE,mBAAmB,MAAM,KACvD;AACH,KAAI,SAAU,QAAO;AAErB,YAAW;EACT,GAAG;EACH,GAAG;EACH,wBAAgB;EACjB;AAED,QAAO;;;;;AAMT,MAAa,uBACX,WACA,UAA+B,EAAE,mBAAmB,MAAM,KACvD;AACa,oBAAmB,QAAQ;;;;;;AAU7C,MAAa,wBAAsC;AACjD,KAAI;AAEF,SADqB,oBAAoB,IAClB;UAChB,QAAQ;AACf,UAAQ,KACN,iFACD;AACD,SAAO;GACL,mBAAmB;GACnB,UAAU;GACX"}
@@ -1,57 +1,24 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var configuration_exports = {};
30
- __export(configuration_exports, {
31
- useConfiguration: () => useConfiguration
32
- });
33
- module.exports = __toCommonJS(configuration_exports);
34
- var import_core = require("@angular/core");
35
- var import_built = __toESM(require("@intlayer/config/built"));
36
- var import_editor = require("@intlayer/editor");
37
- var import_useCrossFrameState = require('./useCrossFrameState.cjs');
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_editor_useCrossFrameState = require('./useCrossFrameState.cjs');
3
+ let __angular_core = require("@angular/core");
4
+ __angular_core = require_rolldown_runtime.__toESM(__angular_core);
5
+ let __intlayer_editor = require("@intlayer/editor");
6
+ __intlayer_editor = require_rolldown_runtime.__toESM(__intlayer_editor);
7
+ let __intlayer_config_built = require("@intlayer/config/built");
8
+ __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_built);
9
+
10
+ //#region src/editor/configuration.ts
38
11
  const useConfiguration = () => {
39
- const [pushedConfiguration, setConfiguration] = (0, import_useCrossFrameState.useCrossFrameState)(import_editor.MessageKey.INTLAYER_CONFIGURATION);
40
- try {
41
- const destroyRef = (0, import_core.inject)(import_core.DestroyRef, { optional: true });
42
- if (destroyRef) {
43
- if (!pushedConfiguration()) {
44
- setConfiguration(import_built.default);
45
- }
46
- }
47
- } catch {
48
- console.warn(
49
- "useConfiguration called outside injection context; configuration may not be synchronized."
50
- );
51
- }
12
+ const [pushedConfiguration, setConfiguration] = require_editor_useCrossFrameState.useCrossFrameState(__intlayer_editor.MessageKey.INTLAYER_CONFIGURATION);
13
+ try {
14
+ if ((0, __angular_core.inject)(__angular_core.DestroyRef, { optional: true })) {
15
+ if (!pushedConfiguration()) setConfiguration(__intlayer_config_built.default);
16
+ }
17
+ } catch {
18
+ console.warn("useConfiguration called outside injection context; configuration may not be synchronized.");
19
+ }
52
20
  };
53
- // Annotate the CommonJS export names for ESM import in node:
54
- 0 && (module.exports = {
55
- useConfiguration
56
- });
21
+
22
+ //#endregion
23
+ exports.useConfiguration = useConfiguration;
57
24
  //# sourceMappingURL=configuration.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/editor/configuration.ts"],"sourcesContent":["import { DestroyRef, inject } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport { IntlayerConfig } from '@intlayer/config/client';\nimport { MessageKey } from '@intlayer/editor';\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAmC;AACnC,mBAA0B;AAE1B,oBAA2B;AAC3B,gCAAmC;AAE5B,MAAM,mBAAmB,MAAM;AACpC,QAAM,CAAC,qBAAqB,gBAAgB,QAC1C,8CAAmC,yBAAW,sBAAsB;AAGtE,MAAI;AACF,UAAM,iBAAa,oBAAO,wBAAY,EAAE,UAAU,KAAK,CAAC;AAExD,QAAI,YAAY;AAEd,UAAI,CAAC,oBAAoB,GAAG;AAC1B,yBAAiB,aAAAA,OAAa;AAAA,MAChC;AAAA,IACF;AAAA,EACF,QAAQ;AACN,YAAQ;AAAA,MACN;AAAA,IAEF;AAAA,EACF;AACF;","names":["configuration"]}
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';\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":";;;;;;;;;;AAMA,MAAa,yBAAyB;CACpC,MAAM,CAAC,qBAAqB,oBAC1BA,qDAAmCC,6BAAW,uBAAuB;AAGvE,KAAI;AAGF,iCAF0BC,2BAAY,EAAE,UAAU,MAAM,CAAC,EAIvD;OAAI,CAAC,qBAAqB,CACxB,kBAAiBC,gCAAc;;SAG7B;AACN,UAAQ,KACN,4FAED"}
@@ -1,68 +1,51 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var createSharedComposable_exports = {};
20
- __export(createSharedComposable_exports, {
21
- createSharedComposable: () => createSharedComposable,
22
- tryOnScopeDispose: () => tryOnScopeDispose
23
- });
24
- module.exports = __toCommonJS(createSharedComposable_exports);
25
- var import_core = require("@angular/core");
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let __angular_core = require("@angular/core");
3
+ __angular_core = require_rolldown_runtime.__toESM(__angular_core);
4
+
5
+ //#region src/editor/createSharedComposable.ts
6
+ /**
7
+ * Angular replacement for Vue's tryOnScopeDispose
8
+ * Uses Angular's DestroyRef to handle cleanup when the injection context is destroyed
9
+ */
26
10
  function tryOnScopeDispose(fn) {
27
- try {
28
- const destroyRef = (0, import_core.inject)(import_core.DestroyRef, { optional: true });
29
- if (destroyRef) {
30
- destroyRef.onDestroy(fn);
31
- return true;
32
- }
33
- return false;
34
- } catch {
35
- return false;
36
- }
11
+ try {
12
+ const destroyRef = (0, __angular_core.inject)(__angular_core.DestroyRef, { optional: true });
13
+ if (destroyRef) {
14
+ destroyRef.onDestroy(fn);
15
+ return true;
16
+ }
17
+ return false;
18
+ } catch {
19
+ return false;
20
+ }
37
21
  }
22
+ /**
23
+ * Angular equivalent of Vue's createSharedComposable
24
+ * Creates a singleton pattern for services/composables
25
+ */
38
26
  const createSharedComposable = (composable) => {
39
- let subscribers = 0;
40
- let state;
41
- let cleanupFn;
42
- const dispose = () => {
43
- subscribers -= 1;
44
- if (cleanupFn && subscribers <= 0) {
45
- cleanupFn();
46
- state = void 0;
47
- cleanupFn = void 0;
48
- }
49
- };
50
- return ((...args) => {
51
- subscribers += 1;
52
- if (!state) {
53
- state = composable(...args);
54
- if (tryOnScopeDispose(dispose)) {
55
- cleanupFn = dispose;
56
- }
57
- } else {
58
- tryOnScopeDispose(dispose);
59
- }
60
- return state;
61
- });
27
+ let subscribers = 0;
28
+ let state;
29
+ let cleanupFn;
30
+ const dispose = () => {
31
+ subscribers -= 1;
32
+ if (cleanupFn && subscribers <= 0) {
33
+ cleanupFn();
34
+ state = void 0;
35
+ cleanupFn = void 0;
36
+ }
37
+ };
38
+ return ((...args) => {
39
+ subscribers += 1;
40
+ if (!state) {
41
+ state = composable(...args);
42
+ if (tryOnScopeDispose(dispose)) cleanupFn = dispose;
43
+ } else tryOnScopeDispose(dispose);
44
+ return state;
45
+ });
62
46
  };
63
- // Annotate the CommonJS export names for ESM import in node:
64
- 0 && (module.exports = {
65
- createSharedComposable,
66
- tryOnScopeDispose
67
- });
47
+
48
+ //#endregion
49
+ exports.createSharedComposable = createSharedComposable;
50
+ exports.tryOnScopeDispose = tryOnScopeDispose;
68
51
  //# sourceMappingURL=createSharedComposable.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/editor/createSharedComposable.ts"],"sourcesContent":["import { DestroyRef, inject } from '@angular/core';\n\ntype AnyFn = (...args: any[]) => any;\n\nexport type SharedComposableReturn<T extends AnyFn = AnyFn> = T;\n\n/**\n * Angular replacement for Vue's tryOnScopeDispose\n * Uses Angular's DestroyRef to handle cleanup when the injection context is destroyed\n */\nexport function tryOnScopeDispose(fn: () => void) {\n try {\n const destroyRef = inject(DestroyRef, { optional: true });\n if (destroyRef) {\n destroyRef.onDestroy(fn);\n return true;\n }\n return false;\n } catch {\n // If called outside injection context, return false\n return false;\n }\n}\n\n/**\n * Angular equivalent of Vue's createSharedComposable\n * Creates a singleton pattern for services/composables\n */\nexport const createSharedComposable = <Fn extends AnyFn>(\n composable: Fn\n): SharedComposableReturn<Fn> => {\n let subscribers = 0;\n let state: ReturnType<Fn> | undefined;\n let cleanupFn: (() => void) | undefined;\n\n const dispose = () => {\n subscribers -= 1;\n if (cleanupFn && subscribers <= 0) {\n cleanupFn();\n state = undefined;\n cleanupFn = undefined;\n }\n };\n\n return <Fn>((...args) => {\n subscribers += 1;\n if (!state) {\n state = composable(...args);\n // Set up cleanup when the first subscriber is destroyed\n if (tryOnScopeDispose(dispose)) {\n cleanupFn = dispose;\n }\n } else {\n // For additional subscribers, just set up their individual cleanup\n tryOnScopeDispose(dispose);\n }\n return state;\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAmC;AAU5B,SAAS,kBAAkB,IAAgB;AAChD,MAAI;AACF,UAAM,iBAAa,oBAAO,wBAAY,EAAE,UAAU,KAAK,CAAC;AACxD,QAAI,YAAY;AACd,iBAAW,UAAU,EAAE;AACvB,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT,QAAQ;AAEN,WAAO;AAAA,EACT;AACF;AAMO,MAAM,yBAAyB,CACpC,eAC+B;AAC/B,MAAI,cAAc;AAClB,MAAI;AACJ,MAAI;AAEJ,QAAM,UAAU,MAAM;AACpB,mBAAe;AACf,QAAI,aAAa,eAAe,GAAG;AACjC,gBAAU;AACV,cAAQ;AACR,kBAAY;AAAA,IACd;AAAA,EACF;AAEA,UAAY,IAAI,SAAS;AACvB,mBAAe;AACf,QAAI,CAAC,OAAO;AACV,cAAQ,WAAW,GAAG,IAAI;AAE1B,UAAI,kBAAkB,OAAO,GAAG;AAC9B,oBAAY;AAAA,MACd;AAAA,IACF,OAAO;AAEL,wBAAkB,OAAO;AAAA,IAC3B;AACA,WAAO;AAAA,EACT;AACF;","names":[]}
1
+ {"version":3,"file":"createSharedComposable.cjs","names":["DestroyRef","state: ReturnType<Fn> | undefined","cleanupFn: (() => void) | undefined"],"sources":["../../../src/editor/createSharedComposable.ts"],"sourcesContent":["import { DestroyRef, inject } from '@angular/core';\n\ntype AnyFn = (...args: any[]) => any;\n\nexport type SharedComposableReturn<T extends AnyFn = AnyFn> = T;\n\n/**\n * Angular replacement for Vue's tryOnScopeDispose\n * Uses Angular's DestroyRef to handle cleanup when the injection context is destroyed\n */\nexport function tryOnScopeDispose(fn: () => void) {\n try {\n const destroyRef = inject(DestroyRef, { optional: true });\n if (destroyRef) {\n destroyRef.onDestroy(fn);\n return true;\n }\n return false;\n } catch {\n // If called outside injection context, return false\n return false;\n }\n}\n\n/**\n * Angular equivalent of Vue's createSharedComposable\n * Creates a singleton pattern for services/composables\n */\nexport const createSharedComposable = <Fn extends AnyFn>(\n composable: Fn\n): SharedComposableReturn<Fn> => {\n let subscribers = 0;\n let state: ReturnType<Fn> | undefined;\n let cleanupFn: (() => void) | undefined;\n\n const dispose = () => {\n subscribers -= 1;\n if (cleanupFn && subscribers <= 0) {\n cleanupFn();\n state = undefined;\n cleanupFn = undefined;\n }\n };\n\n return <Fn>((...args) => {\n subscribers += 1;\n if (!state) {\n state = composable(...args);\n // Set up cleanup when the first subscriber is destroyed\n if (tryOnScopeDispose(dispose)) {\n cleanupFn = dispose;\n }\n } else {\n // For additional subscribers, just set up their individual cleanup\n tryOnScopeDispose(dispose);\n }\n return state;\n });\n};\n"],"mappings":";;;;;;;;;AAUA,SAAgB,kBAAkB,IAAgB;AAChD,KAAI;EACF,MAAM,wCAAoBA,2BAAY,EAAE,UAAU,MAAM,CAAC;AACzD,MAAI,YAAY;AACd,cAAW,UAAU,GAAG;AACxB,UAAO;;AAET,SAAO;SACD;AAEN,SAAO;;;;;;;AAQX,MAAa,0BACX,eAC+B;CAC/B,IAAI,cAAc;CAClB,IAAIC;CACJ,IAAIC;CAEJ,MAAM,gBAAgB;AACpB,iBAAe;AACf,MAAI,aAAa,eAAe,GAAG;AACjC,cAAW;AACX,WAAQ;AACR,eAAY;;;AAIhB,UAAa,GAAG,SAAS;AACvB,iBAAe;AACf,MAAI,CAAC,OAAO;AACV,WAAQ,WAAW,GAAG,KAAK;AAE3B,OAAI,kBAAkB,QAAQ,CAC5B,aAAY;QAId,mBAAkB,QAAQ;AAE5B,SAAO"}