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,14 +1 @@
1
- import { INTLAYER_TOKEN, IntlayerProvider, createIntlayerClient, installIntlayer, provideIntlayer } from "./client/installIntlayer.mjs";
2
- import { useDictionary } from "./client/useDictionary.mjs";
3
- import { useDictionaryAsync } from "./client/useDictionaryAsync.mjs";
4
- import { useLoadDynamic } from "./client/useLoadDynamic.mjs";
5
- import { useDictionaryDynamic } from "./client/useDictionaryDynamic.mjs";
6
- import { useIntl } from "./client/useIntl.mjs";
7
- import { getIntlayer } from "./getIntlayer.mjs";
8
- import { isUpdatableNode, useIntlayer } from "./client/useIntlayer.mjs";
9
- import { useLocale } from "./client/useLocale.mjs";
10
- import { INTLAYER_MARKDOWN_TOKEN, IntlayerMarkdownService, createIntlayerMarkdownProvider, htmlRuntime, useMarkdown } from "./markdown/installIntlayerMarkdown.mjs";
11
- import { htmlPlugin, insertionPlugin, intlayerNodePlugins, markdownPlugin, markdownStringPlugin } from "./plugins.mjs";
12
- import { getDictionary } from "./getDictionary.mjs";
13
-
14
- export { INTLAYER_MARKDOWN_TOKEN, INTLAYER_TOKEN, IntlayerMarkdownService, IntlayerProvider, createIntlayerClient, createIntlayerMarkdownProvider, getDictionary, getIntlayer, htmlPlugin, htmlRuntime, insertionPlugin, installIntlayer, intlayerNodePlugins, isUpdatableNode, markdownPlugin, markdownStringPlugin, provideIntlayer, useDictionary, useDictionaryAsync, useDictionaryDynamic, useIntl, useIntlayer, useLoadDynamic, useLocale, useMarkdown };
1
+ import{INTLAYER_TOKEN as e,IntlayerProvider as t,createIntlayerClient as n,installIntlayer as r,provideIntlayer as i}from"./client/installIntlayer.mjs";import{useDictionary as a}from"./client/useDictionary.mjs";import{useDictionaryAsync as o}from"./client/useDictionaryAsync.mjs";import{useLoadDynamic as s}from"./client/useLoadDynamic.mjs";import{useDictionaryDynamic as c}from"./client/useDictionaryDynamic.mjs";import{useIntl as l}from"./client/useIntl.mjs";import{getIntlayer as u}from"./getIntlayer.mjs";import{isUpdatableNode as d,useIntlayer as f}from"./client/useIntlayer.mjs";import{useLocale as p}from"./client/useLocale.mjs";import{INTLAYER_MARKDOWN_TOKEN as m,IntlayerMarkdownService as h,createIntlayerMarkdownProvider as g,htmlRuntime as _,useMarkdown as v}from"./markdown/installIntlayerMarkdown.mjs";import{htmlPlugin as y,insertionPlugin as b,intlayerNodePlugins as x,markdownPlugin as S,markdownStringPlugin as C}from"./plugins.mjs";import{getDictionary as w}from"./getDictionary.mjs";export{m as INTLAYER_MARKDOWN_TOKEN,e as INTLAYER_TOKEN,h as IntlayerMarkdownService,t as IntlayerProvider,n as createIntlayerClient,g as createIntlayerMarkdownProvider,w as getDictionary,u as getIntlayer,y as htmlPlugin,_ as htmlRuntime,b as insertionPlugin,r as installIntlayer,x as intlayerNodePlugins,d as isUpdatableNode,S as markdownPlugin,C as markdownStringPlugin,i as provideIntlayer,a as useDictionary,o as useDictionaryAsync,c as useDictionaryDynamic,l as useIntl,f as useIntlayer,s as useLoadDynamic,p as useLocale,v as useMarkdown};
@@ -1,3 +1 @@
1
- import { INTLAYER_MARKDOWN_TOKEN, IntlayerMarkdownService, createIntlayerMarkdownProvider, htmlRuntime, useMarkdown } from "./installIntlayerMarkdown.mjs";
2
-
3
- export { INTLAYER_MARKDOWN_TOKEN, IntlayerMarkdownService, createIntlayerMarkdownProvider, htmlRuntime, useMarkdown };
1
+ import{INTLAYER_MARKDOWN_TOKEN as e,IntlayerMarkdownService as t,createIntlayerMarkdownProvider as n,htmlRuntime as r,useMarkdown as i}from"./installIntlayerMarkdown.mjs";export{e as INTLAYER_MARKDOWN_TOKEN,t as IntlayerMarkdownService,n as createIntlayerMarkdownProvider,r as htmlRuntime,i as useMarkdown};
@@ -1,69 +1,2 @@
1
- import { __decorate } from "../_virtual/_@oxc-project_runtime@0.112.0/helpers/decorate.mjs";
2
- import { compile } from "@intlayer/core";
3
- import { Injectable, InjectionToken, inject } from "@angular/core";
4
-
5
- //#region src/markdown/installIntlayerMarkdown.ts
6
- const INTLAYER_MARKDOWN_TOKEN = new InjectionToken("intlayerMarkdown");
7
- const htmlRuntime = {
8
- createElement: (tag, props, ...children) => {
9
- if (typeof tag !== "string") {
10
- if (tag === htmlRuntime.Fragment) return children.join("");
11
- return "";
12
- }
13
- const attrs = props ? Object.entries(props).map(([k, v]) => {
14
- if (k === "key" || v === void 0 || v === null) return "";
15
- return `${k === "className" ? "class" : k}="${String(v).replace(/"/g, """)}"`;
16
- }).filter(Boolean).join(" ") : "";
17
- const childrenStr = children.join("");
18
- if ([
19
- "area",
20
- "base",
21
- "br",
22
- "col",
23
- "embed",
24
- "hr",
25
- "img",
26
- "input",
27
- "link",
28
- "meta",
29
- "param",
30
- "source",
31
- "track",
32
- "wbr"
33
- ].includes(tag)) return `<${tag} ${attrs} />`;
34
- return `<${tag}${attrs ? ` ${attrs}` : ""}>${childrenStr}</${tag}>`;
35
- },
36
- cloneElement: (element, _props) => element,
37
- Fragment: Symbol("Fragment")
38
- };
39
- /**
40
- * Default markdown renderer that converts markdown to HTML string
41
- */
42
- const defaultMarkdownRenderer = (markdown) => compile(markdown, { runtime: htmlRuntime });
43
- /**
44
- * Create IntlayerMarkdown provider configuration
45
- */
46
- const createIntlayerMarkdownProvider = (renderMarkdown = defaultMarkdownRenderer) => ({
47
- provide: INTLAYER_MARKDOWN_TOKEN,
48
- useValue: { renderMarkdown }
49
- });
50
- let IntlayerMarkdownService = class IntlayerMarkdownService {
51
- markdownProvider = inject(INTLAYER_MARKDOWN_TOKEN, { optional: true });
52
- renderMarkdown(markdown, overrides) {
53
- if (!this.markdownProvider) return markdown;
54
- return this.markdownProvider.renderMarkdown(markdown, overrides);
55
- }
56
- };
57
- IntlayerMarkdownService = __decorate([Injectable({ providedIn: "root" })], IntlayerMarkdownService);
58
- /**
59
- * Function to inject markdown provider
60
- */
61
- const useMarkdown = () => {
62
- const markdownProvider = inject(INTLAYER_MARKDOWN_TOKEN, { optional: true });
63
- if (!markdownProvider) return { renderMarkdown: defaultMarkdownRenderer };
64
- return markdownProvider;
65
- };
66
-
67
- //#endregion
68
- export { INTLAYER_MARKDOWN_TOKEN, IntlayerMarkdownService, createIntlayerMarkdownProvider, htmlRuntime, useMarkdown };
1
+ import{__decorate as e}from"../_virtual/_@oxc-project_runtime@0.112.0/helpers/decorate.mjs";import{compile as t}from"@intlayer/core/markdown";import{Injectable as n,InjectionToken as r,inject as i}from"@angular/core";const a=new r(`intlayerMarkdown`),o={createElement:(e,t,...n)=>{if(typeof e!=`string`)return e===o.Fragment?n.join(``):``;let r=t?Object.entries(t).map(([e,t])=>e===`key`||t==null?``:`${e===`className`?`class`:e}="${String(t).replace(/"/g,`&quot;`)}"`).filter(Boolean).join(` `):``,i=n.join(``);return[`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`].includes(e)?`<${e} ${r} />`:`<${e}${r?` ${r}`:``}>${i}</${e}>`},cloneElement:(e,t)=>e,Fragment:Symbol(`Fragment`)},s=e=>t(e,{runtime:o}),c=(e=s)=>({provide:a,useValue:{renderMarkdown:e}});let l=class{markdownProvider=i(a,{optional:!0});renderMarkdown(e,t){return this.markdownProvider?this.markdownProvider.renderMarkdown(e,t):e}};l=e([n({providedIn:`root`})],l);const u=()=>i(a,{optional:!0})||{renderMarkdown:s};export{a as INTLAYER_MARKDOWN_TOKEN,l as IntlayerMarkdownService,c as createIntlayerMarkdownProvider,o as htmlRuntime,u as useMarkdown};
69
2
  //# sourceMappingURL=installIntlayerMarkdown.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"installIntlayerMarkdown.mjs","names":[],"sources":["../../../src/markdown/installIntlayerMarkdown.ts"],"sourcesContent":["import {\n Injectable,\n InjectionToken,\n inject,\n type TemplateRef,\n} from '@angular/core';\nimport { compile, type MarkdownRuntime } from '@intlayer/core';\n\nexport const INTLAYER_MARKDOWN_TOKEN =\n new InjectionToken<IntlayerMarkdownProvider>('intlayerMarkdown');\n\ntype RenderMarkdownOptions = {\n components?: any;\n wrapper?: any;\n options?: any;\n};\n\ntype RenderMarkdownFunction = (\n markdown: string,\n overrides?: any | RenderMarkdownOptions\n) => string | TemplateRef<any>;\n\nexport type IntlayerMarkdownProvider = {\n renderMarkdown: RenderMarkdownFunction;\n};\n\n// Minimal runtime to generate HTML strings\nexport const htmlRuntime: MarkdownRuntime = {\n createElement: (tag: string | any, props: any, ...children: any[]) => {\n if (typeof tag !== 'string') {\n // Handle non-string tags if necessary (e.g. components), or fallback to div\n if (tag === htmlRuntime.Fragment) {\n return children.join('');\n }\n return '';\n }\n\n const attrs = props\n ? Object.entries(props)\n .map(([k, v]) => {\n if (k === 'key' || v === undefined || v === null) return '';\n const key = k === 'className' ? 'class' : k;\n return `${key}=\"${String(v).replace(/\"/g, '&quot;')}\"`;\n })\n .filter(Boolean)\n .join(' ')\n : '';\n\n const childrenStr = children.join('');\n const voidTags = [\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'input',\n 'link',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr',\n ];\n\n if (voidTags.includes(tag)) {\n return `<${tag} ${attrs} />`;\n }\n\n return `<${tag}${attrs ? ` ${attrs}` : ''}>${childrenStr}</${tag}>`;\n },\n cloneElement: (element: any, _props: any) => element, // Not really supported for strings\n Fragment: Symbol('Fragment'),\n};\n\n/**\n * Default markdown renderer that converts markdown to HTML string\n */\nconst defaultMarkdownRenderer: RenderMarkdownFunction = (markdown: string) =>\n compile(markdown, { runtime: htmlRuntime }) as string;\n\n/**\n * Create IntlayerMarkdown provider configuration\n */\nexport const createIntlayerMarkdownProvider = (\n renderMarkdown: RenderMarkdownFunction = defaultMarkdownRenderer\n) => ({\n provide: INTLAYER_MARKDOWN_TOKEN,\n useValue: {\n renderMarkdown,\n } as IntlayerMarkdownProvider,\n});\n\n/**\n * Injectable service for markdown rendering\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class IntlayerMarkdownService {\n private markdownProvider = inject(INTLAYER_MARKDOWN_TOKEN, {\n optional: true,\n });\n\n renderMarkdown(markdown: string, overrides?: any): string | TemplateRef<any> {\n if (!this.markdownProvider) {\n return markdown; // Fallback to returning markdown as is\n }\n return this.markdownProvider.renderMarkdown(markdown, overrides);\n }\n}\n\n/**\n * Function to inject markdown provider\n */\nexport const useMarkdown = (): IntlayerMarkdownProvider => {\n const markdownProvider = inject(INTLAYER_MARKDOWN_TOKEN, { optional: true });\n\n if (!markdownProvider) {\n return {\n renderMarkdown: defaultMarkdownRenderer,\n };\n }\n\n return markdownProvider;\n};\n"],"mappings":";;;;;AAQA,MAAa,0BACX,IAAI,eAAyC,mBAAmB;AAkBlE,MAAa,cAA+B;CAC1C,gBAAgB,KAAmB,OAAY,GAAG,aAAoB;AACpE,MAAI,OAAO,QAAQ,UAAU;AAE3B,OAAI,QAAQ,YAAY,SACtB,QAAO,SAAS,KAAK,GAAG;AAE1B,UAAO;;EAGT,MAAM,QAAQ,QACV,OAAO,QAAQ,MAAM,CAClB,KAAK,CAAC,GAAG,OAAO;AACf,OAAI,MAAM,SAAS,MAAM,UAAa,MAAM,KAAM,QAAO;AAEzD,UAAO,GADK,MAAM,cAAc,UAAU,EAC5B,IAAI,OAAO,EAAE,CAAC,QAAQ,MAAM,SAAS,CAAC;IACpD,CACD,OAAO,QAAQ,CACf,KAAK,IAAI,GACZ;EAEJ,MAAM,cAAc,SAAS,KAAK,GAAG;AAkBrC,MAjBiB;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CAEY,SAAS,IAAI,CACxB,QAAO,IAAI,IAAI,GAAG,MAAM;AAG1B,SAAO,IAAI,MAAM,QAAQ,IAAI,UAAU,GAAG,GAAG,YAAY,IAAI,IAAI;;CAEnE,eAAe,SAAc,WAAgB;CAC7C,UAAU,OAAO,WAAW;CAC7B;;;;AAKD,MAAM,2BAAmD,aACvD,QAAQ,UAAU,EAAE,SAAS,aAAa,CAAC;;;;AAK7C,MAAa,kCACX,iBAAyC,6BACrC;CACJ,SAAS;CACT,UAAU,EACR,gBACD;CACF;AAQM,oCAAM,wBAAwB;CACnC,AAAQ,mBAAmB,OAAO,yBAAyB,EACzD,UAAU,MACX,CAAC;CAEF,eAAe,UAAkB,WAA4C;AAC3E,MAAI,CAAC,KAAK,iBACR,QAAO;AAET,SAAO,KAAK,iBAAiB,eAAe,UAAU,UAAU;;;sCAZnE,WAAW,EACV,YAAY,QACb,CAAC;;;;AAiBF,MAAa,oBAA8C;CACzD,MAAM,mBAAmB,OAAO,yBAAyB,EAAE,UAAU,MAAM,CAAC;AAE5E,KAAI,CAAC,iBACH,QAAO,EACL,gBAAgB,yBACjB;AAGH,QAAO"}
