Skip to content

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.

refactor(properties): delete the toolbar-region vocabulary (U5)

Josh Corbettc0b136e607b7
diff --git a/invokeai/frontend/webv2/public/locales/en.json b/invokeai/frontend/webv2/public/locales/en.json
index 9a34c72a35..8bb03adafe 100644
--- a/invokeai/frontend/webv2/public/locales/en.json
+++ b/invokeai/frontend/webv2/public/locales/en.json
@@ -1572,10 +1572,6 @@
},
"rows": {
"color": "Color",
- "geometry": "Geometry",
- "intensity": "Intensity",
- "modes": "Modes",
- "more": "More",
"kind": "Kind",
"width": "Width",
"angle": "Angle",
diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/ARCHITECTURE.md b/invokeai/frontend/webv2/src/workbench/canvas-engine/ARCHITECTURE.md
index 4ebd57bbcc..e67729a657 100644
--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/ARCHITECTURE.md
+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/ARCHITECTURE.md
@@ -41,7 +41,7 @@ The document mirror diffs forests by leaf identity and ancestor-effective state:
### Properties and Transform
-Tool and operation settings live off the surface, as editor panes of the Layers panel (`widgets/layers/panes`). The Properties pane renders the running operation first (its inputs, secondary controls and status with Apply / Cancel) and then the active tool's settings as labelled rows; the Transform pane edits the selected layer's transform without a tool — each field commits one undoable `patch`, and while the Transform tool holds a session the same fields drive its preview and Apply / Cancel land or drop it. Both read the engine's option stores and document transactions through one `ToolPresentationAdapter` per tool and one `OperationPresentationAdapter` per operation (`widgets/canvas/tool-presentation`): a component per settings region, no state mirror. Staging and generation lock the tool rows in place (`inert`) while an operation keeps its own controls live and Cancel always reachable. The panes are fixed parts of the panel — `LayerEditorPanes` owns their tabs, preferred height and collapse, persisted through the Layers widget's project state — not movable widgets. The same blocks host the Color/Swatches workspace (the project foreground/background pair), the History pane (the engine's labeled undo/redo stack via `history.getEntries()`/`stepBy`), and the Overview navigator (`previews.drawDocumentOverview` plus the live viewport handle).
+Tool and operation settings live off the surface, as editor panes of the Layers panel (`widgets/layers/panes`). The Properties pane renders the running operation first and then the active tool, each as a `ToolPropertyForm` / `OperationPropertyForm` (`widgets/canvas/tool-presentation`): named, collapsible groups of typed rows (an optional preview card on top), with ONE sticky footer pinned to the pane's bottom edge — the running operation's verbs (status chip, Process/Reset, Apply with its save-as menu, Cancel), else the tool form's (the transform session's Apply/Cancel). Group ids are global so tools sharing a group's component keep its DOM and collapse state across the switch. The Transform pane edits the selected layer's transform without a tool — each field commits one undoable `patch`, and while the Transform tool holds a session the same fields drive its preview and Apply / Cancel land or drop it. Forms read the engine's option stores and document transactions directly: no state mirror. Staging and generation lock the tool groups in place (`inert`), the footer honors the same lock itself (it sits outside the sections), and an operation keeps its own controls live with Cancel always reachable. The panes are fixed parts of the panel — `LayerEditorPanes` owns their tabs, preferred height and collapse, persisted through the Layers widget's project state — not movable widgets. The same blocks host the Color/Swatches workspace (the project foreground/background pair), the History pane (the engine's labeled undo/redo stack via `history.getEntries()`/`stepBy`), and the Overview navigator (`previews.drawDocumentOverview` plus the live viewport handle).
## Package and capability boundaries
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/BrushOptions.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/BrushOptions.tsx
index 7b1e456ddb..ace9f442ea 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/BrushOptions.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/BrushOptions.tsx
@@ -3,11 +3,7 @@ import type { KeyboardEvent } from 'react';
import { chakra } from '@chakra-ui/react';
import { MAX_BRUSH_SIZE, MIN_BRUSH_SIZE } from '@workbench/canvas-engine/api';
-import {
- ToolbarNumberField,
- ToolbarSlider,
- useNumberCommit,
-} from '@workbench/widgets/canvas/tool-presentation/ToolbarPrimitives';
+import { FormNumberField, FormSlider, useNumberCommit } from '@workbench/widgets/canvas/tool-presentation/FormControls';
import { useLayoutEffect, useRef, useCallback } from 'react';
import { useTranslation } from 'react-i18next';
@@ -99,7 +95,7 @@ export const PaintSizeControl = ({
return (
<>
- <ToolbarSlider
+ <FormSlider
aria-label={label}
formatValue={formatPx}
getAriaValueText={formatPx}
@@ -110,7 +106,7 @@ export const PaintSizeControl = ({
onKeyDownCapture={onSliderKeyDownCapture}
onValueChange={onSlider}
/>
- <ToolbarNumberField
+ <FormNumberField
aria-label={label}
max={MAX_BRUSH_SIZE}
min={MIN_BRUSH_SIZE}
@@ -147,7 +143,7 @@ export const PaintOpacityControl = ({
);
return (
<>
- <ToolbarSlider
+ <FormSlider
aria-label={label}
formatValue={formatPercent}
max={100}
@@ -155,7 +151,7 @@ export const PaintOpacityControl = ({
value={percent}
onValueChange={onSlider}
/>
- <ToolbarNumberField
+ <FormNumberField
aria-label={label}
max={100}
min={0}
@@ -189,7 +185,7 @@ export const PaintHardnessControl = ({
);
return (
<>
- <ToolbarSlider
+ <FormSlider
aria-label={label}
formatValue={formatPercent}
max={100}
@@ -197,7 +193,7 @@ export const PaintHardnessControl = ({
value={percent}
onValueChange={onSlider}
/>
- <ToolbarNumberField
+ <FormNumberField
aria-label={label}
max={100}
min={0}
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/FilterOptions.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/FilterOptions.tsx
index b478e037b5..a8da62eded 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/FilterOptions.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/FilterOptions.tsx
@@ -1,8 +1,8 @@
import type {
OperationPropertyForm,
- ToolbarRegionProps,
- ToolbarStatusProps,
-} from '@workbench/widgets/canvas/tool-presentation/toolbarContracts';
+ ToolFormProps,
+ ToolFooterProps,
+} from '@workbench/widgets/canvas/tool-presentation/toolFormContracts';
/* oxlint-disable react-perf/jsx-no-new-function-as-prop */
import { Box, createListCollection, Flex, Icon, Menu, Portal } from '@chakra-ui/react';
@@ -72,7 +72,7 @@ export const getFilterStatusTranslationKey = (status: FilterOperationSessionStat
? 'widgets.layers.rasterFilter.statusError'
: 'widgets.layers.selectObject.statusReady';
-const useFilterDraft = (engine: ToolbarRegionProps['engine']) => {
+const useFilterDraft = (engine: ToolFormProps['engine']) => {
const operations = getCanvasOperations(engine);
const setType = useCallback(
(type: string) => {
@@ -102,7 +102,7 @@ const useFilterDraft = (engine: ToolbarRegionProps['engine']) => {
};
/** Filter choice (grouped by category) and auto-process: the iteration dials. */
-const FilterChooseSettings = ({ engine, isSurfaceInteractionLocked }: ToolbarRegionProps) => {
+const FilterChooseSettings = ({ engine, isSurfaceInteractionLocked }: ToolFormProps) => {
const { t } = useTranslation();
const session = useFilterSession(engine);
const { operations, setType } = useFilterDraft(engine);
@@ -167,7 +167,7 @@ const FilterChooseSettings = ({ engine, isSurfaceInteractionLocked }: ToolbarReg
};
/** The chosen filter's parameters. */
-const FilterParamsSettings = ({ engine, isSurfaceInteractionLocked }: ToolbarRegionProps) => {
+const FilterParamsSettings = ({ engine, isSurfaceInteractionLocked }: ToolFormProps) => {
const session = useFilterSession(engine);
const { setSettings, setType } = useFilterDraft(engine);
if (!session) {
@@ -191,7 +191,7 @@ const FilterParamsSettings = ({ engine, isSurfaceInteractionLocked }: ToolbarReg
* The operation's sticky footer: the status chip, Reset, Process (hidden while
* auto-process owns it), Apply with its save-as menu, and Cancel.
*/
-const FilterFooter = ({ engine, isExternalInteractionLocked }: ToolbarStatusProps) => {
+const FilterFooter = ({ engine, isExternalInteractionLocked }: ToolFooterProps) => {
const { t } = useTranslation();
const session = useFilterSession(engine);
const { operations, reset } = useFilterDraft(engine);
@@ -236,7 +236,7 @@ const FilterFooter = ({ engine, isExternalInteractionLocked }: ToolbarStatusProp
)}
<Flex flexShrink={0}>
<Button
- data-toolbar-action="apply"
+ data-pane-action="apply"
disabled={!eligibility.canApply}
loading={session.status === 'committing'}
roundedRight="none"
@@ -280,7 +280,7 @@ const FilterFooter = ({ engine, isExternalInteractionLocked }: ToolbarStatusProp
</Menu.Root>
</Flex>
<Button
- data-toolbar-action="cancel"
+ data-pane-action="cancel"
disabled={!eligibility.canCancel}
flexShrink={0}
size="xs"
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/GradientOptions.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/GradientOptions.tsx
index dc1adc19d6..460d570822 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/GradientOptions.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/GradientOptions.tsx
@@ -1,8 +1,5 @@
import type { CanvasLayerSourceContract, GradientStop, GradientToolOptions } from '@workbench/canvas-engine/api';
-import type {
- ToolbarRegionProps,
- ToolPropertyForm,
-} from '@workbench/widgets/canvas/tool-presentation/toolbarContracts';
+import type { ToolFormProps, ToolPropertyForm } from '@workbench/widgets/canvas/tool-presentation/toolFormContracts';
import type { KeyboardEvent, PointerEvent as ReactPointerEvent } from 'react';
import { Box, chakra, Flex, IconButton as ChakraIconButton, Icon } from '@chakra-ui/react';
@@ -10,18 +7,18 @@ import { ColorPicker } from '@platform/ui/ColorPicker';
import { getDocumentLayer } from '@workbench/canvas-engine/api';
import { useActiveColorPair } from '@workbench/widgets/canvas/color-system/useActiveColors';
import { useGradientOptions } from '@workbench/widgets/canvas/engineStoreHooks';
+import {
+ FormNumberField,
+ FormSlider,
+ useNumberCommit,
+ useSliderGesture,
+} from '@workbench/widgets/canvas/tool-presentation/FormControls';
import {
EditTargetChip,
PropertyControlRow,
PropertySegmentedRow,
PropertySwitchRow,
} from '@workbench/widgets/canvas/tool-presentation/PropertyPrimitives';
-import {
- ToolbarNumberField,
- ToolbarSlider,
- useNumberCommit,
- useSliderGesture,
-} from '@workbench/widgets/canvas/tool-presentation/ToolbarPrimitives';
import { useColorSampler } from '@workbench/widgets/canvas/useColorSampler';
import { usePreparedCommit } from '@workbench/widgets/canvas/useStructuralCommit';
import { useActiveProjectSelector } from '@workbench/WorkbenchContext';
@@ -47,7 +44,7 @@ interface SelectedGradient {
* switches to explicit custom stops, independent of later pair edits. Edits
* commit to a selected gradient layer (stop gestures once on release).
*/
-const useGradientEditor = (engine: ToolbarRegionProps['engine']) => {
+const useGradientEditor = (engine: ToolFormProps['engine']) => {
const { t } = useTranslation();
const commitPrepared = usePreparedCommit(engine);
const options = useGradientOptions(engine);
@@ -336,7 +333,7 @@ const StopHandle = ({
);
};
-const GradientSettings = ({ engine }: ToolbarRegionProps) => {
+const GradientSettings = ({ engine }: ToolFormProps) => {
const { t } = useTranslation();
const editor = useGradientEditor(engine);
const kindOptions = useMemo(
@@ -371,7 +368,7 @@ const GradientSettings = ({ engine }: ToolbarRegionProps) => {
onValueChange={setKind}
/>
<PropertyControlRow label={t('widgets.properties.rows.angle')}>
- <ToolbarSlider
+ <FormSlider
aria-label={t('widgets.canvas.toolOptions.gradientAngle')}
disabled={editor.kind === 'radial'}
max={360}
@@ -380,7 +377,7 @@ const GradientSettings = ({ engine }: ToolbarRegionProps) => {
onValueChange={angleGesture.onChange}
onValueChangeEnd={angleGesture.onChangeEnd}
/>
- <ToolbarNumberField
+ <FormNumberField
aria-label={t('widgets.canvas.toolOptions.gradientAngle')}
disabled={editor.kind === 'radial'}
max={360}
@@ -394,7 +391,7 @@ const GradientSettings = ({ engine }: ToolbarRegionProps) => {
);
};
-const GradientStopsSettings = ({ engine }: ToolbarRegionProps) => {
+const GradientStopsSettings = ({ engine }: ToolFormProps) => {
const { t } = useTranslation();
const editor = useGradientEditor(engine);
const sampleColor = useColorSampler(engine);
@@ -470,7 +467,7 @@ const GradientStopsSettings = ({ engine }: ToolbarRegionProps) => {
onValueChange={onColorChange}
onValueChangeEnd={onColorChangeEnd}
/>
- <ToolbarNumberField
+ <FormNumberField
aria-label={t('widgets.properties.rows.offset')}
max={100}
min={0}
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/SamOptions.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/SamOptions.tsx
index e67fcc56bf..707ef3906c 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/SamOptions.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/SamOptions.tsx
@@ -1,8 +1,8 @@
import type {
OperationPropertyForm,
- ToolbarRegionProps,
- ToolbarStatusProps,
-} from '@workbench/widgets/canvas/tool-presentation/toolbarContracts';
+ ToolFormProps,
+ ToolFooterProps,
+} from '@workbench/widgets/canvas/tool-presentation/toolFormContracts';
/* oxlint-disable react-perf/jsx-no-jsx-as-prop, react-perf/jsx-no-new-function-as-prop, react-perf/jsx-no-new-object-as-prop */
import type { ChangeEvent } from 'react';
@@ -412,7 +412,7 @@ export const SamSettings = ({
/** Input mode, the visual point labels or the prompt, and invert: what changes between previews. */
/** The session's inputs: visual points or a prompt, plus the invert switch. */
-const SamInputSettings = ({ engine, isSurfaceInteractionLocked }: ToolbarRegionProps) => {
+const SamInputSettings = ({ engine, isSurfaceInteractionLocked }: ToolFormProps) => {
const { t } = useTranslation();
const session = useSamSession(engine);
const operations = getCanvasOperations(engine);
@@ -474,7 +474,7 @@ const SamInputSettings = ({ engine, isSurfaceInteractionLocked }: ToolbarRegionP
};
/** Set-once session settings: model, refinement, preview behavior. */
-const SamSettingsGroup = ({ engine, isSurfaceInteractionLocked }: ToolbarRegionProps) => {
+const SamSettingsGroup = ({ engine, isSurfaceInteractionLocked }: ToolFormProps) => {
const session = useSamSession(engine);
const operations = getCanvasOperations(engine);
if (!session) {
@@ -495,7 +495,7 @@ const SamSettingsGroup = ({ engine, isSurfaceInteractionLocked }: ToolbarRegionP
const APPLY_MENU_POSITIONING = { placement: 'top-end' } as const;
/** The sticky footer: status chip, Reset, Process, Apply with its save-as menu, Cancel. */
-const SamFooter = ({ engine, isExternalInteractionLocked }: ToolbarStatusProps) => {
+const SamFooter = ({ engine, isExternalInteractionLocked }: ToolFooterProps) => {
const { t } = useTranslation();
const session = useSamSession(engine);
const actions = useMemo(() => getSamActionHandlers(getCanvasOperations(engine)), [engine]);
@@ -539,7 +539,7 @@ const SamFooter = ({ engine, isExternalInteractionLocked }: ToolbarStatusProps)
</Button>
<Flex flexShrink={0}>
<Button
- data-toolbar-action="apply"
+ data-pane-action="apply"
disabled={!eligibility.canApply}
loading={session.status === 'committing'}
roundedRight="none"
@@ -580,7 +580,7 @@ const SamFooter = ({ engine, isExternalInteractionLocked }: ToolbarStatusProps)
</Menu.Root>
</Flex>
<Button
- data-toolbar-action="cancel"
+ data-pane-action="cancel"
disabled={!eligibility.canCancel}
flexShrink={0}
size="xs"
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/SelectionOptionsRow.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/SelectionOptionsRow.tsx
index 41d4a86a3a..0e7e09ff01 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/SelectionOptionsRow.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/SelectionOptionsRow.tsx
@@ -1,5 +1,5 @@
import type { SelectionOp } from '@workbench/canvas-engine/api';
-import type { ToolbarRegionProps } from '@workbench/widgets/canvas/tool-presentation/toolbarContracts';
+import type { ToolFormProps } from '@workbench/widgets/canvas/tool-presentation/toolFormContracts';
import { HStack } from '@chakra-ui/react';
import { Button, IconButton } from '@platform/ui/Button';
@@ -83,7 +83,7 @@ export const SelectionOpModeButtons = ({
* (unlocked, visible) paint layer — the same rule the engine enforces; invert
* and deselect need only a selection.
*/
-export const SelectionActions = ({ engine }: ToolbarRegionProps) => {
+export const SelectionActions = ({ engine }: ToolFormProps) => {
const { t } = useTranslation();
const hasSelection = useCanvasHasSelection(engine);
const canPaintTarget = useActiveProjectSelector((project) => {
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/ShapeOptions.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/ShapeOptions.tsx
index 73aec82041..cff581e954 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/ShapeOptions.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/ShapeOptions.tsx
@@ -1,8 +1,5 @@
import type { CanvasLayerSourceContract, ShapeToolOptions } from '@workbench/canvas-engine/api';
-import type {
- ToolbarRegionProps,
- ToolPropertyForm,
-} from '@workbench/widgets/canvas/tool-presentation/toolbarContracts';
+import type { ToolFormProps, ToolPropertyForm } from '@workbench/widgets/canvas/tool-presentation/toolFormContracts';
import { Text } from '@chakra-ui/react';
import { ToggleIconButton } from '@platform/ui/Button';
@@ -10,17 +7,17 @@ import { ColorPicker } from '@platform/ui/ColorPicker';
import { MAX_SHAPE_STROKE_WIDTH, getDocumentLayer } from '@workbench/canvas-engine/api';
import { useActiveColorCommands, useActiveColorPair } from '@workbench/widgets/canvas/color-system/useActiveColors';
import { useShapeOptions } from '@workbench/widgets/canvas/engineStoreHooks';
+import {
+ FormNumberField,
+ FormSlider,
+ useNumberCommit,
+ useSliderGesture,
+} from '@workbench/widgets/canvas/tool-presentation/FormControls';
import {
EditTargetChip,
PropertyControlRow,
PropertySegmentedRow,
} from '@workbench/widgets/canvas/tool-presentation/PropertyPrimitives';
-import {
- ToolbarNumberField,
- ToolbarSlider,
- useNumberCommit,
- useSliderGesture,
-} from '@workbench/widgets/canvas/tool-presentation/ToolbarPrimitives';
import { useColorSampler } from '@workbench/widgets/canvas/useColorSampler';
import { usePreparedCommit } from '@workbench/widgets/canvas/useStructuralCommit';
import { useActiveProjectSelector } from '@workbench/WorkbenchContext';
@@ -47,7 +44,7 @@ const FALLBACK_COLOR = '#000000';
* nothing selected the color chips edit the pair itself, so there is no second
* global shape color.
*/
-const useShapeEditor = (engine: ToolbarRegionProps['engine']) => {
+const useShapeEditor = (engine: ToolFormProps['engine']) => {
const { t } = useTranslation();
const commitPrepared = usePreparedCommit(engine);
const options = useShapeOptions(engine);
@@ -155,7 +152,7 @@ const useShapeEditor = (engine: ToolbarRegionProps['engine']) => {
};
};
-const ShapeSettings = ({ engine }: ToolbarRegionProps) => {
+const ShapeSettings = ({ engine }: ToolFormProps) => {
const { t } = useTranslation();
const editor = useShapeEditor(engine);
const sampleColor = useColorSampler(engine);
@@ -221,7 +218,7 @@ const ShapeSettings = ({ engine }: ToolbarRegionProps) => {
/>
</PropertyControlRow>
<PropertyControlRow label={t('widgets.properties.rows.width')}>
- <ToolbarSlider
+ <FormSlider
aria-label={t('widgets.canvas.toolOptions.shapeStrokeWidth')}
disabled={editor.stroke === null}
max={MAX_SHAPE_STROKE_WIDTH}
@@ -230,7 +227,7 @@ const ShapeSettings = ({ engine }: ToolbarRegionProps) => {
onValueChange={widthGesture.onChange}
onValueChangeEnd={widthGesture.onChangeEnd}
/>
- <ToolbarNumberField
+ <FormNumberField
aria-label={t('widgets.canvas.toolOptions.shapeStrokeWidth')}
disabled={editor.stroke === null}
max={MAX_SHAPE_STROKE_WIDTH}
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/TextOptions.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/TextOptions.tsx
index 66c7994298..576355e99f 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/TextOptions.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/TextOptions.tsx
@@ -1,9 +1,6 @@
import type { SelectValueChangeDetails } from '@chakra-ui/react';
import type { CanvasLayerSourceContract, TextToolOptions } from '@workbench/canvas-engine/api';
-import type {
- ToolbarRegionProps,
- ToolPropertyForm,
-} from '@workbench/widgets/canvas/tool-presentation/toolbarContracts';
+import type { ToolFormProps, ToolPropertyForm } from '@workbench/widgets/canvas/tool-presentation/toolFormContracts';
import { createListCollection, HStack } from '@chakra-ui/react';
import { IconButton } from '@platform/ui/Button';
@@ -18,13 +15,13 @@ import {
} from '@workbench/canvas-engine/api';
import { useActiveColorCommands, useActiveColorPair } from '@workbench/widgets/canvas/color-system/useActiveColors';
import { useTextEditSession, useTextOptions } from '@workbench/widgets/canvas/engineStoreHooks';
-import { EditTargetChip, PropertyControlRow } from '@workbench/widgets/canvas/tool-presentation/PropertyPrimitives';
import {
- ToolbarNumberField,
- ToolbarSlider,
+ FormNumberField,
+ FormSlider,
useNumberCommit,
useSliderGesture,
-} from '@workbench/widgets/canvas/tool-presentation/ToolbarPrimitives';
+} from '@workbench/widgets/canvas/tool-presentation/FormControls';
+import { EditTargetChip, PropertyControlRow } from '@workbench/widgets/canvas/tool-presentation/PropertyPrimitives';
import { useColorSampler } from '@workbench/widgets/canvas/useColorSampler';
import { usePreparedCommit } from '@workbench/widgets/canvas/useStructuralCommit';
import { useActiveProjectSelector } from '@workbench/WorkbenchContext';
@@ -91,7 +88,7 @@ const AlignButton = ({
* session (folded into its single commit) or commit one history entry on the
* selected layer; color edits with nothing to own them edit the pair.
*/
-const useTextEditor = (engine: ToolbarRegionProps['engine']) => {
+const useTextEditor = (engine: ToolFormProps['engine']) => {
const { t } = useTranslation();
const commitPrepared = usePreparedCommit(engine);
const options = useTextOptions(engine);
@@ -157,7 +154,7 @@ const useTextEditor = (engine: ToolbarRegionProps['engine']) => {
return { active, applyEdit, targetName };
};
-const TextFontSettings = ({ engine }: ToolbarRegionProps) => {
+const TextFontSettings = ({ engine }: ToolFormProps) => {
const { t } = useTranslation();
const { active, applyEdit, targetName } = useTextEditor(engine);
const familyCollection = useMemo(
@@ -235,7 +232,7 @@ const TextFontSettings = ({ engine }: ToolbarRegionProps) => {
/>
</PropertyControlRow>
<PropertyControlRow label={t('widgets.properties.rows.size')}>
- <ToolbarSlider
+ <FormSlider
aria-label={t('widgets.canvas.toolOptions.textSize')}
max={MAX_TEXT_FONT_SIZE}
min={MIN_TEXT_FONT_SIZE}
@@ -243,7 +240,7 @@ const TextFontSettings = ({ engine }: ToolbarRegionProps) => {
onValueChange={sizeGesture.onChange}
onValueChangeEnd={sizeGesture.onChangeEnd}
/>
- <ToolbarNumberField
+ <FormNumberField
aria-label={t('widgets.canvas.toolOptions.textSize')}
max={MAX_TEXT_FONT_SIZE}
min={MIN_TEXT_FONT_SIZE}
@@ -267,7 +264,7 @@ const TextFontSettings = ({ engine }: ToolbarRegionProps) => {
/>
</PropertyControlRow>
<PropertyControlRow label={t('widgets.properties.rows.lineHeight')}>
- <ToolbarSlider
+ <FormSlider
aria-label={t('widgets.canvas.toolOptions.textLineHeight')}
max={4}
min={0.5}
@@ -276,7 +273,7 @@ const TextFontSettings = ({ engine }: ToolbarRegionProps) => {
onValueChange={lineHeightGesture.onChange}
onValueChangeEnd={lineHeightGesture.onChangeEnd}
/>
- <ToolbarNumberField
+ <FormNumberField
aria-label={t('widgets.canvas.toolOptions.textLineHeight')}
max={4}
min={0.5}
@@ -289,7 +286,7 @@ const TextFontSettings = ({ engine }: ToolbarRegionProps) => {
);
};
-const TextParagraphSettings = ({ engine }: ToolbarRegionProps) => {
+const TextParagraphSettings = ({ engine }: ToolFormProps) => {
const { t } = useTranslation();
const { active, applyEdit } = useTextEditor(engine);
const onAlign = useCallback((next: TextAlign) => applyEdit({ align: next }, true), [applyEdit]);
@@ -304,7 +301,7 @@ const TextParagraphSettings = ({ engine }: ToolbarRegionProps) => {
);
};
-const TextColorSettings = ({ engine }: ToolbarRegionProps) => {
+const TextColorSettings = ({ engine }: ToolFormProps) => {
const { t } = useTranslation();
const { active, applyEdit } = useTextEditor(engine);
const sampleColor = useColorSampler(engine);
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/geometryForm.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/geometryForm.tsx
index 39576b2117..54b032dda8 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/geometryForm.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/geometryForm.tsx
@@ -1,11 +1,11 @@
import type { AspectRatioId } from '@features/generation/contracts';
import type { LayerTransform } from '@workbench/canvas-engine/api';
import type {
- ToolbarRegionProps,
- ToolbarStatusProps,
+ ToolFormProps,
+ ToolFooterProps,
ToolPropertyForm,
ToolPropertyGroup,
-} from '@workbench/widgets/canvas/tool-presentation/toolbarContracts';
+} from '@workbench/widgets/canvas/tool-presentation/toolFormContracts';
import { Flex } from '@chakra-ui/react';
import { AspectRatioLockButton, AspectRatioSelect } from '@features/generation/components';
@@ -16,12 +16,12 @@ import {
useCanvasHasFloatingSelection,
useTransformSession,
} from '@workbench/widgets/canvas/engineStoreHooks';
-import { PropertyControlRow } from '@workbench/widgets/canvas/tool-presentation/PropertyPrimitives';
import {
- ToolbarNumberField,
- ToolbarStatus,
+ FormNumberField,
+ ApplyCancelBar,
useNumberCommit,
-} from '@workbench/widgets/canvas/tool-presentation/ToolbarPrimitives';
+} from '@workbench/widgets/canvas/tool-presentation/FormControls';
+import { PropertyControlRow } from '@workbench/widgets/canvas/tool-presentation/PropertyPrimitives';
import { usePreparedCommit } from '@workbench/widgets/canvas/useStructuralCommit';
import { useActiveProjectSelector } from '@workbench/WorkbenchContext';
import { useCallback } from 'react';
@@ -56,7 +56,7 @@ interface SelectedLeafTransform {
* single Apply commit; otherwise each settled field is one undoable patch on
* the selected, unlocked leaf.
*/
-export const useLayerTransformEditor = (engine: ToolbarRegionProps['engine'], labelKey = 'widgets.transform.edit') => {
+export const useLayerTransformEditor = (engine: ToolFormProps['engine'], labelKey = 'widgets.transform.edit') => {
const { t } = useTranslation();
const commitPrepared = usePreparedCommit(engine);
const session = useTransformSession(engine);
@@ -92,7 +92,7 @@ export const useLayerTransformEditor = (engine: ToolbarRegionProps['engine'], la
* else the selected layer / transform session. One component for every
* geometry tool, so the X/Y fields keep DOM identity across tool switches.
*/
-const GeometryPositionSettings = ({ engine }: ToolbarRegionProps) => {
+const GeometryPositionSettings = ({ engine }: ToolFormProps) => {
const { t } = useTranslation();
const activeTool = useCanvasActiveTool(engine);
const isFrame = activeTool === 'bbox';
@@ -120,14 +120,14 @@ const GeometryPositionSettings = ({ engine }: ToolbarRegionProps) => {
// prefixes, so a row label would just repeat it.
return (
<Flex gap="2" w="full">
- <ToolbarNumberField
+ <FormNumberField
aria-label={t('widgets.canvas.toolOptions.positionX')}
disabled={x === null}
label={t('widgets.canvas.toolOptions.positionX')}
value={x === null ? '' : String(x)}
onValueCommit={onX}
/>
- <ToolbarNumberField
+ <FormNumberField
aria-label={t('widgets.canvas.toolOptions.positionY')}
disabled={y === null}
label={t('widgets.canvas.toolOptions.positionY')}
@@ -139,7 +139,7 @@ const GeometryPositionSettings = ({ engine }: ToolbarRegionProps) => {
};
/** Scale percent pair and rotation for the transform session / selected leaf. */
-export const TransformScaleSettings = ({ engine }: ToolbarRegionProps) => {
+export const TransformScaleSettings = ({ engine }: ToolFormProps) => {
const { t } = useTranslation();
const { patch, transform } = useLayerTransformEditor(engine);
const onScaleX = useNumberCommit(
@@ -155,7 +155,7 @@ export const TransformScaleSettings = ({ engine }: ToolbarRegionProps) => {
<>
<PropertyControlRow label={t('widgets.transform.scale')}>
<Flex gap="2" gridColumn="2 / -1">
- <ToolbarNumberField
+ <FormNumberField
aria-label={t('widgets.canvas.toolOptions.scaleWidth')}
disabled={!transform}
label={t('widgets.canvas.toolOptions.frameWidth')}
@@ -163,7 +163,7 @@ export const TransformScaleSettings = ({ engine }: ToolbarRegionProps) => {
value={transform ? String(round2(transform.scaleX * 100)) : ''}
onValueCommit={onScaleX}
/>
- <ToolbarNumberField
+ <FormNumberField
aria-label={t('widgets.canvas.toolOptions.scaleHeight')}
disabled={!transform}
label={t('widgets.canvas.toolOptions.frameHeight')}
@@ -174,7 +174,7 @@ export const TransformScaleSettings = ({ engine }: ToolbarRegionProps) => {
</Flex>
</PropertyControlRow>
<PropertyControlRow label={t('widgets.transform.rotation')}>
- <ToolbarNumberField
+ <FormNumberField
aria-label={t('widgets.canvas.toolOptions.rotation')}
disabled={!transform}
suffix="°"
@@ -187,7 +187,7 @@ export const TransformScaleSettings = ({ engine }: ToolbarRegionProps) => {
};
/** Frame width/height plus the aspect preset and lock, as form rows. */
-const FrameSizeSettings = ({ engine }: ToolbarRegionProps) => {
+const FrameSizeSettings = ({ engine }: ToolFormProps) => {
const { t } = useTranslation();
const { bbox, commitBbox, grid, options, setHeight, setWidth } = useBboxEditor(engine);
const onWidth = useNumberCommit(setWidth);
@@ -225,14 +225,14 @@ const FrameSizeSettings = ({ engine }: ToolbarRegionProps) => {
<>
<PropertyControlRow label={t('widgets.properties.rows.size')}>
<Flex gap="2" gridColumn="2 / -1">
- <ToolbarNumberField
+ <FormNumberField
aria-label={t('widgets.canvas.toolOptions.frameWidth')}
label={t('widgets.canvas.toolOptions.frameWidth')}
min={1}
value={String(bbox.width)}
onValueCommit={onWidth}
/>
- <ToolbarNumberField
+ <FormNumberField
aria-label={t('widgets.canvas.toolOptions.frameHeight')}
label={t('widgets.canvas.toolOptions.frameHeight')}
min={1}
@@ -261,7 +261,7 @@ const FrameSizeSettings = ({ engine }: ToolbarRegionProps) => {
* pixels instead of opening a layer session; the numerics meanwhile edit the
* settled selected layer, matching the Transform pane.
*/
-const TransformFooter = ({ engine, isExternalInteractionLocked }: ToolbarStatusProps) => {
+const TransformFooter = ({ engine, isExternalInteractionLocked }: ToolFooterProps) => {
const session = useTransformSession(engine);
const hasFloat = useCanvasHasFloatingSelection(engine);
// The root sticky footer sits OUTSIDE the inert tool section, so the
@@ -269,7 +269,7 @@ const TransformFooter = ({ engine, isExternalInteractionLocked }: ToolbarStatusP
const disabled = isExternalInteractionLocked || (!session && !hasFloat);
const onApply = useCallback(() => engine.layers.applyTransform(), [engine]);
const onCancel = useCallback(() => engine.layers.cancelTransform(), [engine]);
- return <ToolbarStatus applyDisabled={disabled} cancelDisabled={disabled} onApply={onApply} onCancel={onCancel} />;
+ return <ApplyCancelBar applyDisabled={disabled} cancelDisabled={disabled} onApply={onApply} onCancel={onCancel} />;
};
/** Shared literal: the same object in every geometry form, so the rows' DOM survives tool switches. */
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/hintForms.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/hintForms.tsx
index e55bfa44a8..35d434a43e 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/hintForms.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/hintForms.tsx
@@ -1,7 +1,4 @@
-import type {
- ToolbarRegionProps,
- ToolPropertyForm,
-} from '@workbench/widgets/canvas/tool-presentation/toolbarContracts';
+import type { ToolFormProps, ToolPropertyForm } from '@workbench/widgets/canvas/tool-presentation/toolFormContracts';
import { HintCard } from '@workbench/widgets/canvas/tool-presentation/PropertyPrimitives';
import { useMemo } from 'react';
@@ -12,7 +9,7 @@ import { useTranslation } from 'react-i18next';
* mirror what `pointerPipeline`/the tools actually do — hold-keys included —
* instead of the old single hint sentence.
*/
-const ViewHints = (_props: ToolbarRegionProps) => {
+const ViewHints = (_props: ToolFormProps) => {
const { t } = useTranslation();
const rows = useMemo(
() => [
@@ -25,7 +22,7 @@ const ViewHints = (_props: ToolbarRegionProps) => {
return <HintCard rows={rows} />;
};
-const ColorPickerHints = (_props: ToolbarRegionProps) => {
+const ColorPickerHints = (_props: ToolFormProps) => {
const { t } = useTranslation();
const rows = useMemo(
() => [
@@ -37,7 +34,7 @@ const ColorPickerHints = (_props: ToolbarRegionProps) => {
return <HintCard rows={rows} />;
};
-const SamToolHints = (_props: ToolbarRegionProps) => {
+const SamToolHints = (_props: ToolFormProps) => {
const { t } = useTranslation();
const rows = useMemo(
() => [
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/paintForm.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/paintForm.tsx
index f0907652df..6b0646f1d9 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/paintForm.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/paintForm.tsx
@@ -1,9 +1,9 @@
import type {
- ToolbarRegionProps,
- ToolbarStatusProps,
+ ToolFormProps,
+ ToolFooterProps,
ToolPropertyForm,
ToolPropertyGroup,
-} from '@workbench/widgets/canvas/tool-presentation/toolbarContracts';
+} from '@workbench/widgets/canvas/tool-presentation/toolFormContracts';
import { ColorPicker } from '@platform/ui/ColorPicker';
import { useActiveColorCommands, useActiveColorPair } from '@workbench/widgets/canvas/color-system/useActiveColors';
@@ -31,7 +31,7 @@ const ERASER_PREVIEW_COLOR = '#9aa2b1';
* switch, which is what makes the "stable geometry across related tools"
* invariant hold in the form world.
*/
-const usePaintOptions = (engine: ToolbarRegionProps['engine']) => {
+const usePaintOptions = (engine: ToolFormProps['engine']) => {
const activeTool = useCanvasActiveTool(engine);
const brush = useBrushOptions(engine);
const eraser = useEraserOptions(engine);
@@ -50,7 +50,7 @@ const usePaintOptions = (engine: ToolbarRegionProps['engine']) => {
return { isEraser, options, set };
};
-const PaintPreview = ({ engine }: ToolbarStatusProps) => {
+const PaintPreview = ({ engine }: ToolFooterProps) => {
const { isEraser, options } = usePaintOptions(engine);
const pair = useActiveColorPair();
return (
@@ -63,7 +63,7 @@ const PaintPreview = ({ engine }: ToolbarStatusProps) => {
);
};
-const PaintStrokeSettings = ({ engine }: ToolbarRegionProps) => {
+const PaintStrokeSettings = ({ engine }: ToolFormProps) => {
const { t } = useTranslation();
const { isEraser, options, set } = usePaintOptions(engine);
const setSize = useCallback((size: number) => set({ size: clampBrushSize(size) }), [set]);
@@ -89,7 +89,7 @@ const PaintStrokeSettings = ({ engine }: ToolbarRegionProps) => {
};
/** A mirror of the project foreground, not brush-owned state: the pair feeds the engine's brush color. */
-const PaintColorSettings = ({ engine }: ToolbarRegionProps) => {
+const PaintColorSettings = ({ engine }: ToolFormProps) => {
const { t } = useTranslation();
const pair = useActiveColorPair();
const { setPairColor } = useActiveColorCommands();
@@ -108,7 +108,7 @@ const PaintColorSettings = ({ engine }: ToolbarRegionProps) => {
};
/** Width and opacity are separate pressure responses (opacity also costs a scratch refill per frame). */
-const PaintDynamicsSettings = ({ engine }: ToolbarRegionProps) => {
+const PaintDynamicsSettings = ({ engine }: ToolFormProps) => {
const { t } = useTranslation();
const brush = useBrushOptions(engine);
const set = useCallback(
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/selectionForm.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/selectionForm.tsx
index 1857b2da97..7ba7f76650 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/selectionForm.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/selectionForm.tsx
@@ -1,9 +1,9 @@
import type { SelectionOp } from '@workbench/canvas-engine/api';
import type {
- ToolbarRegionProps,
+ ToolFormProps,
ToolPropertyForm,
ToolPropertyGroup,
-} from '@workbench/widgets/canvas/tool-presentation/toolbarContracts';
+} from '@workbench/widgets/canvas/tool-presentation/toolFormContracts';
import { Text } from '@chakra-ui/react';
import {
@@ -26,7 +26,7 @@ import { SelectionActions, SelectionOpModeButtons } from './SelectionOptionsRow'
* rectangle/ellipse), the op mode, and the command cluster. One component set
* reading the active tool, so the rows keep DOM identity lasso↔marquee.
*/
-const SelectionModeSettings = ({ engine, isSurfaceInteractionLocked }: ToolbarRegionProps) => {
+const SelectionModeSettings = ({ engine, isSurfaceInteractionLocked }: ToolFormProps) => {
const { t } = useTranslation();
const activeTool = useCanvasActiveTool(engine);
const isMarquee = activeTool === 'marquee';
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/ToolbarPrimitives.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/FormControls.tsx
similarity index 92%
rename from invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/ToolbarPrimitives.tsx
rename to invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/FormControls.tsx
index 81f1ce517e..5a3f4b9ff4 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/ToolbarPrimitives.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/FormControls.tsx
@@ -2,7 +2,7 @@
import type { NumberInput as ChakraNumberInput, SliderValueChangeDetails } from '@chakra-ui/react';
import type { KeyboardEvent, ReactNode } from 'react';
-import { Box, Flex, Icon, InputGroup, NumberInput, Text } from '@chakra-ui/react';
+import { Box, Flex, Icon, InputGroup, NumberInput } from '@chakra-ui/react';
import { Button } from '@platform/ui/Button';
import { Slider } from '@platform/ui/Slider';
import { MoveHorizontalIcon } from 'lucide-react';
@@ -10,9 +10,9 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
/** Width of every numeric field, so X / Y / W / H line up across tools; fits "-1234.56" beside its affixes. */
-const TOOLBAR_NUMBER_FIELD_WIDTH_PX = 80;
+const FORM_NUMBER_FIELD_WIDTH_PX = 80;
-interface ToolbarNumberFieldProps {
+interface FormNumberFieldProps {
'aria-label': string;
disabled?: boolean;
/** Short prefix drawn inside the field (X, Y, W, H); it doubles as the scrub handle. */
@@ -46,7 +46,7 @@ const END_ELEMENT_PROPS = { ...AFFIX_PROPS, pe: '1.5', pointerEvents: 'none' } a
* rounded display back over a precise value. Only the accepted value shows
* afterwards, so a clamped commit never leaves the field disagreeing with its owner.
*/
-export const ToolbarNumberField = ({
+export const FormNumberField = ({
'aria-label': ariaLabel,
disabled,
label,
@@ -57,7 +57,7 @@ export const ToolbarNumberField = ({
value,
onValueChange,
onValueCommit,
-}: ToolbarNumberFieldProps) => {
+}: FormNumberFieldProps) => {
const [draft, setDraft] = useState<string | null>(null);
const draftRef = useRef<string | null>(null);
const scrubEnd = useRef<(() => void) | null>(null);
@@ -108,7 +108,7 @@ export const ToolbarNumberField = ({
size="xs"
step={step}
value={live ? value : (draft ?? value)}
- w={`${TOOLBAR_NUMBER_FIELD_WIDTH_PX}px`}
+ w={`${FORM_NUMBER_FIELD_WIDTH_PX}px`}
onValueChange={live ? onValueChange : onDraftChange}
onValueCommit={live ? undefined : onDraftCommit}
>
@@ -141,7 +141,7 @@ export const useNumberCommit = (apply: (value: number) => void) =>
[apply]
);
-interface ToolbarSliderProps {
+interface FormSliderProps {
'aria-label': string;
disabled?: boolean;
formatValue?: (value: number) => string;
@@ -156,8 +156,8 @@ interface ToolbarSliderProps {
onValueChangeEnd?: (value: number) => void;
}
-/** A slider that fills its region; pairs with a {@link ToolbarNumberField}. */
-export const ToolbarSlider = ({
+/** A slider that fills its region; pairs with a {@link FormNumberField}. */
+export const FormSlider = ({
'aria-label': ariaLabel,
disabled,
formatValue,
@@ -169,7 +169,7 @@ export const ToolbarSlider = ({
onKeyDownCapture,
onValueChange,
onValueChangeEnd,
-}: ToolbarSliderProps) => {
+}: FormSliderProps) => {
const labels = useMemo(() => [ariaLabel], [ariaLabel]);
const values = useMemo(() => [value], [value]);
const valueText = useMemo(
@@ -252,7 +252,7 @@ export const useSliderGesture = (
};
/** Apply and Cancel for a pending operation, session or float, after whatever the owner shows about it. */
-export const ToolbarStatus = ({
+export const ApplyCancelBar = ({
applyDisabled = true,
applyLoading = false,
cancelDisabled = true,
@@ -274,7 +274,7 @@ export const ToolbarStatus = ({
{children}
</Box>
<Button
- data-toolbar-action="apply"
+ data-pane-action="apply"
disabled={applyDisabled}
flexShrink={0}
loading={applyLoading}
@@ -285,7 +285,7 @@ export const ToolbarStatus = ({
{t('common.apply')}
</Button>
<Button
- data-toolbar-action="cancel"
+ data-pane-action="cancel"
disabled={cancelDisabled}
flexShrink={0}
size="xs"
@@ -297,10 +297,3 @@ export const ToolbarStatus = ({
</Flex>
);
};
-
-/** Muted guidance for tools and states without a control to show. */
-export const ToolbarHint = ({ children }: { children: string }) => (
- <Text color="fg.muted" data-toolbar-hint="" fontSize="xs" minW="0">
- {children}
- </Text>
-);
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/toolAdapters.test.ts b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/toolAdapters.test.ts
index ea2d8bd634..c8967c7aec 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/toolAdapters.test.ts
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/toolAdapters.test.ts
@@ -2,13 +2,7 @@ import type { ToolId } from '@workbench/canvas-engine/api';
import { describe, expect, it } from 'vitest';
-import {
- hasToolControls,
- isOperationPropertyForm,
- isToolPropertyForm,
- OPERATION_PRESENTATION_ADAPTERS,
- TOOL_PRESENTATION_ADAPTERS,
-} from './toolAdapters';
+import { OPERATION_PRESENTATION_ADAPTERS, TOOL_PRESENTATION_ADAPTERS } from './toolAdapters';
const TOOL_IDS = Object.keys({
bbox: true,
@@ -48,9 +42,9 @@ describe('tool presentation adapters', () => {
}
});
- it('gives every tool controls or gesture cards; the bare-hint fallback is dead', () => {
+ it('gives every tool a form with at least one group', () => {
for (const toolId of TOOL_IDS) {
- expect(hasToolControls(TOOL_PRESENTATION_ADAPTERS[toolId]), toolId).toBe(true);
+ expect(TOOL_PRESENTATION_ADAPTERS[toolId].groups.length, toolId).toBeGreaterThan(0);
}
});
@@ -59,9 +53,6 @@ describe('tool presentation adapters', () => {
key.split('.').reduce<unknown>((node, part) => (node as Record<string, unknown> | undefined)?.[part], en);
for (const toolId of TOOL_IDS) {
const adapter = TOOL_PRESENTATION_ADAPTERS[toolId];
- if (!isToolPropertyForm(adapter)) {
- continue;
- }
const ids = adapter.groups.map((group) => group.id);
expect(new Set(ids).size, toolId).toBe(ids.length);
for (const group of adapter.groups) {
@@ -70,24 +61,16 @@ describe('tool presentation adapters', () => {
}
});
- it('names every Properties row and section in the catalog', () => {
- for (const row of ['geometry', 'intensity', 'color', 'modes', 'more']) {
- expect(en.widgets.properties.rows[row], row).toEqual(expect.any(String));
- }
+ it('names the Properties sections in the catalog', () => {
expect(en.widgets.properties.sections.tool).toEqual(expect.any(String));
expect(en.widgets.properties.sections.operation).toEqual(expect.any(String));
});
- it('gives every guarded operation a verbs slot so Apply and Cancel stay in place', () => {
+ it('gives every guarded operation groups and a footer so Apply and Cancel stay in place', () => {
expect(Object.keys(OPERATION_PRESENTATION_ADAPTERS).sort()).toEqual(['filter', 'select-object']);
for (const adapter of Object.values(OPERATION_PRESENTATION_ADAPTERS)) {
- if (isOperationPropertyForm(adapter)) {
- expect(adapter.footer).toBeDefined();
- expect(adapter.groups.length).toBeGreaterThan(0);
- } else {
- expect(adapter.status).toBeDefined();
- expect(adapter.modes).toBeDefined();
- }
+ expect(adapter.footer).toBeDefined();
+ expect(adapter.groups.length).toBeGreaterThan(0);
}
});
});
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/toolAdapters.ts b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/toolAdapters.ts
index 8a91fc270c..486ce951a7 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/toolAdapters.ts
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/toolAdapters.ts
@@ -10,16 +10,9 @@ import { lassoForm, marqueeForm } from '@workbench/widgets/canvas/tool-options/s
import { shapeForm } from '@workbench/widgets/canvas/tool-options/ShapeOptions';
import { textForm } from '@workbench/widgets/canvas/tool-options/TextOptions';
-import type {
- CanvasOperationKind,
- OperationPanePresentation,
- ToolPanePresentation,
- ToolPresentationAdapter,
-} from './toolbarContracts';
+import type { CanvasOperationKind, OperationPropertyForm, ToolPropertyForm } from './toolFormContracts';
-import { isOperationPropertyForm, isToolPropertyForm } from './toolbarContracts';
-
-export const TOOL_PRESENTATION_ADAPTERS: Readonly<Record<ToolId, ToolPanePresentation>> = {
+export const TOOL_PRESENTATION_ADAPTERS: Readonly<Record<ToolId, ToolPropertyForm>> = {
bbox: bboxForm,
brush: brushForm,
colorPicker: colorPickerForm,
@@ -35,16 +28,7 @@ export const TOOL_PRESENTATION_ADAPTERS: Readonly<Record<ToolId, ToolPanePresent
view: viewForm,
};
-export const OPERATION_PRESENTATION_ADAPTERS: Readonly<Record<CanvasOperationKind, OperationPanePresentation>> = {
+export const OPERATION_PRESENTATION_ADAPTERS: Readonly<Record<CanvasOperationKind, OperationPropertyForm>> = {
filter: filterOperationForm,
'select-object': selectObjectOperationForm,
};
-
-export const hasToolRegions = (adapter: ToolPresentationAdapter): boolean =>
- !!(adapter.geometry || adapter.intensity || adapter.color || adapter.modes || adapter.more || adapter.status);
-
-/** Whether the pane has anything to render for the tool beyond its name and hint. */
-export const hasToolControls = (adapter: ToolPanePresentation): boolean =>
- isToolPropertyForm(adapter) ? adapter.groups.length > 0 : hasToolRegions(adapter);
-
-export { isOperationPropertyForm, isToolPropertyForm };
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/toolbarContracts.ts b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/toolFormContracts.ts
similarity index 50%
rename from invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/toolbarContracts.ts
rename to invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/toolFormContracts.ts
index d077e4162e..2b8f407dd9 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/toolbarContracts.ts
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/toolFormContracts.ts
@@ -10,48 +10,21 @@ export type CanvasToolOptionsEngine = Pick<
export type CanvasOperationKind = Extract<CanvasOperationState, { status: 'active' }>['identity']['kind'];
-export type ToolbarRegionId = 'geometry' | 'intensity' | 'color' | 'modes';
-
-export interface ToolbarRegionProps {
+export interface ToolFormProps {
engine: CanvasToolOptionsEngine;
/** Staging or generation owns the surface: mutating controls disable, Cancel stays. */
isSurfaceInteractionLocked: boolean;
}
-export interface ToolbarStatusProps {
+export interface ToolFooterProps {
engine: CanvasToolOptionsEngine;
isExternalInteractionLocked: boolean;
}
-export type ToolbarRegionComponent = ComponentType<ToolbarRegionProps>;
-
-/**
- * One tool's presentation: a component per region of its settings (geometry,
- * intensity, color, modes, and what only the full form shows), rendered by the
- * Properties widget. The adapter is a presentation seam over the engine's
- * option stores and document transactions; it owns no state.
- */
-export interface ToolPresentationAdapter {
- id: ToolId;
- /** Paints into one leaf: a selected group gets the "select a layer" notice instead of strokes. */
- paintsLeaf?: boolean;
- /** Translation keys naming the rows where the generic region name would mislead (brush "Size", not "Geometry"). */
- rowLabels?: Partial<Record<ToolbarRegionId | 'more', string>>;
- geometry?: ToolbarRegionComponent;
- intensity?: ToolbarRegionComponent;
- color?: ToolbarRegionComponent;
- modes?: ToolbarRegionComponent;
- more?: ToolbarRegionComponent;
- status?: ComponentType<ToolbarStatusProps>;
-}
+/** Preview cards take the footer's props: the engine plus the surface lock. */
+export type ToolPreviewProps = ToolFooterProps;
-/** A guarded operation's presentation: its inputs, its secondary controls and its status with Apply / Cancel. */
-export interface OperationPresentationAdapter {
- kind: CanvasOperationKind;
- modes?: ToolbarRegionComponent;
- more?: ToolbarRegionComponent;
- status: ComponentType<ToolbarStatusProps>;
-}
+export type ToolFormComponent = ComponentType<ToolFormProps>;
/**
* One named group of a tool's property form. Group ids are GLOBAL keys: shared
@@ -64,7 +37,7 @@ export interface ToolPropertyGroup {
labelKey: string;
/** Present makes the header a disclosure; the value is the default state. */
collapsible?: 'open' | 'collapsed';
- body: ToolbarRegionComponent;
+ body: ToolFormComponent;
}
/**
@@ -76,25 +49,16 @@ export interface ToolPropertyForm {
id: ToolId;
/** Paints into one leaf: a selected group gets the "select a layer" notice instead of strokes. */
paintsLeaf?: boolean;
- preview?: ComponentType<ToolbarStatusProps>;
+ preview?: ComponentType<ToolPreviewProps>;
groups: readonly ToolPropertyGroup[];
/** Sticks to the pane's bottom edge while the form scrolls: session status, Apply, Cancel. */
- footer?: ComponentType<ToolbarStatusProps>;
+ footer?: ComponentType<ToolFooterProps>;
}
-export type ToolPanePresentation = ToolPresentationAdapter | ToolPropertyForm;
-
-export const isToolPropertyForm = (adapter: ToolPanePresentation): adapter is ToolPropertyForm => 'groups' in adapter;
-
/** A guarded operation's pane form: named groups plus the sticky footer that owns its verbs. */
export interface OperationPropertyForm {
kind: CanvasOperationKind;
groups: readonly ToolPropertyGroup[];
/** Status chip, Process/Reset, Apply and Cancel; pinned to the pane's bottom edge. */
- footer: ComponentType<ToolbarStatusProps>;
+ footer: ComponentType<ToolFooterProps>;
}
-
-export type OperationPanePresentation = OperationPresentationAdapter | OperationPropertyForm;
-
-export const isOperationPropertyForm = (adapter: OperationPanePresentation): adapter is OperationPropertyForm =>
- 'groups' in adapter;
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/ColorPane.tsx b/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/ColorPane.tsx
index be83890552..e5b57f98e8 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/ColorPane.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/ColorPane.tsx
@@ -26,7 +26,7 @@ import {
useActiveColorTarget,
} from '@workbench/widgets/canvas/color-system/useActiveColors';
import { useMaskTintEditor, type MaskTintEditor } from '@workbench/widgets/canvas/color-system/useMaskTintEditor';
-import { ToolbarNumberField } from '@workbench/widgets/canvas/tool-presentation/ToolbarPrimitives';
+import { FormNumberField } from '@workbench/widgets/canvas/tool-presentation/FormControls';
import { useCanvasEngine } from '@workbench/widgets/canvas/useCanvasEngine';
import { useActiveProjectSelector } from '@workbench/WorkbenchContext';
import { ArrowLeftRightIcon, CircleIcon, PipetteIcon, RotateCcwIcon, SquareIcon } from 'lucide-react';
@@ -428,9 +428,7 @@ const ChannelNumber = ({
},
[index, onCommit]
);
- return (
- <ToolbarNumberField aria-label={label} label={label.slice(0, 1)} value={String(value)} onValueCommit={commit} />
- );
+ return <FormNumberField aria-label={label} label={label.slice(0, 1)} value={String(value)} onValueCommit={commit} />;
};
const HexField = ({ hex, onCommit }: { hex: string; onCommit: (hex: string) => void }) => {
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/PropertiesPane.tsx b/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/PropertiesPane.tsx
index e81e8e7567..a3b0c40db2 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/PropertiesPane.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/PropertiesPane.tsx
@@ -1,12 +1,9 @@
-import { Flex, Stack, Text } from '@chakra-ui/react';
+import { Flex, Stack } from '@chakra-ui/react';
import { Scrollable } from '@platform/ui/Scrollable';
import { isCanvasInteractionLocked } from '@workbench/widgets/canvas/canvasInteractionLock';
import { useCanvasActiveTool, useCanvasOperation } from '@workbench/widgets/canvas/engineStoreHooks';
import { PropertyGroup } from '@workbench/widgets/canvas/tool-presentation/PropertyPrimitives';
import {
- hasToolRegions,
- isOperationPropertyForm,
- isToolPropertyForm,
OPERATION_PRESENTATION_ADAPTERS,
TOOL_PRESENTATION_ADAPTERS,
} from '@workbench/widgets/canvas/tool-presentation/toolAdapters';
@@ -17,19 +14,11 @@ import { useTranslation } from 'react-i18next';
import { GroupSelectedNotice } from './GroupSelectedNotice';
import { LayerSection } from './LayerSection';
-import { PropertiesRow, PropertiesSection } from './PropertiesSection';
-
-const REGION_LABEL_KEYS = {
- color: 'widgets.properties.rows.color',
- geometry: 'widgets.properties.rows.geometry',
- intensity: 'widgets.properties.rows.intensity',
- modes: 'widgets.properties.rows.modes',
- more: 'widgets.properties.rows.more',
-} as const;
+import { PropertiesSection } from './PropertiesSection';
/**
* Full editors for what the canvas is doing: the running operation first, then
- * the active tool's settings. Reads and writes the engine's option stores and
+ * the active tool's form. Reads and writes the engine's option stores and
* document transactions through the same adapters the canvas registers; it
* mirrors no state of its own.
*/
@@ -66,34 +55,20 @@ const ConnectedProperties = ({
const activeTool = useCanvasActiveTool(engine);
const operation = useCanvasOperation(engine);
const running = operation.status === 'active' ? OPERATION_PRESENTATION_ADAPTERS[operation.identity.kind] : null;
- const runningForm = running && isOperationPropertyForm(running) ? running : null;
- const runningLegacy = running && !isOperationPropertyForm(running) ? running : null;
const tool = TOOL_PRESENTATION_ADAPTERS[activeTool];
const toolName = t(`widgets.canvas.tools.${tool.id}`);
- const form = isToolPropertyForm(tool) ? tool : null;
- const legacy = isToolPropertyForm(tool) ? null : tool;
- const ToolStatus = legacy?.status;
- const Preview = form?.preview;
+ const Preview = tool.preview;
+ const regionProps = { engine, isSurfaceInteractionLocked };
// The pane has ONE sticky footer: a running operation's, else the tool
// form's; the operation always wins because the tool section is inert then.
- const Footer = runningForm ? runningForm.footer : running ? null : form?.footer;
- const regionProps = { engine, isSurfaceInteractionLocked };
- const rows = (
- [
- ['geometry', legacy?.geometry],
- ['intensity', legacy?.intensity],
- ['modes', legacy?.modes],
- ['color', legacy?.color],
- ['more', legacy?.more],
- ] as const
- ).filter((entry): entry is [keyof typeof REGION_LABEL_KEYS, NonNullable<(typeof entry)[1]>] => !!entry[1]);
+ const Footer = running ? running.footer : tool.footer;
// `inert` will blur a focused tool control once an operation starts; hand focus to the operation's Cancel first.
const root = useRef<HTMLDivElement>(null);
const toolSection = useRef<HTMLDivElement>(null);
useLayoutEffect(() => {
if (running && toolSection.current?.contains(document.activeElement)) {
- root.current?.querySelector<HTMLElement>('[data-toolbar-action="cancel"]')?.focus();
+ root.current?.querySelector<HTMLElement>('[data-pane-action="cancel"]')?.focus();
}
}, [running]);
@@ -106,18 +81,11 @@ const ConnectedProperties = ({
)}
title={t('widgets.properties.sections.operation')}
>
- {runningForm
- ? runningForm.groups.map((group) => (
- <PropertyGroup key={group.id} collapsible={group.collapsible} id={group.id} label={t(group.labelKey)}>
- <group.body {...regionProps} />
- </PropertyGroup>
- ))
- : null}
- {runningLegacy?.modes ? <runningLegacy.modes {...regionProps} /> : null}
- {runningLegacy?.more ? <runningLegacy.more {...regionProps} /> : null}
- {runningLegacy ? (
- <runningLegacy.status engine={engine} isExternalInteractionLocked={isSurfaceInteractionLocked} />
- ) : null}
+ {running.groups.map((group) => (
+ <PropertyGroup key={group.id} collapsible={group.collapsible} id={group.id} label={t(group.labelKey)}>
+ <group.body {...regionProps} />
+ </PropertyGroup>
+ ))}
</PropertiesSection>
) : null}
<PropertiesSection
@@ -127,32 +95,14 @@ const ConnectedProperties = ({
title={t('widgets.properties.sections.tool')}
>
{tool.paintsLeaf && !running ? <GroupSelectedNotice /> : null}
- {form ? (
- <>
- {Preview ? <Preview engine={engine} isExternalInteractionLocked={isSurfaceInteractionLocked} /> : null}
- {form.groups.map((group) => (
- // Keyed by GROUP id, not tool id: tools sharing a group keep its
- // DOM (and collapse state) alive across the tool switch.
- <PropertyGroup key={group.id} collapsible={group.collapsible} id={group.id} label={t(group.labelKey)}>
- <group.body {...regionProps} />
- </PropertyGroup>
- ))}
- </>
- ) : legacy && hasToolRegions(legacy) ? (
- rows.map(([region, Region]) => (
- <PropertiesRow
- key={`${legacy.id}:${region}`}
- label={t(legacy.rowLabels?.[region] ?? REGION_LABEL_KEYS[region])}
- >
- <Region {...regionProps} />
- </PropertiesRow>
- ))
- ) : (
- <Text color="fg.muted" fontSize="xs">
- {t(`widgets.canvas.toolHints.${tool.id}`)}
- </Text>
- )}
- {ToolStatus ? <ToolStatus engine={engine} isExternalInteractionLocked={isSurfaceInteractionLocked} /> : null}
+ {Preview ? <Preview engine={engine} isExternalInteractionLocked={isSurfaceInteractionLocked} /> : null}
+ {tool.groups.map((group) => (
+ // Keyed by GROUP id, not tool id: tools sharing a group keep its
+ // DOM (and collapse state) alive across the tool switch.
+ <PropertyGroup key={group.id} collapsible={group.collapsible} id={group.id} label={t(group.labelKey)}>
+ <group.body {...regionProps} />
+ </PropertyGroup>
+ ))}
</PropertiesSection>
<LayerSection disabled={isSurfaceInteractionLocked || running !== null} />
{Footer ? (
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/PropertiesSection.tsx b/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/PropertiesSection.tsx
index e7e129de82..3d9b1ab8c3 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/PropertiesSection.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/PropertiesSection.tsx
@@ -43,17 +43,3 @@ export const PropertiesSection = ({
</Stack>
);
};
-
-/** One labelled row: a fixed label column and the controls packed after it, wrapping when the pane is narrow. */
-export const PropertiesRow = ({ children, label }: { children: ReactNode; label: string }) => (
- <Flex align="flex-start" gap="2" minW="0">
- <Flex align="center" flexShrink={0} minH="8" w="20">
- <Text color="fg.muted" fontSize="xs">
- {label}
- </Text>
- </Flex>
- <Flex align="center" flex="1" flexWrap="wrap" gap="2" minH="8" minW="0">
- {children}
- </Flex>
- </Flex>
-);
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/TransformPane.tsx b/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/TransformPane.tsx
index 3326d6b604..bfede2167d 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/TransformPane.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/TransformPane.tsx
@@ -6,7 +6,8 @@ import { Scrollable } from '@platform/ui/Scrollable';
import { getDocumentNode, lookupDocumentLeaf } from '@workbench/canvas-engine/api';
import { useCanvasHasFloatingSelection, useTransformSession } from '@workbench/widgets/canvas/engineStoreHooks';
import { clampScalePercent, round2, wrapDegrees } from '@workbench/widgets/canvas/tool-options/geometryForm';
-import { ToolbarNumberField, useNumberCommit } from '@workbench/widgets/canvas/tool-presentation/ToolbarPrimitives';
+import { FormNumberField, useNumberCommit } from '@workbench/widgets/canvas/tool-presentation/FormControls';
+import { PropertyControlRow } from '@workbench/widgets/canvas/tool-presentation/PropertyPrimitives';
import { useCanvasEngine, type CanvasEngineHandle } from '@workbench/widgets/canvas/useCanvasEngine';
import { usePreparedCommit } from '@workbench/widgets/canvas/useStructuralCommit';
import { useActiveProjectSelector } from '@workbench/WorkbenchContext';
@@ -14,7 +15,7 @@ import { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { GroupSelectedNotice } from './GroupSelectedNotice';
-import { PropertiesRow, PropertiesSection } from './PropertiesSection';
+import { PropertiesSection } from './PropertiesSection';
const RAD_TO_DEG = 180 / Math.PI;
const DEG_TO_RAD = Math.PI / 180;
@@ -109,8 +110,8 @@ const ConnectedTransform = ({ engine }: { engine: CanvasEngineHandle }) => {
const onApply = useCallback(() => engine.layers.applyTransform(), [engine]);
const onCancel = useCallback(() => engine.layers.cancelTransform(), [engine]);
const pending = session !== null || hasFloat;
- const field = (props: Omit<Parameters<typeof ToolbarNumberField>[0], 'disabled'>) => (
- <ToolbarNumberField {...props} disabled={!editable} />
+ const field = (props: Omit<Parameters<typeof FormNumberField>[0], 'disabled'>) => (
+ <FormNumberField {...props} disabled={!editable} />
);
return (
@@ -122,44 +123,48 @@ const ConnectedTransform = ({ engine }: { engine: CanvasEngineHandle }) => {
title={t('widgets.transform.title')}
>
{selected?.isGroup && !session ? <GroupSelectedNotice hint={t('widgets.transform.groupSelected')} /> : null}
- <PropertiesRow label={t('widgets.transform.position')}>
- {field({
- 'aria-label': t('widgets.canvas.toolOptions.positionX'),
- label: t('widgets.canvas.toolOptions.positionX'),
- value: transform ? String(Math.round(transform.x)) : '',
- onValueCommit: onX,
- })}
- {field({
- 'aria-label': t('widgets.canvas.toolOptions.positionY'),
- label: t('widgets.canvas.toolOptions.positionY'),
- value: transform ? String(Math.round(transform.y)) : '',
- onValueCommit: onY,
- })}
- </PropertiesRow>
- <PropertiesRow label={t('widgets.transform.scale')}>
- {field({
- 'aria-label': t('widgets.canvas.toolOptions.scaleWidth'),
- label: t('widgets.canvas.toolOptions.frameWidth'),
- suffix: '%',
- value: transform ? String(round2(transform.scaleX * 100)) : '',
- onValueCommit: onScaleX,
- })}
- {field({
- 'aria-label': t('widgets.canvas.toolOptions.scaleHeight'),
- label: t('widgets.canvas.toolOptions.frameHeight'),
- suffix: '%',
- value: transform ? String(round2(transform.scaleY * 100)) : '',
- onValueCommit: onScaleY,
- })}
- </PropertiesRow>
- <PropertiesRow label={t('widgets.transform.rotation')}>
+ <PropertyControlRow label={t('widgets.transform.position')}>
+ <Flex gap="2" gridColumn="2 / -1">
+ {field({
+ 'aria-label': t('widgets.canvas.toolOptions.positionX'),
+ label: t('widgets.canvas.toolOptions.positionX'),
+ value: transform ? String(Math.round(transform.x)) : '',
+ onValueCommit: onX,
+ })}
+ {field({
+ 'aria-label': t('widgets.canvas.toolOptions.positionY'),
+ label: t('widgets.canvas.toolOptions.positionY'),
+ value: transform ? String(Math.round(transform.y)) : '',
+ onValueCommit: onY,
+ })}
+ </Flex>
+ </PropertyControlRow>
+ <PropertyControlRow label={t('widgets.transform.scale')}>
+ <Flex gap="2" gridColumn="2 / -1">
+ {field({
+ 'aria-label': t('widgets.canvas.toolOptions.scaleWidth'),
+ label: t('widgets.canvas.toolOptions.frameWidth'),
+ suffix: '%',
+ value: transform ? String(round2(transform.scaleX * 100)) : '',
+ onValueCommit: onScaleX,
+ })}
+ {field({
+ 'aria-label': t('widgets.canvas.toolOptions.scaleHeight'),
+ label: t('widgets.canvas.toolOptions.frameHeight'),
+ suffix: '%',
+ value: transform ? String(round2(transform.scaleY * 100)) : '',
+ onValueCommit: onScaleY,
+ })}
+ </Flex>
+ </PropertyControlRow>
+ <PropertyControlRow label={t('widgets.transform.rotation')}>
{field({
'aria-label': t('widgets.canvas.toolOptions.rotation'),
suffix: '°',
value: transform ? String(round2(wrapDegrees(transform.rotation * RAD_TO_DEG))) : '',
onValueCommit: onRotation,
})}
- </PropertiesRow>
+ </PropertyControlRow>
{pending ? (
<Flex gap="2" justify="flex-end">
<Button size="xs" variant="ghost" onClick={onCancel}>