react-intlayer 8.0.0-canary.3 → 8.0.0-canary.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/html/HTMLProvider.cjs.map +1 -1
- package/dist/cjs/html/HTMLRenderer.cjs.map +1 -1
- package/dist/cjs/markdown/MarkdownProvider.cjs +10 -22
- package/dist/cjs/markdown/MarkdownProvider.cjs.map +1 -1
- package/dist/cjs/markdown/MarkdownRenderer.cjs +2 -6
- package/dist/cjs/markdown/MarkdownRenderer.cjs.map +1 -1
- package/dist/cjs/markdown/processor.cjs.map +1 -1
- package/dist/cjs/plugins.cjs +0 -1
- package/dist/cjs/plugins.cjs.map +1 -1
- package/dist/esm/html/HTMLProvider.mjs.map +1 -1
- package/dist/esm/html/HTMLRenderer.mjs.map +1 -1
- package/dist/esm/markdown/MarkdownProvider.mjs +10 -22
- package/dist/esm/markdown/MarkdownProvider.mjs.map +1 -1
- package/dist/esm/markdown/MarkdownRenderer.mjs +2 -6
- package/dist/esm/markdown/MarkdownRenderer.mjs.map +1 -1
- package/dist/esm/markdown/processor.mjs.map +1 -1
- package/dist/esm/plugins.mjs +0 -1
- package/dist/esm/plugins.mjs.map +1 -1
- package/dist/types/client/IntlayerProvider.d.ts +2 -2
- package/dist/types/client/format/useCurrency.d.ts +2 -2
- package/dist/types/client/format/useNumber.d.ts +2 -2
- package/dist/types/client/format/useNumber.d.ts.map +1 -1
- package/dist/types/client/format/usePercentage.d.ts +2 -2
- package/dist/types/client/useDictionaryDynamic.d.ts +2 -2
- package/dist/types/client/useIntlayer.d.ts +3 -3
- package/dist/types/client/useIntlayer.d.ts.map +1 -1
- package/dist/types/client/useLocaleBase.d.ts +5 -5
- package/dist/types/client/useLocaleStorage.d.ts +5 -5
- package/dist/types/html/HTMLProvider.d.ts +3 -2
- package/dist/types/html/HTMLProvider.d.ts.map +1 -1
- package/dist/types/html/HTMLRenderer.d.ts +107 -3
- package/dist/types/html/HTMLRenderer.d.ts.map +1 -1
- package/dist/types/html/index.d.ts +1 -2
- package/dist/types/markdown/MarkdownProvider.d.ts +6 -10
- package/dist/types/markdown/MarkdownProvider.d.ts.map +1 -1
- package/dist/types/markdown/MarkdownRenderer.d.ts +7 -7
- package/dist/types/markdown/MarkdownRenderer.d.ts.map +1 -1
- package/dist/types/markdown/index.d.ts +2 -2
- package/dist/types/markdown/processor.d.ts +4 -4
- package/dist/types/markdown/processor.d.ts.map +1 -1
- package/dist/types/plugins.d.ts +29 -14
- package/dist/types/plugins.d.ts.map +1 -1
- package/dist/types/server/IntlayerServerProvider.d.ts +2 -2
- package/dist/types/server/useDictionary.d.ts +2 -2
- package/dist/types/server/useDictionaryAsync.d.ts +2 -2
- package/dist/types/server/useIntlayer.d.ts +2 -2
- package/dist/types/utils/HTMLComponentTypes.d.ts +38 -0
- package/dist/types/utils/HTMLComponentTypes.d.ts.map +1 -0
- package/package.json +9 -9
- package/dist/types/html/types.d.ts +0 -26
- package/dist/types/html/types.d.ts.map +0 -1
- /package/dist/cjs/{html/types.cjs → utils/HTMLComponentTypes.cjs} +0 -0
- /package/dist/esm/{html/types.mjs → utils/HTMLComponentTypes.mjs} +0 -0
package/dist/esm/plugins.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.mjs","names":[],"sources":["../../src/plugins.tsx"],"sourcesContent":["import {\n type DeepTransformContent as DeepTransformContentCore,\n type ExtractCustomProps,\n getMarkdownMetadata,\n type HTMLCond,\n type HTMLContent,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n type InsertionContent,\n type MarkdownContent,\n type Plugins,\n splitInsertionTemplate,\n} from '@intlayer/core';\nimport {\n type DeclaredLocales,\n type KeyPath,\n type LocalesValues,\n NodeType,\n} from '@intlayer/types';\nimport {\n type ComponentType,\n createElement,\n type ElementType,\n Fragment,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { ContentSelectorRenderer } from './editor';\nimport { EditedContentRenderer } from './editor/useEditedContentRenderer';\nimport { HTMLRendererPlugin } from './html';\nimport type { ReactHTMLComponentMap } from './html/types';\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: (\n <EditedContentRenderer {...rest}>{rest.children}</EditedContentRenderer>\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: (\n <ContentSelectorRenderer {...rest}>\n {renderReactElement(node)}\n </ContentSelectorRenderer>\n ),\n }),\n};\n\n/** ---------------------------------------------\n * INSERTION PLUGIN\n * --------------------------------------------- */\n\nexport type InsertionCond<T, S, L> = T extends {\n nodeType: NodeType | string;\n [NodeType.Insertion]: string;\n fields: readonly string[];\n}\n ? (\n values: {\n [K in T['fields'][number]]: ReactNode;\n }\n ) => 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 return deepTransformNode(children, {\n ...props,\n children,\n keyPath: newKeyPath,\n plugins: [insertionStringPlugin, ...(props.plugins ?? [])],\n });\n },\n};\n\n/**\n * MARKDOWN PLUGIN\n */\n\nexport type MarkdownStringCond<T> = T extends string\n ? IntlayerNode<\n string,\n {\n metadata: DeepTransformContent<string>;\n use: (components: ReactHTMLComponentMap) => 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 <ContentSelectorRenderer {...rest}>\n <MarkdownMetadataRenderer\n {...rest}\n metadataKeyPath={props.keyPath}\n >\n {node}\n </MarkdownMetadataRenderer>\n </ContentSelectorRenderer>\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?: ReactHTMLComponentMap) =>\n renderIntlayerNode({\n ...props,\n value: node,\n children: (\n <ContentSelectorRenderer {...rest}>\n <MarkdownRendererPlugin {...rest} {...(components ?? {})}>\n {node}\n </MarkdownRendererPlugin>\n </ContentSelectorRenderer>\n ),\n additionalProps: {\n metadata: metadataNodes,\n },\n });\n\n const element = render() 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?: ReactHTMLComponentMap) => render(components);\n }\n\n return Reflect.get(target, prop, receiver);\n },\n }) as any;\n },\n};\n\nexport type MarkdownCond<T, S, L extends LocalesValues> = T extends {\n nodeType: NodeType | string;\n [NodeType.Markdown]: infer M;\n metadata?: infer U;\n}\n ? {\n use: (components?: ReactHTMLComponentMap) => ReactNode;\n metadata: DeepTransformContent<U, L>;\n } & any\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\nexport type HTMLPluginCond<T, S, L> = HTMLCond<T, S, L, ReactNode, ReactNode>;\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 tags = node.tags ?? [];\n const { plugins, ...rest } = props;\n\n // Type-safe render function that accepts properly typed components\n const render = <\n T = typeof tags extends readonly (infer U extends string)[]\n ? U\n : typeof tags,\n >(\n userComponents?: ReactHTMLComponentMap<T>\n ): 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 <\n T = typeof tags extends readonly (infer U extends string)[]\n ? U\n : typeof tags,\n >(\n userComponents?: ReactHTMLComponentMap<T>\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 interface IInterpreterPluginReact<T, S, L extends LocalesValues> {\n reactNode: ReactNodeCond<T>;\n reactIntlayerNode: IntlayerNodeCond<T>;\n reactInsertion: InsertionCond<T, S, L>;\n reactMarkdown: MarkdownCond<T, S, L>;\n reactHtml: HTMLPluginCond<T, S, L>;\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 = IInterpreterPluginStateCore & {\n reactNode: true;\n reactIntlayerNode: true;\n reactInsertion: true;\n reactMarkdown: true;\n reactHtml: true;\n};\n\nexport type DeepTransformContent<\n T,\n L extends LocalesValues = DeclaredLocales,\n> = DeepTransformContentCore<T, IInterpreterPluginState, L>;\n"],"mappings":";;;;;;;;;;;;;AA2CA,MAAa,sBAA+B;CAC1C,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;CAClB,YACE,OACA,EACE,SACA,GAAG,WAGL,mBAAmB;EACjB,GAAG;EACH,OAAO,KAAK;EACZ,UACE,oBAAC;GAAsB,GAAI;aAAO,KAAK;IAAiC;EAE3E,CAAC;CACL;;AAcD,MAAa,mBAA4B;CACvC,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,UACE,oBAAC;GAAwB,GAAI;aAC1B,mBAAmB,KAAK;IACD;EAE7B,CAAC;CACL;;;;AAqBD,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,kBAA2B;CACtC,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,SAAS;CAC1D,YAAY,MAAwB,OAAO,sBAAsB;E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}
|
|
1
|
+
{"version":3,"file":"plugins.mjs","names":[],"sources":["../../src/plugins.tsx"],"sourcesContent":["import {\n type DeepTransformContent as DeepTransformContentCore,\n getMarkdownMetadata,\n type HTMLContent,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n type InsertionContent,\n type MarkdownContent,\n type Plugins,\n splitInsertionTemplate,\n} from '@intlayer/core';\nimport {\n type DeclaredLocales,\n type KeyPath,\n type LocalesValues,\n NodeType,\n} from '@intlayer/types';\nimport {\n createElement,\n Fragment,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { ContentSelectorRenderer } from './editor';\nimport { EditedContentRenderer } from './editor/useEditedContentRenderer';\nimport { HTMLRendererPlugin } from './html';\nimport { type IntlayerNode, renderIntlayerNode } from './IntlayerNode';\nimport { MarkdownMetadataRenderer, MarkdownRendererPlugin } from './markdown';\nimport { renderReactElement } from './reactElement/renderReactElement';\nimport type { HTMLComponents } from './utils/HTMLComponentTypes';\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: (\n <EditedContentRenderer {...rest}>{rest.children}</EditedContentRenderer>\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: (\n <ContentSelectorRenderer {...rest}>\n {renderReactElement(node)}\n </ContentSelectorRenderer>\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 ? (\n values: {\n [K in T['fields'][number]]: ReactNode;\n }\n ) => 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 return deepTransformNode(children, {\n ...props,\n children,\n keyPath: newKeyPath,\n plugins: [insertionStringPlugin, ...(props.plugins ?? [])],\n });\n },\n};\n\n/**\n * MARKDOWN PLUGIN\n */\n\nexport type MarkdownStringCond<T> = T extends string\n ? IntlayerNode<\n string,\n {\n metadata: DeepTransformContent<string>;\n use: (components: HTMLComponents<'permissive', {}>) => 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 <ContentSelectorRenderer {...rest}>\n <MarkdownMetadataRenderer\n {...rest}\n metadataKeyPath={props.keyPath}\n >\n {node}\n </MarkdownMetadataRenderer>\n </ContentSelectorRenderer>\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 <ContentSelectorRenderer {...rest}>\n <MarkdownRendererPlugin {...rest} {...(components ?? {})}>\n {node}\n </MarkdownRendererPlugin>\n </ContentSelectorRenderer>\n ),\n additionalProps: {\n metadata: metadataNodes,\n },\n });\n\n const element = render() 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 metadata?: infer U;\n tags?: infer U;\n}\n ? {\n use: (components?: HTMLComponents<'permissive', U>) => IntlayerNode<M>;\n metadata: DeepTransformContent<U>;\n }\n : never;\n\nexport const markdownPlugin: Plugins = {\n id: 'markdown-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === 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 ? {\n use: (components?: HTMLComponents<'permissive', U>) => IntlayerNode<I>;\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 = IInterpreterPluginStateCore & {\n reactNode: true;\n reactIntlayerNode: true;\n reactInsertion: true;\n reactMarkdown: true;\n reactHtml: true;\n};\n\nexport type DeepTransformContent<\n T,\n L extends LocalesValues = DeclaredLocales,\n> = DeepTransformContentCore<T, IInterpreterPluginState, L>;\n"],"mappings":";;;;;;;;;;;;;AAuCA,MAAa,sBAA+B;CAC1C,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;CAClB,YACE,OACA,EACE,SACA,GAAG,WAGL,mBAAmB;EACjB,GAAG;EACH,OAAO,KAAK;EACZ,UACE,oBAAC;GAAsB,GAAI;aAAO,KAAK;IAAiC;EAE3E,CAAC;CACL;;AAcD,MAAa,mBAA4B;CACvC,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,MAAM,UAAU,eACvB,OAAO,KAAK,QAAQ;CAEtB,YACE,MACA,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ACjC,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,SAAS;CAE1D,YAAY,MAA2B,UAAU;EAC/C,MAAM,OAAO,KAAK,SAAS;EAC3B,MAAM,EAAE,SAAS,GAAG,SAAS;EAG7B,MAAM,UAAU,mBACd,cAAc,oBAAoB;GAAE,GAAG;GAAM;GAAM;GAAgB,CAAC;EAEtE,MAAM,UAAU,QAAQ;AAExB,SAAO,IAAI,MAAM,SAAS,EACxB,IAAI,QAAQ,MAAM,UAAU;AAC1B,OAAI,SAAS,QACX,QAAO;AAGT,OAAI,SAAS,MAEX,SAAQ,mBAAoC,OAAO,eAAe;AAGpE,UAAO,QAAQ,IAAI,QAAQ,MAAM,SAAS;KAE7C,CAAC;;CAEL"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react0 from "react";
|
|
2
2
|
import { FC, PropsWithChildren } from "react";
|
|
3
3
|
import { LocalesValues } from "@intlayer/types";
|
|
4
4
|
|
|
@@ -12,7 +12,7 @@ type IntlayerValue = {
|
|
|
12
12
|
/**
|
|
13
13
|
* Context that stores the current locale on the client side.
|
|
14
14
|
*/
|
|
15
|
-
declare const IntlayerClientContext:
|
|
15
|
+
declare const IntlayerClientContext: react0.Context<IntlayerValue>;
|
|
16
16
|
/**
|
|
17
17
|
* Hook that provides the current Intlayer client context.
|
|
18
18
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _intlayer_types14 from "@intlayer/types";
|
|
2
2
|
|
|
3
3
|
//#region src/client/format/useCurrency.d.ts
|
|
4
4
|
/**
|
|
@@ -26,7 +26,7 @@ import * as _intlayer_types11 from "@intlayer/types";
|
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
28
|
declare const useCurrency: () => (value: string | number, options?: Intl.NumberFormatOptions & {
|
|
29
|
-
locale?:
|
|
29
|
+
locale?: _intlayer_types14.LocalesValues;
|
|
30
30
|
}) => string;
|
|
31
31
|
//#endregion
|
|
32
32
|
export { useCurrency };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _intlayer_types11 from "@intlayer/types";
|
|
2
2
|
|
|
3
3
|
//#region src/client/format/useNumber.d.ts
|
|
4
4
|
/**
|
|
@@ -24,7 +24,7 @@ import * as _intlayer_types7 from "@intlayer/types";
|
|
|
24
24
|
* A number formatting function bound to the active locale.
|
|
25
25
|
*/
|
|
26
26
|
declare const useNumber: () => (value: string | number, options?: Intl.NumberFormatOptions & {
|
|
27
|
-
locale?:
|
|
27
|
+
locale?: _intlayer_types11.LocalesValues;
|
|
28
28
|
}) => string;
|
|
29
29
|
//#endregion
|
|
30
30
|
export { useNumber };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNumber.d.ts","names":[],"sources":["../../../../src/client/format/useNumber.ts"],"mappings":";;;;;;AA4BA;;;;;;;;;;;;;;;;;;;cAAa,SAAA,SAAS,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,
|
|
1
|
+
{"version":3,"file":"useNumber.d.ts","names":[],"sources":["../../../../src/client/format/useNumber.ts"],"mappings":";;;;;;AA4BA;;;;;;;;;;;;;;;;;;;cAAa,SAAA,SAAS,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,iBAAA,CAAA,aAAA;AAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _intlayer_types15 from "@intlayer/types";
|
|
2
2
|
|
|
3
3
|
//#region src/client/format/usePercentage.d.ts
|
|
4
4
|
/**
|
|
@@ -20,7 +20,7 @@ import * as _intlayer_types14 from "@intlayer/types";
|
|
|
20
20
|
* A function that formats numbers or numeric strings into localized percentages.
|
|
21
21
|
*/
|
|
22
22
|
declare const usePercentage: () => (value: string | number, options?: Intl.NumberFormatOptions & {
|
|
23
|
-
locale?:
|
|
23
|
+
locale?: _intlayer_types15.LocalesValues;
|
|
24
24
|
}) => string;
|
|
25
25
|
//#endregion
|
|
26
26
|
export { usePercentage };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IInterpreterPluginState as IInterpreterPluginState$1 } from "../plugins.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _intlayer_core1 from "@intlayer/core";
|
|
3
3
|
import { Dictionary, DictionaryKeys, LocalesValues, StrictModeLocaleMap } from "@intlayer/types";
|
|
4
4
|
|
|
5
5
|
//#region src/client/useDictionaryDynamic.d.ts
|
|
@@ -8,7 +8,7 @@ import { Dictionary, DictionaryKeys, LocalesValues, StrictModeLocaleMap } from "
|
|
|
8
8
|
*
|
|
9
9
|
* If the locale is not provided, it will use the locale from the client context
|
|
10
10
|
*/
|
|
11
|
-
declare const useDictionaryDynamic: <T extends Dictionary, K extends DictionaryKeys>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, key: K, locale?: LocalesValues) =>
|
|
11
|
+
declare const useDictionaryDynamic: <T extends Dictionary, K extends DictionaryKeys>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, key: K, locale?: LocalesValues) => _intlayer_core1.DeepTransformContent<T["content"], IInterpreterPluginState$1, "af" | "af-ZA" | "ar" | "ar-AE" | "ar-BH" | "ar-DZ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MA" | "ar-OM" | "ar-QA" | "ar-SA" | "ar-SY" | "ar-TN" | "ar-YE" | "az" | "az-AZ" | "be" | "be-BY" | "bg" | "bg-BG" | "bs" | "bs-BA" | "ca" | "ca-ES" | "cs" | "cs-CZ" | "cy" | "cy-GB" | "da" | "da-DK" | "de" | "de-AT" | "de-CH" | "de-DE" | "de-LI" | "de-LU" | "dv" | "dv-MV" | "el" | "el-GR" | "en" | "en-AU" | "en-BZ" | "en-CA" | "en-CB" | "en-GB" | "en-IE" | "en-JM" | "en-NZ" | "en-PH" | "en-TT" | "en-US" | "en-ZA" | "en-ZW" | "eo" | "es" | "es-AR" | "es-BO" | "es-CL" | "es-CO" | "es-CR" | "es-DO" | "es-EC" | "es-ES" | "es-GT" | "es-HN" | "es-MX" | "es-NI" | "es-PA" | "es-PE" | "es-PR" | "es-PY" | "es-SV" | "es-UY" | "es-VE" | "et" | "et-EE" | "eu" | "eu-ES" | "fa" | "fa-IR" | "fi" | "fi-FI" | "fo" | "fo-FO" | "fr" | "fr-BE" | "fr-CA" | "fr-CH" | "fr-FR" | "fr-LU" | "fr-MC" | "ga" | "ga-IE" | "gd" | "gd-GB" | "gl" | "gl-ES" | "gu" | "gu-IN" | "he" | "he-IL" | "hi" | "hi-IN" | "hr" | "hr-BA" | "hr-HR" | "hu" | "hu-HU" | "hy" | "hy-AM" | "id" | "id-ID" | "is" | "is-IS" | "it" | "it-CH" | "it-IT" | "ja" | "ja-JP" | "ka" | "ka-GE" | "kk" | "kk-KZ" | "kn" | "kn-IN" | "ko" | "ko-KR" | "kok" | "kok-IN" | "ku" | "ku-TR" | "ky" | "ky-KG" | "lt" | "lt-LT" | "lv" | "lv-LV" | "mi" | "mi-NZ" | "mk" | "mk-MK" | "mn" | "mn-MN" | "mr" | "mr-IN" | "ms" | "ms-BN" | "ms-MY" | "mt" | "mt-MT" | "ml" | "ml-IN" | "no" | "nb" | "nb-NO" | "nl" | "nl-BE" | "nl-NL" | "nn" | "nn-NO" | "ns" | "ns-ZA" | "pa" | "pa-IN" | "pl" | "pl-PL" | "ps" | "ps-AR" | "pt" | "pt-BR" | "pt-PT" | "qu" | "qu-BO" | "qu-EC" | "qu-PE" | "ro" | "ro-RO" | "ro-MD" | "rm" | "rm-CH" | "ru" | "ru-RU" | "ru-MD" | "sa" | "sa-IN" | "se" | "se-FI" | "se-NO" | "se-SE" | "hsb" | "hsb-DE" | "dsb" | "dsb-DE" | "sk" | "sk-SK" | "sl" | "sl-SI" | "sq" | "sq-AL" | "sr" | "sr-BA" | "sr-SP" | "sv" | "sv-FI" | "sv-SE" | "sw" | "sw-KE" | "syr" | "syr-SY" | "ta" | "ta-IN" | "te" | "te-IN" | "th" | "th-TH" | "tl" | "tl-PH" | "tn" | "tn-ZA" | "tr" | "tr-TR" | "tt" | "tt-RU" | "ts" | "uk" | "uk-UA" | "ur" | "ur-PK" | "uz" | "uz-UZ" | "vi" | "vi-VN" | "ve" | "ve-ZA" | "xh" | "xh-ZA" | "zh" | "zh-Hans" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-SG" | "zh-Hant" | "zu" | "zu-ZA" | "bn" | "bn-BD" | "bn-IN" | "bn-MM" | "my" | "my-MM" | "km" | "km-KH" | "lo" | "lo-LA" | "yo" | "yo-NG" | "yi" | "yi-001" | "am" | "am-ET" | "ne" | "ne-NP" | "si" | "si-LK" | "sr-Cyrl" | "sr-RS" | "en-IN" | "en-SG" | "en-HK" | "en-NG" | "en-PK" | "en-MY" | "en-BW" | "en-KE" | "en-TZ" | "en-GH" | "en-UG" | "es-CU" | "es-US" | "pt-GW" | "pt-MZ" | "pt-ST" | "pt-CV" | "pt-TL" | "pt-MO" | "zh-TW" | "ar-MR" | "ar-PS" | "ar-SD" | "ar-DJ" | "ar-SO" | "ar-TD" | "ar-KM" | (string & {})>;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { useDictionaryDynamic };
|
|
14
14
|
//# sourceMappingURL=useDictionaryDynamic.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IInterpreterPluginState as IInterpreterPluginState$1 } from "../plugins.js";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _intlayer_core0 from "@intlayer/core";
|
|
3
|
+
import * as _intlayer_types0 from "@intlayer/types";
|
|
4
4
|
import { DeclaredLocales, DictionaryKeys, LocalesValues } from "@intlayer/types";
|
|
5
5
|
|
|
6
6
|
//#region src/client/useIntlayer.d.ts
|
|
@@ -24,7 +24,7 @@ import { DeclaredLocales, DictionaryKeys, LocalesValues } from "@intlayer/types"
|
|
|
24
24
|
* };
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
|
-
declare const useIntlayer: <T extends DictionaryKeys, L extends LocalesValues = DeclaredLocales>(key: T, locale?: L) =>
|
|
27
|
+
declare const useIntlayer: <T extends DictionaryKeys, L extends LocalesValues = DeclaredLocales>(key: T, locale?: L) => _intlayer_core0.DeepTransformContent<_intlayer_types0.DictionaryRegistryContent<T>, IInterpreterPluginState$1, L>;
|
|
28
28
|
//#endregion
|
|
29
29
|
export { useIntlayer };
|
|
30
30
|
//# sourceMappingURL=useIntlayer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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,eAAA,CAAA,oBAAA,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,eAAA,CAAA,oBAAA,CAAA,gBAAA,CAAA,yBAAA,CAAA,CAAA,GAAA,yBAAA,EAAA,CAAA"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _intlayer_types0 from "@intlayer/types";
|
|
2
2
|
|
|
3
3
|
//#region src/client/useLocaleBase.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* On the client side, hook to get the current locale and all related fields
|
|
6
6
|
*/
|
|
7
7
|
declare const useLocaleBase: () => {
|
|
8
|
-
locale:
|
|
9
|
-
defaultLocale:
|
|
10
|
-
availableLocales:
|
|
11
|
-
setLocale: (newLocale:
|
|
8
|
+
locale: _intlayer_types0.LocalesValues;
|
|
9
|
+
defaultLocale: _intlayer_types0.Locale;
|
|
10
|
+
availableLocales: _intlayer_types0.Locale[];
|
|
11
|
+
setLocale: (newLocale: _intlayer_types0.LocalesValues) => void;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
14
14
|
export { useLocaleBase };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _intlayer_types4 from "@intlayer/types";
|
|
2
2
|
import { LocalesValues } from "@intlayer/types";
|
|
3
3
|
|
|
4
4
|
//#region src/client/useLocaleStorage.d.ts
|
|
@@ -8,13 +8,13 @@ import { LocalesValues } from "@intlayer/types";
|
|
|
8
8
|
/**
|
|
9
9
|
* Get the locale cookie
|
|
10
10
|
*/
|
|
11
|
-
declare const localeInStorage:
|
|
11
|
+
declare const localeInStorage: _intlayer_types4.Locale;
|
|
12
12
|
/**
|
|
13
13
|
* @deprecated Use localeInStorage instead
|
|
14
14
|
*
|
|
15
15
|
* Get the locale cookie
|
|
16
16
|
*/
|
|
17
|
-
declare const localeCookie:
|
|
17
|
+
declare const localeCookie: _intlayer_types4.Locale;
|
|
18
18
|
/**
|
|
19
19
|
* Set the locale cookie
|
|
20
20
|
*/
|
|
@@ -29,7 +29,7 @@ declare const setLocaleCookie: (locale: LocalesValues, isCookieEnabled?: boolean
|
|
|
29
29
|
* Hook that provides the locale cookie and a function to set it
|
|
30
30
|
*/
|
|
31
31
|
declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
|
|
32
|
-
getLocale: () =>
|
|
32
|
+
getLocale: () => _intlayer_types4.Locale;
|
|
33
33
|
setLocale: (locale: LocalesValues) => void;
|
|
34
34
|
};
|
|
35
35
|
/**
|
|
@@ -40,7 +40,7 @@ declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
|
|
|
40
40
|
* Hook that provides the locale cookie and a function to set it
|
|
41
41
|
*/
|
|
42
42
|
declare const useLocaleCookie: (isCookieEnabled?: boolean) => {
|
|
43
|
-
localeCookie:
|
|
43
|
+
localeCookie: _intlayer_types4.Locale;
|
|
44
44
|
setLocaleCookie: (locale: LocalesValues) => void;
|
|
45
45
|
};
|
|
46
46
|
//#endregion
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { HTMLComponents } from "../utils/HTMLComponentTypes.js";
|
|
1
2
|
import { FC, PropsWithChildren } from "react";
|
|
2
3
|
|
|
3
4
|
//#region src/html/HTMLProvider.d.ts
|
|
4
5
|
type HTMLContextValue = {
|
|
5
|
-
components?:
|
|
6
|
+
components?: HTMLComponents<'permissive', {}>;
|
|
6
7
|
};
|
|
7
8
|
type HTMLProviderProps = PropsWithChildren<{
|
|
8
9
|
/**
|
|
9
10
|
* Component overrides for HTML tags.
|
|
10
11
|
*/
|
|
11
|
-
components?:
|
|
12
|
+
components?: HTMLComponents<'permissive', {}>;
|
|
12
13
|
}>;
|
|
13
14
|
declare const useHTMLContext: () => HTMLContextValue;
|
|
14
15
|
declare const HTMLProvider: FC<HTMLProviderProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HTMLProvider.d.ts","names":[],"sources":["../../../src/html/HTMLProvider.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"HTMLProvider.d.ts","names":[],"sources":["../../../src/html/HTMLProvider.tsx"],"mappings":";;;;KAUK,gBAAA;EACH,UAAA,GAAa,cAAA;AAAA;AAAA,KAGV,iBAAA,GAAoB,iBAAA;;;;EAIvB,UAAA,GAAa,cAAA;AAAA;AAAA,cAKF,cAAA,QAAc,gBAAA;AAAA,cAEd,YAAA,EAAc,EAAA,CAAG,iBAAA"}
|
|
@@ -1,14 +1,118 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HTMLComponents } from "../utils/HTMLComponentTypes.js";
|
|
2
|
+
import * as react0 from "react";
|
|
2
3
|
import { FC, JSX } from "react";
|
|
3
4
|
|
|
4
5
|
//#region src/html/HTMLRenderer.d.ts
|
|
5
|
-
declare const defaultHTMLComponents:
|
|
6
|
+
declare const defaultHTMLComponents: {} & {
|
|
7
|
+
object?: FC<react0.DetailedHTMLProps<react0.ObjectHTMLAttributes<HTMLObjectElement>, HTMLObjectElement>>;
|
|
8
|
+
hr?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLHRElement>, HTMLHRElement>>;
|
|
9
|
+
th?: FC<react0.DetailedHTMLProps<react0.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>>;
|
|
10
|
+
tr?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>>;
|
|
11
|
+
html?: FC<react0.DetailedHTMLProps<react0.HtmlHTMLAttributes<HTMLHtmlElement>, HTMLHtmlElement>>;
|
|
12
|
+
small?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
13
|
+
sub?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
14
|
+
sup?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
15
|
+
slot?: FC<react0.DetailedHTMLProps<react0.SlotHTMLAttributes<HTMLSlotElement>, HTMLSlotElement>>;
|
|
16
|
+
head?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLHeadElement>, HTMLHeadElement>>;
|
|
17
|
+
body?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>>;
|
|
18
|
+
main?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
19
|
+
header?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
20
|
+
footer?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
21
|
+
nav?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
22
|
+
aside?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
23
|
+
article?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
24
|
+
section?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
25
|
+
div?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
26
|
+
span?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>>;
|
|
27
|
+
h1?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>>;
|
|
28
|
+
h2?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>>;
|
|
29
|
+
h3?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>>;
|
|
30
|
+
h4?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>>;
|
|
31
|
+
h5?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>>;
|
|
32
|
+
h6?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>>;
|
|
33
|
+
p?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>>;
|
|
34
|
+
a?: FC<react0.DetailedHTMLProps<react0.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>>;
|
|
35
|
+
strong?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
36
|
+
b?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
37
|
+
em?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
38
|
+
i?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
39
|
+
u?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
40
|
+
s?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
41
|
+
del?: FC<react0.DetailedHTMLProps<react0.DelHTMLAttributes<HTMLModElement>, HTMLModElement>>;
|
|
42
|
+
ins?: FC<react0.DetailedHTMLProps<react0.InsHTMLAttributes<HTMLModElement>, HTMLModElement>>;
|
|
43
|
+
mark?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
44
|
+
code?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
45
|
+
pre?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLPreElement>, HTMLPreElement>>;
|
|
46
|
+
blockquote?: FC<react0.DetailedHTMLProps<react0.BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>>;
|
|
47
|
+
q?: FC<react0.DetailedHTMLProps<react0.QuoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>>;
|
|
48
|
+
cite?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
49
|
+
abbr?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
50
|
+
address?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
51
|
+
time?: FC<react0.DetailedHTMLProps<react0.TimeHTMLAttributes<HTMLTimeElement>, HTMLTimeElement>>;
|
|
52
|
+
kbd?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
53
|
+
samp?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
54
|
+
var?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
55
|
+
ul?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLUListElement>, HTMLUListElement>>;
|
|
56
|
+
ol?: FC<react0.DetailedHTMLProps<react0.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>>;
|
|
57
|
+
li?: FC<react0.DetailedHTMLProps<react0.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>>;
|
|
58
|
+
dl?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLDListElement>, HTMLDListElement>>;
|
|
59
|
+
dt?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
60
|
+
dd?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
61
|
+
table?: FC<react0.DetailedHTMLProps<react0.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>>;
|
|
62
|
+
thead?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>>;
|
|
63
|
+
tbody?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>>;
|
|
64
|
+
tfoot?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>>;
|
|
65
|
+
td?: FC<react0.DetailedHTMLProps<react0.TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>>;
|
|
66
|
+
caption?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
67
|
+
colgroup?: FC<react0.DetailedHTMLProps<react0.ColgroupHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>>;
|
|
68
|
+
col?: FC<react0.DetailedHTMLProps<react0.ColHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>>;
|
|
69
|
+
form?: FC<react0.DetailedHTMLProps<react0.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>>;
|
|
70
|
+
input?: FC<react0.DetailedHTMLProps<react0.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>>;
|
|
71
|
+
textarea?: FC<react0.DetailedHTMLProps<react0.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>>;
|
|
72
|
+
button?: FC<react0.DetailedHTMLProps<react0.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>>;
|
|
73
|
+
select?: FC<react0.DetailedHTMLProps<react0.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>>;
|
|
74
|
+
option?: FC<react0.DetailedHTMLProps<react0.OptionHTMLAttributes<HTMLOptionElement>, HTMLOptionElement>>;
|
|
75
|
+
optgroup?: FC<react0.DetailedHTMLProps<react0.OptgroupHTMLAttributes<HTMLOptGroupElement>, HTMLOptGroupElement>>;
|
|
76
|
+
label?: FC<react0.DetailedHTMLProps<react0.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>>;
|
|
77
|
+
fieldset?: FC<react0.DetailedHTMLProps<react0.FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>>;
|
|
78
|
+
legend?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>>;
|
|
79
|
+
datalist?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLDataListElement>, HTMLDataListElement>>;
|
|
80
|
+
output?: FC<react0.DetailedHTMLProps<react0.OutputHTMLAttributes<HTMLOutputElement>, HTMLOutputElement>>;
|
|
81
|
+
progress?: FC<react0.DetailedHTMLProps<react0.ProgressHTMLAttributes<HTMLProgressElement>, HTMLProgressElement>>;
|
|
82
|
+
meter?: FC<react0.DetailedHTMLProps<react0.MeterHTMLAttributes<HTMLMeterElement>, HTMLMeterElement>>;
|
|
83
|
+
img?: FC<react0.DetailedHTMLProps<react0.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>>;
|
|
84
|
+
video?: FC<react0.DetailedHTMLProps<react0.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>>;
|
|
85
|
+
audio?: FC<react0.DetailedHTMLProps<react0.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>>;
|
|
86
|
+
source?: FC<react0.DetailedHTMLProps<react0.SourceHTMLAttributes<HTMLSourceElement>, HTMLSourceElement>>;
|
|
87
|
+
track?: FC<react0.DetailedHTMLProps<react0.TrackHTMLAttributes<HTMLTrackElement>, HTMLTrackElement>>;
|
|
88
|
+
picture?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
89
|
+
figure?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
90
|
+
figcaption?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
91
|
+
iframe?: FC<react0.DetailedHTMLProps<react0.IframeHTMLAttributes<HTMLIFrameElement>, HTMLIFrameElement>>;
|
|
92
|
+
embed?: FC<react0.DetailedHTMLProps<react0.EmbedHTMLAttributes<HTMLEmbedElement>, HTMLEmbedElement>>;
|
|
93
|
+
canvas?: FC<react0.DetailedHTMLProps<react0.CanvasHTMLAttributes<HTMLCanvasElement>, HTMLCanvasElement>>;
|
|
94
|
+
svg?: FC<react0.SVGProps<SVGSVGElement>>;
|
|
95
|
+
details?: FC<react0.DetailedHTMLProps<react0.DetailsHTMLAttributes<HTMLDetailsElement>, HTMLDetailsElement>>;
|
|
96
|
+
summary?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
97
|
+
dialog?: FC<react0.DetailedHTMLProps<react0.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>>;
|
|
98
|
+
br?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLBRElement>, HTMLBRElement>>;
|
|
99
|
+
wbr?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
100
|
+
ruby?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
101
|
+
rt?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
102
|
+
rp?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
103
|
+
bdi?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
104
|
+
bdo?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
105
|
+
data?: FC<react0.DetailedHTMLProps<react0.DataHTMLAttributes<HTMLDataElement>, HTMLDataElement>>;
|
|
106
|
+
template?: FC<react0.DetailedHTMLProps<react0.HTMLAttributes<HTMLTemplateElement>, HTMLTemplateElement>>;
|
|
107
|
+
} & {
|
|
108
|
+
[key: string]: FC<react0.HTMLAttributes<HTMLElement>>;
|
|
109
|
+
};
|
|
6
110
|
type RenderHTMLProps = {
|
|
7
111
|
/**
|
|
8
112
|
* Component overrides for HTML tags.
|
|
9
113
|
* Allows you to customize how specific HTML elements are rendered.
|
|
10
114
|
*/
|
|
11
|
-
components?:
|
|
115
|
+
components?: HTMLComponents<'permissive', {}>;
|
|
12
116
|
};
|
|
13
117
|
/**
|
|
14
118
|
* Renders HTML-like content to JSX with the provided components.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HTMLRenderer.d.ts","names":[],"sources":["../../../src/html/HTMLRenderer.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"HTMLRenderer.d.ts","names":[],"sources":["../../../src/html/HTMLRenderer.tsx"],"mappings":";;;;;cAkBa,qBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAED,eAAA;;;;;EAKV,UAAA,GAAa,cAAA;AAAA;;;;;;;cASF,UAAA,GACX,OAAA;EACA;AAAA,IAAgB,eAAA,KACf,GAAA,CAAI,OAAA;;;;;;;cAyBM,eAAA;EAAmB;AAAA,IAAgB,eAAA,MAGtC,OAAA,aAAe,GAAA,CAAA,OAAA;AAAA,KAUb,iBAAA,GAAoB,eAAA;;;;EAI9B,QAAA;AAAA;;;;;;;cASW,YAAA,EAAc,EAAA,CAAG,iBAAA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ExtractTags, ReactComponentProps, ReactHTMLComponent, ReactHTMLComponentMap } from "./types.js";
|
|
2
1
|
import { HTMLProvider, useHTMLContext } from "./HTMLProvider.js";
|
|
3
2
|
import { HTMLRenderer, HTMLRendererProps, RenderHTMLProps, defaultHTMLComponents, renderHTML, useHTMLRenderer } from "./HTMLRenderer.js";
|
|
4
3
|
import { HTMLRendererPlugin } from "./HTMLRendererPlugin.js";
|
|
5
|
-
export {
|
|
4
|
+
export { HTMLProvider, HTMLRenderer, HTMLRendererPlugin, HTMLRendererProps, RenderHTMLProps, defaultHTMLComponents, renderHTML, useHTMLContext, useHTMLRenderer };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FC, PropsWithChildren, ReactNode } from "react";
|
|
1
|
+
import { HTMLComponents } from "../utils/HTMLComponentTypes.js";
|
|
2
|
+
import { FC, HTMLAttributes, PropsWithChildren, ReactNode } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/markdown/MarkdownProvider.d.ts
|
|
5
5
|
type MarkdownProviderOptions = {
|
|
@@ -8,17 +8,13 @@ type MarkdownProviderOptions = {
|
|
|
8
8
|
preserveFrontmatter?: boolean; /** Whether to use the GitHub Tag Filter for security. */
|
|
9
9
|
tagfilter?: boolean;
|
|
10
10
|
};
|
|
11
|
-
type RenderMarkdownOptions = MarkdownProviderOptions & {
|
|
12
|
-
components?: Overrides;
|
|
13
|
-
wrapper?: FC<any>;
|
|
14
|
-
};
|
|
15
11
|
type MarkdownContextValue = {
|
|
16
|
-
renderMarkdown: (markdown: string, components?:
|
|
12
|
+
renderMarkdown: (markdown: string, options?: MarkdownProviderOptions, components?: HTMLComponents<'permissive', {}>, wrapper?: FC<HTMLAttributes<HTMLElement>>) => ReactNode;
|
|
17
13
|
};
|
|
18
14
|
type MarkdownProviderProps = PropsWithChildren<MarkdownProviderOptions & {
|
|
19
|
-
components?:
|
|
20
|
-
wrapper?:
|
|
21
|
-
renderMarkdown?: (markdown: string,
|
|
15
|
+
components?: HTMLComponents<'permissive', {}>;
|
|
16
|
+
wrapper?: FC<HTMLAttributes<HTMLElement>>;
|
|
17
|
+
renderMarkdown?: (markdown: string, options?: MarkdownProviderOptions, components?: HTMLComponents<'permissive', {}>, wrapper?: FC<HTMLAttributes<HTMLElement>>) => ReactNode;
|
|
22
18
|
}>;
|
|
23
19
|
declare const useMarkdownContext: () => MarkdownContextValue;
|
|
24
20
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownProvider.d.ts","names":[],"sources":["../../../src/markdown/MarkdownProvider.tsx"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"MarkdownProvider.d.ts","names":[],"sources":["../../../src/markdown/MarkdownProvider.tsx"],"mappings":";;;;KAaY,uBAAA;iFAEV,UAAA,YAFiC;EAIjC,WAAA,YAJiC;EAMjC,mBAAA,YAFA;EAIA,SAAA;AAAA;AAAA,KAGG,oBAAA;EACH,cAAA,GACE,QAAA,UACA,OAAA,GAAU,uBAAA,EACV,UAAA,GAAa,cAAA,oBACb,OAAA,GAAU,EAAA,CAAG,cAAA,CAAe,WAAA,OACzB,SAAA;AAAA;AAAA,KAGF,qBAAA,GAAwB,iBAAA,CAC3B,uBAAA;EACE,UAAA,GAAa,cAAA;EACb,OAAA,GAAU,EAAA,CAAG,cAAA,CAAe,WAAA;EAC5B,cAAA,IACE,QAAA,UACA,OAAA,GAAU,uBAAA,EACV,UAAA,GAAa,cAAA,oBACb,OAAA,GAAU,EAAA,CAAG,cAAA,CAAe,WAAA,OACzB,SAAA;AAAA;AAAA,cAQI,kBAAA,QAAkB,oBAAA;;;;;;;;;;;;;;;;;;AApBf;;;;;;;cAmEH,gBAAA,EAAkB,EAAA,CAAG,qBAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { HTMLComponents } from "../utils/HTMLComponentTypes.js";
|
|
1
2
|
import { MarkdownProviderOptions } from "./MarkdownProvider.js";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { FC, JSX, ReactNode } from "react";
|
|
3
|
+
import * as react201 from "react";
|
|
4
|
+
import { FC, HTMLAttributes, JSX, ReactNode } from "react";
|
|
5
5
|
|
|
6
6
|
//#region src/markdown/MarkdownRenderer.d.ts
|
|
7
7
|
/**
|
|
@@ -37,7 +37,7 @@ type RenderMarkdownProps = MarkdownProviderOptions & {
|
|
|
37
37
|
* }}
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
|
-
components?:
|
|
40
|
+
components?: HTMLComponents<'permissive', {}>;
|
|
41
41
|
/**
|
|
42
42
|
* Wrapper element or component to be used when there are multiple children.
|
|
43
43
|
* Only used if not wrapped in a MarkdownProvider.
|
|
@@ -47,7 +47,7 @@ type RenderMarkdownProps = MarkdownProviderOptions & {
|
|
|
47
47
|
* wrapper={({ children }) => <div className="markdown-content">{children}</div>}
|
|
48
48
|
* ```
|
|
49
49
|
*/
|
|
50
|
-
wrapper?: FC
|
|
50
|
+
wrapper?: FC<HTMLAttributes<HTMLElement>>;
|
|
51
51
|
};
|
|
52
52
|
/**
|
|
53
53
|
* Renders markdown content to JSX with the provided components and options.
|
|
@@ -134,7 +134,7 @@ declare const useMarkdownRenderer: ({
|
|
|
134
134
|
forceInline,
|
|
135
135
|
preserveFrontmatter,
|
|
136
136
|
tagfilter
|
|
137
|
-
}?: RenderMarkdownProps) => (content: string) => string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean |
|
|
137
|
+
}?: RenderMarkdownProps) => (content: string) => string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react201.ReactPortal | react201.ReactElement<unknown, string | react201.JSXElementConstructor<any>> | Iterable<ReactNode>> | JSX.Element;
|
|
138
138
|
/**
|
|
139
139
|
* Props for the MarkdownRenderer component.
|
|
140
140
|
*
|
|
@@ -183,7 +183,7 @@ type MarkdownRendererProps = RenderMarkdownProps & {
|
|
|
183
183
|
* ```
|
|
184
184
|
*/
|
|
185
185
|
renderMarkdown?: (markdown: string, options?: {
|
|
186
|
-
components?:
|
|
186
|
+
components?: HTMLComponents<'permissive', {}>;
|
|
187
187
|
wrapper?: FC;
|
|
188
188
|
forceBlock?: boolean;
|
|
189
189
|
forceInline?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownRenderer.d.ts","names":[],"sources":["../../../src/markdown/MarkdownRenderer.tsx"],"mappings":";;;;;;;;;AA2BA
|
|
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,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,OAAA,sCAAA,QAAA,CAAA,WAAA,GAAA,QAAA,CAAA,YAAA,mBAAA,QAAA,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"}
|
|
@@ -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
3
|
import { MarkdownMetadataRenderer, MarkdownRendererPlugin } from "./MarkdownRendererPlugin.js";
|
|
4
|
-
import { LegacyMarkdownRenderer, MarkdownRendererOptions,
|
|
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,
|
|
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 };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HTMLComponents } from "../utils/HTMLComponentTypes.js";
|
|
2
|
+
import { RenderRuleHook, RuleType, sanitizer as defaultSanitizer, slugify as defaultSlugify } from "@intlayer/core";
|
|
2
3
|
import { FC, HTMLAttributes, JSX, ReactNode, createElement } from "react";
|
|
3
4
|
|
|
4
5
|
//#region src/markdown/processor.d.ts
|
|
5
6
|
type HTMLTags = keyof JSX.IntrinsicElements;
|
|
6
|
-
type State = ParseState;
|
|
7
7
|
/**
|
|
8
8
|
* Refined MarkdownRendererOptions type.
|
|
9
9
|
*/
|
|
@@ -47,7 +47,7 @@ type MarkdownRendererOptions = Partial<{
|
|
|
47
47
|
/**
|
|
48
48
|
* Selectively control the output of particular HTML tags.
|
|
49
49
|
*/
|
|
50
|
-
components:
|
|
50
|
+
components: HTMLComponents;
|
|
51
51
|
/**
|
|
52
52
|
* Allows for full control over rendering of particular rules.
|
|
53
53
|
*/
|
|
@@ -88,5 +88,5 @@ declare const LegacyMarkdownRenderer: FC<Omit<HTMLAttributes<Element>, 'children
|
|
|
88
88
|
options?: MarkdownRendererOptions;
|
|
89
89
|
}>;
|
|
90
90
|
//#endregion
|
|
91
|
-
export { LegacyMarkdownRenderer, MarkdownRendererOptions,
|
|
91
|
+
export { LegacyMarkdownRenderer, MarkdownRendererOptions, RuleType, compile, compileMarkdown, compiler, defaultSanitizer as sanitizer, defaultSlugify as slugify };
|
|
92
92
|
//# sourceMappingURL=processor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processor.d.ts","names":[],"sources":["../../../src/markdown/processor.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"processor.d.ts","names":[],"sources":["../../../src/markdown/processor.tsx"],"mappings":";;;;;KA4BK,QAAA,SAAiB,GAAA,CAAI,iBAAA;;;;KAKd,uBAAA,GAA0B,OAAA;EAA1B;;;EAIV,aAAA,GACE,GAAA,EAAK,UAAA,QAAkB,aAAA,MACvB,KAAA,EAAO,GAAA,CAAI,mBAAA,KACR,QAAA,EAAU,SAAA,OACV,SAAA;EAHE;;;;EASP,eAAA;EA2CY;;;;EArCZ,qBAAA;EApBoC;;;EAyBpC,kBAAA;EApBE;;;EAyBF,UAAA;EAvBK;;;EA4BL,WAAA;EAfA;;;EAoBA,YAAA;EAAA;;;EAKA,mBAAA;IAAA,CACG,GAAA;EAAA;EAWS;;;EALZ,UAAA,EAAY,cAAA;EAUe;;;EAL3B,UAAA,EAAY,cAAA;EAeZ;;;EAVA,SAAA,GAAY,KAAA,UAAe,GAAA,EAAK,QAAA,EAAU,SAAA;EAoBjC;AAiBX;;EAhCE,OAAA,GAAU,KAAA;EAgFX;;;EA3EC,OAAA;EA8BC;;;EAzBD,mBAAA;EAyEW;;;EApEX,SAAA;AAAA;;;;;cAiBW,eAAA,GACX,QAAA,WACA,OAAA,GAAS,uBAAA,KACR,GAAA,CAAI,OAAA;AAAA,cAgDM,QAAA,GAAQ,QAAA,WAlDH,OAAA,GACP,uBAAA,KACR,GAAA,CAAI,OAAA;AAAA,cAiDM,OAAA,GAAO,QAAA,WAnDF,OAAA,GACP,uBAAA,KACR,GAAA,CAAI,OAAA;;;;cAsDM,sBAAA,EAAwB,EAAA,CACnC,IAAA,CAAK,cAAA,CAAe,OAAA;EAClB,QAAA;EACA,OAAA,GAAU,uBAAA;AAAA"}
|