angular-intlayer 8.0.4 → 8.0.6

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 (97) hide show
  1. package/dist/cjs/UI/ContentSelector.component.cjs +4 -3
  2. package/dist/cjs/UI/ContentSelector.component.cjs.map +1 -1
  3. package/dist/cjs/_virtual/{_@oxc-project_runtime@0.110.0 → _@oxc-project_runtime@0.112.0}/helpers/decorate.cjs +1 -1
  4. package/dist/cjs/_virtual/{_@oxc-project_runtime@0.110.0 → _@oxc-project_runtime@0.112.0}/helpers/decorateMetadata.cjs +1 -1
  5. package/dist/cjs/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +1 -1
  6. package/dist/cjs/client/index.cjs +1 -0
  7. package/dist/cjs/client/installIntlayer.cjs +4 -3
  8. package/dist/cjs/client/installIntlayer.cjs.map +1 -1
  9. package/dist/cjs/client/useDictionary.cjs +2 -1
  10. package/dist/cjs/client/useDictionary.cjs.map +1 -1
  11. package/dist/cjs/client/useDictionaryAsync.cjs +3 -2
  12. package/dist/cjs/client/useDictionaryAsync.cjs.map +1 -1
  13. package/dist/cjs/client/useDictionaryDynamic.cjs +3 -2
  14. package/dist/cjs/client/useDictionaryDynamic.cjs.map +1 -1
  15. package/dist/cjs/client/useIntl.cjs +2 -1
  16. package/dist/cjs/client/useIntl.cjs.map +1 -1
  17. package/dist/cjs/client/useIntlayer.cjs +2 -1
  18. package/dist/cjs/client/useIntlayer.cjs.map +1 -1
  19. package/dist/cjs/client/useLoadDynamic.cjs +2 -1
  20. package/dist/cjs/client/useLoadDynamic.cjs.map +1 -1
  21. package/dist/cjs/client/useLocale.cjs +3 -2
  22. package/dist/cjs/client/useLocale.cjs.map +1 -1
  23. package/dist/cjs/client/useLocaleStorage.cjs +2 -1
  24. package/dist/cjs/client/useLocaleStorage.cjs.map +1 -1
  25. package/dist/cjs/editor/ContentSelectorWrapper.component.cjs +4 -3
  26. package/dist/cjs/editor/ContentSelectorWrapper.component.cjs.map +1 -1
  27. package/dist/cjs/editor/EditedContentRenderer.component.cjs +4 -3
  28. package/dist/cjs/editor/EditedContentRenderer.component.cjs.map +1 -1
  29. package/dist/cjs/editor/EditorSelectorRenderer.component.cjs +4 -3
  30. package/dist/cjs/editor/EditorSelectorRenderer.component.cjs.map +1 -1
  31. package/dist/cjs/editor/communicator.cjs +3 -2
  32. package/dist/cjs/editor/communicator.cjs.map +1 -1
  33. package/dist/cjs/editor/configuration.cjs +3 -2
  34. package/dist/cjs/editor/configuration.cjs.map +1 -1
  35. package/dist/cjs/editor/createSharedComposable.cjs +2 -1
  36. package/dist/cjs/editor/createSharedComposable.cjs.map +1 -1
  37. package/dist/cjs/editor/dictionariesRecord.cjs +2 -1
  38. package/dist/cjs/editor/dictionariesRecord.cjs.map +1 -1
  39. package/dist/cjs/editor/editedContent.cjs +2 -1
  40. package/dist/cjs/editor/editedContent.cjs.map +1 -1
  41. package/dist/cjs/editor/editorEnabled.cjs +2 -1
  42. package/dist/cjs/editor/editorEnabled.cjs.map +1 -1
  43. package/dist/cjs/editor/editorLocale.cjs +2 -1
  44. package/dist/cjs/editor/editorLocale.cjs.map +1 -1
  45. package/dist/cjs/editor/focusDictionary.cjs +2 -1
  46. package/dist/cjs/editor/focusDictionary.cjs.map +1 -1
  47. package/dist/cjs/editor/index.cjs +1 -0
  48. package/dist/cjs/editor/installIntlayerEditor.cjs +3 -2
  49. package/dist/cjs/editor/installIntlayerEditor.cjs.map +1 -1
  50. package/dist/cjs/editor/useCrossFrameMessageListener.cjs +2 -1
  51. package/dist/cjs/editor/useCrossFrameMessageListener.cjs.map +1 -1
  52. package/dist/cjs/editor/useCrossFrameState.cjs +2 -1
  53. package/dist/cjs/editor/useCrossFrameState.cjs.map +1 -1
  54. package/dist/cjs/editor/useCrossURLPathState.cjs +2 -1
  55. package/dist/cjs/editor/useCrossURLPathState.cjs.map +1 -1
  56. package/dist/cjs/editor/useEditedContentRenderer.cjs +3 -2
  57. package/dist/cjs/editor/useEditedContentRenderer.cjs.map +1 -1
  58. package/dist/cjs/editor/useEditor.cjs +1 -0
  59. package/dist/cjs/editor/useEditor.cjs.map +1 -1
  60. package/dist/cjs/editor/useIframeClickInterceptor.cjs +2 -1
  61. package/dist/cjs/editor/useIframeClickInterceptor.cjs.map +1 -1
  62. package/dist/cjs/getDictionary.cjs +2 -1
  63. package/dist/cjs/getDictionary.cjs.map +1 -1
  64. package/dist/cjs/getIntlayer.cjs +2 -1
  65. package/dist/cjs/getIntlayer.cjs.map +1 -1
  66. package/dist/cjs/index.cjs +1 -0
  67. package/dist/cjs/markdown/index.cjs +1 -0
  68. package/dist/cjs/markdown/installIntlayerMarkdown.cjs +3 -2
  69. package/dist/cjs/markdown/installIntlayerMarkdown.cjs.map +1 -1
  70. package/dist/cjs/plugins.cjs +3 -2
  71. package/dist/cjs/plugins.cjs.map +1 -1
  72. package/dist/cjs/renderIntlayerNode.cjs +1 -0
  73. package/dist/cjs/renderIntlayerNode.cjs.map +1 -1
  74. package/dist/cjs/webpack/index.cjs +1 -0
  75. package/dist/cjs/webpack/mergeConfig.cjs +14 -1
  76. package/dist/cjs/webpack/mergeConfig.cjs.map +1 -1
  77. package/dist/esm/UI/ContentSelector.component.mjs +2 -2
  78. package/dist/esm/_virtual/{_@oxc-project_runtime@0.110.0 → _@oxc-project_runtime@0.112.0}/helpers/decorate.mjs +1 -1
  79. package/dist/esm/_virtual/{_@oxc-project_runtime@0.110.0 → _@oxc-project_runtime@0.112.0}/helpers/decorateMetadata.mjs +1 -1
  80. package/dist/esm/client/installIntlayer.mjs +1 -1
  81. package/dist/esm/editor/ContentSelectorWrapper.component.mjs +2 -2
  82. package/dist/esm/editor/EditedContentRenderer.component.mjs +2 -2
  83. package/dist/esm/editor/EditorSelectorRenderer.component.mjs +2 -2
  84. package/dist/esm/editor/useEditedContentRenderer.mjs +1 -1
  85. package/dist/esm/markdown/installIntlayerMarkdown.mjs +1 -1
  86. package/dist/esm/plugins.mjs +1 -1
  87. package/dist/esm/plugins.mjs.map +1 -1
  88. package/dist/esm/webpack/mergeConfig.mjs +12 -0
  89. package/dist/esm/webpack/mergeConfig.mjs.map +1 -1
  90. package/dist/types/client/installIntlayer.d.ts +2 -2
  91. package/dist/types/client/useDictionaryAsync.d.ts +2 -2
  92. package/dist/types/client/useDictionaryDynamic.d.ts +4 -4
  93. package/dist/types/client/useLocaleStorage.d.ts +5 -5
  94. package/dist/types/editor/ContentSelectorWrapper.component.d.ts +3 -3
  95. package/dist/types/editor/EditedContentRenderer.component.d.ts +2 -2
  96. package/dist/types/editor/useCrossURLPathState.d.ts +3 -3
  97. package/package.json +6 -5
