Jump To:

  1. ui/resizer.Resizer
    1. new exports.Resizer(container, control, config)
    2. resizer.destroy()
    3. resizer.onPointerdown(e)
    4. resizer.onKeydown(e)
    5. resizer.getAriaLabel() ⇒ string
    6. resizer.dispatchEvent(type, [data])
  2. ui/resizer~multiplier
  3. ui/resizer~overrideMaxDimensions
  4. ui/resizer~fromX : "left" | "right" | null
  5. ui/resizer~fromY : "top" | "bottom" | null
  6. ui/resizer~keyboardStep
  7. ui/resizer~keyboardDebounceTime
  8. ui/resizer~manageEvents
  9. ui/resizer~manageAriaLabel
  10. ui/resizer~enablePointerResizing
  11. ui/resizer~enableKeyboardResizing

ui/resizer

ui/resizer.Resizer

Class for creating/controlling a container size with a handle/control

Kind: static class of ui/resizer

new exports.Resizer(container, control, config)

Param Type Default Description
container Node Container to be resized
control HTMLElement Resize handle element (should be focusable like a button)
config Object Options to configure the resizer.
[config.debug] Boolean false Enable non-essential debugging logs.
[config.multiplier] Boolean 1 Amount to increase size by (ie. pointer movement * multiplier).
[config.overrideMaxDimensions] Boolean false When script is activated by handle, remove the element's max-width/max-height and allow the resize to exceed them.
[config.fromX] "left" | "right" | null Horizontal resizing direction.
[config.fromY] "top" | "bottom" | null Vertical resizing direction.
[config.keyboardStep] number 10 The step in pixels for keyboard resizing.
[config.keyboardDebounceTime] number 200 Debounce time for keyboard resize end.
[config.manageEvents] boolean true If true, the Resizer will automatically bind its own events.
[config.manageAriaLabel] boolean false If true, the Resizer will manage the control's aria-label.
[config.enablePointerResizing] boolean true If true, pointer events will enable resizing.
[config.enableKeyboardResizing] boolean true If true, keyboard events will enable resizing.

resizer.destroy()

Cleans up event listeners and internal state to prevent memory leaks.

Kind: instance method of Resizer

resizer.onPointerdown(e)

Public handler for pointerdown events. Call this method from your own event listeners if manageEvents is false. Its logic will only execute if enablePointerResizing is true.

Kind: instance method of Resizer

Param Type Description
e PointerEvent The pointerdown event.

resizer.onKeydown(e)

Public handler for keydown events. Call this method from your own event listeners if manageEvents is false. Its logic will only execute if enableKeyboardResizing is true.

Kind: instance method of Resizer

Param Type Description
e KeyboardEvent The keydown event.

resizer.getAriaLabel() ⇒ string

Generates an accessible label for the resize control based on its configuration. This is a convenience function that can be used by the consumer if manageAriaLabel is false.

Kind: instance method of Resizer
Returns: string - The suggested aria-label for the control.

resizer.dispatchEvent(type, [data])

Dispatches a custom event on the container element.

Kind: instance method of Resizer

Param Type Default Description
type string The event type (e.g., "resizer:start", "resizer:update", "resizer:end").
[data] Object {} Optional data to attach to the event's detail property.

ui/resizer~multiplier

Amount to increase size by (ie. pointer movement * multiplier)

Kind: inner property of ui/resizer

ui/resizer~overrideMaxDimensions

Remove max-width, max-height

Kind: inner property of ui/resizer

ui/resizer~fromX : "left" | "right" | null

Specifies the horizontal edge from which resizing occurs.null means no horizontal resizing.- Default null

Kind: inner property of ui/resizer

ui/resizer~fromY : "top" | "bottom" | null

Specifies the vertical edge from which resizing occurs.- null means no vertical resizing.- Default null

Kind: inner property of ui/resizer

ui/resizer~keyboardStep

The step in pixels for keyboard resizing with arrow keys.

Kind: inner property of ui/resizer

ui/resizer~keyboardDebounceTime

Debounce time in milliseconds for ending a keyboard resize.

Kind: inner property of ui/resizer

ui/resizer~manageEvents

If true, the Resizer instance will automatically bind its own DOM event listeners (pointerdown, keydown) to the control element. If false, the user is responsible for calling resizerInstance.onPointerdown(event) and resizerInstance.onKeydown(event) from their own listeners. Default: true

Kind: inner property of ui/resizer

ui/resizer~manageAriaLabel

If true, the Resizer instance will automatically manage the aria-label attribute of the control element. If false, the user is responsible for setting this attribute. Default: false

Kind: inner property of ui/resizer

ui/resizer~enablePointerResizing

If true, pointer events (mouse/touch) will enable resizing. Default: true

Kind: inner property of ui/resizer

ui/resizer~enableKeyboardResizing

If true, keyboard events (arrow keys) will enable resizing. Default: true

Kind: inner property of ui/resizer