import type { Mapping, PlainObject, RecursivePartial, ValueOf } from 'clientnode'; import type BasePropertyTypes from 'clientnode/property-types'; import type { Requireable } from 'clientnode/property-types'; import type { FocusEvent as ReactFocusEvent, ForwardRefExoticComponent, KeyboardEvent, MouseEvent, ReactElement, ReactNode, RefAttributes } from 'react'; import type { GenericEvent } from 'react-generic-tools/type'; import type { ComponentAdapter, ValidationMapping } from 'web-component-wrapper/type'; import type { LanguageSupport } from '@codemirror/language'; import type { JSONContent } from '@tiptap/core'; import type { ChainedCommands, EditorOptions, Extensions } from '@tiptap/core'; import type { EditorEvents } from '@tiptap/react'; import type { StarterKitOptions } from '@tiptap/starter-kit'; import type { IconProperties, InputReference, SelectProperties, TextAreaProperties, TextFieldProperties } from '../../implementations/type'; import type { BaseModel, NormalizedSelection, ModelState as BaseModelState, Properties as BaseProperties, SelectionDefinition, State as BaseState, StaticWebComponent, ValueState as BaseValueState } from '../../type'; import type { Reference as InputEventMapperReference } from './InputEventMapperWrapper/index'; import type { Reference as CodeMirrorReference } from './CodeMirror/index'; import type { Reference as TipTapReference } from './Tiptap/index'; export type Transformer = (value: T, transformer: DataTransformation, configuration: DefaultProperties) => string; export interface FormatSpecification { options?: PlainObject; transform?: Transformer; } export interface FormatSpecifications { final: FormatSpecification; intermediate?: FormatSpecification; } export interface DataTransformSpecification { format?: FormatSpecifications; parse?: (value: InputType, transformer: DataTransformation, configuration: DefaultProperties) => T; type?: NativeType; } export interface DateTransformSpecification extends DataTransformSpecification { useISOString: boolean; } export type DataTransformation = { boolean: DataTransformSpecification; currency: DataTransformSpecification; date: DateTransformSpecification; 'date-local': DataTransformSpecification; datetime: DataTransformSpecification; 'datetime-local': DataTransformSpecification; time: DataTransformSpecification; 'time-local': DataTransformSpecification; float: DataTransformSpecification; integer: DataTransformSpecification; number: DataTransformSpecification; string?: DataTransformSpecification; } & { [key in Exclude]?: DataTransformSpecification; }; export interface EditorReference { input: InputEventMapperReference | null; } export interface EditorProperties extends Omit, 'onChange' | 'textarea' | 'value'> { id: string; value: number | string; minimumLength: number; maximumLength: number; rows: number; onChange: (value: string, contentTree?: JSONContent) => void; } export interface RichTextEditorButtonProps { action: (command: ChainedCommands) => ChainedCommands; activeIndicator?: string; enabledIndicator?: null | ((command: ChainedCommands) => ChainedCommands); checkedIconName?: string; iconName: string; label?: string; } export interface TiptapProperties extends Omit { onBlur: (event: EditorEvents['focus']) => void; onFocus: (event: EditorEvents['focus']) => void; editor: { options?: Partial; extensions?: Extensions; starterKitOptions?: Partial; }; } export type TiptapProps = Partial; export interface CodeMirrorProperties extends Omit { onBlur: (event: ReactFocusEvent) => void; onFocus: (event: ReactFocusEvent) => void; editor: { mode?: LanguageSupport; }; } export type CodeMirrorProps = Partial; export interface ModelState extends BaseModelState { invalidMaximum: boolean; invalidMinimum: boolean; invalidMaximumLength: boolean; invalidMinimumLength: boolean; invalidInvertedPattern: boolean; invalidPattern: boolean; } export interface Model extends BaseModel { default?: T; state?: ModelState; } export type PartialModel = Partial, 'state'>> & { state?: Partial; }; export interface ValueState extends BaseValueState { representation?: ReactNode; } export type NativeType = ('date' | 'datetime-local' | 'time' | 'week' | 'month' | 'number' | 'range' | 'text'); export type Type = ('date-local' | 'datetime' | 'time-local' | 'boolean' | 'currency' | 'float' | 'integer' | 'string' | NativeType); export interface ChildrenOptions { index: number; normalizedSelection?: NormalizedSelection | null; properties: P; query: string; suggestion: ReactNode | string; value: T; } export interface SuggestionCreatorOptions

{ abortController: AbortController; properties: P; query: string; } export type EditorType = ('code' | 'code(css)' | 'code(cascadingstylesheet)' | 'code(cascadingstylesheets)' | 'code(style)' | 'code(styles)' | 'code(script)' | 'code(js)' | 'code(jsx)' | 'code(javascript)' | 'code(ts)' | 'code(tsx)' | 'code(typescript)' | 'plain' | 'text' | 'richtext'); export interface Properties extends ModelState, BaseProperties { default?: Type; align: 'end' | 'start'; children: (options: ChildrenOptions) => null | ReactElement; editor: EditorType; editorIsActive: boolean; editorIsInitiallyActive: boolean; hidden?: boolean; leadingIcon: string | (IconProperties & { tooltip?: string; }); trailingIcon: string | (IconProperties & { tooltip?: string; }); domNodeProperties: Partial | TiptapProps | TextAreaProperties | TextFieldProperties | Mapping>; attributes?: Mapping; invertedPattern: Array | null | RegExp | string; invertedPatternText: string; labels: SelectionDefinition; maximumLengthText: string; minimumLengthText: string; maximumText: string; minimumText: string; model: Model; onChangeEditorIsActive: (isActive: boolean, event: MouseEvent | undefined, properties: this) => void; onKeyDown: (event: KeyboardEvent, properties: this) => void; onKeyUp: (event: KeyboardEvent, properties: this) => void; onSelect: (event: GenericEvent, properties: this) => void; onSelectionChange: (event: GenericEvent, properties: this) => void; pattern: Array | null | RegExp | string; patternText: string; placeholder: string; representation: ReactNode | string; rows: number; searchSelection: boolean; selectableEditor: boolean; step: number; suggestionCreator?: (options: SuggestionCreatorOptions) => Properties['selection'] | Promise; suggestSelection: boolean; transformer: RecursivePartial>; } export type Props = Partial, 'model'>> & { model?: PartialModel; }; export type DefaultProperties = Omit, 'model'> & { model: Model; }; export type PropertyTypes = { [key in keyof Properties]: ValueOf; }; export interface State extends BaseState { editorIsActive: boolean; hidden?: boolean; modelState: ModelState; representation?: ReactNode | string; showDeclaration: boolean; } export type Adapter = ComponentAdapter, Omit, 'editorIsActive' | 'representation' | 'value'> & { representation?: ReactNode | string; value?: null | T; }>; export interface AdapterWithReferences extends Adapter { references: { input: CodeMirrorReference | InputReference | TipTapReference | null; menu: unknown; wrapper: HTMLDivElement | null; }; } export interface Component extends Omit, 'propTypes'>, StaticWebComponent { (props: Props & RefAttributes>): ReactElement; locales: Array; transformer: DataTransformation; } export declare const modelStatePropertyTypes: { [key in keyof ModelState]: Requireable; }; export declare const propertyTypes: ValidationMapping; export declare const renderProperties: Array; export declare const defaultModelState: ModelState; export declare const defaultInputModel: Model; export declare const defaultProperties: DefaultProperties;