-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathstyle.scss
401 lines (337 loc) · 9.11 KB
/
style.scss
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
/**
* Insertion Point.
*/
.block-editor-block-list__insertion-point {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.block-editor-block-list__insertion-point-indicator {
position: absolute;
background: var(--wp-admin-theme-color);
border-radius: 2px;
transform-origin: center;
opacity: 0;
will-change: transform, opacity;
.block-editor-block-list__insertion-point.is-vertical > & {
top: calc(50% - 2px);
height: 4px;
width: 100%;
}
.block-editor-block-list__insertion-point.is-horizontal > & {
top: 0;
bottom: 0;
left: calc(50% - 2px);
width: 4px;
}
}
// This is the clickable plus.
.block-editor-block-list__insertion-point-inserter {
// Don't show on mobile.
display: none;
position: absolute;
will-change: transform;
@include break-mobile() {
display: flex;
}
justify-content: center;
top: calc(50% - #{$button-size-small * 0.5});
left: calc(50% - #{$button-size-small * 0.5});
}
.block-editor-block-list__block-side-inserter-popover .components-popover__content > div {
pointer-events: none;
> * {
pointer-events: all;
}
}
// Sibling inserter / "inbetweenserter".
.block-editor-block-list__empty-block-inserter,
.block-editor-block-list__insertion-point-inserter {
.block-editor-inserter__toggle.components-button.has-icon {
// Basic look
background: $gray-900;
border-radius: $radius-block-ui;
color: $white;
padding: 0;
// Special dimensions for this button.
min-width: $button-size-small;
height: $button-size-small;
&:hover {
color: $white;
background: var(--wp-admin-theme-color);
}
}
}
.block-editor-block-list__insertion-point-inserter .block-editor-inserter__toggle.components-button.has-icon {
background: var(--wp-admin-theme-color);
&:hover {
background: $gray-900;
}
}
/**
* Block Toolbar when contextual.
*/
// Base left position for the toolbar when fixed.
@include editor-left(".block-editor-block-contextual-toolbar.is-fixed");
.block-editor-block-contextual-toolbar {
// Block UI appearance.
display: inline-flex;
border: $border-width solid $gray-900;
border-radius: $radius-block-ui;
background-color: $white;
.block-editor-block-toolbar .components-toolbar-group,
.block-editor-block-toolbar .components-toolbar {
border-right-color: $gray-900;
}
&.is-fixed {
position: sticky;
top: 0;
z-index: z-index(".block-editor-block-popover");
display: block;
width: 100%;
border: none;
border-bottom: $border-width solid $gray-200;
border-radius: 0;
.block-editor-block-toolbar .components-toolbar-group,
.block-editor-block-toolbar .components-toolbar {
border-right-color: $gray-200;
}
}
// on desktop and tablet viewports the toolbar is fixed
// on top of interface header
@include break-medium() {
&.is-fixed {
// leave room for block inserter
margin-left: $grid-unit-80;
// position on top of interface header
position: fixed;
top: $admin-bar-height + $grid-unit;
// Don't fill up when empty
min-height: initial;
// remove the border
border-bottom: none;
// has to be flex for collapse button to fit
display: flex;
&.is-collapsed {
width: initial;
margin-left: $grid-unit-80 * 3 + $grid-unit-30;
}
.is-fullscreen-mode & {
// leave room for block inserter
margin-left: $grid-unit-80 + $grid-unit-70;
top: $grid-unit;
&.is-collapsed {
width: initial;
margin-left: $grid-unit-80 * 4 + $grid-unit-30;
}
}
& > .block-editor-block-toolbar__group-collapse-fixed-toolbar {
border: none;
// Add a border as separator in the block toolbar.
&::after {
content: "";
width: $border-width;
height: 24px;
margin-top: $grid-unit + $grid-unit-05;
margin-bottom: $grid-unit + $grid-unit-05;
background-color: $gray-300;
position: absolute;
left: 44px;
top: -1px;
}
}
& > .block-editor-block-toolbar__group-expand-fixed-toolbar {
border: none;
// Add a border as separator in the block toolbar.
&::before {
content: "";
width: $border-width;
margin-top: $grid-unit + $grid-unit-05;
margin-bottom: $grid-unit + $grid-unit-05;
background-color: $gray-300;
position: relative;
left: -12px; //the padding of buttons
height: 24px;
}
}
.show-icon-labels & {
margin-left: $grid-unit-80;
&.is-collapsed {
margin-left: $grid-unit-80 * 6;
}
.is-fullscreen-mode & {
margin-left: $grid-unit-80 + $grid-unit-80;
&.is-collapsed {
margin-left: $grid-unit-80 * 7;
}
}
.block-editor-block-parent-selector .block-editor-block-parent-selector__button::after {
left: 0;
}
.block-editor-block-toolbar__block-controls .block-editor-block-mover {
border-left: none;
&::before {
content: "";
width: $border-width;
margin-top: $grid-unit + $grid-unit-05;
margin-bottom: $grid-unit + $grid-unit-05;
background-color: $gray-300;
position: relative;
}
}
}
.blocks-widgets-container & {
margin-left: $grid-unit-80 * 2.4;
&.is-collapsed {
margin-left: $grid-unit-80 * 4.2;
}
}
}
&.is-fixed .block-editor-block-parent-selector {
.block-editor-block-parent-selector__button {
position: relative;
top: -1px;
border: 0;
padding-right: 6px;
padding-left: 6px;
&::after {
content: "\00B7";
font-size: 16px;
line-height: $grid-unit-40 + $grid-unit-10;
position: absolute;
left: $grid-unit-40 + $grid-unit-15 + 2px;
bottom: $grid-unit-05;
}
}
}
&:not(.is-fixed) .block-editor-block-parent-selector {
position: absolute;
top: -$border-width;
left: calc(-#{$grid-unit-60} - #{$grid-unit-10} - #{$border-width});
.show-icon-labels & {
position: relative;
left: auto;
top: auto;
margin-top: -$border-width;
margin-left: -$border-width;
margin-bottom: -$border-width;
}
}
}
// on tablet vewports the toolbar is fixed
// on top of interface header and covers the whole header
// except for the inserter on the left
@include break-medium() {
&.is-fixed {
width: 100%;
}
}
// on desktop viewports the toolbar is fixed
// on top of interface header and leaves room
// for the block inserter the publish button
@include break-large() {
&.is-fixed {
width: initial;
}
}
}
/**
* Block Label for Navigation/Selection Mode
*/
.block-editor-block-list__block-selection-button {
display: inline-flex;
padding: 0 $grid-unit-15;
z-index: z-index(".block-editor-block-list__block-selection-button");
// Dark block UI appearance.
border-radius: $radius-block-ui;
background-color: $gray-900;
font-size: $default-font-size;
height: $block-toolbar-height;
.block-editor-block-list__block-selection-button__content {
margin: auto;
display: inline-flex;
align-items: center;
> .components-flex__item {
margin-right: $grid-unit-15 * 0.5;
}
}
.components-button.has-icon.block-selection-button_drag-handle {
cursor: grab;
padding: 0;
height: $grid-unit-30;
min-width: $grid-unit-30;
margin-left: -2px;
// Drag handle is smaller than the others.
svg {
min-width: 18px;
min-height: 18px;
}
}
.block-editor-block-icon {
font-size: $default-font-size;
color: $white;
height: $block-toolbar-height;
}
// The button here has a special style to appear as a toolbar.
.components-button {
min-width: $button-size;
color: $white;
height: $block-toolbar-height;
// When button is focused, it receives a box-shadow instead of the border.
&:focus {
box-shadow: none;
border: none;
}
&:active {
color: $white;
}
// Make sure the button has no hover style when it's disabled.
&[aria-disabled="true"]:hover {
color: $white;
}
display: flex;
}
.block-selection-button_select-button.components-button {
padding: 0;
}
.block-editor-block-mover {
background: unset;
border: none;
}
}
// Hide the popover block editor list while dragging.
// Using a hacky animation to delay hiding the element.
// It's needed because if we hide the element immediately upon dragging,
// the dragging will end immediately since there are no elements to be dragged anymore.
// Fortunately, we only have to keep it visible for a frame immediately after dragging,
// after that, we can safely hide it altogether.
@keyframes hide-during-dragging {
to {
position: fixed;
transform: translate(9999px, 9999px);
}
}
.components-popover.block-editor-block-list__block-popover {
// Position the block toolbar.
.block-editor-block-list__block-selection-button,
.block-editor-block-contextual-toolbar {
pointer-events: all;
margin-top: $grid-unit-15;
margin-bottom: $grid-unit-15;
}
// Hide the block toolbar if the insertion point is shown.
&.is-insertion-point-visible {
visibility: hidden;
}
.is-dragging-components-draggable & {
opacity: 0;
// Use a minimal duration to delay hiding the element, see hide-during-dragging animation for more details.
// It's essential to hide the toolbar/popover so that `dragEnter` events can pass through them to the underlying elements.
animation: hide-during-dragging 1ms linear forwards;
}
}
.is-dragging-components-draggable .components-tooltip {
display: none;
}