Documentation navigation

Published API · 0.1.0-rc.1

themes · components/theme-panel

Published themes API declarations for components/theme-panel.

./components/theme-panel

@wsagency/wseffect-themes · MIT · source · MIT license · WS-AGENCY-NOTICE

This entry point is published in @wsagency/wseffect-themes@0.1.0-rc.1. Import it from the package subpath shown below; the signatures and documentation are read from the installed package declarations.

import * as Wseffect from '@wsagency/wseffect-themes/components/theme-panel'

Exported declarations

Message

export type Message = {
    _tag: 'SettingsChanged';
    settings: Partial<ThemeSettings>;
};

Props

Props: Schema.Struct<{
    readonly isOpen: Schema.Boolean;
    readonly settings: Schema.Struct<{
        readonly accentColor: Schema.optional<Schema.Literals<readonly ["gray", "gold", "bronze", "brown", "yellow", "amber", "orange", "tomato", "red", "ruby", "crimson", "pink", "plum", "purple", "violet", "iris", "indigo", "blue", "cyan", "teal", "jade", "green", "grass", "lime", "mint", "sky", "custom"]>>;
        readonly grayColor: Schema.optional<Schema.Literals<readonly ["auto", "gray", "mauve", "slate", "sage", "olive", "sand"]>>;
        readonly radius: Schema.optional<Schema.Literals<readonly ["none", "small", "medium", "large", "full"]>>;
        readonly scaling: Schema.optional<Schema.Literals<readonly ["90%", "95%", "100%", "105%", "110%"]>>;
        readonly appearance: Schema.optional<Schema.Literals<readonly ["inherit", "light", "dark"]>>;
        readonly panelBackground: Schema.optional<Schema.Literals<readonly ["solid", "translucent"]>>;
        readonly hasBackground: Schema.optional<Schema.Boolean>;
    }>;
}>

ThemeSettings

export type ThemeSettings = typeof Theme.Settings.Type;

view

view: <M>(props: ViewProps, _children: ReadonlyArray<Html | string>, h: HtmlBuilder<M | Message>) => Html

ViewProps

export type ViewProps = typeof Props.Type & Readonly<{
    toSettingsChanged(settings: Partial<ThemeSettings>): Message;
}>;

Props

Props exported by @wsagency/wseffect-themes/components/theme-panel · Props · source
NameTypeRequiredChoicesDescription
isOpenbooleanYes——
settings{ accentColor?: "gray" | "gold" | "bronze" | "brown" | "yellow" | "amber" | "orange" | "tomato" | "red" | "ruby" | "crimson" | "pink" | "plum" | "purple" | "violet" | "iris" | "indigo" | "blue" | "cyan" | "teal" | "jade" | "green" | "grass" | "lime" | "mint" | "sky" | "custom"; grayColor?: "auto" | "gray" | "mauve" | "slate" | "sage" | "olive" | "sand"; radius?: "none" | "small" | "medium" | "large" | "full"; scaling?: "90%" | "95%" | "100%" | "105%" | "110%"; appearance?: "inherit" | "light" | "dark"; panelBackground?: "solid" | "translucent"; hasBackground?: boolean }Yes——

Rendered component example

ThemePanel

Accent color

Gray color

Appearance

Radius

Scaling

Panel background

Background

Example usage
import * as Themes from '@wsagency/wseffect-themes'
import * as SliderRange from '@wsagency/wseffect-themes/components/slider/range'
import * as Option from 'effect/Option'
import { defineView } from '@wsagency/wseffect-foldkit/submodel'
import { inertHtml, type HtmlBuilder } from '@wsagency/wseffect-foldkit/html'

const example = (h: HtmlBuilder<unknown>) => Themes.ThemePanel.view({ isOpen: true, settings: { appearance: 'light', accentColor: 'blue' }, toSettingsChanged: (settings) => ({ _tag: 'SettingsChanged', settings }) }, [], h)