Mixins / foldkit-mixins-ui

Popover

namespace · packages/mixins-ui/src/popover.ts:1

export * as Popover from './popover.js'

In the guides

Members

Popover.anchor

function · packages/mixins-ui/src/popover.ts:39

function anchor(config?: AnchorConfig): AnchorConfig

The popover's placement, for the view's anchor: below its trigger and centred on it, 12px off for the arrow between, kept 8px inside the viewport, where it flips to the other side and shifts along it rather than leave, and caps its height to the room there. Kept in place for layer. config overrides any of it.

Popover.PopoverSlots

const · packages/mixins-ui/src/popover.ts:21

const PopoverSlots: Slots.Contract<{
  readonly button: Slot.UnnamedSlot<
    Capability.Capability<
      'Interactive',
      readonly [Capability.Capability<'Base', readonly []>]
    >,
    readonly [Event.EventToken<'click'>],
    readonly [
      Attr.AttrToken<'role'>,
      Attr.AttrToken<'aria-expanded'>,
      Attr.AttrToken<'aria-disabled'>,
      Attr.AttrToken<'disabled'>,
    ],
    readonly Slot.RequirementName[],
    boolean
  >
  readonly layer: 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<'blur'>],
    readonly Slot.AttributeName[],
    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 arrow: Slot.UnnamedSlot<
    Capability.Capability<
      'Container',
      readonly [
        Capability.Capability<
          'Interactive',
          readonly [Capability.Capability<'Base', readonly []>]
        >,
      ]
    >,
    readonly Slot.EventName[],
    readonly Slot.AttributeName[],
    readonly Slot.RequirementName[],
    boolean
  >
}>

Popover is a Submodel; every bundle is a ChildAttribute group. button owns click (and its pointer/keyboard handlers) while open; panel owns blur; backdrop owns click. The panel and backdrop bundles also carry the anchor and portal Mounts, preserved as opaque ChildAttributes.

layer is this package's: drawn around the panel, it shows the panel in the browser's top layer (Anchor.layer), above every stacking context and outside every overflow box, with the anchor placing it as before. Draw the panel without a portal (portal: false, as anchor gives), or the portal takes it out of the layer. arrow is upstream's: drawn as the panel's child, it points at the trigger from --arrow-x and --arrow-y.

Popover.resolve

function · packages/mixins-ui/src/popover.ts:51

function resolve<Input, Message>(
  render: RenderInfo,
  mixins: MixinList<Message>,
  context: ResolveContext<Input, Message>,
): ResolvedPopover<Message>

Resolves the popover's render groups; isVisible passes through unchanged.

Popover.ResolvedPopover

type · packages/mixins-ui/src/popover.ts:48

type ResolvedPopover<Message> = Resolved<
  RenderInfo,
  typeof PopoverSlots,
  Message
>

The popover's bundles with the attached Mixins applied.

Popover.toView

function · packages/mixins-ui/src/popover.ts:59

function toView<Message>(
  mixins: MixinList<Message>,
  context: ResolveContext<unknown, Message>,
  draw: (resolved: ResolvedPopover<Message>) => Html,
): (render: RenderInfo) => Html

The popover's toView: draw receives its bundles with mixins applied.