@shellui/core 0.7.0-alpha.10 → 0.7.0-alpha.11
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/package.json +2 -2
- package/src/components/ui/drawer.tsx +47 -30
- package/src/components/ui/sheet.tsx +18 -12
- package/src/components/ui/sidebar.tsx +14 -6
- package/src/components/ui/tooltip.tsx +4 -2
- package/src/features/auth/components/LoginButton.spec.tsx +155 -0
- package/src/features/auth/components/LoginButton.tsx +52 -27
- package/src/features/auth/components/LoginButtonIcons.tsx +4 -8
- package/src/features/chromeActions/ChromeActionsHost.tsx +5 -1
- package/src/features/layouts/OverlayShell.tsx +58 -40
- package/src/features/layouts/appbar/AppBarItemIcon.spec.tsx +45 -0
- package/src/features/layouts/appbar/AppBarItemIcon.tsx +19 -0
- package/src/features/layouts/appbar/AppBarLayout.tsx +53 -81
- package/src/features/layouts/appbar/appBarOverflow.spec.ts +27 -0
- package/src/features/layouts/appbar/appBarOverflow.ts +42 -0
- package/src/features/layouts/chrome/CollapsedDesktopTitlebar.tsx +1 -1
- package/src/features/layouts/chrome/constants.ts +3 -0
- package/src/features/layouts/chrome/viewport.ts +11 -4
- package/src/features/layouts/floating/FloatingBottomDock.tsx +66 -25
- package/src/features/layouts/floating/FloatingLayout.tsx +1 -0
- package/src/features/layouts/floating/FloatingSidebar.tsx +26 -8
- package/src/features/layouts/floating/moreSections.spec.ts +28 -0
- package/src/features/layouts/floating/moreSections.ts +31 -0
- package/src/features/layouts/fullscreen/FullscreenLayout.spec.tsx +68 -0
- package/src/features/layouts/fullscreen/FullscreenLayout.tsx +10 -1
- package/src/features/layouts/sidebar/NavigationContent.tsx +4 -4
- package/src/features/layouts/sidebar/SidebarIcons.tsx +67 -0
- package/src/features/layouts/sidebar/SidebarInner.spec.tsx +109 -0
- package/src/features/layouts/sidebar/SidebarInner.tsx +49 -9
- package/src/features/layouts/sidebar/SidebarLayout.tsx +23 -13
- package/src/features/layouts/windows/WindowsLayout.tsx +75 -44
- package/src/features/layouts/windows/deskDots.spec.ts +6 -4
- package/src/features/layouts/windows/deskDots.ts +8 -8
- package/src/features/overlays/ResponsiveModal.tsx +5 -3
- package/src/features/overlays/overlaySize.spec.ts +56 -16
- package/src/features/overlays/overlaySize.ts +114 -31
- package/src/features/overlays/phoneDrawerAnchoring.spec.ts +187 -0
- package/src/features/overlays/useOverlayReportedSize.ts +8 -3
- package/src/i18n/translations/en/common.json +1 -0
- package/src/i18n/translations/fr/common.json +1 -0
- package/src/index.css +211 -32
- package/src/service-worker/devCaches.spec.ts +32 -0
- package/src/service-worker/devCaches.ts +27 -0
- package/src/service-worker/sw-dev.ts +23 -23
package/src/index.css
CHANGED
|
@@ -217,6 +217,39 @@ html[data-shellui-nav-contrast='low'] {
|
|
|
217
217
|
);
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
+
/*
|
|
221
|
+
* Floating drawers: every drawer, sheet and phone bottom sheet sits a gap away
|
|
222
|
+
* from the window edge (8px on phones, 12px from 768px), plus the safe area.
|
|
223
|
+
* Radii follow the theme radius, so --radius: 0 gives square panels.
|
|
224
|
+
*/
|
|
225
|
+
:root {
|
|
226
|
+
--shellui-drawer-gap: 8px;
|
|
227
|
+
--shellui-drawer-radius: var(--shellui-r-float);
|
|
228
|
+
--shellui-sheet-radius: calc(var(--shellui-r-float) * 1.5);
|
|
229
|
+
--shellui-drawer-border: var(--border);
|
|
230
|
+
--shellui-drawer-shadow: var(--shellui-win-shadow);
|
|
231
|
+
--shellui-drawer-top: calc(var(--shellui-drawer-gap) + var(--shellui-safe-area-top));
|
|
232
|
+
--shellui-drawer-right: calc(var(--shellui-drawer-gap) + var(--shellui-safe-area-right));
|
|
233
|
+
--shellui-drawer-bottom: calc(var(--shellui-drawer-gap) + var(--shellui-safe-area-bottom));
|
|
234
|
+
--shellui-drawer-left: calc(var(--shellui-drawer-gap) + var(--shellui-safe-area-left));
|
|
235
|
+
--shellui-drawer-max-width: calc(
|
|
236
|
+
100vw - var(--shellui-drawer-left) - var(--shellui-drawer-right)
|
|
237
|
+
);
|
|
238
|
+
--shellui-drawer-max-height: calc(
|
|
239
|
+
var(--shellui-app-height) - var(--shellui-drawer-top) - var(--shellui-drawer-bottom)
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
@media (min-width: 768px) {
|
|
243
|
+
:root {
|
|
244
|
+
--shellui-drawer-gap: 12px;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
/* macOS desktop: drawers clear the 32px strip and the default traffic lights. */
|
|
248
|
+
html[data-shellui-mac-chrome],
|
|
249
|
+
html[data-shellui-overlay-chrome] {
|
|
250
|
+
--shellui-drawer-top: calc(var(--shellui-mac-titlebar-h) + var(--shellui-drawer-gap));
|
|
251
|
+
}
|
|
252
|
+
|
|
220
253
|
/*
|
|
221
254
|
* Content padding that clears the notch / home indicator, then keeps the
|
|
222
255
|
* configured inset beyond that edge. Override with --shellui-safe-pad-x / -y.
|
|
@@ -911,10 +944,10 @@ html.shellui-theme-switching
|
|
|
911
944
|
* Do not set `transform: none` — enter/exit slide and swipe-dismiss own transform.
|
|
912
945
|
* Morph transitions omit `transform` so keyframes / drag aren’t fought. */
|
|
913
946
|
[data-dialog-content][data-presentation='sheet'] {
|
|
914
|
-
left:
|
|
915
|
-
right:
|
|
947
|
+
left: var(--shellui-drawer-left);
|
|
948
|
+
right: var(--shellui-drawer-right);
|
|
916
949
|
top: auto;
|
|
917
|
-
bottom:
|
|
950
|
+
bottom: var(--shellui-drawer-bottom);
|
|
918
951
|
transition-property:
|
|
919
952
|
width, height, max-width, max-height, border-radius, left, right, top, bottom, padding;
|
|
920
953
|
transition-duration: 220ms;
|
|
@@ -1007,7 +1040,7 @@ html.shellui-theme-switching
|
|
|
1007
1040
|
@keyframes responsive-modal-sheet-in {
|
|
1008
1041
|
from {
|
|
1009
1042
|
opacity: 1;
|
|
1010
|
-
transform: translateY(100%);
|
|
1043
|
+
transform: translateY(calc(100% + var(--shellui-drawer-bottom) + 48px));
|
|
1011
1044
|
}
|
|
1012
1045
|
to {
|
|
1013
1046
|
opacity: 1;
|
|
@@ -1021,7 +1054,7 @@ html.shellui-theme-switching
|
|
|
1021
1054
|
}
|
|
1022
1055
|
to {
|
|
1023
1056
|
opacity: 1;
|
|
1024
|
-
transform: translateY(100%);
|
|
1057
|
+
transform: translateY(calc(100% + var(--shellui-drawer-bottom) + 48px));
|
|
1025
1058
|
}
|
|
1026
1059
|
}
|
|
1027
1060
|
|
|
@@ -1124,7 +1157,7 @@ html.shellui-theme-switching
|
|
|
1124
1157
|
}
|
|
1125
1158
|
@keyframes sheet-content-in-left {
|
|
1126
1159
|
from {
|
|
1127
|
-
transform: translateX(-100%);
|
|
1160
|
+
transform: translateX(calc(-100% - var(--shellui-drawer-left) - 48px));
|
|
1128
1161
|
}
|
|
1129
1162
|
to {
|
|
1130
1163
|
transform: translateX(0);
|
|
@@ -1135,12 +1168,12 @@ html.shellui-theme-switching
|
|
|
1135
1168
|
transform: translateX(0);
|
|
1136
1169
|
}
|
|
1137
1170
|
to {
|
|
1138
|
-
transform: translateX(-100%);
|
|
1171
|
+
transform: translateX(calc(-100% - var(--shellui-drawer-left) - 48px));
|
|
1139
1172
|
}
|
|
1140
1173
|
}
|
|
1141
1174
|
@keyframes sheet-content-in-right {
|
|
1142
1175
|
from {
|
|
1143
|
-
transform: translateX(100%);
|
|
1176
|
+
transform: translateX(calc(100% + var(--shellui-drawer-right) + 48px));
|
|
1144
1177
|
}
|
|
1145
1178
|
to {
|
|
1146
1179
|
transform: translateX(0);
|
|
@@ -1151,12 +1184,12 @@ html.shellui-theme-switching
|
|
|
1151
1184
|
transform: translateX(0);
|
|
1152
1185
|
}
|
|
1153
1186
|
to {
|
|
1154
|
-
transform: translateX(100%);
|
|
1187
|
+
transform: translateX(calc(100% + var(--shellui-drawer-right) + 48px));
|
|
1155
1188
|
}
|
|
1156
1189
|
}
|
|
1157
1190
|
@keyframes sheet-content-in-top {
|
|
1158
1191
|
from {
|
|
1159
|
-
transform: translateY(-100%);
|
|
1192
|
+
transform: translateY(calc(-100% - var(--shellui-drawer-top) - 48px));
|
|
1160
1193
|
}
|
|
1161
1194
|
to {
|
|
1162
1195
|
transform: translateY(0);
|
|
@@ -1167,12 +1200,12 @@ html.shellui-theme-switching
|
|
|
1167
1200
|
transform: translateY(0);
|
|
1168
1201
|
}
|
|
1169
1202
|
to {
|
|
1170
|
-
transform: translateY(-100%);
|
|
1203
|
+
transform: translateY(calc(-100% - var(--shellui-drawer-top) - 48px));
|
|
1171
1204
|
}
|
|
1172
1205
|
}
|
|
1173
1206
|
@keyframes sheet-content-in-bottom {
|
|
1174
1207
|
from {
|
|
1175
|
-
transform: translateY(100%);
|
|
1208
|
+
transform: translateY(calc(100% + var(--shellui-drawer-bottom) + 48px));
|
|
1176
1209
|
}
|
|
1177
1210
|
to {
|
|
1178
1211
|
transform: translateY(0);
|
|
@@ -1183,7 +1216,7 @@ html.shellui-theme-switching
|
|
|
1183
1216
|
transform: translateY(0);
|
|
1184
1217
|
}
|
|
1185
1218
|
to {
|
|
1186
|
-
transform: translateY(100%);
|
|
1219
|
+
transform: translateY(calc(100% + var(--shellui-drawer-bottom) + 48px));
|
|
1187
1220
|
}
|
|
1188
1221
|
}
|
|
1189
1222
|
|
|
@@ -1228,6 +1261,78 @@ html.shellui-theme-switching
|
|
|
1228
1261
|
pointer-events: none;
|
|
1229
1262
|
}
|
|
1230
1263
|
|
|
1264
|
+
/*
|
|
1265
|
+
* Floating drawers (vaul). Offsets, radius, border and shadow live on the
|
|
1266
|
+
* drawerContentByDirection classes. The closed position adds the edge offset
|
|
1267
|
+
* plus 48px so no strip of panel or shadow stays on screen as it slides.
|
|
1268
|
+
*/
|
|
1269
|
+
[data-drawer-content][data-drawer-direction='right'] {
|
|
1270
|
+
--initial-transform: calc(100% + var(--shellui-drawer-right) + 48px);
|
|
1271
|
+
}
|
|
1272
|
+
[data-drawer-content][data-drawer-direction='left'] {
|
|
1273
|
+
--initial-transform: calc(100% + var(--shellui-drawer-left) + 48px);
|
|
1274
|
+
}
|
|
1275
|
+
[data-drawer-content][data-drawer-direction='top'] {
|
|
1276
|
+
--initial-transform: calc(100% + var(--shellui-drawer-top) + 48px);
|
|
1277
|
+
}
|
|
1278
|
+
[data-drawer-content][data-drawer-direction='bottom'] {
|
|
1279
|
+
--initial-transform: calc(100% + var(--shellui-drawer-bottom) + 48px);
|
|
1280
|
+
}
|
|
1281
|
+
/* vaul paints a 200% ::after past the anchored edge; it would fill the gap. */
|
|
1282
|
+
[data-drawer-content]::after {
|
|
1283
|
+
content: none !important;
|
|
1284
|
+
}
|
|
1285
|
+
/* macOS desktop: the scrim starts under the 32px strip so the lights and window drag keep working. */
|
|
1286
|
+
html[data-shellui-mac-chrome] [data-drawer-overlay],
|
|
1287
|
+
html[data-shellui-overlay-chrome] [data-drawer-overlay] {
|
|
1288
|
+
top: var(--shellui-mac-titlebar-h);
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
@keyframes shellui-drawer-fade-in {
|
|
1292
|
+
from {
|
|
1293
|
+
opacity: 0;
|
|
1294
|
+
}
|
|
1295
|
+
to {
|
|
1296
|
+
opacity: 1;
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
@keyframes shellui-drawer-fade-out {
|
|
1300
|
+
from {
|
|
1301
|
+
opacity: 1;
|
|
1302
|
+
}
|
|
1303
|
+
to {
|
|
1304
|
+
opacity: 0;
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
/* Reduced motion: drawers and sheets fade in place instead of sliding. !important beats vaul's injected slide rules. */
|
|
1309
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1310
|
+
[data-drawer-content] {
|
|
1311
|
+
--initial-transform: 0px;
|
|
1312
|
+
transition: none !important;
|
|
1313
|
+
}
|
|
1314
|
+
[data-drawer-content][data-state='open'] {
|
|
1315
|
+
animation: shellui-drawer-fade-in 150ms ease-out both !important;
|
|
1316
|
+
}
|
|
1317
|
+
[data-drawer-content][data-state='closed'] {
|
|
1318
|
+
animation: shellui-drawer-fade-out 120ms ease-in both !important;
|
|
1319
|
+
}
|
|
1320
|
+
[data-sheet-content][data-side][data-state='open'] {
|
|
1321
|
+
animation: shellui-drawer-fade-in 150ms ease-out both;
|
|
1322
|
+
}
|
|
1323
|
+
[data-sheet-content][data-side][data-state='closed'] {
|
|
1324
|
+
animation: shellui-drawer-fade-out 120ms ease-in both;
|
|
1325
|
+
}
|
|
1326
|
+
[data-dialog-content][data-presentation='sheet'][data-state='open'][data-enter-motion] {
|
|
1327
|
+
animation: shellui-drawer-fade-in 150ms ease-out;
|
|
1328
|
+
}
|
|
1329
|
+
[data-dialog-content][data-presentation='sheet'][data-state='closed']:not(
|
|
1330
|
+
[data-dismiss='swipe']
|
|
1331
|
+
) {
|
|
1332
|
+
animation: shellui-drawer-fade-out 120ms ease-in forwards;
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1231
1336
|
/* Cookie consent dialog (bottom-left) animations */
|
|
1232
1337
|
@keyframes cookie-dialog-content-in {
|
|
1233
1338
|
from {
|
|
@@ -1362,6 +1467,12 @@ html.shellui-theme-switching
|
|
|
1362
1467
|
animation: auth-menu-out 0.12s cubic-bezier(0.4, 0, 1, 1) both;
|
|
1363
1468
|
pointer-events: none;
|
|
1364
1469
|
}
|
|
1470
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1471
|
+
[data-auth-menu-content][data-state],
|
|
1472
|
+
[data-shellui-auth-loading] .animate-pulse {
|
|
1473
|
+
animation: none;
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1365
1476
|
|
|
1366
1477
|
/* Tauri overlay titlebar: drag via data-tauri-drag-region; keep controls clickable. */
|
|
1367
1478
|
[data-shellui-drag-region],
|
|
@@ -1450,9 +1561,9 @@ html[data-shellui-overlay-chrome] [data-slot='sidebar-container'] {
|
|
|
1450
1561
|
/*
|
|
1451
1562
|
* Tablet / desktop: fixed shell sidebar sits below the layout safe-area strip.
|
|
1452
1563
|
* Only when the root (non-iframe) layout advertised the topbar via
|
|
1453
|
-
* data-shellui-safe-area-topbar.
|
|
1454
|
-
*
|
|
1455
|
-
*
|
|
1564
|
+
* data-shellui-safe-area-topbar. Drawers clear the inset through
|
|
1565
|
+
* --shellui-drawer-top, which already includes the safe area.
|
|
1566
|
+
* Height is 0 when env(safe-area-inset-top) is 0.
|
|
1456
1567
|
*/
|
|
1457
1568
|
@media (min-width: 768px) {
|
|
1458
1569
|
html[data-shellui-safe-area-topbar]
|
|
@@ -1464,21 +1575,6 @@ html[data-shellui-overlay-chrome] [data-slot='sidebar-container'] {
|
|
|
1464
1575
|
bottom: auto;
|
|
1465
1576
|
height: calc(var(--shellui-app-height, 100dvh) - var(--shellui-safe-area-top));
|
|
1466
1577
|
}
|
|
1467
|
-
|
|
1468
|
-
html[data-shellui-safe-area-topbar] [data-drawer-content][data-drawer-direction='left'],
|
|
1469
|
-
html[data-shellui-safe-area-topbar] [data-drawer-content][data-drawer-direction='right'] {
|
|
1470
|
-
top: var(--shellui-safe-area-top);
|
|
1471
|
-
bottom: 0;
|
|
1472
|
-
height: auto;
|
|
1473
|
-
}
|
|
1474
|
-
|
|
1475
|
-
/* Top drawer: sit below the safe-area band (no extra pt — offset replaces it). */
|
|
1476
|
-
html[data-shellui-safe-area-topbar] [data-drawer-content][data-drawer-direction='top'] {
|
|
1477
|
-
top: var(--shellui-safe-area-top);
|
|
1478
|
-
padding-top: 0;
|
|
1479
|
-
border-top-left-radius: 0.75rem;
|
|
1480
|
-
border-top-right-radius: 0.75rem;
|
|
1481
|
-
}
|
|
1482
1578
|
}
|
|
1483
1579
|
|
|
1484
1580
|
/* Collapsed Tauri: full-width 32px macOS strip; push sidebar + content below it. */
|
|
@@ -1712,6 +1808,26 @@ html[data-shellui-safe-area-topbar] [data-shellui-collapsed-titlebar] {
|
|
|
1712
1808
|
.shellui-appbar-end.is-active {
|
|
1713
1809
|
background-color: var(--shellui-nav-hover);
|
|
1714
1810
|
}
|
|
1811
|
+
/*
|
|
1812
|
+
* Web bar (56px, 6px top pad, 1px border): the underline sits on the bar's bottom
|
|
1813
|
+
* border, half the leftover height below the item. Tauri keeps it at the item bottom.
|
|
1814
|
+
*/
|
|
1815
|
+
html:not([data-shellui-host='tauri'])
|
|
1816
|
+
[data-shellui-app-bar-layout]
|
|
1817
|
+
> header
|
|
1818
|
+
.shellui-appbar-item.is-active::after,
|
|
1819
|
+
html:not([data-shellui-host='tauri'])
|
|
1820
|
+
[data-shellui-mobile-chrome-stack]
|
|
1821
|
+
> header[data-layout]
|
|
1822
|
+
.shellui-appbar-item.is-active::after {
|
|
1823
|
+
bottom: calc((var(--shellui-appbar-item-h, 32px) - 49px) / 2 - 1px);
|
|
1824
|
+
}
|
|
1825
|
+
@media (max-width: 767px) {
|
|
1826
|
+
[data-shellui-app-bar-layout] .shellui-appbar-item {
|
|
1827
|
+
--shellui-appbar-item-h: 40px;
|
|
1828
|
+
height: 40px;
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1715
1831
|
.shellui-appbar-item:focus-visible,
|
|
1716
1832
|
.shellui-appbar-end:focus-visible {
|
|
1717
1833
|
outline: 2px solid var(--sidebar-ring);
|
|
@@ -1732,6 +1848,9 @@ html[data-shellui-safe-area-topbar] [data-shellui-collapsed-titlebar] {
|
|
|
1732
1848
|
font-size: 13.5px;
|
|
1733
1849
|
border-radius: var(--shellui-r-row);
|
|
1734
1850
|
}
|
|
1851
|
+
.shellui-appbar-menu .shellui-appbar-menu-item > :first-child:is(svg, img, span[aria-hidden]) {
|
|
1852
|
+
color: var(--muted-foreground);
|
|
1853
|
+
}
|
|
1735
1854
|
.shellui-appbar-menu .shellui-appbar-menu-item.is-active {
|
|
1736
1855
|
background-color: var(--accent);
|
|
1737
1856
|
color: var(--accent-foreground);
|
|
@@ -1896,7 +2015,7 @@ html[data-shellui-safe-area-topbar] [data-shellui-collapsed-titlebar] {
|
|
|
1896
2015
|
right: calc(8px + var(--shellui-safe-area-right));
|
|
1897
2016
|
bottom: calc(8px + var(--shellui-safe-area-bottom));
|
|
1898
2017
|
padding-top: 8px;
|
|
1899
|
-
border-radius:
|
|
2018
|
+
border-radius: var(--shellui-sheet-radius);
|
|
1900
2019
|
background: color-mix(in oklch, var(--sidebar) 92%, transparent);
|
|
1901
2020
|
backdrop-filter: blur(24px) saturate(180%);
|
|
1902
2021
|
-webkit-backdrop-filter: blur(24px) saturate(180%);
|
|
@@ -1910,6 +2029,13 @@ html[data-shellui-safe-area-topbar] [data-shellui-collapsed-titlebar] {
|
|
|
1910
2029
|
border-radius: 999px;
|
|
1911
2030
|
background: color-mix(in oklch, var(--sidebar-foreground) 22%, transparent);
|
|
1912
2031
|
}
|
|
2032
|
+
/* More sheet group label (sidebar sheet label size, 12.5px / 600). */
|
|
2033
|
+
.shellui-more-sheet-label {
|
|
2034
|
+
padding: 14px 12px 4px;
|
|
2035
|
+
font-size: 12.5px;
|
|
2036
|
+
font-weight: 600;
|
|
2037
|
+
color: var(--shellui-nav-label);
|
|
2038
|
+
}
|
|
1913
2039
|
.shellui-more-sheet-row {
|
|
1914
2040
|
min-height: 48px;
|
|
1915
2041
|
padding-inline: 12px;
|
|
@@ -1938,6 +2064,21 @@ html[data-shellui-safe-area-topbar] [data-shellui-collapsed-titlebar] {
|
|
|
1938
2064
|
.shellui-more-sheet-account:empty {
|
|
1939
2065
|
display: none;
|
|
1940
2066
|
}
|
|
2067
|
+
/* Account row: 48 px in the mobile sidebar sheet, 56 px with a 32 px avatar in the More sheet. */
|
|
2068
|
+
[data-mobile='true'] .shellui-account-row {
|
|
2069
|
+
height: 3rem;
|
|
2070
|
+
}
|
|
2071
|
+
.shellui-more-sheet-account .shellui-account-row {
|
|
2072
|
+
height: 3.5rem;
|
|
2073
|
+
padding-inline: 0.75rem;
|
|
2074
|
+
font-size: 15px;
|
|
2075
|
+
}
|
|
2076
|
+
.shellui-more-sheet-account .shellui-account-row [data-shellui-account-initials],
|
|
2077
|
+
.shellui-more-sheet-account .shellui-account-row img {
|
|
2078
|
+
width: 2rem;
|
|
2079
|
+
height: 2rem;
|
|
2080
|
+
font-size: 12px;
|
|
2081
|
+
}
|
|
1941
2082
|
/* vaul paints an ::after below bottom drawers; the sheet floats, so drop it. */
|
|
1942
2083
|
.shellui-more-sheet::after {
|
|
1943
2084
|
content: none !important;
|
|
@@ -2204,6 +2345,32 @@ html[data-shellui-keyboard='open']
|
|
|
2204
2345
|
.shellui-start-foot {
|
|
2205
2346
|
border-top: 1px solid color-mix(in oklch, var(--border) 60%, transparent);
|
|
2206
2347
|
}
|
|
2348
|
+
.shellui-start-label {
|
|
2349
|
+
font-size: 12px;
|
|
2350
|
+
font-weight: 600;
|
|
2351
|
+
text-transform: none;
|
|
2352
|
+
letter-spacing: 0;
|
|
2353
|
+
}
|
|
2354
|
+
.shellui-task.shellui-task-icon {
|
|
2355
|
+
width: 38px;
|
|
2356
|
+
justify-content: center;
|
|
2357
|
+
padding: 0;
|
|
2358
|
+
}
|
|
2359
|
+
.shellui-start-settings {
|
|
2360
|
+
display: inline-flex;
|
|
2361
|
+
width: 36px;
|
|
2362
|
+
height: 36px;
|
|
2363
|
+
flex: none;
|
|
2364
|
+
align-items: center;
|
|
2365
|
+
justify-content: center;
|
|
2366
|
+
border-radius: var(--shellui-r-row);
|
|
2367
|
+
color: var(--shellui-nav-icon);
|
|
2368
|
+
cursor: pointer;
|
|
2369
|
+
}
|
|
2370
|
+
.shellui-start-settings:hover {
|
|
2371
|
+
background: var(--shellui-nav-hover);
|
|
2372
|
+
color: var(--popover-foreground);
|
|
2373
|
+
}
|
|
2207
2374
|
.shellui-start-row {
|
|
2208
2375
|
display: flex;
|
|
2209
2376
|
width: 100%;
|
|
@@ -2274,6 +2441,18 @@ html[data-shellui-keyboard='open']
|
|
|
2274
2441
|
}
|
|
2275
2442
|
}
|
|
2276
2443
|
|
|
2444
|
+
/*
|
|
2445
|
+
* Fullscreen layout on phones: top pads by safe-area-top + 12px, sides and bottom
|
|
2446
|
+
* by their safe area. The 12px only applies when there is a top inset (the min()
|
|
2447
|
+
* term is 0 on a plain desktop browser).
|
|
2448
|
+
*/
|
|
2449
|
+
.shellui-fullscreen-safe {
|
|
2450
|
+
padding-top: calc(var(--shellui-safe-area-top) + min(12px, var(--shellui-safe-area-top) * 1000));
|
|
2451
|
+
padding-right: var(--shellui-safe-area-right);
|
|
2452
|
+
padding-bottom: var(--shellui-safe-area-bottom);
|
|
2453
|
+
padding-left: var(--shellui-safe-area-left);
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2277
2456
|
/* Fullscreen layout (Tauri): a small glass group keeps history buttons legible on any content. */
|
|
2278
2457
|
.shellui-history-glass {
|
|
2279
2458
|
gap: 2px;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { devCacheNames, isStaleDevCache } from './devCaches';
|
|
3
|
+
|
|
4
|
+
describe('dev service worker caches', () => {
|
|
5
|
+
it('names image, font and html caches after the core version', () => {
|
|
6
|
+
expect(devCacheNames('1.2.3')).toEqual({
|
|
7
|
+
images: 'shellui-dev-images-1.2.3',
|
|
8
|
+
fonts: 'shellui-dev-fonts-1.2.3',
|
|
9
|
+
html: 'shellui-dev-html-1.2.3',
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('has no cache for scripts or styles', () => {
|
|
14
|
+
expect(Object.keys(devCacheNames('1.2.3'))).not.toContain('static-resources');
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('drops unversioned caches and caches from another version', () => {
|
|
18
|
+
for (const name of ['images', 'html-cache', 'static-resources', 'fonts']) {
|
|
19
|
+
expect(isStaleDevCache(name, '1.2.3')).toBe(true);
|
|
20
|
+
}
|
|
21
|
+
expect(isStaleDevCache('shellui-dev-images-1.2.2', '1.2.3')).toBe(true);
|
|
22
|
+
expect(isStaleDevCache('shellui-dev-static-1.2.3', '1.2.3')).toBe(true);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('keeps current caches and caches it does not own', () => {
|
|
26
|
+
for (const name of Object.values(devCacheNames('1.2.3'))) {
|
|
27
|
+
expect(isStaleDevCache(name, '1.2.3')).toBe(false);
|
|
28
|
+
}
|
|
29
|
+
expect(isStaleDevCache('workbox-precache-v2-http://localhost/', '1.2.3')).toBe(false);
|
|
30
|
+
expect(isStaleDevCache('api-cache', '1.2.3')).toBe(false);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache names for the dev service worker (`shellui start`).
|
|
3
|
+
*
|
|
4
|
+
* Vite serves the shell at the same URLs in every version (`/index.css`,
|
|
5
|
+
* `/main.tsx`, `/features/...`), so the dev worker never caches scripts or
|
|
6
|
+
* styles. Images, fonts and the offline HTML fallback use caches named after
|
|
7
|
+
* the core version, so an upgrade drops the previous ones.
|
|
8
|
+
*/
|
|
9
|
+
const DEV_CACHE_PREFIX = 'shellui-dev-';
|
|
10
|
+
|
|
11
|
+
/** Unversioned names written by older dev workers. */
|
|
12
|
+
const LEGACY_DEV_CACHES = ['images', 'html-cache', 'static-resources', 'fonts'];
|
|
13
|
+
|
|
14
|
+
export function devCacheNames(version: string) {
|
|
15
|
+
return {
|
|
16
|
+
images: `${DEV_CACHE_PREFIX}images-${version}`,
|
|
17
|
+
fonts: `${DEV_CACHE_PREFIX}fonts-${version}`,
|
|
18
|
+
html: `${DEV_CACHE_PREFIX}html-${version}`,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** True for a cache an older dev worker left behind. */
|
|
23
|
+
export function isStaleDevCache(name: string, version: string): boolean {
|
|
24
|
+
if (LEGACY_DEV_CACHES.includes(name)) return true;
|
|
25
|
+
if (!name.startsWith(DEV_CACHE_PREFIX)) return false;
|
|
26
|
+
return !Object.values(devCacheNames(version)).includes(name);
|
|
27
|
+
}
|
|
@@ -2,26 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
import { cleanupOutdatedCaches } from 'workbox-precaching';
|
|
4
4
|
import { registerRoute } from 'workbox-routing';
|
|
5
|
-
import { CacheFirst, NetworkFirst
|
|
5
|
+
import { CacheFirst, NetworkFirst } from 'workbox-strategies';
|
|
6
6
|
import { CacheableResponsePlugin } from 'workbox-cacheable-response';
|
|
7
7
|
import { ExpirationPlugin } from 'workbox-expiration';
|
|
8
8
|
import { getLogger } from '@shellui/sdk';
|
|
9
|
+
import { version as coreVersion } from '../../package.json';
|
|
10
|
+
import { devCacheNames, isStaleDevCache } from './devCaches';
|
|
9
11
|
|
|
10
12
|
const _logger = getLogger('shellcore');
|
|
11
13
|
|
|
12
14
|
declare const self: ServiceWorkerGlobalScope;
|
|
13
15
|
|
|
16
|
+
const CACHE = devCacheNames(coreVersion);
|
|
17
|
+
|
|
14
18
|
// Clean up old caches
|
|
15
19
|
cleanupOutdatedCaches();
|
|
16
20
|
|
|
17
|
-
// In dev mode, we don't precache (no manifest available)
|
|
18
|
-
//
|
|
21
|
+
// In dev mode, we don't precache (no manifest available).
|
|
22
|
+
// Scripts, styles and workers always come from the dev server: Vite serves them at
|
|
23
|
+
// the same URLs in every version, so a cached copy would show an older shell.
|
|
19
24
|
|
|
20
25
|
// Cache images with CacheFirst strategy
|
|
21
26
|
registerRoute(
|
|
22
27
|
({ request }) => request.destination === 'image',
|
|
23
28
|
new CacheFirst({
|
|
24
|
-
cacheName:
|
|
29
|
+
cacheName: CACHE.images,
|
|
25
30
|
plugins: [
|
|
26
31
|
new CacheableResponsePlugin({
|
|
27
32
|
statuses: [0, 200],
|
|
@@ -38,23 +43,7 @@ registerRoute(
|
|
|
38
43
|
registerRoute(
|
|
39
44
|
({ request }) => request.destination === 'document',
|
|
40
45
|
new NetworkFirst({
|
|
41
|
-
cacheName:
|
|
42
|
-
plugins: [
|
|
43
|
-
new CacheableResponsePlugin({
|
|
44
|
-
statuses: [0, 200],
|
|
45
|
-
}),
|
|
46
|
-
],
|
|
47
|
-
}),
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
// Cache CSS and JS files with StaleWhileRevalidate
|
|
51
|
-
registerRoute(
|
|
52
|
-
({ request }) =>
|
|
53
|
-
request.destination === 'style' ||
|
|
54
|
-
request.destination === 'script' ||
|
|
55
|
-
request.destination === 'worker',
|
|
56
|
-
new StaleWhileRevalidate({
|
|
57
|
-
cacheName: 'static-resources',
|
|
46
|
+
cacheName: CACHE.html,
|
|
58
47
|
plugins: [
|
|
59
48
|
new CacheableResponsePlugin({
|
|
60
49
|
statuses: [0, 200],
|
|
@@ -67,7 +56,7 @@ registerRoute(
|
|
|
67
56
|
registerRoute(
|
|
68
57
|
({ request }) => request.destination === 'font',
|
|
69
58
|
new CacheFirst({
|
|
70
|
-
cacheName:
|
|
59
|
+
cacheName: CACHE.fonts,
|
|
71
60
|
plugins: [
|
|
72
61
|
new CacheableResponsePlugin({
|
|
73
62
|
statuses: [0, 200],
|
|
@@ -87,5 +76,16 @@ self.addEventListener('message', (event) => {
|
|
|
87
76
|
});
|
|
88
77
|
|
|
89
78
|
self.addEventListener('activate', (event) => {
|
|
90
|
-
event.waitUntil(
|
|
79
|
+
event.waitUntil(
|
|
80
|
+
(async () => {
|
|
81
|
+
// Drop caches from older dev workers (unversioned names or another core version).
|
|
82
|
+
const names = await caches.keys();
|
|
83
|
+
await Promise.all(
|
|
84
|
+
names
|
|
85
|
+
.filter((name) => isStaleDevCache(name, coreVersion))
|
|
86
|
+
.map((name) => caches.delete(name)),
|
|
87
|
+
);
|
|
88
|
+
await self.clients.claim();
|
|
89
|
+
})(),
|
|
90
|
+
);
|
|
91
91
|
});
|