import * as CSS from 'csstype'; import * as _theme_ui_css from '@theme-ui/css'; import { Theme as Theme$1 } from '@theme-ui/css'; import * as React from 'react'; import React__default from 'react'; import * as zustand from 'zustand'; import { BoxProps } from '@theme-ui/components'; import { ThemeUIStyleObject } from '@theme-ui/core'; type ThemeColor = keyof Colors | `${keyof Colors}-${keyof Omit}`; type SchemeColors = ThemeColor | CSS.Property.Color; type SchemeColorsAsCSSVariables = `var(--${ThemeColor})`; declare function isThemeColor(color: string, colors: Colors): color is keyof Colors; type ThemeCompatibilityVersion = 1; /** * @title Notesnook Theme schema * @description This is a schema for validation of Notesnook themes. */ type ThemeDefinition = { /** * Name of the theme */ name: string; /** * ID of the theme. Must be unique across all other themes. * @pattern ^[a-z0-9_-]+$ */ id: string; /** * Version of the theme. */ version: number; /** * The compatibility version of the theme used by the client to * decide whether the theme is compatible with the current app version. */ compatibilityVersion: ThemeCompatibilityVersion; /** * The license under which the theme can be shared, modified etc. * * @examples ["GPL-3.0-or-later", "Apache-2.0", "BSD-3-Clause", "MIT", "MPL-2.0"] */ license: string; /** * Author(s) of the theme. */ authors: ThemeAuthor[]; /** * Website or homepage of the theme. * * @format uri */ homepage?: string; /** * A short description of the theme. */ description: string; /** * Whether the theme has a dark color scheme or light. */ colorScheme: "light" | "dark"; /** * Keywords to help categorize the theme & improve search results. */ tags?: string[]; /** * All the theme scopes. */ scopes: ThemeScopes; codeBlockCSS: string; }; type ThemeAuthor = { /** * Name of the author. */ name: string; /** * Contact email of the author. */ email?: string; /** * Website or support page of the author. */ url?: string; }; type ThemeScopes = { /** * Base theme scope is the only scope that must be 100% specified. * There are no optional variants or colors in this scope and it * acts as a fallback for all the other scopes in case a color or * variant is missing in them. */ base: Variants; /** * Scope for the title bar on Desktop & Web. */ titleBar?: PartialVariants; /** * Scope for the status bar on Desktop & mobile. On mobile, the status * bar can be found at the bottom of the side navigation menu which * includes the sync status, logged in status etc. */ statusBar?: PartialVariants; /** * Scope for the central list view containing your notes, notebooks, tags etc. */ list?: PartialVariants; /** * Scope for everything inside the editor excluding the toolbar which has its * own scope. */ editor?: PartialVariants; /** * Scope specific to the Editor Toolbar. */ editorToolbar?: PartialVariants; /** * Scope for all the Editor side bars include note properties, attachment previews etc. */ editorSidebar?: PartialVariants; /** * Scope for all the dialogs in the app. */ dialog?: PartialVariants; /** * Scope for the side navigation menu. */ navigationMenu?: PartialVariants; /** * Scope for all the context menus in the app. This is desktop/web only since * the mobile clients do not have context menus. */ contextMenu?: PartialVariants; /** * Scope for all the bottom sheets shown in the app. This scope only applies * on the mobile clients & the mobile version of the web app. */ sheet?: PartialVariants; }; type PartialVariants = Partial>; type PartialOrFullColors = TRequired extends true ? Colors : Partial; type Colors = { /** * Only Hex RGB values are supported. No Alpha. (e.g. #f33ff3) * @pattern ^#(?:[0-9a-fA-F]{3}){1,2}$ */ accent: string; /** * Only Hex RGB values are supported. No Alpha. (e.g. #f33ff3) * @pattern ^#(?:[0-9a-fA-F]{3}){1,2}$ */ accentForeground: string; /** * Only Hex RGB values are supported. No Alpha. (e.g. #f33ff3) * @pattern ^#(?:[0-9a-fA-F]{3}){1,2}$ */ paragraph: string; /** * Hex RGB & ARGB values both are supported. (e.g. #dbdbdb99) * @pattern ^#(?:(?:[\da-fA-F]{3}){1,2}|(?:[\da-fA-F]{4}){1,2})$ */ background: string; /** * Only Hex RGB values are supported. No Alpha. (e.g. #f33ff3) * @pattern ^#(?:[0-9a-fA-F]{3}){1,2}$ */ border: string; /** * Only Hex RGB values are supported. No Alpha. (e.g. #f33ff3) * @pattern ^#(?:[0-9a-fA-F]{3}){1,2}$ */ heading: string; /** * Only Hex RGB values are supported. No Alpha. (e.g. #f33ff3) * @pattern ^#(?:[0-9a-fA-F]{3}){1,2}$ */ icon: string; /** * Only Hex RGB values are supported. No Alpha. (e.g. #f33ff3) * @pattern ^#(?:[0-9a-fA-F]{3}){1,2}$ */ separator: string; /** * Hex RGB & ARGB values both are supported. (e.g. #dbdbdb99) * @pattern ^#(?:(?:[\da-fA-F]{3}){1,2}|(?:[\da-fA-F]{4}){1,2})$ */ placeholder: string; /** * Hex RGB & ARGB values both are supported. (e.g. #dbdbdb99) * @pattern ^#(?:(?:[\da-fA-F]{3}){1,2}|(?:[\da-fA-F]{4}){1,2})$ */ hover: string; /** * Hex RGB & ARGB values both are supported. (e.g. #dbdbdb99) * @pattern ^#(?:(?:[\da-fA-F]{3}){1,2}|(?:[\da-fA-F]{4}){1,2})$ */ backdrop: string; /** * Hex RGB & ARGB values both are supported. (e.g. #dbdbdb99) * @pattern ^#(?:(?:[\da-fA-F]{3}){1,2}|(?:[\da-fA-F]{4}){1,2})$ * @deprecated true */ shade: string; /** * Hex RGB & ARGB values both are supported. (e.g. #dbdbdb99) * @pattern ^#(?:(?:[\da-fA-F]{3}){1,2}|(?:[\da-fA-F]{4}){1,2})$ * @deprecated true */ textSelection: string; }; type VariantsWithStaticColors = Variants & { static: typeof StaticColors; }; type PreviewColors = { editor: string; accentForeground: string; navigationMenu: { shade: string; accent: string; background: string; icon: string; }; list: { heading: string; accent: string; accentForeground: string; background: string; }; statusBar: { paragraph: string; background: string; icon: string; }; border: string; paragraph: string; background: string; accent: string; }; declare const StaticColors: { readonly red: "#f44336"; readonly orange: "#FF9800"; readonly yellow: "#FFD600"; readonly green: "#4CAF50"; readonly blue: "#2196F3"; readonly purple: "#673AB7"; readonly gray: "#9E9E9E"; readonly black: "#000000"; readonly white: "#ffffff"; }; declare const THEME_SCOPES: readonly (keyof ThemeScopes)[]; declare const COLORS: readonly (keyof Colors)[]; declare const ALPHA_COLORS: readonly (keyof Colors)[]; type Variants = { primary: PartialOrFullColors; secondary: PartialOrFullColors; disabled: PartialOrFullColors; selected: PartialOrFullColors; error: PartialOrFullColors; success: PartialOrFullColors; }; declare const Variants: readonly (keyof Variants)[]; declare const DEPRECATED_COLORS: string[]; declare const variants: { buttons: { primary: _theme_ui_css.ThemeUIStyleObject; secondary: _theme_ui_css.ThemeUIStyleObject; accent: _theme_ui_css.ThemeUIStyleObject; accentSecondary: _theme_ui_css.ThemeUIStyleObject; error: _theme_ui_css.ThemeUIStyleObject; errorSecondary: _theme_ui_css.ThemeUIStyleObject; anchor: _theme_ui_css.ThemeUICSSObject; dialog: _theme_ui_css.ThemeUICSSObject; statusitem: _theme_ui_css.ThemeUICSSObject; icon: _theme_ui_css.ThemeUICSSObject; menuitem: _theme_ui_css.ThemeUICSSObject; }; forms: { input: _theme_ui_css.ThemeUICSSObject; error: _theme_ui_css.ThemeUICSSObject; clean: _theme_ui_css.ThemeUICSSObject; radio: _theme_ui_css.ThemeUICSSObject; }; text: { default: _theme_ui_css.ThemeUICSSObject; heading: _theme_ui_css.ThemeUICSSObject; title: _theme_ui_css.ThemeUICSSObject; subtitle: _theme_ui_css.ThemeUICSSObject; body: _theme_ui_css.ThemeUICSSObject; subBody: _theme_ui_css.ThemeUICSSObject; error: _theme_ui_css.ThemeUICSSObject; }; variants: { columnCenter: _theme_ui_css.ThemeUIStyleObject; columnFill: _theme_ui_css.ThemeUIStyleObject; columnCenterFill: _theme_ui_css.ThemeUIStyleObject; rowCenter: _theme_ui_css.ThemeUIStyleObject; rowFill: _theme_ui_css.ThemeUIStyleObject; rowCenterFill: _theme_ui_css.ThemeUIStyleObject; }; }; type FontSizes = { heading: string; subheading: string; input: string; title: string; subtitle: string; body: string; menu: string; subBody: string; code: string; }; type FontConfig = { fontSizes: FontSizes; fontWeights: { normal: number; body: number; heading: number; bold: number; }; fonts: { body: string; monospace: string; heading: string; }; }; declare function getFontConfig(): FontConfig; type ThemeConfig = { colorScheme: "dark" | "light"; scope: VariantsWithStaticColors; }; declare const createButtonVariant: (background?: SchemeColors, color?: SchemeColors, states?: { hover?: ThemeUIStyleObject; active?: ThemeUIStyleObject; }) => ThemeUIStyleObject; type Theme = { breakpoints: string[]; space: number[] & { small?: number | string; }; sizes: { full: "100%"; half: "50%"; }; radii: { none: number; default: number; dialog: number; small: number; }; shadows: { menu: string; }; colors: Record; iconSizes: { small: number; medium: number; big: number; }; config: Theme$1["config"]; } & FontConfig & typeof variants; declare class ThemeFactory { static construct(config: ThemeConfig): Theme; } declare function getPreviewColors(theme: ThemeDefinition): PreviewColors; declare function themeToCSS(theme: ThemeDefinition): string; declare function validateTheme(json: Partial): { error: string | undefined; }; declare const ThemeLight: ThemeDefinition; declare const ThemeDark: ThemeDefinition; type ThemeScope = { colors: VariantsWithStaticColors; scope: keyof ThemeScopes; isDark: boolean; }; type ThemeEngineState = { theme: ThemeDefinition; setTheme: (theme: ThemeDefinition) => void; }; declare const useThemeEngineStore: zustand.UseBoundStore>; declare function useThemeColors(scope?: keyof ThemeScopes): ThemeScope; declare const useCurrentThemeScope: () => keyof ThemeScopes; declare const ScopedThemeProvider: React.Provider; declare const THEME_COMPATIBILITY_VERSION: ThemeCompatibilityVersion; type EmotionThemeProviderProps = { scope?: keyof ThemeScopes; injectCssVars?: boolean; theme?: Partial; } & Omit; declare const EmotionThemeProvider: React__default.ForwardRefExoticComponent<{ scope?: keyof ThemeScopes; injectCssVars?: boolean; theme?: Partial; } & Omit & React__default.RefAttributes>; declare module "csstype" { interface Properties { backgroundColor?: Property.BackgroundColor | SchemeColors | SchemeColorsAsCSSVariables; color?: Property.Color | SchemeColors | SchemeColorsAsCSSVariables; accentColor?: Property.AccentColor | SchemeColors | SchemeColorsAsCSSVariables; borderColor?: Property.BorderColor | SchemeColors | SchemeColorsAsCSSVariables; borderBottomColor?: Property.BorderBottomColor | SchemeColors | SchemeColorsAsCSSVariables; borderTopColor?: Property.BorderTopColor | SchemeColors | SchemeColorsAsCSSVariables; borderLeftColor?: Property.BorderLeftColor | SchemeColors | SchemeColorsAsCSSVariables; borderRightColor?: Property.BorderRightColor | SchemeColors | SchemeColorsAsCSSVariables; } } export { ALPHA_COLORS, COLORS, type Colors, DEPRECATED_COLORS, EmotionThemeProvider, type EmotionThemeProviderProps, type PartialOrFullColors, type PartialVariants, type PreviewColors, type SchemeColors, type SchemeColorsAsCSSVariables, ScopedThemeProvider, StaticColors, THEME_COMPATIBILITY_VERSION, THEME_SCOPES, type Theme, type ThemeAuthor, type ThemeColor, type ThemeCompatibilityVersion, ThemeDark, type ThemeDefinition, type ThemeEngineState, ThemeFactory, ThemeLight, type ThemeScopes, Variants, type VariantsWithStaticColors, createButtonVariant, getFontConfig, getPreviewColors, isThemeColor, themeToCSS, useCurrentThemeScope, useThemeColors, useThemeEngineStore, validateTheme };