headless
Import
Section titled “Import”import * as api from "@fungi.computer/maosaico/headless";Exports
Section titled “Exports”| Kind | Export | Description |
|---|---|---|
| type alias | Gesture | The pointer-owned frame or divider operation currently in progress. |
| type alias | State | Pane geometry, ordering and the active gesture held by the layout store. |
| type alias | MaosaicoState | Live layout projection and commands; each state instance owns its store. |
| type alias | Divider | Clamped divider geometry for a main-pane layout. |
| type alias | Arrangement | Pane frames, overflow tabs and optional main-pane divider. |
| function | createMaosaicoState() | Create an independent layout store with no registered panes. |
| function | arrangeTiles() | Named layouts share minima and MRU tabs; the caller renders the groups. |
Gesturetype alias
Section titled “Gesture”type Gesture = | { kind: "frame"; id: string; pointerId: number; start: Frame; snap?: { side: SnapSide; frame: Frame; } | null; } | { kind: "divider"; pointerId: number; start: number | undefined; };The pointer-owned frame or divider operation currently in progress.
Union Members
Section titled “Union Members”Type Literal
Section titled “Type Literal”{ kind: "frame"; id: string; pointerId: number; start: Frame; snap?: | { side: SnapSide; frame: Frame; } | null;}| Name | Type | Description |
|---|---|---|
kind |
"frame" |
Identifies a frame gesture. |
id |
string |
Registered pane being moved or resized. |
pointerId |
number |
Pointer that owns the gesture. |
start |
Frame |
Frame restored when the gesture is cancelled. |
snap? |
| { side: SnapSide; frame: Frame; } | null |
Candidate snap applied only when the gesture completes. |
Type Literal
Section titled “Type Literal”{ kind: "divider"; pointerId: number; start: number | undefined;}| Name | Type | Description |
|---|---|---|
kind |
"divider" |
Identifies a divider gesture. |
pointerId |
number |
Pointer that owns the divider. |
start |
number | undefined |
Main-size preference restored on cancellation. |
Statetype alias
Section titled “State”type State = object;Pane geometry, ordering and the active gesture held by the layout store.
Properties
Section titled “Properties”frames
Section titled “frames”frames: Map<string, Frame>;Registered floating frames, keyed by pane identity.
order: string[];Focus order, with the most recently focused pane last.
tiles: string[];Stable tiling order of participating panes.
minima
Section titled “minima”minima: Map<string, Minima>;Host-supplied minimum dimensions per pane.
participating
Section titled “participating”participating: Set<string>;Panes currently included in layout.
mainSize
Section titled “mainSize”mainSize: number | undefined;Preferred main-pane extent, or undefined for the default half.
zoomed
Section titled “zoomed”zoomed: string | null;Pane expanded to the container, or null.
gesture
Section titled “gesture”gesture: Gesture | null;Current pointer operation, or null.
restore
Section titled “restore”restore: Map<string, Frame>;Floating frames retained for restoration after snapping.
MaosaicoStatetype alias
Section titled “MaosaicoState”type MaosaicoState = Readonly<State> & object;Live layout projection and commands; each state instance owns its store.
Type Declaration
Section titled “Type Declaration”| Name | Type | Description |
|---|---|---|
version |
number |
Revision incremented by store updates. |
subscribe() |
(listener) => () => void |
Observe store changes; returns an unsubscribe function. |
register() |
(id, frame, minima) => void |
Register or replace a pane’s frame and minima, including it in layout. |
setParticipation() |
(id, participating) => void |
Include or exclude a registered pane without discarding its frame. |
setMinima() |
(id, minima) => void |
Update minimum dimensions for an existing pane. |
unregister() |
(id) => void |
Remove a pane, its ordering, restoration frame and active gesture. |
begin() |
(id, pointerId) => void |
Capture a participating pane’s starting frame for a pointer gesture. |
move() |
(id, pointerId, frame, bounds, minima, snapSide?) => void |
Update the owning pointer’s clamped frame and optional snap preview. |
end() |
(id, pointerId) => void |
Finish the owning pointer’s gesture, applying its snap if present. |
cancel() |
(id, pointerId) => void |
Restore the owning pointer’s starting frame and clear its gesture. |
snap() |
(id, side, bounds, minima) => void |
Snap a participating pane and retain its previous frame. |
restoreFrame() |
(id, bounds, minima) => void |
Restore a retained floating frame, clamped to current bounds and minima. |
focus() |
(id) => void |
Move a registered pane to the top of focus order. |
swap() |
(first, second) => void |
Exchange two participating panes’ positions in tiling order. |
zoom() |
(id) => void |
Expand a participating pane, or clear expansion with null. |
resizeMain() |
(size) => void |
Clear the preference with undefined to restore the default half. |
beginDivider() |
(pointerId) => boolean |
Start a divider gesture only when no other gesture is active. |
finishDivider() |
(pointerId, cancel) => void |
Finish the owning divider gesture, restoring its preference on cancel. |
destroy() |
() => void |
Clear the current gesture and retained restoration frames. |
Dividertype alias
Section titled “Divider”type Divider = object;Clamped divider geometry for a main-pane layout.
Properties
Section titled “Properties”axis: "x" | "y";Coordinate axis along which the divider moves.
position
Section titled “position”position: number;Current main-pane extent.
min: number;Smallest extent permitted by pane minima.
max: number;Largest extent permitted by pane minima and available bounds.
Arrangementtype alias
Section titled “Arrangement”type Arrangement = object;Pane frames, overflow tabs and optional main-pane divider.
Properties
Section titled “Properties”frames
Section titled “frames”frames: Map<string, Frame>;Visible pane geometry, keyed by identity.
tabGroups
Section titled “tabGroups”tabGroups: string[][];Panes sharing an overflow slot; the host renders their tabs.
divider
Section titled “divider”divider: Divider | null;Main-pane divider, absent for equal layouts or insufficient space.
createMaosaicoState()function
Section titled “createMaosaicoState()”function createMaosaicoState(): MaosaicoState;Create an independent layout store with no registered panes.
Returns
Section titled “Returns”arrangeTiles()function
Section titled “arrangeTiles()”function arrangeTiles(order, minima, recent, bounds, options): Arrangement;Named layouts share minima and MRU tabs; the caller renders the groups.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
order |
readonly string[] |
minima |
ReadonlyMap<string, Size> |
recent |
readonly string[] |
bounds |
Size |
options |
TilingOptions |
Returns
Section titled “Returns”References
Section titled “References”SnapSide
Section titled “SnapSide”Re-exports SnapSide
Re-exports Frame
Bounds
Section titled “Bounds”Re-exports Bounds
Minima
Section titled “Minima”Re-exports Minima
TilingLayout
Section titled “TilingLayout”Re-exports TilingLayout
TilingOptions
Section titled “TilingOptions”Re-exports TilingOptions