@guildofgleks/ui 21.7.2 → 21.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +155 -11
- package/CHANGELOG.md +407 -0
- package/README.md +24 -3
- package/TOKENS.md +49 -47
- package/fesm2022/guildofgleks-ui.mjs +345 -48
- package/fesm2022/guildofgleks-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/styles/button.css +165 -0
- package/styles/menu.css +120 -114
- package/styles/presets/bevel.css +87 -82
- package/styles/presets/material.css +122 -111
- package/styles/presets/one-dark.css +14 -2
- package/styles/presets/one-light.css +17 -4
- package/styles/presets/primeng.css +139 -121
- package/styles/presets/slate.css +17 -4
- package/styles/theme.css +447 -94
- package/types/guildofgleks-ui.d.ts +248 -20
package/package.json
CHANGED
package/styles/button.css
CHANGED
|
@@ -96,15 +96,59 @@
|
|
|
96
96
|
);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
/*
|
|
100
|
+
* The held state. It changes colour *and* scales, and the colour is the part that matters:
|
|
101
|
+
* `prefers-reduced-motion` switches the transform off below, and until 21.9.0 that was the whole
|
|
102
|
+
* rule — so a reader with animations off pressed a button and nothing whatsoever happened. The
|
|
103
|
+
* ripple does not cover it either: it is off by default and is itself suppressed under reduced
|
|
104
|
+
* motion, deliberately, because it really is decoration. A colour change is not.
|
|
105
|
+
*
|
|
106
|
+
* This sits after `:hover` on purpose. Both are (0,3,0), so source order decides, and a pointer
|
|
107
|
+
* is nearly always hovering the button it is pressing — the press has to win that tie or it is
|
|
108
|
+
* invisible exactly when it is happening.
|
|
109
|
+
*/
|
|
99
110
|
.gog-btn:active:not(:disabled) {
|
|
111
|
+
background-color: var(
|
|
112
|
+
--gog-button-press-bg,
|
|
113
|
+
var(--gog-button-variant-press-bg, var(--gog-button-primary-press-bg))
|
|
114
|
+
);
|
|
115
|
+
color: var(
|
|
116
|
+
--gog-button-press-color,
|
|
117
|
+
var(--gog-button-variant-press-color, var(--gog-button-primary-press-color))
|
|
118
|
+
);
|
|
100
119
|
transform: scale(var(--gog-button-active-scale));
|
|
101
120
|
}
|
|
102
121
|
|
|
122
|
+
/*
|
|
123
|
+
* A toggle button that is on, and the only state here that persists rather than tracking the
|
|
124
|
+
* pointer. It therefore has to survive the ones that do not: `:hover` and `:active` both own the
|
|
125
|
+
* background, so a ring is what is left that they cannot paint over. Last of the state rules and
|
|
126
|
+
* (0,3,0) like them, so it wins the tie by source order — a toggled button that loses its ring
|
|
127
|
+
* the moment the pointer arrives would announce `aria-pressed="true"` and show nothing, which is
|
|
128
|
+
* the WCAG 1.4.1 failure this rule exists to prevent.
|
|
129
|
+
*
|
|
130
|
+
* `mixed` is styled like `true`: a partially-checked toggle is on for the purpose of "does this
|
|
131
|
+
* look different from off".
|
|
132
|
+
*
|
|
133
|
+
* This matches `[gogButton]` on a consumer's own element too, which is the whole reason it keys
|
|
134
|
+
* off the attribute rather than an input — the directive styles markup you own, so you write
|
|
135
|
+
* `aria-pressed` there yourself and get the look for free.
|
|
136
|
+
*/
|
|
137
|
+
.gog-btn[aria-pressed='true']:not(:disabled),
|
|
138
|
+
.gog-btn[aria-pressed='mixed']:not(:disabled) {
|
|
139
|
+
box-shadow: var(
|
|
140
|
+
--gog-button-toggled-shadow,
|
|
141
|
+
var(--gog-button-variant-toggled-shadow, var(--gog-button-primary-toggled-shadow))
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
103
145
|
@media (prefers-reduced-motion: reduce) {
|
|
104
146
|
.gog-btn {
|
|
105
147
|
transition: none;
|
|
106
148
|
}
|
|
107
149
|
|
|
150
|
+
/* Only the movement goes. The colour above stays, and with the transition off it lands on the
|
|
151
|
+
first frame of the press instead of easing in. */
|
|
108
152
|
.gog-btn:active:not(:disabled) {
|
|
109
153
|
transform: none;
|
|
110
154
|
}
|
|
@@ -126,6 +170,9 @@
|
|
|
126
170
|
--gog-button-variant-hover-bg: var(--gog-button-primary-hover-bg);
|
|
127
171
|
--gog-button-variant-hover-color: var(--gog-button-primary-hover-color);
|
|
128
172
|
--gog-button-variant-hover-shadow: var(--gog-button-primary-hover-shadow);
|
|
173
|
+
--gog-button-variant-toggled-shadow: var(--gog-button-primary-toggled-shadow);
|
|
174
|
+
--gog-button-variant-press-bg: var(--gog-button-primary-press-bg);
|
|
175
|
+
--gog-button-variant-press-color: var(--gog-button-primary-press-color);
|
|
129
176
|
--gog-button-variant-spinner-color: var(--gog-button-primary-spinner-color);
|
|
130
177
|
}
|
|
131
178
|
|
|
@@ -137,6 +184,9 @@
|
|
|
137
184
|
--gog-button-variant-hover-bg: var(--gog-button-secondary-hover-bg);
|
|
138
185
|
--gog-button-variant-hover-color: var(--gog-button-secondary-hover-color);
|
|
139
186
|
--gog-button-variant-hover-shadow: var(--gog-button-secondary-hover-shadow);
|
|
187
|
+
--gog-button-variant-toggled-shadow: var(--gog-button-secondary-toggled-shadow);
|
|
188
|
+
--gog-button-variant-press-bg: var(--gog-button-secondary-press-bg);
|
|
189
|
+
--gog-button-variant-press-color: var(--gog-button-secondary-press-color);
|
|
140
190
|
--gog-button-variant-spinner-color: var(--gog-button-secondary-spinner-color);
|
|
141
191
|
}
|
|
142
192
|
|
|
@@ -149,6 +199,9 @@
|
|
|
149
199
|
--gog-button-variant-hover-bg: var(--gog-button-outline-hover-bg);
|
|
150
200
|
--gog-button-variant-hover-color: var(--gog-button-outline-hover-color);
|
|
151
201
|
--gog-button-variant-hover-shadow: var(--gog-button-outline-hover-shadow);
|
|
202
|
+
--gog-button-variant-toggled-shadow: var(--gog-button-outline-toggled-shadow);
|
|
203
|
+
--gog-button-variant-press-bg: var(--gog-button-outline-press-bg);
|
|
204
|
+
--gog-button-variant-press-color: var(--gog-button-outline-press-color);
|
|
152
205
|
--gog-button-variant-spinner-color: var(--gog-button-outline-spinner-color);
|
|
153
206
|
}
|
|
154
207
|
|
|
@@ -161,9 +214,121 @@
|
|
|
161
214
|
--gog-button-variant-hover-bg: var(--gog-button-ghost-hover-bg);
|
|
162
215
|
--gog-button-variant-hover-color: var(--gog-button-ghost-hover-color);
|
|
163
216
|
--gog-button-variant-hover-shadow: var(--gog-button-ghost-hover-shadow);
|
|
217
|
+
--gog-button-variant-toggled-shadow: var(--gog-button-ghost-toggled-shadow);
|
|
218
|
+
--gog-button-variant-press-bg: var(--gog-button-ghost-press-bg);
|
|
219
|
+
--gog-button-variant-press-color: var(--gog-button-ghost-press-color);
|
|
164
220
|
--gog-button-variant-spinner-color: var(--gog-button-ghost-spinner-color);
|
|
165
221
|
}
|
|
166
222
|
|
|
223
|
+
/* === Severity ===
|
|
224
|
+
*
|
|
225
|
+
* `severity` is orthogonal to `variant` — a destructive action can be filled, outlined or a
|
|
226
|
+
* ghost and is destructive in all three — so these do not add a fifth variant. They re-point the
|
|
227
|
+
* `--gog-button-variant-*` layer the variant classes above set, and they come *after* those
|
|
228
|
+
* classes so the tie is decided by source order where specificity allows it.
|
|
229
|
+
*
|
|
230
|
+
* Two halves. The severity class carries only the ingredients (`--gog-button-severity-*`, from
|
|
231
|
+
* the per-severity tokens in theme.css); the shape rules below say what a variant does with
|
|
232
|
+
* them, once each rather than once per severity. Four plus three blocks instead of sixteen, and
|
|
233
|
+
* a fifth status colour would be one more block rather than four.
|
|
234
|
+
*
|
|
235
|
+
* The shape rules are `(0,2,0)` through the doubled `:is()`, which is what puts them above the
|
|
236
|
+
* `(0,1,0)` variant classes regardless of the order the two classes appear in on the element.
|
|
237
|
+
*/
|
|
238
|
+
.gog-btn--success {
|
|
239
|
+
--gog-button-severity-fill: var(--gog-button-success-fill);
|
|
240
|
+
--gog-button-severity-on-fill: var(--gog-button-success-on-fill);
|
|
241
|
+
--gog-button-severity-fill-hover: var(--gog-button-success-fill-hover);
|
|
242
|
+
--gog-button-severity-fill-press: var(--gog-button-success-fill-press);
|
|
243
|
+
--gog-button-severity-ink: var(--gog-button-success-ink);
|
|
244
|
+
--gog-button-severity-wash: var(--gog-button-success-wash);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.gog-btn--danger {
|
|
248
|
+
--gog-button-severity-fill: var(--gog-button-danger-fill);
|
|
249
|
+
--gog-button-severity-on-fill: var(--gog-button-danger-on-fill);
|
|
250
|
+
--gog-button-severity-fill-hover: var(--gog-button-danger-fill-hover);
|
|
251
|
+
--gog-button-severity-fill-press: var(--gog-button-danger-fill-press);
|
|
252
|
+
--gog-button-severity-ink: var(--gog-button-danger-ink);
|
|
253
|
+
--gog-button-severity-wash: var(--gog-button-danger-wash);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.gog-btn--warning {
|
|
257
|
+
--gog-button-severity-fill: var(--gog-button-warning-fill);
|
|
258
|
+
--gog-button-severity-on-fill: var(--gog-button-warning-on-fill);
|
|
259
|
+
--gog-button-severity-fill-hover: var(--gog-button-warning-fill-hover);
|
|
260
|
+
--gog-button-severity-fill-press: var(--gog-button-warning-fill-press);
|
|
261
|
+
--gog-button-severity-ink: var(--gog-button-warning-ink);
|
|
262
|
+
--gog-button-severity-wash: var(--gog-button-warning-wash);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.gog-btn--info {
|
|
266
|
+
--gog-button-severity-fill: var(--gog-button-info-fill);
|
|
267
|
+
--gog-button-severity-on-fill: var(--gog-button-info-on-fill);
|
|
268
|
+
--gog-button-severity-fill-hover: var(--gog-button-info-fill-hover);
|
|
269
|
+
--gog-button-severity-fill-press: var(--gog-button-info-fill-press);
|
|
270
|
+
--gog-button-severity-ink: var(--gog-button-info-ink);
|
|
271
|
+
--gog-button-severity-wash: var(--gog-button-info-wash);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/* The two filled variants: the status colour is the fill, and the label is the one that reads
|
|
275
|
+
on it. `secondary` loses its own neutral fill here, which is the point — a severity says what
|
|
276
|
+
the action does, and the variant is left saying only how loud it is. */
|
|
277
|
+
:is(.gog-btn--success, .gog-btn--danger, .gog-btn--warning, .gog-btn--info):is(
|
|
278
|
+
.gog-btn--primary,
|
|
279
|
+
.gog-btn--secondary
|
|
280
|
+
) {
|
|
281
|
+
--gog-button-variant-bg: var(--gog-button-severity-fill);
|
|
282
|
+
--gog-button-variant-color: var(--gog-button-severity-on-fill);
|
|
283
|
+
--gog-button-variant-border: transparent;
|
|
284
|
+
--gog-button-variant-shadow: none;
|
|
285
|
+
--gog-button-variant-hover-bg: var(--gog-button-severity-fill-hover);
|
|
286
|
+
--gog-button-variant-hover-color: var(--gog-button-severity-on-fill);
|
|
287
|
+
--gog-button-variant-hover-shadow: none;
|
|
288
|
+
--gog-button-variant-toggled-shadow: inset 0 0 0 var(--gog-button-toggled-ring-width)
|
|
289
|
+
var(--gog-button-severity-on-fill);
|
|
290
|
+
--gog-button-variant-press-bg: var(--gog-button-severity-fill-press);
|
|
291
|
+
--gog-button-variant-press-color: var(--gog-button-severity-on-fill);
|
|
292
|
+
--gog-button-variant-spinner-color: var(--gog-button-severity-on-fill);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/* Outline: the border and the label are the *ink* rather than the raw status colour, because
|
|
296
|
+
this label is text on the page and the raw hue clears AA in only five of the eleven themes.
|
|
297
|
+
Hovering fills with the status colour proper, which is where `-on-fill` comes back. */
|
|
298
|
+
:is(.gog-btn--success, .gog-btn--danger, .gog-btn--warning, .gog-btn--info).gog-btn--outline {
|
|
299
|
+
--gog-button-variant-bg: transparent;
|
|
300
|
+
--gog-button-variant-color: var(--gog-button-severity-ink);
|
|
301
|
+
--gog-button-variant-border: var(--gog-button-severity-ink);
|
|
302
|
+
--gog-button-variant-shadow: none;
|
|
303
|
+
--gog-button-variant-hover-bg: var(--gog-button-severity-fill);
|
|
304
|
+
--gog-button-variant-hover-color: var(--gog-button-severity-on-fill);
|
|
305
|
+
--gog-button-variant-hover-shadow: none;
|
|
306
|
+
--gog-button-variant-toggled-shadow: inset 0 0 0 var(--gog-button-toggled-ring-width)
|
|
307
|
+
var(--gog-button-severity-ink);
|
|
308
|
+
--gog-button-variant-press-bg: var(--gog-button-severity-fill-press);
|
|
309
|
+
--gog-button-variant-press-color: var(--gog-button-severity-on-fill);
|
|
310
|
+
--gog-button-variant-spinner-color: var(--gog-button-severity-ink);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/* Ghost: a wash on hover rather than a fill, the same shape the accent ghost has. Its hover
|
|
314
|
+
label is `--gog-text-color` for the reason 21.9.0 recorded on `--gog-button-ghost-hover-color`
|
|
315
|
+
— a label and a ground made of the same hue walk toward each other — and the press then fills
|
|
316
|
+
properly, which is also what the accent ghost does. */
|
|
317
|
+
:is(.gog-btn--success, .gog-btn--danger, .gog-btn--warning, .gog-btn--info).gog-btn--ghost {
|
|
318
|
+
--gog-button-variant-bg: transparent;
|
|
319
|
+
--gog-button-variant-color: var(--gog-button-severity-ink);
|
|
320
|
+
--gog-button-variant-border: transparent;
|
|
321
|
+
--gog-button-variant-shadow: none;
|
|
322
|
+
--gog-button-variant-hover-bg: var(--gog-button-severity-wash);
|
|
323
|
+
--gog-button-variant-hover-color: var(--gog-text-color);
|
|
324
|
+
--gog-button-variant-hover-shadow: none;
|
|
325
|
+
--gog-button-variant-toggled-shadow: inset 0 0 0 var(--gog-button-toggled-ring-width)
|
|
326
|
+
var(--gog-button-severity-ink);
|
|
327
|
+
--gog-button-variant-press-bg: var(--gog-button-severity-fill-press);
|
|
328
|
+
--gog-button-variant-press-color: var(--gog-button-severity-on-fill);
|
|
329
|
+
--gog-button-variant-spinner-color: var(--gog-button-severity-ink);
|
|
330
|
+
}
|
|
331
|
+
|
|
167
332
|
/* === Sizes === */
|
|
168
333
|
.gog-btn--xsm {
|
|
169
334
|
--gog-button-size-padding: var(--gog-button-xsm-padding);
|
package/styles/menu.css
CHANGED
|
@@ -1,114 +1,120 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The menu's visual block, in a **global** stylesheet rather than the component's own.
|
|
3
|
-
*
|
|
4
|
-
* `gogMenuItem` goes on a consumer's own `<button>`, declared in the consumer's template — so
|
|
5
|
-
* the element carries *their* encapsulation attribute, and a rule written in
|
|
6
|
-
* `menu.component.scss` never reaches it. That is the same reason `.gog-btn` lives in
|
|
7
|
-
* `button.css` and `gogBadge` in `utilities.css`; the first version of this component had the
|
|
8
|
-
* item rules scoped to the component, and every menu opened with plain browser buttons in it.
|
|
9
|
-
*
|
|
10
|
-
* The panel is here too, rather than split across two files: it is portaled into `<body>` for
|
|
11
|
-
* `appendToBody`, and keeping the whole block in one place is what stops the two halves drifting.
|
|
12
|
-
*
|
|
13
|
-
* Nothing in this file is a literal: every colour, metric and duration resolves to a
|
|
14
|
-
* `--gog-menu-*` token in theme.css, so a theme can restyle the menu without touching it.
|
|
15
|
-
*/
|
|
16
|
-
/*
|
|
17
|
-
* `fixed`, placed from the trigger's measured rect (see `measure()`). The panel always lives in
|
|
18
|
-
* `<body>`, so nothing above it can clip it and there is no second positioning model to keep in
|
|
19
|
-
* step.
|
|
20
|
-
*/
|
|
21
|
-
.gog-menu {
|
|
22
|
-
position: fixed;
|
|
23
|
-
z-index: var(--gog-menu-z);
|
|
24
|
-
display: flex;
|
|
25
|
-
flex-direction: column;
|
|
26
|
-
gap: var(--gog-menu-gap);
|
|
27
|
-
min-width: var(--gog-menu-min-width);
|
|
28
|
-
max-width: var(--gog-menu-max-width);
|
|
29
|
-
/*
|
|
30
|
-
* Two caps, whichever is smaller: the room the component measured between the trigger and the
|
|
31
|
-
* viewport edge, and the theme's own `--gog-menu-max-height`. Resolved here rather than in the
|
|
32
|
-
* component because an inline `max-height` beats any stylesheet rule — writing the measured
|
|
33
|
-
* room straight onto the element is what used to make `--gog-menu-max-height` inert.
|
|
34
|
-
* `--gog-menu-available-height` is written by `gog-menu`; the `100vh` fallback covers the
|
|
35
|
-
* frame before the first measurement and server-side rendering, where there is no viewport
|
|
36
|
-
* to measure.
|
|
37
|
-
*/
|
|
38
|
-
max-height: min(var(--gog-menu-available-height, 100vh), var(--gog-menu-max-height));
|
|
39
|
-
/* The panel masks its own corners; the scrolling happens in `.gog-menu__scroll` inside it. */
|
|
40
|
-
overflow: hidden;
|
|
41
|
-
padding: var(--gog-menu-padding);
|
|
42
|
-
border: var(--gog-menu-border-width) var(--gog-menu-border-style) var(--gog-menu-border-color);
|
|
43
|
-
border-radius: var(--gog-menu-radius);
|
|
44
|
-
background-color: var(--gog-menu-bg);
|
|
45
|
-
box-shadow: var(--gog-menu-shadow);
|
|
46
|
-
font-family: var(--gog-menu-font-family);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/*
|
|
50
|
-
* `min-height: 0` overrides the flex-item default of `auto`, which would otherwise refuse to
|
|
51
|
-
* shrink below the item list's full height and defeat the panel's max-height — the same note
|
|
52
|
-
* `.gog-select__scroll` carries, for the same reason.
|
|
53
|
-
*/
|
|
54
|
-
.gog-menu__scroll {
|
|
55
|
-
flex: 1;
|
|
56
|
-
min-height: 0;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.gog-menu__item {
|
|
60
|
-
display: flex;
|
|
61
|
-
align-items: center;
|
|
62
|
-
gap: var(--gog-menu-item-gap);
|
|
63
|
-
width: 100%;
|
|
64
|
-
padding: var(--gog-menu-item-padding);
|
|
65
|
-
border: 0;
|
|
66
|
-
border-radius: var(--gog-menu-item-radius);
|
|
67
|
-
background: transparent;
|
|
68
|
-
color: var(--gog-menu-item-color);
|
|
69
|
-
font-family: var(--gog-menu-font-family);
|
|
70
|
-
font-size: var(--gog-menu-item-font-size);
|
|
71
|
-
line-height: var(--gog-menu-item-line-height);
|
|
72
|
-
text-align: start;
|
|
73
|
-
cursor: pointer;
|
|
74
|
-
transition: background-color var(--gog-menu-transition-duration) var(--gog-easing);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/*
|
|
78
|
-
* Doubled class on the `:focus-visible` and `:disabled` rules, for the reason spelled out in
|
|
79
|
-
* `button.css`: a menu item is the consumer's own `<button>`, so an ordinary single-class rule
|
|
80
|
-
* in their component stylesheet ties these at (0,2,0) and wins on source order. The `:hover`
|
|
81
|
-
* selector is already (0,3,0) through its `:not(:disabled)` and is left alone.
|
|
82
|
-
*
|
|
83
|
-
* It matters more here than for a button. The arrow keys step over a disabled item, so an item
|
|
84
|
-
* that has lost its disabled styling is one the pointer can still see as ordinary while the
|
|
85
|
-
* keyboard refuses to reach it — the two input methods disagreeing about what exists.
|
|
86
|
-
*/
|
|
87
|
-
.gog-menu__item:hover:not(:disabled),
|
|
88
|
-
.gog-menu__item.gog-menu__item:focus-visible {
|
|
89
|
-
background-color: var(--gog-menu-item-hover-bg);
|
|
90
|
-
color: var(--gog-menu-item-hover-color);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
1
|
+
/*
|
|
2
|
+
* The menu's visual block, in a **global** stylesheet rather than the component's own.
|
|
3
|
+
*
|
|
4
|
+
* `gogMenuItem` goes on a consumer's own `<button>`, declared in the consumer's template — so
|
|
5
|
+
* the element carries *their* encapsulation attribute, and a rule written in
|
|
6
|
+
* `menu.component.scss` never reaches it. That is the same reason `.gog-btn` lives in
|
|
7
|
+
* `button.css` and `gogBadge` in `utilities.css`; the first version of this component had the
|
|
8
|
+
* item rules scoped to the component, and every menu opened with plain browser buttons in it.
|
|
9
|
+
*
|
|
10
|
+
* The panel is here too, rather than split across two files: it is portaled into `<body>` for
|
|
11
|
+
* `appendToBody`, and keeping the whole block in one place is what stops the two halves drifting.
|
|
12
|
+
*
|
|
13
|
+
* Nothing in this file is a literal: every colour, metric and duration resolves to a
|
|
14
|
+
* `--gog-menu-*` token in theme.css, so a theme can restyle the menu without touching it.
|
|
15
|
+
*/
|
|
16
|
+
/*
|
|
17
|
+
* `fixed`, placed from the trigger's measured rect (see `measure()`). The panel always lives in
|
|
18
|
+
* `<body>`, so nothing above it can clip it and there is no second positioning model to keep in
|
|
19
|
+
* step.
|
|
20
|
+
*/
|
|
21
|
+
.gog-menu {
|
|
22
|
+
position: fixed;
|
|
23
|
+
z-index: var(--gog-menu-z);
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
gap: var(--gog-menu-gap);
|
|
27
|
+
min-width: var(--gog-menu-min-width);
|
|
28
|
+
max-width: var(--gog-menu-max-width);
|
|
29
|
+
/*
|
|
30
|
+
* Two caps, whichever is smaller: the room the component measured between the trigger and the
|
|
31
|
+
* viewport edge, and the theme's own `--gog-menu-max-height`. Resolved here rather than in the
|
|
32
|
+
* component because an inline `max-height` beats any stylesheet rule — writing the measured
|
|
33
|
+
* room straight onto the element is what used to make `--gog-menu-max-height` inert.
|
|
34
|
+
* `--gog-menu-available-height` is written by `gog-menu`; the `100vh` fallback covers the
|
|
35
|
+
* frame before the first measurement and server-side rendering, where there is no viewport
|
|
36
|
+
* to measure.
|
|
37
|
+
*/
|
|
38
|
+
max-height: min(var(--gog-menu-available-height, 100vh), var(--gog-menu-max-height));
|
|
39
|
+
/* The panel masks its own corners; the scrolling happens in `.gog-menu__scroll` inside it. */
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
padding: var(--gog-menu-padding);
|
|
42
|
+
border: var(--gog-menu-border-width) var(--gog-menu-border-style) var(--gog-menu-border-color);
|
|
43
|
+
border-radius: var(--gog-menu-radius);
|
|
44
|
+
background-color: var(--gog-menu-bg);
|
|
45
|
+
box-shadow: var(--gog-menu-shadow);
|
|
46
|
+
font-family: var(--gog-menu-font-family);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/*
|
|
50
|
+
* `min-height: 0` overrides the flex-item default of `auto`, which would otherwise refuse to
|
|
51
|
+
* shrink below the item list's full height and defeat the panel's max-height — the same note
|
|
52
|
+
* `.gog-select__scroll` carries, for the same reason.
|
|
53
|
+
*/
|
|
54
|
+
.gog-menu__scroll {
|
|
55
|
+
flex: 1;
|
|
56
|
+
min-height: 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.gog-menu__item {
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
gap: var(--gog-menu-item-gap);
|
|
63
|
+
width: 100%;
|
|
64
|
+
padding: var(--gog-menu-item-padding);
|
|
65
|
+
border: 0;
|
|
66
|
+
border-radius: var(--gog-menu-item-radius);
|
|
67
|
+
background: transparent;
|
|
68
|
+
color: var(--gog-menu-item-color);
|
|
69
|
+
font-family: var(--gog-menu-font-family);
|
|
70
|
+
font-size: var(--gog-menu-item-font-size);
|
|
71
|
+
line-height: var(--gog-menu-item-line-height);
|
|
72
|
+
text-align: start;
|
|
73
|
+
cursor: pointer;
|
|
74
|
+
transition: background-color var(--gog-menu-transition-duration) var(--gog-easing);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/*
|
|
78
|
+
* Doubled class on the `:focus-visible` and `:disabled` rules, for the reason spelled out in
|
|
79
|
+
* `button.css`: a menu item is the consumer's own `<button>`, so an ordinary single-class rule
|
|
80
|
+
* in their component stylesheet ties these at (0,2,0) and wins on source order. The `:hover`
|
|
81
|
+
* selector is already (0,3,0) through its `:not(:disabled)` and is left alone.
|
|
82
|
+
*
|
|
83
|
+
* It matters more here than for a button. The arrow keys step over a disabled item, so an item
|
|
84
|
+
* that has lost its disabled styling is one the pointer can still see as ordinary while the
|
|
85
|
+
* keyboard refuses to reach it — the two input methods disagreeing about what exists.
|
|
86
|
+
*/
|
|
87
|
+
.gog-menu__item:hover:not(:disabled),
|
|
88
|
+
.gog-menu__item.gog-menu__item:focus-visible {
|
|
89
|
+
background-color: var(--gog-menu-item-hover-bg);
|
|
90
|
+
color: var(--gog-menu-item-hover-color);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* After the hover rule on purpose: both are (0,3,0), so source order decides, and a pointer is
|
|
94
|
+
hovering the item it presses. */
|
|
95
|
+
.gog-menu__item:active:not(:disabled) {
|
|
96
|
+
background-color: var(--gog-menu-item-press-bg);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.gog-menu__item.gog-menu__item:focus-visible {
|
|
100
|
+
outline: var(--gog-menu-focus-ring-width) solid var(--gog-menu-focus-ring);
|
|
101
|
+
outline-offset: calc(var(--gog-menu-focus-ring-width) * -1);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.gog-menu__item.gog-menu__item:disabled {
|
|
105
|
+
color: var(--gog-menu-item-disabled-color);
|
|
106
|
+
opacity: var(--gog-menu-item-disabled-opacity);
|
|
107
|
+
cursor: not-allowed;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* An icon inside an item is decorative next to the label, and must not push it around. */
|
|
111
|
+
.gog-menu__item gog-icon {
|
|
112
|
+
flex-shrink: 0;
|
|
113
|
+
font-size: var(--gog-menu-item-icon-size);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@media (prefers-reduced-motion: reduce) {
|
|
117
|
+
.gog-menu__item {
|
|
118
|
+
transition: none;
|
|
119
|
+
}
|
|
120
|
+
}
|
package/styles/presets/bevel.css
CHANGED
|
@@ -1,82 +1,87 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* `bevel` — the high-chrome early-web look: grey panels, raised buttons, navy accent, square
|
|
3
|
-
* corners. The other half of `docs/themes.md`'s Retro family, and the one that dates itself by
|
|
4
|
-
* *shape* rather than by palette.
|
|
5
|
-
*
|
|
6
|
-
* Import it after `index.css`, then put the attribute on the root — or on any subtree:
|
|
7
|
-
*
|
|
8
|
-
* @import '@guildofgleks/ui/styles/index.css';
|
|
9
|
-
* @import '@guildofgleks/ui/styles/presets/bevel.css';
|
|
10
|
-
*
|
|
11
|
-
* <html data-theme="bevel">
|
|
12
|
-
*
|
|
13
|
-
* Palette plus the character layer, no per-component overrides and no font download — the face
|
|
14
|
-
* this look wants (Tahoma, Verdana, MS Sans Serif) is a system face on the platforms that have
|
|
15
|
-
* it and degrades to the platform sans elsewhere, which is exactly what it did at the time.
|
|
16
|
-
*
|
|
17
|
-
* **`--gog-border-style: outset` is what makes this theme.** Every raised surface in the library
|
|
18
|
-
* reads that token, so one declaration puts a bevel on buttons, panels and chips at once — the
|
|
19
|
-
* reason the character layer carries a border *style* and not just a width. `inset` on form
|
|
20
|
-
* fields is its counterpart: a sunken well is how a text input was drawn before a 1px outline
|
|
21
|
-
* was enough to say "type here".
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
:root[data-theme='bevel'],
|
|
25
|
-
[data-theme='bevel'] {
|
|
26
|
-
color-scheme: light;
|
|
27
|
-
|
|
28
|
-
/* Palette — the default desktop grey, and the navy that every link and title bar used */
|
|
29
|
-
--gog-background-color: #c0c0c0;
|
|
30
|
-
--gog-surface-color: #d8d8d8;
|
|
31
|
-
--gog-hover-color: #cacaca;
|
|
32
|
-
--gog-border-color: #808080;
|
|
33
|
-
--gog-text-color: #0a0a0a;
|
|
34
|
-
--gog-accent-text-color: #ffffff;
|
|
35
|
-
--gog-muted-text-color: #3d3d3d;
|
|
36
|
-
--gog-primary-color: #0a0a0a;
|
|
37
|
-
--gog-accent-color: #000080;
|
|
38
|
-
--gog-accent-bright: #1a1aa8;
|
|
39
|
-
--gog-accent-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
--gog-
|
|
45
|
-
--gog-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
--gog-
|
|
49
|
-
--gog-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
--gog-
|
|
54
|
-
--gog-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
--gog-
|
|
58
|
-
--gog-
|
|
59
|
-
--gog-
|
|
60
|
-
--gog-
|
|
61
|
-
--gog-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
--gog-button-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
--gog-
|
|
81
|
-
|
|
82
|
-
|
|
1
|
+
/*
|
|
2
|
+
* `bevel` — the high-chrome early-web look: grey panels, raised buttons, navy accent, square
|
|
3
|
+
* corners. The other half of `docs/themes.md`'s Retro family, and the one that dates itself by
|
|
4
|
+
* *shape* rather than by palette.
|
|
5
|
+
*
|
|
6
|
+
* Import it after `index.css`, then put the attribute on the root — or on any subtree:
|
|
7
|
+
*
|
|
8
|
+
* @import '@guildofgleks/ui/styles/index.css';
|
|
9
|
+
* @import '@guildofgleks/ui/styles/presets/bevel.css';
|
|
10
|
+
*
|
|
11
|
+
* <html data-theme="bevel">
|
|
12
|
+
*
|
|
13
|
+
* Palette plus the character layer, no per-component overrides and no font download — the face
|
|
14
|
+
* this look wants (Tahoma, Verdana, MS Sans Serif) is a system face on the platforms that have
|
|
15
|
+
* it and degrades to the platform sans elsewhere, which is exactly what it did at the time.
|
|
16
|
+
*
|
|
17
|
+
* **`--gog-border-style: outset` is what makes this theme.** Every raised surface in the library
|
|
18
|
+
* reads that token, so one declaration puts a bevel on buttons, panels and chips at once — the
|
|
19
|
+
* reason the character layer carries a border *style* and not just a width. `inset` on form
|
|
20
|
+
* fields is its counterpart: a sunken well is how a text input was drawn before a 1px outline
|
|
21
|
+
* was enough to say "type here".
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
:root[data-theme='bevel'],
|
|
25
|
+
[data-theme='bevel'] {
|
|
26
|
+
color-scheme: light;
|
|
27
|
+
|
|
28
|
+
/* Palette — the default desktop grey, and the navy that every link and title bar used */
|
|
29
|
+
--gog-background-color: #c0c0c0;
|
|
30
|
+
--gog-surface-color: #d8d8d8;
|
|
31
|
+
--gog-hover-color: #cacaca;
|
|
32
|
+
--gog-border-color: #808080;
|
|
33
|
+
--gog-text-color: #0a0a0a;
|
|
34
|
+
--gog-accent-text-color: #ffffff;
|
|
35
|
+
--gog-muted-text-color: #3d3d3d;
|
|
36
|
+
--gog-primary-color: #0a0a0a;
|
|
37
|
+
--gog-accent-color: #000080;
|
|
38
|
+
--gog-accent-bright: #1a1aa8;
|
|
39
|
+
/* Was #000080 — byte-identical to --gog-accent-color, which made it not a ramp at all.
|
|
40
|
+
Harmless while `dim` was only a field border; 21.9.0 made it the button's pressed fill, so a
|
|
41
|
+
pressed button in this theme painted itself the colour it already was. Darkened to a deeper
|
|
42
|
+
navy, which is as period-correct as the one it replaces. `check-tokens` rule I now fails on
|
|
43
|
+
any theme whose accent ramp collapses like this. */
|
|
44
|
+
--gog-accent-dim: #00005c;
|
|
45
|
+
--gog-accent-pale: #b8b8cc;
|
|
46
|
+
--gog-secondary-color: #4a4a5a;
|
|
47
|
+
--gog-success-color: #006400;
|
|
48
|
+
--gog-danger-color: #8b0000;
|
|
49
|
+
--gog-warning-color: #7a5c00;
|
|
50
|
+
--gog-info-color: #005a6e;
|
|
51
|
+
|
|
52
|
+
/* No blur. A drop shadow of this era was a solid black offset rectangle, if it existed. */
|
|
53
|
+
--gog-panel-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35);
|
|
54
|
+
--gog-spinner-overlay-bg: rgba(192, 192, 192, 0.85);
|
|
55
|
+
|
|
56
|
+
/* Character layer — square, bevelled, compact, and shouting in caps the way a title bar did */
|
|
57
|
+
--gog-font-heading: Tahoma, Verdana, 'MS Sans Serif', Geneva, sans-serif;
|
|
58
|
+
--gog-font-body: Tahoma, Verdana, 'MS Sans Serif', Geneva, sans-serif;
|
|
59
|
+
--gog-radius: 0;
|
|
60
|
+
--gog-density: 0.9;
|
|
61
|
+
--gog-border-width: 2px;
|
|
62
|
+
--gog-border-style: outset;
|
|
63
|
+
--gog-panel-border-width: 2px;
|
|
64
|
+
--gog-panel-border-style: outset;
|
|
65
|
+
--gog-control-border-width: 2px;
|
|
66
|
+
--gog-control-border-style: inset;
|
|
67
|
+
|
|
68
|
+
/* The one per-component override in this file, and the reason it is needed: a button is a
|
|
69
|
+
"control" like a text field is, so it inherits `--gog-control-border-style` — which here has
|
|
70
|
+
to be `inset`, because a sunken well is how a text input was drawn. But a button of this era
|
|
71
|
+
is the opposite shape: raised, and it *pressed in* when you clicked it. The character layer
|
|
72
|
+
has one control tier and this theme needs two halves of it to disagree, so the button says
|
|
73
|
+
so itself. Everything else raised (panels, cards, chips, tags) gets `outset` from the tiers
|
|
74
|
+
above with nothing named. */
|
|
75
|
+
--gog-button-border-width: 2px;
|
|
76
|
+
--gog-button-border-style: outset;
|
|
77
|
+
/* `outset` draws its highlight and shade *from the border colour*, so a transparent border —
|
|
78
|
+
which is the library's default for a filled button, and correct everywhere else — renders a
|
|
79
|
+
bevel that is not there. Naming a colour is what makes the style visible at all. */
|
|
80
|
+
--gog-button-primary-border: #8a8ab0;
|
|
81
|
+
|
|
82
|
+
--gog-text-transform: none;
|
|
83
|
+
--gog-letter-spacing: normal;
|
|
84
|
+
--gog-duration-fast: 0s;
|
|
85
|
+
--gog-duration-base: 0s;
|
|
86
|
+
--gog-duration-slow: 0s;
|
|
87
|
+
}
|