@@ -1,4 +1,4 @@
1
- import { __decorate } from "../_virtual/_@oxc-project_runtime@0.110.0/helpers/decorate.mjs";
1
+ import { __decorate } from "../_virtual/_@oxc-project_runtime@0.112.0/helpers/decorate.mjs";
2
2
  import { compile } from "@intlayer/core";
3
3
  import { Injectable, InjectionToken, inject } from "@angular/core";
4
4
 
@@ -65,7 +65,7 @@ const markdownStringPlugin = {
65
65
  keyPath: []
66
66
  });
67
67
  const render = (components) => renderIntlayerNode({
68
- ...props,
68
+ ...rest,
69
69
  value: node,
70
70
  children: () => ({
71
71
  component: ContentSelectorWrapperComponent,
@@ -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 ...props,\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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SAAS,GAAG,SAAS;EAG7B,MAAM,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 {\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> = DeepTransformContentCore<T, IInterpreterPluginState, L>;\n"],"mappings":";;;;;;;;;;AAwBA,MAAM,6BAA6B,aAAkB,eAAoB;CACvE,GAAG;CACH,gBAAgB,KAAa,OAAY,GAAG,aAAoB;EAC9D,MAAM,WAAW,YAAY;AAE7B,MAAI,UAAU;GACZ,MAAM,WAAW;IAAE,GAAG;IAAO,GAAG;IAAU;GAG1C,MAAM,gBAAgB,OAAO,SAAS,OAAO;GAC7C,MAAM,gBAAgB,SAAS,SAAS,SAAS;AAEjD,OAAI,iBAAiB,eAAe;AAClC,aAAS,QAAQ,GAAG,cAAc,GAAG;AACrC,aAAS,YAAY;;AAGvB,UAAO,YAAY,cAAc,KAAK,UAA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\/]\.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
+ }
24
36
  }] },