1
+ {"version":3,"file":"installIntlayerMarkdown.mjs","names":[],"sources":["../../../src/markdown/installIntlayerMarkdown.ts"],"sourcesContent":["import {\n Injectable,\n InjectionToken,\n inject,\n type TemplateRef,\n} from '@angular/core';\nimport type { MarkdownRuntime } from '@intlayer/core/markdown';\nimport { compile } from '@intlayer/core/markdown';\n\nexport const INTLAYER_MARKDOWN_TOKEN =\n new InjectionToken<IntlayerMarkdownProvider>('intlayerMarkdown');\n\ntype RenderMarkdownOptions = {\n components?: any;\n wrapper?: any;\n options?: any;\n};\n\ntype RenderMarkdownFunction = (\n markdown: string,\n overrides?: any | RenderMarkdownOptions\n) => string | TemplateRef<any>;\n\nexport type IntlayerMarkdownProvider = {\n renderMarkdown: RenderMarkdownFunction;\n};\n\n// Minimal runtime to generate HTML strings\nexport const htmlRuntime: MarkdownRuntime = {\n createElement: (tag: string | any, props: any, ...children: any[]) => {\n if (typeof tag !== 'string') {\n // Handle non-string tags if necessary (e.g. components), or fallback to div\n if (tag === htmlRuntime.Fragment) {\n return children.join('');\n }\n return '';\n }\n\n const attrs = props\n ? Object.entries(props)\n .map(([k, v]) => {\n if (k === 'key' || v === undefined || v === null) return '';\n const key = k === 'className' ? 'class' : k;\n return `${key}=\"${String(v).replace(/\"/g, '&quot;')}\"`;\n })\n .filter(Boolean)\n .join(' ')\n : '';\n\n const childrenStr = children.join('');\n const voidTags = [\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'input',\n 'link',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr',\n ];\n\n if (voidTags.includes(tag)) {\n return `<${tag} ${attrs} />`;\n }\n\n return `<${tag}${attrs ? ` ${attrs}` : ''}>${childrenStr}</${tag}>`;\n },\n cloneElement: (element: any, _props: any) => element, // Not really supported for strings\n Fragment: Symbol('Fragment'),\n};\n\n/**\n * Default markdown renderer that converts markdown to HTML string\n */\nconst defaultMarkdownRenderer: RenderMarkdownFunction = (markdown: string) =>\n compile(markdown, { runtime: htmlRuntime }) as string;\n\n/**\n * Create IntlayerMarkdown provider configuration\n */\nexport const createIntlayerMarkdownProvider = (\n renderMarkdown: RenderMarkdownFunction = defaultMarkdownRenderer\n) => ({\n provide: INTLAYER_MARKDOWN_TOKEN,\n useValue: {\n renderMarkdown,\n } as IntlayerMarkdownProvider,\n});\n\n/**\n * Injectable service for markdown rendering\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class IntlayerMarkdownService {\n private markdownProvider = inject(INTLAYER_MARKDOWN_TOKEN, {\n optional: true,\n });\n\n renderMarkdown(markdown: string, overrides?: any): string | TemplateRef<any> {\n if (!this.markdownProvider) {\n return markdown; // Fallback to returning markdown as is\n }\n return this.markdownProvider.renderMarkdown(markdown, overrides);\n }\n}\n\n/**\n * Function to inject markdown provider\n */\nexport const useMarkdown = (): IntlayerMarkdownProvider => {\n const markdownProvider = inject(INTLAYER_MARKDOWN_TOKEN, { optional: true });\n\n if (!markdownProvider) {\n return {\n renderMarkdown: defaultMarkdownRenderer,\n };\n }\n\n return markdownProvider;\n};\n"],"mappings":"yNASA,MAAa,EACX,IAAI,EAAyC,mBAAmB,CAkBrD,EAA+B,CAC1C,eAAgB,EAAmB,EAAY,GAAG,IAAoB,CACpE,GAAI,OAAO,GAAQ,SAKjB,OAHI,IAAQ,EAAY,SACf,EAAS,KAAK,GAAG,CAEnB,GAGT,IAAM,EAAQ,EACV,OAAO,QAAQ,EAAM,CAClB,KAAK,CAAC,EAAG,KACJ,IAAM,OAAS,GAAyB,KAAa,GAElD,GADK,IAAM,YAAc,QAAU,EAC5B,IAAI,OAAO,EAAE,CAAC,QAAQ,KAAM,SAAS,CAAC,GACpD,CACD,OAAO,QAAQ,CACf,KAAK,IAAI,CACZ,GAEE,EAAc,EAAS,KAAK,GAAG,CAsBrC,MArBiB,CACf,OACA,OACA,KACA,MACA,QACA,KACA,MACA,QACA,OACA,OACA,QACA,SACA,QACA,MACD,CAEY,SAAS,EAAI,CACjB,IAAI,EAAI,GAAG,EAAM,KAGnB,IAAI,IAAM,EAAQ,IAAI,IAAU,GAAG,GAAG,EAAY,IAAI,EAAI,IAEnE,cAAe,EAAc,IAAgB,EAC7C,SAAU,OAAO,WAAW,CAC7B,CAKK,EAAmD,GACvD,EAAQ,EAAU,CAAE,QAAS,EAAa,CAAC,CAKhC,GACX,EAAyC,KACrC,CACJ,QAAS,EACT,SAAU,CACR,iBACD,CACF,EAQM,IAAA,EAAA,KAA8B,CACnC,iBAA2B,EAAO,EAAyB,CACzD,SAAU,GACX,CAAC,CAEF,eAAe,EAAkB,EAA4C,CAI3E,OAHK,KAAK,iBAGH,KAAK,iBAAiB,eAAe,EAAU,EAAU,CAFvD,SAVZ,EAAW,CACV,WAAY,OACb,CAAC,CAAA,CAAA,EAAA,CAiBF,MAAa,MACc,EAAO,EAAyB,CAAE,SAAU,GAAM,CAAC,EAGnE,CACL,eAAgB,EACjB"}
@@ -1,183 +1,2 @@
1
- import { ContentSelectorWrapperComponent } from "./editor/ContentSelectorWrapper.component.mjs";
2
- import { htmlRuntime, useMarkdown } from "./markdown/installIntlayerMarkdown.mjs";
3
- import { renderIntlayerNode } from "./renderIntlayerNode.mjs";
4
- import { compile, getMarkdownMetadata } from "@intlayer/core";
5
- import { NodeType } from "@intlayer/types";
6
-
7
- //#region src/plugins.ts
8
- /** ---------------------------------------------
9
- * UTILS
10
- * --------------------------------------------- */
11
- const createRuntimeWithOverides = (baseRuntime, overrides) => ({
12
- ...baseRuntime,
13
- createElement: (tag, props, ...children) => {
14
- const override = overrides?.[tag];
15
- if (override) {
16
- const newProps = {
17
- ...props,
18
- ...override
19
- };
20
- const originalClass = props?.class || props?.className;
21
- const overrideClass = override.class || override.className;
22
- if (originalClass && overrideClass) {
23
- newProps.class = `${originalClass} ${overrideClass}`;
24
- newProps.className = void 0;
25
- }
26
- return baseRuntime.createElement(tag, newProps, ...children);
27
- }
28
- return baseRuntime.createElement(tag, props, ...children);
29
- }
30
- });
31
- /** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
32
- const intlayerNodePlugins = {
33
- id: "intlayer-node-plugin",
34
- canHandle: (node) => typeof node === "bigint" || typeof node === "string" || typeof node === "number",
35
- transform: (_node, { children, ...rest }) => renderIntlayerNode({
36
- ...rest,
37
- value: children,
38
- children: () => ({
39
- component: ContentSelectorWrapperComponent,
40
- props: {
41
- dictionaryKey: rest.dictionaryKey,
42
- keyPath: rest.keyPath
43
- },
44
- children
45
- })
46
- })
47
- };
48
- /** Markdown string plugin. Replaces string node with a component that render the markdown. */
49
- const markdownStringPlugin = {
50
- id: "markdown-string-plugin",
51
- canHandle: (node) => typeof node === "string",
52
- transform: (node, props, deepTransformNode) => {
53
- const { plugins, ...rest } = props;
54
- const metadataNodes = deepTransformNode(getMarkdownMetadata(node), {
55
- plugins: [{
56
- id: "markdown-metadata-plugin",
57
- canHandle: (metadataNode) => typeof metadataNode === "string" || typeof metadataNode === "number" || typeof metadataNode === "boolean" || !metadataNode,
58
- transform: (metadataNode, props) => renderIntlayerNode({
59
- ...props,
60
- value: metadataNode,
61
- children: node
62
- })
63
- }],
64
- dictionaryKey: rest.dictionaryKey,
65
- keyPath: []
66
- });
67
- const render = (components) => renderIntlayerNode({
68
- ...rest,
69
- value: node,
70
- children: () => ({
71
- component: ContentSelectorWrapperComponent,
72
- props: {
73
- dictionaryKey: rest.dictionaryKey,
74
- keyPath: rest.keyPath,
75
- ...components
76
- },
77
- children: () => {
78
- const { renderMarkdown } = useMarkdown();
79
- return renderMarkdown(node, components);
80
- }
81
- }),
82
- additionalProps: { metadata: metadataNodes }
83
- });
84
- const createProxy = (element, components) => new Proxy(element, { get(target, prop, receiver) {
85
- if (prop === "value") return node;
86
- if (prop === "metadata") return metadataNodes;
87
- if (prop === "toString") return () => {
88
- return compile(node, { runtime: components ? createRuntimeWithOverides(htmlRuntime, components) : htmlRuntime });
89
- };
90
- if (prop === Symbol.toPrimitive) return () => {
91
- return compile(node, { runtime: components ? createRuntimeWithOverides(htmlRuntime, components) : htmlRuntime });
92
- };
93
- if (prop === "use") return (newComponents) => {
94
- const mergedComponents = {
95
- ...components,
96
- ...newComponents
97
- };
98
- return createProxy(render(mergedComponents), mergedComponents);
99
- };
100
- return Reflect.get(target, prop, receiver);
101
- } });
102
- return createProxy(render());
103
- }
104
- };
105
- const markdownPlugin = {
106
- id: "markdown-plugin",
107
- canHandle: (node) => typeof node === "object" && node?.nodeType === NodeType.Markdown,
108
- transform: (node, props, deepTransformNode) => {
109
- const newKeyPath = [...props.keyPath, { type: NodeType.Markdown }];
110
- const children = node[NodeType.Markdown];
111
- return deepTransformNode(children, {
112
- ...props,
113
- children,
114
- keyPath: newKeyPath,
115
- plugins: [markdownStringPlugin, ...props.plugins ?? []]
116
- });
117
- }
118
- };
119
- /** HTML plugin. Replaces node with a function that takes components => IntlayerNode. */
120
- const htmlPlugin = {
121
- id: "html-plugin",
122
- canHandle: (node) => typeof node === "object" && node?.nodeType === NodeType.HTML,
123
- transform: (node, props) => {
124
- const html = node[NodeType.HTML];
125
- const { plugins, ...rest } = props;
126
- const render = (userComponents) => renderIntlayerNode({
127
- ...rest,
128
- value: html,
129
- children: () => ({
130
- component: ContentSelectorWrapperComponent,
131
- props: {
132
- dictionaryKey: rest.dictionaryKey,
133
- keyPath: rest.keyPath,
134
- ...userComponents
135
- },
136
- children: html
137
- })
138
- });
139
- const createProxy = (element, components) => new Proxy(element, { get(target, prop, receiver) {
140
- if (prop === "value") return html;
141
- if (prop === "toString") return () => {
142
- if (!components || typeof components === "object" && Object.keys(components).length === 0) return String(html);
143
- return compile(html, { runtime: createRuntimeWithOverides(htmlRuntime, components) });
144
- };
145
- if (prop === Symbol.toPrimitive) return () => {
146
- if (!components || typeof components === "object" && Object.keys(components).length === 0) return String(html);
147
- return compile(html, { runtime: createRuntimeWithOverides(htmlRuntime, components) });
148
- };
149
- if (prop === "use") return (userComponents) => {
150
- const mergedComponents = {
151
- ...components,
152
- ...userComponents
153
- };
154
- return createProxy(render(mergedComponents), mergedComponents);
155
- };
156
- return Reflect.get(target, prop, receiver);
157
- } });
158
- return createProxy(render());
159
- }
160
- };
161
- const insertionPlugin = {
162
- id: "insertion-plugin",
163
- canHandle: (node) => typeof node === "object" && node?.nodeType === NodeType.Insertion,
164
- transform: (node, props) => {
165
- const { plugins, ...rest } = props;
166
- const render = (args = {}) => {
167
- let text = node.insertion;
168
- if (args) Object.entries(args).forEach(([key, value]) => {
169
- text = text.replace(new RegExp(`{{\\s*${key}\\s*}}`, "g"), String(value));
170
- });
171
- return text;
172
- };
173
- return renderIntlayerNode({
174
- ...rest,
175
- value: render,
176
- children: render
177
- });
178
- }
179
- };
180
-
181
- //#endregion
182
- export { htmlPlugin, insertionPlugin, intlayerNodePlugins, markdownPlugin, markdownStringPlugin };
1
+ import{ContentSelectorWrapperComponent as e}from"./editor/ContentSelectorWrapper.component.mjs";import{htmlRuntime as t,useMarkdown as n}from"./markdown/installIntlayerMarkdown.mjs";import{renderIntlayerNode as r}from"./renderIntlayerNode.mjs";import{compile as i,getMarkdownMetadata as a}from"@intlayer/core/markdown";import{NodeType as o}from"@intlayer/types";const s=(e,t)=>({...e,createElement:(n,r,...i)=>{let a=t?.[n];if(a){let t={...r,...a},o=r?.class||r?.className,s=a.class||a.className;return o&&s&&(t.class=`${o} ${s}`,t.className=void 0),e.createElement(n,t,...i)}return e.createElement(n,r,...i)}}),c={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(t,{children:n,...i})=>r({...i,value:n,children:()=>({component:e,props:{dictionaryKey:i.dictionaryKey,keyPath:i.keyPath},children:n})})},l={id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(o,c,l)=>{let{plugins:u,...d}=c,f=l(a(o),{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(e,t)=>r({...t,value:e,children:o})}],dictionaryKey:d.dictionaryKey,keyPath:[]}),p=t=>r({...d,value:o,children:()=>({component:e,props:{dictionaryKey:d.dictionaryKey,keyPath:d.keyPath,...t},children:()=>{let{renderMarkdown:e}=n();return e(o,t)}}),additionalProps:{metadata:f}}),m=(e,n)=>new Proxy(e,{get(e,r,a){return r===`value`?o:r===`metadata`?f:r===`toString`||r===Symbol.toPrimitive?()=>i(o,{runtime:n?s(t,n):t}):r===`use`?e=>{let t={...n,...e};return m(p(t),t)}:Reflect.get(e,r,a)}});return m(p())}},u={id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===o.Markdown,transform:(e,t,n)=>{let r=[...t.keyPath,{type:o.Markdown}],i=e[o.Markdown];return n(i,{...t,children:i,keyPath:r,plugins:[l,...t.plugins??[]]})}},d={id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===o.HTML,transform:(n,a)=>{let c=n[o.HTML],{plugins:l,...u}=a,d=t=>r({...u,value:c,children:()=>({component:e,props:{dictionaryKey:u.dictionaryKey,keyPath:u.keyPath,...t},children:c})}),f=(e,n)=>new Proxy(e,{get(e,r,a){return r===`value`?c:r===`toString`||r===Symbol.toPrimitive?()=>!n||typeof n==`object`&&Object.keys(n).length===0?String(c):i(c,{runtime:s(t,n)}):r===`use`?e=>{let t={...n,...e};return f(d(t),t)}:Reflect.get(e,r,a)}});return f(d())}},f={id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===o.Insertion,transform:(e,t)=>{let{plugins:n,...i}=t,a=(t={})=>{let n=e.insertion;return t&&Object.entries(t).forEach(([e,t])=>{n=n.replace(RegExp(`{{\\s*${e}\\s*}}`,`g`),String(t))}),n};return r({...i,value:a,children:a})}};export{d as htmlPlugin,f as insertionPlugin,c as intlayerNodePlugins,u as markdownPlugin,l as markdownStringPlugin};
183
2
  //# sourceMappingURL=plugins.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.mjs","names":[],"sources":["../../src/plugins.ts"],"sourcesContent":["import {\n compile,\n type DeepTransformContent as DeepTransformContentCore,\n getMarkdownMetadata,\n type HTMLContent,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n type InsertionContent,\n type MarkdownContent,\n type Plugins,\n} from '@intlayer/core';\nimport {\n type DeclaredLocales,\n type KeyPath,\n type LocalesValues,\n NodeType,\n} from '@intlayer/types';\nimport { ContentSelectorWrapperComponent } from './editor';\nimport { htmlRuntime, useMarkdown } from './markdown/installIntlayerMarkdown';\nimport { renderIntlayerNode } from './renderIntlayerNode';\n\n/** ---------------------------------------------\n * UTILS\n * --------------------------------------------- */\n\nconst createRuntimeWithOverides = (baseRuntime: any, overrides: any) => ({\n ...baseRuntime,\n createElement: (tag: string, props: any, ...children: any[]) => {\n const override = overrides?.[tag];\n\n if (override) {\n const newProps = { ...props, ...override };\n\n // Merge class attributes intelligently\n const originalClass = props?.class || props?.className;\n const overrideClass = override.class || override.className;\n\n if (originalClass && overrideClass) {\n newProps.class = `${originalClass} ${overrideClass}`;\n newProps.className = undefined;\n }\n\n return baseRuntime.createElement(tag, newProps, ...children);\n }\n\n return baseRuntime.createElement(tag, props, ...children);\n },\n});\n\n/** ---------------------------------------------\n * INTLAYER NODE PLUGIN\n * --------------------------------------------- */\n\nexport type IntlayerNodeCond<T> = T extends number | string\n ? IntlayerNode<T>\n : never;\n\nexport interface IntlayerNode<T, P = {}> {\n value: T;\n children?: any;\n additionalProps?: P;\n}\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const intlayerNodePlugins: Plugins = {\n id: 'intlayer-node-plugin',\n canHandle: (node) =>\n typeof node === 'bigint' ||\n typeof node === 'string' ||\n typeof node === 'number',\n transform: (_node, { children, ...rest }) =>\n renderIntlayerNode({\n ...rest,\n value: children,\n children: () => ({\n component: ContentSelectorWrapperComponent,\n props: {\n dictionaryKey: rest.dictionaryKey,\n keyPath: rest.keyPath,\n },\n children: children,\n }),\n }),\n};\n\n/**\n * MARKDOWN PLUGIN\n */\n\nexport type MarkdownStringCond<T> = T extends string\n ? IntlayerNode<string, { metadata: DeepTransformContent<string> }>\n : never;\n\n/** Markdown string plugin. Replaces string node with a component that render the markdown. */\nexport const markdownStringPlugin: Plugins = {\n id: 'markdown-string-plugin',\n canHandle: (node) => typeof node === 'string',\n transform: (node: string, props, deepTransformNode) => {\n const {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n } = props;\n\n const metadata = getMarkdownMetadata(node);\n\n const metadataPlugins: Plugins = {\n id: 'markdown-metadata-plugin',\n canHandle: (metadataNode) =>\n typeof metadataNode === 'string' ||\n typeof metadataNode === 'number' ||\n typeof metadataNode === 'boolean' ||\n !metadataNode,\n transform: (metadataNode, props) =>\n renderIntlayerNode({\n ...props,\n value: metadataNode,\n children: node,\n }),\n };\n\n // Transform metadata while keeping the same structure\n const metadataNodes = deepTransformNode(metadata, {\n plugins: [metadataPlugins],\n dictionaryKey: rest.dictionaryKey,\n keyPath: [],\n });\n\n const render = (components?: any) =>\n renderIntlayerNode({\n ...rest,\n value: node,\n children: () => ({\n component: ContentSelectorWrapperComponent,\n props: {\n dictionaryKey: rest.dictionaryKey,\n keyPath: rest.keyPath,\n ...components,\n },\n children: () => {\n const { renderMarkdown } = useMarkdown();\n return renderMarkdown(node, components);\n },\n }),\n additionalProps: {\n metadata: metadataNodes,\n },\n });\n\n const createProxy = (element: any, components?: any) =>\n new Proxy(element, {\n get(target, prop, receiver) {\n if (prop === 'value') {\n return node;\n }\n if (prop === 'metadata') {\n return metadataNodes;\n }\n\n if (prop === 'toString') {\n return () => {\n const runtime = components\n ? createRuntimeWithOverides(htmlRuntime, components)\n : htmlRuntime;\n return compile(node, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === Symbol.toPrimitive) {\n return () => {\n const runtime = components\n ? createRuntimeWithOverides(htmlRuntime, components)\n : htmlRuntime;\n return compile(node, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === 'use') {\n return (newComponents?: any) => {\n const mergedComponents = { ...components, ...newComponents };\n return createProxy(render(mergedComponents), mergedComponents);\n };\n }\n\n return Reflect.get(target, prop, receiver);\n },\n }) as any;\n\n return createProxy(render() as any);\n },\n};\n\nexport type MarkdownCond<T, _S, _L extends LocalesValues> = T extends {\n nodeType: NodeType | string;\n [NodeType.Markdown]: infer M;\n tags?: infer U;\n metadata?: infer V;\n}\n ? IntlayerNode<\n M,\n {\n use: (components?: Record<keyof U, any>) => any;\n metadata: DeepTransformContent<V>;\n }\n >\n : never;\n\nexport const markdownPlugin: Plugins = {\n id: 'markdown-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Markdown,\n transform: (node: MarkdownContent, props, deepTransformNode) => {\n const newKeyPath: KeyPath[] = [\n ...props.keyPath,\n {\n type: NodeType.Markdown,\n },\n ];\n\n const children = node[NodeType.Markdown];\n\n return deepTransformNode(children, {\n ...props,\n children,\n keyPath: newKeyPath,\n plugins: [markdownStringPlugin, ...(props.plugins ?? [])],\n });\n },\n};\n\n/** ---------------------------------------------\n * HTML PLUGIN\n * --------------------------------------------- */\n\n/**\n * HTML conditional type.\n *\n * This ensures type safety:\n * - `html('<div>Hello <CustomComponent /></div>').use({ CustomComponent: ... })` - optional but typed\n */\nexport type HTMLPluginCond<T, _S, _L> = T extends {\n nodeType: NodeType | string;\n [NodeType.HTML]: infer I;\n tags?: infer U;\n}\n ? IntlayerNode<\n I,\n {\n use: (components?: Record<keyof U, any>) => any;\n }\n >\n : never;\n\n/** HTML plugin. Replaces node with a function that takes components => IntlayerNode. */\nexport const htmlPlugin: Plugins = {\n id: 'html-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.HTML,\n\n transform: (node: HTMLContent<string>, props) => {\n const html = node[NodeType.HTML];\n const { plugins, ...rest } = props;\n\n // Type-safe render function that accepts properly typed components\n const render = (userComponents?: any) =>\n renderIntlayerNode({\n ...rest,\n value: html,\n children: () => ({\n component: ContentSelectorWrapperComponent,\n props: {\n dictionaryKey: rest.dictionaryKey,\n keyPath: rest.keyPath,\n ...userComponents,\n },\n children: html,\n }),\n });\n\n const createProxy = (element: any, components?: any) =>\n new Proxy(element, {\n get(target, prop, receiver) {\n if (prop === 'value') {\n return html;\n }\n\n if (prop === 'toString') {\n return () => {\n if (\n !components ||\n (typeof components === 'object' &&\n Object.keys(components).length === 0)\n ) {\n return String(html);\n }\n const runtime = createRuntimeWithOverides(\n htmlRuntime,\n components\n );\n return compile(html, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === Symbol.toPrimitive) {\n return () => {\n if (\n !components ||\n (typeof components === 'object' &&\n Object.keys(components).length === 0)\n ) {\n return String(html);\n }\n const runtime = createRuntimeWithOverides(\n htmlRuntime,\n components\n );\n return compile(html, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === 'use') {\n // Return a properly typed function based on custom components\n return (userComponents?: any) => {\n const mergedComponents = { ...components, ...userComponents };\n return createProxy(render(mergedComponents), mergedComponents);\n };\n }\n\n return Reflect.get(target, prop, receiver);\n },\n }) as any;\n\n return createProxy(render() as any);\n },\n};\n\n/** ---------------------------------------------\n * INSERTION PLUGIN\n * --------------------------------------------- */\n\n/**\n * Insertion conditional type.\n */\nexport type InsertionPluginCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeType.Insertion]: infer _I;\n}\n ? (args: Record<string, string | number>) => string\n : never;\n\nexport const insertionPlugin: Plugins = {\n id: 'insertion-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Insertion,\n transform: (node: InsertionContent, props) => {\n const { plugins, ...rest } = props;\n\n // Return a function that performs the interpolation\n const render = (args: Record<string, string | number> = {}) => {\n let text = node.insertion as string;\n if (args) {\n Object.entries(args).forEach(([key, value]) => {\n text = text.replace(\n new RegExp(`{{\\\\s*${key}\\\\s*}}`, 'g'),\n String(value)\n );\n });\n }\n return text;\n };\n\n return renderIntlayerNode({\n ...rest,\n value: render as any,\n children: render,\n });\n },\n};\n\nexport interface IInterpreterPluginAngular<T, S, L extends LocalesValues> {\n angularIntlayerNode: IntlayerNodeCond<T>;\n angularMarkdown: MarkdownCond<T, S, L>;\n angularHtml: HTMLPluginCond<T, S, L>;\n angularInsertion: InsertionPluginCond<T>;\n}\n\n/**\n * Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution.\n *\n * Otherwise the the `angular-intlayer` plugins will override the types of `intlayer` functions.\n */\nexport type IInterpreterPluginState = Omit<\n IInterpreterPluginStateCore,\n 'insertion' // Remove insertion type from core package\n> & {\n angularIntlayerNode: true;\n angularMarkdown: true;\n angularHtml: true;\n angularInsertion: true;\n};\n\nexport type DeepTransformContent<\n T,\n L extends LocalesValues = DeclaredLocales,\n> = Deep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,UAAU,OAAwC,EAAE,KAAK;GAC7D,IAAI,OAAO,KAAK;AAChB,OAAI,KACF,QAAO,QAAQ,KAAK,CAAC,SAAS,CAAC,KAAK,WAAW;AAC7C,WAAO,KAAK,QACV,IAAI,OAAO,SAAS,IAAI,SAAS,IAAI,EACrC,OAAO,MAAM,CACd;KACD;AAEJ,UAAO;;AAGT,SAAO,mBAAmB;GACxB,GAAG;GACH,OAAO;GACP,UAAU;GACX,CAAC;;CAEL"}
