react-intlayer 8.0.0 → 8.0.1-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/markdown/processor.cjs +5 -0
- package/dist/cjs/markdown/processor.cjs.map +1 -1
- package/dist/cjs/markdown/runtime.cjs.map +1 -1
- package/dist/cjs/plugins.cjs +1 -1
- package/dist/cjs/plugins.cjs.map +1 -1
- package/dist/esm/markdown/processor.mjs +5 -0
- package/dist/esm/markdown/processor.mjs.map +1 -1
- package/dist/esm/markdown/runtime.mjs.map +1 -1
- package/dist/esm/plugins.mjs +1 -1
- package/dist/esm/plugins.mjs.map +1 -1
- package/dist/types/client/format/useCompact.d.ts +2 -2
- package/dist/types/client/format/useCurrency.d.ts +2 -2
- package/dist/types/client/format/useList.d.ts +2 -2
- package/dist/types/client/format/useList.d.ts.map +1 -1
- 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/format/usePercentage.d.ts.map +1 -1
- package/dist/types/client/format/useRelativeTime.d.ts +2 -2
- package/dist/types/client/format/useRelativeTime.d.ts.map +1 -1
- package/dist/types/client/format/useUnit.d.ts +2 -2
- package/dist/types/client/format/useUnit.d.ts.map +1 -1
- package/dist/types/client/useDictionary.d.ts +2 -2
- package/dist/types/client/useIntlayer.d.ts +2 -2
- package/dist/types/client/useLocaleBase.d.ts +5 -5
- package/dist/types/client/useLocaleBase.d.ts.map +1 -1
- package/dist/types/client/useLocaleStorage.d.ts +5 -5
- package/dist/types/html/HTMLRenderer.d.ts +101 -101
- package/dist/types/markdown/processor.d.ts.map +1 -1
- package/dist/types/markdown/runtime.d.ts.map +1 -1
- package/dist/types/plugins.d.ts +2 -2
- package/dist/types/plugins.d.ts.map +1 -1
- package/dist/types/server/IntlayerServerProvider.d.ts +2 -2
- package/dist/types/server/useDictionaryAsync.d.ts +2 -2
- package/dist/types/server/useIntlayer.d.ts +3 -3
- package/dist/types/server/useIntlayer.d.ts.map +1 -1
- package/package.json +9 -9
|
@@ -4,6 +4,11 @@ let _intlayer_core = require("@intlayer/core");
|
|
|
4
4
|
|
|
5
5
|
//#region src/markdown/processor.tsx
|
|
6
6
|
/**
|
|
7
|
+
* it's a fork
|
|
8
|
+
* [markdown-to-jsx v7.7.14](https://github.com/quantizor/markdown-to-jsx) from quantizor
|
|
9
|
+
* [simple-markdown v0.2.2](https://github.com/Khan/simple-markdown) from Khan Academy.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
7
12
|
* Default React runtime for markdown rendering.
|
|
8
13
|
*/
|
|
9
14
|
const DEFAULT_RUNTIME = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processor.cjs","names":["createElement"],"sources":["../../../src/markdown/processor.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"processor.cjs","names":["createElement"],"sources":["../../../src/markdown/processor.tsx"],"sourcesContent":["/**\n * it's a fork\n * [markdown-to-jsx v7.7.14](https://github.com/quantizor/markdown-to-jsx) from quantizor\n * [simple-markdown v0.2.2](https://github.com/Khan/simple-markdown) from Khan Academy.\n */\n\nimport {\n compile as coreCompile,\n sanitizer as defaultSanitizer,\n slugify as defaultSlugify,\n type MarkdownContext,\n type MarkdownOptions,\n type MarkdownRuntime,\n type RenderRuleHook,\n RuleType,\n} from '@intlayer/core';\nimport {\n cloneElement,\n createElement,\n type FC,\n Fragment,\n type HTMLAttributes,\n type JSX,\n type ReactNode,\n} from 'react';\nimport type { HTMLComponents } from '../html/HTMLComponentTypes';\n\n// Re-export RuleType for compatibility\nexport { RuleType };\n\n// Re-export utilities for compatibility\nexport { defaultSlugify as slugify, defaultSanitizer as sanitizer };\n\ntype HTMLTags = keyof JSX.IntrinsicElements;\n\n/**\n * Refined MarkdownRendererOptions type.\n */\nexport type MarkdownRendererOptions = Partial<{\n /**\n * Ultimate control over the output of all rendered JSX.\n */\n createElement: (\n tag: Parameters<typeof createElement>[0],\n props: JSX.IntrinsicAttributes,\n ...children: ReactNode[]\n ) => ReactNode;\n\n /**\n * The library automatically generates an anchor tag for bare URLs included in the markdown\n * document, but this behavior can be disabled if desired.\n */\n disableAutoLink: boolean;\n\n /**\n * Disable the compiler's best-effort transcription of provided raw HTML\n * into JSX-equivalent.\n */\n disableParsingRawHTML: boolean;\n\n /**\n * Forces the compiler to have space between hash sign and the header text.\n */\n enforceAtxHeadings: boolean;\n\n /**\n * Forces the compiler to always output content with a block-level wrapper.\n */\n forceBlock: boolean;\n\n /**\n * Forces the compiler to always output content with an inline wrapper.\n */\n forceInline: boolean;\n\n /**\n * Forces the compiler to wrap results, even if there is only a single child.\n */\n forceWrapper: boolean;\n\n /**\n * Supply additional HTML entity: unicode replacement mappings.\n */\n namedCodesToUnicode: {\n [key: string]: string;\n };\n\n /**\n * Selectively control the output of particular HTML tags.\n */\n components: HTMLComponents;\n\n /**\n * Allows for full control over rendering of particular rules.\n */\n renderRule: RenderRuleHook;\n\n /**\n * Override the built-in sanitizer function for URLs.\n */\n sanitizer: (value: string, tag: HTMLTags, attribute: string) => string | null;\n\n /**\n * Override normalization of non-URI-safe characters for anchor linking.\n */\n slugify: (input: string) => string;\n\n /**\n * Declare the type of the wrapper to be used when there are multiple children.\n */\n wrapper: any | null;\n\n /**\n * Whether to preserve frontmatter in the markdown content.\n */\n preserveFrontmatter: boolean;\n\n /**\n * Whether to use the GitHub Tag Filter.\n */\n tagfilter: boolean;\n}>;\n\n/**\n * Default React runtime for markdown rendering.\n */\nconst DEFAULT_RUNTIME: MarkdownRuntime = {\n createElement: createElement as any,\n cloneElement,\n Fragment,\n normalizeProps: (_tag, props) => props,\n};\n\n/**\n * Compile markdown to React elements.\n * This is the primary export - use this for new code.\n */\nexport const compileMarkdown = (\n markdown: string = '',\n options: MarkdownRendererOptions = {}\n): JSX.Element => {\n const {\n createElement: customCreateElement,\n disableAutoLink,\n disableParsingRawHTML,\n enforceAtxHeadings,\n forceBlock,\n forceInline,\n forceWrapper,\n namedCodesToUnicode,\n components,\n renderRule,\n sanitizer,\n slugify,\n wrapper,\n preserveFrontmatter,\n tagfilter,\n } = options;\n\n const runtime = customCreateElement\n ? { ...DEFAULT_RUNTIME, createElement: customCreateElement as any }\n : DEFAULT_RUNTIME;\n\n const ctx: MarkdownContext<HTMLComponents> = {\n runtime,\n components,\n namedCodesToUnicode,\n sanitizer: sanitizer as any,\n slugify,\n };\n\n const compilerOptions: MarkdownOptions = {\n disableAutoLink,\n disableParsingRawHTML,\n enforceAtxHeadings,\n forceBlock,\n forceInline,\n forceWrapper,\n renderRule,\n wrapper,\n preserveFrontmatter,\n tagfilter,\n };\n\n return coreCompile(markdown, ctx, compilerOptions) as JSX.Element;\n};\n\n// Backward compatibility aliases\nexport const compiler = compileMarkdown;\nexport const compile = compileMarkdown;\n\n/**\n * React component that renders markdown to JSX (legacy).\n */\nexport const LegacyMarkdownRenderer: FC<\n Omit<HTMLAttributes<Element>, 'children'> & {\n children: string;\n options?: MarkdownRendererOptions;\n }\n> = ({ children = '', options, ...props }) => {\n if (process.env.NODE_ENV !== 'production' && typeof children !== 'string') {\n console.error(\n 'intlayer: <Markdown> component only accepts a single string as a child, received:',\n children\n );\n }\n\n return cloneElement(\n compiler(children, options),\n props as JSX.IntrinsicAttributes\n );\n};\n"],"mappings":";;;;;;;;;;;;;AA8HA,MAAM,kBAAmC;CACvC,eAAeA;CACf;CACA;CACA,iBAAiB,MAAM,UAAU;CAClC;;;;;AAMD,MAAa,mBACX,WAAmB,IACnB,UAAmC,EAAE,KACrB;CAChB,MAAM,EACJ,eAAe,qBACf,iBACA,uBACA,oBACA,YACA,aACA,cACA,qBACA,YACA,YACA,WACA,SACA,SACA,qBACA,cACE;AA2BJ,oCAAmB,UArB0B;EAC3C,SALc,sBACZ;GAAE,GAAG;GAAiB,eAAe;GAA4B,GACjE;EAIF;EACA;EACW;EACX;EACD,EAEwC;EACvC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAEiD;;AAIpD,MAAa,WAAW;AACxB,MAAa,UAAU;;;;AAKvB,MAAa,0BAKR,EAAE,WAAW,IAAI,SAAS,GAAG,YAAY;AAC5C,KAAI,QAAQ,IAAI,aAAa,gBAAgB,OAAO,aAAa,SAC/D,SAAQ,MACN,qFACA,SACD;AAGH,gCACE,SAAS,UAAU,QAAQ,EAC3B,MACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.cjs","names":[],"sources":["../../../src/markdown/runtime.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"runtime.cjs","names":[],"sources":["../../../src/markdown/runtime.ts"],"sourcesContent":["import type { HTMLTag, MarkdownRuntime } from '@intlayer/core';\nimport {\n cloneElement,\n createElement,\n Fragment,\n type ReactElement,\n type ReactNode,\n} from 'react';\n\n/**\n * React-specific runtime for the markdown processor.\n * Implements the MarkdownRuntime interface using React's primitives.\n */\nexport const reactRuntime: MarkdownRuntime = {\n /**\n * Creates a React element.\n * Handles the conversion of props and children to React format.\n */\n createElement: (\n type: string | any,\n props: Record<string, any> | null,\n ...children: any[]\n ): ReactNode => {\n // React accepts children as rest args or as a single array\n // If there's only one child, pass it directly to avoid unnecessary array\n if (children.length === 0) {\n return createElement(type, props);\n }\n if (children.length === 1) {\n return createElement(type, props, children[0]);\n }\n return createElement(type, props, ...children);\n },\n\n /**\n * Clones a React element with new props.\n */\n cloneElement: (\n element: unknown,\n props: Record<string, any>,\n ...children: any[]\n ): ReactNode => {\n if (children.length === 0) {\n return cloneElement(element as ReactElement, props);\n }\n return cloneElement(element as ReactElement, props, ...children);\n },\n\n /**\n * React Fragment component.\n */\n Fragment,\n\n /**\n * React-specific prop normalization.\n * React uses className instead of class, htmlFor instead of for, etc.\n * The core processor already handles ATTRIBUTE_TO_NODE_PROP_MAP,\n * so this is mostly a no-op but can be used for additional React-specific transforms.\n */\n normalizeProps: (\n _tag: HTMLTag,\n props: Record<string, any>\n ): Record<string, any> => {\n // The core already handles class -> className and for -> htmlFor\n // via ATTRIBUTE_TO_NODE_PROP_MAP in the attrStringToMap function.\n // This hook is available for any additional React-specific transforms.\n return props;\n },\n};\n\n/**\n * Creates a React runtime with custom createElement for advanced use cases.\n * Useful for wrapping elements or adding middleware.\n */\nexport const createReactRuntime = (\n options: {\n onCreateElement?: (\n type: string | any,\n props: Record<string, any> | null,\n children: any[]\n ) => ReactNode;\n } = {}\n): MarkdownRuntime => {\n const { onCreateElement } = options;\n\n if (onCreateElement) {\n return {\n ...reactRuntime,\n createElement: (\n type: string | any,\n props: Record<string, any> | null,\n ...children: any[]\n ): ReactNode => {\n return onCreateElement(type, props, children);\n },\n };\n }\n\n return reactRuntime;\n};\n\nexport default reactRuntime;\n"],"mappings":";;;;;;;;;AAaA,MAAa,eAAgC;CAK3C,gBACE,MACA,OACA,GAAG,aACW;AAGd,MAAI,SAAS,WAAW,EACtB,iCAAqB,MAAM,MAAM;AAEnC,MAAI,SAAS,WAAW,EACtB,iCAAqB,MAAM,OAAO,SAAS,GAAG;AAEhD,kCAAqB,MAAM,OAAO,GAAG,SAAS;;CAMhD,eACE,SACA,OACA,GAAG,aACW;AACd,MAAI,SAAS,WAAW,EACtB,gCAAoB,SAAyB,MAAM;AAErD,iCAAoB,SAAyB,OAAO,GAAG,SAAS;;CAMlE;CAQA,iBACE,MACA,UACwB;AAIxB,SAAO;;CAEV;;;;;AAMD,MAAa,sBACX,UAMI,EAAE,KACc;CACpB,MAAM,EAAE,oBAAoB;AAE5B,KAAI,gBACF,QAAO;EACL,GAAG;EACH,gBACE,MACA,OACA,GAAG,aACW;AACd,UAAO,gBAAgB,MAAM,OAAO,SAAS;;EAEhD;AAGH,QAAO;;AAGT,sBAAe"}
|
package/dist/cjs/plugins.cjs
CHANGED
|
@@ -78,7 +78,7 @@ const insertionPlugin = {
|
|
|
78
78
|
keyPath: newKeyPath,
|
|
79
79
|
plugins: [insertionStringPlugin, ...props.plugins ?? []]
|
|
80
80
|
});
|
|
81
|
-
if (typeof children === "object" && children !== null && "nodeType" in children &&
|
|
81
|
+
if (typeof children === "object" && children !== null && "nodeType" in children && [_intlayer_types.NodeType.Enumeration, _intlayer_types.NodeType.Condition].includes(children.nodeType)) return (values) => (arg) => {
|
|
82
82
|
const inner = result(arg);
|
|
83
83
|
if (typeof inner === "function") return inner(values);
|
|
84
84
|
return inner;
|
package/dist/cjs/plugins.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.cjs","names":["renderIntlayerNode","EditedContentRenderer","ContentSelectorRenderer","renderReactElement","Fragment","NodeType","MarkdownMetadataRenderer","MarkdownRendererPlugin","HTMLRendererPlugin"],"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 { 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: (\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 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 (children.nodeType === NodeType.Enumeration ||\n children.nodeType === NodeType.Condition)\n ) {\n return (values: any) => (arg: any) => {\n const func = result as Function;\n const inner = func(arg);\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 <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 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 = 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,WAGLA,wCAAmB;EACjB,GAAG;EACH,OAAO,KAAK;EACZ,UACE,2CAACC;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,WAGLD,wCAAmB;EACjB,GAAG;EACH,OAAO;EACP,UACE,2CAACE;GAAwB,GAAI;aAC1BC,2DAAmB,KAAK;IACD;EAE7B,CAAC;CACL;;;;AAqBD,MAAM,yBACJ,UACA,WACc;CACd,MAAM,oDAAgC,UAAU,OAAO;AAEvD,KAAI,OAAO,SAET,QAAO,OAAO;AAIhB,iCACEC,gBACA,MACA,GAAI,OAAO,MAAgB,KAAK,MAAM,mCACtBA,gBAAU,EAAE,KAAK,OAAO,EAAE,KAAK,CAC9C,CACF;;;AAIH,MAAa,kBAA2B;CACtC,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAAY,MAAM,aAAaC,yBAAS;CAC1D,YAAY,MAAwB,OAAO,sBAAsB;EAC/D,MAAM,aAAwB,CAC5B,GAAG,MAAM,SACT,EACE,MAAMA,yBAAS,WAChB,CACF;EAED,MAAM,WAAW,KAAKA,yBAAS;;EAG/B,MAAM,wBAAiC;G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I,SAAS,MAEX,SAAQ,mBAAoC,OAAO,eAAe;AAGpE,UAAO,QAAQ,IAAI,QAAQ,MAAM,SAAS;KAE7C,CAAC;;CAEL"}
|
|
1
|
+
{"version":3,"file":"plugins.cjs","names":["renderIntlayerNode","EditedContentRenderer","ContentSelectorRenderer","renderReactElement","Fragment","NodeType","MarkdownMetadataRenderer","MarkdownRendererPlugin","HTMLRendererPlugin"],"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 { 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: (\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 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 <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 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"],"mappings":";;;;;;;;;;;;;;AAuCA,MAAa,sBAA+B;CAC1C,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;CAClB,YACE,OACA,EACE,SACA,GAAG,WAGLA,wCAAmB;EACjB,GAAG;EACH,OAAO,KAAK;EACZ,UACE,2CAACC;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,WAGLD,wCAAmB;EACjB,GAAG;EACH,OAAO;EACP,UACE,2CAACE;GAAwB,GAAI;aAC1BC,2DAAmB,KAAK;IACD;EAE7B,CAAC;CACL;;;;AAqBD,MAAM,yBACJ,UACA,WACc;CACd,MAAM,oDAAgC,UAAU,OAAO;AAEvD,KAAI,OAAO,SAET,QAAO,OAAO;AAIhB,iCACEC,gBACA,MACA,GAAI,OAAO,MAAgB,KAAK,MAAM,mCACtBA,gBAAU,EAAE,KAAK,OAAO,EAAE,KAAK,CAC9C,CACF;;;AAIH,MAAa,kBAA2B;CACtC,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAAY,MAAM,aAAaC,yBAAS;CAC1D,YAAY,MAAwB,OAAO,sBAAsB;EAC/D,MAAM,aAAwB,CAC5B,GAAG,MAAM,SACT,EACE,MAAMA,yBAAS,WAChB,CACF;EAED,MAAM,WAAW,KAAKA,yBAAS;;EAG/B,MAAM,wBAAiC;GACrC,IAAI;GACJ,YAAY,SAAS,OAAO,SAAS;GACrC,YAAY,MAAc,UAAU,sBAAsB;IACxD,MAAM,oBAAoB,kBAAkB,MAAM;KAChD,GAAG;KACH,UAAU;KACV,SAAS,C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{ RuleType, compile as compile$1, sanitizer as defaultSanitizer, slugify
|
|
|
3
3
|
|
|
4
4
|
//#region src/markdown/processor.tsx
|
|
5
5
|
/**
|
|
6
|
+
* it's a fork
|
|
7
|
+
* [markdown-to-jsx v7.7.14](https://github.com/quantizor/markdown-to-jsx) from quantizor
|
|
8
|
+
* [simple-markdown v0.2.2](https://github.com/Khan/simple-markdown) from Khan Academy.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
6
11
|
* Default React runtime for markdown rendering.
|
|
7
12
|
*/
|
|
8
13
|
const DEFAULT_RUNTIME = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processor.mjs","names":["coreCompile"],"sources":["../../../src/markdown/processor.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"processor.mjs","names":["coreCompile"],"sources":["../../../src/markdown/processor.tsx"],"sourcesContent":["/**\n * it's a fork\n * [markdown-to-jsx v7.7.14](https://github.com/quantizor/markdown-to-jsx) from quantizor\n * [simple-markdown v0.2.2](https://github.com/Khan/simple-markdown) from Khan Academy.\n */\n\nimport {\n compile as coreCompile,\n sanitizer as defaultSanitizer,\n slugify as defaultSlugify,\n type MarkdownContext,\n type MarkdownOptions,\n type MarkdownRuntime,\n type RenderRuleHook,\n RuleType,\n} from '@intlayer/core';\nimport {\n cloneElement,\n createElement,\n type FC,\n Fragment,\n type HTMLAttributes,\n type JSX,\n type ReactNode,\n} from 'react';\nimport type { HTMLComponents } from '../html/HTMLComponentTypes';\n\n// Re-export RuleType for compatibility\nexport { RuleType };\n\n// Re-export utilities for compatibility\nexport { defaultSlugify as slugify, defaultSanitizer as sanitizer };\n\ntype HTMLTags = keyof JSX.IntrinsicElements;\n\n/**\n * Refined MarkdownRendererOptions type.\n */\nexport type MarkdownRendererOptions = Partial<{\n /**\n * Ultimate control over the output of all rendered JSX.\n */\n createElement: (\n tag: Parameters<typeof createElement>[0],\n props: JSX.IntrinsicAttributes,\n ...children: ReactNode[]\n ) => ReactNode;\n\n /**\n * The library automatically generates an anchor tag for bare URLs included in the markdown\n * document, but this behavior can be disabled if desired.\n */\n disableAutoLink: boolean;\n\n /**\n * Disable the compiler's best-effort transcription of provided raw HTML\n * into JSX-equivalent.\n */\n disableParsingRawHTML: boolean;\n\n /**\n * Forces the compiler to have space between hash sign and the header text.\n */\n enforceAtxHeadings: boolean;\n\n /**\n * Forces the compiler to always output content with a block-level wrapper.\n */\n forceBlock: boolean;\n\n /**\n * Forces the compiler to always output content with an inline wrapper.\n */\n forceInline: boolean;\n\n /**\n * Forces the compiler to wrap results, even if there is only a single child.\n */\n forceWrapper: boolean;\n\n /**\n * Supply additional HTML entity: unicode replacement mappings.\n */\n namedCodesToUnicode: {\n [key: string]: string;\n };\n\n /**\n * Selectively control the output of particular HTML tags.\n */\n components: HTMLComponents;\n\n /**\n * Allows for full control over rendering of particular rules.\n */\n renderRule: RenderRuleHook;\n\n /**\n * Override the built-in sanitizer function for URLs.\n */\n sanitizer: (value: string, tag: HTMLTags, attribute: string) => string | null;\n\n /**\n * Override normalization of non-URI-safe characters for anchor linking.\n */\n slugify: (input: string) => string;\n\n /**\n * Declare the type of the wrapper to be used when there are multiple children.\n */\n wrapper: any | null;\n\n /**\n * Whether to preserve frontmatter in the markdown content.\n */\n preserveFrontmatter: boolean;\n\n /**\n * Whether to use the GitHub Tag Filter.\n */\n tagfilter: boolean;\n}>;\n\n/**\n * Default React runtime for markdown rendering.\n */\nconst DEFAULT_RUNTIME: MarkdownRuntime = {\n createElement: createElement as any,\n cloneElement,\n Fragment,\n normalizeProps: (_tag, props) => props,\n};\n\n/**\n * Compile markdown to React elements.\n * This is the primary export - use this for new code.\n */\nexport const compileMarkdown = (\n markdown: string = '',\n options: MarkdownRendererOptions = {}\n): JSX.Element => {\n const {\n createElement: customCreateElement,\n disableAutoLink,\n disableParsingRawHTML,\n enforceAtxHeadings,\n forceBlock,\n forceInline,\n forceWrapper,\n namedCodesToUnicode,\n components,\n renderRule,\n sanitizer,\n slugify,\n wrapper,\n preserveFrontmatter,\n tagfilter,\n } = options;\n\n const runtime = customCreateElement\n ? { ...DEFAULT_RUNTIME, createElement: customCreateElement as any }\n : DEFAULT_RUNTIME;\n\n const ctx: MarkdownContext<HTMLComponents> = {\n runtime,\n components,\n namedCodesToUnicode,\n sanitizer: sanitizer as any,\n slugify,\n };\n\n const compilerOptions: MarkdownOptions = {\n disableAutoLink,\n disableParsingRawHTML,\n enforceAtxHeadings,\n forceBlock,\n forceInline,\n forceWrapper,\n renderRule,\n wrapper,\n preserveFrontmatter,\n tagfilter,\n };\n\n return coreCompile(markdown, ctx, compilerOptions) as JSX.Element;\n};\n\n// Backward compatibility aliases\nexport const compiler = compileMarkdown;\nexport const compile = compileMarkdown;\n\n/**\n * React component that renders markdown to JSX (legacy).\n */\nexport const LegacyMarkdownRenderer: FC<\n Omit<HTMLAttributes<Element>, 'children'> & {\n children: string;\n options?: MarkdownRendererOptions;\n }\n> = ({ children = '', options, ...props }) => {\n if (process.env.NODE_ENV !== 'production' && typeof children !== 'string') {\n console.error(\n 'intlayer: <Markdown> component only accepts a single string as a child, received:',\n children\n );\n }\n\n return cloneElement(\n compiler(children, options),\n props as JSX.IntrinsicAttributes\n );\n};\n"],"mappings":";;;;;;;;;;;;AA8HA,MAAM,kBAAmC;CACxB;CACf;CACA;CACA,iBAAiB,MAAM,UAAU;CAClC;;;;;AAMD,MAAa,mBACX,WAAmB,IACnB,UAAmC,EAAE,KACrB;CAChB,MAAM,EACJ,eAAe,qBACf,iBACA,uBACA,oBACA,YACA,aACA,cACA,qBACA,YACA,YACA,WACA,SACA,SACA,qBACA,cACE;AA2BJ,QAAOA,UAAY,UArB0B;EAC3C,SALc,sBACZ;GAAE,GAAG;GAAiB,eAAe;GAA4B,GACjE;EAIF;EACA;EACW;EACX;EACD,EAEwC;EACvC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAEiD;;AAIpD,MAAa,WAAW;AACxB,MAAa,UAAU;;;;AAKvB,MAAa,0BAKR,EAAE,WAAW,IAAI,SAAS,GAAG,YAAY;AAC5C,KAAI,QAAQ,IAAI,aAAa,gBAAgB,OAAO,aAAa,SAC/D,SAAQ,MACN,qFACA,SACD;AAGH,QAAO,aACL,SAAS,UAAU,QAAQ,EAC3B,MACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.mjs","names":[],"sources":["../../../src/markdown/runtime.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"runtime.mjs","names":[],"sources":["../../../src/markdown/runtime.ts"],"sourcesContent":["import type { HTMLTag, MarkdownRuntime } from '@intlayer/core';\nimport {\n cloneElement,\n createElement,\n Fragment,\n type ReactElement,\n type ReactNode,\n} from 'react';\n\n/**\n * React-specific runtime for the markdown processor.\n * Implements the MarkdownRuntime interface using React's primitives.\n */\nexport const reactRuntime: MarkdownRuntime = {\n /**\n * Creates a React element.\n * Handles the conversion of props and children to React format.\n */\n createElement: (\n type: string | any,\n props: Record<string, any> | null,\n ...children: any[]\n ): ReactNode => {\n // React accepts children as rest args or as a single array\n // If there's only one child, pass it directly to avoid unnecessary array\n if (children.length === 0) {\n return createElement(type, props);\n }\n if (children.length === 1) {\n return createElement(type, props, children[0]);\n }\n return createElement(type, props, ...children);\n },\n\n /**\n * Clones a React element with new props.\n */\n cloneElement: (\n element: unknown,\n props: Record<string, any>,\n ...children: any[]\n ): ReactNode => {\n if (children.length === 0) {\n return cloneElement(element as ReactElement, props);\n }\n return cloneElement(element as ReactElement, props, ...children);\n },\n\n /**\n * React Fragment component.\n */\n Fragment,\n\n /**\n * React-specific prop normalization.\n * React uses className instead of class, htmlFor instead of for, etc.\n * The core processor already handles ATTRIBUTE_TO_NODE_PROP_MAP,\n * so this is mostly a no-op but can be used for additional React-specific transforms.\n */\n normalizeProps: (\n _tag: HTMLTag,\n props: Record<string, any>\n ): Record<string, any> => {\n // The core already handles class -> className and for -> htmlFor\n // via ATTRIBUTE_TO_NODE_PROP_MAP in the attrStringToMap function.\n // This hook is available for any additional React-specific transforms.\n return props;\n },\n};\n\n/**\n * Creates a React runtime with custom createElement for advanced use cases.\n * Useful for wrapping elements or adding middleware.\n */\nexport const createReactRuntime = (\n options: {\n onCreateElement?: (\n type: string | any,\n props: Record<string, any> | null,\n children: any[]\n ) => ReactNode;\n } = {}\n): MarkdownRuntime => {\n const { onCreateElement } = options;\n\n if (onCreateElement) {\n return {\n ...reactRuntime,\n createElement: (\n type: string | any,\n props: Record<string, any> | null,\n ...children: any[]\n ): ReactNode => {\n return onCreateElement(type, props, children);\n },\n };\n }\n\n return reactRuntime;\n};\n\nexport default reactRuntime;\n"],"mappings":";;;;;;;AAaA,MAAa,eAAgC;CAK3C,gBACE,MACA,OACA,GAAG,aACW;AAGd,MAAI,SAAS,WAAW,EACtB,QAAO,cAAc,MAAM,MAAM;AAEnC,MAAI,SAAS,WAAW,EACtB,QAAO,cAAc,MAAM,OAAO,SAAS,GAAG;AAEhD,SAAO,cAAc,MAAM,OAAO,GAAG,SAAS;;CAMhD,eACE,SACA,OACA,GAAG,aACW;AACd,MAAI,SAAS,WAAW,EACtB,QAAO,aAAa,SAAyB,MAAM;AAErD,SAAO,aAAa,SAAyB,OAAO,GAAG,SAAS;;CAMlE;CAQA,iBACE,MACA,UACwB;AAIxB,SAAO;;CAEV;;;;;AAMD,MAAa,sBACX,UAMI,EAAE,KACc;CACpB,MAAM,EAAE,oBAAoB;AAE5B,KAAI,gBACF,QAAO;EACL,GAAG;EACH,gBACE,MACA,OACA,GAAG,aACW;AACd,UAAO,gBAAgB,MAAM,OAAO,SAAS;;EAEhD;AAGH,QAAO;;AAGT,sBAAe"}
|
package/dist/esm/plugins.mjs
CHANGED
|
@@ -77,7 +77,7 @@ const insertionPlugin = {
|
|
|
77
77
|
keyPath: newKeyPath,
|
|
78
78
|
plugins: [insertionStringPlugin, ...props.plugins ?? []]
|
|
79
79
|
});
|
|
80
|
-
if (typeof children === "object" && children !== null && "nodeType" in children &&
|
|
80
|
+
if (typeof children === "object" && children !== null && "nodeType" in children && [NodeType.Enumeration, NodeType.Condition].includes(children.nodeType)) return (values) => (arg) => {
|
|
81
81
|
const inner = result(arg);
|
|
82
82
|
if (typeof inner === "function") return inner(values);
|
|
83
83
|
return inner;
|
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 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 { 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: (\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 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 (children.nodeType === NodeType.Enumeration ||\n children.nodeType === NodeType.Condition)\n ) {\n return (values: any) => (arg: any) => {\n const func = result as Function;\n const inner = func(arg);\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 <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 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 = 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 = DeclaredLoc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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 { 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: (\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 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 <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 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"],"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,oBAA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IAAI,QAAQ,MAAM,SAAS;KAE7C,CAAC;;CAEL;AAiBD,MAAa,iBAA0B;CACrC,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,SAAS;CAC1D,YAAY,MAAuB,OAAO,sBAAsB;EAC9D,MAAM,aAAwB,CAC5B,GAAG,MAAM,SACT,EACE,MAAM,SAAS,UAChB,CACF;EAED,MAAM,WAAW,KAAK,SAAS;AAE/B,SAAO,kBAAkB,UAAU;GACjC,GAAG;GACH;GACA,SAAS;GACT,SAAS,CAAC,sBAAsB,GAAI,MAAM,WAAW,EAAE,CAAE;GAC1D,CAAC;;CAEL;;AA4BD,MAAa,aAAsB;CACjC,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 _intlayer_types5 from "@intlayer/types";
|
|
2
2
|
|
|
3
3
|
//#region src/client/format/useCompact.d.ts
|
|
4
4
|
/**
|
|
@@ -12,7 +12,7 @@ import * as _intlayer_types9 from "@intlayer/types";
|
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
14
|
declare const useCompact: () => (value: string | number, options?: Intl.NumberFormatOptions & {
|
|
15
|
-
locale?:
|
|
15
|
+
locale?: _intlayer_types5.LocalesValues;
|
|
16
16
|
}) => string;
|
|
17
17
|
//#endregion
|
|
18
18
|
export { useCompact };
|
|
@@ -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_types10 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_types7 from "@intlayer/types";
|
|
2
2
|
|
|
3
3
|
//#region src/client/format/useList.d.ts
|
|
4
4
|
/**
|
|
@@ -23,7 +23,7 @@ import * as _intlayer_types13 from "@intlayer/types";
|
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
25
|
declare const useList: () => (values: (string | number)[], options?: Intl.ListFormatOptions & {
|
|
26
|
-
locale?:
|
|
26
|
+
locale?: _intlayer_types7.LocalesValues;
|
|
27
27
|
}) => string;
|
|
28
28
|
//#endregion
|
|
29
29
|
export { useList };
|
|
@@ -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,
|
|
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,gBAAA,CAAA,aAAA;AAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _intlayer_types4 from "@intlayer/types";
|
|
2
2
|
|
|
3
3
|
//#region src/client/format/useNumber.d.ts
|
|
4
4
|
/**
|
|
@@ -24,7 +24,7 @@ import * as _intlayer_types11 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_types4.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,gBAAA,CAAA,aAAA;AAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _intlayer_types8 from "@intlayer/types";
|
|
2
2
|
|
|
3
3
|
//#region src/client/format/usePercentage.d.ts
|
|
4
4
|
/**
|
|
@@ -20,7 +20,7 @@ import * as _intlayer_types12 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_types8.LocalesValues;
|
|
24
24
|
}) => string;
|
|
25
25
|
//#endregion
|
|
26
26
|
export { usePercentage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePercentage.d.ts","names":[],"sources":["../../../../src/client/format/usePercentage.ts"],"mappings":";;;;;;AAwBA;;;;;;;;;;;;;;;cAAa,aAAA,SAAa,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,
|
|
1
|
+
{"version":3,"file":"usePercentage.d.ts","names":[],"sources":["../../../../src/client/format/usePercentage.ts"],"mappings":";;;;;;AAwBA;;;;;;;;;;;;;;;cAAa,aAAA,SAAa,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,gBAAA,CAAA,aAAA;AAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _intlayer_types6 from "@intlayer/types";
|
|
2
2
|
|
|
3
3
|
//#region src/client/format/useRelativeTime.d.ts
|
|
4
4
|
/**
|
|
@@ -20,7 +20,7 @@ import * as _intlayer_types14 from "@intlayer/types";
|
|
|
20
20
|
* bound to the current client locale.
|
|
21
21
|
*/
|
|
22
22
|
declare const useRelativeTime: () => (from: string | number | Date, to?: string | number | Date, options?: Intl.RelativeTimeFormatOptions & {
|
|
23
|
-
locale?:
|
|
23
|
+
locale?: _intlayer_types6.LocalesValues;
|
|
24
24
|
unit?: Intl.RelativeTimeFormatUnit;
|
|
25
25
|
}) => string;
|
|
26
26
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRelativeTime.d.ts","names":[],"sources":["../../../../src/client/format/useRelativeTime.ts"],"mappings":";;;;;;AAwBA;;;;;;;;;;;;;;;cAAa,eAAA,SAAe,IAAA,oBAAA,IAAA,EAAA,EAAA,qBAAA,IAAA,EAAA,OAAA,GAAA,IAAA,CAAA,yBAAA;WAAA,
|
|
1
|
+
{"version":3,"file":"useRelativeTime.d.ts","names":[],"sources":["../../../../src/client/format/useRelativeTime.ts"],"mappings":";;;;;;AAwBA;;;;;;;;;;;;;;;cAAa,eAAA,SAAe,IAAA,oBAAA,IAAA,EAAA,EAAA,qBAAA,IAAA,EAAA,OAAA,GAAA,IAAA,CAAA,yBAAA;WAAA,gBAAA,CAAA,aAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _intlayer_types9 from "@intlayer/types";
|
|
2
2
|
|
|
3
3
|
//#region src/client/format/useUnit.d.ts
|
|
4
4
|
/**
|
|
@@ -19,7 +19,7 @@ import * as _intlayer_types15 from "@intlayer/types";
|
|
|
19
19
|
* @returns {Function} A unit formatting function that accepts a value and optional formatting options.
|
|
20
20
|
*/
|
|
21
21
|
declare const useUnit: () => (value: string | number, options?: Intl.NumberFormatOptions & {
|
|
22
|
-
locale?:
|
|
22
|
+
locale?: _intlayer_types9.LocalesValues;
|
|
23
23
|
}) => string;
|
|
24
24
|
//#endregion
|
|
25
25
|
export { useUnit };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUnit.d.ts","names":[],"sources":["../../../../src/client/format/useUnit.ts"],"mappings":";;;;;;AAuBA;;;;;;;;;;;;;;cAAa,OAAA,SAAO,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,
|
|
1
|
+
{"version":3,"file":"useUnit.d.ts","names":[],"sources":["../../../../src/client/format/useUnit.ts"],"mappings":";;;;;;AAuBA;;;;;;;;;;;;;;cAAa,OAAA,SAAO,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,gBAAA,CAAA,aAAA;AAAA"}
|
|
@@ -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 { DeclaredLocales, Dictionary, LocalesValues } from "@intlayer/types";
|
|
4
4
|
|
|
5
5
|
//#region src/client/useDictionary.d.ts
|
|
@@ -8,7 +8,7 @@ import { DeclaredLocales, Dictionary, LocalesValues } from "@intlayer/types";
|
|
|
8
8
|
*
|
|
9
9
|
* If the locale is not provided, it will use the locale from the client context
|
|
10
10
|
*/
|
|
11
|
-
declare const useDictionary: <T extends Dictionary, L extends LocalesValues = DeclaredLocales>(dictionary: T, locale?: L) =>
|
|
11
|
+
declare const useDictionary: <T extends Dictionary, L extends LocalesValues = DeclaredLocales>(dictionary: T, locale?: L) => _intlayer_core1.DeepTransformContent<T["content"], IInterpreterPluginState$1, L>;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { useDictionary };
|
|
14
14
|
//# sourceMappingURL=useDictionary.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IInterpreterPluginState as IInterpreterPluginState$1 } from "../plugins.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _intlayer_core0 from "@intlayer/core";
|
|
3
3
|
import * as _intlayer_types0 from "@intlayer/types";
|
|
4
4
|
import { DeclaredLocales, DictionaryKeys, LocalesValues } from "@intlayer/types";
|
|
5
5
|
|
|
@@ -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,14 +1,14 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _intlayer_types10 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_types10.LocalesValues;
|
|
9
|
+
defaultLocale: _intlayer_types10.Locale;
|
|
10
|
+
availableLocales: _intlayer_types10.Locale[];
|
|
11
|
+
setLocale: (newLocale: _intlayer_types10.LocalesValues) => void;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
14
14
|
export { useLocaleBase };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocaleBase.d.ts","names":[],"sources":["../../../src/client/useLocaleBase.ts"],"mappings":";;;;;;cAYa,aAAA;UASZ,
|
|
1
|
+
{"version":3,"file":"useLocaleBase.d.ts","names":[],"sources":["../../../src/client/useLocaleBase.ts"],"mappings":";;;;;;cAYa,aAAA;UASZ,iBAAA,CAAA,aAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _intlayer_types0 from "@intlayer/types";
|
|
2
2
|
import { LocalesValues } from "@intlayer/types";
|
|
3
3
|
|
|
4
4
|
//#region src/client/useLocaleStorage.d.ts
|
|
@@ -8,13 +8,13 @@ import { LocalesValues } from "@intlayer/types";
|
|
|
8
8
|
/**
|
|
9
9
|
* Get the locale cookie
|
|
10
10
|
*/
|
|
11
|
-
declare const localeInStorage:
|
|
11
|
+
declare const localeInStorage: _intlayer_types0.Locale;
|
|
12
12
|
/**
|
|
13
13
|
* @deprecated Use localeInStorage instead
|
|
14
14
|
*
|
|
15
15
|
* Get the locale cookie
|
|
16
16
|
*/
|
|
17
|
-
declare const localeCookie:
|
|
17
|
+
declare const localeCookie: _intlayer_types0.Locale;
|
|
18
18
|
/**
|
|
19
19
|
* Set the locale cookie
|
|
20
20
|
*/
|
|
@@ -29,7 +29,7 @@ declare const setLocaleCookie: (locale: LocalesValues, isCookieEnabled?: boolean
|
|
|
29
29
|
* Hook that provides the locale cookie and a function to set it
|
|
30
30
|
*/
|
|
31
31
|
declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
|
|
32
|
-
getLocale: () =>
|
|
32
|
+
getLocale: () => _intlayer_types0.Locale;
|
|
33
33
|
setLocale: (locale: LocalesValues) => void;
|
|
34
34
|
};
|
|
35
35
|
/**
|
|
@@ -40,7 +40,7 @@ declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
|
|
|
40
40
|
* Hook that provides the locale cookie and a function to set it
|
|
41
41
|
*/
|
|
42
42
|
declare const useLocaleCookie: (isCookieEnabled?: boolean) => {
|
|
43
|
-
localeCookie:
|
|
43
|
+
localeCookie: _intlayer_types0.Locale;
|
|
44
44
|
setLocaleCookie: (locale: LocalesValues) => void;
|
|
45
45
|
};
|
|
46
46
|
//#endregion
|
|
@@ -1,109 +1,109 @@
|
|
|
1
1
|
import { HTMLComponents } from "./HTMLComponentTypes.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react4 from "react";
|
|
3
3
|
import { FC, JSX } from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/html/HTMLRenderer.d.ts
|
|
6
6
|
declare const defaultHTMLComponents: {} & {
|
|
7
|
-
object?: FC<
|
|
8
|
-
hr?: FC<
|
|
9
|
-
th?: FC<
|
|
10
|
-
tr?: FC<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
html?: FC<
|
|
16
|
-
head?: FC<
|
|
17
|
-
body?: FC<
|
|
18
|
-
main?: FC<
|
|
19
|
-
header?: FC<
|
|
20
|
-
footer?: FC<
|
|
21
|
-
nav?: FC<
|
|
22
|
-
aside?: FC<
|
|
23
|
-
article?: FC<
|
|
24
|
-
section?: FC<
|
|
25
|
-
div?: FC<
|
|
26
|
-
span?: FC<
|
|
27
|
-
h1?: FC<
|
|
28
|
-
h2?: FC<
|
|
29
|
-
h3?: FC<
|
|
30
|
-
h4?: FC<
|
|
31
|
-
h5?: FC<
|
|
32
|
-
h6?: FC<
|
|
33
|
-
p?: FC<
|
|
34
|
-
a?: FC<
|
|
35
|
-
strong?: FC<
|
|
36
|
-
b?: FC<
|
|
37
|
-
em?: FC<
|
|
38
|
-
i?: FC<
|
|
39
|
-
u?: FC<
|
|
40
|
-
s?: FC<
|
|
41
|
-
del?: FC<
|
|
42
|
-
ins?: FC<
|
|
43
|
-
mark?: FC<
|
|
44
|
-
code?: FC<
|
|
45
|
-
pre?: FC<
|
|
46
|
-
blockquote?: FC<
|
|
47
|
-
q?: FC<
|
|
48
|
-
cite?: FC<
|
|
49
|
-
abbr?: FC<
|
|
50
|
-
address?: FC<
|
|
51
|
-
time?: FC<
|
|
52
|
-
kbd?: FC<
|
|
53
|
-
samp?: FC<
|
|
54
|
-
var?: FC<
|
|
55
|
-
ul?: FC<
|
|
56
|
-
ol?: FC<
|
|
57
|
-
li?: FC<
|
|
58
|
-
dl?: FC<
|
|
59
|
-
dt?: FC<
|
|
60
|
-
dd?: FC<
|
|
61
|
-
table?: FC<
|
|
62
|
-
thead?: FC<
|
|
63
|
-
tbody?: FC<
|
|
64
|
-
tfoot?: FC<
|
|
65
|
-
td?: FC<
|
|
66
|
-
caption?: FC<
|
|
67
|
-
colgroup?: FC<
|
|
68
|
-
col?: FC<
|
|
69
|
-
form?: FC<
|
|
70
|
-
input?: FC<
|
|
71
|
-
textarea?: FC<
|
|
72
|
-
button?: FC<
|
|
73
|
-
select?: FC<
|
|
74
|
-
option?: FC<
|
|
75
|
-
optgroup?: FC<
|
|
76
|
-
label?: FC<
|
|
77
|
-
fieldset?: FC<
|
|
78
|
-
legend?: FC<
|
|
79
|
-
datalist?: FC<
|
|
80
|
-
output?: FC<
|
|
81
|
-
progress?: FC<
|
|
82
|
-
meter?: FC<
|
|
83
|
-
img?: FC<
|
|
84
|
-
video?: FC<
|
|
85
|
-
audio?: FC<
|
|
86
|
-
source?: FC<
|
|
87
|
-
track?: FC<
|
|
88
|
-
picture?: FC<
|
|
89
|
-
figure?: FC<
|
|
90
|
-
figcaption?: FC<
|
|
91
|
-
iframe?: FC<
|
|
92
|
-
embed?: FC<
|
|
93
|
-
canvas?: FC<
|
|
94
|
-
svg?: FC<
|
|
95
|
-
details?: FC<
|
|
96
|
-
summary?: FC<
|
|
97
|
-
dialog?: FC<
|
|
98
|
-
br?: FC<
|
|
99
|
-
wbr?: FC<
|
|
100
|
-
ruby?: FC<
|
|
101
|
-
rt?: FC<
|
|
102
|
-
rp?: FC<
|
|
103
|
-
bdi?: FC<
|
|
104
|
-
bdo?: FC<
|
|
105
|
-
data?: FC<
|
|
106
|
-
template?: FC<
|
|
7
|
+
object?: FC<react4.DetailedHTMLProps<react4.ObjectHTMLAttributes<HTMLObjectElement>, HTMLObjectElement>>;
|
|
8
|
+
hr?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLHRElement>, HTMLHRElement>>;
|
|
9
|
+
th?: FC<react4.DetailedHTMLProps<react4.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>>;
|
|
10
|
+
tr?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>>;
|
|
11
|
+
small?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
12
|
+
sub?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
13
|
+
sup?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
14
|
+
slot?: FC<react4.DetailedHTMLProps<react4.SlotHTMLAttributes<HTMLSlotElement>, HTMLSlotElement>>;
|
|
15
|
+
html?: FC<react4.DetailedHTMLProps<react4.HtmlHTMLAttributes<HTMLHtmlElement>, HTMLHtmlElement>>;
|
|
16
|
+
head?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLHeadElement>, HTMLHeadElement>>;
|
|
17
|
+
body?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>>;
|
|
18
|
+
main?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
19
|
+
header?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
20
|
+
footer?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
21
|
+
nav?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
22
|
+
aside?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
23
|
+
article?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
24
|
+
section?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
25
|
+
div?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
26
|
+
span?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>>;
|
|
27
|
+
h1?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>>;
|
|
28
|
+
h2?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>>;
|
|
29
|
+
h3?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>>;
|
|
30
|
+
h4?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>>;
|
|
31
|
+
h5?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>>;
|
|
32
|
+
h6?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>>;
|
|
33
|
+
p?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>>;
|
|
34
|
+
a?: FC<react4.DetailedHTMLProps<react4.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>>;
|
|
35
|
+
strong?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
36
|
+
b?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
37
|
+
em?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
38
|
+
i?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
39
|
+
u?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
40
|
+
s?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
41
|
+
del?: FC<react4.DetailedHTMLProps<react4.DelHTMLAttributes<HTMLModElement>, HTMLModElement>>;
|
|
42
|
+
ins?: FC<react4.DetailedHTMLProps<react4.InsHTMLAttributes<HTMLModElement>, HTMLModElement>>;
|
|
43
|
+
mark?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
44
|
+
code?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
45
|
+
pre?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLPreElement>, HTMLPreElement>>;
|
|
46
|
+
blockquote?: FC<react4.DetailedHTMLProps<react4.BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>>;
|
|
47
|
+
q?: FC<react4.DetailedHTMLProps<react4.QuoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>>;
|
|
48
|
+
cite?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
49
|
+
abbr?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
50
|
+
address?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
51
|
+
time?: FC<react4.DetailedHTMLProps<react4.TimeHTMLAttributes<HTMLTimeElement>, HTMLTimeElement>>;
|
|
52
|
+
kbd?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
53
|
+
samp?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
54
|
+
var?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
55
|
+
ul?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLUListElement>, HTMLUListElement>>;
|
|
56
|
+
ol?: FC<react4.DetailedHTMLProps<react4.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>>;
|
|
57
|
+
li?: FC<react4.DetailedHTMLProps<react4.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>>;
|
|
58
|
+
dl?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLDListElement>, HTMLDListElement>>;
|
|
59
|
+
dt?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
60
|
+
dd?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
61
|
+
table?: FC<react4.DetailedHTMLProps<react4.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>>;
|
|
62
|
+
thead?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>>;
|
|
63
|
+
tbody?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>>;
|
|
64
|
+
tfoot?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>>;
|
|
65
|
+
td?: FC<react4.DetailedHTMLProps<react4.TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>>;
|
|
66
|
+
caption?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
67
|
+
colgroup?: FC<react4.DetailedHTMLProps<react4.ColgroupHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>>;
|
|
68
|
+
col?: FC<react4.DetailedHTMLProps<react4.ColHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>>;
|
|
69
|
+
form?: FC<react4.DetailedHTMLProps<react4.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>>;
|
|
70
|
+
input?: FC<react4.DetailedHTMLProps<react4.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>>;
|
|
71
|
+
textarea?: FC<react4.DetailedHTMLProps<react4.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>>;
|
|
72
|
+
button?: FC<react4.DetailedHTMLProps<react4.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>>;
|
|
73
|
+
select?: FC<react4.DetailedHTMLProps<react4.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>>;
|
|
74
|
+
option?: FC<react4.DetailedHTMLProps<react4.OptionHTMLAttributes<HTMLOptionElement>, HTMLOptionElement>>;
|
|
75
|
+
optgroup?: FC<react4.DetailedHTMLProps<react4.OptgroupHTMLAttributes<HTMLOptGroupElement>, HTMLOptGroupElement>>;
|
|
76
|
+
label?: FC<react4.DetailedHTMLProps<react4.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>>;
|
|
77
|
+
fieldset?: FC<react4.DetailedHTMLProps<react4.FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>>;
|
|
78
|
+
legend?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>>;
|
|
79
|
+
datalist?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLDataListElement>, HTMLDataListElement>>;
|
|
80
|
+
output?: FC<react4.DetailedHTMLProps<react4.OutputHTMLAttributes<HTMLOutputElement>, HTMLOutputElement>>;
|
|
81
|
+
progress?: FC<react4.DetailedHTMLProps<react4.ProgressHTMLAttributes<HTMLProgressElement>, HTMLProgressElement>>;
|
|
82
|
+
meter?: FC<react4.DetailedHTMLProps<react4.MeterHTMLAttributes<HTMLMeterElement>, HTMLMeterElement>>;
|
|
83
|
+
img?: FC<react4.DetailedHTMLProps<react4.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>>;
|
|
84
|
+
video?: FC<react4.DetailedHTMLProps<react4.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>>;
|
|
85
|
+
audio?: FC<react4.DetailedHTMLProps<react4.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>>;
|
|
86
|
+
source?: FC<react4.DetailedHTMLProps<react4.SourceHTMLAttributes<HTMLSourceElement>, HTMLSourceElement>>;
|
|
87
|
+
track?: FC<react4.DetailedHTMLProps<react4.TrackHTMLAttributes<HTMLTrackElement>, HTMLTrackElement>>;
|
|
88
|
+
picture?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
89
|
+
figure?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
90
|
+
figcaption?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
91
|
+
iframe?: FC<react4.DetailedHTMLProps<react4.IframeHTMLAttributes<HTMLIFrameElement>, HTMLIFrameElement>>;
|
|
92
|
+
embed?: FC<react4.DetailedHTMLProps<react4.EmbedHTMLAttributes<HTMLEmbedElement>, HTMLEmbedElement>>;
|
|
93
|
+
canvas?: FC<react4.DetailedHTMLProps<react4.CanvasHTMLAttributes<HTMLCanvasElement>, HTMLCanvasElement>>;
|
|
94
|
+
svg?: FC<react4.SVGProps<SVGSVGElement>>;
|
|
95
|
+
details?: FC<react4.DetailedHTMLProps<react4.DetailsHTMLAttributes<HTMLDetailsElement>, HTMLDetailsElement>>;
|
|
96
|
+
summary?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
97
|
+
dialog?: FC<react4.DetailedHTMLProps<react4.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>>;
|
|
98
|
+
br?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLBRElement>, HTMLBRElement>>;
|
|
99
|
+
wbr?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
100
|
+
ruby?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
101
|
+
rt?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
102
|
+
rp?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
103
|
+
bdi?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
104
|
+
bdo?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
105
|
+
data?: FC<react4.DetailedHTMLProps<react4.DataHTMLAttributes<HTMLDataElement>, HTMLDataElement>>;
|
|
106
|
+
template?: FC<react4.DetailedHTMLProps<react4.HTMLAttributes<HTMLTemplateElement>, HTMLTemplateElement>>;
|
|
107
107
|
} & {
|
|
108
108
|
[key: string]: FC<any>;
|
|
109
109
|
};
|
|
@@ -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":";;;;;KAiCK,QAAA,SAAiB,GAAA,CAAI,iBAAA;;;;KAKd,uBAAA,GAA0B,OAAA;EAM3B;;;EAFT,aAAA,GACE,GAAA,EAAK,UAAA,QAAkB,aAAA,MACvB,KAAA,EAAO,GAAA,CAAI,mBAAA,KACR,QAAA,EAAU,SAAA,OACV,SAAA;EAiDO;;;;EA3CZ,eAAA;EAdoC;;;;EAoBpC,qBAAA;EAdS;;;EAmBT,kBAAA;EAlBe;;;EAuBf,UAAA;EALA;;;EAUA,WAAA;EAUA;;;EALA,YAAA;EAiBA;;;EAZA,mBAAA;IAAA,CACG,GAAA;EAAA;EAgBuC;;;EAV1C,UAAA,EAAY,cAAA;EAyBZ;;;EApBA,UAAA,EAAY,cAAA;EA0CD;;;EArCX,SAAA,GAAY,KAAA,UAAe,GAAA,EAAK,QAAA,EAAU,SAAA;EAsC1C;;;EAjCA,OAAA,GAAU,KAAA;EAmCL;;;EA9BL,OAAA;EA8EqC;;;EAzErC,mBAAA;EAwBS;;;EAnBT,SAAA;AAAA;;AAqEF;;;cApDa,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","names":[],"sources":["../../../src/markdown/runtime.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","names":[],"sources":["../../../src/markdown/runtime.ts"],"mappings":";;;;;;AAaA;;cAAa,YAAA,EAAc,eAAA;;;AA6D3B;;cAAa,kBAAA,GACX,OAAA;EACE,eAAA,IACE,IAAA,gBACA,KAAA,EAAO,MAAA,sBACP,QAAA,YACG,SAAA;AAAA,MAEN,eAAA"}
|
package/dist/types/plugins.d.ts
CHANGED
|
@@ -84,12 +84,12 @@ type IInterpreterPluginReact<T, _S, _L extends LocalesValues> = {
|
|
|
84
84
|
*
|
|
85
85
|
* Otherwise the the `react-intlayer` plugins will override the types of `intlayer` functions.
|
|
86
86
|
*/
|
|
87
|
-
type IInterpreterPluginState = IInterpreterPluginState$1 & {
|
|
87
|
+
type IInterpreterPluginState = Omit<IInterpreterPluginState$1, 'insertion'> & {
|
|
88
88
|
reactNode: true;
|
|
89
89
|
reactIntlayerNode: true;
|
|
90
|
-
reactInsertion: true;
|
|
91
90
|
reactMarkdown: true;
|
|
92
91
|
reactHtml: true;
|
|
92
|
+
reactInsertion: true;
|
|
93
93
|
};
|
|
94
94
|
type DeepTransformContent<T, L extends LocalesValues = DeclaredLocales> = DeepTransformContent$1<T, IInterpreterPluginState, L>;
|
|
95
95
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","names":[],"sources":["../../src/plugins.tsx"],"mappings":";;;;;;;;;AAkCA;KAAY,gBAAA,MAAsB,CAAA,2BAC9B,YAAA,CAAa,CAAA;;cAIJ,mBAAA,EAAqB,OAAA;;;;KA0BtB,aAAA,MAAmB,CAAA;EAC7B,KAAA;EACA,GAAA;AAAA,IAEE,SAAA;;cAIS,gBAAA,EAAkB,OAAA;;AAlC/B;;KA+DY,aAAA,MAAmB,CAAA;EAC7B,QAAA,EAAU,QAAA;EAAA,CACT,QAAA,CAAS,SAAA;EACV,MAAA;AAAA,KAGI,MAAA,UACQ,CAAA,qBAAsB,SAAA,OAE3B,SAAA;;cA4BI,eAAA,EAAiB,OAAA;;;;
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","names":[],"sources":["../../src/plugins.tsx"],"mappings":";;;;;;;;;AAkCA;KAAY,gBAAA,MAAsB,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,CAAA;AAAA;;;;;;KAQhB,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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react3 from "react";
|
|
2
2
|
import { FC, PropsWithChildren } from "react";
|
|
3
3
|
import { LocalesValues } from "@intlayer/types";
|
|
4
4
|
|
|
@@ -13,7 +13,7 @@ declare const IntlayerServerContext: FC<PropsWithChildren<{
|
|
|
13
13
|
value?: LocalesValues;
|
|
14
14
|
}>>;
|
|
15
15
|
Consumer: FC<PropsWithChildren<{
|
|
16
|
-
children: (context: LocalesValues) =>
|
|
16
|
+
children: (context: LocalesValues) => react3.ReactNode;
|
|
17
17
|
}>>;
|
|
18
18
|
_storage: () => {
|
|
19
19
|
value: LocalesValues;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IInterpreterPluginState as IInterpreterPluginState$1 } from "../plugins.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _intlayer_core2 from "@intlayer/core";
|
|
3
3
|
import { DeclaredLocales, Dictionary, LocalesValues, StrictModeLocaleMap } from "@intlayer/types";
|
|
4
4
|
|
|
5
5
|
//#region src/server/useDictionaryAsync.d.ts
|
|
@@ -8,7 +8,7 @@ import { DeclaredLocales, Dictionary, LocalesValues, StrictModeLocaleMap } from
|
|
|
8
8
|
*
|
|
9
9
|
* If the locale is not provided, it will use the locale from the server context
|
|
10
10
|
*/
|
|
11
|
-
declare const useDictionaryAsync: <T extends Dictionary, L extends LocalesValues = DeclaredLocales>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, locale?: L) => Promise<
|
|
11
|
+
declare const useDictionaryAsync: <T extends Dictionary, L extends LocalesValues = DeclaredLocales>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, locale?: L) => Promise<_intlayer_core2.DeepTransformContent<T["content"], IInterpreterPluginState$1, L>>;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { useDictionaryAsync };
|
|
14
14
|
//# sourceMappingURL=useDictionaryAsync.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_core4 from "@intlayer/core";
|
|
3
|
+
import * as _intlayer_types15 from "@intlayer/types";
|
|
4
4
|
import { DictionaryKeys, LocalesValues } from "@intlayer/types";
|
|
5
5
|
|
|
6
6
|
//#region src/server/useIntlayer.d.ts
|
|
@@ -9,7 +9,7 @@ import { DictionaryKeys, LocalesValues } from "@intlayer/types";
|
|
|
9
9
|
*
|
|
10
10
|
* If the locale is not provided, it will use the locale from the server context
|
|
11
11
|
*/
|
|
12
|
-
declare const useIntlayer: <T extends DictionaryKeys, L extends LocalesValues>(key: T, locale?: L) =>
|
|
12
|
+
declare const useIntlayer: <T extends DictionaryKeys, L extends LocalesValues>(key: T, locale?: L) => _intlayer_core4.DeepTransformContent<_intlayer_types15.DictionaryRegistryContent<T>, IInterpreterPluginState$1, L>;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { useIntlayer };
|
|
15
15
|
//# sourceMappingURL=useIntlayer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIntlayer.d.ts","names":[],"sources":["../../../src/server/useIntlayer.ts"],"mappings":";;;;;;;;;;;cAUa,WAAA,aAAyB,cAAA,YAA0B,aAAA,EAC9D,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,CAAA,KAAC,eAAA,CAAA,oBAAA,CAAA,
|
|
1
|
+
{"version":3,"file":"useIntlayer.d.ts","names":[],"sources":["../../../src/server/useIntlayer.ts"],"mappings":";;;;;;;;;;;cAUa,WAAA,aAAyB,cAAA,YAA0B,aAAA,EAC9D,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,CAAA,KAAC,eAAA,CAAA,oBAAA,CAAA,iBAAA,CAAA,yBAAA,CAAA,CAAA,GAAA,yBAAA,EAAA,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-intlayer",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.1-canary.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your React applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -116,14 +116,14 @@
|
|
|
116
116
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
117
117
|
},
|
|
118
118
|
"dependencies": {
|
|
119
|
-
"@intlayer/api": "8.0.
|
|
120
|
-
"@intlayer/config": "8.0.
|
|
121
|
-
"@intlayer/core": "8.0.
|
|
122
|
-
"@intlayer/dictionaries-entry": "8.0.
|
|
123
|
-
"@intlayer/editor-react": "8.0.
|
|
124
|
-
"@intlayer/types": "8.0.
|
|
125
|
-
"@intlayer/unmerged-dictionaries-entry": "8.0.
|
|
126
|
-
"intlayer": "8.0.
|
|
119
|
+
"@intlayer/api": "8.0.1-canary.1",
|
|
120
|
+
"@intlayer/config": "8.0.1-canary.1",
|
|
121
|
+
"@intlayer/core": "8.0.1-canary.1",
|
|
122
|
+
"@intlayer/dictionaries-entry": "8.0.1-canary.1",
|
|
123
|
+
"@intlayer/editor-react": "8.0.1-canary.1",
|
|
124
|
+
"@intlayer/types": "8.0.1-canary.1",
|
|
125
|
+
"@intlayer/unmerged-dictionaries-entry": "8.0.1-canary.1",
|
|
126
|
+
"intlayer": "8.0.1-canary.1"
|
|
127
127
|
},
|
|
128
128
|
"devDependencies": {
|
|
129
129
|
"@craco/types": "7.1.0",
|