25
37
  plugins: [new IntlayerPlugin(intlayerConfig)]
26
38
  }, baseConfig);
@@ -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 },\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;AA2BzC,QAAO,KAzBQ;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,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 { 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,11 +1,11 @@
1
- import * as _angular_core7 from "@angular/core";
1
+ import * as _angular_core0 from "@angular/core";
2
2
  import { InjectionToken, Signal } from "@angular/core";
3
3
  import { LocalesValues } from "@intlayer/types";
4
4
 
5
5
  //#region src/client/installIntlayer.d.ts
6
6
  declare const INTLAYER_TOKEN: InjectionToken<IntlayerProvider>;
7
7
  declare class IntlayerProvider {
8
- isCookieEnabled: _angular_core7.WritableSignal<boolean>;
8
+ isCookieEnabled: _angular_core0.WritableSignal<boolean>;
9
9
  private _locale;
10
10
  readonly locale: Signal<LocalesValues>;
11
11
  setLocale: (locale: LocalesValues) => void;
@@ -1,4 +1,4 @@
1
- import * as _angular_core8 from "@angular/core";
1
+ import * as _angular_core0 from "@angular/core";
2
2
  import { Dictionary, LocalesValues, StrictModeLocaleMap } from "@intlayer/types";
3
3
 
4
4
  //#region src/client/useDictionaryAsync.d.ts
@@ -7,7 +7,7 @@ import { Dictionary, LocalesValues, StrictModeLocaleMap } from "@intlayer/types"
7
7
  *
8
8
  * If the locale is not provided, it will use the locale from the client context
9
9
  */
10
- declare const useDictionaryAsync: <T extends Dictionary>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, locale?: LocalesValues) => Promise<_angular_core8.Signal<any>>;
10
+ declare const useDictionaryAsync: <T extends Dictionary>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, locale?: LocalesValues) => Promise<_angular_core0.Signal<any>>;
11
11
  //#endregion
