Mixins / foldkit-mixins-ui

ResizableSlots

const · packages/mixins-ui/src/resizable.ts:35

const ResizableSlots: 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 first: 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 handle: Slot.UnnamedSlot<
    Capability.Capability<
      'Interactive',
      readonly [Capability.Capability<'Base', readonly []>]
    >,
    readonly [Event.EventToken<'keydown'>],
    readonly [
      Attr.AttrToken<'role'>,
      Attr.AttrToken<'aria-label'>,
      Attr.AttrToken<'aria-controls'>,
      Attr.AttrToken<'aria-valuenow'>,
    ],
    readonly Slot.RequirementName[],
    boolean
  >
  readonly grip: 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 second: Slot.UnnamedSlot<
    Capability.Capability<
      'Container',
      readonly [
        Capability.Capability<
          'Interactive',
          readonly [Capability.Capability<'Base', readonly []>]
        >,
      ]
    >,
    readonly Slot.EventName[],
    readonly Slot.AttributeName[],
    readonly Slot.RequirementName[],
    boolean
  >
}>

Two panels with a handle between them, shadcn's Resizable and the APG's window splitter: the handle is a separator with its value, a tab stop the arrows step and Home and End send to the bounds, and a drag moves it. The split is a small Model of this module's (the first panel's share, where a drag began, and the share to go back to while a panel is collapsed), which the application keeps and folds with update; a drag measures the group with the Resize Mount and follows the Move Mount's deltas from where it began. A split whose bounds name a collapsible panel collapses it on Enter or a double-click, as the APG's splitter does, and the same again puts it back where it was. A panel may hold another split, either way.