embed
embed: <ParentMessage>(h: HtmlBuilder<ParentMessage>, config: EmbedConfig<ParentMessage>) => HtmlEffect-native UI toolkit
Interactive demosPublished API · 0.1.0-rc.1
Published themes API declarations for components/slider, 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'embedembed: <ParentMessage>(h: HtmlBuilder<ParentMessage>, config: EmbedConfig<ParentMessage>) => HtmlEmbedConfigexport type EmbedConfig<ParentMessage> = Readonly<{
slotId: string;
model: Model;
toParentMessage(message: Message): ParentMessage;
viewInputs: ViewInputs;
}>;foldfold: <ParentModel, ParentMessage, ParentOutMessage>(config: Omit<Update.ChildFoldWithDerivedParentOutMessage<ParentModel, ParentMessage, Model, Message, Message, OutMessage, ParentOutMessage>, 'update'>) => Update.FoldWithOutMessage<ParentModel, ParentMessage, Message, ParentOutMessage>initinit: (config: SliderUi.InitConfig) => SliderUi.ModelInitConfigexport type InitConfig = SliderUi.InitConfig;Messageexport type Message = SliderUi.Message;MessageMessage: 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;
};
}>Modelexport type Model = SliderUi.Model;ModelModel: 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;
};
}>;
}>OutMessageexport type OutMessage = SliderUi.OutMessage;OutMessageOutMessage: import("@wsagency/wseffect-foldkit/message").MessageUnion<{
readonly ChangedValue: {
value: import("effect/Schema").Number;
};
}>Propsexport type Props = typeof Props.Type;PropsProps: 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"]>>;
}>RangeRange: 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;
}>RangeConfigexport type RangeConfig = PrimitiveRangeConfig & Readonly<{
props?: Props;
}>;RangeEmbedConfigexport type RangeEmbedConfig<ParentMessage> = Readonly<{
slotId: string;
model: RangeModel;
toParentMessage(message: RangeMessage): ParentMessage;
viewInputs: RangeConfig;
}>;RangeFoldInputexport type RangeFoldInput = Readonly<{
config: RangeConfig;
message: RangeMessage;
}>;RangeMessageexport type RangeMessage = RangePrimitive.Range.RangeMessage;RangeModelexport type RangeModel = RangePrimitive.Range.RangeModel;RangeOutMessageexport type RangeOutMessage = RangePrimitive.Range.RangeOutMessage;updateupdate: (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;
};
}>viewview: 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>ViewInputsexport type ViewInputs = Omit<UiInputs, 'toView'> & Readonly<{
props?: Props;
}>;| Name | Type | Required | Choices | Description |
|---|---|---|---|---|
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" | — |
highContrast | boolean | No | — | — |
radius | "none" | "small" | "medium" | "large" | "full" | No | "none", "small", "medium", "large", "full" | — |
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' } })
@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'Propsexport type Props = typeof Props.Type;PropsProps: 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"]>>;
}>RangeRange: 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;
}>RangeConfigexport type RangeConfig = PrimitiveRangeConfig & Readonly<{
props?: Props;
}>;RangeEmbedConfigexport type RangeEmbedConfig<ParentMessage> = Readonly<{
slotId: string;
model: RangeModel;
toParentMessage(message: RangeMessage): ParentMessage;
viewInputs: RangeConfig;
}>;RangeFoldInputexport type RangeFoldInput = Readonly<{
config: RangeConfig;
message: RangeMessage;
}>;RangeMessageexport type RangeMessage = RangePrimitive.Range.RangeMessage;RangeModelexport type RangeModel = RangePrimitive.Range.RangeModel;RangeOutMessageexport type RangeOutMessage = RangePrimitive.Range.RangeOutMessage;| Name | Type | Required | Choices | Description |
|---|---|---|---|---|
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" | — |
highContrast | boolean | No | — | — |
radius | "none" | "small" | "medium" | "large" | "full" | No | "none", "small", "medium", "large", "full" | — |
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 }) })()