1
+ {"version":3,"file":"plugins.mjs","names":[],"sources":["../../src/plugins.ts"],"sourcesContent":["import type {\n DeepTransformContent as DeepTransformContentCore,\n IInterpreterPluginState as IInterpreterPluginStateCore,\n Plugins,\n} from '@intlayer/core/interpreter';\nimport {\n compile,\n getMarkdownMetadata,\n type MarkdownContent,\n} from '@intlayer/core/markdown';\nimport type { HTMLContent, InsertionContent } from '@intlayer/core/transpiler';\nimport {\n type DeclaredLocales,\n type KeyPath,\n type LocalesValues,\n NodeType,\n} from '@intlayer/types';\nimport { ContentSelectorWrapperComponent } from './editor';\nimport { htmlRuntime, useMarkdown } from './markdown/installIntlayerMarkdown';\nimport { renderIntlayerNode } from './renderIntlayerNode';\n\n/** ---------------------------------------------\n * UTILS\n * --------------------------------------------- */\n\nconst createRuntimeWithOverides = (baseRuntime: any, overrides: any) => ({\n ...baseRuntime,\n createElement: (tag: string, props: any, ...children: any[]) => {\n const override = overrides?.[tag];\n\n if (override) {\n const newProps = { ...props, ...override };\n\n // Merge class attributes intelligently\n const originalClass = props?.class || props?.className;\n const overrideClass = override.class || override.className;\n\n if (originalClass && overrideClass) {\n newProps.class = `${originalClass} ${overrideClass}`;\n newProps.className = undefined;\n }\n\n return baseRuntime.createElement(tag, newProps, ...children);\n }\n\n return baseRuntime.createElement(tag, props, ...children);\n },\n});\n\n/** ---------------------------------------------\n * INTLAYER NODE PLUGIN\n * --------------------------------------------- */\n\nexport type IntlayerNodeCond<T> = T extends number | string\n ? IntlayerNode<T>\n : never;\n\nexport interface IntlayerNode<T, P = {}> {\n value: T;\n children?: any;\n additionalProps?: P;\n}\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const intlayerNodePlugins: Plugins = {\n id: 'intlayer-node-plugin',\n canHandle: (node) =>\n typeof node === 'bigint' ||\n typeof node === 'string' ||\n typeof node === 'number',\n transform: (_node, { children, ...rest }) =>\n renderIntlayerNode({\n ...rest,\n value: children,\n children: () => ({\n component: ContentSelectorWrapperComponent,\n props: {\n dictionaryKey: rest.dictionaryKey,\n keyPath: rest.keyPath,\n },\n children: children,\n }),\n }),\n};\n\n/**\n * MARKDOWN PLUGIN\n */\n\nexport type MarkdownStringCond<T> = T extends string\n ? IntlayerNode<string, { metadata: DeepTransformContent<string> }>\n : never;\n\n/** Markdown string plugin. Replaces string node with a component that render the markdown. */\nexport const markdownStringPlugin: Plugins = {\n id: 'markdown-string-plugin',\n canHandle: (node) => typeof node === 'string',\n transform: (node: string, props, deepTransformNode) => {\n const {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n } = props;\n\n const metadata = getMarkdownMetadata(node);\n\n const metadataPlugins: Plugins = {\n id: 'markdown-metadata-plugin',\n canHandle: (metadataNode) =>\n typeof metadataNode === 'string' ||\n typeof metadataNode === 'number' ||\n typeof metadataNode === 'boolean' ||\n !metadataNode,\n transform: (metadataNode, props) =>\n renderIntlayerNode({\n ...props,\n value: metadataNode,\n children: node,\n }),\n };\n\n // Transform metadata while keeping the same structure\n const metadataNodes = deepTransformNode(metadata, {\n plugins: [metadataPlugins],\n dictionaryKey: rest.dictionaryKey,\n keyPath: [],\n });\n\n const render = (components?: any) =>\n renderIntlayerNode({\n ...rest,\n value: node,\n children: () => ({\n component: ContentSelectorWrapperComponent,\n props: {\n dictionaryKey: rest.dictionaryKey,\n keyPath: rest.keyPath,\n ...components,\n },\n children: () => {\n const { renderMarkdown } = useMarkdown();\n return renderMarkdown(node, components);\n },\n }),\n additionalProps: {\n metadata: metadataNodes,\n },\n });\n\n const createProxy = (element: any, components?: any) =>\n new Proxy(element, {\n get(target, prop, receiver) {\n if (prop === 'value') {\n return node;\n }\n if (prop === 'metadata') {\n return metadataNodes;\n }\n\n if (prop === 'toString') {\n return () => {\n const runtime = components\n ? createRuntimeWithOverides(htmlRuntime, components)\n : htmlRuntime;\n return compile(node, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === Symbol.toPrimitive) {\n return () => {\n const runtime = components\n ? createRuntimeWithOverides(htmlRuntime, components)\n : htmlRuntime;\n return compile(node, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === 'use') {\n return (newComponents?: any) => {\n const mergedComponents = { ...components, ...newComponents };\n return createProxy(render(mergedComponents), mergedComponents);\n };\n }\n\n return Reflect.get(target, prop, receiver);\n },\n }) as any;\n\n return createProxy(render() as any);\n },\n};\n\nexport type MarkdownCond<T, _S, _L extends LocalesValues> = T extends {\n nodeType: NodeType | string;\n [NodeType.Markdown]: infer M;\n tags?: infer U;\n metadata?: infer V;\n}\n ? IntlayerNode<\n M,\n {\n use: (components?: Record<keyof U, any>) => any;\n metadata: DeepTransformContent<V>;\n }\n >\n : never;\n\nexport const markdownPlugin: Plugins = {\n id: 'markdown-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Markdown,\n transform: (node: MarkdownContent, props, deepTransformNode) => {\n const newKeyPath: KeyPath[] = [\n ...props.keyPath,\n {\n type: NodeType.Markdown,\n },\n ];\n\n const children = node[NodeType.Markdown];\n\n return deepTransformNode(children, {\n ...props,\n children,\n keyPath: newKeyPath,\n plugins: [markdownStringPlugin, ...(props.plugins ?? [])],\n });\n },\n};\n\n/** ---------------------------------------------\n * HTML PLUGIN\n * --------------------------------------------- */\n\n/**\n * HTML conditional type.\n *\n * This ensures type safety:\n * - `html('<div>Hello <CustomComponent /></div>').use({ CustomComponent: ... })` - optional but typed\n */\nexport type HTMLPluginCond<T, _S, _L> = T extends {\n nodeType: NodeType | string;\n [NodeType.HTML]: infer I;\n tags?: infer U;\n}\n ? IntlayerNode<\n I,\n {\n use: (components?: Record<keyof U, any>) => any;\n }\n >\n : never;\n\n/** HTML plugin. Replaces node with a function that takes components => IntlayerNode. */\nexport const htmlPlugin: Plugins = {\n id: 'html-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.HTML,\n\n transform: (node: HTMLContent<string>, props) => {\n const html = node[NodeType.HTML];\n const { plugins, ...rest } = props;\n\n // Type-safe render function that accepts properly typed components\n const render = (userComponents?: any) =>\n renderIntlayerNode({\n ...rest,\n value: html,\n children: () => ({\n component: ContentSelectorWrapperComponent,\n props: {\n dictionaryKey: rest.dictionaryKey,\n keyPath: rest.keyPath,\n ...userComponents,\n },\n children: html,\n }),\n });\n\n const createProxy = (element: any, components?: any) =>\n new Proxy(element, {\n get(target, prop, receiver) {\n if (prop === 'value') {\n return html;\n }\n\n if (prop === 'toString') {\n return () => {\n if (\n !components ||\n (typeof components === 'object' &&\n Object.keys(components).length === 0)\n ) {\n return String(html);\n }\n const runtime = createRuntimeWithOverides(\n htmlRuntime,\n components\n );\n return compile(html, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === Symbol.toPrimitive) {\n return () => {\n if (\n !components ||\n (typeof components === 'object' &&\n Object.keys(components).length === 0)\n ) {\n return String(html);\n }\n const runtime = createRuntimeWithOverides(\n htmlRuntime,\n components\n );\n return compile(html, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === 'use') {\n // Return a properly typed function based on custom components\n return (userComponents?: any) => {\n const mergedComponents = { ...components, ...userComponents };\n return createProxy(render(mergedComponents), mergedComponents);\n };\n }\n\n return Reflect.get(target, prop, receiver);\n },\n }) as any;\n\n return createProxy(render() as any);\n },\n};\n\n/** ---------------------------------------------\n * INSERTION PLUGIN\n * --------------------------------------------- */\n\n/**\n * Insertion conditional type.\n */\nexport type InsertionPluginCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeType.Insertion]: infer _I;\n}\n ? (args: Record<string, string | number>) => string\n : never;\n\nexport const insertionPlugin: Plugins = {\n id: 'insertion-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Insertion,\n transform: (node: InsertionContent, props) => {\n const { plugins, ...rest } = props;\n\n // Return a function that performs the interpolation\n const render = (args: Record<string, string | number> = {}) => {\n let text = node.insertion as string;\n if (args) {\n Object.entries(args).forEach(([key, value]) => {\n text = text.replace(\n new RegExp(`{{\\\\s*${key}\\\\s*}}`, 'g'),\n String(value)\n );\n });\n }\n return text;\n };\n\n return renderIntlayerNode({\n ...rest,\n value: render as any,\n children: render,\n });\n },\n};\n\nexport interface IInterpreterPluginAngular<T, S, L extends LocalesValues> {\n angularIntlayerNode: IntlayerNodeCond<T>;\n angularMarkdown: MarkdownCond<T, S, L>;\n angularHtml: HTMLPluginCond<T, S, L>;\n angularInsertion: InsertionPluginCond<T>;\n}\n\n/**\n * Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution.\n *\n * Otherwise the the `angular-intlayer` plugins will override the types of `intlayer` functions.\n */\nexport type IInterpreterPluginState = Omit<\n IInterpreterPluginStateCore,\n 'insertion' // Remove insertion type from core package\n> & {\n angularIntlayerNode: true;\n angularMarkdown: true;\n angularHtml: true;\n angularInsertion: true;\n};\n\nexport type DeepTransformContent<\n T,\n L extends LocalesValues = DeclaredLocales,\n> = DeepTransformContentCore<T, IInterpreterPluginState, L>;\n"],"mappings":"0WAyBA,MAAM,GAA6B,EAAkB,KAAoB,CACvE,GAAG,EACH,eAAgB,EAAa,EAAY,GAAG,IAAoB,CAC9D,IAAM,EAAW,IAAY,GAE7B,GAAI,EAAU,CACZ,IAAM,EAAW,CAAE,GAAG,EAAO,GAAG,EAAU,CAGpC,EAAgB,GAAO,OAAS,GAAO,UACvC,EAAgB,EAAS,OAAS,EAAS,UAOjD,OALI,GAAiB,IACnB,EAAS,MAAQ,GAAG,EAAc,GAAG,IACrC,EAAS,UAAY,IAAA,IAGhB,EAAY,cAAc,EAAK,EAAU,GAAG,EAAS,CAG9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O,EAAiB,CAAE,EAAiB,EAI3D,QAAQ,IAAI,EAAQ,EAAM,EAAS,EAE7C,CAAC,CAEJ,OAAO,EAAY,GAAQ,CAAQ,EAEtC,CAgBY,EAA2B,CACtC,GAAI,mBACJ,UAAY,GACV,OAAO,GAAS,UAAY,GAAM,WAAa,EAAS,UAC1D,WAAY,EAAwB,IAAU,CAC5C,GAAM,CAAE,UAAS,GAAG,GAAS,EAGvB,GAAU,EAAwC,EAAE,GAAK,CAC7D,IAAI,EAAO,EAAK,UAShB,OARI,GACF,OAAO,QAAQ,EAAK,CAAC,SAAS,CAAC,EAAK,KAAW,CAC7C,EAAO,EAAK,QACN,OAAO,SAAS,EAAI,QAAS,IAAI,CACrC,OAAO,EAAM,CACd,EACD,CAEG,GAGT,OAAO,EAAmB,CACxB,GAAG,EACH,MAAO,EACP,SAAU,EACX,CAAC,EAEL"}
@@ -1,27 +1,2 @@
1
- //#region src/renderIntlayerNode.ts
2
- const renderIntlayerNode = ({ children, value, additionalProps = {} }) => {
3
- if (children == null) return new Proxy({}, { get(target, prop, receiver) {
4
- if (prop === "value") return value;
5
- if (additionalProps && Object.keys(additionalProps).includes(prop)) return additionalProps[prop];
6
- return Reflect.get(target, prop, receiver);
7
- } });
8
- return new Proxy(children, {
9
- apply(target, thisArg, argumentsList) {
10
- if (typeof value === "function") return Reflect.apply(value, thisArg, argumentsList);
11
- return Reflect.apply(target, thisArg, argumentsList);
12
- },
13
- get(target, prop, receiver) {
14
- if (prop === "value") return value;
15
- if (prop === "toString") return () => {
16
- return String(value);
17
- };
18
- if (prop === Symbol.toPrimitive) return () => value;
19
- if (additionalProps && Object.keys(additionalProps).includes(prop)) return additionalProps[prop];
20
- return Reflect.get(target, prop, receiver);
21
- }
22
- });
23
- };
24
-
25
- //#endregion
26
- export { renderIntlayerNode };
1
+ const e=({children:e,value:t,additionalProps:n={}})=>e==null?new Proxy({},{get(e,r,i){return r===`value`?t:n&&Object.keys(n).includes(r)?n[r]:Reflect.get(e,r,i)}}):new Proxy(e,{apply(e,n,r){return typeof t==`function`?Reflect.apply(t,n,r):Reflect.apply(e,n,r)},get(e,r,i){return r===`value`?t:r===`toString`?()=>String(t):r===Symbol.toPrimitive?()=>t:n&&Object.keys(n).includes(r)?n[r]:Reflect.get(e,r,i)}});export{e as renderIntlayerNode};
27
2
  //# sourceMappingURL=renderIntlayerNode.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderIntlayerNode.mjs","names":[],"sources":["../../src/renderIntlayerNode.ts"],"sourcesContent":["export type IntlayerNode<T = string, AdditionalProps = {}> = any & {\n value: T;\n} & AdditionalProps;\n\ntype RenderIntlayerNodeProps<T> = {\n value: T;\n children: any;\n additionalProps?: { [key: string]: any };\n};\n\nexport const renderIntlayerNode = <\n T extends number | string | boolean | undefined | null,\n>({\n children,\n value,\n additionalProps = {},\n}: RenderIntlayerNodeProps<T>): IntlayerNode<T> => {\n // If children is null or undefined, return a simple object with the value\n if (children == null) {\n return new Proxy({} as any, {\n get(target, prop, receiver) {\n if (prop === 'value') {\n return value;\n }\n\n if (\n additionalProps &&\n Object.keys(additionalProps).includes(prop as string)\n ) {\n return additionalProps[prop as keyof typeof additionalProps];\n }\n\n return Reflect.get(target, prop, receiver);\n },\n }) as IntlayerNode<T>;\n }\n\n // Return a Proxy that pretends to be the original content\n // but also has a .value getter and additional props.\n return new Proxy(children, {\n apply(target, thisArg, argumentsList) {\n if (typeof value === 'function') {\n return Reflect.apply(value as Function, thisArg, argumentsList);\n }\n return Reflect.apply(target as Function, thisArg, argumentsList);\n },\n get(target, prop, receiver) {\n if (prop === 'value') {\n return value;\n }\n\n if (prop === 'toString') {\n return () => {\n // console.log('renderIntlayerNode toString called for:', value);\n return String(value);\n };\n }\n\n if (prop === Symbol.toPrimitive) {\n return () => value;\n }\n\n if (\n additionalProps &&\n Object.keys(additionalProps).includes(prop as string)\n ) {\n return additionalProps[prop as keyof typeof additionalProps];\n }\n\n return Reflect.get(target, prop, receiver);\n },\n }) as IntlayerNode<T>;\n};\n"],"mappings":";AAUA,MAAa,sBAEX,EACA,UACA,OACA,kBAAkB,EAAE,OAC6B;AAEjD,KAAI,YAAY,KACd,QAAO,IAAI,MAAM,EAAE,EAAS,EAC1B,IAAI,QAAQ,MAAM,UAAU;AAC1B,MAAI,SAAS,QACX,QAAO;AAGT,MACE,mBACA,OAAO,KAAK,gBAAgB,CAAC,SAAS,KAAe,CAErD,QAAO,gBAAgB;AAGzB,SAAO,QAAQ,IAAI,QAAQ,MAAM,SAAS;IAE7C,CAAC;AAKJ,QAAO,IAAI,MAAM,UAAU;EACzB,MAAM,QAAQ,SAAS,eAAe;AACpC,OAAI,OAAO,UAAU,WACnB,QAAO,QAAQ,MAAM,OAAmB,SAAS,cAAc;AAEjE,UAAO,QAAQ,MAAM,QAAoB,SAAS,cAAc;;EAElE,IAAI,QAAQ,MAAM,UAAU;AAC1B,OAAI,SAAS,QACX,QAAO;AAGT,OAAI,SAAS,WACX,cAAa;AAEX,WAAO,OAAO,MAAM;;AAIxB,OAAI,SAAS,OAAO,YAClB,cAAa;AAGf,OACE,mBACA,OAAO,KAAK,gBAAgB,CAAC,SAAS,KAAe,CAErD,QAAO,gBAAgB;AAGzB,UAAO,QAAQ,IAAI,QAAQ,MAAM,SAAS;;EAE7C,CAAC"}
