UNPKG

2.2 kBTypeScriptView Raw
1import * as React from 'react';
2export * from './theme/types';
3import { IPropsTheme } from './theme/types';
4export declare type PropsData = Record<string, unknown> | PropArray;
5export declare type PropScalar = string | boolean | number | null | undefined;
6export declare type PropArray = Array<PropScalar | Record<string, unknown>>;
7export declare type PropValue = PropScalar | PropArray | Record<string, unknown> | Function;
8export declare type PropDataObjectType = 'object' | 'array';
9export declare type PropObjectType = PropDataObjectType | 'function';
10export declare type PropTypeScalar = 'string' | 'boolean' | 'number';
11export declare type PropEmptyType = 'null' | 'undefined';
12export declare type PropType = PropTypeScalar | PropEmptyType | PropObjectType;
13export declare type PropValueFactory = (e: PropValueFactoryArgs) => PropValueFactoryResponse | undefined | void;
14export declare type PropValueFactoryResponse = {
15 el?: React.ReactNode;
16 underline?: {
17 color: string | number;
18 style: 'solid' | 'dashed';
19 };
20};
21export declare type PropValueFactoryArgs = {
22 path: string;
23 key: string | number;
24 value: PropValue;
25 type: PropType;
26 theme: IPropsTheme;
27 change(args: {
28 to: string;
29 }): void;
30 onFocus(isFocused: boolean): void;
31};
32export declare type PropFilter = (e: PropFilterArgs) => boolean;
33export declare type PropFilterArgs = {
34 path: string;
35 key: string | number;
36 value: PropValue;
37 type: PropType;
38};
39export declare type PropsEvent = IPropsChangedEvent | IPropsFocusEvent;
40export declare type IPropsChangedEvent<D extends PropsData = any> = {
41 type: 'PROPS/changed';
42 payload: IPropsChange<D>;
43};
44export declare type IPropsChange<D extends PropsData = any> = {
45 action: PropChangeAction;
46 path: string;
47 key: string | number;
48 value: {
49 from: PropValue;
50 to: PropValue;
51 };
52 data: {
53 from: D;
54 to: D;
55 };
56};
57export declare type PropChangeAction = 'CHANGE' | 'INSERT' | 'DELETE';
58export declare type IPropsFocusEvent = {
59 type: 'PROPS/focus';
60 payload: IPropsFocus;
61};
62export declare type IPropsFocus = {
63 isFocused: boolean;
64 path: string;
65};