Documentation navigation

Published API · 0.1.0-rc.1

themes · components/slider, components/slider/range

Published themes API declarations for components/slider, components/slider/range.

./components/slider

@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/slider'

Exported declarations

embed

embed: <ParentMessage>(h: HtmlBuilder<ParentMessage>, config: EmbedConfig<ParentMessage>) => Html

EmbedConfig

export type EmbedConfig<ParentMessage> = Readonly<{
    slotId: string;
    model: Model;
    toParentMessage(message: Message): ParentMessage;
    viewInputs: ViewInputs;
}>;

fold

fold: <ParentModel, ParentMessage, ParentOutMessage>(config: Omit<Update.ChildFoldWithDerivedParentOutMessage<ParentModel, ParentMessage, Model, Message, Message, OutMessage, ParentOutMessage>, 'update'>) => Update.FoldWithOutMessage<ParentModel, ParentMessage, Message, ParentOutMessage>

init

init: (config: SliderUi.InitConfig) => SliderUi.Model

InitConfig

export type InitConfig = SliderUi.InitConfig;

Message

export type Message = SliderUi.Message;

Message

Message: import("@wsagency/wseffect-foldkit/message").MessageUnion<{
    readonly PressedThumb: {
        originValue: import("effect/Schema").Number;
    };
    readonly PressedPointer: {
        value: import("effect/Schema").Number;
        originValue: import("effect/Schema").Number;
    };
    readonly MovedDragPointer: {
        value: import("effect/Schema").Number;
    };
    readonly ReleasedDragPointer: {};
    readonly CancelledDrag: {};
    readonly PressedKeyboardNavigation: {
        direction: import("effect/Schema").Literals<readonly ["StepDecrement", "StepIncrement", "PageDecrement", "PageIncrement", "Min", "Max"]>;
        value: import("effect/Schema").Number;
    };
}>

Model

export type Model = SliderUi.Model;

Model

Model: import("effect/Schema").Struct<{
    readonly id: import("effect/Schema").String;
    readonly min: import("effect/Schema").Number;
    readonly max: import("effect/Schema").Number;
    readonly step: import("effect/Schema").Number;
    readonly dragState: import("@wsagency/wseffect-foldkit/schema").TaggedUnion<{
        readonly Idle: {};
        readonly Dragging: {
            originValue: import("effect/Schema").Number;
        };
    }>;
}>

OutMessage

export type OutMessage = SliderUi.OutMessage;

OutMessage

OutMessage: import("@wsagency/wseffect-foldkit/message").MessageUnion<{
    readonly ChangedValue: {
        value: import("effect/Schema").Number;
    };
}>

Props

export type Props = typeof Props.Type;

Props

Props: import("effect/Schema").Struct<{
    readonly size: import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Literals<readonly string[]> | import("effect/Schema").String, import("effect/Schema").Struct<{
        [k: string]: import("effect/Schema").optional<import("effect/Schema").Literals<readonly string[]> | import("effect/Schema").String>;
    }>]>>;
    readonly variant: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["classic", "surface", "soft"]>>;
    readonly color: import("effect/Schema").optional<import("effect/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 highContrast: import("effect/Schema").optional<import("effect/Schema").Boolean>;
    readonly radius: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["none", "small", "medium", "large", "full"]>>;
}>

Range

Range: Readonly<{
    Model: import("effect/Schema").Struct<{
        readonly activeThumbId: import("effect/Schema").NullOr<import("effect/Schema").String>;
        readonly dragStartValues: import("effect/Schema").NullOr<import("effect/Schema").$Array<import("effect/Schema").Struct<{
            readonly id: import("effect/Schema").String;
            readonly value: import("effect/Schema").Number;
            readonly min: import("effect/Schema").optional<import("effect/Schema").Number>;
            readonly max: import("effect/Schema").optional<import("effect/Schema").Number>;
            readonly step: import("effect/Schema").optional<import("effect/Schema").Number>;
        }>>>;
    }>;
    Message: import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
        readonly _tag: import("effect/Schema").Literal<"FocusThumb">;
        readonly id: import("effect/Schema").String;
    }>, import("effect/Schema").Struct<{
        readonly _tag: import("effect/Schema").Literal<"Step">;
        readonly id: import("effect/Schema").String;
        readonly delta: import("effect/Schema").Number;
    }>, import("effect/Schema").Struct<{
        readonly _tag: import("effect/Schema").Literal<"Page">;
        readonly id: import("effect/Schema").String;
        readonly direction: import("effect/Schema").Literals<readonly [-1, 1]>;
    }>, import("effect/Schema").Struct<{
        readonly _tag: import("effect/Schema").Literal<"SetBoundary">;
        readonly id: import("effect/Schema").String;
        readonly boundary: import("effect/Schema").Literals<readonly ["min", "max"]>;
    }>, import("effect/Schema").Struct<{
        readonly _tag: import("effect/Schema").Literal<"DragStart">;
        readonly id: import("effect/Schema").String;
    }>, import("effect/Schema").Struct<{
        readonly _tag: import("effect/Schema").Literal<"DragValue">;
        readonly id: import("effect/Schema").String;
        readonly value: import("effect/Schema").Number;
    }>, import("effect/Schema").Struct<{
        readonly _tag: import("effect/Schema").Literal<"DragEnd">;
    }>, import("effect/Schema").Struct<{
        readonly _tag: import("effect/Schema").Literal<"CancelDrag">;
    }>]>;
    OutMessage: import("effect/Schema").Struct<{
        readonly _tag: import("effect/Schema").Literal<"ValuesChanged">;
        readonly thumbs: import("effect/Schema").$Array<import("effect/Schema").Struct<{
            readonly id: import("effect/Schema").String;
            readonly value: import("effect/Schema").Number;
            readonly min: import("effect/Schema").optional<import("effect/Schema").Number>;
            readonly max: import("effect/Schema").optional<import("effect/Schema").Number>;
            readonly step: import("effect/Schema").optional<import("effect/Schema").Number>;
        }>>;
    }>;
    init: typeof rangeInit;
    update: typeof rangeUpdate;
    view: typeof rangeView;
    fold: typeof rangeFold;
    embed: typeof rangeEmbed;
}>

