import { HTMLComponents } from "./html/HTMLComponentTypes.js"; import { IntlayerNode } from "./IntlayerNode.js"; import { DeepTransformContent as DeepTransformContent$1, IInterpreterPluginState as IInterpreterPluginState$1, Plugins } from "@intlayer/core/interpreter"; import { DeclaredLocales, LocalesValues } from "@intlayer/types/module_augmentation"; import { ReactNode } from "react"; import * as NodeTypes from "@intlayer/types/nodeType"; import { NodeType } from "@intlayer/types/nodeType"; /** --------------------------------------------- * INTLAYER NODE PLUGIN * --------------------------------------------- */ export type IntlayerNodeCond = T extends number | string ? IntlayerNode : never; /** Translation plugin. Replaces node with a locale string if nodeType = Translation. */ export declare const intlayerNodePlugins: Plugins; /** --------------------------------------------- * REACT NODE PLUGIN * --------------------------------------------- */ export type ReactNodeCond = T extends { props: any; key: any; } ? ReactNode : never; /** Translation plugin. Replaces node with a locale string if nodeType = Translation. */ export declare const reactNodePlugins: Plugins; /** --------------------------------------------- * INSERTION PLUGIN * --------------------------------------------- */ export type InsertionCond = T extends { nodeType: NodeType | string; [NodeTypes.INSERTION]: infer I; fields: readonly string[]; } ? (values: V) => I extends string ? V[keyof V] extends string | number ? IntlayerNode : IntlayerNode : DeepTransformContent : never; /** Insertion plugin for React. Handles component/node insertion. */ export declare const insertionPlugin: Plugins; /** * MARKDOWN PLUGIN */ export type MarkdownStringCond = T extends string ? IntlayerNode; use: (components: HTMLComponents<'permissive', {}>) => ReactNode; }> : never; /** Markdown string plugin. Replaces string node with a component that render the markdown. */ export declare const markdownStringPlugin: Plugins; export type MarkdownCond = T extends { nodeType: NodeType | string; [NodeTypes.MARKDOWN]: infer M; tags?: infer U; metadata?: infer V; } ? IntlayerNode) => ReactNode; metadata: DeepTransformContent; }> : never; export declare const markdownPlugin: Plugins; /** --------------------------------------------- * HTML PLUGIN * --------------------------------------------- */ /** * HTML conditional type that enforces: * - All components (Standard or Custom) are OPTIONAL in the `use()` method. * - Custom components props are strictly inferred from the dictionary definition. * * This ensures type safety: * - `html('
Hello
').use({ CustomComponent: ... })` - optional but typed */ export type HTMLPluginCond = T extends { nodeType: NodeType | string; [NodeTypes.HTML]: infer I; tags?: infer U; } ? IntlayerNode) => ReactNode; }> : never; /** HTML plugin. Replaces node with a function that takes components => ReactNode. */ export declare const htmlPlugin: Plugins; /** --------------------------------------------- * PLUGINS RESULT * --------------------------------------------- */ export type IInterpreterPluginReact = { reactNode: ReactNodeCond; reactIntlayerNode: IntlayerNodeCond; reactInsertion: InsertionCond; reactMarkdown: MarkdownCond; reactHtml: HTMLPluginCond; }; /** * Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution. * * Otherwise the the `react-intlayer` plugins will override the types of `intlayer` functions. */ export type IInterpreterPluginState = Omit & { reactNode: true; reactIntlayerNode: true; reactMarkdown: true; reactHtml: true; reactInsertion: true; }; export type DeepTransformContent = DeepTransformContent$1; /** * Get the plugins array for React content transformation. * This function is used by both getIntlayer and getDictionary to ensure consistent plugin configuration. */ export declare const getPlugins: (locale?: LocalesValues, fallback?: boolean) => Plugins[]; //# sourceMappingURL=plugins.d.ts.map