1
+ {"version":3,"file":"renderIntlayerNode.mjs","names":[],"sources":["../../src/renderIntlayerNode.ts"],"sourcesContent":["export type IntlayerNode<T = string, AdditionalProps = {}> = any & {\n value: T;\n} & AdditionalProps;\n\ntype RenderIntlayerNodeProps<T> = {\n value: T;\n children: any;\n additionalProps?: { [key: string]: any };\n};\n\nexport const renderIntlayerNode = <\n T extends number | string | boolean | undefined | null,\n>({\n children,\n value,\n additionalProps = {},\n}: RenderIntlayerNodeProps<T>): IntlayerNode<T> => {\n // If children is null or undefined, return a simple object with the value\n if (children == null) {\n return new Proxy({} as any, {\n get(target, prop, receiver) {\n if (prop === 'value') {\n return value;\n }\n\n if (\n additionalProps &&\n Object.keys(additionalProps).includes(prop as string)\n ) {\n return additionalProps[prop as keyof typeof additionalProps];\n }\n\n return Reflect.get(target, prop, receiver);\n },\n }) as IntlayerNode<T>;\n }\n\n // Return a Proxy that pretends to be the original content\n // but also has a .value getter and additional props.\n return new Proxy(children, {\n apply(target, thisArg, argumentsList) {\n if (typeof value === 'function') {\n return Reflect.apply(value as Function, thisArg, argumentsList);\n }\n return Reflect.apply(target as Function, thisArg, argumentsList);\n },\n get(target, prop, receiver) {\n if (prop === 'value') {\n return value;\n }\n\n if (prop === 'toString') {\n return () => {\n // console.log('renderIntlayerNode toString called for:', value);\n return String(value);\n };\n }\n\n if (prop === Symbol.toPrimitive) {\n return () => value;\n }\n\n if (\n additionalProps &&\n Object.keys(additionalProps).includes(prop as string)\n ) {\n return additionalProps[prop as keyof typeof additionalProps];\n }\n\n return Reflect.get(target, prop, receiver);\n },\n }) as IntlayerNode<T>;\n};\n"],"mappings":"AAUA,MAAa,GAEX,CACA,WACA,QACA,kBAAkB,EAAE,IAGhB,GAAY,KACP,IAAI,MAAM,EAAE,CAAS,CAC1B,IAAI,EAAQ,EAAM,EAAU,CAY1B,OAXI,IAAS,QACJ,EAIP,GACA,OAAO,KAAK,EAAgB,CAAC,SAAS,EAAe,CAE9C,EAAgB,GAGlB,QAAQ,IAAI,EAAQ,EAAM,EAAS,EAE7C,CAAC,CAKG,IAAI,MAAM,EAAU,CACzB,MAAM,EAAQ,EAAS,EAAe,CAIpC,OAHI,OAAO,GAAU,WACZ,QAAQ,MAAM,EAAmB,EAAS,EAAc,CAE1D,QAAQ,MAAM,EAAoB,EAAS,EAAc,EAElE,IAAI,EAAQ,EAAM,EAAU,CAuB1B,OAtBI,IAAS,QACJ,EAGL,IAAS,eAGF,OAAO,EAAM,CAIpB,IAAS,OAAO,gBACL,EAIb,GACA,OAAO,KAAK,EAAgB,CAAC,SAAS,EAAe,CAE9C,EAAgB,GAGlB,QAAQ,IAAI,EAAQ,EAAM,EAAS,EAE7C,CAAC"}
@@ -1,3 +1 @@
1
- import { mergeConfig } from "./mergeConfig.mjs";
2
-
3
- export { mergeConfig };
1
+ import{mergeConfig as e}from"./mergeConfig.mjs";export{e as mergeConfig};
@@ -1,43 +1,2 @@
1
- import { resolve } from "node:path";
2
- import { getAlias, getConfiguration } from "@intlayer/config";
3
- import { IntlayerPlugin } from "@intlayer/webpack";
4
- import { defu } from "defu";
5
-
6
- //#region src/webpack/mergeConfig.ts
7
- const mergeConfig = (baseConfig) => {
8
- const intlayerConfig = getConfiguration();
9
- return defu({
10
- resolve: { alias: getAlias({
11
- configuration: intlayerConfig,
12
- formatter: (value) => resolve(value)
13
- }) },
14
- externals: {
15
- esbuild: "esbuild",
16
- module: "module",
17
- fs: "fs",
18
- chokidar: "chokidar",
19
- fsevents: "fsevents"
20
- },
21
- module: { rules: [{
22
- test: /\.node$/,
23
- loader: "node-loader"
24
- }, {
25
- test: /\.mjs$/,
26
- include: [/[\\/]\.intlayer[\\/]/],
27
- type: "javascript/auto",
28
- enforce: "pre",
29
- use: {
30
- loader: "babel-loader",
31
- options: {
32
- presets: [["@babel/preset-env", { modules: "commonjs" }]],
33
- plugins: [["@babel/plugin-syntax-import-attributes", { deprecatedAssert: true }]]
34
- }
35
- }
36
- }] },
37
- plugins: [new IntlayerPlugin(intlayerConfig)]
38
- }, baseConfig);
39
- };
40
-
41
- //#endregion
42
- export { mergeConfig };
1
+ import{resolve as e}from"node:path";import{getConfiguration as t}from"@intlayer/config/node";import{getAlias as n}from"@intlayer/config/utils";import{IntlayerPlugin as r}from"@intlayer/webpack";import{defu as i}from"defu";const a=a=>{let o=t();return i({resolve:{alias:n({configuration:o,formatter:t=>e(t)})},externals:{esbuild:`esbuild`,module:`module`,fs:`fs`,chokidar:`chokidar`,fsevents:`fsevents`},module:{rules:[{test:/\.node$/,loader:`node-loader`},{test:/\.mjs$/,include:[/[\\/]\.intlayer[\\/]/],type:`javascript/auto`,enforce:`pre`,use:{loader:`babel-loader`,options:{presets:[[`@babel/preset-env`,{modules:`commonjs`}]],plugins:[[`@babel/plugin-syntax-import-attributes`,{deprecatedAssert:!0}]]}}}]},plugins:[new r(o)]},a)};export{a as mergeConfig};
43
2
  //# sourceMappingURL=mergeConfig.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"mergeConfig.mjs","names":[],"sources":["../../../src/webpack/mergeConfig.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport { getAlias, getConfiguration } from '@intlayer/config';\nimport { IntlayerPlugin } from '@intlayer/webpack'; // adjust path if needed\nimport { defu } from 'defu';\n/** @ts-ignore Configuration type exist but raise error */\nimport type { Configuration as WebpackConfig } from 'webpack';\n\nexport const mergeConfig = (baseConfig: WebpackConfig): WebpackConfig => {\n const intlayerConfig = getConfiguration();\n\n const config = {\n resolve: {\n alias: getAlias({\n configuration: intlayerConfig,\n formatter: (value: string) => resolve(value), // get absolute path\n }),\n },\n externals: {\n esbuild: 'esbuild',\n module: 'module',\n fs: 'fs',\n chokidar: 'chokidar',\n fsevents: 'fsevents',\n },\n module: {\n rules: [\n {\n test: /\\.node$/,\n loader: 'node-loader',\n },\n\n // Fix `import _48DQ2FD8DPGT8SPgqAmt from '../dictionary/app.json' with { type: 'json' };` syntax\n {\n test: /\\.mjs$/,\n include: [/[\\\\/]\\.intlayer[\\\\/]/],\n type: 'javascript/auto',\n enforce: 'pre',\n use: {\n loader: 'babel-loader',\n options: {\n presets: [['@babel/preset-env', { modules: 'commonjs' }]],\n plugins: [\n [\n '@babel/plugin-syntax-import-attributes',\n { deprecatedAssert: true },\n ],\n ],\n },\n },\n },\n ],\n },\n plugins: [new IntlayerPlugin(intlayerConfig)],\n };\n\n return defu(config, baseConfig) as WebpackConfig;\n};\n"],"mappings":";;;;;;AAOA,MAAa,eAAe,eAA6C;CACvE,MAAM,iBAAiB,kBAAkB;AA+CzC,QAAO,KA7CQ;EACb,SAAS,EACP,OAAO,SAAS;GACd,eAAe;GACf,YAAY,UAAkB,QAAQ,MAAM;GAC7C,CAAC,EACH;EACD,WAAW;GACT,SAAS;GACT,QAAQ;GACR,IAAI;GACJ,UAAU;GACV,UAAU;GACX;EACD,QAAQ,EACN,OAAO,CACL;GACE,MAAM;GACN,QAAQ;GACT,EAGD;GACE,MAAM;GACN,SAAS,CAAC,uBAAuB;GACjC,MAAM;GACN,SAAS;GACT,KAAK;IACH,QAAQ;IACR,SAAS;KACP,SAAS,CAAC,CAAC,qBAAqB,EAAE,SAAS,YAAY,CAAC,CAAC;KACzD,SAAS,CACP,CACE,0CACA,EAAE,kBAAkB,MAAM,CAC3B,CACF;KACF;IACF;GACF,CACF,EACF;EACD,SAAS,CAAC,IAAI,eAAe,eAAe,CAAC;EAC9C,EAEmB,WAAW"}
