diff --git a/src/main.ts b/src/main.ts
index c1b8026..fe237f3 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -10,5 +10,23 @@ export default function () {
figma.ui.resize(width, height)
})
+ // Эмуляция докинга: прижать окно плагина к краям canvas (left/right/center).
+ // reposition() принимает canvas-space координаты (как figma.viewport.center).
+ // Ширину панелей Figma API не отдаёт, поэтому прижимаем к bounds видимой области.
+ on('DOCK_WINDOW', function (payload: { position: 'left' | 'right' | 'center'; width: number; height: number }) {
+ const { position, width, height } = payload
+ figma.ui.resize(width, height)
+ const b = figma.viewport.bounds
+ let x = b.x
+ let y = b.y
+ if (position === 'right') {
+ x = b.x + b.width - width
+ } else if (position === 'center') {
+ x = b.x + (b.width - width) / 2
+ y = b.y + (b.height - height) / 2
+ }
+ figma.ui.reposition(x, y)
+ })
+
showUI({ width: 320, height: 200, themeColors: true, title: 'AI assistant (MVP)' })
}
diff --git a/src/ui.tsx b/src/ui.tsx
index fe80e97..3bf4e18 100644
--- a/src/ui.tsx
+++ b/src/ui.tsx
@@ -4,6 +4,7 @@ import {
Text,
Muted,
VerticalSpace,
+ Button,
IconButton,
IconExpand24,
IconCollapse24,
@@ -58,6 +59,14 @@ function Plugin () {
emit('RESIZE_WINDOW', next)
}
+ function dockWindow (position: 'left' | 'right' | 'center') {
+ emit('DOCK_WINDOW', {
+ position,
+ width: currentWindowSize.width,
+ height: currentWindowSize.height
+ })
+ }
+
const isMaximized =
currentWindowSize.width >= MAX_WINDOW_SIZE.width &&
currentWindowSize.height >= MAX_WINDOW_SIZE.height
@@ -74,6 +83,11 @@ function Plugin () {
{isMaximized ?