12
12
  export { useDictionaryAsync };
13
13
  //# sourceMappingURL=useDictionaryAsync.d.ts.map
@@ -1,9 +1,9 @@
1
1
  import { IInterpreterPluginState as IInterpreterPluginState$1 } from "../plugins.js";
2
2
  import "../index.js";
3
- import * as _angular_core1 from "@angular/core";
4
- import * as _intlayer_types1 from "@intlayer/types";
3
+ import * as _angular_core0 from "@angular/core";
4
+ import * as _intlayer_types0 from "@intlayer/types";
5
5
  import { Dictionary, DictionaryKeys, LocalesValues, StrictModeLocaleMap } from "@intlayer/types";
6
- import * as _intlayer_core1 from "@intlayer/core";
6
+ import * as _intlayer_core0 from "@intlayer/core";
7
7
 
8
8
  //#region src/client/useDictionaryDynamic.d.ts
9
9
  /**
@@ -11,7 +11,7 @@ import * as _intlayer_core1 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_core1.Signal<_intlayer_core1.DeepTransformContent<T["content"], IInterpreterPluginState$1, _intlayer_types1.Locale>>;
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>>;
15
15
  //#endregion
16
16
  export { useDictionaryDynamic };
17
17
  //# sourceMappingURL=useDictionaryDynamic.d.ts.map
@@ -1,4 +1,4 @@
1
- import * as _intlayer_types2 from "@intlayer/types";
1
+ import * as _intlayer_types0 from "@intlayer/types";
2
2
  import { LocalesValues } from "@intlayer/types";
3
3
 
4
4
  //#region src/client/useLocaleStorage.d.ts
@@ -8,13 +8,13 @@ import { LocalesValues } from "@intlayer/types";
8
8
  /**
9
9
  * Get the locale cookie
10
10
  */
11
- declare const localeInStorage: _intlayer_types2.Locale;
11
+ declare const localeInStorage: _intlayer_types0.Locale;
12
12
  /**
13
13
  * @deprecated Use localeInStorage instead
14
14
  *
15
15
  * Get the locale cookie
16
16
  */
17
- declare const localeCookie: _intlayer_types2.Locale;
17
+ declare const localeCookie: _intlayer_types0.Locale;
18
18
  /**
19
19
  * Set the locale cookie
20
20
  */
@@ -29,7 +29,7 @@ declare const setLocaleCookie: (locale: LocalesValues, isCookieEnabled: boolean)
29
29
  * Hook that provides the locale storage and a function to set it
30
30
  */
31
31
  declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
32
- getLocale: () => _intlayer_types2.Locale;
32
+ getLocale: () => _intlayer_types0.Locale;
33
33
  setLocale: (locale: LocalesValues) => void;
34
34
  };
35
35
  /**
@@ -40,7 +40,7 @@ declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
40
40
  * Hook that provides the locale cookie and a function to set it
41
41
  */
42
42
  declare const useLocaleCookie: (isCookieEnabled?: boolean) => {
43
- localeCookie: _intlayer_types2.Locale;
43
+ localeCookie: _intlayer_types0.Locale;
44
44
  setLocaleCookie: (locale: LocalesValues) => void;
45
45
  };
46
46
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as _angular_core4 from "@angular/core";
1
+ import * as _angular_core0 from "@angular/core";
2
2
  import { NodeProps } from "@intlayer/core";
3
3
 
4
4
  //#region src/editor/ContentSelectorWrapper.component.d.ts
@@ -15,8 +15,8 @@ declare class ContentSelectorWrapperComponent {
15
15
  private focusDictionary;
16
16
  private editorEnabled;
17
17
  constructor();
18
- isSelected: _angular_core4.Signal<boolean>;
19
- enabled: _angular_core4.Signal<boolean>;
18
+ isSelected: _angular_core0.Signal<boolean>;
19
+ enabled: _angular_core0.Signal<boolean>;
20
20
  handleSelect(): void;
21
21
  }
22
22
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as _angular_core6 from "@angular/core";
1
+ import * as _angular_core0 from "@angular/core";
2
2
  import { KeyPath, Locale } from "@intlayer/types";
