FloatingPanel.BASE_LAYER
const · packages/mixins-ui/src/floatingPanel.ts:498
const BASE_LAYER: 40The z-index of the lowest panel in a stack, above the page's own layers.
Mixins / foldkit-mixins-ui
namespace · packages/mixins-ui/src/floatingPanel.ts:1
export * as FloatingPanel from './floatingPanel.js'FloatingPanel.BASE_LAYERconst · packages/mixins-ui/src/floatingPanel.ts:498
const BASE_LAYER: 40The z-index of the lowest panel in a stack, above the page's own layers.
FloatingPanel.Besideconst · packages/mixins-ui/src/floatingPanel.ts:191
const Beside: Command.CommandDefinitionWithArgs<
'FloatingPanel.Beside',
{
openerId: Schema.String
side: Schema.Literals<readonly ['bottom', 'top', 'left', 'right']>
gap: Schema.Number
width: Schema.Number
height: Schema.Number
},
Effect.Effect<
| { readonly _tag: 'CompletedFocus' }
| {
readonly _tag: 'Placed'
readonly rect: {
readonly x: number
readonly y: number
readonly width: number
readonly height: number
}
},
never,
never
>
>Reads the box of the element with openerId and places the panel beside it
(rectBeside), keeping the panel's own size. The opener is the page's, so
a Command reads it and Placed carries the answer into update.
FloatingPanel.closefunction · packages/mixins-ui/src/floatingPanel.ts:233
function close(model: Model): ReturnCloses the panel, keeping where it was; focusReturn gives focus back to what opened it.
FloatingPanel.configurefunction · packages/mixins-ui/src/floatingPanel.ts:766
function configure<const Names extends string = never>(
config: Presets<FloatingPanelPreset, Names>,
): {
readonly view: <ParentMessage>(
options: FloatingPanelView<ParentMessage> & PresetOption<Names>,
h: HtmlBuilder<ParentMessage>,
) => Html
}The application's own FloatingPanel: base for every use, presets chosen
at a use with preset, and the call over both. words merge key by key
and mixins concatenate in that order (FloatingPanel.focusReturn goes in
base); any other option given at the call replaces the preset's. The
limits are the Model's (init), not a preset's.
FloatingPanel.conflictfunction · packages/mixins-ui/src/floatingPanel.ts:520
function conflict<ParentMessage>(
routes: ReadonlyArray<Route<ParentMessage>>,
input?: Pick<FloatingPanelView<ParentMessage>, 'closeOnEscape'>,
): Option.Option<Diagnostic>The mixins:key-conflict that drawing the open panel with routes would
throw, or none: the application's routes against Escape (unless
closeOnEscape is false) and against each other. A closed panel draws
nothing, so the check is of the open one.
FloatingPanel.Controltype · packages/mixins-ui/src/floatingPanel.ts:433
type Control = 'minimize' | 'maximize' | 'close'The header's controls a panel can draw; restore appears with whichever stage change was made.
FloatingPanel.Edgetype · packages/mixins-ui/src/floatingPanel.ts:58
type Edge = Exclude<Handle, 'move'>FloatingPanel.FloatingPanelPresettype · packages/mixins-ui/src/floatingPanel.ts:745
type FloatingPanelPreset = Pick<
FloatingPanelView<never>,
| 'resizable'
| 'draggable'
| 'closeOnEscape'
| 'controls'
| 'step'
| 'direction'
| 'words'
| 'style'
> & {
readonly mixins?: MixinList<never>
}What a FloatingPanel is given once: its look, words and the options that hold no Message.
FloatingPanel.FloatingPanelSlotsconst · packages/mixins-ui/src/floatingPanel/slots.ts:4
const FloatingPanelSlots: Slots.Contract<{ readonly root: 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 boundary: 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 panel: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly [Event.EventToken<"keydown">, Event.EventToken<"pointerdown">, Event.EventToken<"focus">], readonly [Attr.AttrToken<"role">], readonly Slot.RequirementName[], boolean>; readonly header: 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 dragTrigger: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly [Event.EventToken<"keydown">, Event.EventToken<"pointerdown">], readonly [Attr.AttrToken<"aria-label">], readonly Slot.RequirementName[], boolean>; readonly title: Sl …;The panel's pieces: a header (drag trigger and controls), the body, and the edges and corners that resize it.
FloatingPanel.FloatingPanelViewinterface · packages/mixins-ui/src/floatingPanel.ts:456
interface FloatingPanelView<ParentMessage> {
readonly model: Model
readonly onMessage: (message: Message) => NoInfer<ParentMessage>
readonly title: string
readonly content: Html
readonly order?: ReadonlyArray<string> | undefined
readonly resizable?: boolean | undefined
readonly draggable?: boolean | undefined
readonly closeOnEscape?: boolean | undefined
readonly controls?: ReadonlyArray<Control> | undefined
readonly routes?: ReadonlyArray<Route<NoInfer<ParentMessage>>> | undefined
readonly step?: number | undefined
readonly direction?: 'ltr' | 'rtl' | undefined
readonly words?: Partial<FloatingPanelWords> | undefined
readonly style?: NamedStyle<typeof FloatingPanelSlots> | undefined
readonly mixins?: MixinList<ParentMessage> | undefined
}FloatingPanel.FloatingPanelWordsinterface · packages/mixins-ui/src/floatingPanel.ts:436
interface FloatingPanelWords {
readonly minimize: string
readonly maximize: string
readonly restore: string
readonly close: string
readonly move: string
readonly resize: string
}The fixed text a panel draws, in words with {title} where the panel's name goes.
FloatingPanel.Focusconst · packages/mixins-ui/src/floatingPanel.ts:163
const Focus: Command.CommandDefinitionWithArgs<
'FloatingPanel.Focus',
{ elementId: Schema.String },
Effect.Effect<{ readonly _tag: 'CompletedFocus' }, never, never>
>Focuses the element of this id once the render that drew it has committed.
FloatingPanel.focusReturnconst · packages/mixins-ui/src/floatingPanel/focusReturn.ts:13
const focusReturn: readonly [Mixin<never>]Gives focus back when the panel closes: to what had it before the panel,
then by FocusReturn's rules (an element with the opener's id, the
opener's FocusRecovery steps, the layer below, the page's first tabbable
element). Focus the reader moved elsewhere is left alone. The one way focus
returns: the panel keeps no opener of its own. Pass it among the mixins;
opt in, as it sends no Message.
FloatingPanel.Handleconst · packages/mixins-ui/src/floatingPanel.ts:56
const Handle: Schema.Literals<
readonly ['move', 'n', 's', 'e', 'w', 'ne', 'nw', 'se', 'sw']
>What a gesture moves: the whole panel, or one edge or corner of it.
FloatingPanel.initfunction · packages/mixins-ui/src/floatingPanel.ts:143
function init(
options: {
readonly id: string
readonly rect: Rect
readonly open?: boolean | undefined
} & Limits,
): ModelFloatingPanel.Limitsinterface · packages/mixins-ui/src/floatingPanel.ts:125
interface Limits {
readonly min?:
| {
readonly width: number
readonly height: number
}
| undefined
readonly max?:
| {
readonly width: number
readonly height: number
}
| undefined
readonly grid?: number | undefined
readonly overflow?: boolean | undefined
}FloatingPanel.Messageconst · packages/mixins-ui/src/floatingPanel.ts:98
const Message: MessageUnion<{
readonly Measured: {
readonly width: Schema.Number
readonly height: Schema.Number
}
readonly GestureStarted: {
readonly handle: Schema.Literals<
readonly ['move', 'n', 's', 'e', 'w', 'ne', 'nw', 'se', 'sw']
>
}
readonly GestureMoved: {
readonly deltaX: Schema.Number
readonly deltaY: Schema.Number
}
readonly GestureEnded: {}
readonly Nudged: {
readonly handle: Schema.Literals<
readonly ['move', 'n', 's', 'e', 'w', 'ne', 'nw', 'se', 'sw']
>
readonly deltaX: Schema.Number
readonly deltaY: Schema.Number
}
readonly Placed: {
readonly rect: Schema.Struct<{
readonly x: Schema.Number
readonly y: Schema.Number
readonly width: Schema.Number
readonly height: Schema.Number
}>
}
readonly Docked: {
readonly edge: Schema.Literals<readonly ['bottom', 'top', 'left', 'right']>
readonly thickness: Schema.Number
}
readonly StageChosen: {
readonly stage: Schema.Literals<
readonly ['default', 'minimized', 'maximized']
>
}
readonly Closed: {}
readonly Activated: {}
readonly CompletedFocus: {}
}>FloatingPanel.MIN_SIZEconst · packages/mixins-ui/src/floatingPanel.ts:123
const MIN_SIZE = { width, height }The smallest size update lets a resize reach, unless the limits say otherwise.
FloatingPanel.Modelconst · packages/mixins-ui/src/floatingPanel.ts:82
const Model: Schema.Struct<{
readonly id: Schema.String
readonly open: Schema.Boolean
readonly stage: Schema.Literals<
readonly ['default', 'minimized', 'maximized']
>
readonly rect: Schema.Struct<{
readonly x: Schema.Number
readonly y: Schema.Number
readonly width: Schema.Number
readonly height: Schema.Number
}>
readonly boundary: Schema.Struct<{
readonly width: Schema.Number
readonly height: Schema.Number
}>
readonly gesture: Schema.Option<
Schema.Struct<{
readonly handle: Schema.Literals<
readonly ['move', 'n', 's', 'e', 'w', 'ne', 'nw', 'se', 'sw']
>
readonly from: Schema.Struct<{
readonly x: Schema.Number
readonly y: Schema.Number
readonly width: Schema.Number
readonly height: Schema.Number
}>
}>
>
readonly limits: Schema.Struct<{
readonly min: Schema.optionalKey<
Schema.Struct<{
readonly width: Schema.Number
readonly height: Schema.Number
}>
>
readonly max: Schema.optionalKey<
Schema.Struct<{
readonly width: Schema.Number
readonly height: Schema.Number
}>
>
readonly grid: Schema.optionalKey<Schema.Number>
readonly overflow: Schema.optionalKey<Schema.Boolean>
}>
}>FloatingPanel.moveRectfunction · packages/mixins-ui/src/floatingPanel.ts:252
function moveRect(
from: Rect,
handle: Handle,
deltaX: number,
deltaY: number,
boundary: {
readonly width: number
readonly height: number
},
limits?: Limits,
): RectWhere from goes when handle moves by deltaX, deltaY, within the
limits and the viewport. Pure, so a drag and the keys agree.
FloatingPanel.openfunction · packages/mixins-ui/src/floatingPanel.ts:178
function open(model: Model): ReturnOpens the panel where it last was and focuses it.
FloatingPanel.openBesidefunction · packages/mixins-ui/src/floatingPanel.ts:216
function openBeside(
model: Model,
openerId: string,
options?: {
readonly side?: Side
readonly gap?: number
},
): ReturnOpens the panel beside the element with openerId (which must be drawn
when this runs), focuses it and keeps its size; an open panel is moved
beside it. The placement is read after the update, so the panel is drawn at
its old place only if the answer lands after the frame.
FloatingPanel.raisefunction · packages/mixins-ui/src/floatingPanel.ts:239
function raise(order: ReadonlyArray<string>, id: string): ReadonlyArray<string>order with id on top: the same array when it already is.
FloatingPanel.Raisedconst · packages/mixins-ui/src/floatingPanel.ts:119
const Raised: Schema.TaggedStruct<'Raised', { readonly id: Schema.String }>Told to the application: bring this panel above the others (raise).
FloatingPanel.Rectconst · packages/mixins-ui/src/floatingPanel.ts:60
const Rect: Schema.Struct<{
readonly x: Schema.Number
readonly y: Schema.Number
readonly width: Schema.Number
readonly height: Schema.Number
}>FloatingPanel.rectBesidefunction · packages/mixins-ui/src/floatingPanel.ts:309
function rectBeside(
anchor: Rect,
size: {
readonly width: number
readonly height: number
},
options?: {
readonly side?: Side
readonly gap?: number
},
): RectWhere a panel of size goes beside anchor (the opener's box, as
getBoundingClientRect reads it), gap pixels off it (default 8) and
aligned to its start. Pure: hand the result to Placed, which keeps it
within the viewport.
FloatingPanel.Returntype · packages/mixins-ui/src/floatingPanel.ts:175
type Return = ReturnWithOutMessage<Model, Message, Raised>FloatingPanel.Routetype · packages/mixins-ui/src/floatingPanel.ts:430
type Route<ParentMessage> = Behaviors.Keys.Route<undefined, ParentMessage>A key the application answers on the panel; a press inside it that nothing else took reaches it.
FloatingPanel.Sidetype · packages/mixins-ui/src/floatingPanel.ts:72
type Side = typeof Side.TypeFloatingPanel.Stageconst · packages/mixins-ui/src/floatingPanel.ts:52
const Stage: Schema.Literals<readonly ['default', 'minimized', 'maximized']>FloatingPanel.updatefunction · packages/mixins-ui/src/floatingPanel.ts:349
function update(limits?: Limits): (model: Model, message: Message) => ReturnThe panel's update, within limits where given and within the ones init
stored otherwise; the same Model when nothing changes.
FloatingPanel.viewfunction · packages/mixins-ui/src/floatingPanel.ts:531
function view<ParentMessage>(
options: FloatingPanelView<ParentMessage>,
h: HtmlBuilder<ParentMessage>,
): HtmlFloatingPanel.wordsconst · packages/mixins-ui/src/floatingPanel.ts:447
const words = { minimize, maximize, restore, close, move, resize }