angular-intlayer 8.0.2 → 8.0.5
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.
- package/dist/cjs/UI/ContentSelector.component.cjs +4 -3
- package/dist/cjs/UI/ContentSelector.component.cjs.map +1 -1
- package/dist/cjs/_virtual/{_@oxc-project_runtime@0.110.0 → _@oxc-project_runtime@0.112.0}/helpers/decorate.cjs +1 -1
- package/dist/cjs/_virtual/{_@oxc-project_runtime@0.110.0 → _@oxc-project_runtime@0.112.0}/helpers/decorateMetadata.cjs +1 -1
- package/dist/cjs/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +1 -1
- package/dist/cjs/client/index.cjs +1 -0
- package/dist/cjs/client/installIntlayer.cjs +4 -3
- package/dist/cjs/client/installIntlayer.cjs.map +1 -1
- package/dist/cjs/client/useDictionary.cjs +2 -1
- package/dist/cjs/client/useDictionary.cjs.map +1 -1
- package/dist/cjs/client/useDictionaryAsync.cjs +3 -2
- package/dist/cjs/client/useDictionaryAsync.cjs.map +1 -1
- package/dist/cjs/client/useDictionaryDynamic.cjs +3 -2
- package/dist/cjs/client/useDictionaryDynamic.cjs.map +1 -1
- package/dist/cjs/client/useIntl.cjs +2 -1
- package/dist/cjs/client/useIntl.cjs.map +1 -1
- package/dist/cjs/client/useIntlayer.cjs +2 -1
- package/dist/cjs/client/useIntlayer.cjs.map +1 -1
- package/dist/cjs/client/useLoadDynamic.cjs +2 -1
- package/dist/cjs/client/useLoadDynamic.cjs.map +1 -1
- package/dist/cjs/client/useLocale.cjs +3 -2
- package/dist/cjs/client/useLocale.cjs.map +1 -1
- package/dist/cjs/client/useLocaleStorage.cjs +2 -1
- package/dist/cjs/client/useLocaleStorage.cjs.map +1 -1
- package/dist/cjs/editor/ContentSelectorWrapper.component.cjs +4 -3
- package/dist/cjs/editor/ContentSelectorWrapper.component.cjs.map +1 -1
- package/dist/cjs/editor/EditedContentRenderer.component.cjs +4 -3
- package/dist/cjs/editor/EditedContentRenderer.component.cjs.map +1 -1
- package/dist/cjs/editor/EditorSelectorRenderer.component.cjs +4 -3
- package/dist/cjs/editor/EditorSelectorRenderer.component.cjs.map +1 -1
- package/dist/cjs/editor/communicator.cjs +3 -2
- package/dist/cjs/editor/communicator.cjs.map +1 -1
- package/dist/cjs/editor/configuration.cjs +3 -2
- package/dist/cjs/editor/configuration.cjs.map +1 -1
- package/dist/cjs/editor/createSharedComposable.cjs +2 -1
- package/dist/cjs/editor/createSharedComposable.cjs.map +1 -1
- package/dist/cjs/editor/dictionariesRecord.cjs +2 -1
- package/dist/cjs/editor/dictionariesRecord.cjs.map +1 -1
- package/dist/cjs/editor/editedContent.cjs +2 -1
- package/dist/cjs/editor/editedContent.cjs.map +1 -1
- package/dist/cjs/editor/editorEnabled.cjs +2 -1
- package/dist/cjs/editor/editorEnabled.cjs.map +1 -1
- package/dist/cjs/editor/editorLocale.cjs +2 -1
- package/dist/cjs/editor/editorLocale.cjs.map +1 -1
- package/dist/cjs/editor/focusDictionary.cjs +2 -1
- package/dist/cjs/editor/focusDictionary.cjs.map +1 -1
- package/dist/cjs/editor/index.cjs +1 -0
- package/dist/cjs/editor/installIntlayerEditor.cjs +3 -2
- package/dist/cjs/editor/installIntlayerEditor.cjs.map +1 -1
- package/dist/cjs/editor/useCrossFrameMessageListener.cjs +2 -1
- package/dist/cjs/editor/useCrossFrameMessageListener.cjs.map +1 -1
- package/dist/cjs/editor/useCrossFrameState.cjs +2 -1
- package/dist/cjs/editor/useCrossFrameState.cjs.map +1 -1
- package/dist/cjs/editor/useCrossURLPathState.cjs +2 -1
- package/dist/cjs/editor/useCrossURLPathState.cjs.map +1 -1
- package/dist/cjs/editor/useEditedContentRenderer.cjs +3 -2
- package/dist/cjs/editor/useEditedContentRenderer.cjs.map +1 -1
- package/dist/cjs/editor/useEditor.cjs +1 -0
- package/dist/cjs/editor/useEditor.cjs.map +1 -1
- package/dist/cjs/editor/useIframeClickInterceptor.cjs +2 -1
- package/dist/cjs/editor/useIframeClickInterceptor.cjs.map +1 -1
- package/dist/cjs/getDictionary.cjs +2 -1
- package/dist/cjs/getDictionary.cjs.map +1 -1
- package/dist/cjs/getIntlayer.cjs +2 -1
- package/dist/cjs/getIntlayer.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -0
- package/dist/cjs/markdown/index.cjs +1 -0
- package/dist/cjs/markdown/installIntlayerMarkdown.cjs +3 -2
- package/dist/cjs/markdown/installIntlayerMarkdown.cjs.map +1 -1
- package/dist/cjs/plugins.cjs +3 -2
- package/dist/cjs/plugins.cjs.map +1 -1
- package/dist/cjs/renderIntlayerNode.cjs +1 -0
- package/dist/cjs/renderIntlayerNode.cjs.map +1 -1
- package/dist/cjs/webpack/index.cjs +1 -0
- package/dist/cjs/webpack/mergeConfig.cjs +2 -1
- package/dist/cjs/webpack/mergeConfig.cjs.map +1 -1
- package/dist/esm/UI/ContentSelector.component.mjs +2 -2
- package/dist/esm/_virtual/{_@oxc-project_runtime@0.110.0 → _@oxc-project_runtime@0.112.0}/helpers/decorate.mjs +1 -1
- package/dist/esm/_virtual/{_@oxc-project_runtime@0.110.0 → _@oxc-project_runtime@0.112.0}/helpers/decorateMetadata.mjs +1 -1
- package/dist/esm/client/installIntlayer.mjs +1 -1
- package/dist/esm/editor/ContentSelectorWrapper.component.mjs +2 -2
- package/dist/esm/editor/EditedContentRenderer.component.mjs +2 -2
- package/dist/esm/editor/EditorSelectorRenderer.component.mjs +2 -2
- package/dist/esm/editor/useEditedContentRenderer.mjs +1 -1
- package/dist/esm/markdown/installIntlayerMarkdown.mjs +1 -1
- package/dist/esm/plugins.mjs +1 -1
- package/dist/esm/plugins.mjs.map +1 -1
- package/dist/types/client/installIntlayer.d.ts +2 -2
- package/dist/types/client/useDictionaryAsync.d.ts +2 -2
- package/dist/types/client/useDictionaryDynamic.d.ts +3 -3
- package/dist/types/client/useIntl.d.ts +2 -2
- package/dist/types/client/useLocale.d.ts +2 -2
- package/dist/types/client/useLocaleStorage.d.ts +5 -5
- package/dist/types/editor/EditedContentRenderer.component.d.ts +2 -2
- package/dist/types/editor/useCrossURLPathState.d.ts +3 -3
- package/package.json +12 -12
package/dist/esm/plugins.mjs.map
CHANGED
|
@@ -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 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,UAAU,GAAG,SAAS;;AAG9D,SAAO,YAAY,cAAc,KAAK,OAAO,GAAG,SAAS;;CAE5D;;AAiBD,MAAa,sBAA+B;CAC1C,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,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SALc,0BACd,aACA,WACD,EAGA,CAAC;;AAIN,OAAI,SAAS,OAAO,YAClB,cAAa;AACX,QACE,CAAC,cACA,OAAO,eAAe,YACrB,OAAO,KAAK,WAAW,CAAC,WAAW,EAErC,QAAO,OAAO,KAAK;AAMrB,WAAO,QAAQ,MAAM,EACnB,SALc,0BACd,aACA,WACD,EAGA,CAAC;;AAIN,OAAI,SAAS,MAEX,SAAQ,mBAAyB;IAC/B,MAAM,mBAAmB;KAAE,GAAG;KAAY,GAAG;KAAgB;AAC7D,WAAO,YAAY,OAAO,iBAAiB,EAAE,iBAAiB;;AAIlE,UAAO,QAAQ,IAAI,QAAQ,MAAM,SAAS;KAE7C,CAAC;AAEJ,SAAO,YAAY,QAAQ,CAAQ;;CAEtC;AAgBD,MAAa,kBAA2B;CACtC,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,SAAS;CAC1D,YAAY,MAAwB,UAAU;EAC5C,MAAM,EAAE,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,UAAU,GAAG,SAAS;;AAG9D,SAAO,YAAY,cAAc,KAAK,OAAO,GAAG,SAAS;;CAE5D;;AAiBD,MAAa,sBAA+B;CAC1C,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;CAClB,YAAY,OAAO,EAAE,UAAU,GAAG,WAChC,mBAAmB;EACjB,GAAG;EACH,OAAO;EACP,iBAAiB;GACf,WAAW;GACX,OAAO;IACL,eAAe,KAAK;IACpB,SAAS,KAAK;IACf;GACS;GACX;EACF,CAAC;CACL;;AAWD,MAAa,uBAAgC;CAC3C,IAAI;CACJ,YAAY,SAAS,OAAO,SAAS;CACrC,YAAY,MAAc,OAAO,sBAAsB;EACrD,MAAM,EACJ,SACA,GAAG,SACD;EAoBJ,MAAM,gBAAgB,kBAlBL,oBAAoB,KAAK,EAkBQ;GAChD,SAAS,CAjBsB;IAC/B,IAAI;IACJ,YAAY,iBACV,OAAO,iBAAiB,YACxB,OAAO,iBAAiB,Y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Q,CAAQ;;CAEtC;AAgBD,MAAa,kBAA2B;CACtC,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,SAAS;CAC1D,YAAY,MAAwB,UAAU;EAC5C,MAAM,EAAE,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,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
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:
|
|
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
|
|
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<
|
|
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
|
|
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
|
|
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) =>
|
|
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
|
|
1
|
+
import * as _angular_core0 from "@angular/core";
|
|
2
2
|
import { LocalesValues } from "@intlayer/types";
|
|
3
3
|
|
|
4
4
|
//#region src/client/useIntl.d.ts
|
|
@@ -26,7 +26,7 @@ import { LocalesValues } from "@intlayer/types";
|
|
|
26
26
|
* }
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
|
-
declare const useIntl: (locale?: LocalesValues) =>
|
|
29
|
+
declare const useIntl: (locale?: LocalesValues) => _angular_core0.Signal<{
|
|
30
30
|
Collator: {
|
|
31
31
|
new (locales?: LocalesValues, options?: Intl.CollatorOptions): Intl.Collator;
|
|
32
32
|
new (options?: Intl.CollatorOptions & {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _angular_core0 from "@angular/core";
|
|
2
2
|
import * as _intlayer_types0 from "@intlayer/types";
|
|
3
3
|
import { LocalesValues } from "@intlayer/types";
|
|
4
4
|
|
|
@@ -38,7 +38,7 @@ declare const useLocale: ({
|
|
|
38
38
|
isCookieEnabled,
|
|
39
39
|
onLocaleChange
|
|
40
40
|
}?: useLocaleProps) => {
|
|
41
|
-
locale:
|
|
41
|
+
locale: _angular_core0.Signal<"af" | "af-ZA" | "ar" | "ar-AE" | "ar-BH" | "ar-DZ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MA" | "ar-OM" | "ar-QA" | "ar-SA" | "ar-SY" | "ar-TN" | "ar-YE" | "az" | "az-AZ" | "be" | "be-BY" | "bg" | "bg-BG" | "bs" | "bs-BA" | "ca" | "ca-ES" | "cs" | "cs-CZ" | "cy" | "cy-GB" | "da" | "da-DK" | "de" | "de-AT" | "de-CH" | "de-DE" | "de-LI" | "de-LU" | "dv" | "dv-MV" | "el" | "el-GR" | "en" | "en-AU" | "en-BZ" | "en-CA" | "en-CB" | "en-GB" | "en-IE" | "en-JM" | "en-NZ" | "en-PH" | "en-TT" | "en-US" | "en-ZA" | "en-ZW" | "eo" | "es" | "es-AR" | "es-BO" | "es-CL" | "es-CO" | "es-CR" | "es-DO" | "es-EC" | "es-ES" | "es-GT" | "es-HN" | "es-MX" | "es-NI" | "es-PA" | "es-PE" | "es-PR" | "es-PY" | "es-SV" | "es-UY" | "es-VE" | "et" | "et-EE" | "eu" | "eu-ES" | "fa" | "fa-IR" | "fi" | "fi-FI" | "fo" | "fo-FO" | "fr" | "fr-BE" | "fr-CA" | "fr-CH" | "fr-FR" | "fr-LU" | "fr-MC" | "ga" | "ga-IE" | "gd" | "gd-GB" | "gl" | "gl-ES" | "gu" | "gu-IN" | "he" | "he-IL" | "hi" | "hi-IN" | "hr" | "hr-BA" | "hr-HR" | "hu" | "hu-HU" | "hy" | "hy-AM" | "id" | "id-ID" | "is" | "is-IS" | "it" | "it-CH" | "it-IT" | "ja" | "ja-JP" | "ka" | "ka-GE" | "kk" | "kk-KZ" | "kn" | "kn-IN" | "ko" | "ko-KR" | "kok" | "kok-IN" | "ku" | "ku-TR" | "ky" | "ky-KG" | "lt" | "lt-LT" | "lv" | "lv-LV" | "mi" | "mi-NZ" | "mk" | "mk-MK" | "mn" | "mn-MN" | "mr" | "mr-IN" | "ms" | "ms-BN" | "ms-MY" | "mt" | "mt-MT" | "ml" | "ml-IN" | "no" | "nb" | "nb-NO" | "nl" | "nl-BE" | "nl-NL" | "nn" | "nn-NO" | "ns" | "ns-ZA" | "pa" | "pa-IN" | "pl" | "pl-PL" | "ps" | "ps-AR" | "pt" | "pt-BR" | "pt-PT" | "qu" | "qu-BO" | "qu-EC" | "qu-PE" | "ro" | "ro-RO" | "ro-MD" | "rm" | "rm-CH" | "ru" | "ru-RU" | "ru-MD" | "sa" | "sa-IN" | "se" | "se-FI" | "se-NO" | "se-SE" | "hsb" | "hsb-DE" | "dsb" | "dsb-DE" | "sk" | "sk-SK" | "sl" | "sl-SI" | "sq" | "sq-AL" | "sr" | "sr-BA" | "sr-SP" | "sv" | "sv-FI" | "sv-SE" | "sw" | "sw-KE" | "syr" | "syr-SY" | "ta" | "ta-IN" | "te" | "te-IN" | "th" | "th-TH" | "tl" | "tl-PH" | "tn" | "tn-ZA" | "tr" | "tr-TR" | "tt" | "tt-RU" | "ts" | "uk" | "uk-UA" | "ur" | "ur-PK" | "uz" | "uz-UZ" | "vi" | "vi-VN" | "ve" | "ve-ZA" | "xh" | "xh-ZA" | "zh" | "zh-Hans" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-SG" | "zh-Hant" | "zu" | "zu-ZA" | "bn" | "bn-BD" | "bn-IN" | "bn-MM" | "my" | "my-MM" | "km" | "km-KH" | "lo" | "lo-LA" | "yo" | "yo-NG" | "yi" | "yi-001" | "am" | "am-ET" | "ne" | "ne-NP" | "si" | "si-LK" | "sr-Cyrl" | "sr-RS" | "en-IN" | "en-SG" | "en-HK" | "en-NG" | "en-PK" | "en-MY" | "en-BW" | "en-KE" | "en-TZ" | "en-GH" | "en-UG" | "es-CU" | "es-US" | "pt-GW" | "pt-MZ" | "pt-ST" | "pt-CV" | "pt-TL" | "pt-MO" | "zh-TW" | "ar-MR" | "ar-PS" | "ar-SD" | "ar-DJ" | "ar-SO" | "ar-TD" | "ar-KM" | (string & {})>;
|
|
42
42
|
defaultLocale: _intlayer_types0.Locale;
|
|
43
43
|
availableLocales: _intlayer_types0.Locale[];
|
|
44
44
|
setLocale: (newLocale: LocalesValues) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
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:
|
|
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:
|
|
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: () =>
|
|
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:
|
|
43
|
+
localeCookie: _intlayer_types0.Locale;
|
|
44
44
|
setLocaleCookie: (locale: LocalesValues) => void;
|
|
45
45
|
};
|
|
46
46
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
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:
|
|
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
|
|
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_core6 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]) => [
|
|
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 [
|
|
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.
|
|
3
|
+
"version": "8.0.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Angular applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -85,29 +85,29 @@
|
|
|
85
85
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
|
-
"@intlayer/chokidar": "8.0.
|
|
89
|
-
"@intlayer/config": "8.0.
|
|
90
|
-
"@intlayer/core": "8.0.
|
|
91
|
-
"@intlayer/dictionaries-entry": "8.0.
|
|
92
|
-
"@intlayer/editor": "8.0.
|
|
93
|
-
"@intlayer/types": "8.0.
|
|
94
|
-
"@intlayer/webpack": "8.0.
|
|
88
|
+
"@intlayer/chokidar": "8.0.4",
|
|
89
|
+
"@intlayer/config": "8.0.4",
|
|
90
|
+
"@intlayer/core": "8.0.4",
|
|
91
|
+
"@intlayer/dictionaries-entry": "8.0.4",
|
|
92
|
+
"@intlayer/editor": "8.0.4",
|
|
93
|
+
"@intlayer/types": "8.0.4",
|
|
94
|
+
"@intlayer/webpack": "8.0.4",
|
|
95
95
|
"defu": "6.1.4"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
|
-
"@types/node": "25.
|
|
98
|
+
"@types/node": "25.2.2",
|
|
99
99
|
"@types/webpack": "5.28.5",
|
|
100
100
|
"@utils/ts-config": "1.0.4",
|
|
101
101
|
"@utils/ts-config-types": "1.0.4",
|
|
102
102
|
"@utils/tsdown-config": "1.0.4",
|
|
103
103
|
"rimraf": "6.1.2",
|
|
104
|
-
"tsdown": "0.20.
|
|
104
|
+
"tsdown": "0.20.3",
|
|
105
105
|
"typescript": "5.9.3",
|
|
106
106
|
"vitest": "4.0.18"
|
|
107
107
|
},
|
|
108
108
|
"peerDependencies": {
|
|
109
|
-
"@angular/common": "15
|
|
110
|
-
"@angular/core": "15
|
|
109
|
+
"@angular/common": ">=15",
|
|
110
|
+
"@angular/core": ">=15",
|
|
111
111
|
"rxjs": "6.0.0 || ^7.0.0"
|
|
112
112
|
},
|
|
113
113
|
"engines": {
|