RangeConfig

export type RangeConfig = PrimitiveRangeConfig & Readonly<{
    props?: Props;
}>;

RangeEmbedConfig

export type RangeEmbedConfig<ParentMessage> = Readonly<{
    slotId: string;
    model: RangeModel;
    toParentMessage(message: RangeMessage): ParentMessage;
    viewInputs: RangeConfig;
}>;

RangeFoldInput

export type RangeFoldInput = Readonly<{
    config: RangeConfig;
    message: RangeMessage;
}>;

RangeMessage

export type RangeMessage = RangePrimitive.Range.RangeMessage;

RangeModel

export type RangeModel = RangePrimitive.Range.RangeModel;

RangeOutMessage

export type RangeOutMessage = RangePrimitive.Range.RangeOutMessage;

update

update: (model: SliderUi.Model, message: SliderUi.Message) => Readonly<{
    model: {
        readonly id: string;
        readonly min: number;
        readonly max: number;
        readonly step: number;
        readonly dragState: {
            readonly _tag: "Idle";
        } | {
            readonly _tag: "Dragging";
            readonly originValue: number;
        };
    };
    commands?: Update.Commands<{
        readonly _tag: "CancelledDrag";
    } | {
        readonly _tag: "MovedDragPointer";
        readonly value: number;
    } | {
        readonly _tag: "PressedKeyboardNavigation";
        readonly direction: "Max" | "Min" | "PageDecrement" | "PageIncrement" | "StepDecrement" | "StepIncrement";
        readonly value: number;
    } | {
        readonly _tag: "PressedPointer";
        readonly value: number;
        readonly originValue: number;
    } | {
        readonly _tag: "PressedThumb";
        readonly originValue: number;
    } | {
        readonly _tag: "ReleasedDragPointer";
    }, never>;
    outMessage?: {
        readonly _tag: "ChangedValue";
        readonly value: number;
    };
}>

view

view: import("@wsagency/wseffect-foldkit/submodel").View<{
    readonly id: string;
    readonly min: number;
    readonly max: number;
    readonly step: number;
    readonly dragState: {
        readonly _tag: "Dragging";
        readonly originValue: number;
    } | {
        readonly _tag: "Idle";
    };
}, {
    readonly _tag: "CancelledDrag";
} | {
    readonly _tag: "MovedDragPointer";
    readonly value: number;
} | {
    readonly _tag: "PressedKeyboardNavigation";
    readonly direction: "Max" | "Min" | "PageDecrement" | "PageIncrement" | "StepDecrement" | "StepIncrement";
    readonly value: number;
} | {
    readonly _tag: "PressedPointer";
    readonly value: number;
    readonly originValue: number;
} | {
    readonly _tag: "PressedThumb";
    readonly originValue: number;
} | {
    readonly _tag: "ReleasedDragPointer";
}, ViewInputs>

ViewInputs

export type ViewInputs = Omit<UiInputs, 'toView'> & Readonly<{
    props?: Props;
}>;

Props

Props exported by @wsagency/wseffect-themes/components/slider · Props · source
NameTypeRequiredChoicesDescription
size"1" | "2" | "3" | Responsive<"1" | "2" | "3">No——
variant"classic" | "surface" | "soft"No"classic", "surface", "soft"—
color"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"No"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"—
highContrastbooleanNo——
radius"none" | "small" | "medium" | "large" | "full"No"none", "small", "medium", "large", "full"—

Rendered component example

Slider
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.Slider.embed(h, { slotId: 'volume-example', model: Themes.Slider.init({ id: 'volume-example', min: 0, max: 100, step: 1 }), toParentMessage: (message) => message, viewInputs: { value: 42, ariaLabel: 'Volume' } })

./components/slider/range

@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/slider/range'

Exported declarations

Props

export type Props = typeof Props.Type;

Props

