UNPKG

1.89 kBTypeScriptView Raw
1import { IBaseProps } from '../BaseComponent.types';
2import { ISettings, ISettingsFunction } from './Customizations';
3import { ICustomizerContext } from './CustomizerContext';
4export declare type ICustomizerProps = IBaseProps & Partial<{
5 /**
6 * Settings are used as general settings for the React tree below.
7 * Components can subscribe to receive the settings by using `customizable`.
8 *
9 * @example
10 * ```
11 * // Settings can be represented by a plain object that contains the key value pairs.
12 * <Customizer settings={{ color: 'red' }} />
13 *
14 * // or a function that receives the current settings and returns the new ones
15 * <Customizer settings={(currentSettings) => ({ ...currentSettings, color: 'red' })} />
16 * ```
17 */
18 settings: ISettings | ISettingsFunction;
19 /**
20 * Scoped settings are settings that are scoped to a specific scope. The
21 * scope is the name that is passed to the `customizable` function when the
22 * the component is customized.
23 *
24 * @example
25 * ```
26 * // Scoped settings can be represented by a plain object that contains the key value pairs.
27 * const myScopedSettings = {
28 * Button: { color: 'red' };
29 * };
30 * <Customizer scopedSettings={myScopedSettings} />
31 *
32 * // or a function that receives the current settings and returns the new ones
33 * const myScopedSettings = {
34 * Button: { color: 'red' };
35 * };
36 * <Customizer scopedSettings={(currentScopedSettings) => ({ ...currentScopedSettings, ...myScopedSettings })} />
37 * ```
38 */
39 scopedSettings: ISettings | ISettingsFunction;
40}> & {
41 /**
42 * Optional transform function for context. Any implementations should take care to return context without
43 * mutating it.
44 */
45 contextTransform?: (context: Readonly<ICustomizerContext>) => ICustomizerContext;
46};