@@ -11,6 +11,16 @@ import type { Atom } from 'nanostores';
11
11
import { atom , effect } from 'nanostores' ;
12
12
import type { Logger } from 'roarr' ;
13
13
14
+ // Theme-consistent spacing constants (in pixels)
15
+ const SPACING_2 = 8 ; // Equivalent to theme token 2
16
+ const SPACING_4 = 16 ; // Equivalent to theme token 4
17
+ const SPACING_8 = 32 ; // Equivalent to theme token 8
18
+ const BORDER_RADIUS_BASE = 6 ; // Equivalent to theme borderRadius "base"
19
+ const BORDER_WIDTH = 1 ; // Standard border width
20
+ const FONT_SIZE_SM = 14 ; // Equivalent to theme fontSize "sm"
21
+ const BADGE_MIN_WIDTH = 200 ;
22
+ const BADGE_HEIGHT = 36 ;
23
+
14
24
type ImageNameSrc = { type : 'imageName' ; data : string } ;
15
25
type DataURLSrc = { type : 'dataURL' ; data : string } ;
16
26
@@ -74,28 +84,28 @@ export class CanvasStagingAreaModule extends CanvasModuleBase {
74
84
badgeBg : new Konva . Rect ( {
75
85
name : `${ this . type } :placeholder_badge_bg` ,
76
86
fill : 'hsl(220 12% 10% / 0.8)' , // 'base.900' with opacity
77
- x : 6 ,
78
- y : 6 ,
79
- width : Math . min ( 204 , width - 12 ) ,
80
- height : 36 ,
81
- cornerRadius : 6 ,
87
+ x : SPACING_2 - 2 , // Slight offset for visual balance
88
+ y : SPACING_2 - 2 ,
89
+ width : Math . min ( BADGE_MIN_WIDTH + 4 , width - ( SPACING_2 * 2 ) + 4 ) ,
90
+ height : BADGE_HEIGHT ,
91
+ cornerRadius : BORDER_RADIUS_BASE ,
82
92
stroke : 'hsl(220 12% 50% / 1)' , // 'base.700'
83
- strokeWidth : 1 ,
93
+ strokeWidth : BORDER_WIDTH ,
84
94
listening : false ,
85
95
perfectDrawEnabled : false ,
86
96
} ) ,
87
97
text : new Konva . Text ( {
88
98
name : `${ this . type } :placeholder_text` ,
89
99
fill : 'hsl(220 12% 80% / 1)' , // 'base.300'
90
- x : 8 ,
91
- y : 8 ,
92
- width : Math . min ( 200 , width - 16 ) ,
93
- height : 32 ,
100
+ x : SPACING_2 ,
101
+ y : SPACING_2 ,
102
+ width : Math . min ( BADGE_MIN_WIDTH , width - SPACING_4 ) ,
103
+ height : SPACING_8 ,
94
104
align : 'center' ,
95
105
verticalAlign : 'middle' ,
96
106
fontFamily : '"Inter Variable", sans-serif' ,
97
- fontSize : 14 ,
98
- fontStyle : '600' ,
107
+ fontSize : FONT_SIZE_SM ,
108
+ fontStyle : '600' , // Equivalent to theme fontWeight "semibold"
99
109
text : 'Waiting for Image' ,
100
110
listening : false ,
101
111
perfectDrawEnabled : false ,
@@ -141,8 +151,8 @@ export class CanvasStagingAreaModule extends CanvasModuleBase {
141
151
const { width, height } = this . manager . stateApi . getBbox ( ) . rect ;
142
152
this . konva . placeholder . rect . width ( width ) ;
143
153
this . konva . placeholder . rect . height ( height ) ;
144
- this . konva . placeholder . badgeBg . width ( Math . min ( 204 , width - 12 ) ) ;
145
- this . konva . placeholder . text . width ( Math . min ( 200 , width - 16 ) ) ;
154
+ this . konva . placeholder . badgeBg . width ( Math . min ( BADGE_MIN_WIDTH + 4 , width - ( SPACING_2 * 2 ) + 4 ) ) ;
155
+ this . konva . placeholder . text . width ( Math . min ( BADGE_MIN_WIDTH , width - SPACING_4 ) ) ;
146
156
} ;
147
157
148
158
initialize = ( ) => {
0 commit comments