Primitives
Generated by website/scripts/generate-api.ts from packages/gridla/src. Do not edit by hand; run bun run generate in website/.
Accessors over slices of provider state built with from() over the controller store, plus the imperative actions. Each accessor notifies only when its slice changes.
import { useGridActions, useGridInteractionState, useGridItem, useGridItemView, useGridLayout, useGridPreview, useGridSelection, useGridSourceLayout, useGridStore, useGridVisibleLayout } from 'gridla/solid'
import type { GridItemView, MaybeAccessor } from 'gridla/solid'
Hooks
useGridActions
hook · solid/hooks.ts:57
Imperative layout and selection actions. Stable for the provider's lifetime.
export function useGridActions<TData = unknown>(): GridActions<TData>
useGridInteractionState
hook · solid/hooks.ts:141
The gesture in progress, or null when idle.
export function useGridInteractionState(): Accessor<GridInteraction | null>
useGridItem
hook · solid/hooks.ts:77
One item as it should be painted right now. null when absent.
export function useGridItem<TData = unknown>(
itemId: MaybeAccessor<string>,
): Accessor<GridItem<TData> | null>
useGridItemView
hook · solid/hooks.ts:108
Everything a rendered item needs, as one accessor that updates only when the view changes.
export function useGridItemView<TData = unknown>(
itemId: MaybeAccessor<string>,
): Accessor<GridItemView>
useGridLayout
hook · solid/hooks.ts:62
The rendered layout (projected onto the measured canvas size).
export function useGridLayout<TData = unknown>(): Accessor<GridLayout<TData>>
useGridPreview
hook · solid/hooks.ts:146
The solver's latest preview for the gesture in progress, or null when idle.
export function useGridPreview<TData = unknown>(): Accessor<GridPreview<TData> | null>
useGridSelection
hook · solid/hooks.ts:151
Id of the selected item, or null when nothing is selected.
export function useGridSelection(): Accessor<string | null>
useGridSourceLayout
hook · solid/hooks.ts:67
The layout the provider was given, in its own coordinates.
export function useGridSourceLayout<TData = unknown>(): Accessor<GridLayout<TData>>
useGridStore
hook · solid/hooks.ts:22
Subscribe to a slice of provider state. Returns an accessor that notifies
only when the selected value changes (by Object.is, or isEqual). Built
with from() over the controller store, so it follows Solid's ownership
rules and unsubscribes with the component.
export function useGridStore<TData = unknown, TSlice = GridState<TData>>(
selector: (state: GridState<TData>) => TSlice = (state) => state as unknown as TSlice,
isEqual: (a: TSlice, b: TSlice) => boolean = Object.is,
): Accessor<TSlice>
useGridVisibleLayout
hook · solid/hooks.ts:72
The layout that should be painted right now: the preview during a gesture, else the rendered layout.
export function useGridVisibleLayout<TData = unknown>(): Accessor<GridLayout<TData>>
Types
GridItemView
type · solid/hooks.ts:91
Everything needed to paint one item: its current and pre-gesture rectangles
plus its active, selected, shifted, and transferring flags. Returned by
useGridItemView.
export type GridItemView = {
/** Where the item is painted right now (preview-aware). */
rect: GridRect
/** Where the item was before the current gesture. */
baseRect: GridRect
/** Cursor-tracked rect while this item is active; `null` otherwise. */
activeRect: GridRect | null
isActive: boolean
isSelected: boolean
/** True when this item moved in the preview because another item pushed it. */
isShifted: boolean
/** True while the active item is being previewed in another canvas. */
isTransferring: boolean
interaction: GridInteraction | null
}
MaybeAccessor
type · solid/hooks.ts:10
A plain value or an accessor for it. Item ids may be given either way.
export type MaybeAccessor<T> = T | Accessor<T>