1
+ {"version":3,"file":"mergeConfig.mjs","names":[],"sources":["../../../src/webpack/mergeConfig.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { getAlias } from '@intlayer/config/utils';\nimport { IntlayerPlugin } from '@intlayer/webpack'; // adjust path if needed\nimport { defu } from 'defu';\n/** @ts-ignore Configuration type exist but raise error */\nimport type { Configuration as WebpackConfig } from 'webpack';\n\nexport const mergeConfig = (baseConfig: WebpackConfig): WebpackConfig => {\n const intlayerConfig = getConfiguration();\n\n const config = {\n resolve: {\n alias: getAlias({\n configuration: intlayerConfig,\n formatter: (value: string) => resolve(value), // get absolute path\n }),\n },\n externals: {\n esbuild: 'esbuild',\n module: 'module',\n fs: 'fs',\n chokidar: 'chokidar',\n fsevents: 'fsevents',\n },\n module: {\n rules: [\n {\n test: /\\.node$/,\n loader: 'node-loader',\n },\n\n // Fix `import _48DQ2FD8DPGT8SPgqAmt from '../dictionary/app.json' with { type: 'json' };` syntax\n {\n test: /\\.mjs$/,\n include: [/[\\\\/]\\.intlayer[\\\\/]/],\n type: 'javascript/auto',\n enforce: 'pre',\n use: {\n loader: 'babel-loader',\n options: {\n presets: [['@babel/preset-env', { modules: 'commonjs' }]],\n plugins: [\n [\n '@babel/plugin-syntax-import-attributes',\n { deprecatedAssert: true },\n ],\n ],\n },\n },\n },\n ],\n },\n plugins: [new IntlayerPlugin(intlayerConfig)],\n };\n\n return defu(config, baseConfig) as WebpackConfig;\n};\n"],"mappings":"8NAQA,MAAa,EAAe,GAA6C,CACvE,IAAM,EAAiB,GAAkB,CA+CzC,OAAO,EA7CQ,CACb,QAAS,CACP,MAAO,EAAS,CACd,cAAe,EACf,UAAY,GAAkB,EAAQ,EAAM,CAC7C,CAAC,CACH,CACD,UAAW,CACT,QAAS,UACT,OAAQ,SACR,GAAI,KACJ,SAAU,WACV,SAAU,WACX,CACD,OAAQ,CACN,MAAO,CACL,CACE,KAAM,UACN,OAAQ,cACT,CAGD,CACE,KAAM,SACN,QAAS,CAAC,uBAAuB,CACjC,KAAM,kBACN,QAAS,MACT,IAAK,CACH,OAAQ,eACR,QAAS,CACP,QAAS,CAAC,CAAC,oBAAqB,CAAE,QAAS,WAAY,CAAC,CAAC,CACzD,QAAS,CACP,CACE,yCACA,CAAE,iBAAkB,GAAM,CAC3B,CACF,CACF,CACF,CACF,CACF,CACF,CACD,QAAS,CAAC,IAAI,EAAe,EAAe,CAAC,CAC9C,CAEmB,EAAW"}
@@ -3,7 +3,7 @@ import "../index.js";
3
3
  import * as _angular_core0 from "@angular/core";
