namespace · packages/mixins-ui/src/nav.ts:1
export * as Nav from './nav.js' In the guides Members function · packages/mixins-ui/src/nav.ts:723
function configure < const Names extends string = never >(
config: Presets < NavPreset , Names >,
) : {
readonly view : < Outer > (
options: NavView < Outer > & PresetOption < Names >,
h: HtmlBuilder < Outer >,
) => Html
} The application's own Nav: base for every use, presets chosen at a use
with preset, and the call over both.
Nav.conflict# function · packages/mixins-ui/src/nav.ts:477
function conflict < Message >(
routes: ReadonlyArray < Route < Message >>,
input?: Pick < NavView < Message >, 'panelRoutes' >,
) : Option . Option < Diagnostic > The mixins:key-conflict that drawing the nav with routes, and with
panelRoutes when given, would throw, or none: the application's routes
against the nav's own and against each other. The top row's keys are the
same in both orientations, so none is asked for.
Nav.draw# function · packages/mixins-ui/src/nav.ts:116
function draw < Value extends string , Message >(
nav: ResolvedNav < Value , Message >,
label : ( value: Value ) => Html | string ,
h: HtmlBuilder < Message >,
) : Html The links drawn in a list, the indicator and highlight first.
Nav.entryId# function · packages/mixins-ui/src/nav.ts:273
function entryId ( id: string , index: number ) : string The id of the top-level link or trigger at index.
Nav.fluid# const · packages/mixins-ui/src/nav.ts:161
const fluid: readonly [Mixin < never >, Mixin < never >, Mixin < never > ]What moves the indicator and highlight, on the list: the current link
(or the trigger whose panel holds it) is measured (--fk-nav-chosen-*),
and one highlight follows the pointer to the nearest top-level link or
trigger (--fk-nav-hover-*), born at the current one, in a row or a
column. Pass them beside the style; until they run, the current link
marks itself.
Nav.init# function · packages/mixins-ui/src/nav.ts:270
function init ( id: string ) : Model A menu with every panel hidden. id prefixes every id it draws, unique on the page.
Nav.Message# const · packages/mixins-ui/src/nav.ts:252
const Message: MessageUnion <{
readonly Toggled: { readonly panel: Schema . String }
readonly Dismissed: {}
readonly Escaped: { readonly index: Schema . Number }
readonly MovedTop: {
readonly from: Schema . Number
readonly count: Schema . Number
readonly move: Schema . Literals <
readonly ['next' , 'previous' , 'first' , 'last' ]
>
}
readonly Entered: {
readonly index: Schema . Number
readonly panel: Schema . String
}
readonly MovedInPanel: {
readonly entry: Schema . Number
readonly from: Schema . Number
readonly count: Schema . Number
readonly move: Schema . Literals <
readonly ['next' , 'previous' , 'first' , 'last' ]
>
}
readonly CompletedFocus: {}
}> Show all 25 lines Nav.Model# const · packages/mixins-ui/src/nav.ts:241
const Model: Schema . Struct <{
readonly id: Schema . String
readonly open: Schema . Option < Schema . String >
}> Nav.Move# const · packages/mixins-ui/src/nav.ts:249
const Move: Schema . Literals < readonly ['next' , 'previous' , 'first' , 'last' ]> A move of focus, worked out by the view from a key and the menu's orientation and direction.
Nav.NavEntry# type · packages/mixins-ui/src/nav.ts:237
type NavEntry = NavLink | NavPanel Nav.NavLink# interface · packages/mixins-ui/src/nav.ts:200
interface NavLink {
readonly label: string
readonly href: string
readonly current?: boolean | undefined
readonly icon?: Html | undefined
readonly groups?: undefined
} A top-level link.
Nav.NavPanel# interface · packages/mixins-ui/src/nav.ts:227
interface NavPanel {
readonly id: string
readonly label: string
readonly groups: ReadonlyArray < NavPanelGroup >
readonly footer?: Html | undefined
readonly href?: undefined
} A trigger and the panel it shows.
Nav.NavPanelGroup# interface · packages/mixins-ui/src/nav.ts:221
interface NavPanelGroup {
readonly title?: string | undefined
readonly links: ReadonlyArray < NavPanelLink >
} A column of a panel: its links under an optional heading.
Nav.NavPanelLink# interface · packages/mixins-ui/src/nav.ts:211
interface NavPanelLink {
readonly label: string
readonly href: string
readonly description?: string | undefined
readonly current?: boolean | undefined
readonly icon?: Html | undefined
} A link in a panel, its words and a line under them.
Nav.NavPreset# type · packages/mixins-ui/src/nav.ts:715
type NavPreset = Pick < NavView < never >, 'orientation' | 'direction' > & {
readonly mixins?: MixinList < never >
} What a Nav is given once: its look, orientation, direction and mixins. The Model, entries and Messages are each use's.
Nav.NavSlots# const · packages/mixins-ui/src/nav.ts:43
const NavSlots: Slots . Contract <{ readonly nav: Slot . UnnamedSlot < Capability . Capability < "Container" , readonly [Capability . Capability < "Interactive" , readonly [Capability . Capability < "Base" , readonly []> ]> ]>, readonly Slot . EventName [], readonly Slot . AttributeName [], readonly Slot . RequirementName [], boolean >; readonly list: Slot . UnnamedSlot < Capability . Capability < "Container" , readonly [Capability . Capability < "Interactive" , readonly [Capability . Capability < "Base" , readonly []> ]> ]>, readonly Slot . EventName [], readonly Slot . AttributeName [], readonly Slot . RequirementName [], boolean >; readonly item: Slot . UnnamedSlot < Capability . Capability < "Container" , readonly [Capability . Capability < "Interactive" , readonly [Capability . Capability < "Base" , readonly []> ]> ]>, readonly [Event . EventToken < "keydown" > ], readonly Slot . AttributeName [], readonly Slot . RequirementName [], boolean >; readonly link: Slot . UnnamedSlot < Capability . Capability < "Interactive" , readonly [Capability . Capability < "Base" , readonly []> ]>, readonly [Event . EventToken < "keydown" > ], readonly Slot . AttributeName [], readonly Slot . RequirementName [], boolean >; readonly trigger: Slot . UnnamedSlot < Capability . Capability < "Interactive" , readonly [Capability . Capability < "Base" , readonly []> ]>, readonly [Event . EventToken < "click" >, Event . EventToken < "keydown" > ], readonly Slot . AttributeName [], readonly Slot . RequirementName [], boolean >; readonly chevron: Slot . UnnamedSlot < Capability . Capability < "Container" , readonly [Capability . Capability < "Interactive" , readonly [Capability . Capabi …;A navigation menu, shadcn's and the APG's disclosure navigation: a
navigation landmark whose list holds links, and triggers that each show a
panel of links (a mega menu). Its keys are the browser's (Tab to move,
Enter to follow or open), with no roving tab stop, since that is a
composite widget's pattern and not a landmark's; the arrows, Home and End
move between the top-level links and triggers, and through a panel's
links, as the APG's optional keys. indicator and highlight, drawn in
the list, are the current link's marker and the hover that follows the
pointer, which fluid moves, as Tabs' do; a trigger whose panel holds
the current page is marked as current.
Two ways in: view draws the whole menu from entries and keeps which
panel is open in this module's Model, which the application folds with
update; toView (and resolve, draw) style @foldkit/ui's stateless
Nav of links.
Nav.NavView# interface · packages/mixins-ui/src/nav.ts:389
interface NavView < Message > {
readonly model: Model
readonly entries: ReadonlyArray < NavEntry >
readonly label: string
readonly onMessage : ( message: typeof Message. Type) => NoInfer < Message >
readonly orientation?: 'horizontal' | 'vertical' | undefined
readonly direction?: 'ltr' | 'rtl' | undefined
readonly routes?: ReadonlyArray < Route < NoInfer < Message >>> | undefined
readonly panelRoutes?: ReadonlyArray < PanelRoute < NoInfer < Message >>> | undefined
readonly mixins?: MixinList < Message > | undefined
} Nav.PanelRoute# type · packages/mixins-ui/src/nav.ts:387
type PanelRoute < Message > = Behaviors . Keys . Route < NavPanelLink , Message > A key the application answers on a link in a panel; the press's item.index is its place among the panel's links.
Nav.resolve# function · packages/mixins-ui/src/nav.ts:88
function resolve < Value extends string , Input , Message >(
render: RenderInfo < Value >,
mixins: MixinList < Message >,
context: ResolveContext < Input , Message >,
) : ResolvedNav < Value , Message > Applies mixins to the nav's bundles: its landmark, and each item's link.
Nav.ResolvedNav# interface · packages/mixins-ui/src/nav.ts:74
interface ResolvedNav < Value extends string , Message > {
readonly nav: SlotAttributes < Message >
readonly list: SlotAttributes < Message >
readonly indicator: SlotAttributes < Message >
readonly highlight: SlotAttributes < Message >
readonly items: ReadonlyArray <
Omit < ItemInfo < Value >, 'link' > & {
readonly item: SlotAttributes < Message >
readonly link: SlotAttributes < Message >
}
>
} Nav.Route# type · packages/mixins-ui/src/nav.ts:384
type Route < Message > = Behaviors . Keys . Route < NavEntry , Message > A key the application answers on a top-level link or trigger; the press's item.index is its place.
Nav.toView# function · packages/mixins-ui/src/nav.ts:135
function toView < Value extends string , Message >(
mixins: MixinList < Message >,
context: ResolveContext < unknown , Message >,
label : ( value: Value ) => Html | string ,
custom ?: ( resolved: ResolvedNav < Value , Message >) => Html ,
) : ( render: RenderInfo < Value >) => Html The nav's toView: with no draw, the links in a list, each showing
label of its value; a draw of your own receives the bundles.
Nav.update# function · packages/mixins-ui/src/nav.ts:325
function update ( model: Model , message: Message ) : Return < Model , Message > The menu after message; the same Model when nothing changes.
Nav.view# function · packages/mixins-ui/src/nav.ts:500
function view < Message >( options: NavView < Message >, h: HtmlBuilder < Message >) : Html The navigation menu: each entry a top-level link, or a trigger with its
panel, drawn only while it shows, in the browser's top layer below its
trigger (beside it in a column). Escape hides the panel and returns focus
to its trigger; focus leaving the menu, a press outside it and a panel's
link followed hide it too.