forked from riccardoperra/codeimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFrame.css.ts
More file actions
211 lines (196 loc) · 4.8 KB
/
Copy pathFrame.css.ts
File metadata and controls
211 lines (196 loc) · 4.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
import {backgroundColorVar, themeVars, withThemeMode} from '@codeimage/ui';
import {themeTokens} from '@codeui/kit';
import {createTheme, style} from '@vanilla-extract/css';
export const [frame, frameVars] = createTheme({
backgroundColor: backgroundColorVar,
radius: themeVars.borderRadius.lg,
padding: '128px',
opacity: '100%',
visibility: 'visible',
width: 'auto',
height: 'auto',
minWidth: 'max-content',
minHeight: '100%',
maxWidth: '1920px',
controlHandleSize: '24px',
controlHandleColor: '',
resizeLineBadgeBackgroundColor: '',
resizeLineBackgroundColor: '',
controlOffset: '0px',
aspectRatio: 'auto',
});
export const wrapper = style([
frame,
{
position: 'relative',
selectors: {
...withThemeMode({
dark: {
vars: {
[frameVars.resizeLineBadgeBackgroundColor]: '#161515',
[frameVars.resizeLineBackgroundColor]: 'hsla(0,0%,100%,.25)',
[frameVars.controlHandleColor]: '#EEEEEE',
},
},
light: {
vars: {
[frameVars.resizeLineBackgroundColor]:
themeVars.backgroundColor.black,
[frameVars.resizeLineBadgeBackgroundColor]:
themeVars.backgroundColor.black,
[frameVars.controlHandleColor]: themeVars.backgroundColor.black,
},
},
}),
},
},
]);
export const previewWrapper = style([
frame,
{
zIndex: -999,
},
]);
export const previewPortal = style({
position: 'fixed',
left: 0,
top: 0,
zIndex: -999,
width: 'auto',
height: 'auto',
opacity: 0,
transformOrigin: 'left top',
selectors: {
'&[data-dev-mode]': {
opacity: 1,
zIndex: 999,
zoom: '50%',
},
},
':after': {
content: 'Debug preview',
position: 'absolute',
left: 0,
top: 0,
zIndex: 999,
borderRadius: themeTokens.radii.md,
padding: themeTokens.spacing['2'],
backgroundColor: '#333',
color: 'white',
margin: themeTokens.spacing['1'],
},
});
export const container = style([
{
width: frameVars.width,
height: frameVars.height,
maxWidth: frameVars.maxWidth,
minWidth: frameVars.minWidth,
minHeight: frameVars.minHeight,
position: 'relative',
borderRadius: frameVars.radius,
padding: frameVars.padding,
zIndex: 1,
boxSizing: 'border-box',
userSelect: 'none',
transition: 'background-color .2s, padding .2s, border-radius .2s',
display: 'grid',
flexDirection: 'column',
alignItems: 'center',
},
]);
export const overlay = style({
position: 'absolute',
left: 0,
top: 0,
background: frameVars.backgroundColor,
opacity: frameVars.opacity,
visibility: frameVars.visibility,
height: '100%',
width: '100%',
borderRadius: 'inherit',
overflow: 'hidden',
});
export const previewOverlay = style([overlay, {borderRadius: 0}]);
export const dragControls = style({
position: 'absolute',
left: 0,
top: 0,
width: '100%',
height: '100%',
});
export const dragControlHandler = style({
vars: {
[frameVars.controlOffset]: `calc(${frameVars.controlHandleSize} / 2 * -1)`,
},
selectors: {
[`${dragControls} &`]: {
position: 'absolute',
top: '50%',
transform: 'translateY(-50%)',
zIndex: 10,
cursor: 'ew-resize',
width: frameVars.controlHandleSize,
height: frameVars.controlHandleSize,
},
'&:hover::after': {
transform: 'translate(-50%, -50%) scale(2)',
},
},
'::after': {
content: '',
position: 'absolute',
left: '50%',
top: '50%',
width: '8px',
height: '8px',
borderRadius: themeVars.borderRadius.lg,
boxShadow: themeVars.boxShadow.lg,
transform: 'translate(-50%, -50%)',
backgroundColor: frameVars.controlHandleColor,
transition: 'transform .1s ease',
},
});
export const dragControlLeft = style([
dragControlHandler,
{left: frameVars.controlOffset},
]);
export const dragControlRight = style([
dragControlHandler,
{right: frameVars.controlOffset},
]);
export const resizeLine = style({
position: 'absolute',
bottom: -25,
width: '100%',
height: '15px',
borderLeft: `1px solid ${frameVars.resizeLineBackgroundColor}`,
borderRight: `1px solid ${frameVars.resizeLineBackgroundColor}`,
display: 'flex',
});
export const resizeBadge = style([
{
borderRadius: themeVars.borderRadius.lg,
padding: '0 1em',
display: 'inline-block',
fontSize: '12px',
backgroundColor: frameVars.resizeLineBadgeBackgroundColor,
color: 'white',
alignItems: 'center',
margin: 'auto',
zIndex: 10,
},
]);
export const resizeLineDivider = style({
position: 'absolute',
borderColor: frameVars.resizeLineBackgroundColor,
left: 0,
top: '50%',
width: '100%',
transform: 'transformY(50%)',
});
export const watermark = style({
position: 'absolute',
right: '32px',
bottom: '24px',
});