4
4
  import * as _intlayer_types0 from "@intlayer/types";
5
5
  import { Dictionary, DictionaryKeys, LocalesValues, StrictModeLocaleMap } from "@intlayer/types";
6
- import * as _intlayer_core0 from "@intlayer/core";
6
+ import * as _intlayer_core_interpreter0 from "@intlayer/core/interpreter";
7
7
 
8
8
  //#region src/client/useDictionaryDynamic.d.ts
9
9
  /**
@@ -11,7 +11,7 @@ import * as _intlayer_core0 from "@intlayer/core";
11
11
  *
12
12
  * If the locale is not provided, it will use the locale from the client context
13
13
  */
14
- declare const useDictionaryDynamic: <T extends Dictionary, K extends DictionaryKeys>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, key: K, locale?: LocalesValues) => _angular_core0.Signal<_intlayer_core0.DeepTransformContent<T["content"], IInterpreterPluginState$1, _intlayer_types0.Locale>>;
14
+ declare const useDictionaryDynamic: <T extends Dictionary, K extends DictionaryKeys>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, key: K, locale?: LocalesValues) => _angular_core0.Signal<_intlayer_core_interpreter0.DeepTransformContent<T["content"], IInterpreterPluginState$1, _intlayer_types0.Locale>>;
15
15
  //#endregion
