@shellui/core 0.7.0-alpha.8 → 0.7.0-beta.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/README.md +1 -1
- package/package.json +23 -6
- package/src/components/ui/drawer.tsx +47 -30
- package/src/components/ui/sheet.tsx +18 -12
- package/src/components/ui/shell-divider.spec.tsx +63 -0
- package/src/components/ui/shell-divider.tsx +20 -0
- package/src/components/ui/sidebar.tsx +26 -12
- package/src/components/ui/tooltip.tsx +4 -2
- package/src/features/admin/AdminView.tsx +9 -6
- package/src/features/auth/AuthProvider.tsx +10 -1
- package/src/features/auth/components/LoginButton.spec.tsx +203 -0
- package/src/features/auth/components/LoginButton.tsx +77 -28
- package/src/features/auth/components/LoginButtonIcons.tsx +4 -8
- package/src/features/auth/utils/index.ts +1 -0
- package/src/features/auth/utils/resolveSdkLoginRedirectPath.spec.ts +41 -0
- package/src/features/auth/utils/resolveSdkLoginRedirectPath.ts +31 -0
- package/src/features/chromeActions/ChromeActionsHost.tsx +5 -1
- package/src/features/chromeActions/computeActionInsets.ts +7 -4
- 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 +115 -110
- 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 +13 -24
- package/src/features/layouts/chrome/ContentDragOverlay.tsx +5 -6
- package/src/features/layouts/chrome/DesktopChrome.tsx +37 -0
- package/src/features/layouts/chrome/DesktopHistoryButtons.tsx +15 -4
- package/src/features/layouts/chrome/MacStrip.tsx +33 -0
- package/src/features/layouts/chrome/constants.ts +36 -8
- package/src/features/layouts/chrome/index.ts +8 -0
- package/src/features/layouts/chrome/stripDragMap.ts +35 -0
- package/src/features/layouts/chrome/stripNoDrag.spec.tsx +103 -0
- package/src/features/layouts/chrome/useScrollHideChrome.ts +3 -8
- package/src/features/layouts/chrome/viewport.ts +11 -4
- package/src/features/layouts/filterNavigationForAuthState.spec.ts +5 -3
- package/src/features/layouts/floating/FloatingBottomDock.tsx +263 -43
- package/src/features/layouts/floating/FloatingLayout.tsx +14 -8
- package/src/features/layouts/floating/FloatingSidebar.tsx +178 -81
- package/src/features/layouts/floating/computeFloatingInsets.ts +22 -4
- package/src/features/layouts/floating/moreSections.spec.ts +28 -0
- package/src/features/layouts/floating/moreSections.ts +31 -0
- package/src/features/layouts/floating/useFloatingChrome.ts +3 -1
- package/src/features/layouts/floating/useSoftKeyboard.spec.ts +39 -0
- package/src/features/layouts/floating/useSoftKeyboard.ts +82 -0
- package/src/features/layouts/fullscreen/FullscreenLayout.spec.tsx +68 -0
- package/src/features/layouts/fullscreen/FullscreenLayout.tsx +47 -10
- package/src/features/layouts/sidebar/NavigationContent.tsx +17 -9
- package/src/features/layouts/sidebar/SidebarIcons.tsx +70 -9
- package/src/features/layouts/sidebar/SidebarInner.spec.tsx +149 -0
- package/src/features/layouts/sidebar/SidebarInner.tsx +103 -43
- package/src/features/layouts/sidebar/SidebarLayout.tsx +24 -17
- package/src/features/layouts/utils.ts +4 -3
- package/src/features/layouts/windows/DesktopDots.tsx +76 -0
- package/src/features/layouts/windows/WindowsLayout.tsx +265 -160
- package/src/features/layouts/windows/deskDots.spec.ts +54 -0
- package/src/features/layouts/windows/deskDots.ts +314 -0
- 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/features/theme/applyTheme.ts +8 -0
- package/src/features/theme/navContrast.spec.ts +49 -0
- package/src/features/theme/navContrast.ts +108 -0
- package/src/i18n/translations/en/common.json +26 -0
- package/src/i18n/translations/fr/common.json +26 -0
- package/src/index.css +1156 -77
- 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
|
@@ -5,11 +5,17 @@ import type {
|
|
|
5
5
|
OverlaySizeValue,
|
|
6
6
|
DrawerPosition,
|
|
7
7
|
} from '@shellui/sdk';
|
|
8
|
-
import { readSafeAreaInsetTop } from '../layouts/chrome/viewport';
|
|
8
|
+
import { readDrawerBottomOffset, readSafeAreaInsetTop } from '../layouts/chrome/viewport';
|
|
9
9
|
|
|
10
10
|
/** CSS max-height for overlays — matches --shellui-overlay-max-height in index.css. */
|
|
11
11
|
const OVERLAY_MAX_HEIGHT_CSS = 'var(--shellui-overlay-max-height)';
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Largest floating drawer height: the shell height minus the top and bottom drawer
|
|
15
|
+
* offsets (each is the gap plus the safe area). Matches --shellui-drawer-max-height.
|
|
16
|
+
*/
|
|
17
|
+
const DRAWER_MAX_HEIGHT_CSS = 'var(--shellui-drawer-max-height)';
|
|
18
|
+
|
|
13
19
|
/** Fraction of overlay max height — avoids raw dvh which disagrees with iOS standalone measure. */
|
|
14
20
|
function overlayHeightFrac(fraction: number): string {
|
|
15
21
|
return `calc(${OVERLAY_MAX_HEIGHT_CSS} * ${fraction})`;
|
|
@@ -89,7 +95,7 @@ const DRAWER_PRESET_VERTICAL: Record<OverlaySizePreset, string> = {
|
|
|
89
95
|
md: overlayHeightFrac(0.55),
|
|
90
96
|
lg: overlayHeightFrac(0.75),
|
|
91
97
|
xl: overlayHeightFrac(0.9),
|
|
92
|
-
full:
|
|
98
|
+
full: DRAWER_MAX_HEIGHT_CSS,
|
|
93
99
|
content: 'auto',
|
|
94
100
|
};
|
|
95
101
|
|
|
@@ -98,7 +104,7 @@ const DRAWER_PRESET_HORIZONTAL: Record<OverlaySizePreset, string> = {
|
|
|
98
104
|
md: '28rem',
|
|
99
105
|
lg: '36rem',
|
|
100
106
|
xl: '48rem',
|
|
101
|
-
full: '100%',
|
|
107
|
+
full: 'calc(100% - 2 * var(--shellui-drawer-gap))',
|
|
102
108
|
content: 'auto',
|
|
103
109
|
};
|
|
104
110
|
|
|
@@ -111,6 +117,11 @@ export interface ResolvedOverlaySize {
|
|
|
111
117
|
contentSized: boolean;
|
|
112
118
|
/** Primary drawer CSS length (vaul size prop) when applicable. */
|
|
113
119
|
drawerSize: string | null;
|
|
120
|
+
/**
|
|
121
|
+
* Phone sheets only: the preset height to use when the app never reports its
|
|
122
|
+
* content size (no `shellui.overlay.autoSize()`), clamped by the drawer max height.
|
|
123
|
+
*/
|
|
124
|
+
fallbackHeight?: string | null;
|
|
114
125
|
}
|
|
115
126
|
|
|
116
127
|
function applyExplicitDimensions(
|
|
@@ -213,7 +224,7 @@ export function resolveDrawerSize(
|
|
|
213
224
|
if (contentSized) {
|
|
214
225
|
drawerSize = 'auto';
|
|
215
226
|
if (isVertical) {
|
|
216
|
-
style.maxHeight = style.maxHeight ??
|
|
227
|
+
style.maxHeight = style.maxHeight ?? DRAWER_MAX_HEIGHT_CSS;
|
|
217
228
|
style.height = style.height ?? 'auto';
|
|
218
229
|
} else {
|
|
219
230
|
style.maxWidth = style.maxWidth ?? 'min(90vw, 100%)';
|
|
@@ -231,8 +242,15 @@ export function resolveDrawerSize(
|
|
|
231
242
|
|
|
232
243
|
/**
|
|
233
244
|
* Resolve drawer size for the active viewport.
|
|
234
|
-
*
|
|
235
|
-
*
|
|
245
|
+
*
|
|
246
|
+
* Desktop: the requested edge and size.
|
|
247
|
+
*
|
|
248
|
+
* Phones: every drawer is a bottom sheet sized to its content. It listens for
|
|
249
|
+
* SHELLUI_OVERLAY_SIZE and grows with the iframe up to the drawer max height
|
|
250
|
+
* (8px plus the safe area above the bottom, the top below the notch), then the
|
|
251
|
+
* iframe scrolls. The requested size only applies as `fallbackHeight` when the
|
|
252
|
+
* app never reports. Horizontal freeform widths (`60vw`, `400px`, explicit
|
|
253
|
+
* `width`) are dropped so they are not applied as height.
|
|
236
254
|
*/
|
|
237
255
|
export function resolveDrawerSizeForViewport(
|
|
238
256
|
options?: OverlayOpenOptions | null,
|
|
@@ -244,22 +262,31 @@ export function resolveDrawerSizeForViewport(
|
|
|
244
262
|
return resolveDrawerSize(options, effective);
|
|
245
263
|
}
|
|
246
264
|
|
|
265
|
+
let presetOptions: OverlayOpenOptions | null | undefined = options;
|
|
247
266
|
// left/right → bottom: width-oriented sizes must not become sheet height
|
|
248
267
|
if (position === 'left' || position === 'right') {
|
|
249
268
|
const dynamic = isDynamicSizing(options);
|
|
250
269
|
const size = options?.size;
|
|
251
270
|
const dropFreeformWidth =
|
|
252
271
|
!dynamic && size !== undefined && size !== null && !isOverlaySizePreset(size);
|
|
253
|
-
|
|
272
|
+
presetOptions = dropFreeformWidth
|
|
254
273
|
? { ...options, size: undefined, width: undefined }
|
|
255
274
|
: options?.width !== undefined
|
|
256
275
|
? { ...options, width: undefined }
|
|
257
276
|
: options;
|
|
258
|
-
return resolveDrawerSize(nextOptions, 'bottom');
|
|
259
277
|
}
|
|
260
278
|
|
|
261
|
-
|
|
262
|
-
|
|
279
|
+
const preset = resolveDrawerSize(presetOptions, 'bottom');
|
|
280
|
+
const { width: _width, height: _height, ...rest } = presetOptions ?? {};
|
|
281
|
+
const sheet = resolveDrawerSize({ ...rest, size: 'content' }, 'bottom');
|
|
282
|
+
// Content sheets never exceed the drawer max height, whatever maxHeight asks for.
|
|
283
|
+
sheet.style.maxHeight = DRAWER_MAX_HEIGHT_CSS;
|
|
284
|
+
return {
|
|
285
|
+
...sheet,
|
|
286
|
+
fallbackHeight: preset.contentSized
|
|
287
|
+
? null
|
|
288
|
+
: `min(${preset.drawerSize ?? DEFAULT_VERTICAL_DRAWER}, ${DRAWER_MAX_HEIGHT_CSS})`,
|
|
289
|
+
};
|
|
263
290
|
}
|
|
264
291
|
|
|
265
292
|
export type OverlayDismissOptions = {
|
|
@@ -283,19 +310,72 @@ export function resolveDismissOptions(
|
|
|
283
310
|
};
|
|
284
311
|
}
|
|
285
312
|
|
|
313
|
+
/** How the shell presents a drawer: edge, drag handle, and whether Vaul snaps apply. */
|
|
314
|
+
export type DrawerChrome = {
|
|
315
|
+
direction: DrawerPosition;
|
|
316
|
+
showDragHandle: boolean;
|
|
317
|
+
allowSnapPoints: boolean;
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Resolve drawer chrome for the active viewport.
|
|
322
|
+
*
|
|
323
|
+
* Phones (below md): every drawer, whatever edge was requested, is a bottom sheet
|
|
324
|
+
* anchored above the home indicator, always with a drag handle for the thumb. Phone
|
|
325
|
+
* sheets never snap: they sit at their content height (see
|
|
326
|
+
* {@link resolveDrawerSizeForViewport}), so there is no half-height stop leaving
|
|
327
|
+
* empty space under the actions.
|
|
328
|
+
*
|
|
329
|
+
* Content-sized drawers never snap on desktop either: a snap sheet is the expanded
|
|
330
|
+
* height, so the iframe would report that height back and the sheet would end up
|
|
331
|
+
* below the screen.
|
|
332
|
+
*
|
|
333
|
+
* Desktop: the requested edge, with the handle and snaps the options ask for.
|
|
334
|
+
*/
|
|
335
|
+
export function resolveDrawerChrome({
|
|
336
|
+
position,
|
|
337
|
+
isMobile,
|
|
338
|
+
dismiss,
|
|
339
|
+
pending = false,
|
|
340
|
+
desktopResizable = false,
|
|
341
|
+
contentSized = false,
|
|
342
|
+
}: {
|
|
343
|
+
position?: DrawerPosition;
|
|
344
|
+
isMobile: boolean;
|
|
345
|
+
dismiss: Pick<OverlayDismissOptions, 'dismissible' | 'showDragHandle'>;
|
|
346
|
+
pending?: boolean;
|
|
347
|
+
desktopResizable?: boolean;
|
|
348
|
+
contentSized?: boolean;
|
|
349
|
+
}): DrawerChrome {
|
|
350
|
+
const direction = resolveEffectiveDrawerPosition(position, isMobile);
|
|
351
|
+
if (isMobile) {
|
|
352
|
+
return { direction, showDragHandle: !pending, allowSnapPoints: false };
|
|
353
|
+
}
|
|
354
|
+
const vertical = direction === 'top' || direction === 'bottom';
|
|
355
|
+
const handle = dismiss.showDragHandle && dismiss.dismissible;
|
|
356
|
+
return {
|
|
357
|
+
direction,
|
|
358
|
+
showDragHandle: !pending && vertical && handle,
|
|
359
|
+
allowSnapPoints:
|
|
360
|
+
direction === 'bottom' && handle && !pending && !desktopResizable && !contentSized,
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
|
|
286
364
|
/**
|
|
287
365
|
* Expanded bottom-sheet height leaves a tappable overlay band above the sheet:
|
|
288
|
-
* top safe-area inset + {@link SHEET_EXPANDED_TOP_GAP_PX}.
|
|
366
|
+
* top safe-area inset + {@link SHEET_EXPANDED_TOP_GAP_PX}. The floating sheet also
|
|
367
|
+
* ends a gap above the home indicator (--shellui-drawer-bottom).
|
|
289
368
|
*/
|
|
290
369
|
export const SHEET_EXPANDED_TOP_GAP_PX = 60;
|
|
291
370
|
|
|
292
|
-
/** CSS height for the expanded bottom
|
|
293
|
-
export const SHEET_EXPANDED_HEIGHT_CSS = `calc(var(--shellui-app-height) - var(--shellui-safe-area-top) - ${SHEET_EXPANDED_TOP_GAP_PX}px)`;
|
|
371
|
+
/** CSS height for the expanded floating bottom sheet. */
|
|
372
|
+
export const SHEET_EXPANDED_HEIGHT_CSS = `calc(var(--shellui-app-height) - var(--shellui-safe-area-top) - ${SHEET_EXPANDED_TOP_GAP_PX}px - var(--shellui-drawer-bottom))`;
|
|
294
373
|
|
|
295
|
-
/** Pixel height for the expanded
|
|
374
|
+
/** Pixel height for the expanded sheet (matches {@link SHEET_EXPANDED_HEIGHT_CSS}). */
|
|
296
375
|
export function sheetExpandedHeightPx(
|
|
297
376
|
viewportHeightPx?: number,
|
|
298
377
|
safeAreaTopPx?: number,
|
|
378
|
+
bottomOffsetPx?: number,
|
|
299
379
|
topGapPx = SHEET_EXPANDED_TOP_GAP_PX,
|
|
300
380
|
): number {
|
|
301
381
|
const viewport = viewportHeightPx ?? (typeof window !== 'undefined' ? window.innerHeight : 0);
|
|
@@ -303,20 +383,14 @@ export function sheetExpandedHeightPx(
|
|
|
303
383
|
if (safeTop === undefined) {
|
|
304
384
|
safeTop = typeof document !== 'undefined' ? readSafeAreaInsetTop() : 0;
|
|
305
385
|
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
viewportHeightPx?: number,
|
|
312
|
-
safeAreaTopPx?: number,
|
|
313
|
-
): number {
|
|
314
|
-
const viewport = viewportHeightPx ?? (typeof window !== 'undefined' ? window.innerHeight : 0);
|
|
315
|
-
if (!(viewport > 0)) return 0.9;
|
|
316
|
-
return Number((sheetExpandedHeightPx(viewport, safeAreaTopPx) / viewport).toFixed(4));
|
|
386
|
+
let bottom = bottomOffsetPx;
|
|
387
|
+
if (bottom === undefined) {
|
|
388
|
+
bottom = typeof document !== 'undefined' ? readDrawerBottomOffset() : 0;
|
|
389
|
+
}
|
|
390
|
+
return Math.max(0, Math.round(viewport - safeTop - topGapPx - bottom));
|
|
317
391
|
}
|
|
318
392
|
|
|
319
|
-
/** Vertical drawer presets →
|
|
393
|
+
/** Vertical drawer presets → visible fraction of the window height. */
|
|
320
394
|
const VERTICAL_SNAP_BY_PRESET: Record<OverlaySizePreset, number> = {
|
|
321
395
|
sm: 0.4,
|
|
322
396
|
md: 0.55,
|
|
@@ -329,17 +403,24 @@ const VERTICAL_SNAP_BY_PRESET: Record<OverlaySizePreset, number> = {
|
|
|
329
403
|
/**
|
|
330
404
|
* Resolve `[normal, expanded]` Vaul snap points for a bottom sheet.
|
|
331
405
|
* Returns null when the sheet is already near the expanded height (nothing useful to expand to).
|
|
406
|
+
*
|
|
407
|
+
* Vaul moves a bottom sheet by `translateY(H - snap)` as if the sheet started at the top
|
|
408
|
+
* of the screen. The sheet is shorter than the viewport (h < H) and floats above the home
|
|
409
|
+
* indicator, so to show a visible height v the snap is `v + (H - h)`, and the expanded
|
|
410
|
+
* snap is `1` (no translate: the whole sheet shows, ending at its bottom offset).
|
|
332
411
|
*/
|
|
333
412
|
export function resolveBottomSheetSnapPoints(
|
|
334
413
|
options?: OverlayOpenOptions | null,
|
|
335
414
|
reportedHeightPx?: number | null,
|
|
336
415
|
viewportHeightPx?: number,
|
|
337
416
|
safeAreaTopPx?: number,
|
|
417
|
+
bottomOffsetPx?: number,
|
|
338
418
|
): number[] | null {
|
|
339
419
|
const viewport = viewportHeightPx ?? (typeof window !== 'undefined' ? window.innerHeight : 0);
|
|
340
420
|
if (!(viewport > 0)) return null;
|
|
341
421
|
|
|
342
|
-
const
|
|
422
|
+
const sheetPx = sheetExpandedHeightPx(viewport, safeAreaTopPx, bottomOffsetPx);
|
|
423
|
+
const expandedVisible = sheetPx / viewport;
|
|
343
424
|
|
|
344
425
|
let normal: number;
|
|
345
426
|
if (reportedHeightPx !== null && Number.isFinite(reportedHeightPx) && reportedHeightPx > 0) {
|
|
@@ -364,9 +445,11 @@ export function resolveBottomSheetSnapPoints(
|
|
|
364
445
|
}
|
|
365
446
|
}
|
|
366
447
|
|
|
367
|
-
// Already near expanded
|
|
368
|
-
if (normal >=
|
|
448
|
+
// Already near expanded: expand would be a no-op
|
|
449
|
+
if (normal >= expandedVisible - 0.04) return null;
|
|
369
450
|
// Keep a meaningful gap between snaps
|
|
370
|
-
normal = Math.min(Math.max(normal, 0.2),
|
|
371
|
-
|
|
451
|
+
normal = Math.min(Math.max(normal, 0.2), expandedVisible - 0.05);
|
|
452
|
+
// Visible height → Vaul snap (add the part of the viewport the sheet never covers)
|
|
453
|
+
const snap = normal + (viewport - sheetPx) / viewport;
|
|
454
|
+
return [Number(snap.toFixed(4)), 1];
|
|
372
455
|
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, resolve } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { describe, expect, it } from 'vitest';
|
|
5
|
+
import type { DrawerPosition, OverlayOpenOptions } from '@shellui/sdk';
|
|
6
|
+
import {
|
|
7
|
+
resolveDismissOptions,
|
|
8
|
+
resolveDrawerChrome,
|
|
9
|
+
resolveDrawerSizeForViewport,
|
|
10
|
+
} from './overlaySize';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Phones (below 768px): every drawer must be a bottom sheet, anchored 8px plus the
|
|
14
|
+
* safe area above the bottom edge, with a drag handle, sized to its content so the
|
|
15
|
+
* actions sit right above the bottom where the thumb reaches. A tall sheet stops 8px
|
|
16
|
+
* below the notch and scrolls inside. These tests fail if any drawer path stops being
|
|
17
|
+
* bottom-anchored or content-sized on a phone.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
const POSITIONS: DrawerPosition[] = ['left', 'right', 'top', 'bottom'];
|
|
21
|
+
|
|
22
|
+
const OPTION_CASES: Array<{
|
|
23
|
+
name: string;
|
|
24
|
+
options: OverlayOpenOptions & { showDragHandle?: boolean };
|
|
25
|
+
reported?: number;
|
|
26
|
+
}> = [
|
|
27
|
+
{ name: 'defaults', options: {} },
|
|
28
|
+
{ name: 'sm', options: { size: 'sm' } },
|
|
29
|
+
{ name: 'md', options: { size: 'md' } },
|
|
30
|
+
{ name: 'lg', options: { size: 'lg' } },
|
|
31
|
+
{ name: 'xl', options: { size: 'xl' } },
|
|
32
|
+
{ name: 'full', options: { size: 'full' } },
|
|
33
|
+
{ name: '300px', options: { size: '300px' } },
|
|
34
|
+
{ name: '40vh', options: { size: '40vh' } },
|
|
35
|
+
{ name: 'width 60vw', options: { width: '60vw' } },
|
|
36
|
+
{ name: 'content (reported 152px)', options: { size: 'content' }, reported: 152 },
|
|
37
|
+
{ name: 'dynamicSizing (reported 320px)', options: { dynamicSizing: true }, reported: 320 },
|
|
38
|
+
{ name: 'no drag handle', options: { showDragHandle: false } },
|
|
39
|
+
{ name: 'not dismissible', options: { dismissible: false } },
|
|
40
|
+
{
|
|
41
|
+
name: 'sm, not dismissible, no handle',
|
|
42
|
+
options: { size: 'sm', dismissible: false, showDragHandle: false },
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
const PHONES = [
|
|
47
|
+
{ name: '390 x 844 with notch', height: 844, safeTop: 47, safeBottom: 34 },
|
|
48
|
+
{ name: '375 x 667 without notch', height: 667, safeTop: 0, safeBottom: 0 },
|
|
49
|
+
{ name: '767 x 1000 (just below md)', height: 1000, safeTop: 0, safeBottom: 0 },
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
/** Content heights the iframe may report: short, mid, and taller than any phone. */
|
|
53
|
+
const REPORTS = [120, 326, 560, 2000];
|
|
54
|
+
|
|
55
|
+
/** --shellui-drawer-bottom on a phone: 8px gap plus the bottom safe area. */
|
|
56
|
+
const phoneBottomOffset = (safeBottom: number) => 8 + safeBottom;
|
|
57
|
+
/** --shellui-drawer-top on a phone: 8px gap plus the top safe area (below the notch). */
|
|
58
|
+
const phoneTopOffset = (safeTop: number) => 8 + safeTop;
|
|
59
|
+
|
|
60
|
+
function specDir(): string {
|
|
61
|
+
const url = import.meta.url;
|
|
62
|
+
if (url.startsWith('file:')) return dirname(fileURLToPath(url));
|
|
63
|
+
return dirname(url);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
describe('phone drawers are bottom-anchored sheets', () => {
|
|
67
|
+
for (const position of POSITIONS) {
|
|
68
|
+
for (const { name, options } of OPTION_CASES) {
|
|
69
|
+
it(`${position} drawer (${name}) is a content-sized bottom sheet with a drag handle`, () => {
|
|
70
|
+
const size = resolveDrawerSizeForViewport(options, position, true);
|
|
71
|
+
const chrome = resolveDrawerChrome({
|
|
72
|
+
position,
|
|
73
|
+
isMobile: true,
|
|
74
|
+
dismiss: resolveDismissOptions(options),
|
|
75
|
+
contentSized: size.contentSized,
|
|
76
|
+
});
|
|
77
|
+
expect(chrome.direction).toBe('bottom');
|
|
78
|
+
expect(chrome.showDragHandle).toBe(true);
|
|
79
|
+
// No half-height stop: the sheet is as tall as its content.
|
|
80
|
+
expect(chrome.allowSnapPoints).toBe(false);
|
|
81
|
+
expect(size.contentSized).toBe(true);
|
|
82
|
+
expect(size.drawerSize).toBeNull();
|
|
83
|
+
expect(size.style.height).toBe('auto');
|
|
84
|
+
expect(size.style.maxHeight).toBe('var(--shellui-drawer-max-height)');
|
|
85
|
+
// Nothing may move the sheet off its bottom anchor through inline style.
|
|
86
|
+
expect(size.style.top).toBeUndefined();
|
|
87
|
+
expect(size.style.bottom).toBeUndefined();
|
|
88
|
+
expect(size.style.transform).toBeUndefined();
|
|
89
|
+
// Apps that never report fall back to their requested height, still capped.
|
|
90
|
+
if (size.fallbackHeight) {
|
|
91
|
+
expect(size.fallbackHeight).toMatch(/var\(--shellui-drawer-max-height\)\)$/);
|
|
92
|
+
expect(size.fallbackHeight).not.toMatch(/vw/);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
it('keeps the requested edge on desktop', () => {
|
|
99
|
+
for (const position of POSITIONS) {
|
|
100
|
+
const chrome = resolveDrawerChrome({
|
|
101
|
+
position,
|
|
102
|
+
isMobile: false,
|
|
103
|
+
dismiss: resolveDismissOptions({}),
|
|
104
|
+
});
|
|
105
|
+
expect(chrome.direction).toBe(position);
|
|
106
|
+
expect(chrome.showDragHandle).toBe(position === 'top' || position === 'bottom');
|
|
107
|
+
expect(resolveDrawerSizeForViewport({ size: 'md' }, position, false).contentSized).toBe(
|
|
108
|
+
false,
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it('hides the handle while a phone sheet waits for its size', () => {
|
|
114
|
+
const chrome = resolveDrawerChrome({
|
|
115
|
+
position: 'right',
|
|
116
|
+
isMobile: true,
|
|
117
|
+
dismiss: resolveDismissOptions({}),
|
|
118
|
+
pending: true,
|
|
119
|
+
});
|
|
120
|
+
expect(chrome.direction).toBe('bottom');
|
|
121
|
+
expect(chrome.showDragHandle).toBe(false);
|
|
122
|
+
expect(chrome.allowSnapPoints).toBe(false);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
for (const phone of PHONES) {
|
|
126
|
+
for (const reported of REPORTS) {
|
|
127
|
+
it(`${phone.name}: a ${reported}px sheet ends above the bottom edge, top below the notch`, () => {
|
|
128
|
+
const H = phone.height;
|
|
129
|
+
const bottomOffset = phoneBottomOffset(phone.safeBottom);
|
|
130
|
+
// --shellui-drawer-max-height: app height minus drawer top and bottom offsets
|
|
131
|
+
const maxH = H - phoneTopOffset(phone.safeTop) - bottomOffset;
|
|
132
|
+
const visible = Math.min(reported, maxH);
|
|
133
|
+
const bottom = H - bottomOffset;
|
|
134
|
+
const top = bottom - visible;
|
|
135
|
+
|
|
136
|
+
expect(bottom).toBe(H - 8 - phone.safeBottom);
|
|
137
|
+
expect(top).toBeGreaterThanOrEqual(phone.safeTop + 8);
|
|
138
|
+
// Short content: the sheet hugs it, so the actions are near the bottom.
|
|
139
|
+
if (reported < maxH) expect(visible).toBe(reported);
|
|
140
|
+
// Tall content: capped, the iframe scrolls inside.
|
|
141
|
+
else expect(top).toBe(phone.safeTop + 8);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
it('anchors the bottom drawer chrome to the bottom offset', () => {
|
|
147
|
+
const drawerSrc = readFileSync(resolve(specDir(), '../../components/ui/drawer.tsx'), 'utf8');
|
|
148
|
+
const bottom = drawerSrc.match(/^\s*bottom: `\$\{drawerPanel\}([^`]*)`/m)?.[1] ?? '';
|
|
149
|
+
expect(bottom).toContain('bottom-[var(--shellui-drawer-bottom)]');
|
|
150
|
+
expect(bottom).toContain('left-[var(--shellui-drawer-left)]');
|
|
151
|
+
expect(bottom).toContain('right-[var(--shellui-drawer-right)]');
|
|
152
|
+
expect(bottom).not.toMatch(/(^|\s)top-/);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it('keeps an 8px phone gap plus the safe areas, and caps sheets between them', () => {
|
|
156
|
+
const css = readFileSync(resolve(specDir(), '../../index.css'), 'utf8');
|
|
157
|
+
expect(css).toMatch(/--shellui-drawer-gap:\s*8px;/);
|
|
158
|
+
expect(css).toMatch(
|
|
159
|
+
/--shellui-drawer-bottom:\s*calc\(\s*var\(--shellui-drawer-gap\)\s*\+\s*var\(--shellui-safe-area-bottom\)\s*\);/,
|
|
160
|
+
);
|
|
161
|
+
expect(css).toMatch(
|
|
162
|
+
/--shellui-drawer-top:\s*calc\(\s*var\(--shellui-drawer-gap\)\s*\+\s*var\(--shellui-safe-area-top\)\s*\);/,
|
|
163
|
+
);
|
|
164
|
+
expect(css).toMatch(
|
|
165
|
+
/--shellui-drawer-max-height:\s*calc\(\s*var\(--shellui-app-height\)\s*-\s*var\(--shellui-drawer-top\)\s*-\s*var\(--shellui-drawer-bottom\)/,
|
|
166
|
+
);
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
it('OverlayShell takes the drawer edge, handle and height from these helpers', () => {
|
|
170
|
+
const shell = readFileSync(resolve(specDir(), '../layouts/OverlayShell.tsx'), 'utf8');
|
|
171
|
+
expect(shell).toMatch(/resolveDrawerChrome\(/);
|
|
172
|
+
expect(shell).toMatch(/showDragHandle=\{drawerChrome\.showDragHandle\}/);
|
|
173
|
+
expect(shell).toMatch(
|
|
174
|
+
/resolveDrawerSizeForViewport\(drawerOptions, drawerPosition, isMobile\)/,
|
|
175
|
+
);
|
|
176
|
+
// Phone sheets listen for the content size and may grow to the drawer max height.
|
|
177
|
+
expect(shell).toMatch(
|
|
178
|
+
/useOverlayReportedSize\(\s*drawerSize\.contentSized \|\| drawerDynamic,\s*isDrawerOpen,\s*isMobile \? 1 : undefined,?\s*\)/,
|
|
179
|
+
);
|
|
180
|
+
expect(shell).toMatch(/if \(!drawerChrome\.allowSnapPoints\) return undefined;/);
|
|
181
|
+
// A tall content report is clamped by the drawer max height, not the overlay max
|
|
182
|
+
// (which ignores the bottom offset and would push the top under the notch).
|
|
183
|
+
expect(shell).toMatch(/maxHeight: `min\(\$\{drawerReported\.height\}px, \$\{DRAWER_MAX_H\}\)`/);
|
|
184
|
+
expect(shell).toMatch(/height: drawerPhoneFallback, maxHeight: DRAWER_MAX_H/);
|
|
185
|
+
expect(shell).toMatch(/direction=\{effectiveDrawerPosition\}/);
|
|
186
|
+
});
|
|
187
|
+
});
|
|
@@ -27,7 +27,12 @@ export type ReportedOverlaySize = {
|
|
|
27
27
|
* On close: last size is kept for CLOSE_SIZE_CLEAR_MS so exit animation does not
|
|
28
28
|
* shrink back to the pending spinner. On open: size resets immediately (pending again).
|
|
29
29
|
*/
|
|
30
|
-
export function useOverlayReportedSize(
|
|
30
|
+
export function useOverlayReportedSize(
|
|
31
|
+
enabled: boolean,
|
|
32
|
+
active: boolean,
|
|
33
|
+
/** Share of the overlay max height a report may reach. Phone sheets pass 1: CSS caps them. */
|
|
34
|
+
maxRatio = MAX_VIEWPORT_RATIO,
|
|
35
|
+
) {
|
|
31
36
|
const [reported, setReported] = useState<ReportedOverlaySize | null>(null);
|
|
32
37
|
const [fallback, setFallback] = useState(false);
|
|
33
38
|
const lastRef = useRef<ReportedOverlaySize | null>(null);
|
|
@@ -69,7 +74,7 @@ export function useOverlayReportedSize(enabled: boolean, active: boolean) {
|
|
|
69
74
|
|
|
70
75
|
// Clamp against the shell height (not raw innerHeight / dvh), so standalone
|
|
71
76
|
// iOS overlays cannot outgrow the visible screen.
|
|
72
|
-
const maxH = overlayMaxHeightPx(
|
|
77
|
+
const maxH = overlayMaxHeightPx(maxRatio);
|
|
73
78
|
const rawH = Math.ceil(height);
|
|
74
79
|
const clampedH = Math.min(Math.max(rawH, MIN_CONTENT_HEIGHT), maxH);
|
|
75
80
|
const wasClamped = rawH > maxH;
|
|
@@ -111,7 +116,7 @@ export function useOverlayReportedSize(enabled: boolean, active: boolean) {
|
|
|
111
116
|
cleanup();
|
|
112
117
|
if (fallbackTimerRef.current) clearTimeout(fallbackTimerRef.current);
|
|
113
118
|
};
|
|
114
|
-
}, [enabled, active]);
|
|
119
|
+
}, [enabled, active, maxRatio]);
|
|
115
120
|
|
|
116
121
|
const effectiveReported =
|
|
117
122
|
reported ??
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { toCssVarValue } from './color';
|
|
2
2
|
import type { ThemeColorsMode, ThemeDefinition } from './types';
|
|
3
3
|
import { isHomeScreenPwa, isTauriRuntime } from '../layouts/chrome/runtime';
|
|
4
|
+
import { isLowNavContrast, NAV_CONTRAST_ATTR } from './navContrast';
|
|
4
5
|
|
|
5
6
|
const COLOR_VAR_MAP: Array<[keyof ThemeColorsMode, string]> = [
|
|
6
7
|
['background', '--background'],
|
|
@@ -95,6 +96,13 @@ export function applyTheme(theme: ThemeDefinition, isDark: boolean): void {
|
|
|
95
96
|
|
|
96
97
|
root.style.setProperty('--radius', colors.radius);
|
|
97
98
|
|
|
99
|
+
// Solid active pill under 4.5:1 in this mode: chrome switches to a tinted pill.
|
|
100
|
+
if (isLowNavContrast(colors.sidebarPrimary, colors.sidebarPrimaryForeground)) {
|
|
101
|
+
root.setAttribute(NAV_CONTRAST_ATTR, 'low');
|
|
102
|
+
} else {
|
|
103
|
+
root.removeAttribute(NAV_CONTRAST_ATTR);
|
|
104
|
+
}
|
|
105
|
+
|
|
98
106
|
// Browser-tab chrome only — see syncThemeColorMeta (skipped for PWA / Tauri).
|
|
99
107
|
syncThemeColorMeta(toCssVarValue(colors.background) || (isDark ? '#000000' : '#ffffff'));
|
|
100
108
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// @vitest-environment happy-dom
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import { contrastRatio, isLowNavContrast, parseThemeColor } from './navContrast';
|
|
4
|
+
import { curatedThemes } from './themes';
|
|
5
|
+
import { applyTheme } from './applyTheme';
|
|
6
|
+
|
|
7
|
+
describe('navContrast', () => {
|
|
8
|
+
it('parses oklch, hex and hsl', () => {
|
|
9
|
+
expect(parseThemeColor('oklch(1 0 0)')).toEqual([1, 1, 1]);
|
|
10
|
+
expect(parseThemeColor('#000000')).toEqual([0, 0, 0]);
|
|
11
|
+
expect(parseThemeColor('0 0% 100%')?.map((n) => Math.round(n))).toEqual([1, 1, 1]);
|
|
12
|
+
expect(parseThemeColor('hsl(0 0% 0%)')).toEqual([0, 0, 0]);
|
|
13
|
+
expect(parseThemeColor('var(--x)')).toBeNull();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('computes WCAG ratios', () => {
|
|
17
|
+
expect(contrastRatio('#000000', '#ffffff')).toBeCloseTo(21, 1);
|
|
18
|
+
expect(contrastRatio('nope', '#ffffff')).toBeNull();
|
|
19
|
+
expect(isLowNavContrast('nope', '#ffffff')).toBe(false);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('keeps the solid pill on shellui and flags the low curated modes (37 from the audit, plus quantum-rose light at 4.497:1)', () => {
|
|
23
|
+
const low: string[] = [];
|
|
24
|
+
for (const theme of curatedThemes) {
|
|
25
|
+
for (const mode of ['light', 'dark'] as const) {
|
|
26
|
+
const c = theme.colors[mode];
|
|
27
|
+
if (isLowNavContrast(c.sidebarPrimary, c.sidebarPrimaryForeground)) {
|
|
28
|
+
low.push(`${theme.name}:${mode}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
expect(low).not.toContain('shellui:light');
|
|
33
|
+
expect(low).not.toContain('shellui:dark');
|
|
34
|
+
expect(low).toContain('twitter:light');
|
|
35
|
+
expect(low).toContain('amber-minimal:dark');
|
|
36
|
+
expect(low).toContain('quantum-rose:light');
|
|
37
|
+
expect(low).toHaveLength(38);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('applyTheme sets and clears the attribute on <html>', () => {
|
|
41
|
+
const twitter = curatedThemes.find((t) => t.name === 'twitter');
|
|
42
|
+
const shellui = curatedThemes.find((t) => t.name === 'shellui');
|
|
43
|
+
if (!twitter || !shellui) throw new Error('curated themes twitter and shellui are required');
|
|
44
|
+
applyTheme({ ...twitter, fontFiles: [] }, false);
|
|
45
|
+
expect(document.documentElement.getAttribute('data-shellui-nav-contrast')).toBe('low');
|
|
46
|
+
applyTheme({ ...shellui, fontFiles: [] }, false);
|
|
47
|
+
expect(document.documentElement.hasAttribute('data-shellui-nav-contrast')).toBe(false);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Active nav contrast guard.
|
|
3
|
+
*
|
|
4
|
+
* The solid active pill paints `--sidebar-primary-foreground` on `--sidebar-primary`.
|
|
5
|
+
* Some themes pair those two below WCAG AA (4.5:1). For those, `applyTheme` sets
|
|
6
|
+
* `html[data-shellui-nav-contrast="low"]` and the chrome switches to a tinted pill.
|
|
7
|
+
*
|
|
8
|
+
* Parses the colour formats themes use: oklch(), #rrggbb, hsl() and legacy
|
|
9
|
+
* `H S% L%` channels. Anything else returns null (guard stays off).
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export const NAV_CONTRAST_MIN = 4.5;
|
|
13
|
+
export const NAV_CONTRAST_ATTR = 'data-shellui-nav-contrast';
|
|
14
|
+
|
|
15
|
+
type Rgb = [number, number, number];
|
|
16
|
+
|
|
17
|
+
const clamp01 = (n: number) => Math.min(1, Math.max(0, n));
|
|
18
|
+
|
|
19
|
+
function parseNumber(token: string, percentScale: number): number | null {
|
|
20
|
+
const t = token.trim();
|
|
21
|
+
if (t === 'none') return 0;
|
|
22
|
+
const n = parseFloat(t);
|
|
23
|
+
if (Number.isNaN(n)) return null;
|
|
24
|
+
return t.endsWith('%') ? (n / 100) * percentScale : n;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** OKLCH to linear sRGB (Björn Ottosson's matrices), clamped to the gamut. */
|
|
28
|
+
function oklchToLinearRgb(L: number, C: number, H: number): Rgb {
|
|
29
|
+
const hr = (H * Math.PI) / 180;
|
|
30
|
+
const a = C * Math.cos(hr);
|
|
31
|
+
const b = C * Math.sin(hr);
|
|
32
|
+
const l_ = L + 0.3963377774 * a + 0.2158037573 * b;
|
|
33
|
+
const m_ = L - 0.1055613458 * a - 0.0638541728 * b;
|
|
34
|
+
const s_ = L - 0.0894841775 * a - 1.291485548 * b;
|
|
35
|
+
const l = l_ ** 3;
|
|
36
|
+
const m = m_ ** 3;
|
|
37
|
+
const s = s_ ** 3;
|
|
38
|
+
return [
|
|
39
|
+
clamp01(4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s),
|
|
40
|
+
clamp01(-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s),
|
|
41
|
+
clamp01(-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s),
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const srgbToLinear = (c: number) => (c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4);
|
|
46
|
+
|
|
47
|
+
function hslToLinearRgb(h: number, s: number, l: number): Rgb {
|
|
48
|
+
const k = (n: number) => (n + h / 30) % 12;
|
|
49
|
+
const a = s * Math.min(l, 1 - l);
|
|
50
|
+
const f = (n: number) => l - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1)));
|
|
51
|
+
return [srgbToLinear(f(0)), srgbToLinear(f(8)), srgbToLinear(f(4))];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Linear sRGB for a theme colour value, or null when the format is unknown. */
|
|
55
|
+
export function parseThemeColor(value: string | undefined | null): Rgb | null {
|
|
56
|
+
if (!value || typeof value !== 'string') return null;
|
|
57
|
+
const v = value.trim().toLowerCase();
|
|
58
|
+
|
|
59
|
+
const hex = v.match(/^#?([0-9a-f]{6})$/);
|
|
60
|
+
if (hex) {
|
|
61
|
+
const n = parseInt(hex[1], 16);
|
|
62
|
+
return [
|
|
63
|
+
srgbToLinear(((n >> 16) & 255) / 255),
|
|
64
|
+
srgbToLinear(((n >> 8) & 255) / 255),
|
|
65
|
+
srgbToLinear((n & 255) / 255),
|
|
66
|
+
];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const ok = v.match(/^oklch\(\s*([^\s/]+)\s+([^\s/]+)\s+([^\s/)]+)/);
|
|
70
|
+
if (ok) {
|
|
71
|
+
const L = parseNumber(ok[1], 1);
|
|
72
|
+
const C = parseNumber(ok[2], 0.4);
|
|
73
|
+
const H = parseNumber(ok[3], 360);
|
|
74
|
+
if (L === null || C === null || H === null) return null;
|
|
75
|
+
return oklchToLinearRgb(L, C, H);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const hsl = v.match(/^(?:hsla?\()?\s*([\d.]+)(?:deg)?[\s,]+([\d.]+)%[\s,]+([\d.]+)%/);
|
|
79
|
+
if (hsl) {
|
|
80
|
+
return hslToLinearRgb(parseFloat(hsl[1]), parseFloat(hsl[2]) / 100, parseFloat(hsl[3]) / 100);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const luminance = ([r, g, b]: Rgb) => 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
87
|
+
|
|
88
|
+
/** WCAG 2 contrast ratio between two theme colours, or null when either is unparsable. */
|
|
89
|
+
export function contrastRatio(
|
|
90
|
+
a: string | undefined | null,
|
|
91
|
+
b: string | undefined | null,
|
|
92
|
+
): number | null {
|
|
93
|
+
const ca = parseThemeColor(a);
|
|
94
|
+
const cb = parseThemeColor(b);
|
|
95
|
+
if (!ca || !cb) return null;
|
|
96
|
+
const la = luminance(ca);
|
|
97
|
+
const lb = luminance(cb);
|
|
98
|
+
return (Math.max(la, lb) + 0.05) / (Math.min(la, lb) + 0.05);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** True when the solid active pill would fall under 4.5:1 for this mode. */
|
|
102
|
+
export function isLowNavContrast(
|
|
103
|
+
sidebarPrimary?: string | null,
|
|
104
|
+
sidebarPrimaryForeground?: string | null,
|
|
105
|
+
): boolean {
|
|
106
|
+
const ratio = contrastRatio(sidebarPrimary, sidebarPrimaryForeground);
|
|
107
|
+
return ratio !== null && ratio < NAV_CONTRAST_MIN;
|
|
108
|
+
}
|