@blinkk/selective-edit
Version:
Selective structured text editor.
67 lines (66 loc) • 2.21 kB
TypeScript
import { TemplateResult } from 'lit-html';
import { Constructor } from './index';
import { DeepObject } from '../utility/deepObject';
import { SelectiveEditor } from '../selective/editor';
/**
* Orientation for colors gradient.
*/
export declare enum ColorsOrientation {
Vertical = "vertical",
Horizontal = "horizontal",
Slope = "slope"
}
export interface ColorsConfig {
colors: Array<string>;
/**
* Use a smooth color gradient?
*/
isSmooth?: boolean;
/**
* Orientation for the color gradient.
*/
orientation?: ColorsOrientation;
}
export interface Option {
/**
* Color for the color hint.
*/
color?: string;
/**
* Gradient color hint.
*/
gradient?: ColorsConfig;
/**
* Value when the option is selected.
*/
value: any;
/**
* Label for the option.
*/
label: string;
}
export interface OptionUiComponent {
templateOption(editor: SelectiveEditor, option: Option): TemplateResult;
}
export interface OptionUIConfig {
handleBlur: (evt: Event) => void;
handleInput: (evt: Event) => void;
isMulti?: boolean;
isOptionSelected: (option: Option) => boolean;
showColorHint?: boolean;
}
export declare function OptionMixin<TBase extends Constructor>(Base: TBase): {
new (...args: any[]): {
ariaLabelForOptionDot(config: OptionUIConfig, option: Option): string;
classesForOptions(config: OptionUIConfig, options: Array<Option>): Record<string, boolean>;
classesForOption(config: OptionUIConfig, option: Option): Record<string, boolean>;
/**
* Are there color hints?
*/
hasColorHints(options: Array<Option>): boolean;
stylesForOptionDot(config: OptionUIConfig, option: Option): Record<string, string>;
templateColorSwatch(editor: SelectiveEditor, data: DeepObject, config: OptionUIConfig, option: Option): TemplateResult;
templateOption(editor: SelectiveEditor, data: DeepObject, config: OptionUIConfig, option: Option): TemplateResult;
templateOptions(editor: SelectiveEditor, data: DeepObject, config: OptionUIConfig, options: Array<Option>): TemplateResult;
};
} & TBase;