Published API · 0.1.0-rc.1
themes · components/dropdown-menu Published themes API declarations for components/dropdown-menu.
./components/dropdown-menu @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/dropdown-menu'Exported declarations Bundleexport type Bundle<Item extends string> = Readonly<{
Model: typeof UiMenu.Model;
Message: typeof UiMenu.Message;
OutMessage: typeof UiMenu.OutMessage;
init: typeof UiMenu.init;
update: UiMenu.Bundle<Item>['update'];
view: UiMenu.Bundle<Item>['view'];
fold: <ParentModel, ParentMessage, ParentOutMessage>(config: Omit<Update.ChildFoldWithDerivedParentOutMessage<ParentModel, ParentMessage, UiMenu.Model, UiMenu.Message, UiMenu.Message, UiMenu.OutMessage<Item>, ParentOutMessage>, 'update'>) => Update.FoldWithOutMessage<ParentModel, ParentMessage, UiMenu.Message, ParentOutMessage>;
embed: <ParentMessage>(h: HtmlBuilder<ParentMessage>, config: EmbedConfig<Item, ParentMessage>) => Html;
}>;createcreate: <Item extends string>() => Bundle<Item>EmbedConfigexport type EmbedConfig<Item extends string, ParentMessage> = Readonly<{
slotId: string;
model: UiMenu.Model;
toParentMessage: (message: UiMenu.Message) => ParentMessage;
viewInputs: ViewInputs<Item>;
}>;Rendered component example DropdownMenu 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 menu = Themes.DropdownMenu.create<'edit' | 'archive'>(); const model = menu.init({ id: 'project-menu-example' }); return menu.embed(h, { slotId: 'project-menu-example', model, toParentMessage: (message) => message, viewInputs: { items: ['edit', 'archive'], buttonContent: h.span([], ['Project actions']), itemToConfig: (item) => ({ content: h.span([], [item === 'edit' ? 'Edit project' : 'Archive project']) }) } }) })()