Skip to content
API reference

maosaico

Import
import * as api from "@fungi.computer/maosaico";
Kind Export Description
type alias BentoOptions Host-owned placements and the callback receiving completed intents.
type alias BentoBinding Renderable frames and interaction attributes for host-owned tiles.
type alias MaosaicoLayer Shell paint order. Window ranks are local to the windows root.
type alias Point Coordinates relative to the host’s container.
type alias Size Dimensions in the host’s coordinate units.
type alias Frame A container-relative origin and dimensions.
type alias Bounds Available container dimensions.
type alias Minima Smallest dimensions the host permits for a pane.
type alias SnapSide Edge or corner used to derive a snapped frame.
type alias MaosaicoItem A mounted pane’s stable identity and initial geometry.
type alias MaosaicoItemOptions Interaction mode and layout participation for a mounted pane.
type alias MaosaicoItemBinding Geometry, focus state and host element interactions for a pane.
type alias TilingLayout Named strategies for dividing the host’s available bounds.
type alias TilingOptions Layout strategy and spacing supplied by the host.
constant MaosaicoRegion The host positions the region; Maosaico owns its isolated layer and modality.
function useMaosaicoBento() Captured, cell-snapped previews. Only a completed gesture proposes host-owned changes.
function MaosaicoLayers() Mount inside the shell’s positioned container, outside clipped panes. Roots are pointer-transparent; interactive portal content enables pointers. The host supplies Stipe’s stylesheet and retains content and focus ownership.
function useLayer() Null until the shell root mounts (also during SSR); body outside a shell.
function usePointerDrag() One captured pointer; cancellation and unmount share the same release path.
function MaosaicoRoot() Omit tiling to retain floating frames. Main size is a preference, in pixels.
function useMaosaicoLayout() Layout commands keep content and DOM ownership with the caller.
function useMaosaicoItem() Register a mounted pane and bind its geometry and captured-pointer lifecycle.

BentoOptionstype alias

Section titled “BentoOptions”
Signature
type BentoOptions = BentoGeometry & object;

Host-owned placements and the callback receiving completed intents.

Name Type Description
placements readonly BentoPlacement[] Current committed tile positions and spans.
onChange() (ops) => void Receive operations for a completed gesture or keyboard action.
enabled? boolean Set false to disable pointer and keyboard edits.

BentoBindingtype alias

Section titled “BentoBinding”
Signature
type BentoBinding = object;

Renderable frames and interaction attributes for host-owned tiles.

Signature
frames: ReturnType<typeof bentoFrames>;

Current committed or preview geometry.

Signature
preview: boolean;

Whether frames include a live, non-stale gesture preview.

Signature
previewId: string | null;

Tile being previewed, or null.

Signature
bind: (id, kind) => DOMAttributes<HTMLElement>;

Bind a tile’s move or resize interaction to a host element.

Parameter Type
id string
kind "move" | "resize"

DOMAttributes<HTMLElement>


MaosaicoLayertype alias

Section titled “MaosaicoLayer”
Signature
type MaosaicoLayer =
"desktop" | "windows" | "chrome" | "popover" | "dialog" | "toast" | "tooltip";

Shell paint order. Window ranks are local to the windows root.


Signature
type Point = object;

Coordinates relative to the host’s container.

Signature
x: number;

Horizontal coordinate.

Signature
y: number;

Vertical coordinate.


Signature
type Size = object;

Dimensions in the host’s coordinate units.

Signature
width: number;

Horizontal extent.

Signature
height: number;

Vertical extent.


Signature
type Frame = Point & Size;

A container-relative origin and dimensions.


Signature
type Bounds = Size;

Available container dimensions.


Signature
type Minima = Size;

Smallest dimensions the host permits for a pane.


Signature
type SnapSide =
"left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right";

Edge or corner used to derive a snapped frame.


MaosaicoItemtype alias

Section titled “MaosaicoItem”
Signature
type MaosaicoItem = object;

A mounted pane’s stable identity and initial geometry.

Signature
id: string;

Identity used for registration and commands.

Signature
frame: Frame;

Initial floating frame; later changes use layout commands.

Signature
minima: Minima;

Minimum dimensions kept current while the pane is mounted.


MaosaicoItemOptionstype alias

Section titled “MaosaicoItemOptions”
Signature
type MaosaicoItemOptions = object;

Interaction mode and layout participation for a mounted pane.

Signature
optional kind?: "drag" | "resize";

Defaults to dragging; resize changes dimensions instead of origin.

Signature
optional participating?: boolean;

Defaults to true; false retains geometry but excludes the pane from layout.


MaosaicoItemBindingtype alias

Section titled “MaosaicoItemBinding”
Signature
type MaosaicoItemBinding = object;

Geometry, focus state and host element interactions for a pane.

Signature
frame: Frame;

Visible layout frame, falling back to the pane’s floating geometry.

Signature
stackingStyle: Pick<React.CSSProperties, "zIndex">;

Merge into the window’s style, inside the windows layer.

Signature
visible: boolean;

Whether this pane has a frame in the current arrangement.

Signature
active: boolean;

Whether this pane is last in focus order.

Signature
props: React.DOMAttributes<HTMLElement>;

Pointer attributes to spread onto the pane’s interaction element.

Signature
focus: () => void;

Bring the pane to the top of focus order.

void

Signature
snap: (side) => void;

Snap the pane to a container edge or corner.

Parameter Type
side SnapSide

void

Signature
restore: () => void;