3
3
 
4
4
  //#region src/editor/EditedContentRenderer.component.d.ts
@@ -16,7 +16,7 @@ declare class EditedContentRendererComponent {
16
16
  /**
17
17
  * Object → getContent → string, same as the React version.
18
18
  */
19
- renderedContent: _angular_core6.Signal<string>;
19
+ renderedContent: _angular_core0.Signal<string>;
20
20
  }
21
21
  //#endregion
22
22
  export { EditedContentRendererComponent, EditedContentRendererProps };
@@ -1,5 +1,5 @@
1
1
  import { useCrossFrameState } from "./useCrossFrameState.js";
2
- import * as _angular_core2 from "@angular/core";
2
+ import * as _angular_core0 from "@angular/core";
3
3
 
4
4
  //#region src/editor/useCrossURLPathState.d.ts
5
5
  /**
@@ -8,14 +8,14 @@ import * as _angular_core2 from "@angular/core";
8
8
  * @param opts - Options for controlling emit and receive behavior
9
9
  * @returns A tuple containing [state signal, setState function, forceSync function]
10
10
  */
11
- declare const useCrossURLPathState: (initial?: string, opts?: Parameters<typeof useCrossFrameState>[2]) => [_angular_core2.Signal<string>, (v: string | ((prev: string) => string)) => void, () => void];
11
+ declare const useCrossURLPathState: (initial?: string, opts?: Parameters<typeof useCrossFrameState>[2]) => [_angular_core0.Signal<string>, (v: string | ((prev: string) => string)) => void, () => void];
12
12
  /**
13
13
  * Hook for host applications to push URL path changes into the shared state
14
14
  * This also monkey patches history methods to capture navigation events
15
15
  * @param initial - The initial URL path
16
16
  * @returns A tuple containing [state signal, setState function]
17
17
  */
18
- declare const useCrossURLPathSetter: (initial?: string) => readonly [_angular_core2.Signal<string>, (v: string | ((prev: string) => string)) => void];
18
+ declare const useCrossURLPathSetter: (initial?: string) => readonly [_angular_core0.Signal<string>, (v: string | ((prev: string) => string)) => void];
19
19
  //#endregion
20
20
  export { useCrossURLPathSetter, useCrossURLPathState };
21
21
  //# sourceMappingURL=useCrossURLPathState.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "angular-intlayer",
3
- "version": "8.0.4",
3
+ "version": "8.0.6",
4
4
  "private": false,
5
5
  "description": "Easily internationalize i18n your Angular applications with type-safe multilingual content management.",
6
6
  "keywords": [
@@ -85,6 +85,7 @@
85
85
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
86
86
  },
87
87
  "dependencies": {
88
+ "@babel/plugin-syntax-import-attributes": "^7.28.6",
88
89
  "@intlayer/chokidar": "8.0.4",
89
90
  "@intlayer/config": "8.0.4",
90
91
  "@intlayer/core": "8.0.4",
@@ -95,19 +96,19 @@
95
96
  "defu": "6.1.4"
96
97
  },
97
98
  "devDependencies": {
98
- "@types/node": "25.0.10",
99
+ "@types/node": "25.2.2",
99
100
  "@types/webpack": "5.28.5",
100
101
  "@utils/ts-config": "1.0.4",
101
102
  "@utils/ts-config-types": "1.0.4",
102
103
  "@utils/tsdown-config": "1.0.4",
103
104
  "rimraf": "6.1.2",
104
- "tsdown": "0.20.1",
105
+ "tsdown": "0.20.3",
105
106
  "typescript": "5.9.3",
106
107
  "vitest": "4.0.18"
107
108
  },
108
109
  "peerDependencies": {
109
- "@angular/common": "15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0",
110
- "@angular/core": "15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0",
110
+ "@angular/common": ">=15",
111
+ "@angular/core": ">=15",
111
112
  "rxjs": "6.0.0 || ^7.0.0"
112
113
  },
113
114
  "engines": {