Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
import type { LayerStackKind } from '@workbench/canvas-engine/api';
import type { LayerSelectionModifiers } from '@workbench/layerPanelState';
import type { KeyboardEvent } from 'react';
import type { ProjectedChildRow } from './layerChildRows';
/** A point or box the surface host anchors a menu or popover to, in viewport pixels. */
export interface LayerSurfaceAnchor {
readonly x: number;
readonly y: number;
readonly width: number;
readonly height: number;
}
/** One stable command handle per tree; rows rerender for their own state while the tree owns commits. */
export interface LayerRowCommands {
select(id: string, modifiers: LayerSelectionModifiers): void;
focus(id: string): void;
toggleExpanded(id: string): void;
setEnabled(id: string, isEnabled: boolean): void;
setHidden(id: string, isHidden: boolean): void;
setLocked(id: string, isLocked: boolean): void;
startRename(id: string): void;
rename(id: string, name: string): void;
endRename(): void;
openMenu(id: string, anchor: LayerSurfaceAnchor): void;
openStackMenu(stack: LayerStackKind, anchor: LayerSurfaceAnchor): void;
toggleCollapse(stack: LayerStackKind): void;
toggleChildren(id: string): void;
/** Sub-selects a child row and opens its editor, unless `reveal: false` (context menus). */
selectChild(child: ProjectedChildRow, options?: { reveal?: boolean }): void;
setChildEnabled(child: ProjectedChildRow, isEnabled: boolean): void;
removeChild(child: ProjectedChildRow): void;
/** Renameable kinds (adjustment entries): sets the custom name, `null` restoring the kind's own. */
renameChild(child: ProjectedChildRow, name: string | null): void;
/** Ordered kinds only (adjustment entries): swap with the neighbour in `direction`. */
moveChild(child: ProjectedChildRow, direction: -1 | 1): void;
/** Moves the item to another layer of its kind as one atomic edit; it stays sub-selected and focused. */
moveChildToLayer(child: ProjectedChildRow, layerId: string): void;
/** Ordered kinds only: insert a copy directly after the entry. */
duplicateChild(child: ProjectedChildRow): void;
openChildMenu(child: ProjectedChildRow, anchor: LayerSurfaceAnchor): void;
/** `id` is a node id, a child-row key, or a stack header key; the tree tells them apart. */
keyDown(id: string, event: KeyboardEvent<HTMLElement>): void;
}
export const anchorFromPoint = (x: number, y: number): LayerSurfaceAnchor => ({ height: 1, width: 1, x, y });