import type { CSSProperties, ReactElement } from 'react'; import type { Node as RichContentNode } from 'ricos-schema'; import type { AugmentedRequired } from 'utility-types/dist/mapped-types'; import type { AvailableExperiments, BasePlugin } from '.'; export interface ThemeUtils { isBright: (hexColor: string) => boolean; adaptForeground: (actionColor?: string, fallbackColor?: string) => string | undefined; toCssRgbA: (hexColor: string | undefined, opacity: number) => string | undefined; } /** Colors scheme for `Ricos`. * * {@link https://wix.github.io/ricos/docs/ricos/ricos-api/#theme Read More} * @example * ```ts * const palette: PaletteColors = { * textColor: '#111111', * actionColor: 'rgb(132, 84, 252)', * bgColor: 'transparent', * }; * ``` */ export interface PaletteColors { actionColor?: string; bgColor?: string; textColor?: string; textColorLow?: string; disabledColor?: string; /** Default is black. * When `ActionColor` is too bright, it is replaced with `FallbackColor` when used on bright backgrounds (e.g modals, toolbars). * Therefore this color should remain relatively dark. */ fallbackColor?: string; } /** Colors scheme for `Ricos`. * * {@link https://wix.github.io/ricos/docs/ricos/ricos-api/#theme Read More} * @example * ```ts * const palette: PaletteRgbColors = { * type: 'rgb', * textColor: '132, 84, 252', * actionColor: 'var(--your-rgb-value)', * }; * ``` */ export interface PaletteRgbColors { type: 'rgb'; actionColor?: string; bgColor?: string; textColor?: string; textColorLow?: string; disabledColor?: string; /** Used for actionColor as a fallback. Default is black. **/ fallbackColor?: string; } export interface ThemeData { colors?: PaletteColors; utils: ThemeUtils; customStyles?: RicosCustomStyles; } export interface ThemeGeneratorFunction { (themeData: AugmentedRequired): void; } export interface CustomTextualStyle { fontSize?: CSSProperties['fontSize']; fontFamily?: CSSProperties['fontFamily']; fontWeight?: CSSProperties['fontWeight']; fontStyle?: CSSProperties['fontStyle']; textDecoration?: CSSProperties['textDecoration']; lineHeight?: CSSProperties['lineHeight']; minHeight?: CSSProperties['minHeight']; color?: CSSProperties['color']; backgroundColor?: CSSProperties['backgroundColor']; paddingTop?: CSSProperties['paddingTop']; paddingBottom?: CSSProperties['paddingBottom']; } export interface CustomQuoteStyle extends CustomTextualStyle { borderColor?: CSSProperties['borderColor']; borderWidth?: CSSProperties['borderWidth']; paddingInlineStart?: CSSProperties['paddingInlineStart']; marginInlineStart?: CSSProperties['marginInlineStart']; marginInlineEnd?: CSSProperties['marginInlineEnd']; } export interface CustomCodeBlockStyle { margin?: CSSProperties['margin']; padding?: CSSProperties['padding']; fontSize?: CSSProperties['fontSize']; lineHeight?: CSSProperties['lineHeight']; } export interface CustomMentionStyle { color: CSSProperties['color']; backgroundColor: CSSProperties['backgroundColor']; } export interface CustomFooterToolbarStyle { marginTop?: CSSProperties['marginTop']; paddingInlineStart?: CSSProperties['paddingInlineStart']; paddingInlineEnd?: CSSProperties['paddingInlineEnd']; iconColor?: CSSProperties['color']; } export interface CustomEditorStyle { minHeight?: CSSProperties['minHeight']; maxHeight?: CSSProperties['maxHeight']; placeholder?: Pick; addPluginButton?: { positionInlineStart?: CSSProperties['left'] | CSSProperties['right']; plusIconColor?: CSSProperties['color']; }; } export interface RicosCustomStyles { h1?: CustomTextualStyle; h2?: CustomTextualStyle; h3?: CustomTextualStyle; h4?: CustomTextualStyle; h5?: CustomTextualStyle; h6?: CustomTextualStyle; p?: CustomTextualStyle; quote?: CustomQuoteStyle; link?: CustomTextualStyle; hashtag?: CustomTextualStyle; button?: Pick; codeBlock?: CustomCodeBlockStyle; mention?: CustomMentionStyle; footerToolbar?: CustomFooterToolbarStyle; editor?: CustomEditorStyle; } export interface RicosSettingsStyles { text?: { fontFamily?: CSSProperties['fontFamily']; color?: CSSProperties['color']; }; whitebox?: { borderRadius?: CSSProperties['borderRadius']; boxShadow?: CSSProperties['boxShadow']; }; buttons?: { borderRadius?: CSSProperties['borderRadius']; textColor?: CSSProperties['color']; }; inputs?: { borderColor?: CSSProperties['borderColor']; borderRadius?: CSSProperties['borderRadius']; placeholderColor?: CSSProperties['color']; }; icons?: { color?: CSSProperties['color']; }; dividers?: { color?: CSSProperties['color']; height?: CSSProperties['height']; }; colorPaletteSelectedButton?: { borderRadius?: CSSProperties['borderRadius']; }; smallButtons?: { borderRadius?: CSSProperties['borderRadius']; }; bgColor?: { backgroundColor?: CSSProperties['backgroundColor']; }; disabled?: { backgroundColor?: CSSProperties['backgroundColor']; }; hover?: { color?: CSSProperties['color']; }; modals?: { toolbarZIndex?: CSSProperties['zIndex']; popupZIndex?: CSSProperties['zIndex']; drawerZIndex?: CSSProperties['zIndex']; dialogZIndex?: CSSProperties['zIndex']; tooltipZIndex?: CSSProperties['zIndex']; notificationZIndex?: CSSProperties['zIndex']; /** ** @deprecated **/ baseZIndex?: CSSProperties['zIndex']; }; } export interface RicosNativeStyles { text?: { fontFamily?: CSSProperties['fontFamily']; color?: CSSProperties['color']; }; bgColor?: { backgroundColor?: CSSProperties['backgroundColor']; }; primaryText?: { fontWeight?: CSSProperties['fontWeight']; }; secondary?: { backgroundColor?: CSSProperties['backgroundColor']; }; whitebox?: { borderRadius?: CSSProperties['borderRadius']; }; coverImage?: { width?: CSSProperties['width']; height?: CSSProperties['height']; border?: CSSProperties['border']; margin?: CSSProperties['margin']; }; } export interface WixColor { name: string; reference: string; value: string; } /** Ricos can work with a Wix Palette object */ export type WixPalette = WixColor[]; export type PalettePreset = 'darkTheme'; export interface RicosTypography { /** * WixTypography - work in progress. * This field is ineffective at the moment. */ wixTypography?: WixTypography; fontFamily?: CSSProperties['fontFamily']; } export interface WixTypography { Title: WixTypographyDefinition; Menu: WixTypographyDefinition; 'Page-title': WixTypographyDefinition; 'Heading-XL': WixTypographyDefinition; 'Heading-L': WixTypographyDefinition; 'Heading-M': WixTypographyDefinition; 'Heading-S': WixTypographyDefinition; 'Body-L': WixTypographyDefinition; 'Body-M': WixTypographyDefinition; 'Body-S': WixTypographyDefinition; 'Body-XS': WixTypographyDefinition; } export interface WixTypographyDefinition { editorKey: string; lineHeight: string; style: string; weight: string; size: string; fontFamily: string; value: string; } export interface RicosTheme { parentClass?: string; palette?: PaletteColors | PaletteRgbColors | WixPalette | PalettePreset; paletteConfig?: PaletteConfig; typography?: RicosTypography; customStyles?: RicosCustomStyles; settingsStyles?: RicosSettingsStyles; nativeStyle?: RicosNativeStyles; breakout?: { /** will be iterated with every root node and will set normalPadding for normal nodes and fullWidthPadding for fullWidth nodes */ rule: ({ node }: { node: RichContentNode; }) => 'fullWidth' | 'normal'; /** these should be bigger than fullWidth paddings for fullWith padding */ normalPadding: { start: CSSProperties['paddingInlineStart']; end: CSSProperties['paddingInlineEnd']; }; /** these will default to 0 if not provided, but sometimes they might be useful if you want to limit max-width of 'fullWidth' */ fullWidthPadding?: { start: CSSProperties['paddingInlineStart']; end: CSSProperties['paddingInlineEnd']; }; }; } export interface PaletteConfig { /** * When `true`, attribute `bgColor` provided in `palette` will be the * `background-color` of the inner content container of Ricos. * * Default: `false` */ contentBgColor?: boolean; /** Override the `actionColor` of floating panels, toolbars & settings modals. * * **Note:** `RicosEditor` only. * @default actionColor */ settingsActionColor?: string; /** Override the `actionColor` of plugin when focused / clicked. * * **Note:** `RicosEditor` only. * @default actionColor */ focusActionColor?: string; } export interface ThemeStrategyArgs { experiments?: AvailableExperiments; plugins?: BasePlugin[]; ricosTheme?: RicosTheme; } export interface ThemeStrategyResult { html: ReactElement; themeData: ThemeData; } export type CssVarsObject = Record; //# sourceMappingURL=themeTypes.d.ts.map