Signals
Generated by website/scripts/generate-api.ts from packages/gridla/src. Do not edit by hand; run bun run generate in website/.
Read provider state as signals from any injection context: a slice of the state, one item as it should be painted, or the imperative actions.
import { injectGridActions, injectGridController, injectGridItemView, injectGridStore, itemViewsEqual, selectItemView } from 'gridla/angular'
import type { GridItemView } from 'gridla/angular'
Functions
injectGridActions
function · angular/inject.ts:37
Imperative layout and selection actions of the nearest provider. Call it in an injection context.
export function injectGridActions<TData = unknown>(): GridActions<TData>
injectGridController
function · angular/inject.ts:11
The GridController of the nearest enclosing provider. Call it in an
injection context (a constructor or field initializer).
export function injectGridController<TData = unknown>(): GridController<TData>
injectGridItemView
function · angular/inject.ts:32
Everything a rendered item needs, as a signal with structural equality.
Pass a static id or a signal (for example an input). Call it in an
injection context.
export function injectGridItemView(itemId: string | Signal<string>): Signal<GridItemView>
injectGridStore
function · angular/inject.ts:20
A signal over a slice of the nearest provider's state. Recomputes on every
store change and notifies dependents only when equal (default Object.is)
says the slice changed. Call it in an injection context.
export function injectGridStore<TSlice, TData = unknown>(
selector: (state: GridState<TData>) => TSlice,
equal?: ValueEqualityFn<TSlice>,
): Signal<TSlice>
itemViewsEqual
function · angular/view.ts:34
Structural equality for GridItemView, used to skip redundant signal updates.
export function itemViewsEqual(a: GridItemView, b: GridItemView): boolean
selectItemView
function · angular/view.ts:48
Derive the GridItemView of itemId from controller state.
export function selectItemView<TData>(state: GridState<TData>, itemId: string): GridItemView
Types
GridItemView
type · angular/view.ts:11
Everything needed to paint one item: its current and pre-gesture rectangles
plus its active, selected, shifted, and transferring flags. Returned by
injectGridItemView and GridController.itemView.
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
}