@seanyeh77/ui 0.46.0 → 0.47.1
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/dist/bundle.js +16 -16
- package/dist/components/Badge/Badge.d.ts +4 -4
- package/dist/components/Badge/Badge.js +7 -1
- package/dist/components/Badge/Badge.js.map +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.js +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/components/DataTable/DataTable.js +19 -4
- package/dist/components/DataTable/DataTable.js.map +1 -1
- package/dist/components/EmptyState/EmptyState.js +19 -1
- package/dist/components/EmptyState/EmptyState.js.map +1 -1
- package/dist/components/InlineCode/InlineCode.js +1 -1
- package/dist/components/InlineCode/InlineCode.js.map +1 -1
- package/dist/components/KpiCard/KpiCard.d.ts +2 -2
- package/dist/components/KpiCard/KpiCard.js +1 -1
- package/dist/components/KpiCard/KpiCard.js.map +1 -1
- package/dist/components/LayerGraph/LayerGraph.js +5 -5
- package/dist/components/LayerGraph/LayerGraph.js.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +1 -0
- package/dist/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/components/SettingsLayout/SettingsLayout.js +3 -1
- package/dist/components/SettingsLayout/SettingsLayout.js.map +1 -1
- package/dist/components/TextField/TextField.d.ts +8 -2
- package/dist/components/TextField/TextField.js +65 -13
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/css/Alert.css +9 -1
- package/dist/css/DataTable.css +27 -2
- package/dist/css/EmptyState.css +4 -4
- package/dist/css/EventTimeline.css +3 -1
- package/dist/css/LayerGraph.css +1 -1
- package/dist/css/LoadingBar.css +4 -1
- package/dist/css/MobileTabBar.css +6 -4
- package/dist/css/SettingsLayout.css +1 -0
- package/dist/css/Tabs.css +15 -2
- package/dist/css/base.css +86 -3
- package/dist/css/end.css +3 -1
- package/dist/i18n.js +1 -0
- package/dist/i18n.js.map +1 -1
- package/dist/icons/Icon.d.ts +2 -1
- package/dist/icons/Icon.js +4 -3
- package/dist/icons/Icon.js.map +1 -1
- package/dist/icons/store.d.ts +3 -1
- package/dist/icons/store.js +17 -12
- package/dist/icons/store.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/internal/util.js +4 -3
- package/dist/internal/util.js.map +1 -1
- package/dist/styles.css +248 -109
- package/dist/theme.d.ts +7 -0
- package/dist/theme.js +39 -15
- package/dist/theme.js.map +1 -1
- package/docs/Badge.md +2 -1
- package/docs/DataTable.md +1 -1
- package/docs/EmptyState.md +1 -1
- package/docs/EventTimeline.md +1 -1
- package/docs/Graph.md +1 -1
- package/docs/KpiCard.md +1 -1
- package/docs/LoadingBar.md +1 -1
- package/docs/MobileTabBar.md +1 -1
- package/docs/MultiSelect.md +1 -1
- package/docs/Tabs.md +10 -9
- package/docs/TextField.md +2 -0
- package/docs/agents.md +6 -6
- package/docs/theme.md +5 -2
- package/package.json +2 -2
package/dist/styles.css
CHANGED
|
@@ -184,11 +184,18 @@ html.ui-theme-fade * {
|
|
|
184
184
|
click area wrap the control, not the whole row, as on Switch. Still a block, so each sits on its own line. */
|
|
185
185
|
.ui-check,
|
|
186
186
|
.ui-radio {
|
|
187
|
-
|
|
187
|
+
/* A grid, not a flex row: the box sits on the first line of a label that wraps (align-items: start, see the box's
|
|
188
|
+
margin), while one line stays centred in the 40 px height (align-content: center). */
|
|
189
|
+
display: grid;
|
|
190
|
+
grid-template-columns: auto;
|
|
191
|
+
grid-auto-flow: column;
|
|
192
|
+
grid-auto-columns: minmax(0, max-content);
|
|
188
193
|
width: max-content;
|
|
189
194
|
max-width: 100%;
|
|
190
|
-
|
|
191
|
-
|
|
195
|
+
justify-content: start;
|
|
196
|
+
align-items: start;
|
|
197
|
+
align-content: center;
|
|
198
|
+
column-gap: 12px;
|
|
192
199
|
min-height: var(--control-height);
|
|
193
200
|
padding: 0;
|
|
194
201
|
border: 0;
|
|
@@ -199,6 +206,11 @@ html.ui-theme-fade * {
|
|
|
199
206
|
text-align: left;
|
|
200
207
|
cursor: pointer;
|
|
201
208
|
}
|
|
209
|
+
.ui-check > .ui-check-box,
|
|
210
|
+
.ui-radio > .ui-radio-ring {
|
|
211
|
+
/* Centred on the first line of the label. */
|
|
212
|
+
margin-top: calc((1lh - 22px) / 2);
|
|
213
|
+
}
|
|
202
214
|
.ui-check:disabled,
|
|
203
215
|
.ui-radio:disabled {
|
|
204
216
|
color: var(--ink-muted);
|
|
@@ -287,6 +299,77 @@ html.ui-theme-fade * {
|
|
|
287
299
|
label:has(> .ui-switch) {
|
|
288
300
|
font-size: var(--text-control);
|
|
289
301
|
}
|
|
302
|
+
/* TextField with prefix, suffix or unit: the box draws the border (like the password field) and the input inside is
|
|
303
|
+
bare, so the muted text sits inside the same frame. */
|
|
304
|
+
.ui-field-box.has-affix {
|
|
305
|
+
display: flex;
|
|
306
|
+
align-items: center;
|
|
307
|
+
gap: var(--space-2);
|
|
308
|
+
height: var(--control-height);
|
|
309
|
+
box-sizing: border-box;
|
|
310
|
+
padding: 0 var(--space-3);
|
|
311
|
+
/* The frame is an inset shadow, not a border, so the input inside is the full 40 px (48 px on phones) tall: the
|
|
312
|
+
whole box is its touch target. */
|
|
313
|
+
box-shadow: inset 0 0 0 1px var(--line-strong);
|
|
314
|
+
border-radius: var(--radius-md);
|
|
315
|
+
background: var(--surface-input);
|
|
316
|
+
color: var(--ink);
|
|
317
|
+
}
|
|
318
|
+
.ui-field-box.has-affix .ui-input {
|
|
319
|
+
flex: 1 1 auto;
|
|
320
|
+
min-width: 0;
|
|
321
|
+
height: 100%;
|
|
322
|
+
padding: 0;
|
|
323
|
+
border: 0;
|
|
324
|
+
border-radius: 0;
|
|
325
|
+
background: transparent;
|
|
326
|
+
}
|
|
327
|
+
.ui-field-box.has-affix .ui-input:focus-visible {
|
|
328
|
+
outline: none;
|
|
329
|
+
}
|
|
330
|
+
.has-error .ui-field-box.has-affix {
|
|
331
|
+
box-shadow: inset 0 0 0 1.5px var(--danger);
|
|
332
|
+
}
|
|
333
|
+
.is-disabled .ui-field-box.has-affix {
|
|
334
|
+
box-shadow: none;
|
|
335
|
+
background: var(--surface-sub);
|
|
336
|
+
color: var(--ink-muted);
|
|
337
|
+
}
|
|
338
|
+
.ui-field-affix {
|
|
339
|
+
flex: none;
|
|
340
|
+
color: var(--ink-muted);
|
|
341
|
+
font-size: var(--text-control);
|
|
342
|
+
white-space: nowrap;
|
|
343
|
+
}
|
|
344
|
+
/* The unit after the typed text: an invisible copy of the text, on top of the input, pushes it along. */
|
|
345
|
+
.ui-field-unitwrap {
|
|
346
|
+
flex: 1 1 auto;
|
|
347
|
+
min-width: 0;
|
|
348
|
+
height: 100%;
|
|
349
|
+
display: grid;
|
|
350
|
+
}
|
|
351
|
+
.ui-field-unitwrap > * {
|
|
352
|
+
grid-area: 1 / 1;
|
|
353
|
+
}
|
|
354
|
+
.ui-field-unitline {
|
|
355
|
+
display: flex;
|
|
356
|
+
align-items: center;
|
|
357
|
+
overflow: hidden;
|
|
358
|
+
font-size: var(--text-control);
|
|
359
|
+
white-space: pre;
|
|
360
|
+
pointer-events: none;
|
|
361
|
+
}
|
|
362
|
+
.ui-field-mirror {
|
|
363
|
+
visibility: hidden;
|
|
364
|
+
min-width: 0;
|
|
365
|
+
overflow: hidden;
|
|
366
|
+
}
|
|
367
|
+
/* Forced colors drop shadows: the frame becomes a border. */
|
|
368
|
+
@media (forced-colors: active) {
|
|
369
|
+
.ui-field-box.has-affix {
|
|
370
|
+
border: 1px solid CanvasText;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
290
373
|
@keyframes ui-rise {
|
|
291
374
|
from {
|
|
292
375
|
opacity: 0;
|
|
@@ -1021,7 +1104,8 @@ label:has(> .ui-switch) {
|
|
|
1021
1104
|
grid-row: 1;
|
|
1022
1105
|
width: 40px;
|
|
1023
1106
|
height: 40px;
|
|
1024
|
-
|
|
1107
|
+
/* Its box ends at the padding edge, where an action button ends in an alert without ✕. */
|
|
1108
|
+
margin: -8px 0 -8px var(--space-3);
|
|
1025
1109
|
border: 0;
|
|
1026
1110
|
border-radius: var(--radius-sm);
|
|
1027
1111
|
background: transparent;
|
|
@@ -1031,6 +1115,13 @@ label:has(> .ui-switch) {
|
|
|
1031
1115
|
align-items: center;
|
|
1032
1116
|
justify-content: center;
|
|
1033
1117
|
}
|
|
1118
|
+
/* Beside an action: centred on the same line as the button, not at the top. */
|
|
1119
|
+
@container (min-width: 480px) {
|
|
1120
|
+
.ui-alert:has(> .ui-alert-action) > .ui-alert-close {
|
|
1121
|
+
align-self: center;
|
|
1122
|
+
margin-block: 0;
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1034
1125
|
.ui-alert-close:hover {
|
|
1035
1126
|
background: var(--surface-sub);
|
|
1036
1127
|
}
|
|
@@ -1089,11 +1180,11 @@ label:has(> .ui-switch) {
|
|
|
1089
1180
|
font-size: var(--text-compact);
|
|
1090
1181
|
color: var(--ink-muted);
|
|
1091
1182
|
}
|
|
1092
|
-
/* Phones: a description
|
|
1093
|
-
|
|
1183
|
+
/* Phones: a description of more than 2 lines (EmptyState adds is-long) left-aligns the whole block, title, steps and
|
|
1184
|
+
button with it, so nothing is centred above left-aligned text; up to 2 lines everything stays centred. */
|
|
1094
1185
|
@media (max-width: 599px) {
|
|
1095
|
-
.ui-empty-
|
|
1096
|
-
|
|
1186
|
+
.ui-empty.is-long {
|
|
1187
|
+
align-items: flex-start;
|
|
1097
1188
|
text-align: start;
|
|
1098
1189
|
}
|
|
1099
1190
|
}
|
|
@@ -1312,10 +1403,11 @@ div.ui-toast[role='status'] {
|
|
|
1312
1403
|
}
|
|
1313
1404
|
/* Tabs switch between different content: text on a 1 px baseline rule, the current tab underlined in the accent (an
|
|
1314
1405
|
underline, not a raised pill, so it never reads like SegmentedControl, which switches how the same content shows).
|
|
1315
|
-
40 px tall, the height of the controls beside it in a toolbar. */
|
|
1406
|
+
40 px tall, the height of the controls beside it in a toolbar. The baseline runs the full width of the container. */
|
|
1316
1407
|
.ui-tabs {
|
|
1317
1408
|
position: relative;
|
|
1318
|
-
display:
|
|
1409
|
+
display: flex;
|
|
1410
|
+
width: 100%;
|
|
1319
1411
|
max-width: 100%;
|
|
1320
1412
|
box-sizing: border-box;
|
|
1321
1413
|
height: var(--control-height);
|
|
@@ -1371,6 +1463,18 @@ div.ui-toast[role='status'] {
|
|
|
1371
1463
|
font-weight: 700;
|
|
1372
1464
|
}
|
|
1373
1465
|
|
|
1466
|
+
/* Forced colors drop backgrounds and box shadows: the underline is drawn in Highlight and the baseline is a border. */
|
|
1467
|
+
@media (forced-colors: active) {
|
|
1468
|
+
.ui-tabs {
|
|
1469
|
+
box-shadow: none;
|
|
1470
|
+
border-bottom: 1px solid CanvasText;
|
|
1471
|
+
}
|
|
1472
|
+
.ui-tabs-ind {
|
|
1473
|
+
forced-color-adjust: none;
|
|
1474
|
+
background: Highlight;
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1374
1478
|
@media (prefers-reduced-motion: reduce) {
|
|
1375
1479
|
.ui-tabs-ind {
|
|
1376
1480
|
transition: opacity var(--dur-hover) ease !important;
|
|
@@ -1435,17 +1539,19 @@ div.ui-toast[role='status'] {
|
|
|
1435
1539
|
.ui-tabbar-item.is-selected {
|
|
1436
1540
|
color: var(--accent-text);
|
|
1437
1541
|
}
|
|
1438
|
-
/* MA: an 11 px label under each icon; the pill sits behind the icon only
|
|
1542
|
+
/* MA: an 11 px label under each icon; the pill sits behind the icon only: centred on it (22 px icon, 28 px pill) and
|
|
1543
|
+
clear of the label (6 px gap). The icon, gap and label (42 px) are centred in the bar, so the pill's centre is the
|
|
1544
|
+
bar's middle less 21 px plus 11 px. */
|
|
1439
1545
|
.ui-tabbar.has-labels {
|
|
1440
1546
|
height: 64px;
|
|
1441
1547
|
}
|
|
1442
1548
|
.ui-tabbar.has-labels .ui-tabbar-item {
|
|
1443
1549
|
flex-direction: column;
|
|
1444
|
-
gap:
|
|
1445
|
-
padding-top: 2px;
|
|
1550
|
+
gap: 6px;
|
|
1446
1551
|
}
|
|
1447
1552
|
.ui-tabbar.has-labels .ui-tabbar-pill {
|
|
1448
|
-
top:
|
|
1553
|
+
top: calc(50% - 24px);
|
|
1554
|
+
height: 28px;
|
|
1449
1555
|
}
|
|
1450
1556
|
.ui-tabbar-label {
|
|
1451
1557
|
font-size: var(--text-mini);
|
|
@@ -2034,12 +2140,15 @@ div.ui-toast[role='status'] {
|
|
|
2034
2140
|
ui-drop-l var(--dur-loop) cubic-bezier(0.65, 0, 0.35, 1) infinite,
|
|
2035
2141
|
ui-drop-r var(--dur-loop) var(--ease-standard) infinite;
|
|
2036
2142
|
}
|
|
2143
|
+
/* Reduced motion: a still bar across the whole track, accent stripes on the track (full accent, 3:1 against it), so it
|
|
2144
|
+
reads as 「busy」 and not as a fixed amount done. */
|
|
2037
2145
|
@media (prefers-reduced-motion: reduce) {
|
|
2038
2146
|
.ui-loading-drop {
|
|
2039
2147
|
animation: none;
|
|
2040
2148
|
left: 0;
|
|
2041
2149
|
right: 0;
|
|
2042
|
-
|
|
2150
|
+
border-radius: 0;
|
|
2151
|
+
background: repeating-linear-gradient(-45deg, var(--accent) 0 6px, transparent 6px 12px);
|
|
2043
2152
|
}
|
|
2044
2153
|
}
|
|
2045
2154
|
.ui-ring-track {
|
|
@@ -3641,6 +3750,8 @@ div.ui-toast[role='status'] {
|
|
|
3641
3750
|
/* The summary keeps the segmented look (a gray track, the current part a raised white pill), the user's choice for
|
|
3642
3751
|
summaries; plain Tabs are underlined. */
|
|
3643
3752
|
.ui-tabs.ui-dt-summary {
|
|
3753
|
+
display: inline-flex;
|
|
3754
|
+
width: auto;
|
|
3644
3755
|
height: auto;
|
|
3645
3756
|
padding: 4px;
|
|
3646
3757
|
border-radius: var(--radius-md);
|
|
@@ -3815,10 +3926,24 @@ div.ui-toast[role='status'] {
|
|
|
3815
3926
|
.ui-dt-time wbr {
|
|
3816
3927
|
display: none;
|
|
3817
3928
|
}
|
|
3818
|
-
/*
|
|
3929
|
+
/* Code and paths in a row are the row's size, in Geist Mono: one text size per row. */
|
|
3930
|
+
.ui-dt-body .ui-dt-cell .ui-code,
|
|
3931
|
+
.ui-dt-body .ui-dt-cell .ui-code.is-link.is-location {
|
|
3932
|
+
font-size: inherit;
|
|
3933
|
+
}
|
|
3934
|
+
/* Hugging columns are measured on one line (DataTable adds is-measuring for the read only), headings at their full
|
|
3935
|
+
width too, so a column is never narrower than its heading, also while it holds only loading bars. */
|
|
3819
3936
|
.ui-dt.is-measuring .ui-dt-cell.is-hug {
|
|
3820
3937
|
white-space: nowrap;
|
|
3821
3938
|
}
|
|
3939
|
+
.ui-dt.is-measuring .ui-dt-cell.is-hug > .ui-dt-sort {
|
|
3940
|
+
flex: none;
|
|
3941
|
+
max-width: none;
|
|
3942
|
+
}
|
|
3943
|
+
/* Loading bars keep their width in the cell (a flex box would shrink them). */
|
|
3944
|
+
.ui-dt-skelrow .ui-skel {
|
|
3945
|
+
flex: none;
|
|
3946
|
+
}
|
|
3822
3947
|
|
|
3823
3948
|
.ui-dt-body .ui-dt-row:last-child {
|
|
3824
3949
|
border-bottom: 0;
|
|
@@ -4312,6 +4437,14 @@ div.ui-toast[role='status'] {
|
|
|
4312
4437
|
.ui-dt-body .ui-dt-cell .ui-dt-time wbr {
|
|
4313
4438
|
display: inline;
|
|
4314
4439
|
}
|
|
4440
|
+
/* Each part stays whole while it fits on a line; only a card narrower than the part (320 px, wide text spacing)
|
|
4441
|
+
breaks inside it, rather than overflowing the card. */
|
|
4442
|
+
.ui-dt-body .ui-dt-cell .ui-dt-nowrap {
|
|
4443
|
+
display: inline-block;
|
|
4444
|
+
max-width: 100%;
|
|
4445
|
+
white-space: normal;
|
|
4446
|
+
overflow-wrap: anywhere;
|
|
4447
|
+
}
|
|
4315
4448
|
.ui-dt-body .ui-dt-cell.is-num {
|
|
4316
4449
|
white-space: normal;
|
|
4317
4450
|
}
|
|
@@ -4326,7 +4459,8 @@ div.ui-toast[role='status'] {
|
|
|
4326
4459
|
color: var(--ink-muted);
|
|
4327
4460
|
font-family: var(--font-sans);
|
|
4328
4461
|
font-size: var(--text-small);
|
|
4329
|
-
line
|
|
4462
|
+
/* The value's line height (1lh here is the cell's), so the smaller name sits on the value's baseline. */
|
|
4463
|
+
line-height: 1lh;
|
|
4330
4464
|
font-weight: 400;
|
|
4331
4465
|
white-space: nowrap;
|
|
4332
4466
|
}
|
|
@@ -5406,6 +5540,7 @@ div.ui-toast[role='status'] {
|
|
|
5406
5540
|
.ui-settings-body {
|
|
5407
5541
|
flex-direction: column;
|
|
5408
5542
|
align-items: stretch;
|
|
5543
|
+
gap: var(--space-4);
|
|
5409
5544
|
}
|
|
5410
5545
|
/* The categories as Tabs, like every other row of tabs: the row scrolls sideways when the names do not fit. */
|
|
5411
5546
|
.ui-settings-tabs {
|
|
@@ -7252,6 +7387,96 @@ div.ui-toast[role='status'] {
|
|
|
7252
7387
|
display: inline-flex;
|
|
7253
7388
|
gap: 4px;
|
|
7254
7389
|
}
|
|
7390
|
+
/* SegmentedControl: a 40 px switch between ways of showing the same thing (the height of a toolbar's controls);
|
|
7391
|
+
the selected part is a raised pill. */
|
|
7392
|
+
.ui-seg {
|
|
7393
|
+
position: relative;
|
|
7394
|
+
display: inline-flex;
|
|
7395
|
+
flex: none;
|
|
7396
|
+
gap: 2px;
|
|
7397
|
+
height: var(--control-height);
|
|
7398
|
+
padding: 3px;
|
|
7399
|
+
box-sizing: border-box;
|
|
7400
|
+
border-radius: var(--radius-sm);
|
|
7401
|
+
background: var(--surface-sub);
|
|
7402
|
+
vertical-align: middle;
|
|
7403
|
+
}
|
|
7404
|
+
/* Like the tab pill: a line-strong border shows the selection at 3:1 (icon-only items differ in color alone). */
|
|
7405
|
+
.ui-seg-ind {
|
|
7406
|
+
position: absolute;
|
|
7407
|
+
top: 3px;
|
|
7408
|
+
bottom: 3px;
|
|
7409
|
+
box-sizing: border-box;
|
|
7410
|
+
border: 1px solid var(--line-strong);
|
|
7411
|
+
border-radius: var(--radius-xs);
|
|
7412
|
+
background: var(--surface);
|
|
7413
|
+
box-shadow: var(--shadow-sm);
|
|
7414
|
+
}
|
|
7415
|
+
.ui-seg-item {
|
|
7416
|
+
position: relative;
|
|
7417
|
+
display: inline-flex;
|
|
7418
|
+
align-items: center;
|
|
7419
|
+
justify-content: center;
|
|
7420
|
+
gap: 6px;
|
|
7421
|
+
height: 100%;
|
|
7422
|
+
padding: 0 var(--space-3);
|
|
7423
|
+
border: 0;
|
|
7424
|
+
border-radius: var(--radius-xs);
|
|
7425
|
+
background: none;
|
|
7426
|
+
color: var(--ink-muted);
|
|
7427
|
+
font: inherit;
|
|
7428
|
+
font-size: var(--text-control);
|
|
7429
|
+
line-height: 20px;
|
|
7430
|
+
white-space: nowrap;
|
|
7431
|
+
cursor: pointer;
|
|
7432
|
+
transition: color var(--dur-hover) ease;
|
|
7433
|
+
}
|
|
7434
|
+
.ui-seg-item:hover,
|
|
7435
|
+
.ui-seg-item.is-selected {
|
|
7436
|
+
color: var(--ink);
|
|
7437
|
+
}
|
|
7438
|
+
.ui-seg-item.is-selected {
|
|
7439
|
+
font-weight: 600;
|
|
7440
|
+
}
|
|
7441
|
+
.ui-seg.is-icons .ui-seg-item {
|
|
7442
|
+
width: 34px;
|
|
7443
|
+
padding: 0;
|
|
7444
|
+
}
|
|
7445
|
+
/* Icons only: the selected one is marked like the words are, ink in the outlined pill (not a color of its own). */
|
|
7446
|
+
.ui-seg.is-icons .ui-seg-item.is-selected {
|
|
7447
|
+
color: var(--ink);
|
|
7448
|
+
}
|
|
7449
|
+
/* Workbench's mainBar is 36 px: the compact 28 px switch, like the bar's other buttons. */
|
|
7450
|
+
.ui-wb-mainbar .ui-seg {
|
|
7451
|
+
height: 28px;
|
|
7452
|
+
padding: 2px;
|
|
7453
|
+
}
|
|
7454
|
+
.ui-wb-mainbar .ui-seg-ind {
|
|
7455
|
+
top: 2px;
|
|
7456
|
+
bottom: 2px;
|
|
7457
|
+
}
|
|
7458
|
+
.ui-wb-mainbar .ui-seg-item {
|
|
7459
|
+
font-size: var(--text-small);
|
|
7460
|
+
}
|
|
7461
|
+
.ui-wb-mainbar .ui-seg.is-icons .ui-seg-item {
|
|
7462
|
+
width: 28px;
|
|
7463
|
+
}
|
|
7464
|
+
/* Touch screens: each part is a 48 px target (the whole switch 48 px tall). In Workbench's 36 px mainBar the switch
|
|
7465
|
+
keeps its 28 px look, like the bar's other buttons, and each part's touch area grows to 48 px (touch.css). */
|
|
7466
|
+
@media (pointer: coarse) {
|
|
7467
|
+
.ui-seg {
|
|
7468
|
+
height: var(--touch-target);
|
|
7469
|
+
}
|
|
7470
|
+
.ui-seg.is-icons .ui-seg-item,
|
|
7471
|
+
.ui-wb-mainbar .ui-seg.is-icons .ui-seg-item {
|
|
7472
|
+
width: 42px;
|
|
7473
|
+
}
|
|
7474
|
+
}
|
|
7475
|
+
@media (prefers-reduced-motion: reduce) {
|
|
7476
|
+
.ui-seg-ind {
|
|
7477
|
+
transition: none !important;
|
|
7478
|
+
}
|
|
7479
|
+
}
|
|
7255
7480
|
/* LayerGraph */
|
|
7256
7481
|
.ui-lg-scroller {
|
|
7257
7482
|
position: relative;
|
|
@@ -9155,96 +9380,6 @@ button.ui-md-link.is-row {
|
|
|
9155
9380
|
opacity: 0;
|
|
9156
9381
|
}
|
|
9157
9382
|
}
|
|
9158
|
-
/* SegmentedControl: a 40 px switch between ways of showing the same thing (the height of a toolbar's controls);
|
|
9159
|
-
the selected part is a raised pill. */
|
|
9160
|
-
.ui-seg {
|
|
9161
|
-
position: relative;
|
|
9162
|
-
display: inline-flex;
|
|
9163
|
-
flex: none;
|
|
9164
|
-
gap: 2px;
|
|
9165
|
-
height: var(--control-height);
|
|
9166
|
-
padding: 3px;
|
|
9167
|
-
box-sizing: border-box;
|
|
9168
|
-
border-radius: var(--radius-sm);
|
|
9169
|
-
background: var(--surface-sub);
|
|
9170
|
-
vertical-align: middle;
|
|
9171
|
-
}
|
|
9172
|
-
/* Like the tab pill: a line-strong border shows the selection at 3:1 (icon-only items differ in color alone). */
|
|
9173
|
-
.ui-seg-ind {
|
|
9174
|
-
position: absolute;
|
|
9175
|
-
top: 3px;
|
|
9176
|
-
bottom: 3px;
|
|
9177
|
-
box-sizing: border-box;
|
|
9178
|
-
border: 1px solid var(--line-strong);
|
|
9179
|
-
border-radius: var(--radius-xs);
|
|
9180
|
-
background: var(--surface);
|
|
9181
|
-
box-shadow: var(--shadow-sm);
|
|
9182
|
-
}
|
|
9183
|
-
.ui-seg-item {
|
|
9184
|
-
position: relative;
|
|
9185
|
-
display: inline-flex;
|
|
9186
|
-
align-items: center;
|
|
9187
|
-
justify-content: center;
|
|
9188
|
-
gap: 6px;
|
|
9189
|
-
height: 100%;
|
|
9190
|
-
padding: 0 var(--space-3);
|
|
9191
|
-
border: 0;
|
|
9192
|
-
border-radius: var(--radius-xs);
|
|
9193
|
-
background: none;
|
|
9194
|
-
color: var(--ink-muted);
|
|
9195
|
-
font: inherit;
|
|
9196
|
-
font-size: var(--text-control);
|
|
9197
|
-
line-height: 20px;
|
|
9198
|
-
white-space: nowrap;
|
|
9199
|
-
cursor: pointer;
|
|
9200
|
-
transition: color var(--dur-hover) ease;
|
|
9201
|
-
}
|
|
9202
|
-
.ui-seg-item:hover,
|
|
9203
|
-
.ui-seg-item.is-selected {
|
|
9204
|
-
color: var(--ink);
|
|
9205
|
-
}
|
|
9206
|
-
.ui-seg-item.is-selected {
|
|
9207
|
-
font-weight: 600;
|
|
9208
|
-
}
|
|
9209
|
-
.ui-seg.is-icons .ui-seg-item {
|
|
9210
|
-
width: 34px;
|
|
9211
|
-
padding: 0;
|
|
9212
|
-
}
|
|
9213
|
-
/* Icons only: the selected one is marked like the words are, ink in the outlined pill (not a color of its own). */
|
|
9214
|
-
.ui-seg.is-icons .ui-seg-item.is-selected {
|
|
9215
|
-
color: var(--ink);
|
|
9216
|
-
}
|
|
9217
|
-
/* Workbench's mainBar is 36 px: the compact 28 px switch, like the bar's other buttons. */
|
|
9218
|
-
.ui-wb-mainbar .ui-seg {
|
|
9219
|
-
height: 28px;
|
|
9220
|
-
padding: 2px;
|
|
9221
|
-
}
|
|
9222
|
-
.ui-wb-mainbar .ui-seg-ind {
|
|
9223
|
-
top: 2px;
|
|
9224
|
-
bottom: 2px;
|
|
9225
|
-
}
|
|
9226
|
-
.ui-wb-mainbar .ui-seg-item {
|
|
9227
|
-
font-size: var(--text-small);
|
|
9228
|
-
}
|
|
9229
|
-
.ui-wb-mainbar .ui-seg.is-icons .ui-seg-item {
|
|
9230
|
-
width: 28px;
|
|
9231
|
-
}
|
|
9232
|
-
/* Touch screens: each part is a 48 px target (the whole switch 48 px tall). In Workbench's 36 px mainBar the switch
|
|
9233
|
-
keeps its 28 px look, like the bar's other buttons, and each part's touch area grows to 48 px (touch.css). */
|
|
9234
|
-
@media (pointer: coarse) {
|
|
9235
|
-
.ui-seg {
|
|
9236
|
-
height: var(--touch-target);
|
|
9237
|
-
}
|
|
9238
|
-
.ui-seg.is-icons .ui-seg-item,
|
|
9239
|
-
.ui-wb-mainbar .ui-seg.is-icons .ui-seg-item {
|
|
9240
|
-
width: 42px;
|
|
9241
|
-
}
|
|
9242
|
-
}
|
|
9243
|
-
@media (prefers-reduced-motion: reduce) {
|
|
9244
|
-
.ui-seg-ind {
|
|
9245
|
-
transition: none !important;
|
|
9246
|
-
}
|
|
9247
|
-
}
|
|
9248
9383
|
/* StatusBand: a 12 px band of classes along time; under a LineChart it lines up with the points. */
|
|
9249
9384
|
.ui-statusband-bar {
|
|
9250
9385
|
position: relative;
|
|
@@ -9609,8 +9744,8 @@ button.ui-md-link.is-row {
|
|
|
9609
9744
|
border-bottom: 0;
|
|
9610
9745
|
}
|
|
9611
9746
|
.ui-events-time {
|
|
9747
|
+
/* The row's size: the time, the icon and the sentence are one row, so one text size. */
|
|
9612
9748
|
font-family: var(--font-mono);
|
|
9613
|
-
font-size: var(--text-small);
|
|
9614
9749
|
color: var(--ink-muted);
|
|
9615
9750
|
font-variant-numeric: tabular-nums;
|
|
9616
9751
|
}
|
|
@@ -9650,6 +9785,8 @@ button.ui-md-link.is-row {
|
|
|
9650
9785
|
}
|
|
9651
9786
|
.ui-events-actor {
|
|
9652
9787
|
color: var(--ink-muted);
|
|
9788
|
+
/* A name stays whole: it moves to the next line rather than splitting (「系/統」). */
|
|
9789
|
+
white-space: nowrap;
|
|
9653
9790
|
}
|
|
9654
9791
|
.ui-events-empty {
|
|
9655
9792
|
margin: 0;
|
|
@@ -9985,7 +10122,8 @@ button.ui-md-link.is-row {
|
|
|
9985
10122
|
.ui-input,
|
|
9986
10123
|
.ui-select-trigger,
|
|
9987
10124
|
.ui-datefield,
|
|
9988
|
-
.ui-pwfield
|
|
10125
|
+
.ui-pwfield,
|
|
10126
|
+
.ui-field-box.has-affix {
|
|
9989
10127
|
height: var(--touch-target);
|
|
9990
10128
|
}
|
|
9991
10129
|
}
|
|
@@ -10067,6 +10205,7 @@ button.ui-md-link.is-row {
|
|
|
10067
10205
|
.ui-cal-day:focus-visible,
|
|
10068
10206
|
.ui-ms:focus-within,
|
|
10069
10207
|
.ui-pwfield:focus-within,
|
|
10208
|
+
.ui-field-box.has-affix:focus-within,
|
|
10070
10209
|
.ui-dt-opt:focus-visible,
|
|
10071
10210
|
.ui-code.is-link:focus-visible,
|
|
10072
10211
|
.ui-code.is-link.is-name:focus-visible,
|
package/dist/theme.d.ts
CHANGED
|
@@ -35,4 +35,11 @@ export declare function divergeToken(diff: number, limits: {
|
|
|
35
35
|
zero: number;
|
|
36
36
|
strong: number;
|
|
37
37
|
}): 'diverge-neg-strong' | 'diverge-neg' | 'diverge-zero' | 'diverge-pos' | 'diverge-pos-strong';
|
|
38
|
+
/**
|
|
39
|
+
* A small script for an inline <script> in <head> of a server-rendered page: applies the stored theme (data-theme,
|
|
40
|
+
* data-theme-setting) and the picked accent before the first paint, so the page does not flash the light theme or the
|
|
41
|
+
* default accent until initTheme runs. A preset goes on <html data-theme-preset> in the server's markup; the script
|
|
42
|
+
* keeps it. Still call initTheme() at startup.
|
|
43
|
+
*/
|
|
44
|
+
export declare const themeScript = "(function(){try{var d=document.documentElement,s=localStorage,t=s.getItem('ui-theme');if(t!=='light'&&t!=='dark')t='auto';var p=d.getAttribute('data-theme-preset');var m=t!=='auto'?t:window.matchMedia&&matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light';d.setAttribute('data-theme',p||m);d.setAttribute('data-theme-setting',t);var a=s.getItem('ui-accent'),c=JSON.parse(s.getItem('ui-accent-vars')||'null'),v=a&&c&&c.hex===a&&c[p?'light':m];if(v)for(var k in v)d.style.setProperty(k,v[k])}catch(e){}})();";
|
|
38
45
|
export type { ThemePreset };
|
package/dist/theme.js
CHANGED
|
@@ -7,6 +7,8 @@ import { reduced } from "./internal/util.js";
|
|
|
7
7
|
// src/theme.ts
|
|
8
8
|
const THEME_KEY = "ui-theme";
|
|
9
9
|
const ACCENT_KEY = "ui-accent";
|
|
10
|
+
/** The picked accent's derived tokens, for themeScript. */
|
|
11
|
+
const ACCENT_VARS_KEY = "ui-accent-vars";
|
|
10
12
|
const PRESET_ATTR = "data-theme-preset";
|
|
11
13
|
const isSetting = (v) => v === "auto" || v === "light" || v === "dark";
|
|
12
14
|
const hasDom = () => typeof window !== "undefined" && typeof document !== "undefined";
|
|
@@ -180,6 +182,23 @@ const ACCENT_VARS = [
|
|
|
180
182
|
"--focus",
|
|
181
183
|
"--focus-ring"
|
|
182
184
|
];
|
|
185
|
+
/** Every accent token for one color on one theme's grounds. */
|
|
186
|
+
function accentVars(hex, dark, surface, bg, sub, chrome) {
|
|
187
|
+
const soft = dark ? mixHex(surface, hex, .22) : mixHex("#ffffff", hex, .12);
|
|
188
|
+
const text = accentText(hex, dark, bg, surface, sub, chrome, soft);
|
|
189
|
+
const fill = accentFill(hex, dark, bg, surface, sub, chrome, soft);
|
|
190
|
+
const away = dark ? "#ffffff" : "#000000";
|
|
191
|
+
return {
|
|
192
|
+
"--accent": fill,
|
|
193
|
+
"--accent-hover": mixHex(fill, away, .12),
|
|
194
|
+
"--accent-press": mixHex(fill, away, .22),
|
|
195
|
+
"--accent-soft": soft,
|
|
196
|
+
"--accent-text": text,
|
|
197
|
+
"--on-accent": onFill(fill),
|
|
198
|
+
"--focus": text,
|
|
199
|
+
"--focus-ring": text
|
|
200
|
+
};
|
|
201
|
+
}
|
|
183
202
|
/** Derives every accent token from one color (自訂強調色的換算 in docs/theme.md) and writes them on <html>.
|
|
184
203
|
* Returns false for anything but #rrggbb. quiet: apply without storing. */
|
|
185
204
|
function setAccent(hex, quiet = false) {
|
|
@@ -194,22 +213,19 @@ function setAccent(hex, quiet = false) {
|
|
|
194
213
|
const bg = toHex(cs.getPropertyValue("--bg")) ?? GROUNDS.bg[mode];
|
|
195
214
|
const sub = toHex(cs.getPropertyValue("--surface-sub")) ?? GROUNDS["surface-sub"][mode];
|
|
196
215
|
const chrome = toHex(cs.getPropertyValue("--surface-chrome")) ?? GROUNDS["surface-chrome"][mode];
|
|
197
|
-
const
|
|
198
|
-
const text = accentText(hex, dark, bg, surface, sub, chrome, soft);
|
|
199
|
-
const fill = accentFill(hex, dark, bg, surface, sub, chrome, soft);
|
|
200
|
-
const away = dark ? "#ffffff" : "#000000";
|
|
201
|
-
const vars = {
|
|
202
|
-
"--accent": fill,
|
|
203
|
-
"--accent-hover": mixHex(fill, away, .12),
|
|
204
|
-
"--accent-press": mixHex(fill, away, .22),
|
|
205
|
-
"--accent-soft": soft,
|
|
206
|
-
"--accent-text": text,
|
|
207
|
-
"--on-accent": onFill(fill),
|
|
208
|
-
"--focus": text,
|
|
209
|
-
"--focus-ring": text
|
|
210
|
-
};
|
|
216
|
+
const vars = accentVars(hex, dark, surface, bg, sub, chrome);
|
|
211
217
|
for (const [k, v] of Object.entries(vars)) root.style.setProperty(k, v);
|
|
212
218
|
if (!quiet) writeStored(ACCENT_KEY, hex);
|
|
219
|
+
if (readStored("ui-accent") === hex) {
|
|
220
|
+
const other = !dark;
|
|
221
|
+
const o = other ? "dark" : "light";
|
|
222
|
+
const cache = {
|
|
223
|
+
hex,
|
|
224
|
+
[mode]: vars
|
|
225
|
+
};
|
|
226
|
+
if (!themePreset()) cache[o] = accentVars(hex, other, GROUNDS.surface[o], GROUNDS.bg[o], GROUNDS["surface-sub"][o], GROUNDS["surface-chrome"][o]);
|
|
227
|
+
writeStored(ACCENT_VARS_KEY, JSON.stringify(cache));
|
|
228
|
+
}
|
|
213
229
|
return true;
|
|
214
230
|
}
|
|
215
231
|
/** Forgets the picked accent and removes the inline accent variables, so tokens.css (the theme or preset) decides. */
|
|
@@ -217,6 +233,7 @@ function resetAccent() {
|
|
|
217
233
|
if (!hasDom()) return;
|
|
218
234
|
for (const k of ACCENT_VARS) document.documentElement.style.removeProperty(k);
|
|
219
235
|
writeStored(ACCENT_KEY, null);
|
|
236
|
+
writeStored(ACCENT_VARS_KEY, null);
|
|
220
237
|
}
|
|
221
238
|
/** Applies the picked accent for the current theme, or removes the inline variables when none is picked. */
|
|
222
239
|
function applyAccent() {
|
|
@@ -265,6 +282,13 @@ function divergeToken(diff, limits) {
|
|
|
265
282
|
const strong = a >= limits.strong;
|
|
266
283
|
return diff < 0 ? strong ? "diverge-neg-strong" : "diverge-neg" : strong ? "diverge-pos-strong" : "diverge-pos";
|
|
267
284
|
}
|
|
268
|
-
|
|
285
|
+
/**
|
|
286
|
+
* A small script for an inline <script> in <head> of a server-rendered page: applies the stored theme (data-theme,
|
|
287
|
+
* data-theme-setting) and the picked accent before the first paint, so the page does not flash the light theme or the
|
|
288
|
+
* default accent until initTheme runs. A preset goes on <html data-theme-preset> in the server's markup; the script
|
|
289
|
+
* keeps it. Still call initTheme() at startup.
|
|
290
|
+
*/
|
|
291
|
+
const themeScript = `(function(){try{var d=document.documentElement,s=localStorage,t=s.getItem('${THEME_KEY}');if(t!=='light'&&t!=='dark')t='auto';var p=d.getAttribute('${PRESET_ATTR}');var m=t!=='auto'?t:window.matchMedia&&matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light';d.setAttribute('data-theme',p||m);d.setAttribute('data-theme-setting',t);var a=s.getItem('${ACCENT_KEY}'),c=JSON.parse(s.getItem('${ACCENT_VARS_KEY}')||'null'),v=a&&c&&c.hex===a&&c[p?'light':m];if(v)for(var k in v)d.style.setProperty(k,v[k])}catch(e){}})();`;
|
|
292
|
+
export { ACCENT_KEY, ACCENT_SWATCHES, DEFAULT_ACCENT, THEME_KEY, accentFill, accentText, defaultAccent, divergeToken, heatToken, initTheme, onFill, parseAccent, parseTheme, pickedAccent, resetAccent, setAccent, setTheme, storedAccent, storedTheme, textOn, themePreset, themeScript, toHex };
|
|
269
293
|
|
|
270
294
|
//# sourceMappingURL=theme.js.map
|