import { ComponentProps, FC, HTMLAttributes, JSX } from "react"; import { HTMLTagsType } from "@intlayer/core/transpiler"; /** * Helper to map string types from dictionary to TypeScript types */ type PropTypeMap = T extends 'string' ? string : T extends 'number' ? number : T extends 'boolean' ? boolean : T; /** * Helper to extract specific props from the configuration value. */ type PropsFromConfig = Value extends true ? {} : Value extends object ? { [K in Exclude]?: PropTypeMap; } : {}; /** * Smart Type to resolve props based on the key K. */ type ElementProps = K extends keyof JSX.IntrinsicElements ? ComponentProps : HTMLAttributes; /** * Helper: Defines the mapping for the explicitly listed keys in T. * Handles whether they are Required or Optional. */ type DefinedComponents = IsRequired extends true ? { [K in keyof T]: FC & PropsFromConfig>; } : { [K in keyof T]?: FC & PropsFromConfig>; }; /** * Helper: Defines the standard HTML tags NOT listed in T. * These are always optional when included. */ type RestHTMLComponents = { [K in Exclude]?: FC : HTMLAttributes>; }; /** * The supported modes for the HTMLComponents type. */ export type HTMLComponentMode = 'permissive' | 'optional' | 'inclusive' | 'strict'; /** * The main component definition with Mode support. */ export type HTMLComponents = Mode extends 'strict' ? DefinedComponents : Mode extends 'inclusive' // Inclusive: Keys in T are required. Rest of HTML is optional. ? DefinedComponents & RestHTMLComponents : Mode extends 'permissive' // Permissive: Keys in T optional. Rest of HTML optional. Any other string allowed. ? DefinedComponents & RestHTMLComponents & { [key: string]: FC; } // Optional (Default): Keys in T optional. Rest of HTML optional. : DefinedComponents & RestHTMLComponents; export {}; //# sourceMappingURL=HTMLComponentTypes.d.ts.map