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.

feat(properties): tool property forms replace toolbar regions (U0)

Josh Corbettdded5907139b
diff --git a/invokeai/frontend/webv2/performance/browser-baseline.json b/invokeai/frontend/webv2/performance/browser-baseline.json
index 7beef71f5a..f046bd57d2 100644
--- a/invokeai/frontend/webv2/performance/browser-baseline.json
+++ b/invokeai/frontend/webv2/performance/browser-baseline.json
@@ -25,13 +25,13 @@
"scriptRequestCount": 0,
"totalRawBytes": 0
},
- "domContentLoadedMedianMs": 117,
+ "domContentLoadedMedianMs": 113,
"id": "launchpad",
"layoutAckMedianMs": 0,
"layoutReturnSwitchMedianMs": 0,
"layoutSwitchMedianMs": 0,
- "loadMedianMs": 117,
- "longestTaskMaxMs": 71,
+ "loadMedianMs": 113.1000000089407,
+ "longestTaskMaxMs": 67,
"owner": "app",
"projectSwitchMedianMs": 0,
"readyMark": "invokeai:ready:launchpad",
@@ -41,24 +41,24 @@
"fontRawBytes": 23664,
"imageRawBytes": 0,
"largestAssetRawBytes": 746376,
- "otherRawBytes": 160995,
+ "otherRawBytes": 161115,
"requestCount": 38,
- "scriptRawBytes": 1636430,
+ "scriptRawBytes": 1636198,
"scriptRequestCount": 34,
- "totalRawBytes": 1823248
+ "totalRawBytes": 1823136
},
"resourceLimits": {
"cssRawBytes": 2181,
"fontRawBytes": 23901,
"imageRawBytes": 0,
"largestAssetRawBytes": 753840,
- "otherRawBytes": 162605,
+ "otherRawBytes": 162727,
"requestCount": 38,
- "scriptRawBytes": 1652795,
+ "scriptRawBytes": 1652560,
"scriptRequestCount": 34,
- "totalRawBytes": 1841481
+ "totalRawBytes": 1841368
},
- "routeReadyMedianMs": 263.6000000089407,
+ "routeReadyMedianMs": 252.40000000596046,
"scriptSourceOwnerSet": "launchpad-static",
"stateProfile": "empty"
},
@@ -85,13 +85,13 @@
"scriptRequestCount": 0,
"totalRawBytes": 0
},
- "domContentLoadedMedianMs": 118.90000000596046,
+ "domContentLoadedMedianMs": 115.20000000298023,
"id": "launchpad",
"layoutAckMedianMs": 0,
"layoutReturnSwitchMedianMs": 0,
"layoutSwitchMedianMs": 0,
- "loadMedianMs": 119.1000000089407,
- "longestTaskMaxMs": 70,
+ "loadMedianMs": 115.3999999910593,
+ "longestTaskMaxMs": 68,
"owner": "app",
"projectSwitchMedianMs": 0,
"readyMark": "invokeai:ready:launchpad",
@@ -101,24 +101,24 @@
"fontRawBytes": 23664,
"imageRawBytes": 0,
"largestAssetRawBytes": 746376,
- "otherRawBytes": 160995,
+ "otherRawBytes": 161115,
"requestCount": 38,
- "scriptRawBytes": 1636430,
+ "scriptRawBytes": 1636198,
"scriptRequestCount": 34,
- "totalRawBytes": 1823248
+ "totalRawBytes": 1823136
},
"resourceLimits": {
"cssRawBytes": 2181,
"fontRawBytes": 23901,
"imageRawBytes": 0,
"largestAssetRawBytes": 753840,
- "otherRawBytes": 162605,
+ "otherRawBytes": 162727,
"requestCount": 38,
- "scriptRawBytes": 1652795,
+ "scriptRawBytes": 1652560,
"scriptRequestCount": 34,
- "totalRawBytes": 1841481
+ "totalRawBytes": 1841368
},
- "routeReadyMedianMs": 281.1000000089407,
+ "routeReadyMedianMs": 274.29999999701977,
"scriptSourceOwnerSet": "launchpad-static",
"stateProfile": "representative"
},
@@ -145,15 +145,15 @@
"scriptRequestCount": 0,
"totalRawBytes": 0
},
- "domContentLoadedMedianMs": 121.09999999403954,
+ "domContentLoadedMedianMs": 118,
"id": "editor-minimal",
"layoutAckMedianMs": 0,
"layoutReturnSwitchMedianMs": 0,
"layoutSwitchMedianMs": 0,
- "loadMedianMs": 121.29999999701977,
- "longestTaskMaxMs": 99,
+ "loadMedianMs": 118.20000000298023,
+ "longestTaskMaxMs": 96,
"owner": "workbench",
- "projectSwitchMedianMs": 37.70000000298023,
+ "projectSwitchMedianMs": 34,
"readyMark": "invokeai:ready:widget:center:preview",
"remediationTicket": "deepen-widget-registry-loading",
"resourceBaseline": {
@@ -161,24 +161,24 @@
"fontRawBytes": 23664,
"imageRawBytes": 156376,
"largestAssetRawBytes": 746376,
- "otherRawBytes": 160995,
+ "otherRawBytes": 161115,
"requestCount": 115,
- "scriptRawBytes": 3286728,
+ "scriptRawBytes": 3286480,
"scriptRequestCount": 110,
- "totalRawBytes": 3629922
+ "totalRawBytes": 3629794
},
"resourceLimits": {
"cssRawBytes": 2181,
"fontRawBytes": 23901,
"imageRawBytes": 157940,
"largestAssetRawBytes": 753840,
- "otherRawBytes": 162605,
+ "otherRawBytes": 162727,
"requestCount": 115,
- "scriptRawBytes": 3319596,
+ "scriptRawBytes": 3319345,
"scriptRequestCount": 110,
- "totalRawBytes": 3666222
+ "totalRawBytes": 3666092
},
- "routeReadyMedianMs": 677.5999999940395,
+ "routeReadyMedianMs": 666.8000000119209,
"scriptSourceOwnerSet": "editor-minimal-static",
"stateProfile": "empty"
},
@@ -205,15 +205,15 @@
"scriptRequestCount": 0,
"totalRawBytes": 0
},
- "domContentLoadedMedianMs": 118,
+ "domContentLoadedMedianMs": 117.20000000298023,
"id": "editor-minimal",
"layoutAckMedianMs": 0,
"layoutReturnSwitchMedianMs": 0,
"layoutSwitchMedianMs": 0,
- "loadMedianMs": 118.09999999403954,
- "longestTaskMaxMs": 184,
+ "loadMedianMs": 117.30000001192093,
+ "longestTaskMaxMs": 176,
"owner": "workbench",
- "projectSwitchMedianMs": 71,
+ "projectSwitchMedianMs": 67.29999999701977,
"readyMark": "invokeai:ready:widget:center:preview",
"remediationTicket": "deepen-widget-registry-loading",
"resourceBaseline": {
@@ -221,24 +221,24 @@
"fontRawBytes": 23664,
"imageRawBytes": 156376,
"largestAssetRawBytes": 746376,
- "otherRawBytes": 160995,
+ "otherRawBytes": 161115,
"requestCount": 115,
- "scriptRawBytes": 3286728,
+ "scriptRawBytes": 3286480,
"scriptRequestCount": 110,
- "totalRawBytes": 3629922
+ "totalRawBytes": 3629794
},
"resourceLimits": {
"cssRawBytes": 2181,
"fontRawBytes": 23901,
"imageRawBytes": 157940,
"largestAssetRawBytes": 753840,
- "otherRawBytes": 162605,
+ "otherRawBytes": 162727,
"requestCount": 115,
- "scriptRawBytes": 3319596,
+ "scriptRawBytes": 3319345,
"scriptRequestCount": 110,
- "totalRawBytes": 3666222
+ "totalRawBytes": 3666092
},
- "routeReadyMedianMs": 450.19999998807907,
+ "routeReadyMedianMs": 433,
"scriptSourceOwnerSet": "editor-minimal-static",
"stateProfile": "representative"
},
@@ -247,31 +247,31 @@
"cssRawBytes": 0,
"fontRawBytes": 0,
"imageRawBytes": 0,
- "largestAssetRawBytes": 298823,
+ "largestAssetRawBytes": 301354,
"otherRawBytes": 0,
"requestCount": 7,
- "scriptRawBytes": 458453,
+ "scriptRawBytes": 460979,
"scriptRequestCount": 7,
- "totalRawBytes": 458453
+ "totalRawBytes": 460979
},
"activatedResourceLimits": {
"cssRawBytes": 0,
"fontRawBytes": 0,
"imageRawBytes": 0,
- "largestAssetRawBytes": 301812,
+ "largestAssetRawBytes": 304368,
"otherRawBytes": 0,
"requestCount": 7,
- "scriptRawBytes": 463038,
+ "scriptRawBytes": 465589,
"scriptRequestCount": 7,
- "totalRawBytes": 463038
+ "totalRawBytes": 465589
},
- "domContentLoadedMedianMs": 119.5,
+ "domContentLoadedMedianMs": 114.5,
"id": "editor-canvas",
- "layoutAckMedianMs": 2.199999988079071,
- "layoutReturnSwitchMedianMs": 55.69999998807907,
- "layoutSwitchMedianMs": 95.40000000596046,
- "loadMedianMs": 119.6000000089407,
- "longestTaskMaxMs": 127,
+ "layoutAckMedianMs": 2.6000000089406967,
+ "layoutReturnSwitchMedianMs": 53.79999999701977,
+ "layoutSwitchMedianMs": 94.90000000596046,
+ "loadMedianMs": 114.5,
+ "longestTaskMaxMs": 119,
"owner": "canvas",
"projectSwitchMedianMs": 0,
"readyMark": "invokeai:ready:widget:center:canvas",
@@ -281,24 +281,24 @@
"fontRawBytes": 23664,
"imageRawBytes": 156376,
"largestAssetRawBytes": 746376,
- "otherRawBytes": 160995,
+ "otherRawBytes": 161115,
"requestCount": 122,
- "scriptRawBytes": 3745181,
+ "scriptRawBytes": 3747459,
"scriptRequestCount": 117,
- "totalRawBytes": 4088375
+ "totalRawBytes": 4090773
},
"resourceLimits": {
"cssRawBytes": 2181,
"fontRawBytes": 23901,
"imageRawBytes": 157940,
"largestAssetRawBytes": 753840,
- "otherRawBytes": 162605,
+ "otherRawBytes": 162727,
"requestCount": 122,
- "scriptRawBytes": 3782633,
+ "scriptRawBytes": 3784934,
"scriptRequestCount": 117,
- "totalRawBytes": 4129259
+ "totalRawBytes": 4131681
},
- "routeReadyMedianMs": 1060,
+ "routeReadyMedianMs": 1050.6000000089407,
"scriptSourceOwnerSet": "editor-canvas-static",
"stateProfile": "empty"
},
@@ -307,31 +307,31 @@
"cssRawBytes": 0,
"fontRawBytes": 0,
"imageRawBytes": 0,
- "largestAssetRawBytes": 298823,
+ "largestAssetRawBytes": 301354,
"otherRawBytes": 0,
"requestCount": 7,
- "scriptRawBytes": 458453,
+ "scriptRawBytes": 460979,
"scriptRequestCount": 7,
- "totalRawBytes": 458453
+ "totalRawBytes": 460979
},
"activatedResourceLimits": {
"cssRawBytes": 0,
"fontRawBytes": 0,
"imageRawBytes": 0,
- "largestAssetRawBytes": 301812,
+ "largestAssetRawBytes": 304368,
"otherRawBytes": 0,
"requestCount": 7,
- "scriptRawBytes": 463038,
+ "scriptRawBytes": 465589,
"scriptRequestCount": 7,
- "totalRawBytes": 463038
+ "totalRawBytes": 465589
},
- "domContentLoadedMedianMs": 119.1000000089407,
+ "domContentLoadedMedianMs": 113.90000000596046,
"id": "editor-canvas",
- "layoutAckMedianMs": 2.7999999970197678,
- "layoutReturnSwitchMedianMs": 47,
- "layoutSwitchMedianMs": 91.1000000089407,
- "loadMedianMs": 119.20000000298023,
- "longestTaskMaxMs": 188,
+ "layoutAckMedianMs": 2.5999999940395355,
+ "layoutReturnSwitchMedianMs": 44,
+ "layoutSwitchMedianMs": 93.3999999910593,
+ "loadMedianMs": 114,
+ "longestTaskMaxMs": 176,
"owner": "canvas",
"projectSwitchMedianMs": 0,
"readyMark": "invokeai:ready:widget:center:canvas",
@@ -341,24 +341,24 @@
"fontRawBytes": 23664,
"imageRawBytes": 156376,
"largestAssetRawBytes": 746376,
- "otherRawBytes": 160995,
+ "otherRawBytes": 161115,
"requestCount": 122,
- "scriptRawBytes": 3745181,
+ "scriptRawBytes": 3747459,
"scriptRequestCount": 117,
- "totalRawBytes": 4088375
+ "totalRawBytes": 4090773
},
"resourceLimits": {
"cssRawBytes": 2181,
"fontRawBytes": 23901,
"imageRawBytes": 157940,
"largestAssetRawBytes": 753840,
- "otherRawBytes": 162605,
+ "otherRawBytes": 162727,
"requestCount": 122,
- "scriptRawBytes": 3782633,
+ "scriptRawBytes": 3784934,
"scriptRequestCount": 117,
- "totalRawBytes": 4129259
+ "totalRawBytes": 4131681
},
- "routeReadyMedianMs": 1169.4000000059605,
+ "routeReadyMedianMs": 1143.1000000089407,
"scriptSourceOwnerSet": "editor-canvas-static",
"stateProfile": "representative"
},
@@ -370,9 +370,9 @@
"largestAssetRawBytes": 173980,
"otherRawBytes": 0,
"requestCount": 7,
- "scriptRawBytes": 364251,
+ "scriptRawBytes": 364237,
"scriptRequestCount": 6,
- "totalRawBytes": 379664
+ "totalRawBytes": 379650
},
"activatedResourceLimits": {
"cssRawBytes": 15568,
@@ -381,17 +381,17 @@
"largestAssetRawBytes": 175720,
"otherRawBytes": 0,
"requestCount": 7,
- "scriptRawBytes": 367894,
+ "scriptRawBytes": 367880,
"scriptRequestCount": 6,
- "totalRawBytes": 383461
+ "totalRawBytes": 383447
},
- "domContentLoadedMedianMs": 117.09999999403954,
+ "domContentLoadedMedianMs": 113.5,
"id": "editor-workflow",
- "layoutAckMedianMs": 2.4000000059604645,
- "layoutReturnSwitchMedianMs": 34.6000000089407,
- "layoutSwitchMedianMs": 93.8999999910593,
- "loadMedianMs": 117.40000000596046,
- "longestTaskMaxMs": 104,
+ "layoutAckMedianMs": 2.3999999910593033,
+ "layoutReturnSwitchMedianMs": 32.5,
+ "layoutSwitchMedianMs": 91.3999999910593,
+ "loadMedianMs": 113.70000000298023,
+ "longestTaskMaxMs": 96,
"owner": "workflow",
"projectSwitchMedianMs": 0,
"readyMark": "invokeai:ready:widget:center:workflow",
@@ -401,24 +401,24 @@
"fontRawBytes": 23664,
"imageRawBytes": 156376,
"largestAssetRawBytes": 746376,
- "otherRawBytes": 160995,
+ "otherRawBytes": 161115,
"requestCount": 122,
- "scriptRawBytes": 3650979,
+ "scriptRawBytes": 3650717,
"scriptRequestCount": 116,
- "totalRawBytes": 4009586
+ "totalRawBytes": 4009444
},
"resourceLimits": {
"cssRawBytes": 17748,
"fontRawBytes": 23901,
"imageRawBytes": 157940,
"largestAssetRawBytes": 753840,
- "otherRawBytes": 162605,
+ "otherRawBytes": 162727,
"requestCount": 122,
- "scriptRawBytes": 3687489,
+ "scriptRawBytes": 3687225,
"scriptRequestCount": 116,
- "totalRawBytes": 4049682
+ "totalRawBytes": 4049539
},
- "routeReadyMedianMs": 1060.2999999970198,
+ "routeReadyMedianMs": 1054.199999988079,
"scriptSourceOwnerSet": "editor-workflow-static",
"stateProfile": "empty"
},
@@ -430,9 +430,9 @@
"largestAssetRawBytes": 173980,
"otherRawBytes": 0,
"requestCount": 7,
- "scriptRawBytes": 364251,
+ "scriptRawBytes": 364237,
"scriptRequestCount": 6,
- "totalRawBytes": 379664
+ "totalRawBytes": 379650
},
"activatedResourceLimits": {
"cssRawBytes": 15568,
@@ -441,17 +441,17 @@
"largestAssetRawBytes": 175720,
"otherRawBytes": 0,
"requestCount": 7,
- "scriptRawBytes": 367894,
+ "scriptRawBytes": 367880,
"scriptRequestCount": 6,
- "totalRawBytes": 383461
+ "totalRawBytes": 383447
},
- "domContentLoadedMedianMs": 122.20000000298023,
+ "domContentLoadedMedianMs": 114.90000000596046,
"id": "editor-workflow",
- "layoutAckMedianMs": 2.8999999910593033,
- "layoutReturnSwitchMedianMs": 42.79999999701977,
- "layoutSwitchMedianMs": 129.90000000596046,
- "loadMedianMs": 122.30000001192093,
- "longestTaskMaxMs": 372,
+ "layoutAckMedianMs": 2.6000000089406967,
+ "layoutReturnSwitchMedianMs": 38.79999999701977,
+ "layoutSwitchMedianMs": 124.70000000298023,
+ "loadMedianMs": 115,
+ "longestTaskMaxMs": 333,
"owner": "workflow",
"projectSwitchMedianMs": 0,
"readyMark": "invokeai:ready:widget:center:workflow",
@@ -461,24 +461,24 @@
"fontRawBytes": 23664,
"imageRawBytes": 156376,
"largestAssetRawBytes": 746376,
- "otherRawBytes": 160995,
+ "otherRawBytes": 161115,
"requestCount": 122,
- "scriptRawBytes": 3650979,
+ "scriptRawBytes": 3650717,
"scriptRequestCount": 116,
- "totalRawBytes": 4009586
+ "totalRawBytes": 4009444
},
"resourceLimits": {
"cssRawBytes": 17748,
"fontRawBytes": 23901,
"imageRawBytes": 157940,
"largestAssetRawBytes": 753840,
- "otherRawBytes": 162605,
+ "otherRawBytes": 162727,
"requestCount": 122,
- "scriptRawBytes": 3687489,
+ "scriptRawBytes": 3687225,
"scriptRequestCount": 116,
- "totalRawBytes": 4049682
+ "totalRawBytes": 4049539
},
- "routeReadyMedianMs": 1201.2000000029802,
+ "routeReadyMedianMs": 1174.5,
"scriptSourceOwnerSet": "editor-workflow-static",
"stateProfile": "representative"
},
@@ -505,13 +505,13 @@
"scriptRequestCount": 0,
"totalRawBytes": 0
},
- "domContentLoadedMedianMs": 116.20000000298023,
+ "domContentLoadedMedianMs": 113.20000000298023,
"id": "editor-gallery",
"layoutAckMedianMs": 0,
"layoutReturnSwitchMedianMs": 0,
- "layoutSwitchMedianMs": 26.799999997019768,
- "loadMedianMs": 116.40000000596046,
- "longestTaskMaxMs": 107,
+ "layoutSwitchMedianMs": 23.900000005960464,
+ "loadMedianMs": 113.29999999701977,
+ "longestTaskMaxMs": 94,
"owner": "gallery",
"projectSwitchMedianMs": 0,
"readyMark": "invokeai:ready:widget:center:gallery",
@@ -521,24 +521,24 @@
"fontRawBytes": 23664,
"imageRawBytes": 156376,
"largestAssetRawBytes": 746376,
- "otherRawBytes": 160995,
+ "otherRawBytes": 161115,
"requestCount": 115,
- "scriptRawBytes": 3286728,
+ "scriptRawBytes": 3286480,
"scriptRequestCount": 110,
- "totalRawBytes": 3629922
+ "totalRawBytes": 3629794
},
"resourceLimits": {
"cssRawBytes": 2181,
"fontRawBytes": 23901,
"imageRawBytes": 157940,
"largestAssetRawBytes": 753840,
- "otherRawBytes": 162605,
+ "otherRawBytes": 162727,
"requestCount": 115,
- "scriptRawBytes": 3319596,
+ "scriptRawBytes": 3319345,
"scriptRequestCount": 110,
- "totalRawBytes": 3666222
+ "totalRawBytes": 3666092
},
- "routeReadyMedianMs": 1267.2000000029802,
+ "routeReadyMedianMs": 1254.5,
"scriptSourceOwnerSet": "editor-minimal-static",
"stateProfile": "empty"
},
@@ -565,13 +565,13 @@
"scriptRequestCount": 0,
"totalRawBytes": 0
},
- "domContentLoadedMedianMs": 121,
+ "domContentLoadedMedianMs": 115.29999999701977,
"id": "editor-gallery",
"layoutAckMedianMs": 0,
"layoutReturnSwitchMedianMs": 0,
- "layoutSwitchMedianMs": 95.3999999910593,
- "loadMedianMs": 121,
- "longestTaskMaxMs": 194,
+ "layoutSwitchMedianMs": 85.09999999403954,
+ "loadMedianMs": 115.5,
+ "longestTaskMaxMs": 178,
"owner": "gallery",
"projectSwitchMedianMs": 0,
"readyMark": "invokeai:ready:widget:center:gallery",
@@ -581,24 +581,24 @@
"fontRawBytes": 23664,
"imageRawBytes": 156376,
"largestAssetRawBytes": 746376,
- "otherRawBytes": 160995,
+ "otherRawBytes": 161115,
"requestCount": 115,
- "scriptRawBytes": 3286728,
+ "scriptRawBytes": 3286480,
"scriptRequestCount": 110,
- "totalRawBytes": 3629922
+ "totalRawBytes": 3629794
},
"resourceLimits": {
"cssRawBytes": 2181,
"fontRawBytes": 23901,
"imageRawBytes": 157940,
"largestAssetRawBytes": 753840,
- "otherRawBytes": 162605,
+ "otherRawBytes": 162727,
"requestCount": 115,
- "scriptRawBytes": 3319596,
+ "scriptRawBytes": 3319345,
"scriptRequestCount": 110,
- "totalRawBytes": 3666222
+ "totalRawBytes": 3666092
},
- "routeReadyMedianMs": 1471.699999988079,
+ "routeReadyMedianMs": 1426.5,
"scriptSourceOwnerSet": "editor-minimal-static",
"stateProfile": "representative"
}
@@ -2826,7 +2826,6 @@
"source:src/workbench/widgets/canvas/tool-options/BboxOptions.tsx",
"source:src/workbench/widgets/canvas/tool-options/BrushOptions.tsx",
"source:src/workbench/widgets/canvas/tool-options/CanvasOptionsBar.tsx",
- "source:src/workbench/widgets/canvas/tool-options/EraserOptions.tsx",
"source:src/workbench/widgets/canvas/tool-options/FilterOptions.tsx",
"source:src/workbench/widgets/canvas/tool-options/GradientOptions.tsx",
"source:src/workbench/widgets/canvas/tool-options/LassoOptions.tsx",
@@ -2838,9 +2837,13 @@
"source:src/workbench/widgets/canvas/tool-options/ShapeOptions.tsx",
"source:src/workbench/widgets/canvas/tool-options/TextOptions.tsx",
"source:src/workbench/widgets/canvas/tool-options/TransformOptions.tsx",
+ "source:src/workbench/widgets/canvas/tool-options/paintForm.tsx",
"source:src/workbench/widgets/canvas/tool-options/useBboxEditor.ts",
+ "source:src/workbench/widgets/canvas/tool-presentation/PropertyPrimitives.tsx",
"source:src/workbench/widgets/canvas/tool-presentation/ToolbarPrimitives.tsx",
+ "source:src/workbench/widgets/canvas/tool-presentation/propertyGroupStore.ts",
"source:src/workbench/widgets/canvas/tool-presentation/toolAdapters.ts",
+ "source:src/workbench/widgets/canvas/tool-presentation/toolbarContracts.ts",
"source:src/workbench/widgets/canvas/useCanvasEngine.ts",
"source:src/workbench/widgets/canvas/useCanvasGallerySave.ts",
"source:src/workbench/widgets/canvas/useColorSampler.ts",
diff --git a/invokeai/frontend/webv2/public/locales/en.json b/invokeai/frontend/webv2/public/locales/en.json
index bc1e8209fe..8b81893bf1 100644
--- a/invokeai/frontend/webv2/public/locales/en.json
+++ b/invokeai/frontend/webv2/public/locales/en.json
@@ -1524,6 +1524,11 @@
},
"properties": {
"noCanvas": "Open a canvas to edit its properties.",
+ "groups": {
+ "stroke": "Stroke",
+ "dynamics": "Dynamics"
+ },
+ "foreground": "Foreground",
"rows": {
"color": "Color",
"geometry": "Geometry",
@@ -2421,7 +2426,6 @@
"positionY": "Y",
"pressureAffectsOpacity": "Pen pressure affects opacity",
"pressureAffectsWidth": "Pen pressure affects width",
- "pressure": "Pressure",
"rotation": "Rotation",
"scaleHeight": "H %",
"scaleWidth": "W %",
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 c9d7807041..7b1e456ddb 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
@@ -1,25 +1,13 @@
import type { NumberInput as ChakraNumberInput } from '@chakra-ui/react';
-import type { BrushOptions as BrushOptionsState } from '@workbench/canvas-engine/api';
-import type {
- ToolbarRegionProps,
- ToolbarStatusProps,
- ToolPresentationAdapter,
-} from '@workbench/widgets/canvas/tool-presentation/toolbarContracts';
import type { KeyboardEvent } from 'react';
-import { chakra, HStack } from '@chakra-ui/react';
-import { ToggleIconButton } from '@platform/ui/Button';
-import { ColorPicker } from '@platform/ui/ColorPicker';
+import { chakra } from '@chakra-ui/react';
import { MAX_BRUSH_SIZE, MIN_BRUSH_SIZE } from '@workbench/canvas-engine/api';
-import { useActiveColorCommands, useActiveColorPair } from '@workbench/widgets/canvas/color-system/useActiveColors';
-import { useBrushOptions } from '@workbench/widgets/canvas/engineStoreHooks';
import {
ToolbarNumberField,
ToolbarSlider,
useNumberCommit,
} from '@workbench/widgets/canvas/tool-presentation/ToolbarPrimitives';
-import { useColorSampler } from '@workbench/widgets/canvas/useColorSampler';
-import { DropletIcon, PenLineIcon } from 'lucide-react';
import { useLayoutEffect, useRef, useCallback } from 'react';
import { useTranslation } from 'react-i18next';
@@ -279,101 +267,3 @@ export const PaintStrokePreview = ({
/>
);
};
-
-const BrushPreview = ({ engine }: ToolbarStatusProps) => {
- const options = useBrushOptions(engine);
- return (
- <PaintStrokePreview
- color={options.color}
- hardness={options.hardness}
- opacity={options.opacity}
- size={options.size}
- />
- );
-};
-
-const useBrushPatch = (engine: ToolbarRegionProps['engine']) => {
- const options = useBrushOptions(engine);
- const patch = useCallback(
- (changes: Partial<BrushOptionsState>) => engine.interaction.set('brushOptions', { ...options, ...changes }),
- [engine, options]
- );
- return [options, patch] as const;
-};
-
-const BrushSize = ({ engine }: ToolbarRegionProps) => {
- const { t } = useTranslation();
- const [options, set] = useBrushPatch(engine);
- const setSize = useCallback((size: number) => set({ size: clampBrushSize(size) }), [set]);
- return <PaintSizeControl label={t('widgets.canvas.toolOptions.brushSize')} setSize={setSize} size={options.size} />;
-};
-
-const BrushOpacity = ({ engine }: ToolbarRegionProps) => {
- const [options, set] = useBrushPatch(engine);
- const setOpacity = useCallback((opacity: number) => set({ opacity }), [set]);
- return <PaintOpacityControl opacity={options.opacity} setOpacity={setOpacity} />;
-};
-
-const BrushHardness = ({ engine }: ToolbarRegionProps) => {
- const [options, set] = useBrushPatch(engine);
- const setHardness = useCallback((hardness: number) => set({ hardness }), [set]);
- return <PaintHardnessControl hardness={options.hardness} setHardness={setHardness} />;
-};
-
-/** A mirror of the project foreground, not brush-owned state: the pair feeds the engine's brush color. */
-const BrushColor = ({ engine }: ToolbarRegionProps) => {
- const { t } = useTranslation();
- const pair = useActiveColorPair();
- const { setPairColor } = useActiveColorCommands();
- const onColorChange = useCallback((color: string) => setPairColor('foreground', color), [setPairColor]);
- const sampleColor = useColorSampler(engine);
- return (
- <ColorPicker
- aria-label={t('widgets.canvas.toolOptions.brushColor')}
- value={pair.foreground}
- onSampleColor={sampleColor}
- onValueChange={onColorChange}
- />
- );
-};
-
-/** Width and opacity are separate pressure responses (opacity also costs a scratch refill per frame). */
-const BrushPressure = ({ engine }: ToolbarRegionProps) => {
- const { t } = useTranslation();
- const [options, set] = useBrushPatch(engine);
- const onWidth = useCallback((pressureAffectsWidth: boolean) => set({ pressureAffectsWidth }), [set]);
- const onOpacity = useCallback((pressureAffectsOpacity: boolean) => set({ pressureAffectsOpacity }), [set]);
- return (
- <HStack gap="1">
- <ToggleIconButton
- checked={options.pressureAffectsWidth}
- icon={PenLineIcon}
- label={t('widgets.canvas.toolOptions.pressureAffectsWidth')}
- onCheckedChange={onWidth}
- />
- <ToggleIconButton
- checked={options.pressureAffectsOpacity}
- icon={DropletIcon}
- label={t('widgets.canvas.toolOptions.pressureAffectsOpacity')}
- onCheckedChange={onOpacity}
- />
- </HStack>
- );
-};
-
-export const brushAdapter: ToolPresentationAdapter = {
- rowLabels: {
- geometry: 'widgets.canvas.toolOptions.size',
- intensity: 'widgets.canvas.toolOptions.opacity',
- modes: 'widgets.canvas.toolOptions.hardness',
- more: 'widgets.canvas.toolOptions.pressure',
- },
- color: BrushColor,
- geometry: BrushSize,
- id: 'brush',
- intensity: BrushOpacity,
- modes: BrushHardness,
- more: BrushPressure,
- paintsLeaf: true,
- status: BrushPreview,
-};
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/EraserOptions.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/EraserOptions.tsx
deleted file mode 100644
index aae2f8defe..0000000000
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/EraserOptions.tsx
+++ /dev/null
@@ -1,66 +0,0 @@
-import type {
- ToolbarRegionProps,
- ToolbarStatusProps,
- ToolPresentationAdapter,
-} from '@workbench/widgets/canvas/tool-presentation/toolbarContracts';
-
-import { useEraserOptions } from '@workbench/widgets/canvas/engineStoreHooks';
-import { useCallback } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import {
- clampBrushSize,
- PaintHardnessControl,
- PaintOpacityControl,
- PaintSizeControl,
- PaintStrokePreview,
-} from './BrushOptions';
-
-const EraserSize = ({ engine }: ToolbarRegionProps) => {
- const { t } = useTranslation();
- const options = useEraserOptions(engine);
- const setSize = useCallback(
- (size: number) => engine.interaction.set('eraserOptions', { ...options, size: clampBrushSize(size) }),
- [engine, options]
- );
- return <PaintSizeControl label={t('widgets.canvas.toolOptions.eraserSize')} setSize={setSize} size={options.size} />;
-};
-
-const EraserOpacity = ({ engine }: ToolbarRegionProps) => {
- const options = useEraserOptions(engine);
- const setOpacity = useCallback(
- (opacity: number) => engine.interaction.set('eraserOptions', { ...options, opacity }),
- [engine, options]
- );
- return <PaintOpacityControl opacity={options.opacity} setOpacity={setOpacity} />;
-};
-
-const EraserHardness = ({ engine }: ToolbarRegionProps) => {
- const options = useEraserOptions(engine);
- const setHardness = useCallback(
- (hardness: number) => engine.interaction.set('eraserOptions', { ...options, hardness }),
- [engine, options]
- );
- return <PaintHardnessControl hardness={options.hardness} setHardness={setHardness} />;
-};
-
-const EraserPreview = ({ engine }: ToolbarStatusProps) => {
- const options = useEraserOptions(engine);
- return (
- <PaintStrokePreview color="#9aa2b1" hardness={options.hardness} opacity={options.opacity} size={options.size} />
- );
-};
-
-export const eraserAdapter: ToolPresentationAdapter = {
- rowLabels: {
- geometry: 'widgets.canvas.toolOptions.size',
- intensity: 'widgets.canvas.toolOptions.opacity',
- modes: 'widgets.canvas.toolOptions.hardness',
- },
- geometry: EraserSize,
- id: 'eraser',
- intensity: EraserOpacity,
- modes: EraserHardness,
- paintsLeaf: true,
- status: EraserPreview,
-};
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
new file mode 100644
index 0000000000..f0907652df
--- /dev/null
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/paintForm.tsx
@@ -0,0 +1,164 @@
+import type {
+ ToolbarRegionProps,
+ ToolbarStatusProps,
+ ToolPropertyForm,
+ ToolPropertyGroup,
+} from '@workbench/widgets/canvas/tool-presentation/toolbarContracts';
+
+import { ColorPicker } from '@platform/ui/ColorPicker';
+import { useActiveColorCommands, useActiveColorPair } from '@workbench/widgets/canvas/color-system/useActiveColors';
+import { useBrushOptions, useCanvasActiveTool, useEraserOptions } from '@workbench/widgets/canvas/engineStoreHooks';
+import { PropertyControlRow, PropertySwitchRow } from '@workbench/widgets/canvas/tool-presentation/PropertyPrimitives';
+import { useColorSampler } from '@workbench/widgets/canvas/useColorSampler';
+import { useCallback } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import {
+ clampBrushSize,
+ PaintHardnessControl,
+ PaintOpacityControl,
+ PaintSizeControl,
+ PaintStrokePreview,
+} from './BrushOptions';
+
+/** The eraser preview's neutral ink: it erases, so no project color applies. */
+const ERASER_PREVIEW_COLOR = '#9aa2b1';
+
+/**
+ * The brush/eraser form pieces are SHARED components that read the active tool
+ * from the engine, rather than per-tool closures: identical component types
+ * under identical group ids keep the DOM alive across the brush↔eraser
+ * switch, which is what makes the "stable geometry across related tools"
+ * invariant hold in the form world.
+ */
+const usePaintOptions = (engine: ToolbarRegionProps['engine']) => {
+ const activeTool = useCanvasActiveTool(engine);
+ const brush = useBrushOptions(engine);
+ const eraser = useEraserOptions(engine);
+ const isEraser = activeTool === 'eraser';
+ const options = isEraser ? eraser : brush;
+ const set = useCallback(
+ (changes: Partial<typeof options>) => {
+ if (isEraser) {
+ engine.interaction.set('eraserOptions', { ...eraser, ...changes });
+ } else {
+ engine.interaction.set('brushOptions', { ...brush, ...changes });
+ }
+ },
+ [brush, engine, eraser, isEraser]
+ );
+ return { isEraser, options, set };
+};
+
+const PaintPreview = ({ engine }: ToolbarStatusProps) => {
+ const { isEraser, options } = usePaintOptions(engine);
+ const pair = useActiveColorPair();
+ return (
+ <PaintStrokePreview
+ color={isEraser ? ERASER_PREVIEW_COLOR : pair.foreground}
+ hardness={options.hardness}
+ opacity={options.opacity}
+ size={options.size}
+ />
+ );
+};
+
+const PaintStrokeSettings = ({ engine }: ToolbarRegionProps) => {
+ const { t } = useTranslation();
+ const { isEraser, options, set } = usePaintOptions(engine);
+ const setSize = useCallback((size: number) => set({ size: clampBrushSize(size) }), [set]);
+ const setOpacity = useCallback((opacity: number) => set({ opacity }), [set]);
+ const setHardness = useCallback((hardness: number) => set({ hardness }), [set]);
+ return (
+ <>
+ <PropertyControlRow label={t('widgets.canvas.toolOptions.size')}>
+ <PaintSizeControl
+ label={t(isEraser ? 'widgets.canvas.toolOptions.eraserSize' : 'widgets.canvas.toolOptions.brushSize')}
+ setSize={setSize}
+ size={options.size}
+ />
+ </PropertyControlRow>
+ <PropertyControlRow label={t('widgets.canvas.toolOptions.opacity')}>
+ <PaintOpacityControl opacity={options.opacity} setOpacity={setOpacity} />
+ </PropertyControlRow>
+ <PropertyControlRow label={t('widgets.canvas.toolOptions.hardness')}>
+ <PaintHardnessControl hardness={options.hardness} setHardness={setHardness} />
+ </PropertyControlRow>
+ </>
+ );
+};
+
+/** A mirror of the project foreground, not brush-owned state: the pair feeds the engine's brush color. */
+const PaintColorSettings = ({ engine }: ToolbarRegionProps) => {
+ const { t } = useTranslation();
+ const pair = useActiveColorPair();
+ const { setPairColor } = useActiveColorCommands();
+ const onColorChange = useCallback((color: string) => setPairColor('foreground', color), [setPairColor]);
+ const sampleColor = useColorSampler(engine);
+ return (
+ <PropertyControlRow label={t('widgets.properties.foreground')}>
+ <ColorPicker
+ aria-label={t('widgets.canvas.toolOptions.brushColor')}
+ value={pair.foreground}
+ onSampleColor={sampleColor}
+ onValueChange={onColorChange}
+ />
+ </PropertyControlRow>
+ );
+};
+
+/** Width and opacity are separate pressure responses (opacity also costs a scratch refill per frame). */
+const PaintDynamicsSettings = ({ engine }: ToolbarRegionProps) => {
+ const { t } = useTranslation();
+ const brush = useBrushOptions(engine);
+ const set = useCallback(
+ (changes: Partial<typeof brush>) => engine.interaction.set('brushOptions', { ...brush, ...changes }),
+ [brush, engine]
+ );
+ const onWidth = useCallback((pressureAffectsWidth: boolean) => set({ pressureAffectsWidth }), [set]);
+ const onOpacity = useCallback((pressureAffectsOpacity: boolean) => set({ pressureAffectsOpacity }), [set]);
+ return (
+ <>
+ <PropertySwitchRow
+ checked={brush.pressureAffectsWidth}
+ label={t('widgets.canvas.toolOptions.pressureAffectsWidth')}
+ onCheckedChange={onWidth}
+ />
+ <PropertySwitchRow
+ checked={brush.pressureAffectsOpacity}
+ label={t('widgets.canvas.toolOptions.pressureAffectsOpacity')}
+ onCheckedChange={onOpacity}
+ />
+ </>
+ );
+};
+
+/** Shared literal: the same object in both forms, so id, type and DOM survive the switch. */
+const STROKE_GROUP: ToolPropertyGroup = {
+ body: PaintStrokeSettings,
+ id: 'paint-stroke',
+ labelKey: 'widgets.properties.groups.stroke',
+};
+
+export const brushForm: ToolPropertyForm = {
+ groups: [
+ STROKE_GROUP,
+ { body: PaintColorSettings, id: 'paint-color', labelKey: 'widgets.properties.rows.color' },
+ {
+ body: PaintDynamicsSettings,
+ collapsible: 'collapsed',
+ id: 'paint-dynamics',
+ labelKey: 'widgets.properties.groups.dynamics',
+ },
+ ],
+ id: 'brush',
+ paintsLeaf: true,
+ preview: PaintPreview,
+};
+
+export const eraserForm: ToolPropertyForm = {
+ groups: [STROKE_GROUP],
+ id: 'eraser',
+ paintsLeaf: true,
+ preview: PaintPreview,
+};
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/PropertyPrimitives.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/PropertyPrimitives.tsx
new file mode 100644
index 0000000000..7dfe1209f4
--- /dev/null
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/PropertyPrimitives.tsx
@@ -0,0 +1,117 @@
+import type { ReactNode } from 'react';
+
+import { chakra, Grid, Icon, Stack, Switch, Text } from '@chakra-ui/react';
+import { ChevronDownIcon } from 'lucide-react';
+import { useCallback } from 'react';
+
+import { setPropertyGroupCollapsed, usePropertyGroupCollapsed } from './propertyGroupStore';
+
+const GROUP_HEADER_HOVER = { color: 'fg' } as const;
+
+/**
+ * One settings row of a tool property form: a fixed label column, a flexible
+ * control cell, and a fixed trailing cell. Grid, not wrapping flex — a slider
+ * and its number field are one row at every pane width.
+ */
+export const PropertyControlRow = ({ children, label }: { children: ReactNode; label: string }) => (
+ <Grid alignItems="center" columnGap="2" gridTemplateColumns="4.5rem minmax(0, 1fr) auto" minH="7" w="full">
+ <Text color="fg.muted" fontSize="xs" minW="0" truncate>
+ {label}
+ </Text>
+ {children}
+ </Grid>
+);
+
+/** A labelled on/off row; the label is the switch's own, so the whole row is one click target. */
+export const PropertySwitchRow = ({
+ checked,
+ disabled,
+ label,
+ onCheckedChange,
+}: {
+ checked: boolean;
+ disabled?: boolean;
+ label: string;
+ onCheckedChange: (checked: boolean) => void;
+}) => {
+ const handleChange = useCallback(
+ ({ checked: next }: { checked: boolean }) => onCheckedChange(next),
+ [onCheckedChange]
+ );
+ return (
+ <Switch.Root
+ checked={checked}
+ disabled={disabled}
+ justifyContent="space-between"
+ minH="7"
+ size="sm"
+ w="full"
+ onCheckedChange={handleChange}
+ >
+ <Switch.Label color="fg.muted" fontSize="xs">
+ {label}
+ </Switch.Label>
+ <Switch.HiddenInput />
+ <Switch.Control>
+ <Switch.Thumb />
+ </Switch.Control>
+ </Switch.Root>
+ );
+};
+
+/**
+ * A named group of form rows. A collapsible group renders its label as a
+ * disclosure button and remembers the user's choice per group id (an override
+ * store; the declared default applies until the user touches it).
+ */
+export const PropertyGroup = ({
+ children,
+ collapsible,
+ id,
+ label,
+}: {
+ children: ReactNode;
+ /** Absent means always open with a plain header. */
+ collapsible?: 'open' | 'collapsed';
+ id: string;
+ label: string;
+}) => {
+ const collapsed = usePropertyGroupCollapsed(id, collapsible === 'collapsed');
+ const onToggle = useCallback(() => setPropertyGroupCollapsed(id, !collapsed), [collapsed, id]);
+ const open = !collapsible || !collapsed;
+ return (
+ <Stack aria-label={label} gap="1" role="group">
+ {collapsible ? (
+ <chakra.button
+ alignItems="center"
+ aria-expanded={open}
+ color="fg.muted"
+ cursor="pointer"
+ display="flex"
+ gap="1"
+ rounded="xs"
+ type="button"
+ w="fit-content"
+ _hover={GROUP_HEADER_HOVER}
+ onClick={onToggle}
+ >
+ <Icon
+ as={ChevronDownIcon}
+ boxSize="3"
+ transform={open ? undefined : 'rotate(-90deg)'}
+ transitionDuration="fast"
+ transitionProperty="transform"
+ />
+ <Text fontSize="xs" fontWeight="600">
+ {label}
+ </Text>
+ </chakra.button>
+ ) : (
+ <Text color="fg.muted" fontSize="xs" fontWeight="600">
+ {label}
+ </Text>
+ )}
+ {open ? children : null}
+ </Stack>
+ );
+};
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/propertyGroupStore.ts b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/propertyGroupStore.ts
new file mode 100644
index 0000000000..7f3ff00484
--- /dev/null
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/propertyGroupStore.ts
@@ -0,0 +1,50 @@
+import { createExternalStore } from '@platform/state/externalStore';
+
+const STORAGE_KEY = 'invokeai:v7:webv2:tool-property-collapsed';
+
+/**
+ * Per-user collapsed-state overrides for tool property groups, keyed by group
+ * id. Only overrides are stored: a group absent here uses its declared
+ * default, so new groups can ship collapsed without migration.
+ */
+const readStored = (): Record<string, boolean> => {
+ if (typeof window === 'undefined') {
+ return {};
+ }
+ try {
+ const parsed = JSON.parse(window.localStorage.getItem(STORAGE_KEY) ?? '{}') as unknown;
+ if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
+ return {};
+ }
+ return Object.fromEntries(
+ Object.entries(parsed).filter((entry): entry is [string, boolean] => typeof entry[1] === 'boolean')
+ );
+ } catch {
+ return {};
+ }
+};
+
+const store = createExternalStore<Record<string, boolean>>(readStored());
+
+export const setPropertyGroupCollapsed = (groupId: string, collapsed: boolean): void => {
+ const next = { ...store.getSnapshot(), [groupId]: collapsed };
+ store.setSnapshot(next);
+ try {
+ window.localStorage.setItem(STORAGE_KEY, JSON.stringify(next));
+ } catch {
+ // Storage failures are non-fatal; collapse is a convenience.
+ }
+};
+
+export const usePropertyGroupCollapsed = (groupId: string, defaultCollapsed: boolean): boolean =>
+ store.useSelector((snapshot) => snapshot[groupId] ?? defaultCollapsed, Object.is);
+
+/** Test seam: clears every override (storage included). */
+export const resetPropertyGroupCollapse = (): void => {
+ store.setSnapshot({});
+ try {
+ window.localStorage.removeItem(STORAGE_KEY);
+ } catch {
+ // As above.
+ }
+};
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 b780b28e9d..85cc84b2cb 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,7 +2,12 @@ import type { ToolId } from '@workbench/canvas-engine/api';
import { describe, expect, it } from 'vitest';
-import { hasToolRegions, OPERATION_PRESENTATION_ADAPTERS, TOOL_PRESENTATION_ADAPTERS } from './toolAdapters';
+import {
+ hasToolControls,
+ isToolPropertyForm,
+ OPERATION_PRESENTATION_ADAPTERS,
+ TOOL_PRESENTATION_ADAPTERS,
+} from './toolAdapters';
const TOOL_IDS = Object.keys({
bbox: true,
@@ -46,7 +51,7 @@ describe('tool presentation adapters', () => {
it('hints exactly the tools without a control', () => {
for (const toolId of TOOL_IDS) {
const adapter = TOOL_PRESENTATION_ADAPTERS[toolId];
- if (hasToolRegions(adapter)) {
+ if (hasToolControls(adapter)) {
expect(en.widgets.canvas.toolHints[toolId], toolId).toBeUndefined();
} else {
expect(en.widgets.canvas.toolHints[toolId], toolId).toEqual(expect.any(String));
@@ -54,6 +59,22 @@ describe('tool presentation adapters', () => {
}
});
+ it('resolves every form group label in the English catalog and keeps group ids unique per form', () => {
+ const resolve = (key: string): unknown =>
+ 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) {
+ expect(resolve(group.labelKey), `${toolId}:${group.id}`).toEqual(expect.any(String));
+ }
+ }
+ });
+
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));
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 523575fdd7..a54d7e9fd8 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
@@ -1,28 +1,34 @@
import type { ToolId } from '@workbench/canvas-engine/api';
import { bboxAdapter } from '@workbench/widgets/canvas/tool-options/BboxOptions';
-import { brushAdapter } from '@workbench/widgets/canvas/tool-options/BrushOptions';
-import { eraserAdapter } from '@workbench/widgets/canvas/tool-options/EraserOptions';
import { filterOperationAdapter } from '@workbench/widgets/canvas/tool-options/FilterOptions';
import { gradientAdapter } from '@workbench/widgets/canvas/tool-options/GradientOptions';
import { lassoAdapter } from '@workbench/widgets/canvas/tool-options/LassoOptions';
import { marqueeAdapter } from '@workbench/widgets/canvas/tool-options/MarqueeOptions';
import { moveAdapter } from '@workbench/widgets/canvas/tool-options/MoveOptions';
+import { brushForm, eraserForm } from '@workbench/widgets/canvas/tool-options/paintForm';
import { selectObjectOperationAdapter } from '@workbench/widgets/canvas/tool-options/SamOptions';
import { shapeAdapter } from '@workbench/widgets/canvas/tool-options/ShapeOptions';
import { textAdapter } from '@workbench/widgets/canvas/tool-options/TextOptions';
import { transformAdapter } from '@workbench/widgets/canvas/tool-options/TransformOptions';
-import type { CanvasOperationKind, OperationPresentationAdapter, ToolPresentationAdapter } from './toolbarContracts';
+import type {
+ CanvasOperationKind,
+ OperationPresentationAdapter,
+ ToolPanePresentation,
+ ToolPresentationAdapter,
+} from './toolbarContracts';
+
+import { isToolPropertyForm } from './toolbarContracts';
/** Tools with no primary settings show their name and hint; the shell never unmounts for them. */
const hintOnly = (id: ToolId): ToolPresentationAdapter => ({ id });
-export const TOOL_PRESENTATION_ADAPTERS: Readonly<Record<ToolId, ToolPresentationAdapter>> = {
+export const TOOL_PRESENTATION_ADAPTERS: Readonly<Record<ToolId, ToolPanePresentation>> = {
bbox: bboxAdapter,
- brush: brushAdapter,
+ brush: brushForm,
colorPicker: hintOnly('colorPicker'),
- eraser: eraserAdapter,
+ eraser: eraserForm,
gradient: gradientAdapter,
lasso: lassoAdapter,
marquee: marqueeAdapter,
@@ -41,3 +47,9 @@ export const OPERATION_PRESENTATION_ADAPTERS: Readonly<Record<CanvasOperationKin
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 { 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/toolbarContracts.ts
index d09c1976be..a585a56fae 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/toolbarContracts.ts
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/toolbarContracts.ts
@@ -52,3 +52,36 @@ export interface OperationPresentationAdapter {
more?: ToolbarRegionComponent;
status: ComponentType<ToolbarStatusProps>;
}
+
+/**
+ * One named group of a tool's property form. Group ids are GLOBAL keys: shared
+ * across tools when (and only when) the tools share the group's component, so
+ * React keeps the DOM alive across the tool switch and collapse state follows
+ * the group rather than the tool.
+ */
+export interface ToolPropertyGroup {
+ id: string;
+ labelKey: string;
+ /** 'actions' renders a command cluster, visually distinct from settings. */
+ kind?: 'settings' | 'actions';
+ /** Present makes the header a disclosure; the value is the default state. */
+ collapsible?: 'open' | 'collapsed';
+ body: ToolbarRegionComponent;
+}
+
+/**
+ * A tool's purpose-built pane form: an optional preview card on top, then
+ * named groups of typed rows. Successor to the region adapter; tools migrate
+ * one by one and the pane renders whichever shape a tool declares.
+ */
+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>;
+ groups: readonly ToolPropertyGroup[];
+}
+
+export type ToolPanePresentation = ToolPresentationAdapter | ToolPropertyForm;
+
+export const isToolPropertyForm = (adapter: ToolPanePresentation): adapter is ToolPropertyForm => 'groups' in adapter;
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/LayerEditorPanes.browser.test.tsx b/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/LayerEditorPanes.browser.test.tsx
index 703258c7cc..c3d3b209d4 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/LayerEditorPanes.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/LayerEditorPanes.browser.test.tsx
@@ -20,12 +20,13 @@ import {
import { attachCanvasOperations } from '@workbench/canvas-operations/operationAccess';
import { createEmptyCanvasDocument, createEmptyCanvasState } from '@workbench/canvasMigration';
import { applyCanvasProjectMutation } from '@workbench/canvasProjectMutations';
+import { resetPropertyGroupCollapse } from '@workbench/widgets/canvas/tool-presentation/propertyGroupStore';
import { createInitialWorkbenchState } from '@workbench/workbenchState';
import { createInstance } from 'i18next';
import { act, useState } from 'react';
import { createRoot, type Root } from 'react-dom/client';
import { I18nextProvider } from 'react-i18next';
-import { afterEach, beforeAll, describe, expect, it, vi } from 'vitest';
+import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
import { page, userEvent } from 'vitest/browser';
const harness = vi.hoisted(() => ({
@@ -237,7 +238,13 @@ const LayerEditorPanesHarness = () => {
};
describe('Properties pane', () => {
- it('shows the active tool as labelled rows and swaps them with the tool', async () => {
+ // Collapse overrides persist in localStorage, which the browser session
+ // shares across test FILES; reset around every test so no order dependence
+ // leaks in either direction.
+ beforeEach(() => resetPropertyGroupCollapse());
+ afterEach(() => resetPropertyGroupCollapse());
+
+ it('shows the active tool as a grouped form and swaps it with the tool', async () => {
await mount(PropertiesPane);
await act(() => engine!.tools.setTool('brush'));
await settle();
@@ -245,7 +252,15 @@ describe('Properties pane', () => {
await expect.element(page.getByRole('slider', { exact: true, name: 'Brush size' })).toBeVisible();
await expect.element(page.getByRole('slider', { exact: true, name: 'Opacity' })).toBeVisible();
await expect.element(page.getByRole('button', { exact: true, name: 'Brush color' })).toBeVisible();
- await expect.element(page.getByRole('button', { exact: true, name: 'Pen pressure affects width' })).toBeVisible();
+ // Dynamics ships collapsed; the disclosure opens it to labelled switches.
+ const dynamics = page.getByRole('button', { exact: true, name: 'Dynamics' });
+ await expect.element(dynamics).toHaveAttribute('aria-expanded', 'false');
+ expect(page.getByRole('checkbox', { exact: true, name: 'Pen pressure affects width' }).query()).toBeNull();
+ await act(() => userEvent.click(dynamics));
+ await expect.element(page.getByRole('checkbox', { exact: true, name: 'Pen pressure affects width' })).toBeVisible();
+ await expect
+ .element(page.getByRole('checkbox', { exact: true, name: 'Pen pressure affects opacity' }))
+ .toBeVisible();
await act(() => engine!.tools.setTool('view'));
await settle();
@@ -253,6 +268,50 @@ describe('Properties pane', () => {
expect(host!.textContent).toContain('Drag to pan and scroll to zoom.');
});
+ it('keeps a slider and its number field on one grid row and shares row identity brush↔eraser', async () => {
+ await mount(PropertiesPane);
+ await act(() => engine!.tools.setTool('brush'));
+ await settle();
+ const slider = page.getByRole('slider', { exact: true, name: 'Brush size' }).element() as HTMLElement;
+ const field = page.getByRole('spinbutton', { exact: true, name: 'Brush size' }).element() as HTMLElement;
+ // One grid row: the slider and its field never wrap apart (compare row
+ // centers; the two controls have different heights).
+ const centerOf = (el: HTMLElement) => {
+ const rect = el.getBoundingClientRect();
+ return rect.top + rect.height / 2;
+ };
+ expect(Math.abs(centerOf(slider) - centerOf(field))).toBeLessThan(8);
+
+ await act(() => engine!.tools.setTool('eraser'));
+ await settle();
+ // Same DOM node, relabelled: the shared Stroke group survives the switch.
+ const eraserSlider = page.getByRole('slider', { exact: true, name: 'Eraser size' }).element();
+ expect(eraserSlider).toBe(slider);
+ expect(page.getByRole('button', { exact: true, name: 'Brush color' }).query()).toBeNull();
+ });
+
+ it('remembers a group collapse per user across remounts', async () => {
+ await mount(PropertiesPane);
+ await act(() => engine!.tools.setTool('brush'));
+ await settle();
+ await act(() => userEvent.click(page.getByRole('button', { exact: true, name: 'Dynamics' })));
+ await expect
+ .element(page.getByRole('button', { exact: true, name: 'Dynamics' }))
+ .toHaveAttribute('aria-expanded', 'true');
+
+ await act(() => root?.unmount());
+ await mount(PropertiesPane);
+ await act(() => engine!.tools.setTool('brush'));
+ await settle();
+ await expect
+ .element(page.getByRole('button', { exact: true, name: 'Dynamics' }))
+ .toHaveAttribute('aria-expanded', 'true');
+ // The override reached storage, not just the in-memory store.
+ expect(JSON.parse(window.localStorage.getItem('invokeai:v7:webv2:tool-property-collapsed') ?? '{}')).toMatchObject({
+ 'paint-dynamics': false,
+ });
+ });
+
it('keeps the Tool section mounted with stable geometry across every tool switch', async () => {
await mount(PropertiesPane);
await act(() => engine!.tools.setTool('brush'));
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 ffd2a69efc..c1b9607d2b 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/PropertiesPane.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/PropertiesPane.tsx
@@ -2,8 +2,10 @@ import { Flex, Stack, Text } 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,
+ isToolPropertyForm,
OPERATION_PRESENTATION_ADAPTERS,
TOOL_PRESENTATION_ADAPTERS,
} from '@workbench/widgets/canvas/tool-presentation/toolAdapters';
@@ -65,15 +67,18 @@ const ConnectedProperties = ({
const running = operation.status === 'active' ? OPERATION_PRESENTATION_ADAPTERS[operation.identity.kind] : null;
const tool = TOOL_PRESENTATION_ADAPTERS[activeTool];
const toolName = t(`widgets.canvas.tools.${tool.id}`);
- const ToolStatus = tool.status;
+ const form = isToolPropertyForm(tool) ? tool : null;
+ const legacy = isToolPropertyForm(tool) ? null : tool;
+ const ToolStatus = legacy?.status;
+ const Preview = form?.preview;
const regionProps = { engine, isSurfaceInteractionLocked };
const rows = (
[
- ['geometry', tool.geometry],
- ['intensity', tool.intensity],
- ['modes', tool.modes],
- ['color', tool.color],
- ['more', tool.more],
+ ['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]);
@@ -107,11 +112,22 @@ const ConnectedProperties = ({
title={t('widgets.properties.sections.tool')}
>
{tool.paintsLeaf && !running ? <GroupSelectedNotice /> : null}
- {hasToolRegions(tool) ? (
+ {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={`${tool.id}:${region}`}
- label={t(tool.rowLabels?.[region] ?? REGION_LABEL_KEYS[region])}
+ key={`${legacy.id}:${region}`}
+ label={t(legacy.rowLabels?.[region] ?? REGION_LABEL_KEYS[region])}
>
<Region {...regionProps} />
</PropertiesRow>