react-intlayer 8.4.0 → 8.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/cjs/client/format/useIntl.cjs.map +1 -1
  2. package/dist/cjs/client/useDictionaryAsync.cjs.map +1 -1
  3. package/dist/cjs/client/useDictionaryDynamic.cjs.map +1 -1
  4. package/dist/cjs/client/useI18n.cjs.map +1 -1
  5. package/dist/cjs/client/useIntlayer.cjs.map +1 -1
  6. package/dist/cjs/client/useRewriteURL.cjs.map +1 -1
  7. package/dist/cjs/editor/useEditor.cjs +1 -1
  8. package/dist/cjs/editor/useEditor.cjs.map +1 -1
  9. package/dist/cjs/markdown/MarkdownRenderer.cjs +1 -1
  10. package/dist/cjs/markdown/MarkdownRenderer.cjs.map +1 -1
  11. package/dist/cjs/markdown/MarkdownRendererPlugin.cjs +1 -1
  12. package/dist/cjs/markdown/MarkdownRendererPlugin.cjs.map +1 -1
  13. package/dist/cjs/markdown/index.cjs +1 -1
  14. package/dist/cjs/plugins.cjs +1 -1
  15. package/dist/cjs/plugins.cjs.map +1 -1
  16. package/dist/cjs/server/format/useIntl.cjs.map +1 -1
  17. package/dist/cjs/server/useDictionary.cjs.map +1 -1
  18. package/dist/cjs/server/useDictionaryAsync.cjs.map +1 -1
  19. package/dist/cjs/server/useDictionaryDynamic.cjs.map +1 -1
  20. package/dist/esm/client/format/useIntl.mjs.map +1 -1
  21. package/dist/esm/client/useDictionaryAsync.mjs.map +1 -1
  22. package/dist/esm/client/useDictionaryDynamic.mjs.map +1 -1
  23. package/dist/esm/client/useI18n.mjs.map +1 -1
  24. package/dist/esm/client/useIntlayer.mjs.map +1 -1
  25. package/dist/esm/client/useRewriteURL.mjs.map +1 -1
  26. package/dist/esm/editor/useEditor.mjs +1 -1
  27. package/dist/esm/editor/useEditor.mjs.map +1 -1
  28. package/dist/esm/markdown/MarkdownRenderer.mjs +1 -1
  29. package/dist/esm/markdown/MarkdownRenderer.mjs.map +1 -1
  30. package/dist/esm/markdown/MarkdownRendererPlugin.mjs +1 -1
  31. package/dist/esm/markdown/MarkdownRendererPlugin.mjs.map +1 -1
  32. package/dist/esm/markdown/index.mjs +1 -1
  33. package/dist/esm/plugins.mjs +1 -1
  34. package/dist/esm/plugins.mjs.map +1 -1
  35. package/dist/esm/server/format/useIntl.mjs.map +1 -1
  36. package/dist/esm/server/useDictionary.mjs.map +1 -1
  37. package/dist/esm/server/useDictionaryAsync.mjs.map +1 -1
  38. package/dist/esm/server/useDictionaryDynamic.mjs.map +1 -1
  39. package/dist/types/client/format/useIntl.d.ts +2 -58
  40. package/dist/types/client/format/useIntl.d.ts.map +1 -1
  41. package/dist/types/client/format/useList.d.ts +5 -1
  42. package/dist/types/client/format/useList.d.ts.map +1 -1
  43. package/dist/types/client/useDictionaryAsync.d.ts.map +1 -1
  44. package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -1
  45. package/dist/types/client/useI18n.d.ts.map +1 -1
  46. package/dist/types/client/useIntlayer.d.ts.map +1 -1
  47. package/dist/types/client/useRewriteURL.d.ts.map +1 -1
  48. package/dist/types/html/HTMLRenderer.d.ts +4 -4
  49. package/dist/types/markdown/MarkdownRenderer.d.ts.map +1 -1
  50. package/dist/types/markdown/MarkdownRendererPlugin.d.ts +1 -5
  51. package/dist/types/markdown/MarkdownRendererPlugin.d.ts.map +1 -1
  52. package/dist/types/markdown/index.d.ts +2 -2
  53. package/dist/types/plugins.d.ts.map +1 -1
  54. package/dist/types/server/format/useIntl.d.ts +2 -58
  55. package/dist/types/server/format/useIntl.d.ts.map +1 -1
  56. package/dist/types/server/useDictionary.d.ts.map +1 -1
  57. package/dist/types/server/useDictionaryAsync.d.ts.map +1 -1
  58. package/dist/types/server/useDictionaryDynamic.d.ts.map +1 -1
  59. package/package.json +9 -9
  60. package/dist/cjs/markdown/MarkdownMetadataRendererInternal.cjs +0 -2
  61. package/dist/cjs/markdown/MarkdownMetadataRendererInternal.cjs.map +0 -1
  62. package/dist/esm/markdown/MarkdownMetadataRendererInternal.mjs +0 -2
  63. package/dist/esm/markdown/MarkdownMetadataRendererInternal.mjs.map +0 -1
  64. package/dist/types/markdown/MarkdownMetadataRendererInternal.d.ts +0 -16
  65. package/dist/types/markdown/MarkdownMetadataRendererInternal.d.ts.map +0 -1
