maosaico
Import
Section titled “Import”import * as api from "@fungi.computer/maosaico";Exports
Section titled “Exports”| 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”type BentoOptions = BentoGeometry & object;Host-owned placements and the callback receiving completed intents.
Type Declaration
Section titled “Type Declaration”| 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”type BentoBinding = object;Renderable frames and interaction attributes for host-owned tiles.
Properties
Section titled “Properties”frames
Section titled “frames”frames: ReturnType<typeof bentoFrames>;Current committed or preview geometry.
preview
Section titled “preview”preview: boolean;Whether frames include a live, non-stale gesture preview.
previewId
Section titled “previewId”previewId: string | null;Tile being previewed, or null.
bind: (id, kind) => DOMAttributes<HTMLElement>;Bind a tile’s move or resize interaction to a host element.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
id |
string |
kind |
"move" | "resize" |
Returns
Section titled “Returns”DOMAttributes<HTMLElement>
MaosaicoLayertype alias
Section titled “MaosaicoLayer”type MaosaicoLayer = "desktop" | "windows" | "chrome" | "popover" | "dialog" | "toast" | "tooltip";Shell paint order. Window ranks are local to the windows root.
Pointtype alias
Section titled “Point”type Point = object;Coordinates relative to the host’s container.
Properties
Section titled “Properties”x: number;Horizontal coordinate.
y: number;Vertical coordinate.
Sizetype alias
Section titled “Size”type Size = object;Dimensions in the host’s coordinate units.
Properties
Section titled “Properties”width: number;Horizontal extent.
height
Section titled “height”height: number;Vertical extent.
Frametype alias
Section titled “Frame”type Frame = Point & Size;A container-relative origin and dimensions.
Boundstype alias
Section titled “Bounds”type Bounds = Size;Available container dimensions.
Minimatype alias
Section titled “Minima”type Minima = Size;Smallest dimensions the host permits for a pane.
SnapSidetype alias
Section titled “SnapSide”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”type MaosaicoItem = object;A mounted pane’s stable identity and initial geometry.
Properties
Section titled “Properties”id: string;Identity used for registration and commands.
frame: Frame;Initial floating frame; later changes use layout commands.
minima
Section titled “minima”minima: Minima;Minimum dimensions kept current while the pane is mounted.
MaosaicoItemOptionstype alias
Section titled “MaosaicoItemOptions”type MaosaicoItemOptions = object;Interaction mode and layout participation for a mounted pane.
Properties
Section titled “Properties”optional kind?: "drag" | "resize";Defaults to dragging; resize changes dimensions instead of origin.
participating?
Section titled “participating?”optional participating?: boolean;Defaults to true; false retains geometry but excludes the pane from layout.
MaosaicoItemBindingtype alias
Section titled “MaosaicoItemBinding”type MaosaicoItemBinding = object;Geometry, focus state and host element interactions for a pane.
Properties
Section titled “Properties”frame: Frame;Visible layout frame, falling back to the pane’s floating geometry.
stackingStyle
Section titled “stackingStyle”stackingStyle: Pick<React.CSSProperties, "zIndex">;Merge into the window’s style, inside the windows layer.
visible
Section titled “visible”visible: boolean;Whether this pane has a frame in the current arrangement.
active
Section titled “active”active: boolean;Whether this pane is last in focus order.
props: React.DOMAttributes<HTMLElement>;Pointer attributes to spread onto the pane’s interaction element.
focus: () => void;Bring the pane to the top of focus order.
Returns
Section titled “Returns”void
snap: (side) => void;Snap the pane to a container edge or corner.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
side |
SnapSide |
Returns
Section titled “Returns”void
restore
Section titled “restore”restore: () => void;Restore the pane’s retained floating frame.
Returns
Section titled “Returns”void
TilingLayouttype alias
Section titled “TilingLayout”type TilingLayout = "main-left" | "main-top" | "columns" | "rows" | "grid";Named strategies for dividing the host’s available bounds.
TilingOptionstype alias
Section titled “TilingOptions”type TilingOptions = object;Layout strategy and spacing supplied by the host.
Properties
Section titled “Properties”layout?
Section titled “layout?”optional layout?: TilingLayout;Defaults to main-left.
mainSize?
Section titled “mainSize?”optional mainSize?: number;Preferred main-pane extent; defaults to half the container’s extent.
optional gap?: number;Space between panes; defaults to eight coordinate units.
MaosaicoRegionconstant
Section titled “MaosaicoRegion”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()”function useMaosaicoBento(options): BentoBinding;Captured, cell-snapped previews. Only a completed gesture proposes host-owned changes.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options |
BentoOptions |
Returns
Section titled “Returns”MaosaicoLayers()function
Section titled “MaosaicoLayers()”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.
Parameters
Section titled “Parameters”| 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. |
Returns
Section titled “Returns”ReactElement
useLayer()function
Section titled “useLayer()”function useLayer(layer): HTMLElement | null;Null until the shell root mounts (also during SSR); body outside a shell.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
layer |
MaosaicoLayer |
Returns
Section titled “Returns”HTMLElement | null
usePointerDrag()function
Section titled “usePointerDrag()”function usePointerDrag( handlers, enabled?, signal?,): DOMAttributes<HTMLElement>;One captured pointer; cancellation and unmount share the same release path.
Parameters
Section titled “Parameters”| 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 |
- |
Returns
Section titled “Returns”DOMAttributes<HTMLElement>
MaosaicoRoot()function
Section titled “MaosaicoRoot()”function MaosaicoRoot(__namedParameters): Element;Omit tiling to retain floating frames. Main size is a preference, in pixels.
Parameters
Section titled “Parameters”| 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. |
Returns
Section titled “Returns”Element
useMaosaicoLayout()function
Section titled “useMaosaicoLayout()”function useMaosaicoLayout(): object;Layout commands keep content and DOM ownership with the caller.
Returns
Section titled “Returns”| 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()”function useMaosaicoItem(item, options?): MaosaicoItemBinding;Register a mounted pane and bind its geometry and captured-pointer lifecycle.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
item |
MaosaicoItem |
options |
MaosaicoItemOptions |
Returns
Section titled “Returns”References
Section titled “References”arrangeBento
Section titled “arrangeBento”Re-exports arrangeBento
applyBentoOps
Section titled “applyBentoOps”Re-exports applyBentoOps
bentoFrames
Section titled “bentoFrames”Re-exports bentoFrames
BentoColumns
Section titled “BentoColumns”Re-exports BentoColumns
BentoPlacement
Section titled “BentoPlacement”Re-exports BentoPlacement
BentoOp
Section titled “BentoOp”Re-exports BentoOp
BentoGeometry
Section titled “BentoGeometry”Re-exports BentoGeometry