summaryrefslogtreecommitdiffstats
path: root/comm/mail/themes/shared/mail/splitter.css
blob: efc190269131b459a92629a6c4b8a87d4b308db3 (plain)
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
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* PaneSplitter / pane-splitter elements */

hr[is="pane-splitter"] {
  margin: 0;
  --splitter-z-index: 1;
  z-index: var(--splitter-z-index);
  /* Make sure border-box's height and width remain the same when we grow or
   * shrink the border width. */
  box-sizing: border-box;
  /* We use a default border-style of none so we can set a border width and
   * color without it producing a border on all sides. */
  border-style: none;
  /* The defining sizes of the splitter:
   * + content-size: The dimension for the clickable area of the splitter.
   * + occupy-size: The amount of space the splitter should occupy in the
   *   layout.
   */
  --splitter-content-size: 5px;
  --splitter-occupy-size: 1px;
  --splitter-margin-size: calc(var(--splitter-occupy-size) - var(--splitter-content-size));
  border-width: var(--splitter-occupy-size);
  border-color: var(--splitter-color);
}

hr[is="pane-splitter"]:not([resize-direction="horizontal"]):not(.splitter-before) {
  height: var(--splitter-content-size);
  border-block-start-style: solid;
  margin-block-end: var(--splitter-margin-size);
}

hr[is="pane-splitter"]:not([resize-direction="horizontal"]).splitter-before {
  height: var(--splitter-content-size);
  border-block-end-style: solid;
  margin-block-start: var(--splitter-margin-size);
}

hr[is="pane-splitter"][resize-direction="horizontal"]:not(.splitter-before) {
  width: var(--splitter-content-size);
  border-inline-start-style: solid;
  margin-inline-end: var(--splitter-margin-size);
}

hr[is="pane-splitter"][resize-direction="horizontal"].splitter-before {
  width: var(--splitter-content-size);
  border-inline-end-style: solid;
  margin-inline-start: var(--splitter-margin-size);
}

/* Collapsed splitters. */

hr[is="pane-splitter"].splitter-collapsed {
  /* Occupy zero space. */
  --splitter-occupy-size: 0px;
  /* Make sure we appear above other splitters. */
  z-index: calc(var(--splitter-z-index) + 1);
}

hr[is="pane-splitter"]::after {
  /* We create a pseudo-element that occupies the splitter content. We will only
   * show this when the splitter is collapsed and being resized or hovered. */
  background-color: var(--selected-item-color);
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  /* We hide this element with scaleY(0) or scaleX(0) so we can smoothly
   * grow the element between the hidden and full-height or full-width
   * states. */
  transform: scaleY(0);
}

hr[is="pane-splitter"]:not(.splitter-before)::after {
  /* Grow top-to-bottom. */
  transform-origin: top;
}

hr[is="pane-splitter"].splitter-before::after {
  transform-origin: bottom;
}

hr[is="pane-splitter"][resize-direction="horizontal"]::after {
  /* Grow left-to-right or right-to-left instead. */
  transform: scaleX(0);
}

hr[is="pane-splitter"][resize-direction="horizontal"]:is(
  :not(.splitter-before):dir(ltr),
  .splitter-before:dir(rtl)
)::after {
  transform-origin: left;
}

hr[is="pane-splitter"][resize-direction="horizontal"]:is(
  .splitter-before:dir(ltr),
  :not(.splitter-before):dir(rtl)
)::after {
  transform-origin: right;
}

hr[is="pane-splitter"]:not([disabled]).splitter-collapsed:is(
  :hover,
  .splitter-resizing
)::after {
  /* Grow to full height. */
  transform: scaleY(1);
}

hr[is="pane-splitter"][resize-direction="horizontal"]:not([disabled]).splitter-collapsed:is(
  :hover,
  .splitter-resizing
)::after {
  /* Grow to full width. */
  transform: scaleX(1);
}

@media (prefers-reduced-motion: no-preference) {
  /* NOTE: We only show a smooth transition from scale 0 to scale 1, or
   * vice versa, whilst the splitter is collapsed. In particular, we do *not*
   * want a smooth transition when we switch from collapsed to not collapsed: in
   * this case we want to immediately shrink back to zero size. In contrast, the
   * switch from not collapsed to collapsed whilst dragging *is* a smooth
   * transition. */
  hr[is="pane-splitter"].splitter-collapsed::after {
    transition: transform 200ms ease;
  }
}

/* Splitter cursors. */

hr[is="pane-splitter"]:not([disabled]) {
  cursor: ns-resize;
}

hr[is="pane-splitter"]:not([disabled]).splitter-collapsed:not(.splitter-before) {
  cursor: s-resize;
}

hr[is="pane-splitter"]:not([disabled]).splitter-collapsed.splitter-before {
  cursor: n-resize;
}

hr[is="pane-splitter"][resize-direction="horizontal"]:not([disabled]) {
  cursor: ew-resize;
}

hr[is="pane-splitter"][resize-direction="horizontal"]:not([disabled]).splitter-collapsed:is(
  .splitter-before:dir(ltr),
  :not(.splitter-before):dir(rtl)
) {
  cursor: w-resize;
}

hr[is="pane-splitter"][resize-direction="horizontal"]:not([disabled]).splitter-collapsed:is(
  :not(.splitter-before):dir(ltr),
  .splitter-before:dir(rtl)
) {
  cursor: e-resize;
}