preact-intlayer 8.4.10 → 8.5.1
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/client/index.cjs +0 -2
- package/dist/cjs/format/index.cjs +20 -0
- package/dist/cjs/{client/format → format}/useCompact.cjs +3 -3
- package/dist/cjs/format/useCompact.cjs.map +1 -0
- package/dist/cjs/{client/format → format}/useCurrency.cjs +3 -3
- package/dist/cjs/format/useCurrency.cjs.map +1 -0
- package/dist/cjs/{client/format → format}/useDate.cjs +3 -3
- package/dist/cjs/format/useDate.cjs.map +1 -0
- package/dist/cjs/{client/format → format}/useIntl.cjs +3 -3
- package/dist/cjs/format/useIntl.cjs.map +1 -0
- package/dist/cjs/{client/format → format}/useList.cjs +3 -3
- package/dist/cjs/format/useList.cjs.map +1 -0
- package/dist/cjs/{client/format → format}/useNumber.cjs +3 -3
- package/dist/cjs/format/useNumber.cjs.map +1 -0
- package/dist/cjs/{client/format → format}/usePercentage.cjs +3 -3
- package/dist/cjs/format/usePercentage.cjs.map +1 -0
- package/dist/cjs/{client/format → format}/useRelativeTime.cjs +3 -3
- package/dist/cjs/format/useRelativeTime.cjs.map +1 -0
- package/dist/cjs/{client/format → format}/useUnit.cjs +3 -3
- package/dist/cjs/format/useUnit.cjs.map +1 -0
- package/dist/cjs/html/index.cjs +0 -1
- package/dist/cjs/index.cjs +1 -25
- package/dist/cjs/markdown/MarkdownProvider.cjs.map +1 -1
- package/dist/cjs/markdown/MarkdownRenderer.cjs +2 -6
- package/dist/cjs/markdown/MarkdownRenderer.cjs.map +1 -1
- package/dist/cjs/markdown/index.cjs +0 -12
- package/dist/cjs/plugins.cjs +16 -12
- package/dist/cjs/plugins.cjs.map +1 -1
- package/dist/esm/client/index.mjs +1 -2
- package/dist/esm/{client/format → format}/index.mjs +2 -1
- package/dist/esm/{client/format → format}/useCompact.mjs +2 -2
- package/dist/esm/format/useCompact.mjs.map +1 -0
- package/dist/esm/{client/format → format}/useCurrency.mjs +2 -2
- package/dist/esm/format/useCurrency.mjs.map +1 -0
- package/dist/esm/{client/format → format}/useDate.mjs +2 -2
- package/dist/esm/format/useDate.mjs.map +1 -0
- package/dist/esm/{client/format → format}/useIntl.mjs +2 -2
- package/dist/esm/format/useIntl.mjs.map +1 -0
- package/dist/esm/{client/format → format}/useList.mjs +2 -2
- package/dist/esm/format/useList.mjs.map +1 -0
- package/dist/esm/{client/format → format}/useNumber.mjs +2 -2
- package/dist/esm/format/useNumber.mjs.map +1 -0
- package/dist/esm/{client/format → format}/usePercentage.mjs +2 -2
- package/dist/esm/format/usePercentage.mjs.map +1 -0
- package/dist/esm/{client/format → format}/useRelativeTime.mjs +2 -2
- package/dist/esm/format/useRelativeTime.mjs.map +1 -0
- package/dist/esm/{client/format → format}/useUnit.mjs +2 -2
- package/dist/esm/format/useUnit.mjs.map +1 -0
- package/dist/esm/html/index.mjs +2 -2
- package/dist/esm/index.mjs +1 -9
- package/dist/esm/markdown/MarkdownProvider.mjs.map +1 -1
- package/dist/esm/markdown/MarkdownRenderer.mjs +2 -6
- package/dist/esm/markdown/MarkdownRenderer.mjs.map +1 -1
- package/dist/esm/markdown/index.mjs +2 -4
- package/dist/esm/plugins.mjs +16 -12
- package/dist/esm/plugins.mjs.map +1 -1
- package/dist/types/client/index.d.ts +1 -2
- package/dist/types/client/useContent.d.ts +2 -2
- package/dist/types/client/useContent.d.ts.map +1 -1
- package/dist/types/client/useDictionary.d.ts +2 -2
- package/dist/types/client/useDictionary.d.ts.map +1 -1
- package/dist/types/client/useDictionaryDynamic.d.ts +2 -2
- package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -1
- package/dist/types/client/useLocale.d.ts +3 -3
- package/dist/types/client/useLocaleBase.d.ts +5 -6
- package/dist/types/client/useLocaleBase.d.ts.map +1 -1
- package/dist/types/client/useLocaleStorage.d.ts +5 -5
- package/dist/types/client/useLocaleStorage.d.ts.map +1 -1
- package/dist/types/{client/format → format}/index.d.ts +2 -1
- package/dist/types/{client/format → format}/useCompact.d.ts +3 -3
- package/dist/types/format/useCompact.d.ts.map +1 -0
- package/dist/types/{client/format → format}/useCurrency.d.ts +3 -3
- package/dist/types/format/useCurrency.d.ts.map +1 -0
- package/dist/types/{client/format → format}/useDate.d.ts +1 -1
- package/dist/types/format/useDate.d.ts.map +1 -0
- package/dist/types/{client/format → format}/useIntl.d.ts +1 -1
- package/dist/types/format/useIntl.d.ts.map +1 -0
- package/dist/types/{client/format → format}/useList.d.ts +3 -3
- package/dist/types/format/useList.d.ts.map +1 -0
- package/dist/types/{client/format → format}/useNumber.d.ts +3 -3
- package/dist/types/format/useNumber.d.ts.map +1 -0
- package/dist/types/{client/format → format}/usePercentage.d.ts +3 -3
- package/dist/types/format/usePercentage.d.ts.map +1 -0
- package/dist/types/{client/format → format}/useRelativeTime.d.ts +3 -3
- package/dist/types/format/useRelativeTime.d.ts.map +1 -0
- package/dist/types/{client/format → format}/useUnit.d.ts +3 -3
- package/dist/types/format/useUnit.d.ts.map +1 -0
- package/dist/types/html/index.d.ts +3 -2
- package/dist/types/index.d.ts +2 -9
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/intlayer/dist/types/index.d.ts +4 -0
- package/dist/types/markdown/MarkdownProvider.d.ts +4 -4
- package/dist/types/markdown/MarkdownProvider.d.ts.map +1 -1
- package/dist/types/markdown/MarkdownRenderer.d.ts +5 -5
- package/dist/types/markdown/MarkdownRenderer.d.ts.map +1 -1
- package/dist/types/markdown/index.d.ts +3 -5
- package/dist/types/plugins.d.ts.map +1 -1
- package/package.json +19 -11
- package/dist/cjs/client/format/index.cjs +0 -18
- package/dist/cjs/client/format/useCompact.cjs.map +0 -1
- package/dist/cjs/client/format/useCurrency.cjs.map +0 -1
- package/dist/cjs/client/format/useDate.cjs.map +0 -1
- package/dist/cjs/client/format/useIntl.cjs.map +0 -1
- package/dist/cjs/client/format/useList.cjs.map +0 -1
- package/dist/cjs/client/format/useNumber.cjs.map +0 -1
- package/dist/cjs/client/format/usePercentage.cjs.map +0 -1
- package/dist/cjs/client/format/useRelativeTime.cjs.map +0 -1
- package/dist/cjs/client/format/useUnit.cjs.map +0 -1
- package/dist/esm/client/format/useCompact.mjs.map +0 -1
- package/dist/esm/client/format/useCurrency.mjs.map +0 -1
- package/dist/esm/client/format/useDate.mjs.map +0 -1
- package/dist/esm/client/format/useIntl.mjs.map +0 -1
- package/dist/esm/client/format/useList.mjs.map +0 -1
- package/dist/esm/client/format/useNumber.mjs.map +0 -1
- package/dist/esm/client/format/usePercentage.mjs.map +0 -1
- package/dist/esm/client/format/useRelativeTime.mjs.map +0 -1
- package/dist/esm/client/format/useUnit.mjs.map +0 -1
- package/dist/types/client/format/useCompact.d.ts.map +0 -1
- package/dist/types/client/format/useCurrency.d.ts.map +0 -1
- package/dist/types/client/format/useDate.d.ts.map +0 -1
- package/dist/types/client/format/useIntl.d.ts.map +0 -1
- package/dist/types/client/format/useList.d.ts.map +0 -1
- package/dist/types/client/format/useNumber.d.ts.map +0 -1
- package/dist/types/client/format/usePercentage.d.ts.map +0 -1
- package/dist/types/client/format/useRelativeTime.d.ts.map +0 -1
- package/dist/types/client/format/useUnit.d.ts.map +0 -1
package/dist/esm/plugins.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.mjs","names":[],"sources":["../../src/plugins.tsx"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport {\n conditionPlugin,\n type DeepTransformContent as DeepTransformContentCore,\n enumerationPlugin,\n filePlugin,\n genderPlugin,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n nestedPlugin,\n type Plugins,\n translationPlugin,\n} from '@intlayer/core/interpreter';\nimport type {\n HTMLContent,\n InsertionContent,\n MarkdownContent,\n} from '@intlayer/core/transpiler';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport type { NodeType } from '@intlayer/types/nodeType';\nimport * as NodeTypes from '@intlayer/types/nodeType';\nimport { Fragment, h, type VNode } from 'preact';\nimport { lazy, Suspense } from 'preact/compat';\nimport { ContentSelector } from './editor/ContentSelector';\nimport type { HTMLComponents } from './html/types';\nimport { type IntlayerNode, renderIntlayerNode } from './IntlayerNode';\nimport { renderPreactElement } from './preactElement/renderPreactElement';\n\n// Lazy pre-load @intlayer/core/markdown — creates a separate code-split chunk\nlet _getMarkdownMetadata: ((s: string) => any) | null = null;\nvoid import('@intlayer/core/markdown').then((m) => {\n _getMarkdownMetadata = m.getMarkdownMetadata;\n});\n\n// preact lazy for heavy renderer components — creates separate code-split chunks\nconst LazyMarkdownMetadataRenderer = lazy(() =>\n import('./markdown').then((m) => ({ default: m.MarkdownMetadataRenderer }))\n);\n\nconst LazyMarkdownRendererPlugin = lazy(() =>\n import('./markdown').then((m) => ({ default: m.MarkdownRendererPlugin }))\n);\n\nconst LazyHTMLRenderer = lazy(() =>\n import('./html/HTMLRenderer').then((m) => ({ default: m.HTMLRenderer }))\n);\n\n/** ---------------------------------------------\n * INTLAYER NODE PLUGIN\n * --------------------------------------------- */\n\nexport type IntlayerNodeCond<T> = T extends number | string\n ? IntlayerNode<T>\n : never;\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: (\n _node,\n {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n }\n ) =>\n renderIntlayerNode({\n ...rest,\n value: rest.children,\n children: configuration?.editor.enabled ? (\n <ContentSelector {...rest} key={rest.children}>\n {rest.children}\n </ContentSelector>\n ) : (\n rest.children\n ),\n }),\n};\n\n/** ---------------------------------------------\n * PREACT NODE PLUGIN\n * --------------------------------------------- */\n\nexport type PreactNodeCond<T> = T extends {\n props: any;\n key: any;\n}\n ? VNode\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const preactNodePlugins: Plugins = {\n id: 'preact-node-plugin',\n canHandle: (node) =>\n typeof node === 'object' &&\n typeof node.props !== 'undefined' &&\n typeof node.key !== 'undefined',\n\n transform: (\n node,\n {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n }\n ) =>\n renderIntlayerNode({\n ...rest,\n value: '[[preact-element]]',\n children: configuration?.editor.enabled ? (\n <ContentSelector {...rest}>{renderPreactElement(node)}</ContentSelector>\n ) : (\n renderPreactElement(node)\n ),\n }),\n};\n\n/** ---------------------------------------------\n * INSERTION PLUGIN\n * --------------------------------------------- */\n\nexport type InsertionCond<T, _S, L extends LocalesValues> = T extends {\n nodeType: NodeType | string;\n [NodeTypes.INSERTION]: infer I; // Accept strings OR nested nodes like enumerations\n fields: readonly (infer F)[]; // Infer the exact string literals in the array\n}\n ? <V extends { [K in Extract<F, string>]: string | number | VNode }>(\n values: V\n ) => I extends string\n ? V[keyof V] extends string | number\n ? IntlayerNode<string>\n : IntlayerNode<VNode>\n : DeepTransformContent<I, L> // Delegate nested nodes (like enumerations) back to the core\n : never;\n\n/**\n * Check if a value is a Preact VNode\n */\nconst isVNode = (value: any): value is VNode => {\n return (\n value !== null &&\n value !== undefined &&\n typeof value !== 'string' &&\n typeof value !== 'number' &&\n typeof value !== 'boolean'\n );\n};\n\n/**\n * Split insertion string and join with Preact VNodes\n */\nconst splitAndJoinInsertion = (\n template: string,\n values: Record<string, string | number | VNode>\n): VNode => {\n // Check if any value is a VNode\n const hasVNode = Object.values(values).some(isVNode);\n\n if (!hasVNode) {\n // Simple string replacement\n return template.replace(/\\{\\{\\s*(.*?)\\s*\\}\\}/g, (_, key) => {\n const trimmedKey = key.trim();\n return (values[trimmedKey] ?? '').toString();\n }) as any;\n }\n\n // Split the template by placeholders while keeping the structure\n const parts: (string | VNode)[] = [];\n let lastIndex = 0;\n const regex = /\\{\\{\\s*(.*?)\\s*\\}\\}/g;\n let match: RegExpExecArray | null = regex.exec(template);\n\n while (match !== null) {\n // Add text before the placeholder\n if (match.index > lastIndex) {\n parts.push(template.substring(lastIndex, match.index));\n }\n\n // Add the replaced value\n const key = match[1].trim();\n const value = values[key];\n if (value !== undefined && value !== null) {\n parts.push(typeof value === 'number' ? String(value) : value);\n }\n\n lastIndex = match.index + match[0].length;\n match = regex.exec(template);\n }\n\n // Add remaining text\n if (lastIndex < template.length) {\n parts.push(template.substring(lastIndex));\n }\n\n // Return as Fragment\n return h(\n Fragment,\n null,\n ...parts.map((part, index) => h(Fragment, { key: index }, part))\n );\n};\n\n/** Insertion plugin for Preact. Handles component/node insertion. */\nexport const insertionPlugin: Plugins = {\n id: 'insertion-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeTypes.INSERTION,\n transform: (node: InsertionContent, props, deepTransformNode) => {\n const newKeyPath: KeyPath[] = [\n ...props.keyPath,\n {\n type: NodeTypes.INSERTION,\n },\n ];\n\n const children = node[NodeTypes.INSERTION];\n\n /** Insertion string plugin. Replaces string node with a component that render the insertion. */\n const insertionStringPlugin: Plugins = {\n id: 'insertion-string-plugin',\n canHandle: (node) => typeof node === 'string',\n transform: (node: string, subProps, deepTransformNode) => {\n const transformedResult = deepTransformNode(node, {\n ...subProps,\n children: node,\n plugins: [\n ...(props.plugins ?? ([] as Plugins[])).filter(\n (plugin) => plugin.id !== 'intlayer-node-plugin'\n ),\n ],\n });\n\n return (\n values: {\n [K in InsertionContent['fields'][number]]: string | number | VNode;\n }\n ) => {\n const result = splitAndJoinInsertion(transformedResult, values);\n\n return deepTransformNode(result, {\n ...subProps,\n plugins: props.plugins,\n children: result as any,\n });\n };\n },\n };\n\n return deepTransformNode(children, {\n ...props,\n children,\n keyPath: newKeyPath,\n plugins: [insertionStringPlugin, ...(props.plugins ?? [])],\n });\n },\n};\n\n/**\n * MARKDOWN PLUGIN\n */\n\nexport type MarkdownStringCond<T> = T extends string\n ? IntlayerNode<\n string,\n {\n metadata: DeepTransformContent<string>;\n use: (components?: HTMLComponents<'permissive', {}>) => VNode;\n }\n >\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: configuration?.editor.enabled ? (\n <ContentSelector {...rest}>\n <Suspense fallback={node}>\n <LazyMarkdownMetadataRenderer\n {...rest}\n metadataKeyPath={props.keyPath}\n >\n {node}\n </LazyMarkdownMetadataRenderer>\n </Suspense>\n </ContentSelector>\n ) : (\n <Suspense fallback={node}>\n <LazyMarkdownMetadataRenderer\n {...rest}\n metadataKeyPath={props.keyPath}\n >\n {node}\n </LazyMarkdownMetadataRenderer>\n </Suspense>\n ),\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: configuration?.editor.enabled ? (\n <ContentSelector {...rest}>\n <Suspense fallback={node}>\n <LazyMarkdownRendererPlugin {...rest} components={components}>\n {node}\n </LazyMarkdownRendererPlugin>\n </Suspense>\n </ContentSelector>\n ) : (\n <Suspense fallback={node}>\n <LazyMarkdownRendererPlugin {...rest} components={components}>\n {node}\n </LazyMarkdownRendererPlugin>\n </Suspense>\n ),\n additionalProps: {\n metadata: metadataNodes,\n },\n });\n\n const element = render() as any;\n\n return new Proxy(element, {\n get(target, prop) {\n if (prop === 'value') {\n return node;\n }\n if (prop === 'metadata') {\n return metadataNodes;\n }\n\n if (prop === 'use') {\n return (components?: any) => render(components);\n }\n\n return Reflect.get(target, prop);\n },\n }) as any;\n },\n};\n\nexport type MarkdownCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeTypes.MARKDOWN]: infer _M;\n metadata?: infer U;\n tags?: infer U;\n}\n ? {\n use: (components?: HTMLComponents<'permissive', U>) => VNode;\n metadata: DeepTransformContent<U>;\n }\n : never;\n\nexport const markdownPlugin: Plugins = {\n id: 'markdown-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeTypes.MARKDOWN,\n transform: (node: MarkdownContent, props, deepTransformNode) => {\n const newKeyPath: KeyPath[] = [\n ...props.keyPath,\n {\n type: NodeTypes.MARKDOWN,\n },\n ];\n\n const children = node[NodeTypes.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\nexport type HTMLPluginCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeTypes.HTML]: infer I;\n tags?: infer U;\n}\n ? {\n use: (components?: HTMLComponents<'permissive', U>) => IntlayerNode<I>;\n }\n : never;\n\n/** HTML plugin. Replaces node with a function that takes components => VNode. */\nexport const htmlPlugin: Plugins = {\n id: 'html-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeTypes.HTML,\n transform: (node: HTMLContent<string>, props) => {\n const html = node[NodeTypes.HTML];\n const _tags = node.tags ?? [];\n const { plugins, ...rest } = props;\n\n // Type-safe render function that accepts properly typed components\n const render = (userComponents?: HTMLComponents): VNode =>\n h(\n Suspense as any,\n { fallback: html },\n h(LazyHTMLRenderer as any, { ...rest, html, userComponents } as any)\n );\n\n const element = render() as any;\n\n const proxy = new Proxy(element, {\n get(target, prop) {\n if (prop === 'value') {\n return html;\n }\n\n if (prop === 'use') {\n return (userComponents?: HTMLComponents) => render(userComponents);\n }\n\n return Reflect.get(target, prop);\n },\n });\n\n return proxy;\n },\n};\n\n/** ---------------------------------------------\n * PLUGINS RESULT\n * --------------------------------------------- */\n\nexport interface IInterpreterPluginPreact<T, S, L extends LocalesValues> {\n preactNode: PreactNodeCond<T>;\n preactIntlayerNode: IntlayerNodeCond<T>;\n preactInsertion: InsertionCond<T, S, L>;\n preactMarkdown: MarkdownCond<T>;\n preactHtml: HTMLPluginCond<T>;\n}\n\n/**\n * Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution.\n *\n * Otherwise the the `preact-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 preactNode: true;\n preactIntlayerNode: true;\n preactInsertion: true;\n preactMarkdown: true;\n preactHtml: true;\n};\n\nexport type DeepTransformContent<\n T,\n L extends LocalesValues = DeclaredLocales,\n> = DeepTransformContentCore<T, IInterpreterPluginState, L>;\n\n/**\n * Get the plugins array for Preact content transformation.\n * This function is used by both getIntlayer and getDictionary to ensure consistent plugin configuration.\n */\nexport const getPlugins = (\n locale?: LocalesValues,\n fallback: boolean = true\n): Plugins[] => [\n translationPlugin(\n locale ?? configuration.internationalization.defaultLocale,\n fallback ? configuration.internationalization.defaultLocale : undefined\n ),\n enumerationPlugin,\n conditionPlugin,\n nestedPlugin(locale ?? configuration.internationalization.defaultLocale),\n filePlugin,\n genderPlugin,\n intlayerNodePlugins,\n preactNodePlugins,\n insertionPlugin,\n markdownPlugin,\n htmlPlugin,\n];\n"],"mappings":";;;;;;;;;;;AAgCA,IAAI,uBAAoD;AACnD,OAAO,2BAA2B,MAAM,MAAM;AACjD,wBAAuB,EAAE;EACzB;AAGF,MAAM,+BAA+B,WACnC,OAAO,wBAAc,MAAM,OAAO,EAAE,SAAS,EAAE,0BAA0B,EAAE,CAC5E;AAED,MAAM,6B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,KAAK;KAEnC,CAAC;;CAEL;AAcD,MAAa,iBAA0B;CACrC,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,UAAU;CAC3D,YAAY,MAAuB,OAAO,sBAAsB;EAC9D,MAAM,aAAwB,CAC5B,GAAG,MAAM,SACT,EACE,MAAM,UAAU,UACjB,CACF;EAED,MAAM,WAAW,KAAK,UAAU;AAEhC,SAAO,kBAAkB,UAAU;GACjC,GAAG;GACH;GACA,SAAS;GACT,SAAS,CAAC,sBAAsB,GAAI,MAAM,WAAW,EAAE,CAAE;GAC1D,CAAC;;CAEL;;AAiBD,MAAa,aAAsB;CACjC,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,UAAU;CAC3D,YAAY,MAA2B,UAAU;EAC/C,MAAM,OAAO,KAAK,UAAU;AACd,OAAK;EACnB,MAAM,EAAE,SAAS,GAAG,SAAS;EAG7B,MAAM,UAAU,mBACd,EACE,UACA,EAAE,UAAU,MAAM,EAClB,EAAE,kBAAyB;GAAE,GAAG;GAAM;GAAM;GAAgB,CAAQ,CACrE;EAEH,MAAM,UAAU,QAAQ;AAgBxB,SAdc,IAAI,MAAM,SAAS,EAC/B,IAAI,QAAQ,MAAM;AAChB,OAAI,SAAS,QACX,QAAO;AAGT,OAAI,SAAS,MACX,SAAQ,mBAAoC,OAAO,eAAe;AAGpE,UAAO,QAAQ,IAAI,QAAQ,KAAK;KAEnC,CAAC;;CAIL;;;;;AAuCD,MAAa,cACX,QACA,WAAoB,SACN;CACd,kBACE,UAAU,cAAc,qBAAqB,eAC7C,WAAW,cAAc,qBAAqB,gBAAgB,OAC/D;CACD;CACA;CACA,aAAa,UAAU,cAAc,qBAAqB,cAAc;CACxE;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
|
|
1
|
+
{"version":3,"file":"plugins.mjs","names":[],"sources":["../../src/plugins.tsx"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport {\n conditionPlugin,\n type DeepTransformContent as DeepTransformContentCore,\n enumerationPlugin,\n filePlugin,\n genderPlugin,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n nestedPlugin,\n type Plugins,\n translationPlugin,\n} from '@intlayer/core/interpreter';\nimport { getMarkdownMetadata } from '@intlayer/core/markdown';\nimport type {\n HTMLContent,\n InsertionContent,\n MarkdownContent,\n} from '@intlayer/core/transpiler';\nimport { isEnabled } from '@intlayer/editor/isEnabled';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport type { NodeType } from '@intlayer/types/nodeType';\nimport * as NodeTypes from '@intlayer/types/nodeType';\nimport { Fragment, h, type VNode } from 'preact';\nimport { lazy, Suspense } from 'preact/compat';\nimport { ContentSelector } from './editor/ContentSelector';\nimport type { HTMLComponents } from './html/types';\nimport { type IntlayerNode, renderIntlayerNode } from './IntlayerNode';\nimport { renderPreactElement } from './preactElement/renderPreactElement';\n\n// preact lazy for heavy renderer components — creates separate code-split chunks\nconst LazyMarkdownMetadataRenderer = lazy(() =>\n import('./markdown/MarkdownRendererPlugin').then((m) => ({\n default: m.MarkdownMetadataRenderer,\n }))\n);\n\nconst LazyMarkdownRendererPlugin = lazy(() =>\n import('./markdown/MarkdownRendererPlugin').then((m) => ({\n default: m.MarkdownRendererPlugin,\n }))\n);\n\nconst LazyHTMLRenderer = lazy(() =>\n import('./html/HTMLRenderer').then((m) => ({ default: m.HTMLRenderer }))\n);\n\n/** ---------------------------------------------\n * INTLAYER NODE PLUGIN\n * --------------------------------------------- */\n\nexport type IntlayerNodeCond<T> = T extends number | string\n ? IntlayerNode<T>\n : never;\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: (\n _node,\n {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n }\n ) =>\n renderIntlayerNode({\n ...rest,\n value: rest.children,\n children: isEnabled ? (\n <ContentSelector {...rest} key={rest.children}>\n {rest.children}\n </ContentSelector>\n ) : (\n rest.children\n ),\n }),\n};\n\n/** ---------------------------------------------\n * PREACT NODE PLUGIN\n * --------------------------------------------- */\n\nexport type PreactNodeCond<T> = T extends {\n props: any;\n key: any;\n}\n ? VNode\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const preactNodePlugins: Plugins = {\n id: 'preact-node-plugin',\n canHandle: (node) =>\n typeof node === 'object' &&\n typeof node.props !== 'undefined' &&\n typeof node.key !== 'undefined',\n\n transform: (\n node,\n {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n }\n ) =>\n renderIntlayerNode({\n ...rest,\n value: '[[preact-element]]',\n children: isEnabled ? (\n <ContentSelector {...rest}>{renderPreactElement(node)}</ContentSelector>\n ) : (\n renderPreactElement(node)\n ),\n }),\n};\n\n/** ---------------------------------------------\n * INSERTION PLUGIN\n * --------------------------------------------- */\n\nexport type InsertionCond<T, _S, L extends LocalesValues> = T extends {\n nodeType: NodeType | string;\n [NodeTypes.INSERTION]: infer I; // Accept strings OR nested nodes like enumerations\n fields: readonly (infer F)[]; // Infer the exact string literals in the array\n}\n ? <V extends { [K in Extract<F, string>]: string | number | VNode }>(\n values: V\n ) => I extends string\n ? V[keyof V] extends string | number\n ? IntlayerNode<string>\n : IntlayerNode<VNode>\n : DeepTransformContent<I, L> // Delegate nested nodes (like enumerations) back to the core\n : never;\n\n/**\n * Check if a value is a Preact VNode\n */\nconst isVNode = (value: any): value is VNode => {\n return (\n value !== null &&\n value !== undefined &&\n typeof value !== 'string' &&\n typeof value !== 'number' &&\n typeof value !== 'boolean'\n );\n};\n\n/**\n * Split insertion string and join with Preact VNodes\n */\nconst splitAndJoinInsertion = (\n template: string,\n values: Record<string, string | number | VNode>\n): VNode => {\n // Check if any value is a VNode\n const hasVNode = Object.values(values).some(isVNode);\n\n if (!hasVNode) {\n // Simple string replacement\n return template.replace(/\\{\\{\\s*(.*?)\\s*\\}\\}/g, (_, key) => {\n const trimmedKey = key.trim();\n return (values[trimmedKey] ?? '').toString();\n }) as any;\n }\n\n // Split the template by placeholders while keeping the structure\n const parts: (string | VNode)[] = [];\n let lastIndex = 0;\n const regex = /\\{\\{\\s*(.*?)\\s*\\}\\}/g;\n let match: RegExpExecArray | null = regex.exec(template);\n\n while (match !== null) {\n // Add text before the placeholder\n if (match.index > lastIndex) {\n parts.push(template.substring(lastIndex, match.index));\n }\n\n // Add the replaced value\n const key = match[1].trim();\n const value = values[key];\n if (value !== undefined && value !== null) {\n parts.push(typeof value === 'number' ? String(value) : value);\n }\n\n lastIndex = match.index + match[0].length;\n match = regex.exec(template);\n }\n\n // Add remaining text\n if (lastIndex < template.length) {\n parts.push(template.substring(lastIndex));\n }\n\n // Return as Fragment\n return h(\n Fragment,\n null,\n ...parts.map((part, index) => h(Fragment, { key: index }, part))\n );\n};\n\n/** Insertion plugin for Preact. Handles component/node insertion. */\nexport const insertionPlugin: Plugins = {\n id: 'insertion-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeTypes.INSERTION,\n transform: (node: InsertionContent, props, deepTransformNode) => {\n const newKeyPath: KeyPath[] = [\n ...props.keyPath,\n {\n type: NodeTypes.INSERTION,\n },\n ];\n\n const children = node[NodeTypes.INSERTION];\n\n /** Insertion string plugin. Replaces string node with a component that render the insertion. */\n const insertionStringPlugin: Plugins = {\n id: 'insertion-string-plugin',\n canHandle: (node) => typeof node === 'string',\n transform: (node: string, subProps, deepTransformNode) => {\n const transformedResult = deepTransformNode(node, {\n ...subProps,\n children: node,\n plugins: [\n ...(props.plugins ?? ([] as Plugins[])).filter(\n (plugin) => plugin.id !== 'intlayer-node-plugin'\n ),\n ],\n });\n\n return (\n values: {\n [K in InsertionContent['fields'][number]]: string | number | VNode;\n }\n ) => {\n const result = splitAndJoinInsertion(transformedResult, values);\n\n return deepTransformNode(result, {\n ...subProps,\n plugins: props.plugins,\n children: result as any,\n });\n };\n },\n };\n\n const result = deepTransformNode(children, {\n ...props,\n children,\n keyPath: newKeyPath,\n plugins: [insertionStringPlugin, ...(props.plugins ?? [])],\n });\n\n if (\n typeof children === 'object' &&\n children !== null &&\n 'nodeType' in children &&\n [NodeTypes.ENUMERATION, NodeTypes.CONDITION].includes(\n children.nodeType as\n | typeof NodeTypes.ENUMERATION\n | typeof NodeTypes.CONDITION\n )\n ) {\n return (values: any) => (arg: any) => {\n const func = result as Function;\n const inner = func(arg);\n\n if (typeof inner === 'function') {\n return inner(values);\n }\n return inner;\n };\n }\n\n return result;\n },\n};\n\n/**\n * MARKDOWN PLUGIN\n */\n\nexport type MarkdownStringCond<T> = T extends string\n ? IntlayerNode<\n string,\n {\n metadata: DeepTransformContent<string>;\n use: (components?: HTMLComponents<'permissive', {}>) => VNode;\n }\n >\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: isEnabled ? (\n <ContentSelector {...rest}>\n <Suspense fallback={node}>\n <LazyMarkdownMetadataRenderer\n {...rest}\n metadataKeyPath={props.keyPath}\n >\n {node}\n </LazyMarkdownMetadataRenderer>\n </Suspense>\n </ContentSelector>\n ) : (\n <Suspense fallback={node}>\n <LazyMarkdownMetadataRenderer\n {...rest}\n metadataKeyPath={props.keyPath}\n >\n {node}\n </LazyMarkdownMetadataRenderer>\n </Suspense>\n ),\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: isEnabled ? (\n <ContentSelector {...rest}>\n <Suspense fallback={node}>\n <LazyMarkdownRendererPlugin {...rest} components={components}>\n {node}\n </LazyMarkdownRendererPlugin>\n </Suspense>\n </ContentSelector>\n ) : (\n <Suspense fallback={node}>\n <LazyMarkdownRendererPlugin {...rest} components={components}>\n {node}\n </LazyMarkdownRendererPlugin>\n </Suspense>\n ),\n additionalProps: {\n metadata: metadataNodes,\n },\n });\n\n const element = render() as any;\n\n return new Proxy(element, {\n get(target, prop) {\n if (prop === 'value') {\n return node;\n }\n if (prop === 'metadata') {\n return metadataNodes;\n }\n\n if (prop === 'use') {\n return (components?: any) => render(components);\n }\n\n return Reflect.get(target, prop);\n },\n }) as any;\n },\n};\n\nexport type MarkdownCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeTypes.MARKDOWN]: infer _M;\n metadata?: infer U;\n tags?: infer U;\n}\n ? {\n use: (components?: HTMLComponents<'permissive', U>) => VNode;\n metadata: DeepTransformContent<U>;\n }\n : never;\n\nexport const markdownPlugin: Plugins = {\n id: 'markdown-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeTypes.MARKDOWN,\n transform: (node: MarkdownContent, props, deepTransformNode) => {\n const newKeyPath: KeyPath[] = [\n ...props.keyPath,\n {\n type: NodeTypes.MARKDOWN,\n },\n ];\n\n const children = node[NodeTypes.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\nexport type HTMLPluginCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeTypes.HTML]: infer I;\n tags?: infer U;\n}\n ? {\n use: (components?: HTMLComponents<'permissive', U>) => IntlayerNode<I>;\n }\n : never;\n\n/** HTML plugin. Replaces node with a function that takes components => VNode. */\nexport const htmlPlugin: Plugins = {\n id: 'html-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeTypes.HTML,\n transform: (node: HTMLContent<string>, props) => {\n const html = node[NodeTypes.HTML];\n const _tags = node.tags ?? [];\n const { plugins, ...rest } = props;\n\n // Type-safe render function that accepts properly typed components\n const render = (userComponents?: HTMLComponents): VNode =>\n h(\n Suspense as any,\n { fallback: html },\n h(LazyHTMLRenderer as any, { ...rest, html, userComponents })\n ) as any;\n\n const element = render() as any;\n\n const proxy = new Proxy(element, {\n get(target, prop) {\n if (prop === 'value') {\n return html;\n }\n\n if (prop === 'use') {\n return (userComponents?: HTMLComponents) => render(userComponents);\n }\n\n return Reflect.get(target, prop);\n },\n });\n\n return proxy;\n },\n};\n\n/** ---------------------------------------------\n * PLUGINS RESULT\n * --------------------------------------------- */\n\nexport interface IInterpreterPluginPreact<T, S, L extends LocalesValues> {\n preactNode: PreactNodeCond<T>;\n preactIntlayerNode: IntlayerNodeCond<T>;\n preactInsertion: InsertionCond<T, S, L>;\n preactMarkdown: MarkdownCond<T>;\n preactHtml: HTMLPluginCond<T>;\n}\n\n/**\n * Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution.\n *\n * Otherwise the the `preact-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 preactNode: true;\n preactIntlayerNode: true;\n preactInsertion: true;\n preactMarkdown: true;\n preactHtml: true;\n};\n\nexport type DeepTransformContent<\n T,\n L extends LocalesValues = DeclaredLocales,\n> = DeepTransformContentCore<T, IInterpreterPluginState, L>;\n\n/**\n * Get the plugins array for Preact content transformation.\n * This function is used by both getIntlayer and getDictionary to ensure consistent plugin configuration.\n */\nexport const getPlugins = (\n locale?: LocalesValues,\n fallback: boolean = true\n): Plugins[] => [\n translationPlugin(\n locale ?? configuration.internationalization.defaultLocale,\n fallback ? configuration.internationalization.defaultLocale : undefined\n ),\n enumerationPlugin,\n conditionPlugin,\n nestedPlugin(locale ?? configuration.internationalization.defaultLocale),\n filePlugin,\n genderPlugin,\n intlayerNodePlugins,\n preactNodePlugins,\n insertionPlugin,\n markdownPlugin,\n htmlPlugin,\n];\n"],"mappings":";;;;;;;;;;;;;AAkCA,MAAM,+BAA+B,WACnC,OAAO,yCAAqC,MAAM,OAAO,EACvD,SAAS,EAAE,0BACZ,EAAE,CACJ;AAED,MAAM,6BAA6B,WACjC,OAAO,yCAAqC,MAAM,OAAO,EACvD,SAAS,EAAE,wBACZ,EAAE,CACJ;AAED,MAAM,mBAAmB,WACvB,OAAO,2BAAuB,MAAM,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CACzE;;AAWD,MAAa,sBAA+B;CAC1C,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;CAClB,YACE,OACA,EACE,SACA,GAAG,WAGL,mBAAmB;EACjB,GAAG;EACH,OAAO,KAAK;EACZ,UAAU,YACR,8BAAC,iBAAD;GAAiB,GAAI;GAAM,KAAK,KAAK;GAEnB,EADf,KAAK,SACU,GAElB,KAAK;EAER,CAAC;CACL;;AAcD,MAAa,oBAA6B;CACxC,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,KAAK,UAAU,eACtB,OAAO,KAAK,QAAQ;CAEtB,YACE,MACA,EACE,SACA,GAAG,WAGL,mBAAmB;EACjB,GAAG;EACH,OAAO;EACP,UAAU,YACR,oBAAC,iBAAD;GAAiB,GAAI;aAAO,oBAAoB,KAAK;GAAmB,IAExE,oBAAoB,KAAK;EAE5B,CAAC;CACL;;;;AAuBD,MAAM,WAAW,UAA+B;AAC9C,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,EACE,UACA,EAAE,UAAU,MAAM,EAClB,EAAE,kBAAyB;GAAE,GAAG;GAAM;GAAM;GAAgB,CAAC,CAC9D;EAEH,MAAM,UAAU,QAAQ;AAgBxB,SAdc,IAAI,MAAM,SAAS,EAC/B,IAAI,QAAQ,MAAM;AAChB,OAAI,SAAS,QACX,QAAO;AAGT,OAAI,SAAS,MACX,SAAQ,mBAAoC,OAAO,eAAe;AAGpE,UAAO,QAAQ,IAAI,QAAQ,KAAK;KAEnC,CAAC;;CAIL;;;;;AAuCD,MAAa,cACX,QACA,WAAoB,SACN;CACd,kBACE,UAAU,cAAc,qBAAqB,eAC7C,WAAW,cAAc,qBAAqB,gBAAgB,OAC/D;CACD;CACA;CACA,aAAa,UAAU,cAAc,qBAAqB,cAAc;CACxE;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { IntlayerClientContext, IntlayerProvider, IntlayerProviderContent, IntlayerProviderProps, useIntlayerContext } from "./IntlayerProvider.js";
|
|
2
|
-
import { useIntl } from "./format/useIntl.js";
|
|
3
2
|
import { t } from "./t.js";
|
|
4
3
|
import { useDictionary } from "./useDictionary.js";
|
|
5
4
|
import { useDictionaryAsync } from "./useDictionaryAsync.js";
|
|
@@ -9,4 +8,4 @@ import { useLoadDynamic } from "./useLoadDynamic.js";
|
|
|
9
8
|
import { useLocale } from "./useLocale.js";
|
|
10
9
|
import { useLocaleBase } from "./useLocaleBase.js";
|
|
11
10
|
import { localeCookie, localeInStorage, setLocaleCookie, setLocaleInStorage, useLocaleCookie, useLocaleStorage } from "./useLocaleStorage.js";
|
|
12
|
-
export { IntlayerClientContext, IntlayerProvider, IntlayerProviderContent, type IntlayerProviderProps, localeCookie, localeInStorage, setLocaleCookie, setLocaleInStorage, t, useDictionary, useDictionaryAsync, useDictionaryDynamic,
|
|
11
|
+
export { IntlayerClientContext, IntlayerProvider, IntlayerProviderContent, type IntlayerProviderProps, localeCookie, localeInStorage, setLocaleCookie, setLocaleInStorage, t, useDictionary, useDictionaryAsync, useDictionaryDynamic, useIntlayer, useIntlayerContext, useLoadDynamic, useLocale, useLocaleBase, useLocaleCookie, useLocaleStorage };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LocalesValues as LocalesValues$1 } from "../intlayer/dist/types/index.js";
|
|
2
2
|
import { StrictModeLocaleMap } from "@intlayer/types/module_augmentation";
|
|
3
3
|
|
|
4
4
|
//#region src/client/useContent.d.ts
|
|
@@ -6,7 +6,7 @@ import { StrictModeLocaleMap } from "@intlayer/types/module_augmentation";
|
|
|
6
6
|
* On the client side, hook to get the translation content based on the locale
|
|
7
7
|
*/
|
|
8
8
|
declare const useContent: <Content>(languageContent: StrictModeLocaleMap<Content>) => {
|
|
9
|
-
locale:
|
|
9
|
+
locale: LocalesValues$1;
|
|
10
10
|
content: Content;
|
|
11
11
|
t: <Content_1 = string>(languageContent: StrictModeLocaleMap<Content_1>) => Content_1;
|
|
12
12
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useContent.d.ts","names":[],"sources":["../../../src/client/useContent.ts"],"mappings":";;;;;;;cAOa,UAAA,YACX,eAAA,EAAiB,mBAAA,CAAoB,OAAA;UAAD,
|
|
1
|
+
{"version":3,"file":"useContent.d.ts","names":[],"sources":["../../../src/client/useContent.ts"],"mappings":";;;;;;;cAOa,UAAA,YACX,eAAA,EAAiB,mBAAA,CAAoB,OAAA;UAAD,eAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IInterpreterPluginState as IInterpreterPluginState$1 } from "../plugins.js";
|
|
2
|
+
import { Locale } from "../intlayer/dist/types/index.js";
|
|
2
3
|
import * as _intlayer_core_interpreter0 from "@intlayer/core/interpreter";
|
|
3
4
|
import { DeclaredLocales, LocalesValues } from "@intlayer/types/module_augmentation";
|
|
4
|
-
import * as _intlayer_types_allLocales0 from "@intlayer/types/allLocales";
|
|
5
5
|
import { Dictionary } from "@intlayer/types/dictionary";
|
|
6
6
|
|
|
7
7
|
//#region src/client/useDictionary.d.ts
|
|
@@ -10,7 +10,7 @@ import { Dictionary } from "@intlayer/types/dictionary";
|
|
|
10
10
|
*
|
|
11
11
|
* If the locale is not provided, it will use the locale from the client context
|
|
12
12
|
*/
|
|
13
|
-
declare const useDictionary: <T extends Dictionary, L extends LocalesValues = DeclaredLocales>(dictionary: T, locale?: L) => _intlayer_core_interpreter0.DeepTransformContent<T["content"], IInterpreterPluginState$1,
|
|
13
|
+
declare const useDictionary: <T extends Dictionary, L extends LocalesValues = DeclaredLocales>(dictionary: T, locale?: L) => _intlayer_core_interpreter0.DeepTransformContent<T["content"], IInterpreterPluginState$1, Locale>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { useDictionary };
|
|
16
16
|
//# sourceMappingURL=useDictionary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionary.d.ts","names":[],"sources":["../../../src/client/useDictionary.ts"],"mappings":";;;;;;;;;;;;cAca,aAAA,aACD,UAAA,YACA,aAAA,GAAgB,eAAA,EAE1B,UAAA,EAAY,CAAA,EACZ,MAAA,GAAS,CAAA,KAAC,2BAAA,CAAA,oBAAA,CAAA,CAAA,aAAA,yBAAA,EAAA,
|
|
1
|
+
{"version":3,"file":"useDictionary.d.ts","names":[],"sources":["../../../src/client/useDictionary.ts"],"mappings":";;;;;;;;;;;;cAca,aAAA,aACD,UAAA,YACA,aAAA,GAAgB,eAAA,EAE1B,UAAA,EAAY,CAAA,EACZ,MAAA,GAAS,CAAA,KAAC,2BAAA,CAAA,oBAAA,CAAA,CAAA,aAAA,yBAAA,EAAA,MAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IInterpreterPluginState as IInterpreterPluginState$1 } from "../plugins.js";
|
|
2
|
+
import { Locale } from "../intlayer/dist/types/index.js";
|
|
2
3
|
import * as _intlayer_core_interpreter0 from "@intlayer/core/interpreter";
|
|
3
4
|
import { DictionaryKeys, LocalesValues, StrictModeLocaleMap } from "@intlayer/types/module_augmentation";
|
|
4
|
-
import * as _intlayer_types_allLocales0 from "@intlayer/types/allLocales";
|
|
5
5
|
import { Dictionary } from "@intlayer/types/dictionary";
|
|
6
6
|
|
|
7
7
|
//#region src/client/useDictionaryDynamic.d.ts
|
|
@@ -10,7 +10,7 @@ import { Dictionary } from "@intlayer/types/dictionary";
|
|
|
10
10
|
*
|
|
11
11
|
* If the locale is not provided, it will use the locale from the client context
|
|
12
12
|
*/
|
|
13
|
-
declare const useDictionaryDynamic: <T extends Dictionary, K extends DictionaryKeys>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, key: K, locale?: LocalesValues) => _intlayer_core_interpreter0.DeepTransformContent<T["content"], IInterpreterPluginState$1,
|
|
13
|
+
declare const useDictionaryDynamic: <T extends Dictionary, K extends DictionaryKeys>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, key: K, locale?: LocalesValues) => _intlayer_core_interpreter0.DeepTransformContent<T["content"], IInterpreterPluginState$1, Locale>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { useDictionaryDynamic };
|
|
16
16
|
//# sourceMappingURL=useDictionaryDynamic.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionaryDynamic.d.ts","names":[],"sources":["../../../src/client/useDictionaryDynamic.ts"],"mappings":";;;;;;;;;;;;cAgBa,oBAAA,aACD,UAAA,YACA,cAAA,EAEV,iBAAA,EAAmB,mBAAA,OAA0B,OAAA,CAAQ,CAAA,IACrD,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,aAAA,KAAa,2BAAA,CAAA,oBAAA,CAAA,CAAA,aAAA,yBAAA,EAAA,
|
|
1
|
+
{"version":3,"file":"useDictionaryDynamic.d.ts","names":[],"sources":["../../../src/client/useDictionaryDynamic.ts"],"mappings":";;;;;;;;;;;;cAgBa,oBAAA,aACD,UAAA,YACA,cAAA,EAEV,iBAAA,EAAmB,mBAAA,OAA0B,OAAA,CAAQ,CAAA,IACrD,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,aAAA,KAAa,2BAAA,CAAA,oBAAA,CAAA,CAAA,aAAA,yBAAA,EAAA,MAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { Locale } from "../intlayer/dist/types/index.js";
|
|
1
2
|
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
2
|
-
import * as _intlayer_types_allLocales0 from "@intlayer/types/allLocales";
|
|
3
3
|
|
|
4
4
|
//#region src/client/useLocale.d.ts
|
|
5
5
|
type useLocaleProps = {
|
|
@@ -34,8 +34,8 @@ declare const useLocale: ({
|
|
|
34
34
|
onLocaleChange
|
|
35
35
|
}?: useLocaleProps) => {
|
|
36
36
|
locale: LocalesValues;
|
|
37
|
-
defaultLocale:
|
|
38
|
-
availableLocales:
|
|
37
|
+
defaultLocale: Locale;
|
|
38
|
+
availableLocales: Locale[];
|
|
39
39
|
setLocale: (locale: LocalesValues) => void;
|
|
40
40
|
};
|
|
41
41
|
//#endregion
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as _intlayer_types_allLocales0 from "@intlayer/types/allLocales";
|
|
1
|
+
import { Locale, LocalesValues } from "../intlayer/dist/types/index.js";
|
|
3
2
|
|
|
4
3
|
//#region src/client/useLocaleBase.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* On the client side, hook to get the current locale and all related fields
|
|
7
6
|
*/
|
|
8
7
|
declare const useLocaleBase: () => {
|
|
9
|
-
locale:
|
|
10
|
-
defaultLocale:
|
|
11
|
-
availableLocales:
|
|
12
|
-
setLocale: (newLocale:
|
|
8
|
+
locale: LocalesValues;
|
|
9
|
+
defaultLocale: Locale;
|
|
10
|
+
availableLocales: Locale[];
|
|
11
|
+
setLocale: (newLocale: LocalesValues) => void;
|
|
13
12
|
};
|
|
14
13
|
//#endregion
|
|
15
14
|
export { useLocaleBase };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocaleBase.d.ts","names":[],"sources":["../../../src/client/useLocaleBase.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useLocaleBase.d.ts","names":[],"sources":["../../../src/client/useLocaleBase.ts"],"mappings":";;;;;;cAUa,aAAA;UASZ,aAAA"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import { Locale } from "../intlayer/dist/types/index.js";
|
|
1
2
|
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
2
|
-
import * as _intlayer_types_allLocales0 from "@intlayer/types/allLocales";
|
|
3
3
|
|
|
4
4
|
//#region src/client/useLocaleStorage.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Get the locale cookie
|
|
7
7
|
*/
|
|
8
|
-
declare const localeInStorage:
|
|
8
|
+
declare const localeInStorage: Locale;
|
|
9
9
|
/**
|
|
10
10
|
* @deprecated Use localeInStorage instead
|
|
11
11
|
*
|
|
12
12
|
* Get the locale cookie
|
|
13
13
|
*/
|
|
14
|
-
declare const localeCookie:
|
|
14
|
+
declare const localeCookie: Locale;
|
|
15
15
|
/**
|
|
16
16
|
* Set the locale cookie
|
|
17
17
|
*/
|
|
@@ -26,7 +26,7 @@ declare const setLocaleCookie: (locale: LocalesValues, isCookieEnabled: boolean)
|
|
|
26
26
|
* Hook that provides the locale storage and a function to set it
|
|
27
27
|
*/
|
|
28
28
|
declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
|
|
29
|
-
getLocale: () =>
|
|
29
|
+
getLocale: () => Locale;
|
|
30
30
|
setLocale: (locale: LocalesValues) => void;
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
@@ -37,7 +37,7 @@ declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
|
|
|
37
37
|
* Hook that provides the locale cookie and a function to set it
|
|
38
38
|
*/
|
|
39
39
|
declare const useLocaleCookie: (isCookieEnabled?: boolean) => {
|
|
40
|
-
localeCookie:
|
|
40
|
+
localeCookie: Locale;
|
|
41
41
|
setLocaleCookie: (locale: LocalesValues) => void;
|
|
42
42
|
};
|
|
43
43
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocaleStorage.d.ts","names":[],"sources":["../../../src/client/useLocaleStorage.ts"],"mappings":";;;;;;;cAYa,eAAA,EAA4D,
|
|
1
|
+
{"version":3,"file":"useLocaleStorage.d.ts","names":[],"sources":["../../../src/client/useLocaleStorage.ts"],"mappings":";;;;;;;cAYa,eAAA,EAA4D,MAAA;;;;;AAMzE;cAAa,YAAA,EAA8B,MAAA;;;;cAK9B,kBAAA,GACX,MAAA,EAAQ,aAAA,EACR,eAAA;;;;;;cAYW,eAAA,GAAe,MAAA,EAblB,aAAA,EAAa,eAAA;;;AAavB;cAKa,gBAAA,GAAoB,eAAA;mBAQ9B,MAAA;sBAAA,aAAA;AAAA;;;;;AARH;;;cAiBa,eAAA,GAAmB,eAAA;gBAM/B,MAAA;4BAAA,aAAA;AAAA"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { useCompact } from "./useCompact.js";
|
|
2
2
|
import { useCurrency } from "./useCurrency.js";
|
|
3
3
|
import { useDate } from "./useDate.js";
|
|
4
|
+
import { useIntl } from "./useIntl.js";
|
|
4
5
|
import { useList } from "./useList.js";
|
|
5
6
|
import { useNumber } from "./useNumber.js";
|
|
6
7
|
import { usePercentage } from "./usePercentage.js";
|
|
7
8
|
import { useRelativeTime } from "./useRelativeTime.js";
|
|
8
9
|
import { useUnit } from "./useUnit.js";
|
|
9
|
-
export { useCompact, useCurrency, useDate, useList, useNumber, usePercentage, useRelativeTime, useUnit };
|
|
10
|
+
export { useCompact, useCurrency, useDate, useIntl, useList, useNumber, usePercentage, useRelativeTime, useUnit };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
2
|
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/format/useCompact.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* React client hook that provides a compact number formatter
|
|
6
6
|
* bound to the current application locale.
|
|
@@ -12,7 +12,7 @@ import * as _intlayer_types_module_augmentation0 from "@intlayer/types/module_au
|
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
14
|
declare const useCompact: () => (value: string | number, options?: Intl.NumberFormatOptions & {
|
|
15
|
-
locale?:
|
|
15
|
+
locale?: LocalesValues;
|
|
16
16
|
}) => string;
|
|
17
17
|
//#endregion
|
|
18
18
|
export { useCompact };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCompact.d.ts","names":[],"sources":["../../../src/format/useCompact.ts"],"mappings":";;;;;;AAcA;;;;;;;cAAa,UAAA,SAAU,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,aAAA;AAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
2
|
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/format/useCurrency.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* React client hook that provides a currency formatter
|
|
6
6
|
* bound to the current application locale.
|
|
@@ -26,7 +26,7 @@ import * as _intlayer_types_module_augmentation0 from "@intlayer/types/module_au
|
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
28
|
declare const useCurrency: () => (value: string | number, options?: Intl.NumberFormatOptions & {
|
|
29
|
-
locale?:
|
|
29
|
+
locale?: LocalesValues;
|
|
30
30
|
}) => string;
|
|
31
31
|
//#endregion
|
|
32
32
|
export { useCurrency };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCurrency.d.ts","names":[],"sources":["../../../src/format/useCurrency.ts"],"mappings":";;;;;;AA4BA;;;;;;;;;;;;;;;;;;;;;cAAa,WAAA,SAAW,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,aAAA;AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDate.d.ts","names":[],"sources":["../../../src/format/useDate.ts"],"mappings":";;;;;AA8BA;;;;;;;;;;;;;;;;;;;;;;;;cAAa,OAAA,YAGA,IAAA,EAAM,UAAA,QAAkB,IAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
2
2
|
import { WrappedIntl } from "@intlayer/core/formatters";
|
|
3
3
|
|
|
4
|
-
//#region src/
|
|
4
|
+
//#region src/format/useIntl.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Preact client hook that provides a locale-bound `Intl` object.
|
|
7
7
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIntl.d.ts","names":[],"sources":["../../../src/format/useIntl.ts"],"mappings":";;;;;;AAuBA;;;;;;;;;;;;;;;;cAAa,OAAA,GAAW,MAAA,GAAS,aAAA,KAAa,WAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
2
|
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/format/useList.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* React client hook that provides a list formatter
|
|
6
6
|
* bound to the current application locale.
|
|
@@ -27,7 +27,7 @@ declare const useList: () => (values: (string | number)[], options?: {
|
|
|
27
27
|
type?: "conjunction" | "disjunction" | "unit";
|
|
28
28
|
style?: "long" | "short" | "narrow";
|
|
29
29
|
} & {
|
|
30
|
-
locale?:
|
|
30
|
+
locale?: LocalesValues;
|
|
31
31
|
}) => string;
|
|
32
32
|
//#endregion
|
|
33
33
|
export { useList };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useList.d.ts","names":[],"sources":["../../../src/format/useList.ts"],"mappings":";;;;;;AAyBA;;;;;;;;;;;;;;;;;;cAAa,OAAA,SAAO,MAAA,uBAAA,OAAA;;;;;WAWnB,aAAA;AAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
2
|
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/format/useNumber.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* React client hook that provides a localized number formatter.
|
|
6
6
|
*
|
|
@@ -24,7 +24,7 @@ import * as _intlayer_types_module_augmentation0 from "@intlayer/types/module_au
|
|
|
24
24
|
* A number formatting function bound to the active locale.
|
|
25
25
|
*/
|
|
26
26
|
declare const useNumber: () => (value: string | number, options?: Intl.NumberFormatOptions & {
|
|
27
|
-
locale?:
|
|
27
|
+
locale?: LocalesValues;
|
|
28
28
|
}) => string;
|
|
29
29
|
//#endregion
|
|
30
30
|
export { useNumber };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNumber.d.ts","names":[],"sources":["../../../src/format/useNumber.ts"],"mappings":";;;;;;AA0BA;;;;;;;;;;;;;;;;;;;cAAa,SAAA,SAAS,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,aAAA;AAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
2
|
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/format/usePercentage.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* React hook to provide a percentage formatter function
|
|
6
6
|
* based on the current application locale.
|
|
@@ -20,7 +20,7 @@ import * as _intlayer_types_module_augmentation0 from "@intlayer/types/module_au
|
|
|
20
20
|
* A function that formats numbers or numeric strings into localized percentages.
|
|
21
21
|
*/
|
|
22
22
|
declare const usePercentage: () => (value: string | number, options?: Intl.NumberFormatOptions & {
|
|
23
|
-
locale?:
|
|
23
|
+
locale?: LocalesValues;
|
|
24
24
|
}) => string;
|
|
25
25
|
//#endregion
|
|
26
26
|
export { usePercentage };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePercentage.d.ts","names":[],"sources":["../../../src/format/usePercentage.ts"],"mappings":";;;;;;AAsBA;;;;;;;;;;;;;;;cAAa,aAAA,SAAa,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,aAAA;AAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
2
|
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/format/useRelativeTime.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Client-side React hook for accessing a localized relative time formatter.
|
|
6
6
|
*
|
|
@@ -20,7 +20,7 @@ import * as _intlayer_types_module_augmentation0 from "@intlayer/types/module_au
|
|
|
20
20
|
* bound to the current client locale.
|
|
21
21
|
*/
|
|
22
22
|
declare const useRelativeTime: () => (from: string | number | Date, to?: string | number | Date, options?: Intl.RelativeTimeFormatOptions & {
|
|
23
|
-
locale?:
|
|
23
|
+
locale?: LocalesValues;
|
|
24
24
|
unit?: Intl.RelativeTimeFormatUnit;
|
|
25
25
|
}) => string;
|
|
26
26
|
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRelativeTime.d.ts","names":[],"sources":["../../../src/format/useRelativeTime.ts"],"mappings":";;;;;;AAsBA;;;;;;;;;;;;;;;cAAa,eAAA,SAAe,IAAA,oBAAA,IAAA,EAAA,EAAA,qBAAA,IAAA,EAAA,OAAA,GAAA,IAAA,CAAA,yBAAA;WAAA,aAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
2
|
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/format/useUnit.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* React hook that provides a unit formatting function
|
|
6
6
|
* based on the current locale from {@link useLocaleBase}.
|
|
@@ -19,7 +19,7 @@ import * as _intlayer_types_module_augmentation0 from "@intlayer/types/module_au
|
|
|
19
19
|
* @returns {Function} A unit formatting function that accepts a value and optional formatting options.
|
|
20
20
|
*/
|
|
21
21
|
declare const useUnit: () => (value: string | number, options?: Intl.NumberFormatOptions & {
|
|
22
|
-
locale?:
|
|
22
|
+
locale?: LocalesValues;
|
|
23
23
|
}) => string;
|
|
24
24
|
//#endregion
|
|
25
25
|
export { useUnit };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUnit.d.ts","names":[],"sources":["../../../src/format/useUnit.ts"],"mappings":";;;;;;AAqBA;;;;;;;;;;;;;;cAAa,OAAA,SAAO,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,aAAA;AAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HTMLComponents } from "./types.js";
|
|
1
2
|
import { HTMLProvider, useHTMLContext } from "./HTMLProvider.js";
|
|
2
|
-
import { HTMLRenderer, HTMLRendererProps, RenderHTMLProps,
|
|
3
|
-
export { HTMLProvider, HTMLRenderer, HTMLRendererProps, RenderHTMLProps,
|
|
3
|
+
import { HTMLRenderer, HTMLRendererProps, RenderHTMLProps, renderHTML, useHTMLRenderer } from "./HTMLRenderer.js";
|
|
4
|
+
export { type HTMLComponents, HTMLProvider, HTMLRenderer, type HTMLRendererProps, type RenderHTMLProps, renderHTML, useHTMLContext, useHTMLRenderer };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { IntlayerNode } from "./IntlayerNode.js";
|
|
2
2
|
import { IntlayerClientContext, IntlayerProvider, IntlayerProviderContent, IntlayerProviderProps, useIntlayerContext } from "./client/IntlayerProvider.js";
|
|
3
|
-
import { useIntl } from "./client/format/useIntl.js";
|
|
4
3
|
import { t } from "./client/t.js";
|
|
5
|
-
import { IInterpreterPluginPreact
|
|
4
|
+
import { IInterpreterPluginPreact } from "./plugins.js";
|
|
6
5
|
import { useDictionary } from "./client/useDictionary.js";
|
|
7
6
|
import { useDictionaryAsync } from "./client/useDictionaryAsync.js";
|
|
8
7
|
import { useDictionaryDynamic } from "./client/useDictionaryDynamic.js";
|
|
@@ -13,12 +12,6 @@ import { useLocaleBase } from "./client/useLocaleBase.js";
|
|
|
13
12
|
import { localeCookie, setLocaleCookie, setLocaleInStorage, useLocaleCookie, useLocaleStorage } from "./client/useLocaleStorage.js";
|
|
14
13
|
import { getDictionary } from "./getDictionary.js";
|
|
15
14
|
import { getIntlayer } from "./getIntlayer.js";
|
|
16
|
-
import { HTMLProvider } from "./html/HTMLProvider.js";
|
|
17
|
-
import { HTMLRenderer, HTMLRendererProps, RenderHTMLProps, renderHTML, useHTMLRenderer } from "./html/HTMLRenderer.js";
|
|
18
|
-
import { compileMarkdown } from "./markdown/compiler.js";
|
|
19
|
-
import { MarkdownProvider } from "./markdown/MarkdownProvider.js";
|
|
20
|
-
import { MarkdownRenderer, renderMarkdown, useMarkdownRenderer } from "./markdown/MarkdownRenderer.js";
|
|
21
|
-
import preactRuntime from "./markdown/runtime.js";
|
|
22
15
|
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
23
16
|
|
|
24
17
|
//#region src/index.d.ts
|
|
@@ -26,5 +19,5 @@ declare module '@intlayer/core/interpreter' {
|
|
|
26
19
|
interface IInterpreterPlugin<T, S, L extends LocalesValues> extends IInterpreterPluginPreact<T, S, L> {}
|
|
27
20
|
}
|
|
28
21
|
//#endregion
|
|
29
|
-
export {
|
|
22
|
+
export { IntlayerClientContext, type IntlayerNode, IntlayerProvider, IntlayerProviderContent, type IntlayerProviderProps, getDictionary, getIntlayer, localeCookie, setLocaleCookie, setLocaleInStorage, t, useDictionary, useDictionaryAsync, useDictionaryDynamic, useIntlayer, useIntlayerContext, useLoadDynamic, useLocale, useLocaleBase, useLocaleCookie, useLocaleStorage };
|
|
30
23
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;YAIY,kBAAA,iBAAmC,aAAA,UACnC,wBAAA,CAAyB,CAAA,EAAG,CAAA,EAAG,CAAA;AAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { LocalesValues as LocalesValues$1 } from "@intlayer/types/module_augmentation";
|
|
2
|
+
import { Locale as Locale$1 } from "@intlayer/types/allLocales";
|
|
3
|
+
import { Dictionary } from "@intlayer/types/dictionary";
|
|
4
|
+
export { type Locale$1 as Locale, type LocalesValues$1 as LocalesValues };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HTMLComponents } from "../html/types.js";
|
|
2
|
-
import { ComponentChildren, FunctionComponent } from "preact";
|
|
2
|
+
import { ComponentChildren, ComponentType, FunctionComponent, JSX } from "preact";
|
|
3
3
|
|
|
4
4
|
//#region src/markdown/MarkdownProvider.d.ts
|
|
5
5
|
type PropsWithChildren<P = {}> = P & {
|
|
@@ -28,7 +28,7 @@ type MarkdownProviderOptions = {
|
|
|
28
28
|
};
|
|
29
29
|
type MarkdownContextValue = {
|
|
30
30
|
components?: HTMLComponents<'permissive', {}>;
|
|
31
|
-
renderMarkdown: (markdown: string, options?: MarkdownProviderOptions, components?: HTMLComponents<'permissive', {}>, wrapper?: any) => ComponentChildren
|
|
31
|
+
renderMarkdown: (markdown: string, options?: MarkdownProviderOptions, components?: HTMLComponents<'permissive', {}>, wrapper?: ComponentType<any> | keyof JSX.IntrinsicElements) => ComponentChildren | Promise<ComponentChildren>;
|
|
32
32
|
};
|
|
33
33
|
type MarkdownProviderProps = PropsWithChildren<MarkdownProviderOptions & {
|
|
34
34
|
/**
|
|
@@ -38,12 +38,12 @@ type MarkdownProviderProps = PropsWithChildren<MarkdownProviderOptions & {
|
|
|
38
38
|
/**
|
|
39
39
|
* Wrapper element or component to be used when there are multiple children.
|
|
40
40
|
*/
|
|
41
|
-
wrapper?: any;
|
|
41
|
+
wrapper?: ComponentType<any> | keyof JSX.IntrinsicElements;
|
|
42
42
|
/**
|
|
43
43
|
* Custom render function for markdown.
|
|
44
44
|
* If provided, it will overwrite all rules and default rendering.
|
|
45
45
|
*/
|
|
46
|
-
renderMarkdown?: (markdown: string, options?: MarkdownProviderOptions, components?: HTMLComponents<'permissive', {}>, wrapper?: any) => ComponentChildren
|
|
46
|
+
renderMarkdown?: (markdown: string, options?: MarkdownProviderOptions, components?: HTMLComponents<'permissive', {}>, wrapper?: ComponentType<any> | keyof JSX.IntrinsicElements) => ComponentChildren | Promise<ComponentChildren>;
|
|
47
47
|
}>;
|
|
48
48
|
declare const useMarkdownContext: () => MarkdownContextValue;
|
|
49
49
|
declare const MarkdownProvider: FunctionComponent<MarkdownProviderProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownProvider.d.ts","names":[],"sources":["../../../src/markdown/MarkdownProvider.tsx"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"MarkdownProvider.d.ts","names":[],"sources":["../../../src/markdown/MarkdownProvider.tsx"],"mappings":";;;;KAWK,iBAAA,WAA4B,CAAA;EAAM,QAAA,GAAW,iBAAA;AAAA;;;;KAKtC,uBAAA;EALqB;;;EAS/B,UAAA;EATiE;AAKnE;;EAQE,WAAA;EARiC;;;EAYjC,mBAAA;EAIA;;;EAAA,SAAA;AAAA;AAAA,KASG,oBAAA;EACH,UAAA,GAAa,cAAA;EACb,cAAA,GACE,QAAA,UACA,OAAA,GAAU,uBAAA,EACV,UAAA,GAAa,cAAA,oBACb,OAAA,GAAU,aAAA,cAA2B,GAAA,CAAI,iBAAA,KACtC,iBAAA,GAAoB,OAAA,CAAQ,iBAAA;AAAA;AAAA,KAG9B,qBAAA,GAAwB,iBAAA,CAC3B,uBAAA;EALuC;;;EASrC,UAAA,GAAa,cAAA;EARiB;;;EAY9B,OAAA,GAAU,aAAA,cAA2B,GAAA,CAAI,iBAAA;EAjB3C;;;;EAsBE,cAAA,IACE,QAAA,UACA,OAAA,GAAU,uBAAA,EACV,UAAA,GAAa,cAAA,oBACb,OAAA,GAAU,aAAA,cAA2B,GAAA,CAAI,iBAAA,KACtC,iBAAA,GAAoB,OAAA,CAAQ,iBAAA;AAAA;AAAA,cAQxB,kBAAA,QAAkB,oBAAA;AAAA,cAuBlB,gBAAA,EAAkB,iBAAA,CAAkB,qBAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HTMLComponents } from "../html/types.js";
|
|
2
2
|
import { MarkdownProviderOptions } from "./MarkdownProvider.js";
|
|
3
|
-
import { ComponentChildren, FunctionComponent, JSX } from "preact";
|
|
3
|
+
import { ComponentChildren, ComponentType, FunctionComponent, JSX } from "preact";
|
|
4
4
|
|
|
5
5
|
//#region src/markdown/MarkdownRenderer.d.ts
|
|
6
6
|
type RenderMarkdownProps = MarkdownProviderOptions & {
|
|
@@ -13,7 +13,7 @@ type RenderMarkdownProps = MarkdownProviderOptions & {
|
|
|
13
13
|
* Wrapper element or component to be used when there are multiple children.
|
|
14
14
|
* Only used if not wrapped in a MarkdownProvider.
|
|
15
15
|
*/
|
|
16
|
-
wrapper?:
|
|
16
|
+
wrapper?: ComponentType<any> | keyof JSX.IntrinsicElements;
|
|
17
17
|
};
|
|
18
18
|
declare const renderMarkdown: (content: string, {
|
|
19
19
|
components,
|
|
@@ -42,12 +42,12 @@ type MarkdownRendererProps = RenderMarkdownProps & {
|
|
|
42
42
|
*/
|
|
43
43
|
renderMarkdown?: (markdown: string, options?: {
|
|
44
44
|
components?: HTMLComponents<'permissive', {}>;
|
|
45
|
-
wrapper?:
|
|
45
|
+
wrapper?: ComponentType<any> | keyof JSX.IntrinsicElements;
|
|
46
46
|
forceBlock?: boolean;
|
|
47
47
|
forceInline?: boolean;
|
|
48
48
|
preserveFrontmatter?: boolean;
|
|
49
49
|
tagfilter?: boolean;
|
|
50
|
-
}) => ComponentChildren
|
|
50
|
+
}) => ComponentChildren | Promise<ComponentChildren>;
|
|
51
51
|
};
|
|
52
52
|
/**
|
|
53
53
|
* Preact component that renders markdown to JSX.
|
|
@@ -57,5 +57,5 @@ type MarkdownRendererProps = RenderMarkdownProps & {
|
|
|
57
57
|
*/
|
|
58
58
|
declare const MarkdownRenderer: FunctionComponent<MarkdownRendererProps>;
|
|
59
59
|
//#endregion
|
|
60
|
-
export { MarkdownRenderer, RenderMarkdownProps, renderMarkdown, useMarkdownRenderer };
|
|
60
|
+
export { MarkdownRenderer, MarkdownRendererProps, RenderMarkdownProps, renderMarkdown, useMarkdownRenderer };
|
|
61
61
|
//# sourceMappingURL=MarkdownRenderer.d.ts.map
|