@tristan2828/ui-foundation 4.91.0 → 4.93.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/conventions/docs/add-an-entity.md +17 -11
- package/conventions/docs/design-language.md +150 -59
- package/dist/components/app/app-shell.js +3 -3
- package/dist/components/app/entity-view.js +2 -14
- package/dist/components/app/equal-items.d.ts +84 -0
- package/dist/components/app/equal-items.js +127 -0
- package/dist/components/app/field-rows.d.ts +11 -0
- package/dist/components/app/field-rows.js +24 -0
- package/dist/components/app/foundation-providers.d.ts +6 -4
- package/dist/components/app/foundation-providers.js +3 -2
- package/dist/components/app/palette-provider.d.ts +5 -4
- package/dist/components/app/palette-provider.js +5 -3
- package/dist/hooks/use-palette.d.ts +5 -5
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/lib/palettes.d.ts +10 -0
- package/dist/lib/palettes.js +18 -0
- package/dist/testing/index.d.ts +10 -8
- package/dist/testing/index.js +3 -3
- package/package.json +1 -1
- package/styles/index.css +11 -10
- package/styles/theme.css +340 -3
- package/vite/index.d.ts +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type QueryClient } from '@tanstack/react-query';
|
|
2
2
|
import { type ReactNode } from 'react';
|
|
3
|
-
import type
|
|
3
|
+
import { type AppPaletteName } from '../../lib/palettes.js';
|
|
4
4
|
import { type ErrorReportingOptions } from '../../error-reporting/reporter.js';
|
|
5
5
|
export declare function FoundationProviders({ mockMode, queryClient, errorReporting, palette, palettePicker, rowsPicker, children, }: {
|
|
6
6
|
/** Whether the API is served by MSW — the app's own IS_MOCK_MODE. */
|
|
@@ -17,13 +17,15 @@ export declare function FoundationProviders({ mockMode, queryClient, errorReport
|
|
|
17
17
|
/**
|
|
18
18
|
* The app's palette (design-language.md "Palettes"). With one, the app
|
|
19
19
|
* is always dark in that palette and the shell has no light/dark
|
|
20
|
-
* toggle; printed notes still print light.
|
|
21
|
-
*
|
|
20
|
+
* toggle; printed notes still print light. A light palette
|
|
21
|
+
* (`'palm-lcd'`), which an app opts into only here, forces light
|
|
22
|
+
* instead. Without, light and dark follow the system, as before.
|
|
22
23
|
*/
|
|
23
|
-
palette?:
|
|
24
|
+
palette?: AppPaletteName;
|
|
24
25
|
/**
|
|
25
26
|
* With `palette`: the shell offers all four palettes, and the one picked
|
|
26
27
|
* is remembered on this device. A new device starts on `palette`.
|
|
28
|
+
* Ignored with a light palette, which is never in the picker.
|
|
27
29
|
*/
|
|
28
30
|
palettePicker?: boolean;
|
|
29
31
|
/**
|
|
@@ -7,11 +7,12 @@ import { MockModeBanner } from './mock-mode-banner.js';
|
|
|
7
7
|
import { ThemeProvider } from '../theme-provider.js';
|
|
8
8
|
import { PaletteProvider } from './palette-provider.js';
|
|
9
9
|
import { RowsProvider } from './rows-provider.js';
|
|
10
|
+
import { paletteColorScheme } from '../../lib/palettes.js';
|
|
10
11
|
import { ErrorReportingProvider } from '../../error-reporting/error-reporting-provider.js';
|
|
11
12
|
import { resolveErrorReporting } from '../../error-reporting/reporter.js';
|
|
12
13
|
import { browserStaleChunkReload } from '../../lib/stale-chunk-reload.js';
|
|
13
14
|
// Everything an app's root needs around its router, in the order that
|
|
14
|
-
// works: the theme outermost (and the palette, which forces it dark), the mock-mode banner above the router so it
|
|
15
|
+
// works: the theme outermost (and the palette, which forces it dark, or light for a light one), the mock-mode banner above the router so it
|
|
15
16
|
// shows on every route (/login included), and AuthProvider inside
|
|
16
17
|
// QueryClientProvider because it queries /auth/me through TanStack Query.
|
|
17
18
|
// An app's DataEnvironmentBanner goes first among the children, before its
|
|
@@ -22,5 +23,5 @@ export function FoundationProviders({ mockMode, queryClient, errorReporting, pal
|
|
|
22
23
|
const [client] = useState(() => queryClient ?? createQueryClient());
|
|
23
24
|
const reporting = resolveErrorReporting(errorReporting);
|
|
24
25
|
useEffect(() => browserStaleChunkReload().install(window), []);
|
|
25
|
-
return (_jsx(ThemeProvider, { attribute: "class", defaultTheme: "system", enableSystem: true, forcedTheme: palette ?
|
|
26
|
+
return (_jsx(ThemeProvider, { attribute: "class", defaultTheme: "system", enableSystem: true, forcedTheme: palette ? paletteColorScheme(palette) : undefined, children: _jsx(PaletteProvider, { palette: palette, picker: palettePicker, children: _jsxs(RowsProvider, { picker: rowsPicker, children: [_jsx(MockModeBanner, { active: mockMode }), _jsx(QueryClientProvider, { client: client, children: _jsx(AuthProvider, { children: reporting ? _jsx(ErrorReportingProvider, { options: reporting, children: children }) : children }) })] }) }) }));
|
|
26
27
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
import { type
|
|
2
|
+
import { type AppPaletteName, type PaletteStore } from '../../lib/palettes.js';
|
|
3
3
|
/**
|
|
4
4
|
* Puts the palette on <html>. FoundationProviders renders it; an app
|
|
5
5
|
* doesn't. Without `palette` it does nothing, and the app keeps light and
|
|
6
|
-
* dark.
|
|
6
|
+
* dark. A light palette (`palm-lcd`) takes no picker: the picker's four
|
|
7
|
+
* are dark, so with one `picker` is ignored and the saved choice is too.
|
|
7
8
|
*/
|
|
8
|
-
export declare function PaletteProvider({ palette: defaultPalette, picker, store, children, }: {
|
|
9
|
-
palette?:
|
|
9
|
+
export declare function PaletteProvider({ palette: defaultPalette, picker: pickerAsked, store, children, }: {
|
|
10
|
+
palette?: AppPaletteName;
|
|
10
11
|
picker?: boolean;
|
|
11
12
|
/** For tests; the browser's localStorage by default. */
|
|
12
13
|
store?: PaletteStore;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useLayoutEffect, useMemo, useSyncExternalStore } from 'react';
|
|
3
3
|
import { PaletteContext } from '../../hooks/use-palette.js';
|
|
4
|
-
import { browserPaletteStore, subscribeToBrowserPaletteStore } from '../../lib/palettes.js';
|
|
4
|
+
import { browserPaletteStore, isLightPaletteName, subscribeToBrowserPaletteStore } from '../../lib/palettes.js';
|
|
5
5
|
/**
|
|
6
6
|
* Puts the palette on <html>. FoundationProviders renders it; an app
|
|
7
7
|
* doesn't. Without `palette` it does nothing, and the app keeps light and
|
|
8
|
-
* dark.
|
|
8
|
+
* dark. A light palette (`palm-lcd`) takes no picker: the picker's four
|
|
9
|
+
* are dark, so with one `picker` is ignored and the saved choice is too.
|
|
9
10
|
*/
|
|
10
|
-
export function PaletteProvider({ palette: defaultPalette, picker = false, store = browserPaletteStore, children, }) {
|
|
11
|
+
export function PaletteProvider({ palette: defaultPalette, picker: pickerAsked = false, store = browserPaletteStore, children, }) {
|
|
11
12
|
const subscribe = useCallback((listener) => (store === browserPaletteStore ? subscribeToBrowserPaletteStore(listener) : store.subscribe(listener)), [store]);
|
|
13
|
+
const picker = pickerAsked && !isLightPaletteName(defaultPalette);
|
|
12
14
|
const saved = useSyncExternalStore(subscribe, store.get, () => null);
|
|
13
15
|
const palette = defaultPalette ? ((picker && saved) || defaultPalette) : null;
|
|
14
16
|
// Before paint, so the first frame is already in the palette.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { PaletteName } from '../lib/palettes.js';
|
|
1
|
+
import type { AppPaletteName, PaletteName } from '../lib/palettes.js';
|
|
2
2
|
export type PaletteState = {
|
|
3
3
|
/** The palette on screen, or null for an app without one (light and dark as the system says). */
|
|
4
|
-
palette:
|
|
4
|
+
palette: AppPaletteName | null;
|
|
5
5
|
/** The app's own default. */
|
|
6
|
-
defaultPalette:
|
|
7
|
-
/** Whether this app lets a device pick (FoundationProviders' `palettePicker`). */
|
|
6
|
+
defaultPalette: AppPaletteName | null;
|
|
7
|
+
/** Whether this app lets a device pick (FoundationProviders' `palettePicker`). Never under a light palette. */
|
|
8
8
|
picker: boolean;
|
|
9
|
-
/** Saves `palette
|
|
9
|
+
/** Saves `palette`, one of the four dark ones, as this device's choice. Does nothing without the picker. */
|
|
10
10
|
setPalette: (palette: PaletteName) => void;
|
|
11
11
|
};
|
|
12
12
|
export declare const PaletteContext: import("react").Context<PaletteState>;
|
package/dist/index.d.ts
CHANGED
|
@@ -71,6 +71,7 @@ export { Notice, type NoticeProps, type NoticeTone } from './components/app/noti
|
|
|
71
71
|
export { ValueList, type ValueListItem, type ValueListProps } from './components/app/value-list.js';
|
|
72
72
|
export { ListHeader, type ListHeaderAction, type ListHeaderLink, type ListHeaderProps, } from './components/app/list-header.js';
|
|
73
73
|
export { Timeline, type TimelineItem, type TimelineProps } from './components/app/timeline.js';
|
|
74
|
+
export { EqualItems, type EqualItem, type EqualItemField, type EqualItemState, type EqualItemTone, type EqualItemsLook, type EqualItemsProps, } from './components/app/equal-items.js';
|
|
74
75
|
export { NeedsYou, type NeedsYouItem, type NeedsYouProps, type NeedsYouTone } from './components/app/needs-you.js';
|
|
75
76
|
export { Freshness, type FreshnessProps } from './components/app/freshness.js';
|
|
76
77
|
export { isStale } from './lib/freshness.js';
|
|
@@ -115,7 +116,7 @@ export { useSessionClock, type SessionClock, type SessionClockOptions, type Sess
|
|
|
115
116
|
export { usePrefersReducedMotion } from './hooks/use-prefers-reduced-motion.js';
|
|
116
117
|
export { useMuted } from './hooks/use-muted.js';
|
|
117
118
|
export { usePalette, type PaletteState } from './hooks/use-palette.js';
|
|
118
|
-
export { PALETTE_LABELS, PALETTE_STORAGE_KEY, PALETTES, isPaletteName, type PaletteName } from './lib/palettes.js';
|
|
119
|
+
export { LIGHT_PALETTE_LABELS, LIGHT_PALETTES, PALETTE_LABELS, PALETTE_STORAGE_KEY, PALETTES, isLightPaletteName, isPaletteName, paletteColorScheme, type AppPaletteName, type LightPaletteName, type PaletteName, } from './lib/palettes.js';
|
|
119
120
|
export { useRows, type RowsState } from './hooks/use-rows.js';
|
|
120
121
|
export { ROWS, ROWS_LABELS, ROWS_STORAGE_KEY, isRowsName, type RowsName } from './lib/rows.js';
|
|
121
122
|
export { createPushController, usePushPermission, type PushController, type PushControllerOptions, type PushEnvironment, type PushPermission, type PushStatus, } from './hooks/use-push-permission.js';
|
package/dist/index.js
CHANGED
|
@@ -75,6 +75,7 @@ export { Notice } from './components/app/notice.js';
|
|
|
75
75
|
export { ValueList } from './components/app/value-list.js';
|
|
76
76
|
export { ListHeader, } from './components/app/list-header.js';
|
|
77
77
|
export { Timeline } from './components/app/timeline.js';
|
|
78
|
+
export { EqualItems, } from './components/app/equal-items.js';
|
|
78
79
|
export { NeedsYou } from './components/app/needs-you.js';
|
|
79
80
|
export { Freshness } from './components/app/freshness.js';
|
|
80
81
|
export { isStale } from './lib/freshness.js';
|
|
@@ -119,7 +120,7 @@ export { useSessionClock, } from './hooks/use-session-clock.js';
|
|
|
119
120
|
export { usePrefersReducedMotion } from './hooks/use-prefers-reduced-motion.js';
|
|
120
121
|
export { useMuted } from './hooks/use-muted.js';
|
|
121
122
|
export { usePalette } from './hooks/use-palette.js';
|
|
122
|
-
export { PALETTE_LABELS, PALETTE_STORAGE_KEY, PALETTES, isPaletteName } from './lib/palettes.js';
|
|
123
|
+
export { LIGHT_PALETTE_LABELS, LIGHT_PALETTES, PALETTE_LABELS, PALETTE_STORAGE_KEY, PALETTES, isLightPaletteName, isPaletteName, paletteColorScheme, } from './lib/palettes.js';
|
|
123
124
|
export { useRows } from './hooks/use-rows.js';
|
|
124
125
|
export { ROWS, ROWS_LABELS, ROWS_STORAGE_KEY, isRowsName } from './lib/rows.js';
|
|
125
126
|
export { createPushController, usePushPermission, } from './hooks/use-push-permission.js';
|
package/dist/lib/palettes.d.ts
CHANGED
|
@@ -6,6 +6,16 @@ export declare const PALETTE_LABELS: Record<PaletteName, string>;
|
|
|
6
6
|
/** Where a device's chosen palette is kept. */
|
|
7
7
|
export declare const PALETTE_STORAGE_KEY = "ui-foundation:palette";
|
|
8
8
|
export declare function isPaletteName(value: unknown): value is PaletteName;
|
|
9
|
+
/** The light palettes, which an app opts into by name: never in the picker (design-language.md "Palettes"). */
|
|
10
|
+
export declare const LIGHT_PALETTES: readonly ["palm-lcd"];
|
|
11
|
+
export type LightPaletteName = (typeof LIGHT_PALETTES)[number];
|
|
12
|
+
/** Each light palette's name as a person reads it. */
|
|
13
|
+
export declare const LIGHT_PALETTE_LABELS: Record<LightPaletteName, string>;
|
|
14
|
+
/** Any palette an app can name: one of the four dark ones, or a light one. */
|
|
15
|
+
export type AppPaletteName = PaletteName | LightPaletteName;
|
|
16
|
+
export declare function isLightPaletteName(value: unknown): value is LightPaletteName;
|
|
17
|
+
/** The theme a palette forces: light for a light palette, dark for the four. */
|
|
18
|
+
export declare function paletteColorScheme(palette: AppPaletteName): 'light' | 'dark';
|
|
9
19
|
export type PaletteStore = DeviceChoiceStore<PaletteName>;
|
|
10
20
|
/** The store under usePalette, taking the storage so its rules are unit tested (tests/palettes.test.ts). */
|
|
11
21
|
export declare function createPaletteStore(getStorage: () => StorageLike | undefined): PaletteStore;
|
package/dist/lib/palettes.js
CHANGED
|
@@ -6,6 +6,11 @@
|
|
|
6
6
|
// palette rides on <html> as data-palette, so popups portaled to <body>
|
|
7
7
|
// wear it too, and styles/theme.css's `.dark[data-palette]` blocks do the
|
|
8
8
|
// rest (components/app/palette-provider.tsx, hooks/use-palette.ts).
|
|
9
|
+
//
|
|
10
|
+
// The light palettes (LIGHT_PALETTES, so far one: Palm LCD) are opt-in: an
|
|
11
|
+
// app gets one only by naming it as `palette`. It forces the light theme,
|
|
12
|
+
// it is never in the picker, and it has no glow. Its block is
|
|
13
|
+
// `[data-palette="<name>"]` on top of :root.
|
|
9
14
|
import { browserStorage, createDeviceChoiceStore, otherTabsSubscriber } from './device-choice.js';
|
|
10
15
|
export const PALETTES = ['indigo-cyan', 'indigo-rose', 'graphite-periwinkle', 'violet'];
|
|
11
16
|
/** Each palette's name as a person reads it, in the guide's ranked order. */
|
|
@@ -20,6 +25,19 @@ export const PALETTE_STORAGE_KEY = 'ui-foundation:palette';
|
|
|
20
25
|
export function isPaletteName(value) {
|
|
21
26
|
return typeof value === 'string' && PALETTES.includes(value);
|
|
22
27
|
}
|
|
28
|
+
/** The light palettes, which an app opts into by name: never in the picker (design-language.md "Palettes"). */
|
|
29
|
+
export const LIGHT_PALETTES = ['palm-lcd'];
|
|
30
|
+
/** Each light palette's name as a person reads it. */
|
|
31
|
+
export const LIGHT_PALETTE_LABELS = {
|
|
32
|
+
'palm-lcd': 'Palm LCD',
|
|
33
|
+
};
|
|
34
|
+
export function isLightPaletteName(value) {
|
|
35
|
+
return typeof value === 'string' && LIGHT_PALETTES.includes(value);
|
|
36
|
+
}
|
|
37
|
+
/** The theme a palette forces: light for a light palette, dark for the four. */
|
|
38
|
+
export function paletteColorScheme(palette) {
|
|
39
|
+
return isLightPaletteName(palette) ? 'light' : 'dark';
|
|
40
|
+
}
|
|
23
41
|
/** The store under usePalette, taking the storage so its rules are unit tested (tests/palettes.test.ts). */
|
|
24
42
|
export function createPaletteStore(getStorage) {
|
|
25
43
|
return createDeviceChoiceStore(PALETTE_STORAGE_KEY, isPaletteName, getStorage);
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { expect, type Page } from '@playwright/test';
|
|
2
2
|
import { type NavEntry } from '../components/app/app-shell-nav.js';
|
|
3
|
-
import { type
|
|
3
|
+
import { type AppPaletteName } from '../lib/palettes.js';
|
|
4
4
|
import type { MswOverride } from '../mocks/override.js';
|
|
5
5
|
export type { MswHandle, MswOverride } from '../mocks/override.js';
|
|
6
6
|
export { expect };
|
|
@@ -83,12 +83,14 @@ export type A11ySuiteOptions = {
|
|
|
83
83
|
*/
|
|
84
84
|
checkSidebar?: boolean;
|
|
85
85
|
/**
|
|
86
|
-
* For an app with a palette (`<FoundationProviders palette>`), which
|
|
87
|
-
*
|
|
88
|
-
* as the device's choice before the page loads
|
|
89
|
-
*
|
|
86
|
+
* For an app with a palette (`<FoundationProviders palette>`), which
|
|
87
|
+
* forces its theme: the palettes to check instead of light and dark, each
|
|
88
|
+
* saved as the device's choice before the page loads and checked in the
|
|
89
|
+
* theme it forces (dark, or light for `'palm-lcd'`). Pass the app's
|
|
90
|
+
* default on every spec and, with the picker, all of `PALETTES` on one
|
|
91
|
+
* (the shell's).
|
|
90
92
|
*/
|
|
91
|
-
palettes?: readonly
|
|
93
|
+
palettes?: readonly AppPaletteName[];
|
|
92
94
|
};
|
|
93
95
|
/**
|
|
94
96
|
* Every data view on the page has loaded: at least one shows its data (or,
|
|
@@ -119,7 +121,7 @@ export declare function expectDataViewsLoaded(page: Page, { success }?: {
|
|
|
119
121
|
* color-contrast rule against the rendered dark DOM is also what keeps the
|
|
120
122
|
* dark-mode tokens readable. The theme follows the OS setting, so
|
|
121
123
|
* emulateMedia switches it. An app with a palette passes `palettes`, and
|
|
122
|
-
* each is checked (
|
|
124
|
+
* each is checked (in the theme it forces) in place of light and dark.
|
|
123
125
|
*/
|
|
124
126
|
export declare function defineA11ySuite({ formRoutes, viewRoutes, loggedOutRoutes, nav, checkSidebar, palettes, }: A11ySuiteOptions): void;
|
|
125
127
|
export type MockModeBannerSuiteOptions = {
|
|
@@ -154,7 +156,7 @@ export type DataEnvironmentBannerSuiteOptions = {
|
|
|
154
156
|
*/
|
|
155
157
|
dataLabel?: string | null;
|
|
156
158
|
/** For an app with a palette: the palettes to check the banner in, in place of light and dark (as for `defineA11ySuite`). */
|
|
157
|
-
palettes?: readonly
|
|
159
|
+
palettes?: readonly AppPaletteName[];
|
|
158
160
|
};
|
|
159
161
|
/**
|
|
160
162
|
* DataEnvironmentBanner: shown on every route, logged-out ones included,
|
package/dist/testing/index.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import AxeBuilder from '@axe-core/playwright';
|
|
15
15
|
import { expect, test as base } from '@playwright/test';
|
|
16
16
|
import { navPathname, navTargets } from '../components/app/app-shell-nav.js';
|
|
17
|
-
import { PALETTE_STORAGE_KEY } from '../lib/palettes.js';
|
|
17
|
+
import { PALETTE_STORAGE_KEY, paletteColorScheme } from '../lib/palettes.js';
|
|
18
18
|
export { expect };
|
|
19
19
|
// A page load returns at the load event, but the app isn't up yet: React
|
|
20
20
|
// renders only after MSW's worker.start(), which took up to 2.4 s past
|
|
@@ -177,7 +177,7 @@ async function navRoutes(page, isMobile) {
|
|
|
177
177
|
const pagePaths = (routes) => [...new Set(routes.map(navPathname))].sort();
|
|
178
178
|
function a11yThemes(palettes) {
|
|
179
179
|
if (palettes?.length)
|
|
180
|
-
return palettes.map((palette) => ({ label: palette, colorScheme:
|
|
180
|
+
return palettes.map((palette) => ({ label: palette, colorScheme: paletteColorScheme(palette), palette }));
|
|
181
181
|
return [
|
|
182
182
|
{ label: 'light', colorScheme: 'light' },
|
|
183
183
|
{ label: 'dark', colorScheme: 'dark' },
|
|
@@ -249,7 +249,7 @@ async function expectNavPageAccessible(page, route, theme) {
|
|
|
249
249
|
* color-contrast rule against the rendered dark DOM is also what keeps the
|
|
250
250
|
* dark-mode tokens readable. The theme follows the OS setting, so
|
|
251
251
|
* emulateMedia switches it. An app with a palette passes `palettes`, and
|
|
252
|
-
* each is checked (
|
|
252
|
+
* each is checked (in the theme it forces) in place of light and dark.
|
|
253
253
|
*/
|
|
254
254
|
export function defineA11ySuite({ formRoutes, viewRoutes = [], loggedOutRoutes = [], nav, checkSidebar = true, palettes, }) {
|
|
255
255
|
// Each `to` as given, query string and all, so a page that opens on a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tristan2828/ui-foundation",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.93.0",
|
|
4
4
|
"description": "Shared UI foundation for contract-first, database-backed React apps: shadcn primitives, DataTable/EntityForm composites, auth, the gateway error seam, design tokens, lint rules and the AI playbook.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
package/styles/index.css
CHANGED
|
@@ -20,10 +20,11 @@
|
|
|
20
20
|
composite's own rows and padding tighten under data-density="compact"
|
|
21
21
|
on any ancestor, the way the table's tokens do. `density-compact:py-1`.
|
|
22
22
|
Text never shrinks under it. */
|
|
23
|
-
/* Under a palette only (FoundationProviders' `palette`, data-palette
|
|
24
|
-
<html
|
|
25
|
-
gets
|
|
26
|
-
|
|
23
|
+
/* Under a dark palette only (FoundationProviders' `palette`, data-palette
|
|
24
|
+
on <html>, with the dark theme it forces): the shared style guide's
|
|
25
|
+
glow, which an app without one never gets, and nor does Palm LCD, the
|
|
26
|
+
light palette. `palette:hover:shadow-(--primary-glow)`. */
|
|
27
|
+
@custom-variant palette (&:where(.dark[data-palette] *));
|
|
27
28
|
|
|
28
29
|
@custom-variant density-compact (&:where([data-density="compact"], [data-density="compact"] *));
|
|
29
30
|
|
|
@@ -291,7 +292,7 @@
|
|
|
291
292
|
font-weight: var(--type-heading-3-weight);
|
|
292
293
|
}
|
|
293
294
|
|
|
294
|
-
/* A hovered hub tile, widget or card, under a palette: its edge turns the
|
|
295
|
+
/* A hovered hub tile, widget or card, under a dark palette: its edge turns the
|
|
295
296
|
accent and a soft halo of it shows (--edge-glow). On an element that
|
|
296
297
|
draws its edge with ring-1 and its shadow with shadow-* (Card does), it
|
|
297
298
|
recolours the ring and adds the halo to the shadow it already has.
|
|
@@ -302,21 +303,21 @@
|
|
|
302
303
|
transition-property: box-shadow;
|
|
303
304
|
transition-duration: var(--default-transition-duration);
|
|
304
305
|
transition-timing-function: var(--default-transition-timing-function);
|
|
305
|
-
&:where([data-palette] *):hover {
|
|
306
|
+
&:where(.dark[data-palette] *):hover {
|
|
306
307
|
--tw-ring-color: color-mix(in srgb, var(--primary) 75%, var(--border));
|
|
307
308
|
--tw-shadow: var(--card-shadow, 0 0 #0000), var(--edge-glow);
|
|
308
309
|
}
|
|
309
310
|
}
|
|
310
311
|
|
|
311
|
-
/* A primary button's shine under a palette: a light band sweeping across
|
|
312
|
+
/* A primary button's shine under a dark palette: a light band sweeping across
|
|
312
313
|
on hover (650ms), once. Not under reduced motion, and never on another
|
|
313
314
|
variant. In components, so a button's own position utility still wins. */
|
|
314
315
|
@layer components {
|
|
315
|
-
[data-palette] [data-slot="button"][data-variant="default"] {
|
|
316
|
+
.dark[data-palette] [data-slot="button"][data-variant="default"] {
|
|
316
317
|
position: relative;
|
|
317
318
|
overflow: hidden;
|
|
318
319
|
}
|
|
319
|
-
[data-palette] [data-slot="button"][data-variant="default"]::after {
|
|
320
|
+
.dark[data-palette] [data-slot="button"][data-variant="default"]::after {
|
|
320
321
|
content: "";
|
|
321
322
|
position: absolute;
|
|
322
323
|
inset: 0;
|
|
@@ -325,7 +326,7 @@
|
|
|
325
326
|
transform: translateX(-130%);
|
|
326
327
|
}
|
|
327
328
|
@media (prefers-reduced-motion: no-preference) {
|
|
328
|
-
[data-palette] [data-slot="button"][data-variant="default"]:hover::after {
|
|
329
|
+
.dark[data-palette] [data-slot="button"][data-variant="default"]:hover::after {
|
|
329
330
|
animation: button-shine 650ms ease-out;
|
|
330
331
|
}
|
|
331
332
|
}
|