Props: import("effect/Schema").Struct<{
    readonly size: import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Literals<readonly string[]> | import("effect/Schema").String, import("effect/Schema").Struct<{
        [k: string]: import("effect/Schema").optional<import("effect/Schema").Literals<readonly string[]> | import("effect/Schema").String>;
    }>]>>;
    readonly variant: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["classic", "surface", "soft"]>>;
    readonly color: import("effect/Schema").optional<import("effect/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 highContrast: import("effect/Schema").optional<import("effect/Schema").Boolean>;
    readonly radius: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["none", "small", "medium", "large", "full"]>>;
}>

Range

Range: Readonly<{
    Model: import("effect/Schema").Struct<{
        readonly activeThumbId: import("effect/Schema").NullOr<import("effect/Schema").String>;
        readonly dragStartValues: import("effect/Schema").NullOr<import("effect/Schema").$Array<import("effect/Schema").Struct<{
            readonly id: import("effect/Schema").String;
            readonly value: import("effect/Schema").Number;
            readonly min: import("effect/Schema").optional<import("effect/Schema").Number>;
            readonly max: import("effect/Schema").optional<import("effect/Schema").Number>;
            readonly step: import("effect/Schema").optional<import("effect/Schema").Number>;
        }>>>;
    }>;
    Message: import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
        readonly _tag: import("effect/Schema").Literal<"FocusThumb">;
        readonly id: import("effect/Schema").String;
    }>, import("effect/Schema").Struct<{
        readonly _tag: import("effect/Schema").Literal<"Step">;
        readonly id: import("effect/Schema").String;
        readonly delta: import("effect/Schema").Number;
    }>, import("effect/Schema").Struct<{
        readonly _tag: import("effect/Schema").Literal<"Page">;
        readonly id: import("effect/Schema").String;
        readonly direction: import("effect/Schema").Literals<readonly [-1, 1]>;
    }>, import("effect/Schema").Struct<{
        readonly _tag: import("effect/Schema").Literal<"SetBoundary">;
        readonly id: import("effect/Schema").String;
        readonly boundary: import("effect/Schema").Literals<readonly ["min", "max"]>;
    }>, import("effect/Schema").Struct<{
        readonly _tag: import("effect/Schema").Literal<"DragStart">;
        readonly id: import("effect/Schema").String;
    }>, import("effect/Schema").Struct<{
        readonly _tag: import("effect/Schema").Literal<"DragValue">;
        readonly id: import("effect/Schema").String;
        readonly value: import("effect/Schema").Number;
    }>, import("effect/Schema").Struct<{
        readonly _tag: import("effect/Schema").Literal<"DragEnd">;
    }>, import("effect/Schema").Struct<{
        readonly _tag: import("effect/Schema").Literal<"CancelDrag">;
    }>]>;
    OutMessage: import("effect/Schema").Struct<{
        readonly _tag: import("effect/Schema").Literal<"ValuesChanged">;
        readonly thumbs: import("effect/Schema").$Array<import("effect/Schema").Struct<{
            readonly id: import("effect/Schema").String;
            readonly value: import("effect/Schema").Number;
            readonly min: import("effect/Schema").optional<import("effect/Schema").Number>;
            readonly max: import("effect/Schema").optional<import("effect/Schema").Number>;
            readonly step: import("effect/Schema").optional<import("effect/Schema").Number>;
        }>>;
    }>;
    init: typeof rangeInit;
    update: typeof rangeUpdate;
    view: typeof rangeView;
    fold: typeof rangeFold;
    embed: typeof rangeEmbed;
}>

RangeConfig

export type RangeConfig = PrimitiveRangeConfig & Readonly<{
    props?: Props;
}>;

RangeEmbedConfig

export type RangeEmbedConfig<ParentMessage> = Readonly<{
    slotId: string;
    model: RangeModel;
    toParentMessage(message: RangeMessage): ParentMessage;
    viewInputs: RangeConfig;
}>;

RangeFoldInput

export type RangeFoldInput = Readonly<{
    config: RangeConfig;
    message: RangeMessage;
}>;

RangeMessage

export type RangeMessage = RangePrimitive.Range.RangeMessage;

RangeModel

export type RangeModel = RangePrimitive.Range.RangeModel;

RangeOutMessage

export type RangeOutMessage = RangePrimitive.Range.RangeOutMessage;

Props

Props exported by @wsagency/wseffect-themes/components/slider/range · Props · source
NameTypeRequiredChoicesDescription
size"1" | "2" | "3" | Responsive<"1" | "2" | "3">No——
variant"classic" | "surface" | "soft"No"classic", "surface", "soft"—
color"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"No"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"—
highContrastbooleanNo——
radius"none" | "small" | "medium" | "large" | "full"No"none", "small", "medium", "large", "full"—

Rendered component example

Slider.Range
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>) => (() => { const config = { min: 0, max: 100, step: 1, orientation: 'horizontal' as const, thumbs: [{ id: 'minimum', value: 20 }, { id: 'maximum', value: 72 }] }; return SliderRange.Range.embed(h, { slotId: 'budget-range-example', model: SliderRange.Range.init(config), toParentMessage: (message) => message, viewInputs: config }) })()