Restore the pane’s retained floating frame.

void


TilingLayouttype alias

Section titled “TilingLayout”
Signature
type TilingLayout = "main-left" | "main-top" | "columns" | "rows" | "grid";

Named strategies for dividing the host’s available bounds.


TilingOptionstype alias

Section titled “TilingOptions”
Signature
type TilingOptions = object;

Layout strategy and spacing supplied by the host.

Signature
optional layout?: TilingLayout;

Defaults to main-left.

Signature
optional mainSize?: number;

Preferred main-pane extent; defaults to half the container’s extent.

Signature
optional gap?: number;

Space between panes; defaults to eight coordinate units.

MaosaicoRegionconstant

Section titled “MaosaicoRegion”
Signature
const MaosaicoRegion: ForwardRefExoticComponent<
HTMLAttributes<HTMLDivElement> & object & RefAttributes<HTMLDivElement>
>;

The host positions the region; Maosaico owns its isolated layer and modality.

useMaosaicoBento()function

Section titled “useMaosaicoBento()”
Signature
function useMaosaicoBento(options): BentoBinding;

Captured, cell-snapped previews. Only a completed gesture proposes host-owned changes.

Parameter Type
options BentoOptions

BentoBinding


MaosaicoLayers()function

Section titled “MaosaicoLayers()”
Signature
function MaosaicoLayers(__namedParameters): ReactElement;

Mount inside the shell’s positioned container, outside clipped panes. Roots are pointer-transparent; interactive portal content enables pointers. The host supplies Stipe’s stylesheet and retains content and focus ownership.

Parameter Type Description
__namedParameters { children?: ReactNode; onDismiss?: () => void; } -
__namedParameters.children? ReactNode Host content rendered alongside the overlay roots.
__namedParameters.onDismiss? () => void Light-dismiss transient overlays on host blur or focus entering a window.

ReactElement


Signature
function useLayer(layer): HTMLElement | null;

Null until the shell root mounts (also during SSR); body outside a shell.

Parameter Type
layer MaosaicoLayer

HTMLElement | null


usePointerDrag()function

Section titled “usePointerDrag()”
Signature
function usePointerDrag(
handlers,
enabled?,
signal?,
): DOMAttributes<HTMLElement>;

One captured pointer; cancellation and unmount share the same release path.

Parameter Type Default value Description
handlers { begin: (event) => boolean; move: (dx, dy, event) => void; end: (cancel) => void; } undefined -
handlers.begin (event) => boolean undefined Return true to accept the captured pointer gesture.
handlers.move (dx, dy, event) => void undefined Receive incremental pointer movement in client-coordinate pixels.
handlers.end? (cancel) => void undefined Complete the gesture; true denotes cancellation or lost capture.
enabled? boolean true -
signal? AbortSignal undefined -

DOMAttributes<HTMLElement>


MaosaicoRoot()function

Section titled “MaosaicoRoot()”
Signature
function MaosaicoRoot(__namedParameters): Element;

Omit tiling to retain floating frames. Main size is a preference, in pixels.

Parameter Type Description
__namedParameters { bounds: Size; tiling?: TilingOptions; containerRef?: RefObject<HTMLElement | null>; children?: ReactNode; } -
__namedParameters.bounds Size Available container dimensions in host coordinates.
__namedParameters.tiling? TilingOptions Optional tiling strategy; omission preserves floating frames.
__namedParameters.containerRef? RefObject<HTMLElement | null> The positioned workspace element; supplying it enables container-relative edge snapping.
__namedParameters.children? ReactNode Host-owned content rendered inside the layout context.

Element


useMaosaicoLayout()function

Section titled “useMaosaicoLayout()”
Signature
function useMaosaicoLayout(): object;

Layout commands keep content and DOM ownership with the caller.

Name Type Default value Description
stackingStyle object - Decorations rank immediately above every window, inside the windows region.
stackingStyle.zIndex number state.order.length Rank above every pane in the windows region.
mode "tiled" | "floating" - Whether the root supplied a tiling strategy.
order readonly string[] - Stable order of participating tiles.
interacting boolean - Whether a frame or divider gesture is active.
snapPreview | { side: SnapSide; frame: Frame; } | null - Candidate floating-frame snap, hidden while tiled or zoomed.
activeId string | null - Most recently focused participating pane, or null.
zoomedId string | null state.zoomed Pane expanded to fill the root, or null.
tabGroups string[][] arrangement.tabGroups Overflow panes sharing layout slots.
divider | { props: DOMAttributes<HTMLElement>; axis: "x" | "y"; position: number; min: number; max: number; } | null - Divider geometry and pointer attributes, or null.
focus() (id) => void state.focus Focus a registered pane.
swap() (first, second) => void state.swap Swap two participating panes in tiling order.
zoom() (id) => void state.zoom Expand a pane or clear expansion with null.
resizeMain() (size) => void - Set the main-pane extent within current divider bounds.

useMaosaicoItem()function

Section titled “useMaosaicoItem()”
Signature
function useMaosaicoItem(item, options?): MaosaicoItemBinding;

Register a mounted pane and bind its geometry and captured-pointer lifecycle.

Parameter Type
item MaosaicoItem
options MaosaicoItemOptions

MaosaicoItemBinding

Re-exports arrangeBento


Re-exports applyBentoOps


Re-exports bentoFrames


Re-exports BentoColumns


Re-exports BentoPlacement


Re-exports BentoOp


Re-exports BentoGeometry