Dialog.close
function · packages/mixins-ui/src/dialog.ts:157
function close(model: DialogModel): ReturnType<typeof updateDialog>@foldkit/ui's close, through update: closing a closed dialog returns its Model.
Mixins / foldkit-mixins-ui
namespace · packages/mixins-ui/src/dialog.ts:1
export * as Dialog from './dialog.js'Dialog.closefunction · packages/mixins-ui/src/dialog.ts:157
function close(model: DialogModel): ReturnType<typeof updateDialog>@foldkit/ui's close, through update: closing a closed dialog returns its Model.
Dialog.DialogContextinterface · packages/mixins-ui/src/dialog.ts:25
interface DialogContext<Input, Message> extends ResolveContext<Input, Message> {
readonly role?: 'dialog' | 'alertdialog'
readonly covered?: boolean
readonly isLeaving?: boolean
readonly interactiveHandle?: boolean
readonly attributes?: {
readonly [K in keyof typeof DialogSlots]?: SlotAttributes<Message>
}
}Dialog.DialogSlotsconst · packages/mixins-ui/src/dialog/slots.ts:19
const DialogSlots: Slots.Contract<{ readonly dialog: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly [Event.EventToken<"cancel">], readonly [Attr.AttrToken<"aria-describedby">], readonly Slot.RequirementName[], boolean>; readonly backdrop: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly [Event.EventToken<"click">], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>; readonly panel: 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 title: 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 description: 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 initialFocus: Slot.UnnamedSlot<Capability.Capability<"F …;Dialog is a Submodel: each published bundle is a ChildAttribute group that
carries the dialog boundary's dispatcher. The resolver treats those as opaque
and preserves their identity, so spreading a resolved bundle into the parent's
markup keeps routing through the dialog's toParentMessage.
dialog owns cancel (the native Escape handler); backdrop and
closeButton own click. A Behavior adding its own handler to one of those
is a conflict, not a second silent owner.
body, scroll, scrollBar, scrollThumb and footer are this
package's, with no upstream bundle: a panel taller than the viewport
scrolls its scroll (inside body, between the title and the footer)
while the title and the footer's answers stay in view. overlayBars
draws the overlay bar, scrollBar with its scrollThumb, inside body.
Dialog.focusReturnconst · packages/mixins-ui/src/dialog/focusReturn.ts:14
const focusReturn: readonly [Mixin<never>]A way back for focus when the element that opened the dialog is gone when
it closes (removed by the action the dialog was opened for, or drawn again
as a new element): upstream's return goes to the opener and, with none, to
body. This goes by FocusReturn's rules: an element with the opener's id,
the opener's FocusRecovery fallback steps, the dialog below, then the
page's first tabbable element. Pass it among the mixins; opt in, as it
sends no Message.
Dialog.isDismissalfunction · packages/mixins-ui/src/dialog.ts:171
function isDismissal(message: DialogMessage): booleanWhether message is the dialog dismissing itself: Escape, a press on the
backdrop, or its close button, which upstream all send as RequestedClose.
An alert dialog (role: 'alertdialog') answers only to its own buttons:
its application drops such a Message in update instead of folding it, and
closes from those buttons with @foldkit/ui's close.
Dialog.isLeavingfunction · packages/mixins-ui/src/dialog.ts:93
function isLeaving(model: DialogModel): booleanWhether the dialog is in its exit animation: still drawn, no longer open.
Dialog.keyboardconst · packages/mixins-ui/src/dialog/keyboard.ts:11
const keyboard: readonly [Mixin<never>]The on-screen keyboard's height on the panel (--fk-keyboard-inset), which the Dialog
and Sheet recipes keep the panel above: iOS Safari, and Chrome on Android unless the page
asks otherwise, leave a fixed panel under the keys when a field in it takes focus. Pass it
among the mixins of a dialog or sheet that holds a field. Opt in, as it sends no Message.
Dialog.openfunction · packages/mixins-ui/src/dialog.ts:161
function open(model: DialogModel): ReturnType<typeof updateDialog>@foldkit/ui's open, through update: an open that meets the exit puts focus back.
Dialog.overlayBarsconst · packages/mixins-ui/src/dialog/overlayBars.ts:10
const overlayBars: readonly [Mixin<never>]The overlay bar on the dialog's scroll, the popups' list shape: pass it
among the mixins, and draw scrollBar (holding scrollThumb) beside
scroll in body. Where the pointer is coarse the browser's bar stays.
Dialog.resolvefunction · packages/mixins-ui/src/dialog.ts:58
function resolve<Input, Message>(
render: RenderInfo,
mixins: MixinList<Message>,
context: DialogContext<Input, Message>,
): ResolvedDialog<Message>Resolves the dialog's render groups; isVisible passes through unchanged.
Dialog.ResolvedDialogtype · packages/mixins-ui/src/dialog.ts:23
type ResolvedDialog<Message> = Resolved<RenderInfo, typeof DialogSlots, Message>The dialog's bundles with the attached Mixins applied.
Dialog.RestoreFocusconst · packages/mixins-ui/src/dialog.ts:122
const RestoreFocus: Command.CommandDefinitionWithArgs<
'Dialog.RestoreFocus',
{ id: Schema.String; selector: Schema.String },
Effect.Effect<
{ readonly _tag: 'CompletedReleaseDialogResources' },
never,
never
>
>Puts focus back inside a dialog that was opened again mid-exit. Its panel
was inert and so gave up focus, and upstream's second ShowDialog returns at
once for a dialog it still holds, so nothing else places it. It goes where
the open would have: the focusSelector or the initial-focus mark, else the
first control. Which control had focus when the exit began is not in the
Model, so it is not restored.
Dialog.toViewfunction · packages/mixins-ui/src/dialog.ts:174
function toView<Message>(
mixins: MixinList<Message>,
context: DialogContext<unknown, Message>,
draw: (resolved: ResolvedDialog<Message>) => Html,
): (render: RenderInfo) => HtmlThe dialog's toView: draw receives its bundles with mixins applied.
Dialog.updatefunction · packages/mixins-ui/src/dialog.ts:145
function update(
model: DialogModel,
message: DialogMessage,
): ReturnType<typeof updateDialog>@foldkit/ui's Dialog update, plus one focus repair: after an open that
met the exit, focus goes back inside the dialog. A closing dialog whose
opener is gone is Dialog.focusReturn's. A RequestedClose on a dialog
that is not open is a no-op returning the Model it was given; upstream
rebuilds an equal one, which renders the whole page.