react-intlayer 8.6.2 → 8.6.4
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/IntlayerProvider.cjs +6 -4
- package/dist/cjs/client/IntlayerProvider.cjs.map +1 -1
- package/dist/cjs/client/useDictionaryAsync.cjs +1 -2
- package/dist/cjs/client/useDictionaryAsync.cjs.map +1 -1
- package/dist/cjs/client/useDictionaryDynamic.cjs +1 -2
- package/dist/cjs/client/useDictionaryDynamic.cjs.map +1 -1
- package/dist/cjs/client/useLocale.cjs +1 -2
- package/dist/cjs/client/useLocale.cjs.map +1 -1
- package/dist/cjs/client/useLocaleBase.cjs +1 -2
- package/dist/cjs/client/useLocaleBase.cjs.map +1 -1
- package/dist/cjs/client/useRewriteURL.cjs +1 -2
- package/dist/cjs/client/useRewriteURL.cjs.map +1 -1
- package/dist/cjs/editor/ContentSelector.cjs +6 -2
- package/dist/cjs/editor/ContentSelector.cjs.map +1 -1
- package/dist/cjs/editor/useEditor.cjs +2 -1
- package/dist/cjs/editor/useEditor.cjs.map +1 -1
- package/dist/cjs/plugins.cjs +47 -14
- package/dist/cjs/plugins.cjs.map +1 -1
- package/dist/cjs/server/IntlayerServerProvider.cjs +1 -2
- package/dist/cjs/server/IntlayerServerProvider.cjs.map +1 -1
- package/dist/cjs/server/format/useIntl.cjs +1 -2
- package/dist/cjs/server/format/useIntl.cjs.map +1 -1
- package/dist/cjs/server/useDictionaryAsync.cjs +1 -2
- package/dist/cjs/server/useDictionaryAsync.cjs.map +1 -1
- package/dist/cjs/server/useDictionaryDynamic.cjs +1 -2
- package/dist/cjs/server/useDictionaryDynamic.cjs.map +1 -1
- package/dist/cjs/server/useLocale.cjs +1 -2
- package/dist/cjs/server/useLocale.cjs.map +1 -1
- package/dist/esm/client/IntlayerProvider.mjs +6 -3
- package/dist/esm/client/IntlayerProvider.mjs.map +1 -1
- package/dist/esm/client/useDictionaryAsync.mjs +2 -2
- package/dist/esm/client/useDictionaryAsync.mjs.map +1 -1
- package/dist/esm/client/useDictionaryDynamic.mjs +2 -2
- package/dist/esm/client/useDictionaryDynamic.mjs.map +1 -1
- package/dist/esm/client/useLocale.mjs +2 -2
- package/dist/esm/client/useLocale.mjs.map +1 -1
- package/dist/esm/client/useLocaleBase.mjs +2 -2
- package/dist/esm/client/useLocaleBase.mjs.map +1 -1
- package/dist/esm/client/useRewriteURL.mjs +2 -2
- package/dist/esm/client/useRewriteURL.mjs.map +1 -1
- package/dist/esm/editor/ContentSelector.mjs +6 -2
- package/dist/esm/editor/ContentSelector.mjs.map +1 -1
- package/dist/esm/editor/useEditor.mjs +2 -1
- package/dist/esm/editor/useEditor.mjs.map +1 -1
- package/dist/esm/plugins.mjs +48 -14
- package/dist/esm/plugins.mjs.map +1 -1
- package/dist/esm/server/IntlayerServerProvider.mjs +2 -2
- package/dist/esm/server/IntlayerServerProvider.mjs.map +1 -1
- package/dist/esm/server/format/useIntl.mjs +2 -2
- package/dist/esm/server/format/useIntl.mjs.map +1 -1
- package/dist/esm/server/useDictionaryAsync.mjs +2 -2
- package/dist/esm/server/useDictionaryAsync.mjs.map +1 -1
- package/dist/esm/server/useDictionaryDynamic.mjs +2 -2
- package/dist/esm/server/useDictionaryDynamic.mjs.map +1 -1
- package/dist/esm/server/useLocale.mjs +2 -2
- package/dist/esm/server/useLocale.mjs.map +1 -1
- package/dist/types/client/IntlayerProvider.d.ts.map +1 -1
- package/dist/types/client/useLocaleBase.d.ts.map +1 -1
- package/dist/types/editor/ContentSelector.d.ts.map +1 -1
- package/dist/types/editor/useEditor.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/markdown/MarkdownRenderer.d.ts +1 -1
- package/dist/types/markdown/MarkdownRenderer.d.ts.map +1 -1
- package/dist/types/plugins.d.ts.map +1 -1
- package/package.json +9 -9
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 fallbackPlugin,\n filePlugin,\n genderPlugin,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n nestedPlugin,\n type Plugins,\n splitInsertionTemplate,\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 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 {\n createElement,\n Fragment,\n lazy,\n type ReactElement,\n type ReactNode,\n Suspense,\n} from 'react';\nimport { ContentSelector } from './editor/ContentSelector';\nimport type { HTMLComponents } from './html/HTMLComponentTypes';\nimport { type IntlayerNode, renderIntlayerNode } from './IntlayerNode';\nimport { renderReactElement } from './reactElement/renderReactElement';\n\n// React.lazy for heavy renderer components — creates separate code-split chunks\n// and properly suspends until the module is loaded\nconst LazyMarkdownRendererPlugin = lazy(() =>\n import('./markdown/MarkdownRendererPlugin').then((m) => ({\n default: m.MarkdownRendererPlugin,\n }))\n);\n\nconst LazyHTMLRendererPlugin = lazy(() =>\n import('./html/HTMLRendererPlugin').then((m) => ({\n default: m.HTMLRendererPlugin,\n }))\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 process.env.INTLAYER_NODE_TYPE_INTLAYER_NODE === 'false'\n ? fallbackPlugin\n : {\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}>{rest.children}</ContentSelector>\n ) : (\n rest.children\n ),\n }),\n };\n\n/** ---------------------------------------------\n * REACT NODE PLUGIN\n * --------------------------------------------- */\n\nexport type ReactNodeCond<T> = T extends {\n props: any;\n key: any;\n}\n ? ReactNode\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const reactNodePlugins: Plugins =\n process.env.INTLAYER_NODE_TYPE_REACT_NODE === 'false'\n ? fallbackPlugin\n : {\n id: 'react-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: '[[react-element]]',\n children: configuration.editor.enabled ? (\n <ContentSelector {...rest}>\n {renderReactElement(node)}\n </ContentSelector>\n ) : (\n renderReactElement(node)\n ),\n }),\n };\n\n/** ---------------------------------------------\n * INSERTION PLUGIN\n * --------------------------------------------- */\n\nexport type InsertionCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeTypes.INSERTION]: string;\n fields: readonly string[];\n}\n ? <V extends { [K in T['fields'][number]]: ReactNode }>(\n values: V\n ) => V[keyof V] extends string | number\n ? IntlayerNode<string>\n : IntlayerNode<ReactNode>\n : never;\n\n/**\n * Split insertion string and join with React nodes using shared core logic\n */\nconst splitAndJoinInsertion = (\n template: string,\n values: Record<string, string | number | ReactNode>\n): ReactNode => {\n const result = splitInsertionTemplate(template, values);\n\n if (result.isSimple) {\n // Simple string replacement\n return result.parts as string;\n }\n\n // Return as Fragment with proper keys\n return createElement(\n Fragment,\n null,\n ...(result.parts as any[]).map((part, index) =>\n createElement(Fragment, { key: index }, part)\n )\n );\n};\n\n/** Insertion plugin for React. Handles component/node insertion. */\nexport const insertionPlugin: Plugins =\n process.env.INTLAYER_NODE_TYPE_INSERTION === 'false'\n ? fallbackPlugin\n : {\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]]:\n | string\n | number\n | ReactNode;\n }\n ) => {\n const result = splitAndJoinInsertion(transformedResult, values);\n\n return deepTransformNode(result, {\n ...subProps,\n plugins: props.plugins,\n children: result,\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', {}>) => ReactNode;\n }\n >\n : never;\n\n/** Markdown string plugin. Replaces string node with a component that render the markdown. */\nexport const markdownStringPlugin: Plugins =\n process.env.INTLAYER_NODE_TYPE_MARKDOWN === 'false'\n ? fallbackPlugin\n : {\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}>{node}</ContentSelector>\n ) : (\n node\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?: HTMLComponents) =>\n renderIntlayerNode({\n ...props,\n value: node,\n children: configuration.editor.enabled ? (\n <ContentSelector {...rest}>\n <Suspense fallback={node}>\n <LazyMarkdownRendererPlugin\n {...rest}\n components={components}\n >\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 unknown as ReactElement;\n\n return 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 === 'use') {\n return (components?: HTMLComponents) => render(components);\n }\n\n return Reflect.get(target, prop, receiver);\n },\n }) as any;\n },\n };\n\nexport type MarkdownCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeTypes.MARKDOWN]: infer M;\n tags?: infer U;\n metadata?: infer V;\n}\n ? IntlayerNode<\n M,\n {\n use: (components?: HTMLComponents<'permissive', U>) => ReactNode;\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 === 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\n/**\n * HTML conditional type that enforces:\n * - All components (Standard or Custom) are OPTIONAL in the `use()` method.\n * - Custom components props are strictly inferred from the dictionary definition.\n *\n * This ensures type safety:\n * - `html('<div>Hello <CustomComponent /></div>').use({ CustomComponent: ... })` - optional but typed\n */\nexport type HTMLPluginCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeTypes.HTML]: infer I;\n tags?: infer U;\n}\n ? IntlayerNode<\n I,\n {\n use: (components?: HTMLComponents<'permissive', U>) => ReactNode;\n }\n >\n : never;\n\n/** HTML plugin. Replaces node with a function that takes components => ReactNode. */\nexport const htmlPlugin: Plugins =\n process.env.INTLAYER_NODE_TYPE_HTML === 'false'\n ? fallbackPlugin\n : {\n id: 'html-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeTypes.HTML,\n\n transform: (node: HTMLContent<string>, props) => {\n const html = node[NodeTypes.HTML];\n const { plugins, ...rest } = props;\n\n // Type-safe render function that accepts properly typed components\n const render = (userComponents?: HTMLComponents): ReactNode =>\n renderIntlayerNode({\n ...rest,\n value: html,\n children: (\n <Suspense fallback={html}>\n <LazyHTMLRendererPlugin\n {...rest}\n html={html}\n userComponents={userComponents}\n />\n </Suspense>\n ),\n });\n\n const element = render() as unknown as ReactElement;\n\n return new Proxy(element, {\n get(target, prop, receiver) {\n if (prop === 'value') {\n return html;\n }\n\n if (prop === 'use') {\n // Return a properly typed function based on custom components\n return (userComponents?: HTMLComponents) =>\n render(userComponents);\n }\n\n return Reflect.get(target, prop, receiver);\n },\n }) as any;\n },\n };\n\n/** ---------------------------------------------\n * PLUGINS RESULT\n * --------------------------------------------- */\n\nexport type IInterpreterPluginReact<T, _S, _L extends LocalesValues> = {\n reactNode: ReactNodeCond<T>;\n reactIntlayerNode: IntlayerNodeCond<T>;\n reactInsertion: InsertionCond<T>;\n reactMarkdown: MarkdownCond<T>;\n reactHtml: HTMLPluginCond<T>;\n};\n\n/**\n * Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution.\n *\n * Otherwise the the `react-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 reactNode: true;\n reactIntlayerNode: true;\n reactMarkdown: true;\n reactHtml: true;\n reactInsertion: 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 React 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 [\n // Env var allows the bundler to to remove the plugin if not used to make the bundle smaller\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 // Always include: handle plain strings/numbers and React elements\n intlayerNodePlugins,\n reactNodePlugins,\n insertionPlugin,\n markdownPlugin,\n htmlPlugin,\n ].filter(Boolean) as Plugins[];\n"],"mappings":";;;;;;;;;;;AA0CA,MAAM,6BAA6B,WACjC,OAAO,yCAAqC,MAAM,OAAO,EACvD,SAAS,EAAE,wBACZ,EAAE,CACJ;AAED,MAAM,yBAAyB,WAC7B,OAAO,iCAA6B,MAAM,OAAO,EAC/C,SAAS,EAAE,oBACZ,EAAE,CACJ;;AAWD,MAAa,sBACX,QAAQ,IAAI,qCAAqC,UAC7C,iBACA;CACE,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,cAAc,OAAO,UAC7B,oBAAC,iBAAD;GAAiB,GAAI;aAAO,KAAK;GAA2B,IAE5D,KAAK;EAER,CAAC;CACL;;AAcP,MAAa,mBACX,QAAQ,IAAI,kCAAkC,UAC1C,iBACA;CACE,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,MAAM,UAAU,eACvB,OAAO,KAAK,QAAQ;CAEtB,YACE,MACA,EACE,SACA,GAAG,WAGL,mBAAmB;EACjB,GAAG;EACH,OAAO;EACP,UAAU,cAAc,OAAO,UAC7B,oBAAC,iBAAD;GAAiB,GAAI;aAClB,mBAAmB,KAAK;GACT,IAElB,mBAAmB,KAAK;EAE3B,CAAC;CACL;;;;AAqBP,MAAM,yBACJ,UACA,WACc;CACd,MAAM,SAAS,uBAAuB,UAAU,OAAO;AAEvD,KAAI,OAAO,SAET,QAAO,OAAO;AAIhB,QAAO,cACL,UACA,MACA,GAAI,OAAO,MAAgB,KAAK,MAAM,UACpC,cAAc,UAAU,EAAE,KAAK,OAAO,EAAE,KAAK,CAC9C,CACF;;;AAIH,MAAa,kBACX,QAAQ,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,EAAE,CAAE;GAC1D,CAAC;;CAEL;;AA4BD,MAAa,aACX,QAAQ,IAAI,4BAA4B,UACpC,iBACA;CACE,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,UAAU;CAE3D,YAAY,MAA2B,UAAU;EAC/C,MAAM,OAAO,KAAK,UAAU;EAC5B,MAAM,EAAE,SAAS,GAAG,SAAS;EAG7B,MAAM,UAAU,mBACd,mBAAmB;GACjB,GAAG;GACH,OAAO;GACP,UACE,oBAAC,UAAD;IAAU,UAAU;cAClB,oBAAC,wBAAD;KACE,GAAI;KACE;KACU;KAChB;IACO;GAEd,CAAC;EAEJ,MAAM,UAAU,QAAQ;AAExB,SAAO,IAAI,MAAM,SAAS,EACxB,IAAI,QAAQ,MAAM,UAAU;AAC1B,OAAI,SAAS,QACX,QAAO;AAGT,OAAI,SAAS,MAEX,SAAQ,mBACN,OAAO,eAAe;AAG1B,UAAO,QAAQ,IAAI,QAAQ,MAAM,SAAS;KAE7C,CAAC;;CAEL;;;;;AAuCP,MAAa,cACX,QACA,WAAoB,SAEpB;CAEE,kBACE,UAAU,cAAc,qBAAqB,eAC7C,WAAW,cAAc,qBAAqB,gBAAgB,OAC/D;CACD;CACA;CACA,aAAa,UAAU,cAAc,qBAAqB,cAAc;CACxE;CACA;CAEA;CACA;CACA;CACA;CACA;CACD,CAAC,OAAO,QAAQ"}
|
|
1
|
+
{"version":3,"file":"plugins.mjs","names":[],"sources":["../../src/plugins.tsx"],"sourcesContent":["import { editor, internationalization } from '@intlayer/config/built';\nimport {\n conditionPlugin,\n type DeepTransformContent as DeepTransformContentCore,\n enumerationPlugin,\n fallbackPlugin,\n filePlugin,\n genderPlugin,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n nestedPlugin,\n type Plugins,\n splitInsertionTemplate,\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 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 {\n createElement,\n Fragment,\n lazy,\n type ReactElement,\n type ReactNode,\n Suspense,\n} from 'react';\nimport { ContentSelector } from './editor/ContentSelector';\nimport type { HTMLComponents } from './html/HTMLComponentTypes';\nimport { type IntlayerNode, renderIntlayerNode } from './IntlayerNode';\nimport { renderReactElement } from './reactElement/renderReactElement';\n\n// ── Tree-shake constants ──────────────────────────────────────────────────────\n// When these env vars are injected at build time, bundlers eliminate the\n// branches guarded by these constants.\n\n/**\n * True when the intlayer node type is explicitly disabled at build time.\n */\nconst TREE_SHAKE_INTLAYER_NODE =\n process.env['INTLAYER_NODE_TYPE_INTLAYER_NODE'] === 'false';\n\n/**\n * True when the react node type is explicitly disabled at build time.\n */\nconst TREE_SHAKE_REACT_NODE =\n process.env['INTLAYER_NODE_TYPE_REACT_NODE'] === 'false';\n\n/**\n * True when the markdown node type is explicitly disabled at build time.\n */\nconst TREE_SHAKE_MARKDOWN =\n process.env['INTLAYER_NODE_TYPE_MARKDOWN'] === 'false';\n\n/**\n * True when the HTML node type is explicitly disabled at build time.\n */\nconst TREE_SHAKE_HTML = process.env['INTLAYER_NODE_TYPE_HTML'] === 'false';\n\n/**\n * True when the insertion node type is explicitly disabled at build time.\n */\nconst TREE_SHAKE_INSERTION =\n process.env['INTLAYER_NODE_TYPE_INSERTION'] === 'false';\n\n/**\n * True when the editor is explicitly disabled at build time.\n */\nconst TREE_SHAKE_EDITOR = process.env['INTLAYER_EDITOR_ENABLED'] === 'false';\n\n// React.lazy for heavy renderer components — creates separate code-split chunks\n// and properly suspends until the module is loaded\nconst LazyMarkdownRendererPlugin = lazy(() =>\n import('./markdown/MarkdownRendererPlugin').then((m) => ({\n default: m.MarkdownRendererPlugin,\n }))\n);\n\nconst LazyHTMLRendererPlugin = lazy(() =>\n import('./html/HTMLRendererPlugin').then((m) => ({\n default: m.HTMLRendererPlugin,\n }))\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 = TREE_SHAKE_INTLAYER_NODE\n ? fallbackPlugin\n : {\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:\n !TREE_SHAKE_EDITOR && editor.enabled ? (\n <ContentSelector {...rest}>{rest.children}</ContentSelector>\n ) : (\n rest.children\n ),\n }),\n };\n\n/** ---------------------------------------------\n * REACT NODE PLUGIN\n * --------------------------------------------- */\n\nexport type ReactNodeCond<T> = T extends {\n props: any;\n key: any;\n}\n ? ReactNode\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const reactNodePlugins: Plugins = TREE_SHAKE_REACT_NODE\n ? fallbackPlugin\n : {\n id: 'react-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: '[[react-element]]',\n children:\n !TREE_SHAKE_EDITOR && editor.enabled ? (\n <ContentSelector {...rest}>\n {renderReactElement(node)}\n </ContentSelector>\n ) : (\n renderReactElement(node)\n ),\n }),\n };\n\n/** ---------------------------------------------\n * INSERTION PLUGIN\n * --------------------------------------------- */\n\nexport type InsertionCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeTypes.INSERTION]: string;\n fields: readonly string[];\n}\n ? <V extends { [K in T['fields'][number]]: ReactNode }>(\n values: V\n ) => V[keyof V] extends string | number\n ? IntlayerNode<string>\n : IntlayerNode<ReactNode>\n : never;\n\n/**\n * Split insertion string and join with React nodes using shared core logic\n */\nconst splitAndJoinInsertion = (\n template: string,\n values: Record<string, string | number | ReactNode>\n): ReactNode => {\n const result = splitInsertionTemplate(template, values);\n\n if (result.isSimple) {\n // Simple string replacement\n return result.parts as string;\n }\n\n // Return as Fragment with proper keys\n return createElement(\n Fragment,\n null,\n ...(result.parts as any[]).map((part, index) =>\n createElement(Fragment, { key: index }, part)\n )\n );\n};\n\n/** Insertion plugin for React. Handles component/node insertion. */\nexport const insertionPlugin: Plugins = TREE_SHAKE_INSERTION\n ? fallbackPlugin\n : {\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]]:\n | string\n | number\n | ReactNode;\n }\n ) => {\n const result = splitAndJoinInsertion(transformedResult, values);\n\n return deepTransformNode(result, {\n ...subProps,\n plugins: props.plugins,\n children: result,\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', {}>) => ReactNode;\n }\n >\n : never;\n\n/** Markdown string plugin. Replaces string node with a component that render the markdown. */\nexport const markdownStringPlugin: Plugins = TREE_SHAKE_MARKDOWN\n ? fallbackPlugin\n : {\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:\n !TREE_SHAKE_EDITOR && editor.enabled ? (\n <ContentSelector {...rest}>{node}</ContentSelector>\n ) : (\n node\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?: HTMLComponents) =>\n renderIntlayerNode({\n ...props,\n value: node,\n children:\n !TREE_SHAKE_EDITOR && editor.enabled ? (\n <ContentSelector {...rest}>\n <Suspense fallback={node}>\n <LazyMarkdownRendererPlugin\n {...rest}\n components={components}\n >\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 unknown as ReactElement;\n\n return 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 === 'use') {\n return (components?: HTMLComponents) => render(components);\n }\n\n return Reflect.get(target, prop, receiver);\n },\n }) as any;\n },\n };\n\nexport type MarkdownCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeTypes.MARKDOWN]: infer M;\n tags?: infer U;\n metadata?: infer V;\n}\n ? IntlayerNode<\n M,\n {\n use: (components?: HTMLComponents<'permissive', U>) => ReactNode;\n metadata: DeepTransformContent<V>;\n }\n >\n : never;\n\nexport const markdownPlugin: Plugins = TREE_SHAKE_MARKDOWN\n ? fallbackPlugin\n : {\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\n/**\n * HTML conditional type that enforces:\n * - All components (Standard or Custom) are OPTIONAL in the `use()` method.\n * - Custom components props are strictly inferred from the dictionary definition.\n *\n * This ensures type safety:\n * - `html('<div>Hello <CustomComponent /></div>').use({ CustomComponent: ... })` - optional but typed\n */\nexport type HTMLPluginCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeTypes.HTML]: infer I;\n tags?: infer U;\n}\n ? IntlayerNode<\n I,\n {\n use: (components?: HTMLComponents<'permissive', U>) => ReactNode;\n }\n >\n : never;\n\n/** HTML plugin. Replaces node with a function that takes components => ReactNode. */\nexport const htmlPlugin: Plugins = TREE_SHAKE_HTML\n ? fallbackPlugin\n : {\n id: 'html-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeTypes.HTML,\n\n transform: (node: HTMLContent<string>, props) => {\n const html = node[NodeTypes.HTML];\n const { plugins, ...rest } = props;\n\n // Type-safe render function that accepts properly typed components\n const render = (userComponents?: HTMLComponents): ReactNode =>\n renderIntlayerNode({\n ...rest,\n value: html,\n children:\n !TREE_SHAKE_EDITOR && editor.enabled ? (\n <ContentSelector {...rest}>\n <Suspense fallback={html}>\n <LazyHTMLRendererPlugin\n {...rest}\n html={html}\n userComponents={userComponents}\n />\n </Suspense>\n </ContentSelector>\n ) : (\n <Suspense fallback={html}>\n <LazyHTMLRendererPlugin\n {...rest}\n html={html}\n userComponents={userComponents}\n />\n </Suspense>\n ),\n });\n\n const element = render() as unknown as ReactElement;\n\n return new Proxy(element, {\n get(target, prop, receiver) {\n if (prop === 'value') {\n return html;\n }\n\n if (prop === 'use') {\n // Return a properly typed function based on custom components\n return (userComponents?: HTMLComponents) =>\n render(userComponents);\n }\n\n return Reflect.get(target, prop, receiver);\n },\n }) as any;\n },\n };\n\n/** ---------------------------------------------\n * PLUGINS RESULT\n * --------------------------------------------- */\n\nexport type IInterpreterPluginReact<T, _S, _L extends LocalesValues> = {\n reactNode: ReactNodeCond<T>;\n reactIntlayerNode: IntlayerNodeCond<T>;\n reactInsertion: InsertionCond<T>;\n reactMarkdown: MarkdownCond<T>;\n reactHtml: HTMLPluginCond<T>;\n};\n\n/**\n * Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution.\n *\n * Otherwise the the `react-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 reactNode: true;\n reactIntlayerNode: true;\n reactMarkdown: true;\n reactHtml: true;\n reactInsertion: 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 React 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 [\n // Env var allows the bundler to to remove the plugin if not used to make the bundle smaller\n translationPlugin(\n locale ?? internationalization.defaultLocale,\n fallback ? internationalization.defaultLocale : undefined\n ),\n enumerationPlugin,\n conditionPlugin,\n nestedPlugin(locale ?? internationalization.defaultLocale),\n\n filePlugin,\n genderPlugin,\n // Always include: handle plain strings/numbers and React elements\n intlayerNodePlugins,\n reactNodePlugins,\n insertionPlugin,\n markdownPlugin,\n htmlPlugin,\n ].filter(Boolean) as Plugins[];\n"],"mappings":";;;;;;;;;;;;;;AA+CA,MAAM,2BACJ,QAAQ,IAAI,wCAAwC;;;;AAKtD,MAAM,wBACJ,QAAQ,IAAI,qCAAqC;;;;AAKnD,MAAM,sBACJ,QAAQ,IAAI,mCAAmC;;;;AAKjD,MAAM,kBAAkB,QAAQ,IAAI,+BAA+B;;;;AAKnE,MAAM,uBACJ,QAAQ,IAAI,oCAAoC;;;;AAKlD,MAAM,oBAAoB,QAAQ,IAAI,+BAA+B;AAIrE,MAAM,6BAA6B,WACjC,OAAO,yCAAqC,MAAM,OAAO,EACvD,SAAS,EAAE,wBACZ,EAAE,CACJ;AAED,MAAM,yBAAyB,WAC7B,OAAO,iCAA6B,MAAM,OAAO,EAC/C,SAAS,EAAE,oBACZ,EAAE,CACJ;;AAWD,MAAa,sBAA+B,2BACxC,iBACA;CACE,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;CAClB,YACE,OACA,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KACE,GAAI;KACE;KACU;KAChB;IACO;GAEhB,CAAC;EAEJ,MAAM,UAAU,QAAQ;AAExB,SAAO,IAAI,MAAM,SAAS,EACxB,IAAI,QAAQ,MAAM,UAAU;AAC1B,OAAI,SAAS,QACX,QAAO;AAGT,OAAI,SAAS,MAEX,SAAQ,mBACN,OAAO,eAAe;AAG1B,UAAO,QAAQ,IAAI,QAAQ,MAAM,SAAS;KAE7C,CAAC;;CAEL;;;;;AAuCL,MAAa,cACX,QACA,WAAoB,SAEpB;CAEE,kBACE,UAAU,qBAAqB,eAC/B,WAAW,qBAAqB,gBAAgB,OACjD;CACD;CACA;CACA,aAAa,UAAU,qBAAqB,cAAc;CAE1D;CACA;CAEA;CACA;CACA;CACA;CACA;CACD,CAAC,OAAO,QAAQ"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createServerContext, getServerContext } from "./serverContext.mjs";
|
|
2
|
-
import
|
|
2
|
+
import { internationalization } from "@intlayer/config/built";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/server/IntlayerServerProvider.tsx
|
|
6
|
-
const { defaultLocale } =
|
|
6
|
+
const { defaultLocale } = internationalization ?? {};
|
|
7
7
|
/**
|
|
8
8
|
* Context that store the current locale on the server side
|
|
9
9
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntlayerServerProvider.mjs","names":[],"sources":["../../../src/server/IntlayerServerProvider.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"IntlayerServerProvider.mjs","names":[],"sources":["../../../src/server/IntlayerServerProvider.tsx"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\n\nimport type { FC, PropsWithChildren } from 'react';\nimport { createServerContext, getServerContext } from './serverContext';\n\nconst { defaultLocale } = internationalization ?? {};\n\n/**\n * Context that store the current locale on the server side\n */\nexport const IntlayerServerContext =\n createServerContext<LocalesValues>(defaultLocale);\n\n/**\n * Hook that provides the current locale\n */\nexport const useIntlayer = () => getServerContext(IntlayerServerContext);\n\n/**\n * Get the current locale\n */\nexport const locale = getServerContext(IntlayerServerContext);\n\nexport type IntlayerServerProviderProps = PropsWithChildren & {\n locale?: LocalesValues;\n};\n\n/**\n * Provider that store the current locale on the server side\n */\nexport const IntlayerServerProvider: FC<IntlayerServerProviderProps> = ({\n children,\n locale = defaultLocale,\n}) => (\n <IntlayerServerContext.Provider value={locale}>\n {children}\n </IntlayerServerContext.Provider>\n);\n"],"mappings":";;;;;AAMA,MAAM,EAAE,kBAAkB,wBAAwB,EAAE;;;;AAKpD,MAAa,wBACX,oBAAmC,cAAc;;;;AAKnD,MAAa,oBAAoB,iBAAiB,sBAAsB;;;;AAKxE,MAAa,SAAS,iBAAiB,sBAAsB;;;;AAS7D,MAAa,0BAA2D,EACtE,UACA,SAAS,oBAET,oBAAC,sBAAsB,UAAvB;CAAgC,OAAO;CACpC;CAC8B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getServerContext } from "../serverContext.mjs";
|
|
2
2
|
import { IntlayerServerContext } from "../IntlayerServerProvider.mjs";
|
|
3
|
-
import
|
|
3
|
+
import { internationalization } from "@intlayer/config/built";
|
|
4
4
|
import { bindIntl } from "@intlayer/core/formatters";
|
|
5
5
|
|
|
6
6
|
//#region src/server/format/useIntl.ts
|
|
@@ -34,7 +34,7 @@ import { bindIntl } from "@intlayer/core/formatters";
|
|
|
34
34
|
*/
|
|
35
35
|
const useIntl = (locale) => {
|
|
36
36
|
const currentLocale = getServerContext(IntlayerServerContext);
|
|
37
|
-
return bindIntl(locale ?? currentLocale ??
|
|
37
|
+
return bindIntl(locale ?? currentLocale ?? internationalization?.defaultLocale);
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIntl.mjs","names":[],"sources":["../../../../src/server/format/useIntl.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"useIntl.mjs","names":[],"sources":["../../../../src/server/format/useIntl.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport { bindIntl, type WrappedIntl } from '@intlayer/core/formatters';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { IntlayerServerContext } from '../IntlayerServerProvider';\nimport { getServerContext } from '../serverContext';\n\n/**\n * React client hook that provides a locale-bound `Intl` object.\n *\n * It acts exactly like the native `Intl` object, but acts as a proxy to:\n * 1. Inject the current locale automatically if none is provided.\n * 2. Use the performance-optimized `CachedIntl` under the hood.\n *\n * @example\n * ```tsx\n * const intl = useIntl(); // uses context locale\n *\n * // Standard API, but no need to pass 'en-US' as the first argument\n * const formatted = new intl.NumberFormat({\n * style: 'currency',\n * currency: 'USD'\n * }).format(123.45);\n * ```\n *\n * @example\n * ```tsx\n * const intl = useIntl();\n *\n * // You can still override the locale if needed\n * const date = new intl.DateTimeFormat({ locale: 'fr-FR' }).format(new Date());\n * // or\n * const date2 = new intl.DateTimeFormat('fr-FR').format(new Date());\n * ```\n */\nexport const useIntl = (locale?: LocalesValues): WrappedIntl => {\n const currentLocale = getServerContext<LocalesValues>(IntlayerServerContext);\n\n return bindIntl(\n locale ?? currentLocale ?? internationalization?.defaultLocale\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAa,WAAW,WAAwC;CAC9D,MAAM,gBAAgB,iBAAgC,sBAAsB;AAE5E,QAAO,SACL,UAAU,iBAAiB,sBAAsB,cAClD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getServerContext } from "./serverContext.mjs";
|
|
2
2
|
import { IntlayerServerContext } from "./IntlayerServerProvider.mjs";
|
|
3
3
|
import { useDictionary } from "./useDictionary.mjs";
|
|
4
|
-
import
|
|
4
|
+
import { internationalization } from "@intlayer/config/built";
|
|
5
5
|
|
|
6
6
|
//#region src/server/useDictionaryAsync.ts
|
|
7
7
|
/**
|
|
@@ -10,7 +10,7 @@ import configuration from "@intlayer/config/built";
|
|
|
10
10
|
* If the locale is not provided, it will use the locale from the server context
|
|
11
11
|
*/
|
|
12
12
|
const useDictionaryAsync = async (dictionaryPromise, locale, fallbackLocale) => {
|
|
13
|
-
const localeTarget = locale ?? getServerContext(IntlayerServerContext) ?? fallbackLocale ??
|
|
13
|
+
const localeTarget = locale ?? getServerContext(IntlayerServerContext) ?? fallbackLocale ?? internationalization.defaultLocale;
|
|
14
14
|
return useDictionary(await dictionaryPromise[localeTarget]?.(), localeTarget);
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionaryAsync.mjs","names":[],"sources":["../../../src/server/useDictionaryAsync.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"useDictionaryAsync.mjs","names":[],"sources":["../../../src/server/useDictionaryAsync.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n LocalesValues,\n StrictModeLocaleMap,\n} from '@intlayer/types/module_augmentation';\nimport { IntlayerServerContext } from './IntlayerServerProvider';\nimport { getServerContext } from './serverContext';\nimport { useDictionary } from './useDictionary';\n\n/**\n * On the server side, Hook that transform a dictionary and return the content\n *\n * If the locale is not provided, it will use the locale from the server context\n */\nexport const useDictionaryAsync = async <\n T extends Dictionary,\n L extends LocalesValues = DeclaredLocales,\n>(\n dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>,\n locale?: L,\n fallbackLocale?: DeclaredLocales\n) => {\n const localeTarget =\n locale ??\n getServerContext<LocalesValues>(IntlayerServerContext) ??\n fallbackLocale ??\n internationalization.defaultLocale;\n\n const dictionary = await (dictionaryPromise as any)[localeTarget]?.();\n\n return useDictionary<T, L>(dictionary, localeTarget as L);\n};\n"],"mappings":";;;;;;;;;;;AAgBA,MAAa,qBAAqB,OAIhC,mBACA,QACA,mBACG;CACH,MAAM,eACJ,UACA,iBAAgC,sBAAsB,IACtD,kBACA,qBAAqB;AAIvB,QAAO,cAFY,MAAO,kBAA0B,iBAAiB,EAE9B,aAAkB"}
|
|
@@ -2,7 +2,7 @@ import { getServerContext } from "./serverContext.mjs";
|
|
|
2
2
|
import { IntlayerServerContext } from "./IntlayerServerProvider.mjs";
|
|
3
3
|
import { useDictionary } from "./useDictionary.mjs";
|
|
4
4
|
import { useLoadDynamic } from "./useLoadDynamic.mjs";
|
|
5
|
-
import
|
|
5
|
+
import { internationalization } from "@intlayer/config/built";
|
|
6
6
|
|
|
7
7
|
//#region src/server/useDictionaryDynamic.ts
|
|
8
8
|
/**
|
|
@@ -11,7 +11,7 @@ import configuration from "@intlayer/config/built";
|
|
|
11
11
|
* If the locale is not provided, it will use the locale from the server context
|
|
12
12
|
*/
|
|
13
13
|
const useDictionaryDynamic = (dictionaryPromise, key, locale, fallbackLocale) => {
|
|
14
|
-
const localeTarget = locale ?? getServerContext(IntlayerServerContext) ?? fallbackLocale ??
|
|
14
|
+
const localeTarget = locale ?? getServerContext(IntlayerServerContext) ?? fallbackLocale ?? internationalization.defaultLocale;
|
|
15
15
|
return useDictionary(useLoadDynamic(`${String(key)}.${localeTarget}`, dictionaryPromise[localeTarget]?.()), localeTarget);
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionaryDynamic.mjs","names":[],"sources":["../../../src/server/useDictionaryDynamic.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"useDictionaryDynamic.mjs","names":[],"sources":["../../../src/server/useDictionaryDynamic.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n LocalesValues,\n StrictModeLocaleMap,\n} from '@intlayer/types/module_augmentation';\nimport { IntlayerServerContext } from './IntlayerServerProvider';\nimport { getServerContext } from './serverContext';\nimport { useDictionary } from './useDictionary';\nimport { useLoadDynamic } from './useLoadDynamic';\n\n/**\n * On the server side, Hook that transform a dictionary and return the content\n *\n * If the locale is not provided, it will use the locale from the server context\n */\nexport const useDictionaryDynamic = <\n T extends Dictionary,\n L extends LocalesValues = DeclaredLocales,\n>(\n dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>,\n key: string,\n locale?: L,\n fallbackLocale?: DeclaredLocales\n) => {\n const localeTarget =\n locale ??\n getServerContext<LocalesValues>(IntlayerServerContext) ??\n fallbackLocale ??\n internationalization.defaultLocale;\n\n const dictionary = useLoadDynamic<T>(\n `${String(key)}.${localeTarget}`,\n (dictionaryPromise as any)[localeTarget]?.()\n );\n\n return useDictionary<T, L>(dictionary, localeTarget as L);\n};\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAa,wBAIX,mBACA,KACA,QACA,mBACG;CACH,MAAM,eACJ,UACA,iBAAgC,sBAAsB,IACtD,kBACA,qBAAqB;AAOvB,QAAO,cALY,eACjB,GAAG,OAAO,IAAI,CAAC,GAAG,gBACjB,kBAA0B,iBAAiB,CAC7C,EAEsC,aAAkB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getServerContext } from "./serverContext.mjs";
|
|
2
2
|
import { IntlayerServerContext } from "./IntlayerServerProvider.mjs";
|
|
3
|
-
import
|
|
3
|
+
import { internationalization } from "@intlayer/config/built";
|
|
4
4
|
|
|
5
5
|
//#region src/server/useLocale.ts
|
|
6
6
|
/**
|
|
@@ -9,7 +9,7 @@ import configuration from "@intlayer/config/built";
|
|
|
9
9
|
* If the locale is not provided, it will use the locale from the server context
|
|
10
10
|
*/
|
|
11
11
|
const useLocale = () => {
|
|
12
|
-
const { defaultLocale, locales: availableLocales } =
|
|
12
|
+
const { defaultLocale, locales: availableLocales } = internationalization ?? {};
|
|
13
13
|
return {
|
|
14
14
|
locale: getServerContext(IntlayerServerContext) ?? defaultLocale,
|
|
15
15
|
defaultLocale,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocale.mjs","names":[],"sources":["../../../src/server/useLocale.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"useLocale.mjs","names":[],"sources":["../../../src/server/useLocale.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport type { DeclaredLocales } from '@intlayer/types/module_augmentation';\nimport { IntlayerServerContext } from './IntlayerServerProvider';\nimport { getServerContext } from './serverContext';\n\ntype UseLocaleResult = {\n locale: DeclaredLocales;\n defaultLocale: DeclaredLocales;\n availableLocales: DeclaredLocales[];\n};\n\n/**\n * On the server side, Hook that picking one dictionary by its key and return the content\n *\n * If the locale is not provided, it will use the locale from the server context\n */\nexport const useLocale = (): UseLocaleResult => {\n const { defaultLocale, locales: availableLocales } =\n internationalization ?? {};\n\n const locale = (getServerContext(IntlayerServerContext) ??\n defaultLocale) as DeclaredLocales;\n\n return { locale, defaultLocale, availableLocales };\n};\n"],"mappings":";;;;;;;;;;AAgBA,MAAa,kBAAmC;CAC9C,MAAM,EAAE,eAAe,SAAS,qBAC9B,wBAAwB,EAAE;AAK5B,QAAO;EAAE,QAHO,iBAAiB,sBAAsB,IACrD;EAEe;EAAe;EAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntlayerProvider.d.ts","names":[],"sources":["../../../src/client/IntlayerProvider.tsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"IntlayerProvider.d.ts","names":[],"sources":["../../../src/client/IntlayerProvider.tsx"],"mappings":";;;;;KAiBK,aAAA;EACH,MAAA,EAAQ,aAAA;EACR,SAAA,GAAY,SAAA,EAAW,aAAA;EACvB,aAAA;EACA,eAAA;AAAA;;;;cAMW,qBAAA,EAAqB,OAAA,CAAA,OAAA,CAAA,aAAA;;;;;;cAWrB,kBAAA;AAXb;;;AAAA,KAgBY,qBAAA,GAAwB,iBAAA;EAhBF;AAWlC;;EASE,MAAA,GAAS,aAAA;EAToE;;AAK/E;EAQE,aAAA,GAAgB,aAAA;;;;EAIhB,SAAA,IAAa,MAAA,EAAQ,aAAA;EAZa;;;EAgBlC,aAAA;EAZA;;;EAgBA,eAAA;AAAA;;;;;;;AAWF;;cAAa,uBAAA,EAAyB,EAAA,CAAG,qBAAA;;;AA8EzC;;;;;;;;;;;;;;;;;;cAAa,gBAAA,EAAkB,EAAA,CAAG,qBAAA"}
|
|
@@ -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":";;;;;;cAWa,aAAA;UASZ,UAAA,CAAA,aAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentSelector.d.ts","names":[],"sources":["../../../src/editor/ContentSelector.tsx"],"mappings":";;;;KAMY,oBAAA,GAAuB,SAAA,GACjC,IAAA,CAAK,cAAA,CAAe,cAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"ContentSelector.d.ts","names":[],"sources":["../../../src/editor/ContentSelector.tsx"],"mappings":";;;;KAMY,oBAAA,GAAuB,SAAA,GACjC,IAAA,CAAK,cAAA,CAAe,cAAA;AAAA,cAWT,eAAA,EAAiB,EAAA,CAAG,oBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditor.d.ts","names":[],"sources":["../../../src/editor/useEditor.tsx"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useEditor.d.ts","names":[],"sources":["../../../src/editor/useEditor.tsx"],"mappings":";;AAeA;;;;cAAa,SAAA"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -70,7 +70,7 @@ declare const useMarkdownRenderer: ({
|
|
|
70
70
|
forceInline,
|
|
71
71
|
preserveFrontmatter,
|
|
72
72
|
tagfilter
|
|
73
|
-
}?: RenderMarkdownProps$1) => (content: string) => string | number | bigint | boolean | _$react.
|
|
73
|
+
}?: RenderMarkdownProps$1) => (content: string) => string | number | bigint | boolean | Iterable<_$react.ReactNode> | _$react.JSX.Element | Promise<_$react.ReactNode>;
|
|
74
74
|
/**
|
|
75
75
|
* @deprecated import from react-intlayer/markdown instead
|
|
76
76
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;YAIY,kBAAA,iBAAmC,aAAA,UACnC,uBAAA,CAAwB,CAAA,EAAG,CAAA,EAAG,CAAA;AAAA;;;;AAJe;;;AAAA,cAwD5C,gBAAA,UAAgB,EAAA,CAAA,yBAAA;eAAA,cAAA;;gDAtBX,yBAAA,EAAA,UAAA,GAAA,cAAA,oBAEZ,OAAA,GACN,OAAA,CAAA,EAAA,CAAA,OAAA,CAAA,cAAA,CAAA,WAAA,OAAA,OAAA,CAAA,SAAA,GAAA,OAAA,CAAA,OAAA,CAAA,SAAA;AAAA;aAAA,OAAA,CAAA,SAAA;AAAA;;;;cAuBa,kBAAA;eAAwC,cAAA;+CAtCP,yBAAA,EAAA,UAAA,GAAA,cAAA,oBAC5B,OAAA,GACI,OAAA,CAAA,EAAA,CAAA,OAAA,CAAA,cAAA,CAAA,WAAA,OAAA,OAAA,CAAA,SAAA,GAAA,OAAA,CAAA,OAAA,CAAA,SAAA;AAAA;;;;KAwCV,uBAAA,GAA0B,yBAAA;;AARtC;;cAYa,cAAA,GAAc,OAAA;EAAA,UAAA;EAAA,OAAA;EAAA,UAAA;EAAA,WAAA;EAAA,mBAAA;EAAA;AAAA,IAAA,qBAAA,KAAA,OAAA,CAAA,GAAA,CAAA,OAAA;;;;cAId,mBAAA;EAAmB,UAAA;EAAA,OAAA;EAAA,UAAA;EAAA,WAAA;EAAA,mBAAA;EAAA;AAAA,IAAA,qBAAA,MAa44C,OAAA,kDAAe,OAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/index.ts"],"mappings":";;;;;;;;;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135
135
|
tagfilter
|
|
136
|
-
}?: RenderMarkdownProps) => (content: string) => string | number | bigint | boolean |
|
|
136
|
+
}?: RenderMarkdownProps) => (content: string) => string | number | bigint | boolean | Iterable<ReactNode> | JSX.Element | Promise<ReactNode>;
|
|
137
137
|
/**
|
|
138
138
|
* Props for the MarkdownRenderer component.
|
|
139
139
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownRenderer.d.ts","names":[],"sources":["../../../src/markdown/MarkdownRenderer.tsx"],"mappings":";;;;;;;AA6BA;;;;;;;;;;;;;;;;;KAAY,mBAAA,GAAsB,uBAAA;EAwBO;AA4BzC;;;;;;;;;;;;EAtCE,UAAA,GAAa,cAAA;EAuCb;;;;;;;;;EA7BA,OAAA,GAAU,EAAA,CAAG,cAAA,CAAe,WAAA;AAAA;;;;;;;;AAkG9B;;;;;;;;;;;;;;;;;;cAtEa,cAAA,GACX,OAAA;EACA,UAAA;EAAA,OAAA;EAAA,UAAA;EAAA,WAAA;EAAA,mBAAA;EAAA;AAAA,IAOG,mBAAA,KACF,GAAA,CAAI,OAAA;;;;;;;;;;;;;;;;;;;;;AA+GP;;;;;;;;;;;;;;;;;;;;;;;;;cAnDa,mBAAA;EAAuB,UAAA;EAAA,OAAA;EAAA,UAAA;EAAA,WAAA;EAAA,mBAAA;EAAA;AAAA,IAOjC,mBAAA,MAGO,OAAA,kDAAe,
|
|
1
|
+
{"version":3,"file":"MarkdownRenderer.d.ts","names":[],"sources":["../../../src/markdown/MarkdownRenderer.tsx"],"mappings":";;;;;;;AA6BA;;;;;;;;;;;;;;;;;KAAY,mBAAA,GAAsB,uBAAA;EAwBO;AA4BzC;;;;;;;;;;;;EAtCE,UAAA,GAAa,cAAA;EAuCb;;;;;;;;;EA7BA,OAAA,GAAU,EAAA,CAAG,cAAA,CAAe,WAAA;AAAA;;;;;;;;AAkG9B;;;;;;;;;;;;;;;;;;cAtEa,cAAA,GACX,OAAA;EACA,UAAA;EAAA,OAAA;EAAA,UAAA;EAAA,WAAA;EAAA,mBAAA;EAAA;AAAA,IAOG,mBAAA,KACF,GAAA,CAAI,OAAA;;;;;;;;;;;;;;;;;;;;;AA+GP;;;;;;;;;;;;;;;;;;;;;;;;;cAnDa,mBAAA;EAAuB,UAAA;EAAA,OAAA;EAAA,UAAA;EAAA,WAAA;EAAA,mBAAA;EAAA;AAAA,IAOjC,mBAAA,MAGO,OAAA,kDAAe,QAAA,CAAA,SAAA,IAAA,GAAA,CAAA,OAAA,GAAA,OAAA,CAAA,SAAA;;;;AAmJzB;;;;;;;;;;;;KA1GY,qBAAA,GAAwB,mBAAA;;;;;;;;;;;EAWlC,QAAA;;;;;;;;;;;;;;;;;;;;;EAqBA,cAAA,IACE,QAAA,UACA,OAAA;IACE,UAAA,GAAa,cAAA;IACb,OAAA,GAAU,EAAA;IACV,UAAA;IACA,WAAA;IACA,mBAAA;IACA,SAAA;EAAA,MAEC,SAAA,GAAY,OAAA,CAAQ,SAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAgEd,gBAAA,EAAkB,EAAA,CAAG,qBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","names":[],"sources":["../../src/plugins.tsx"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","names":[],"sources":["../../src/plugins.tsx"],"mappings":";;;;;;;;;;;AAgGA;KAAY,gBAAA,MAAsB,CAAA,2BAC9B,YAAA,CAAa,CAAA;;cAIJ,mBAAA,EAAqB,OAAA;;;;KA+BtB,aAAA,MAAmB,CAAA;EAC7B,KAAA;EACA,GAAA;AAAA,IAEE,SAAA;;cAIS,gBAAA,EAAkB,OAAA;;AAvC/B;;KAyEY,aAAA,MAAmB,CAAA;EAC7B,QAAA,EAAU,QAAA;EAAA,CACT,SAAA,CAAU,SAAA;EACX,MAAA;AAAA,uBAEqB,CAAA,qBAAs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C,UAAA,GACX,MAAA,GAAS,aAAA,EACT,QAAA,eACC,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-intlayer",
|
|
3
|
-
"version": "8.6.
|
|
3
|
+
"version": "8.6.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your React applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -123,14 +123,14 @@
|
|
|
123
123
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
124
124
|
},
|
|
125
125
|
"dependencies": {
|
|
126
|
-
"@intlayer/api": "8.6.
|
|
127
|
-
"@intlayer/config": "8.6.
|
|
128
|
-
"@intlayer/core": "8.6.
|
|
129
|
-
"@intlayer/dictionaries-entry": "8.6.
|
|
130
|
-
"@intlayer/editor": "8.6.
|
|
131
|
-
"@intlayer/editor-react": "8.6.
|
|
132
|
-
"@intlayer/types": "8.6.
|
|
133
|
-
"intlayer": "8.6.
|
|
126
|
+
"@intlayer/api": "8.6.4",
|
|
127
|
+
"@intlayer/config": "8.6.4",
|
|
128
|
+
"@intlayer/core": "8.6.4",
|
|
129
|
+
"@intlayer/dictionaries-entry": "8.6.4",
|
|
130
|
+
"@intlayer/editor": "8.6.4",
|
|
131
|
+
"@intlayer/editor-react": "8.6.4",
|
|
132
|
+
"@intlayer/types": "8.6.4",
|
|
133
|
+
"intlayer": "8.6.4"
|
|
134
134
|
},
|
|
135
135
|
"devDependencies": {
|
|
136
136
|
"@craco/types": "7.1.0",
|