@@ -1,2 +1,2 @@
1
- import{ContentSelector as e}from"./editor/ContentSelector.mjs";import{HTMLRendererPlugin as t}from"./html/HTMLRendererPlugin.mjs";import{renderIntlayerNode as n}from"./IntlayerNode.mjs";import{MarkdownMetadataRenderer as r,MarkdownRendererPlugin as i}from"./markdown/MarkdownRendererPlugin.mjs";import{renderReactElement as a}from"./reactElement/renderReactElement.mjs";import o from"@intlayer/config/built";import{conditionPlugin as s,enumerationPlugin as c,filePlugin as l,genderPlugin as u,nestedPlugin as d,splitInsertionTemplate as f,translationPlugin as p}from"@intlayer/core/interpreter";import{getMarkdownMetadata as m}from"@intlayer/core/markdown";import{NodeType as h}from"@intlayer/types/nodeType";import{Fragment as g,createElement as _}from"react";import{jsx as v}from"react/jsx-runtime";const y={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(t,{plugins:r,...i})=>n({...i,value:i.children,children:o?.editor.enabled?v(e,{...i,children:i.children}):i.children})},b={id:`react-node-plugin`,canHandle:e=>typeof e==`object`&&e?.props!==void 0&&e.key!==void 0,transform:(t,{plugins:r,...i})=>n({...i,value:`[[react-element]]`,children:o?.editor.enabled?v(e,{...i,children:a(t)}):a(t)})},x=(e,t)=>{let n=f(e,t);return n.isSimple?n.parts:_(g,null,...n.parts.map((e,t)=>_(g,{key:t},e)))},S={id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===h.Insertion,transform:(e,t,n)=>{let r=[...t.keyPath,{type:h.Insertion}],i=e[h.Insertion],a={id:`insertion-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,n,r)=>{let i=r(e,{...n,children:e,plugins:[...(t.plugins??[]).filter(e=>e.id!==`intlayer-node-plugin`)]});return e=>{let a=x(i,e);return r(a,{...n,plugins:t.plugins,children:a})}}},o=n(i,{...t,children:i,keyPath:r,plugins:[a,...t.plugins??[]]});return typeof i==`object`&&i&&`nodeType`in i&&[h.Enumeration,h.Condition].includes(i.nodeType)?e=>t=>{let n=o(t);return typeof n==`function`?n(e):n}:o}},C={id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(t,a,o)=>{let{plugins:s,...c}=a,l=o(m(t),{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(i,a)=>n({...a,value:i,children:v(e,{...c,children:v(r,{...c,metadataKeyPath:a.keyPath,children:t})})})}],dictionaryKey:c.dictionaryKey,keyPath:[]}),u=r=>n({...a,value:t,children:v(e,{...c,children:v(i,{...c,components:r,children:t})}),additionalProps:{metadata:l}}),d=u();return new Proxy(d,{get(e,n,r){return n===`value`?t:n===`metadata`?l:n===`use`?e=>u(e):Reflect.get(e,n,r)}})}},w={id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===h.Markdown,transform:(e,t,n)=>{let r=[...t.keyPath,{type:h.Markdown}],i=e[h.Markdown];return n(i,{...t,children:i,keyPath:r,plugins:[C,...t.plugins??[]]})}},T={id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===h.HTML,transform:(e,n)=>{let r=e[h.HTML],{plugins:i,...a}=n,o=e=>_(t,{...a,html:r,userComponents:e}),s=o();return new Proxy(s,{get(e,t,n){return t===`value`?r:t===`use`?e=>o(e):Reflect.get(e,t,n)}})}},E=(e,t=!0)=>[p(e??o.internationalization.defaultLocale,t?o.internationalization.defaultLocale:void 0),c,s,d(e??o.internationalization.defaultLocale),l,u,y,b,S,w,T];export{E as getPlugins,T as htmlPlugin,S as insertionPlugin,y as intlayerNodePlugins,w as markdownPlugin,C as markdownStringPlugin,b as reactNodePlugins};
1
+ import{ContentSelector as e}from"./editor/ContentSelector.mjs";import{HTMLRendererPlugin as t}from"./html/HTMLRendererPlugin.mjs";import{renderIntlayerNode as n}from"./IntlayerNode.mjs";import{MarkdownRendererPlugin as r}from"./markdown/MarkdownRendererPlugin.mjs";import{renderReactElement as i}from"./reactElement/renderReactElement.mjs";import a from"@intlayer/config/built";import{conditionPlugin as o,enumerationPlugin as s,filePlugin as c,genderPlugin as l,nestedPlugin as u,splitInsertionTemplate as d,translationPlugin as f}from"@intlayer/core/interpreter";import{getMarkdownMetadata as p}from"@intlayer/core/markdown";import{NodeType as m}from"@intlayer/types/nodeType";import{Fragment as h,createElement as g}from"react";import{jsx as _}from"react/jsx-runtime";const v={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(t,{plugins:r,...i})=>n({...i,value:i.children,children:a?.editor.enabled?_(e,{...i,children:i.children}):i.children})},y={id:`react-node-plugin`,canHandle:e=>typeof e==`object`&&e?.props!==void 0&&e.key!==void 0,transform:(t,{plugins:r,...o})=>n({...o,value:`[[react-element]]`,children:a?.editor.enabled?_(e,{...o,children:i(t)}):i(t)})},b=(e,t)=>{let n=d(e,t);return n.isSimple?n.parts:g(h,null,...n.parts.map((e,t)=>g(h,{key:t},e)))},x={id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===m.Insertion,transform:(e,t,n)=>{let r=[...t.keyPath,{type:m.Insertion}],i=e[m.Insertion],a={id:`insertion-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,n,r)=>{let i=r(e,{...n,children:e,plugins:[...(t.plugins??[]).filter(e=>e.id!==`intlayer-node-plugin`)]});return e=>{let a=b(i,e);return r(a,{...n,plugins:t.plugins,children:a})}}},o=n(i,{...t,children:i,keyPath:r,plugins:[a,...t.plugins??[]]});return typeof i==`object`&&i&&`nodeType`in i&&[m.Enumeration,m.Condition].includes(i.nodeType)?e=>t=>{let n=o(t);return typeof n==`function`?n(e):n}:o}},S={id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(t,i,o)=>{let{plugins:s,...c}=i,l=o(p(t),{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(r,i)=>n({...i,value:r,children:a?.editor.enabled?_(e,{...c,children:t}):t})}],dictionaryKey:c.dictionaryKey,keyPath:[]}),u=o=>n({...i,value:t,children:a.editor.enabled?_(e,{...c,children:_(r,{...c,components:o,children:t})}):_(r,{...c,components:o,children:t}),additionalProps:{metadata:l}}),d=u();return new Proxy(d,{get(e,n,r){return n===`value`?t:n===`metadata`?l:n===`use`?e=>u(e):Reflect.get(e,n,r)}})}},C={id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===m.Markdown,transform:(e,t,n)=>{let r=[...t.keyPath,{type:m.Markdown}],i=e[m.Markdown];return n(i,{...t,children:i,keyPath:r,plugins:[S,...t.plugins??[]]})}},w={id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===m.HTML,transform:(e,n)=>{let r=e[m.HTML],{plugins:i,...a}=n,o=e=>g(t,{...a,html:r,userComponents:e}),s=o();return new Proxy(s,{get(e,t,n){return t===`value`?r:t===`use`?e=>o(e):Reflect.get(e,t,n)}})}},T=(e,t=!0)=>[f(e??a.internationalization.defaultLocale,t?a.internationalization.defaultLocale:void 0),s,o,u(e??a.internationalization.defaultLocale),c,l,v,y,x,C,w];export{T as getPlugins,w as htmlPlugin,x as insertionPlugin,v as intlayerNodePlugins,C as markdownPlugin,S as markdownStringPlugin,y as reactNodePlugins};
2
2
  //# sourceMappingURL=plugins.mjs.map