16
16
  export { useDictionaryDynamic };
17
17
  //# sourceMappingURL=useDictionaryDynamic.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionaryDynamic.d.ts","names":[],"sources":["../../../src/client/useDictionaryDynamic.ts"],"mappings":";;;;;;;;;;;;;cAmBa,oBAAA,aACD,UAAA,YACA,cAAA,EAEV,iBAAA,EAAmB,mBAAA,OAA0B,OAAA,CAAQ,CAAA,IACrD,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,aAAA,KAAa,cAAA,CAAA,MAAA,CAAA,eAAA,CAAA,oBAAA,CAAA,CAAA,aAAA,yBAAA,EAAA,gBAAA,CAAA,MAAA"}
1
+ {"version":3,"file":"useDictionaryDynamic.d.ts","names":[],"sources":["../../../src/client/useDictionaryDynamic.ts"],"mappings":";;;;;;;;;;;;;cAmBa,oBAAA,aACD,UAAA,YACA,cAAA,EAEV,iBAAA,EAAmB,mBAAA,OAA0B,OAAA,CAAQ,CAAA,IACrD,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,aAAA,KAAa,cAAA,CAAA,MAAA,CAAA,2BAAA,CAAA,oBAAA,CAAA,CAAA,aAAA,yBAAA,EAAA,gBAAA,CAAA,MAAA"}
@@ -1,5 +1,5 @@
1
1
  import * as _angular_core0 from "@angular/core";