@@ -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 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 { NodeType } from '@intlayer/types/nodeType';\nimport {\n createElement,\n Fragment,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { ContentSelector } from './editor/ContentSelector';\nimport { HTMLRendererPlugin } from './html';\nimport type { HTMLComponents } from './html/HTMLComponentTypes';\nimport { type IntlayerNode, renderIntlayerNode } from './IntlayerNode';\nimport { MarkdownMetadataRenderer, MarkdownRendererPlugin } from './markdown';\nimport { renderReactElement } from './reactElement/renderReactElement';\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}>{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 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}>{renderReactElement(node)}</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 [NodeType.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 id: 'insertion-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Insertion,\n transform: (node: InsertionContent, props, deepTransformNode) => {\n const newKeyPath: KeyPath[] = [\n ...props.keyPath,\n {\n type: NodeType.Insertion,\n },\n ];\n\n const children = node[NodeType.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 [NodeType.Enumeration, NodeType.Condition].includes(\n children.nodeType as NodeType\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 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 <ContentSelector {...rest}>\n <MarkdownMetadataRenderer\n {...rest}\n metadataKeyPath={props.keyPath}\n >\n {node}\n </MarkdownMetadataRenderer>\n </ContentSelector>\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 <ContentSelector {...rest}>\n <MarkdownRendererPlugin {...rest} components={components}>\n {node}\n </MarkdownRendererPlugin>\n </ContentSelector>\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 [NodeType.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 === NodeType.Markdown,\n transform: (node: MarkdownContent, props, deepTransformNode) => {\n const newKeyPath: KeyPath[] = [\n ...props.keyPath,\n {\n type: NodeType.Markdown,\n },\n ];\n\n const children = node[NodeType.Markdown];\n\n return deepTransformNode(children, {\n ...props,\n children,\n keyPath: newKeyPath,\n plugins: [markdownStringPlugin, ...(props.plugins ?? [])],\n });\n },\n};\n\n/** ---------------------------------------------\n * HTML PLUGIN\n * --------------------------------------------- */\n\n/**\n * HTML conditional type 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 [NodeType.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 id: 'html-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.HTML,\n\n transform: (node: HTMLContent<string>, props) => {\n const html = node[NodeType.HTML];\n const { plugins, ...rest } = props;\n\n // Type-safe render function that accepts properly typed components\n const render = (userComponents?: HTMLComponents): ReactNode =>\n createElement(HTMLRendererPlugin, { ...rest, html, userComponents });\n\n const element = render() 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) => 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 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 reactNodePlugins,\n insertionPlugin,\n markdownPlugin,\n htmlPlugin,\n];\n"],"mappings":"iyBA+CA,MAAa,EAA+B,CAC1C,GAAI,uBACJ,UAAY,GACV,OAAO,GAAS,UAChB,OAAO,GAAS,UAChB,OAAO,GAAS,SAClB,WACE,EACA,CACE,UACA,GAAG,KAGL,EAAmB,CACjB,GAAG,EACH,MAAO,EAAK,SACZ,SAAU,GAAe,OAAO,QAC9B,EAAC,EAAD,CAAiB,GAAI,WAAO,EAAK,SAA2B,CAAA,CAE5D,EAAK,SAER,CAAC,CACL,CAcY,EAA4B,CACvC,GAAI,oBACJ,UAAY,GACV,OAAO,GAAS,UACT,GAAM,QAAU,QAChB,EAAK,MAAQ,OAEtB,WACE,EACA,CACE,UACA,GAAG,KAGL,EAAmB,CACjB,GAAG,EACH,MAAO,oBACP,SAAU,GAAe,OAAO,QAC9B,EAAC,EAAD,CAAiB,GAAI,WAAO,EAAmB,EAAK,CAAmB,CAAA,CAEvE,EAAmB,EAAK,CAE3B,CAAC,CACL,CAqBK,GACJ,EACA,IACc,CACd,IAAM,EAAS,EAAuB,EAAU,EAAO,CAQvD,OANI,EAAO,SAEF,EAAO,MAIT,EACL,EACA,KACA,GAAI,EAAO,MAAgB,KAAK,EAAM,IACpC,EAAc,EAAU,CAAE,IAAK,EAAO,CAAE,EAAK,CAC9C,CACF,EAIU,EAA2B,CACtC,GAAI,mBACJ,UAAY,GACV,OAAO,GAAS,UAAY,GAAM,WAAa,EAAS,UAC1D,WAAY,EAAwB,EAAO,IAAsB,CAC/D,IAAM,EAAwB,CAC5B,GAAG,EAAM,QACT,CACE,KAAM,EAAS,UAChB,CACF,CAEK,EAAW,EAAK,EAAS,W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AAU,EAAc,qBAAqB,cAC7C,EAAW,EAAc,qBAAqB,cAAgB,IAAA,GAC/D,CACD,EACA,EACA,EAAa,GAAU,EAAc,qBAAqB,cAAc,CACxE,EACA,EACA,EACA,EACA,EACA,EACA,EACD"}
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 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 { NodeType } from '@intlayer/types/nodeType';\nimport {\n createElement,\n Fragment,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { ContentSelector } from './editor/ContentSelector';\nimport { HTMLRendererPlugin } from './html';\nimport type { HTMLComponents } from './html/HTMLComponentTypes';\nimport { type IntlayerNode, renderIntlayerNode } from './IntlayerNode';\nimport { MarkdownRendererPlugin } from './markdown';\nimport { renderReactElement } from './reactElement/renderReactElement';\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}>{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 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}>{renderReactElement(node)}</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 [NodeType.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 id: 'insertion-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Insertion,\n transform: (node: InsertionContent, props, deepTransformNode) => {\n const newKeyPath: KeyPath[] = [\n ...props.keyPath,\n {\n type: NodeType.Insertion,\n },\n ];\n\n const children = node[NodeType.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 [NodeType.Enumeration, NodeType.Condition].includes(\n children.nodeType as NodeType\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 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 <MarkdownRendererPlugin {...rest} components={components}>\n {node}\n </MarkdownRendererPlugin>\n </ContentSelector>\n ) : (\n <MarkdownRendererPlugin {...rest} components={components}>\n {node}\n </MarkdownRendererPlugin>\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 [NodeType.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 === NodeType.Markdown,\n transform: (node: MarkdownContent, props, deepTransformNode) => {\n const newKeyPath: KeyPath[] = [\n ...props.keyPath,\n {\n type: NodeType.Markdown,\n },\n ];\n\n const children = node[NodeType.Markdown];\n\n return deepTransformNode(children, {\n ...props,\n children,\n keyPath: newKeyPath,\n plugins: [markdownStringPlugin, ...(props.plugins ?? [])],\n });\n },\n};\n\n/** ---------------------------------------------\n * HTML PLUGIN\n * --------------------------------------------- */\n\n/**\n * HTML conditional type 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 [NodeType.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 id: 'html-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.HTML,\n\n transform: (node: HTMLContent<string>, props) => {\n const html = node[NodeType.HTML];\n const { plugins, ...rest } = props;\n\n // Type-safe render function that accepts properly typed components\n const render = (userComponents?: HTMLComponents): ReactNode =>\n createElement(HTMLRendererPlugin, { ...rest, html, userComponents });\n\n const element = render() 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) => 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 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 reactNodePlugins,\n insertionPlugin,\n markdownPlugin,\n htmlPlugin,\n];\n"],"mappings":"mwBA+CA,MAAa,EAA+B,CAC1C,GAAI,uBACJ,UAAY,GACV,OAAO,GAAS,UAChB,OAAO,GAAS,UAChB,OAAO,GAAS,SAClB,WACE,EACA,CACE,UACA,GAAG,KAGL,EAAmB,CACjB,GAAG,EACH,MAAO,EAAK,SACZ,SAAU,GAAe,OAAO,QAC9B,EAAC,EAAD,CAAiB,GAAI,WAAO,EAAK,SAA2B,CAAA,CAE5D,EAAK,SAER,CAAC,CACL,CAcY,EAA4B,CACvC,GAAI,oBACJ,UAAY,GACV,OAAO,GAAS,UACT,GAAM,QAAU,QAChB,EAAK,MAAQ,OAEtB,WACE,EACA,CACE,UACA,GAAG,KAGL,EAAmB,CACjB,GAAG,EACH,MAAO,oBACP,SAAU,GAAe,OAAO,QAC9B,EAAC,EAAD,CAAiB,GAAI,WAAO,EAAmB,EAAK,CAAmB,CAAA,CAEvE,EAAmB,EAAK,CAE3B,CAAC,CACL,CAqBK,GACJ,EACA,IACc,CACd,IAAM,EAAS,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AAM,WAAa,EAAS,KAE1D,WAAY,EAA2B,IAAU,CAC/C,IAAM,EAAO,EAAK,EAAS,MACrB,CAAE,UAAS,GAAG,GAAS,EAGvB,EAAU,GACd,EAAc,EAAoB,CAAE,GAAG,EAAM,OAAM,iBAAgB,CAAC,CAEhE,EAAU,GAAQ,CAExB,OAAO,IAAI,MAAM,EAAS,CACxB,IAAI,EAAQ,EAAM,EAAU,CAU1B,OATI,IAAS,QACJ,EAGL,IAAS,MAEH,GAAoC,EAAO,EAAe,CAG7D,QAAQ,IAAI,EAAQ,EAAM,EAAS,EAE7C,CAAC,EAEL,CAuCY,GACX,EACA,EAAoB,KACN,CACd,EACE,GAAU,EAAc,qBAAqB,cAC7C,EAAW,EAAc,qBAAqB,cAAgB,IAAA,GAC/D,CACD,EACA,EACA,EAAa,GAAU,EAAc,qBAAqB,cAAc,CACxE,EACA,EACA,EACA,EACA,EACA,EACA,EACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"useIntl.mjs","names":[],"sources":["../../../../src/server/format/useIntl.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { bindIntl } 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) => {\n const currentLocale = getServerContext<LocalesValues>(IntlayerServerContext);\n\n return bindIntl(\n locale ??\n currentLocale ??\n configuration?.internationalization?.defaultLocale\n );\n};\n"],"mappings":"yNAkCA,MAAa,EAAW,GAA2B,CACjD,IAAM,EAAgB,EAAgC,EAAsB,CAE5E,OAAO,EACL,GACE,GACA,GAAe,sBAAsB,cACxC"}
1
+ {"version":3,"file":"useIntl.mjs","names":[],"sources":["../../../../src/server/format/useIntl.ts"],"sourcesContent":["import configuration 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 ??\n currentLocale ??\n configuration?.internationalization?.defaultLocale\n );\n};\n"],"mappings":"yNAkCA,MAAa,EAAW,GAAwC,CAC9D,IAAM,EAAgB,EAAgC,EAAsB,CAE5E,OAAO,EACL,GACE,GACA,GAAe,sBAAsB,cACxC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionary.mjs","names":[],"sources":["../../../src/server/useDictionary.ts"],"sourcesContent":["import type { DeclaredLocales, LocalesValues } from '@intlayer/types/module_augmentation';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { getDictionary } from '../getDictionary';\nimport { IntlayerServerContext } from './IntlayerServerProvider';\nimport { getServerContext } from './serverContext';\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 useDictionary = <\n T extends Dictionary,\n L extends LocalesValues = DeclaredLocales,\n>(\n dictionary: T,\n locale?: L,\n fallbackLocale?: DeclaredLocales\n) => {\n const localeTarget =\n locale ??\n getServerContext<LocalesValues>(IntlayerServerContext) ??\n fallbackLocale;\n\n return getDictionary<T, L>(dictionary, localeTarget as L);\n};\n"],"mappings":"iLAWA,MAAa,GAIX,EACA,EACA,IAOO,EAAoB,EAJzB,GACA,EAAgC,EAAsB,EACtD,EAEuD"}
1
+ {"version":3,"file":"useDictionary.mjs","names":[],"sources":["../../../src/server/useDictionary.ts"],"sourcesContent":["import type { Dictionary } from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { getDictionary } from '../getDictionary';\nimport { IntlayerServerContext } from './IntlayerServerProvider';\nimport { getServerContext } from './serverContext';\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 useDictionary = <\n T extends Dictionary,\n L extends LocalesValues = DeclaredLocales,\n>(\n dictionary: T,\n locale?: L,\n fallbackLocale?: DeclaredLocales\n) => {\n const localeTarget =\n locale ??\n getServerContext<LocalesValues>(IntlayerServerContext) ??\n fallbackLocale;\n\n return getDictionary<T, L>(dictionary, localeTarget as L);\n};\n"],"mappings":"iLAcA,MAAa,GAIX,EACA,EACA,IAOO,EAAoB,EAJzB,GACA,EAAgC,EAAsB,EACtD,EAEuD"}
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionaryAsync.mjs","names":[],"sources":["../../../src/server/useDictionaryAsync.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { DeclaredLocales, LocalesValues, StrictModeLocaleMap } from '@intlayer/types/module_augmentation';\nimport type { Dictionary } from '@intlayer/types/dictionary';\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 configuration?.internationalization.defaultLocale;\n\n const dictionary = await (dictionaryPromise as any)[localeTarget]?.();\n\n return useDictionary<T, L>(dictionary, localeTarget as L);\n};\n"],"mappings":"sNAYA,MAAa,EAAqB,MAIhC,EACA,EACA,IACG,CACH,IAAM,EACJ,GACA,EAAgC,EAAsB,EACtD,GACA,GAAe,qBAAqB,cAItC,OAAO,EAFY,MAAO,EAA0B,MAAiB,CAE9B,EAAkB"}
1
+ {"version":3,"file":"useDictionaryAsync.mjs","names":[],"sources":["../../../src/server/useDictionaryAsync.ts"],"sourcesContent":["import configuration 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 configuration?.internationalization.defaultLocale;\n\n const dictionary = await (dictionaryPromise as any)[localeTarget]?.();\n\n return useDictionary<T, L>(dictionary, localeTarget as L);\n};\n"],"mappings":"sNAgBA,MAAa,EAAqB,MAIhC,EACA,EACA,IACG,CACH,IAAM,EACJ,GACA,EAAgC,EAAsB,EACtD,GACA,GAAe,qBAAqB,cAItC,OAAO,EAFY,MAAO,EAA0B,MAAiB,CAE9B,EAAkB"}
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionaryDynamic.mjs","names":[],"sources":["../../../src/server/useDictionaryDynamic.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { DeclaredLocales, LocalesValues, StrictModeLocaleMap } from '@intlayer/types/module_augmentation';\nimport type { Dictionary } from '@intlayer/types/dictionary';\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 configuration?.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":"4QAaA,MAAa,GAIX,EACA,EACA,EACA,IACG,CACH,IAAM,EACJ,GACA,EAAgC,EAAsB,EACtD,GACA,GAAe,qBAAqB,cAOtC,OAAO,EALY,EACjB,GAAG,OAAO,EAAI,CAAC,GAAG,IACjB,EAA0B,MAAiB,CAC7C,CAEsC,EAAkB"}
1
+ {"version":3,"file":"useDictionaryDynamic.mjs","names":[],"sources":["../../../src/server/useDictionaryDynamic.ts"],"sourcesContent":["import configuration 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 configuration?.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":"4QAiBA,MAAa,GAIX,EACA,EACA,EACA,IACG,CACH,IAAM,EACJ,GACA,EAAgC,EAAsB,EACtD,GACA,GAAe,qBAAqB,cAOtC,OAAO,EALY,EACjB,GAAG,OAAO,EAAI,CAAC,GAAG,IACjB,EAA0B,MAAiB,CAC7C,CAEsC,EAAkB"}
@@ -1,4 +1,5 @@
1
1
  import { LocalesValues } from "@intlayer/types/module_augmentation";
2
+ import { WrappedIntl } from "@intlayer/core/formatters";
2
3
 
3
4
  //#region src/client/format/useIntl.d.ts
4
5
  /**
@@ -29,64 +30,7 @@ import { LocalesValues } from "@intlayer/types/module_augmentation";
29
30
  * const date2 = new intl.DateTimeFormat('fr-FR').format(new Date());
30
31
  * ```
31
32
  */
32
- declare const useIntl: (locale?: LocalesValues) => {
33
- Collator: {
34
- new (locales?: LocalesValues, options?: Intl.CollatorOptions): Intl.Collator;
35
- new (options?: Intl.CollatorOptions & {
36
- locale?: LocalesValues;
37
- }): Intl.Collator;
38
- };
39
- NumberFormat: {
40
- new (locales?: LocalesValues, options?: Intl.NumberFormatOptions): Intl.NumberFormat;
41
- new (options?: Intl.NumberFormatOptions & {
42
- locale?: LocalesValues;
43
- }): Intl.NumberFormat;
44
- };
45
- DateTimeFormat: {
46
- new (locales?: LocalesValues, options?: Intl.DateTimeFormatOptions): Intl.DateTimeFormat;
47
- new (options?: Intl.DateTimeFormatOptions & {
48
- locale?: LocalesValues;
49
- }): Intl.DateTimeFormat;
50
- };
51
- getCanonicalLocales: typeof Intl.getCanonicalLocales;
52
- readonly PluralRules: {
53
- new (locales?: LocalesValues, options?: Intl.PluralRulesOptions): Intl.PluralRules;
54
- new (options?: Intl.PluralRulesOptions & {
55
- locale?: LocalesValues;
56
- }): Intl.PluralRules;
57
- };
58
- readonly RelativeTimeFormat: {
59
- new (locales?: LocalesValues, options?: Intl.RelativeTimeFormatOptions): Intl.RelativeTimeFormat;
60
- new (options?: Intl.RelativeTimeFormatOptions & {
61
- locale?: LocalesValues;
62
- }): Intl.RelativeTimeFormat;
63
- };
64
- readonly Locale: {
65
- new (locales?: LocalesValues, options?: Intl.LocaleOptions): Intl.Locale;
66
- new (options?: Intl.LocaleOptions & {
67
- locale?: LocalesValues;
68
- }): Intl.Locale;
69
- };
70
- readonly DisplayNames: {
71
- new (locales?: LocalesValues, options?: Intl.DisplayNamesOptions): Intl.DisplayNames;
72
- new (options?: Intl.DisplayNamesOptions & {
73
- locale?: LocalesValues;
74
- }): Intl.DisplayNames;
75
- };
76
- readonly ListFormat: {
77
- new (locales?: LocalesValues, options?: Intl.ListFormatOptions): Intl.ListFormat;
78
- new (options?: Intl.ListFormatOptions & {
79
- locale?: LocalesValues;
80
- }): Intl.ListFormat;
81
- };
82
- supportedValuesOf: typeof Intl.supportedValuesOf;
83
- readonly Segmenter: {
84
- new (locales?: LocalesValues, options?: Intl.SegmenterOptions): Intl.Segmenter;
85
- new (options?: Intl.SegmenterOptions & {
86
- locale?: LocalesValues;
87
- }): Intl.Segmenter;
88
- };
89
- };
33
+ declare const useIntl: (locale?: LocalesValues) => WrappedIntl;
90
34
  //#endregion
91
35
  export { useIntl };
92
36
  //# sourceMappingURL=useIntl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useIntl.d.ts","names":[],"sources":["../../../../src/client/format/useIntl.ts"],"mappings":";;;;;AAmCA;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,OAAA,GAAW,MAAA,GAAS,aAAA"}
1
+ {"version":3,"file":"useIntl.d.ts","names":[],"sources":["../../../../src/client/format/useIntl.ts"],"mappings":";;;;;;AAmCA;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,OAAA,GAAW,MAAA,GAAS,aAAA,KAAa,WAAA"}
@@ -22,7 +22,11 @@ import * as intlayer from "intlayer";
22
22
  * // "1, 2 und 3"
23
23
  * ```
24
24
  */
25
- declare const useList: () => (values: (string | number)[], options?: Intl.ListFormatOptions & {
25
+ declare const useList: () => (values: (string | number)[], options?: {
26
+ localeMatcher?: "lookup" | "best fit";
27
+ type?: "conjunction" | "disjunction" | "unit";
28
+ style?: "long" | "short" | "narrow";
29
+ } & {
26
30
  locale?: intlayer.LocalesValues;
27
31
  }) => string;
28
32
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"useList.d.ts","names":[],"sources":["../../../../src/client/format/useList.ts"],"mappings":";;;;;;AA2BA;;;;;;;;;;;;;;;;;;cAAa,OAAA,SAAO,MAAA,uBAAA,OAAA,GAAA,IAAA,CAAA,iBAAA;WAAA,QAAA,CAAA,aAAA;AAAA"}
1
+ {"version":3,"file":"useList.d.ts","names":[],"sources":["../../../../src/client/format/useList.ts"],"mappings":";;;;;;AA2BA;;;;;;;;;;;;;;;;;;cAAa,OAAA,SAAO,MAAA,uBAAA,OAAA;;;;;WAWnB,QAAA,CAAA,aAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionaryAsync.d.ts","names":[],"sources":["../../../src/client/useDictionaryAsync.ts"],"mappings":";;;;;;AAcA;;;cAAa,kBAAA,aACD,UAAA,YACA,aAAA,GAAgB,eAAA,EAE1B,iBAAA,EAAmB,mBAAA,OAA0B,OAAA,CAAQ,CAAA,IACrD,MAAA,GAAS,CAAA,KACR,OAAA,CAAQ,CAAA"}
1
+ {"version":3,"file":"useDictionaryAsync.d.ts","names":[],"sources":["../../../src/client/useDictionaryAsync.ts"],"mappings":";;;;;;AAkBA;;;cAAa,kBAAA,aACD,UAAA,YACA,aAAA,GAAgB,eAAA,EAE1B,iBAAA,EAAmB,mBAAA,OAA0B,OAAA,CAAQ,CAAA,IACrD,MAAA,GAAS,CAAA,KACR,OAAA,CAAQ,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionaryDynamic.d.ts","names":[],"sources":["../../../src/client/useDictionaryDynamic.ts"],"mappings":";;;;;;;;;;AAeA;cAAa,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"}
1
+ {"version":3,"file":"useDictionaryDynamic.d.ts","names":[],"sources":["../../../src/client/useDictionaryDynamic.ts"],"mappings":";;;;;;;;;;AAmBA;cAAa,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"}
@@ -1 +1 @@
1
- {"version":3,"file":"useI18n.d.ts","names":[],"sources":["../../../src/client/useI18n.ts"],"mappings":";;;;;;;;AA2BA;;;;;;;;;;;;;;;cAAa,OAAA,aACD,cAAA,YACA,aAAA,GAAgB,eAAA,EAE1B,SAAA,EAAW,CAAA,EACX,MAAA,GAAS,CAAA,gBAkBY,gBAAA,CAAiB,CAAA,GAAE,IAAA,EAChC,CAAA,KAEL,UAAA,CAAW,oBAAA,CAAqB,yBAAA,CAA0B,CAAA,IAAK,CAAA"}
1
+ {"version":3,"file":"useI18n.d.ts","names":[],"sources":["../../../src/client/useI18n.ts"],"mappings":";;;;;;;;AAgCA;;;;;;;;;;;;;;;cAAa,OAAA,aACD,cAAA,YACA,aAAA,GAAgB,eAAA,EAE1B,SAAA,EAAW,CAAA,EACX,MAAA,GAAS,CAAA,gBAkBY,gBAAA,CAAiB,CAAA,GAAE,IAAA,EAChC,CAAA,KAEL,UAAA,CAAW,oBAAA,CAAqB,yBAAA,CAA0B,CAAA,IAAK,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useIntlayer.d.ts","names":[],"sources":["../../../src/client/useIntlayer.ts"],"mappings":";;;;;;;;;;;AA2BA;;;;;;;;;;;;;;;cAAa,WAAA,aACD,cAAA,YACA,aAAA,GAAgB,eAAA,EAE1B,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,CAAA,KAAC,2BAAA,CAAA,oBAAA,CAAA,oCAAA,CAAA,yBAAA,CAAA,CAAA,GAAA,yBAAA,EAAA,CAAA"}
1
+ {"version":3,"file":"useIntlayer.d.ts","names":[],"sources":["../../../src/client/useIntlayer.ts"],"mappings":";;;;;;;;;;;AA+BA;;;;;;;;;;;;;;;cAAa,WAAA,aACD,cAAA,YACA,aAAA,GAAgB,eAAA,EAE1B,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,CAAA,KAAC,2BAAA,CAAA,oBAAA,CAAA,oCAAA,CAAA,yBAAA,CAAA,CAAA,GAAA,yBAAA,EAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useRewriteURL.d.ts","names":[],"sources":["../../../src/client/useRewriteURL.ts"],"mappings":";;AAyBA;;;;;;;;;;;;;;;;;cAAa,aAAA"}
1
+ {"version":3,"file":"useRewriteURL.d.ts","names":[],"sources":["../../../src/client/useRewriteURL.ts"],"mappings":";;AA0BA;;;;;;;;;;;;;;;;;cAAa,aAAA"}
@@ -8,6 +8,10 @@ declare const defaultHTMLComponents: {} & {
8
8
  hr?: FC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLHRElement>, HTMLHRElement>>;
9
9
  th?: FC<react.DetailedHTMLProps<react.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>>;
10
10
  tr?: FC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>>;
11
+ small?: FC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
12
+ sub?: FC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
13
+ sup?: FC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
14
+ slot?: FC<react.DetailedHTMLProps<react.SlotHTMLAttributes<HTMLSlotElement>, HTMLSlotElement>>;
11
15
  html?: FC<react.DetailedHTMLProps<react.HtmlHTMLAttributes<HTMLHtmlElement>, HTMLHtmlElement>>;
12
16
  head?: FC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLHeadElement>, HTMLHeadElement>>;
13
17
  body?: FC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>>;
@@ -37,9 +41,6 @@ declare const defaultHTMLComponents: {} & {
37
41
  del?: FC<react.DetailedHTMLProps<react.DelHTMLAttributes<HTMLModElement>, HTMLModElement>>;
38
42
  ins?: FC<react.DetailedHTMLProps<react.InsHTMLAttributes<HTMLModElement>, HTMLModElement>>;
39
43
  mark?: FC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
40
- small?: FC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
41
- sub?: FC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
42
- sup?: FC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
43
44
  code?: FC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
44
45
  pre?: FC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLPreElement>, HTMLPreElement>>;
45
46
  blockquote?: FC<react.DetailedHTMLProps<react.BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>>;
@@ -103,7 +104,6 @@ declare const defaultHTMLComponents: {} & {
103
104
  bdo?: FC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>>;
104
105
  data?: FC<react.DetailedHTMLProps<react.DataHTMLAttributes<HTMLDataElement>, HTMLDataElement>>;
105
106
  template?: FC<react.DetailedHTMLProps<react.HTMLAttributes<HTMLTemplateElement>, HTMLTemplateElement>>;
106
- slot?: FC<react.DetailedHTMLProps<react.SlotHTMLAttributes<HTMLSlotElement>, HTMLSlotElement>>;
107
107
  } & {
108
108
  [key: string]: FC<any>;
109
109
  };
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownRenderer.d.ts","names":[],"sources":["../../../src/markdown/MarkdownRenderer.tsx"],"mappings":";;;;;;;;;AA2BA;;;;;;;;;;;;;;;;KAAY,mBAAA,GAAsB,uBAAA;EAwBO;;AA4BzC;;;;;;;;;;;EAtCE,UAAA,GAAa,cAAA;EA6Dd;;;;;;;;;EAnDC,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,CAA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AAuB,UAAA;EAAA,OAAA;EAAA,UAAA;EAAA,WAAA;EAAA,mBAAA;EAAA;AAAA,IAOjC,mBAAA,MAGO,OAAA,kDAAe,QAAA,CAAA,SAAA,IAAA,OAAA,sCAAA,KAAA,CAAA,WAAA,GAAA,KAAA,CAAA,YAAA,mBAAA,KAAA,CAAA,qBAAA,SAAA,QAAA,CAAA,SAAA,KAAA,GAAA,CAAA,OAAA;;;;;;;;;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;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAgEM,gBAAA,EAAkB,EAAA,CAAG,qBAAA"}
@@ -14,10 +14,6 @@ type MarkdownRendererPluginProps = {
14
14
  components?: HTMLComponents<'permissive', {}>;
15
15
  };
16
16
  declare const MarkdownRendererPlugin: FC<MarkdownRendererPluginProps>;
17
- type MarkdownMetadataRendererProps = MarkdownRendererPluginProps & {
18
- metadataKeyPath: KeyPath[];
19
- };
20
- declare const MarkdownMetadataRenderer: FC<MarkdownMetadataRendererProps>;
21
17
  //#endregion
22
- export { MarkdownMetadataRenderer, MarkdownRendererPlugin };
18
+ export { MarkdownRendererPlugin };
23
19
  //# sourceMappingURL=MarkdownRendererPlugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownRendererPlugin.d.ts","names":[],"sources":["../../../src/markdown/MarkdownRendererPlugin.tsx"],"mappings":";;;;;;;KAUK,2BAAA;EACH,aAAA;EACA,OAAA,EAAS,OAAA;EACT,MAAA,GAAS,aAAA;EACT,QAAA;EACA,OAAA,GAAU,uBAAA;EACV,UAAA,GAAa,cAAA;AAAA;AAAA,cAGF,sBAAA,EAAwB,EAAA,CAAG,2BAAA;AAAA,KAcnC,6BAAA,GAAgC,2BAAA;EACnC,eAAA,EAAiB,OAAA;AAAA;AAAA,cASN,wBAAA,EAA0B,EAAA,CAAG,6BAAA"}
1
+ {"version":3,"file":"MarkdownRendererPlugin.d.ts","names":[],"sources":["../../../src/markdown/MarkdownRendererPlugin.tsx"],"mappings":";;;;;;;KAWK,2BAAA;EACH,aAAA;EACA,OAAA,EAAS,OAAA;EACT,MAAA,GAAS,aAAA;EACT,QAAA;EACA,OAAA,GAAU,uBAAA;EACV,UAAA,GAAa,cAAA;AAAA;AAAA,cAGF,sBAAA,EAAwB,EAAA,CAAG,2BAAA"}
@@ -1,6 +1,6 @@
1
1
  import { MarkdownProvider, MarkdownProviderOptions, useMarkdownContext } from "./MarkdownProvider.js";
2
2
  import { MarkdownRenderer, MarkdownRendererProps, RenderMarkdownProps, renderMarkdown, useMarkdownRenderer } from "./MarkdownRenderer.js";
3
- import { MarkdownMetadataRenderer, MarkdownRendererPlugin } from "./MarkdownRendererPlugin.js";
3
+ import { MarkdownRendererPlugin } from "./MarkdownRendererPlugin.js";
4
4
  import { LegacyMarkdownRenderer, MarkdownRendererOptions, RuleType, compile, compileMarkdown, compiler, sanitizer as defaultSanitizer, slugify as defaultSlugify } from "./processor.js";
5
5
  import reactRuntime, { createReactRuntime } from "./runtime.js";
6
- export { LegacyMarkdownRenderer, MarkdownMetadataRenderer, MarkdownProvider, MarkdownProviderOptions, MarkdownRenderer, MarkdownRendererOptions, MarkdownRendererPlugin, MarkdownRendererProps, RenderMarkdownProps, RuleType, compile, compileMarkdown, compiler, createReactRuntime, reactRuntime, renderMarkdown, defaultSanitizer as sanitizer, defaultSlugify as slugify, useMarkdownContext, useMarkdownRenderer };
6
+ export { LegacyMarkdownRenderer, MarkdownProvider, MarkdownProviderOptions, MarkdownRenderer, MarkdownRendererOptions, MarkdownRendererPlugin, MarkdownRendererProps, RenderMarkdownProps, RuleType, compile, compileMarkdown, compiler, createReactRuntime, reactRuntime, renderMarkdown, defaultSanitizer as sanitizer, defaultSlugify as slugify, useMarkdownContext, useMarkdownRenderer };
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.d.ts","names":[],"sources":["../../src/plugins.tsx"],"mappings":";;;;;;;;;;AA0CA;KAAY,gBAAA,MAAsB,CAAA,2BAC9B,YAAA,CAAa,CAAA;;cAIJ,mBAAA,EAAqB,OAAA;;;;KA4BtB,aAAA,MAAmB,CAAA;EAC7B,KAAA;EACA,GAAA;AAAA,IAEE,SAAA;;cAIS,gBAAA,EAAkB,OAAA;;AApC/B;;KAiEY,aAAA,MAAmB,CAAA;EAC7B,QAAA,EAAU,QAAA;EAAA,CACT,QAAA,CAAS,SAAA;EACV,MAAA;AAAA,uBAEqB,CAAA,qBAAsB,SAAA,IACvC,MAAA,EAAQ,CAAA,KACL,CAAA,OAAQ,CAAA,4BACT,YAAA,WACA,YAAA,CAAa,SAAA;;cA4BR,eAAA,EAAiB,OAAA;;;;KAkFlB,kBAAA,MAAwB,CAAA,kBAChC,YAAA;EAGI,QAAA,EAAU,oBAAA;EACV,GAAA,GAAM,UAAA,EAAY,cAAA,uBAAqC,SAAA;AAAA;;cAMlD,oBAAA,EAAsB,OAAA;AAAA,KA+EvB,YAAA,MAAkB,CAAA;EAC5B,QAAA,EAAU,QAAA;EAAA,CACT,QAAA,CAAS,QAAA;EACV,IAAA;EACA,QAAA;AAAA,IAEE,YAAA,CACE,CAAA;EAEE,GAAA,GAAM,UAAA,GAAa,cAAA,eAA6B,CAAA,MAAO,SAAA;EACvD,QAAA,EAAU,oBAAA,CAAqB,CAAA;AAAA;AAAA,cAK1B,cAAA,EAAgB,OAAA;;;;;;;;;;;;KAmCjB,cAAA,MAAoB,CAAA;EAC9B,QAAA,EAAU,QAAA;EAAA,CACT,QAAA,CAAS,IAAA;EACV,IAAA;AAAA,IAEE,YAAA,CACE,CAAA;EAEE,GAAA,GAAM,UAAA,GAAa,cAA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AAAA,KA8EvB,YAAA,MAAkB,CAAA;EAC5B,QAAA,EAAU,QAAA;EAAA,CACT,QAAA,CAAS,QAAA;EACV,IAAA;EACA,QAAA;AAAA,IAEE,YAAA,CACE,CAAA;EAEE,GAAA,GAAM,UAAA,GAAa,cAAA,eAA6B,CAAA,MAAO,SAAA;EACvD,QAAA,EAAU,oBAAA,CAAqB,CAAA;AAAA;AAAA,cAK1B,cAAA,EAAgB,OAAA;;;;;;;;;;;;KAmCjB,cAAA,MAAoB,CAAA;EAC9B,QAAA,EAAU,QAAA;EAAA,CACT,QAAA,CAAS,IAAA;EACV,IAAA;AAAA,IAEE,YAAA,CACE,CAAA;EAEE,GAAA,GAAM,UAAA,GAAa,cAAA,eAA6B,CAAA,MAAO,SAAA;AAAA;;cAMlD,UAAA,EAAY,OAAA;;;;KAoCb,uBAAA,mBAA0C,aAAA;EACpD,SAAA,EAAW,aAAA,CAAc,CAAA;EACzB,iBAAA,EAAmB,gBAAA,CAAiB,CAAA;EACpC,cAAA,EAAgB,aAAA,CAAc,CAAA;EAC9B,aAAA,EAAe,YAAA,CAAa,CAAA;EAC5B,SAAA,EAAW,cAAA,CAAe,CAAA;AAAA;;;;AAlM5B;;KA0MY,uBAAA,GAA0B,IAAA,CACpC,yBAAA;EAGA,SAAA;EACA,iBAAA;EACA,aAAA;EACA,SAAA;EACA,cAAA;AAAA;AAAA,KAGU,oBAAA,cAEA,aAAA,GAAgB,eAAA,IACxB,sBAAA,CAAyB,CAAA,EAAG,uBAAA,EAAyB,CAAA;;;;;cAM5C,UAAA,GACX,MAAA,GAAS,aAAA,EACT,QAAA,eACC,OAAA"}
@@ -1,4 +1,5 @@
1
1
  import { LocalesValues } from "@intlayer/types/module_augmentation";
2
+ import { WrappedIntl } from "@intlayer/core/formatters";
2
3
 
3
4
  //#region src/server/format/useIntl.d.ts
4
5
  /**
@@ -29,64 +30,7 @@ import { LocalesValues } from "@intlayer/types/module_augmentation";
29
30
  * const date2 = new intl.DateTimeFormat('fr-FR').format(new Date());
30
31
  * ```
31
32
  */
32
- declare const useIntl: (locale?: LocalesValues) => {
33
- Collator: {
34
- new (locales?: LocalesValues, options?: Intl.CollatorOptions): Intl.Collator;
35
- new (options?: Intl.CollatorOptions & {
36
- locale?: LocalesValues;
37
- }): Intl.Collator;
38
- };
39
- NumberFormat: {
40
- new (locales?: LocalesValues, options?: Intl.NumberFormatOptions): Intl.NumberFormat;
41
- new (options?: Intl.NumberFormatOptions & {
42
- locale?: LocalesValues;
43
- }): Intl.NumberFormat;
44
- };
45
- DateTimeFormat: {
46
- new (locales?: LocalesValues, options?: Intl.DateTimeFormatOptions): Intl.DateTimeFormat;
47
- new (options?: Intl.DateTimeFormatOptions & {
48
- locale?: LocalesValues;
49
- }): Intl.DateTimeFormat;
50
- };
51
- getCanonicalLocales: typeof Intl.getCanonicalLocales;
52
- readonly PluralRules: {
53
- new (locales?: LocalesValues, options?: Intl.PluralRulesOptions): Intl.PluralRules;
54
- new (options?: Intl.PluralRulesOptions & {
55
- locale?: LocalesValues;
56
- }): Intl.PluralRules;
57
- };
58
- readonly RelativeTimeFormat: {
59
- new (locales?: LocalesValues, options?: Intl.RelativeTimeFormatOptions): Intl.RelativeTimeFormat;
60
- new (options?: Intl.RelativeTimeFormatOptions & {
61
- locale?: LocalesValues;
62
- }): Intl.RelativeTimeFormat;
63
- };
64
- readonly Locale: {
65
- new (locales?: LocalesValues, options?: Intl.LocaleOptions): Intl.Locale;
66
- new (options?: Intl.LocaleOptions & {
67
- locale?: LocalesValues;
68
- }): Intl.Locale;
69
- };
70
- readonly DisplayNames: {
71
- new (locales?: LocalesValues, options?: Intl.DisplayNamesOptions): Intl.DisplayNames;
72
- new (options?: Intl.DisplayNamesOptions & {
73
- locale?: LocalesValues;
74
- }): Intl.DisplayNames;
75
- };
76
- readonly ListFormat: {
77
- new (locales?: LocalesValues, options?: Intl.ListFormatOptions): Intl.ListFormat;
78
- new (options?: Intl.ListFormatOptions & {
79
- locale?: LocalesValues;
80
- }): Intl.ListFormat;
81
- };
82
- supportedValuesOf: typeof Intl.supportedValuesOf;
83
- readonly Segmenter: {
84
- new (locales?: LocalesValues, options?: Intl.SegmenterOptions): Intl.Segmenter;
85
- new (options?: Intl.SegmenterOptions & {
86
- locale?: LocalesValues;
87
- }): Intl.Segmenter;
88
- };
89
- };
33
+ declare const useIntl: (locale?: LocalesValues) => WrappedIntl;
90
34
  //#endregion
91
35
  export { useIntl };
92
36
  //# sourceMappingURL=useIntl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useIntl.d.ts","names":[],"sources":["../../../../src/server/format/useIntl.ts"],"mappings":";;;;;AAkCA;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,OAAA,GAAW,MAAA,GAAS,aAAA"}
1
+ {"version":3,"file":"useIntl.d.ts","names":[],"sources":["../../../../src/server/format/useIntl.ts"],"mappings":";;;;;;AAkCA;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,OAAA,GAAW,MAAA,GAAS,aAAA,KAAgB,WAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionary.d.ts","names":[],"sources":["../../../src/server/useDictionary.ts"],"mappings":";;;;;;;;;;AAWA;cAAa,aAAA,aACD,UAAA,YACA,aAAA,GAAgB,eAAA,EAE1B,UAAA,EAAY,CAAA,EACZ,MAAA,GAAS,CAAA,EACT,cAAA,GAAiB,eAAA,KAAe,2BAAA,CAAA,oBAAA,CAAA,CAAA,aAAA,yBAAA,EAAA,CAAA"}
1
+ {"version":3,"file":"useDictionary.d.ts","names":[],"sources":["../../../src/server/useDictionary.ts"],"mappings":";;;;;;;;;;AAcA;cAAa,aAAA,aACD,UAAA,YACA,aAAA,GAAgB,eAAA,EAE1B,UAAA,EAAY,CAAA,EACZ,MAAA,GAAS,CAAA,EACT,cAAA,GAAiB,eAAA,KAAe,2BAAA,CAAA,oBAAA,CAAA,CAAA,aAAA,yBAAA,EAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionaryAsync.d.ts","names":[],"sources":["../../../src/server/useDictionaryAsync.ts"],"mappings":";;;;;;;;;;AAYA;cAAa,kBAAA,aACD,UAAA,YACA,aAAA,GAAgB,eAAA,EAE1B,iBAAA,EAAmB,mBAAA,OAA0B,OAAA,CAAQ,CAAA,IACrD,MAAA,GAAS,CAAA,EACT,cAAA,GAAiB,eAAA,KAAe,OAAA,CAAA,2BAAA,CAAA,oBAAA,CAAA,CAAA,aAAA,yBAAA,EAAA,CAAA"}
1
+ {"version":3,"file":"useDictionaryAsync.d.ts","names":[],"sources":["../../../src/server/useDictionaryAsync.ts"],"mappings":";;;;;;;;;;AAgBA;cAAa,kBAAA,aACD,UAAA,YACA,aAAA,GAAgB,eAAA,EAE1B,iBAAA,EAAmB,mBAAA,OAA0B,OAAA,CAAQ,CAAA,IACrD,MAAA,GAAS,CAAA,EACT,cAAA,GAAiB,eAAA,KAAe,OAAA,CAAA,2BAAA,CAAA,oBAAA,CAAA,CAAA,aAAA,yBAAA,EAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionaryDynamic.d.ts","names":[],"sources":["../../../src/server/useDictionaryDynamic.ts"],"mappings":";;;;;;;;;;AAaA;cAAa,oBAAA,aACD,UAAA,YACA,aAAA,GAAgB,eAAA,EAE1B,iBAAA,EAAmB,mBAAA,OAA0B,OAAA,CAAQ,CAAA,IACrD,GAAA,UACA,MAAA,GAAS,CAAA,EACT,cAAA,GAAiB,eAAA,KAAe,2BAAA,CAAA,oBAAA,CAAA,CAAA,aAAA,yBAAA,EAAA,CAAA"}
1
+ {"version":3,"file":"useDictionaryDynamic.d.ts","names":[],"sources":["../../../src/server/useDictionaryDynamic.ts"],"mappings":";;;;;;;;;;AAiBA;cAAa,oBAAA,aACD,UAAA,YACA,aAAA,GAAgB,eAAA,EAE1B,iBAAA,EAAmB,mBAAA,OAA0B,OAAA,CAAQ,CAAA,IACrD,GAAA,UACA,MAAA,GAAS,CAAA,EACT,cAAA,GAAiB,eAAA,KAAe,2BAAA,CAAA,oBAAA,CAAA,CAAA,aAAA,yBAAA,EAAA,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-intlayer",
3
- "version": "8.4.0",
3
+ "version": "8.4.2",
4
4
  "private": false,
5
5
  "description": "Easily internationalize i18n your React applications with type-safe multilingual content management.",
6
6
  "keywords": [
@@ -115,14 +115,14 @@
115
115
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
116
116
  },
117
117
  "dependencies": {
118
- "@intlayer/api": "8.4.0",
119
- "@intlayer/config": "8.4.0",
120
- "@intlayer/core": "8.4.0",
121
- "@intlayer/dictionaries-entry": "8.4.0",
122
- "@intlayer/editor": "8.4.0",
123
- "@intlayer/editor-react": "8.4.0",
124
- "@intlayer/types": "8.4.0",
125
- "intlayer": "8.4.0"
118
+ "@intlayer/api": "8.4.2",
119
+ "@intlayer/config": "8.4.2",
120
+ "@intlayer/core": "8.4.2",
121
+ "@intlayer/dictionaries-entry": "8.4.2",
122
+ "@intlayer/editor": "8.4.2",
123
+ "@intlayer/editor-react": "8.4.2",
124
+ "@intlayer/types": "8.4.2",
125
+ "intlayer": "8.4.2"
126
126
  },
127
127
  "devDependencies": {
128
128
  "@craco/types": "7.1.0",
@@ -1,2 +0,0 @@
1
- "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`@intlayer/core/markdown`),t=require(`react`),n=require(`@intlayer/editor/isEnabled`),r=require(`@intlayer/core/dictionaryManipulator`);const i=(e,r,i)=>{let[a,o]=(0,t.useState)(i);return(0,t.useEffect)(()=>{if(!n.isEnabled)return;let t=!1,i,a,s=t=>{let n=()=>{let n=t.getContentValue(e,r);typeof n==`string`&&o(n)};n(),t.editedContent.addEventListener(`change`,n),i=()=>t.editedContent.removeEventListener(`change`,n)};return import(`@intlayer/editor`).then(({getGlobalEditorManager:e,onGlobalEditorManagerChange:n})=>{if(t)return;let r=e();r?s(r):a=n(e=>{t||(i&&=(i(),void 0),e&&s(e))})}),()=>{t=!0,i?.(),a?.()}},[e,r,i]),a},a=({dictionaryKey:t,keyPath:n,children:a,metadataKeyPath:o})=>(0,r.getContentNodeByKeyPath)((0,e.getMarkdownMetadata)(i(t,n,a)),o);exports.MarkdownMetadataRendererInternal=a;
2
- //# sourceMappingURL=MarkdownMetadataRendererInternal.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MarkdownMetadataRendererInternal.cjs","names":["isEnabled"],"sources":["../../../src/markdown/MarkdownMetadataRendererInternal.tsx"],"sourcesContent":["'use client';\n\nimport { getContentNodeByKeyPath } from '@intlayer/core/dictionaryManipulator';\nimport { getMarkdownMetadata } from '@intlayer/core/markdown';\nimport type { EditorStateManager } from '@intlayer/editor';\nimport { isEnabled } from '@intlayer/editor/isEnabled';\nimport type { ContentNode } from '@intlayer/types/dictionary';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport type { FC, ReactNode } from 'react';\nimport { useEffect, useState } from 'react';\n\ntype MarkdownMetadataRendererProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n locale?: LocalesValues;\n children: string;\n metadataKeyPath: KeyPath[];\n};\n\n/**\n * Gets the edited markdown string for this node from the global manager,\n * falling back to the original children string.\n */\nconst useEditedMarkdown = (\n dictionaryKey: string,\n keyPath: KeyPath[],\n children: string\n): string => {\n const [editedMarkdown, setEditedMarkdown] = useState<string>(children);\n\n useEffect(() => {\n if (!isEnabled) return;\n\n let stopped = false;\n let unsubscribeFromManager: (() => void) | undefined;\n let unsubscribeFromGlobalChange: (() => void) | undefined;\n\n const setupManager = (manager: EditorStateManager) => {\n const updateValue = () => {\n const edited = manager.getContentValue(dictionaryKey, keyPath);\n if (typeof edited === 'string') {\n setEditedMarkdown(edited);\n }\n };\n\n updateValue();\n manager.editedContent.addEventListener('change', updateValue);\n unsubscribeFromManager = () =>\n manager.editedContent.removeEventListener('change', updateValue);\n };\n\n import('@intlayer/editor').then(\n ({ getGlobalEditorManager, onGlobalEditorManagerChange }) => {\n if (stopped) return;\n\n const manager = getGlobalEditorManager();\n\n if (manager) {\n setupManager(manager);\n } else {\n unsubscribeFromGlobalChange = onGlobalEditorManagerChange(\n (newManager) => {\n if (stopped) return;\n\n if (unsubscribeFromManager) {\n unsubscribeFromManager();\n unsubscribeFromManager = undefined;\n }\n\n if (newManager) {\n setupManager(newManager);\n }\n }\n );\n }\n }\n );\n\n return () => {\n stopped = true;\n unsubscribeFromManager?.();\n unsubscribeFromGlobalChange?.();\n };\n }, [dictionaryKey, keyPath, children]);\n\n return editedMarkdown;\n};\n\nexport const MarkdownMetadataRendererInternal: FC<\n MarkdownMetadataRendererProps\n> = ({ dictionaryKey, keyPath, children, metadataKeyPath }): ReactNode => {\n const markdownContent = useEditedMarkdown(dictionaryKey, keyPath, children);\n\n const metadata = getMarkdownMetadata(markdownContent);\n\n const metadataEl = getContentNodeByKeyPath(\n metadata as ContentNode,\n metadataKeyPath\n );\n\n return metadataEl as ReactNode;\n};\n"],"mappings":"mRAwBA,MAAM,GACJ,EACA,EACA,IACW,CACX,GAAM,CAAC,EAAgB,IAAA,EAAA,EAAA,UAAsC,EAAS,CAyDtE,OAvDA,EAAA,EAAA,eAAgB,CACd,GAAI,CAACA,EAAAA,UAAW,OAEhB,IAAI,EAAU,GACV,EACA,EAEE,EAAgB,GAAgC,CACpD,IAAM,MAAoB,CACxB,IAAM,EAAS,EAAQ,gBAAgB,EAAe,EAAQ,CAC1D,OAAO,GAAW,UACpB,EAAkB,EAAO,EAI7B,GAAa,CACb,EAAQ,cAAc,iBAAiB,SAAU,EAAY,CAC7D,MACE,EAAQ,cAAc,oBAAoB,SAAU,EAAY,EA8BpE,OA3BA,OAAO,oBAAoB,MACxB,CAAE,yBAAwB,iCAAkC,CAC3D,GAAI,EAAS,OAEb,IAAM,EAAU,GAAwB,CAEpC,EACF,EAAa,EAAQ,CAErB,EAA8B,EAC3B,GAAe,CACV,IAEJ,AAEE,KADA,GAAwB,CACC,IAAA,IAGvB,GACF,EAAa,EAAW,GAG7B,EAGN,KAEY,CACX,EAAU,GACV,KAA0B,CAC1B,KAA+B,GAEhC,CAAC,EAAe,EAAS,EAAS,CAAC,CAE/B,GAGI,GAER,CAAE,gBAAe,UAAS,WAAU,sBAUvC,EAAA,EAAA,0BAAA,EAAA,EAAA,qBATwB,EAAkB,EAAe,EAAS,EAAS,CAEtB,CAInD,EACD"}
@@ -1,2 +0,0 @@
1
- "use client";import{getMarkdownMetadata as e}from"@intlayer/core/markdown";import{useEffect as t,useState as n}from"react";import{isEnabled as r}from"@intlayer/editor/isEnabled";import{getContentNodeByKeyPath as i}from"@intlayer/core/dictionaryManipulator";const a=(e,i,a)=>{let[o,s]=n(a);return t(()=>{if(!r)return;let t=!1,n,a,o=t=>{let r=()=>{let n=t.getContentValue(e,i);typeof n==`string`&&s(n)};r(),t.editedContent.addEventListener(`change`,r),n=()=>t.editedContent.removeEventListener(`change`,r)};return import(`@intlayer/editor`).then(({getGlobalEditorManager:e,onGlobalEditorManagerChange:r})=>{if(t)return;let i=e();i?o(i):a=r(e=>{t||(n&&=(n(),void 0),e&&o(e))})}),()=>{t=!0,n?.(),a?.()}},[e,i,a]),o},o=({dictionaryKey:t,keyPath:n,children:r,metadataKeyPath:o})=>i(e(a(t,n,r)),o);export{o as MarkdownMetadataRendererInternal};
2
- //# sourceMappingURL=MarkdownMetadataRendererInternal.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MarkdownMetadataRendererInternal.mjs","names":[],"sources":["../../../src/markdown/MarkdownMetadataRendererInternal.tsx"],"sourcesContent":["'use client';\n\nimport { getContentNodeByKeyPath } from '@intlayer/core/dictionaryManipulator';\nimport { getMarkdownMetadata } from '@intlayer/core/markdown';\nimport type { EditorStateManager } from '@intlayer/editor';\nimport { isEnabled } from '@intlayer/editor/isEnabled';\nimport type { ContentNode } from '@intlayer/types/dictionary';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport type { FC, ReactNode } from 'react';\nimport { useEffect, useState } from 'react';\n\ntype MarkdownMetadataRendererProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n locale?: LocalesValues;\n children: string;\n metadataKeyPath: KeyPath[];\n};\n\n/**\n * Gets the edited markdown string for this node from the global manager,\n * falling back to the original children string.\n */\nconst useEditedMarkdown = (\n dictionaryKey: string,\n keyPath: KeyPath[],\n children: string\n): string => {\n const [editedMarkdown, setEditedMarkdown] = useState<string>(children);\n\n useEffect(() => {\n if (!isEnabled) return;\n\n let stopped = false;\n let unsubscribeFromManager: (() => void) | undefined;\n let unsubscribeFromGlobalChange: (() => void) | undefined;\n\n const setupManager = (manager: EditorStateManager) => {\n const updateValue = () => {\n const edited = manager.getContentValue(dictionaryKey, keyPath);\n if (typeof edited === 'string') {\n setEditedMarkdown(edited);\n }\n };\n\n updateValue();\n manager.editedContent.addEventListener('change', updateValue);\n unsubscribeFromManager = () =>\n manager.editedContent.removeEventListener('change', updateValue);\n };\n\n import('@intlayer/editor').then(\n ({ getGlobalEditorManager, onGlobalEditorManagerChange }) => {\n if (stopped) return;\n\n const manager = getGlobalEditorManager();\n\n if (manager) {\n setupManager(manager);\n } else {\n unsubscribeFromGlobalChange = onGlobalEditorManagerChange(\n (newManager) => {\n if (stopped) return;\n\n if (unsubscribeFromManager) {\n unsubscribeFromManager();\n unsubscribeFromManager = undefined;\n }\n\n if (newManager) {\n setupManager(newManager);\n }\n }\n );\n }\n }\n );\n\n return () => {\n stopped = true;\n unsubscribeFromManager?.();\n unsubscribeFromGlobalChange?.();\n };\n }, [dictionaryKey, keyPath, children]);\n\n return editedMarkdown;\n};\n\nexport const MarkdownMetadataRendererInternal: FC<\n MarkdownMetadataRendererProps\n> = ({ dictionaryKey, keyPath, children, metadataKeyPath }): ReactNode => {\n const markdownContent = useEditedMarkdown(dictionaryKey, keyPath, children);\n\n const metadata = getMarkdownMetadata(markdownContent);\n\n const metadataEl = getContentNodeByKeyPath(\n metadata as ContentNode,\n metadataKeyPath\n );\n\n return metadataEl as ReactNode;\n};\n"],"mappings":"iQAwBA,MAAM,GACJ,EACA,EACA,IACW,CACX,GAAM,CAAC,EAAgB,GAAqB,EAAiB,EAAS,CAyDtE,OAvDA,MAAgB,CACd,GAAI,CAAC,EAAW,OAEhB,IAAI,EAAU,GACV,EACA,EAEE,EAAgB,GAAgC,CACpD,IAAM,MAAoB,CACxB,IAAM,EAAS,EAAQ,gBAAgB,EAAe,EAAQ,CAC1D,OAAO,GAAW,UACpB,EAAkB,EAAO,EAI7B,GAAa,CACb,EAAQ,cAAc,iBAAiB,SAAU,EAAY,CAC7D,MACE,EAAQ,cAAc,oBAAoB,SAAU,EAAY,EA8BpE,OA3BA,OAAO,oBAAoB,MACxB,CAAE,yBAAwB,iCAAkC,CAC3D,GAAI,EAAS,OAEb,IAAM,EAAU,GAAwB,CAEpC,EACF,EAAa,EAAQ,CAErB,EAA8B,EAC3B,GAAe,CACV,IAEJ,AAEE,KADA,GAAwB,CACC,IAAA,IAGvB,GACF,EAAa,EAAW,GAG7B,EAGN,KAEY,CACX,EAAU,GACV,KAA0B,CAC1B,KAA+B,GAEhC,CAAC,EAAe,EAAS,EAAS,CAAC,CAE/B,GAGI,GAER,CAAE,gBAAe,UAAS,WAAU,qBAKpB,EAFF,EAFO,EAAkB,EAAe,EAAS,EAAS,CAEtB,CAInD,EACD"}
@@ -1,16 +0,0 @@
1
- import { LocalesValues } from "@intlayer/types/module_augmentation";
2
- import { FC } from "react";
3
- import { KeyPath } from "@intlayer/types/keyPath";
4
-
5
- //#region src/markdown/MarkdownMetadataRendererInternal.d.ts
6
- type MarkdownMetadataRendererProps = {
7
- dictionaryKey: string;
8
- keyPath: KeyPath[];
9
- locale?: LocalesValues;
10
- children: string;
11
- metadataKeyPath: KeyPath[];
12
- };
13
- declare const MarkdownMetadataRendererInternal: FC<MarkdownMetadataRendererProps>;
14
- //#endregion
15
- export { MarkdownMetadataRendererInternal };
16
- //# sourceMappingURL=MarkdownMetadataRendererInternal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MarkdownMetadataRendererInternal.d.ts","names":[],"sources":["../../../src/markdown/MarkdownMetadataRendererInternal.tsx"],"mappings":";;;;;KAYK,6BAAA;EACH,aAAA;EACA,OAAA,EAAS,OAAA;EACT,MAAA,GAAS,aAAA;EACT,QAAA;EACA,eAAA,EAAiB,OAAA;AAAA;AAAA,cAwEN,gCAAA,EAAkC,EAAA,CAC7C,6BAAA"}