2
- import { NodeProps } from "@intlayer/core";
2
+ import { NodeProps } from "@intlayer/core/interpreter";
3
3
 
4
4
  //#region src/editor/ContentSelectorWrapper.component.d.ts
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ContentSelectorWrapper.component.d.ts","names":[],"sources":["../../../src/editor/ContentSelectorWrapper.component.ts"],"mappings":";;;;;;;AAaA;UAAiB,2BAAA,SAAoC,SAAA;EAAA,CAClD,GAAA;AAAA;AAAA,cAkBU,+BAAA;EACF,aAAA;EACA,OAAA;EAAA,QAGD,eAAA;EAAA,QACA,aAAA;;EAOR,UAAA,EAb0C,cAAA,CAahC,MAAA;EASV,OAAA,EATU,cAAA,CASH,MAAA;EAGP,YAAA,CAAA;AAAA"}
1
+ {"version":3,"file":"ContentSelectorWrapper.component.d.ts","names":[],"sources":["../../../src/editor/ContentSelectorWrapper.component.ts"],"mappings":";;;;;;;AAcA;UAAiB,2BAAA,SAAoC,SAAA;EAAA,CAClD,GAAA;AAAA;AAAA,cAkBU,+BAAA;EACF,aAAA;EACA,OAAA;EAAA,QAGD,eAAA;EAAA,QACA,aAAA;;EAOR,UAAA,EAb0C,cAAA,CAahC,MAAA;EASV,OAAA,EATU,cAAA,CASH,MAAA;EAGP,YAAA,CAAA;AAAA"}
@@ -1,4 +1,4 @@
1
- import { NodeProps } from "@intlayer/core";
1
+ import { NodeProps } from "@intlayer/core/interpreter";
2
2
 
3
3
  //#region src/editor/EditorSelectorRenderer.component.d.ts
4
4
  /**
@@ -1,9 +1,9 @@
1
1
  import { DeclaredLocales, Dictionary, LocalesValues } from "@intlayer/types";
2
- import * as _intlayer_core0 from "@intlayer/core";
3
- import { Plugins } from "@intlayer/core";
2
+ import * as _intlayer_core_interpreter0 from "@intlayer/core/interpreter";
3
+ import { Plugins } from "@intlayer/core/interpreter";
4
4
 
5
5
  //#region src/getDictionary.d.ts
6
- declare const getDictionary: <T extends Dictionary, L extends LocalesValues = DeclaredLocales>(dictionary: T, locale?: L, additionalPlugins?: Plugins[]) => _intlayer_core0.DeepTransformContent<T["content"], _intlayer_core0.IInterpreterPluginState, L>;
6
+ declare const getDictionary: <T extends Dictionary, L extends LocalesValues = DeclaredLocales>(dictionary: T, locale?: L, additionalPlugins?: Plugins[]) => _intlayer_core_interpreter0.DeepTransformContent<T["content"], _intlayer_core_interpreter0.IInterpreterPluginState, L>;
7
7
  //#endregion
8
8
  export { getDictionary };
9
9
  //# sourceMappingURL=getDictionary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getDictionary.d.ts","names":[],"sources":["../../src/getDictionary.ts"],"mappings":";;;;;cAWa,aAAA,aACD,UAAA,YACA,aAAA,GAAgB,eAAA,EAE1B,UAAA,EAAY,CAAA,EACZ,MAAA,GAAS,CAAA,EACT,iBAAA,GAAoB,OAAA,OAAS,eAAA,CAAA,oBAAA,CAAA,CAAA,aAAA,eAAA,CAAA,uBAAA,EAAA,CAAA"}
1
+ {"version":3,"file":"getDictionary.d.ts","names":[],"sources":["../../src/getDictionary.ts"],"mappings":";;;;;cAWa,aAAA,aACD,UAAA,YACA,aAAA,GAAgB,eAAA,EAE1B,UAAA,EAAY,CAAA,EACZ,MAAA,GAAS,CAAA,EACT,iBAAA,GAAoB,OAAA,OAAS,2BAAA,CAAA,oBAAA,CAAA,CAAA,aAAA,2BAAA,CAAA,uBAAA,EAAA,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { DeepTransformContent as DeepTransformContent$1 } from "./plugins.js";
2
2
  import { DeclaredLocales, DictionaryKeys, DictionaryRegistryContent, LocalesValues } from "@intlayer/types";
3
- import { Plugins } from "@intlayer/core";
3
+ import { Plugins } from "@intlayer/core/interpreter";
4
4
 
5
5
  //#region src/getIntlayer.d.ts
6
6
  declare const getIntlayer: <T extends DictionaryKeys, L extends LocalesValues = DeclaredLocales>(key: T, locale?: L, additionalPlugins?: Plugins[]) => DeepTransformContent$1<DictionaryRegistryContent<T>>;
@@ -1 +1 @@
1
- {"version":3,"file":"getIntlayer.d.ts","names":[],"sources":["../../src/getIntlayer.ts"],"mappings":";;;;;cAea,WAAA,aACD,cAAA,YACA,aAAA,GAAgB,eAAA,EAE1B,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,CAAA,EACT,iBAAA,GAAoB,OAAA,OAWkC,sBAAA,CACpD,yBAAA,CAA0B,CAAA"}
1
+ {"version":3,"file":"getIntlayer.d.ts","names":[],"sources":["../../src/getIntlayer.ts"],"mappings":";;;;;cAkBa,WAAA,aACD,cAAA,YACA,aAAA,GAAgB,eAAA,EAE1B,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,CAAA,EACT,iBAAA,GAAoB,OAAA,OAWkC,sBAAA,CACpD,yBAAA,CAA0B,CAAA"}
@@ -15,7 +15,7 @@ import "./client/index.js";
15
15
  import { LocalesValues } from "@intlayer/types";
16
16
 
17
17
  //#region src/index.d.ts
18
- declare module '@intlayer/core' {
18
+ declare module '@intlayer/core/interpreter' {
19
19
  interface IInterpreterPlugin<T, S, L extends LocalesValues> extends IInterpreterPluginAngular<T, S, L> {}
20
20
  }
21
21
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;YAKY,kBAAA,iBAAmC,aAAA,UACnC,yBAAA,CAA0B,CAAA,EAAG,CAAA,EAAG,CAAA;AAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;YAIY,kBAAA,iBAAmC,aAAA,UACnC,yBAAA,CAA0B,CAAA,EAAG,CAAA,EAAG,CAAA;AAAA"}
@@ -1,5 +1,5 @@
1
1
  import { InjectionToken, TemplateRef } from "@angular/core";
2
- import { MarkdownRuntime } from "@intlayer/core";
2
+ import { MarkdownRuntime } from "@intlayer/core/markdown";
3
3
 
4
4
  //#region src/markdown/installIntlayerMarkdown.d.ts
5
5
  declare const INTLAYER_MARKDOWN_TOKEN: InjectionToken<IntlayerMarkdownProvider>;