@godxjp/ui 13.15.0 → 13.16.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/dist/app/app-provider.d.ts +1 -1
- package/dist/app/app-provider.js +40 -9
- package/dist/app/storage.d.ts +2 -0
- package/dist/app/storage.js +2 -1
- package/dist/app/theme-axes.d.ts +4 -1
- package/dist/app/theme-axes.js +4 -0
- package/dist/props/components/app.prop.d.ts +11 -1
- package/dist/styles/density.css +25 -48
- package/dist/tokens/components/control.css +13 -14
- package/dist/tokens/components/table.css +1 -1
- package/dist/tokens/foundation.css +23 -11
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type AppDateFormat, type AppLocale, type AppTimeFormat, type AppTimezone } from "./types";
|
|
2
2
|
import type { AppContextValue, AppProviderProp } from "../props/components/app.prop";
|
|
3
3
|
export type { AppProviderProp, AppContextValue } from "../props/components/app.prop";
|
|
4
|
-
export declare function AppProvider({ children, defaultLocale, fallbackLocale, defaultTimezone, systemTimezone, defaultTimeFormat, defaultDateFormat, timezoneOptions, storageKey, persist, theme: initialTheme, brand: initialBrand, density: initialDensity, fontSize: initialFontSize, onLocaleChange, onTimezoneChange, onTimeFormatChange, onDateFormatChange, onThemeChange, onBrandChange, onDensityChange, onFontSizeChange, }: AppProviderProp): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function AppProvider({ children, defaultLocale, fallbackLocale, defaultTimezone, systemTimezone, defaultTimeFormat, defaultDateFormat, timezoneOptions, storageKey, persist, theme: initialTheme, brand: initialBrand, density: initialDensity, fontSize: initialFontSize, scaling: initialScaling, onLocaleChange, onTimezoneChange, onTimeFormatChange, onDateFormatChange, onThemeChange, onBrandChange, onDensityChange, onFontSizeChange, onScalingChange, }: AppProviderProp): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export declare function useAppContext(): AppContextValue;
|
|
6
6
|
/** Returns null outside AppProvider — used by pickers for optional context. */
|
|
7
7
|
export declare function useOptionalAppContext(): AppContextValue | null;
|
package/dist/app/app-provider.js
CHANGED
|
@@ -63,6 +63,7 @@ function AppProvider({
|
|
|
63
63
|
brand: initialBrand = null,
|
|
64
64
|
density: initialDensity = "default",
|
|
65
65
|
fontSize: initialFontSize = "default",
|
|
66
|
+
scaling: initialScaling = null,
|
|
66
67
|
onLocaleChange,
|
|
67
68
|
onTimezoneChange,
|
|
68
69
|
onTimeFormatChange,
|
|
@@ -70,7 +71,8 @@ function AppProvider({
|
|
|
70
71
|
onThemeChange,
|
|
71
72
|
onBrandChange,
|
|
72
73
|
onDensityChange,
|
|
73
|
-
onFontSizeChange
|
|
74
|
+
onFontSizeChange,
|
|
75
|
+
onScalingChange
|
|
74
76
|
}) {
|
|
75
77
|
const initialLocale = defaultLocale;
|
|
76
78
|
const [locale, setLocaleState] = React.useState(initialLocale);
|
|
@@ -87,6 +89,7 @@ function AppProvider({
|
|
|
87
89
|
const [brand, setBrandState] = React.useState(initialBrand);
|
|
88
90
|
const [density, setDensityState] = React.useState(initialDensity);
|
|
89
91
|
const [fontSize, setFontSizeState] = React.useState(initialFontSize);
|
|
92
|
+
const [scaling, setScalingState] = React.useState(initialScaling);
|
|
90
93
|
const hasMountedRef = React.useRef(false);
|
|
91
94
|
const prefsRef = React.useRef({
|
|
92
95
|
locale,
|
|
@@ -96,7 +99,8 @@ function AppProvider({
|
|
|
96
99
|
theme,
|
|
97
100
|
brand,
|
|
98
101
|
density,
|
|
99
|
-
fontSize
|
|
102
|
+
fontSize,
|
|
103
|
+
scaling
|
|
100
104
|
});
|
|
101
105
|
React.useEffect(() => {
|
|
102
106
|
const stored = persist ? readStoredPreferences(storageKey) : {};
|
|
@@ -116,6 +120,7 @@ function AppProvider({
|
|
|
116
120
|
const nextBrand = stored.brand ?? initialBrand;
|
|
117
121
|
const nextDensity = stored.density ?? initialDensity;
|
|
118
122
|
const nextFontSize = stored.fontSize ?? initialFontSize;
|
|
123
|
+
const nextScaling = stored.scaling ?? initialScaling;
|
|
119
124
|
prefsRef.current = {
|
|
120
125
|
locale: nextLocale,
|
|
121
126
|
timezone: nextTimezone,
|
|
@@ -124,7 +129,8 @@ function AppProvider({
|
|
|
124
129
|
theme: nextTheme,
|
|
125
130
|
brand: nextBrand,
|
|
126
131
|
density: nextDensity,
|
|
127
|
-
fontSize: nextFontSize
|
|
132
|
+
fontSize: nextFontSize,
|
|
133
|
+
scaling: nextScaling
|
|
128
134
|
};
|
|
129
135
|
setLocaleState(nextLocale);
|
|
130
136
|
setTimezoneState(nextTimezone);
|
|
@@ -134,6 +140,7 @@ function AppProvider({
|
|
|
134
140
|
setBrandState(nextBrand);
|
|
135
141
|
setDensityState(nextDensity);
|
|
136
142
|
setFontSizeState(nextFontSize);
|
|
143
|
+
setScalingState(nextScaling);
|
|
137
144
|
}, [
|
|
138
145
|
defaultDateFormat,
|
|
139
146
|
defaultLocale,
|
|
@@ -143,17 +150,28 @@ function AppProvider({
|
|
|
143
150
|
initialBrand,
|
|
144
151
|
initialDensity,
|
|
145
152
|
initialFontSize,
|
|
153
|
+
initialScaling,
|
|
146
154
|
persist,
|
|
147
155
|
storageKey,
|
|
148
156
|
systemTimezone
|
|
149
157
|
]);
|
|
150
158
|
React.useEffect(() => {
|
|
151
|
-
prefsRef.current = {
|
|
152
|
-
|
|
159
|
+
prefsRef.current = {
|
|
160
|
+
locale,
|
|
161
|
+
timezone,
|
|
162
|
+
timeFormat,
|
|
163
|
+
dateFormat,
|
|
164
|
+
theme,
|
|
165
|
+
brand,
|
|
166
|
+
density,
|
|
167
|
+
fontSize,
|
|
168
|
+
scaling
|
|
169
|
+
};
|
|
170
|
+
}, [locale, timezone, timeFormat, dateFormat, theme, brand, density, fontSize, scaling]);
|
|
153
171
|
React.useEffect(() => {
|
|
154
172
|
if (typeof document === "undefined") return;
|
|
155
|
-
applyThemeAxes(document.documentElement, { theme, brand, density, fontSize });
|
|
156
|
-
}, [theme, brand, density, fontSize]);
|
|
173
|
+
applyThemeAxes(document.documentElement, { theme, brand, density, fontSize, scaling });
|
|
174
|
+
}, [theme, brand, density, fontSize, scaling]);
|
|
157
175
|
const setLocale = React.useCallback(
|
|
158
176
|
(next) => {
|
|
159
177
|
prefsRef.current = { ...prefsRef.current, locale: next };
|
|
@@ -226,6 +244,15 @@ function AppProvider({
|
|
|
226
244
|
},
|
|
227
245
|
[onFontSizeChange, persist, storageKey]
|
|
228
246
|
);
|
|
247
|
+
const setScaling = React.useCallback(
|
|
248
|
+
(next) => {
|
|
249
|
+
prefsRef.current = { ...prefsRef.current, scaling: next };
|
|
250
|
+
setScalingState(next);
|
|
251
|
+
onScalingChange?.(next);
|
|
252
|
+
if (persist) writeStoredPreferences(storageKey, prefsRef.current);
|
|
253
|
+
},
|
|
254
|
+
[onScalingChange, persist, storageKey]
|
|
255
|
+
);
|
|
229
256
|
const requestHeaders = React.useMemo(
|
|
230
257
|
() => buildRequestHeaders(locale, timezone, timeFormat, dateFormat),
|
|
231
258
|
[locale, timezone, timeFormat, dateFormat]
|
|
@@ -269,6 +296,7 @@ function AppProvider({
|
|
|
269
296
|
brand,
|
|
270
297
|
density,
|
|
271
298
|
fontSize,
|
|
299
|
+
scaling,
|
|
272
300
|
setLocale,
|
|
273
301
|
setTimezone,
|
|
274
302
|
setTimeFormat,
|
|
@@ -276,7 +304,8 @@ function AppProvider({
|
|
|
276
304
|
setTheme,
|
|
277
305
|
setBrand,
|
|
278
306
|
setDensity,
|
|
279
|
-
setFontSize
|
|
307
|
+
setFontSize,
|
|
308
|
+
setScaling
|
|
280
309
|
}),
|
|
281
310
|
[
|
|
282
311
|
locale,
|
|
@@ -291,6 +320,7 @@ function AppProvider({
|
|
|
291
320
|
brand,
|
|
292
321
|
density,
|
|
293
322
|
fontSize,
|
|
323
|
+
scaling,
|
|
294
324
|
setLocale,
|
|
295
325
|
setTimezone,
|
|
296
326
|
setTimeFormat,
|
|
@@ -298,7 +328,8 @@ function AppProvider({
|
|
|
298
328
|
setTheme,
|
|
299
329
|
setBrand,
|
|
300
330
|
setDensity,
|
|
301
|
-
setFontSize
|
|
331
|
+
setFontSize,
|
|
332
|
+
setScaling
|
|
302
333
|
]
|
|
303
334
|
);
|
|
304
335
|
return /* @__PURE__ */ jsx(AppContext.Provider, { value, children });
|
package/dist/app/storage.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export type StoredAppPreferences = {
|
|
|
11
11
|
brand?: AppBrand | null;
|
|
12
12
|
density?: AppDensity;
|
|
13
13
|
fontSize?: AppFontSize;
|
|
14
|
+
/** Continuous global size multiplier; `null` defers to the density preset. */
|
|
15
|
+
scaling?: number | null;
|
|
14
16
|
};
|
|
15
17
|
export declare function readStoredPreferences(storageKey: string): StoredAppPreferences;
|
|
16
18
|
export declare function writeStoredPreferences(storageKey: string, preferences: StoredAppPreferences): void;
|
package/dist/app/storage.js
CHANGED
|
@@ -22,7 +22,8 @@ function readStoredPreferences(storageKey) {
|
|
|
22
22
|
theme: isAppTheme(parsed.theme) ? parsed.theme : void 0,
|
|
23
23
|
brand: isAppBrand(parsed.brand) ? parsed.brand : void 0,
|
|
24
24
|
density: isAppDensity(parsed.density) ? parsed.density : void 0,
|
|
25
|
-
fontSize: isAppFontSize(parsed.fontSize) ? parsed.fontSize : void 0
|
|
25
|
+
fontSize: isAppFontSize(parsed.fontSize) ? parsed.fontSize : void 0,
|
|
26
|
+
scaling: typeof parsed.scaling === "number" && Number.isFinite(parsed.scaling) ? parsed.scaling : void 0
|
|
26
27
|
};
|
|
27
28
|
} catch {
|
|
28
29
|
return {};
|
package/dist/app/theme-axes.d.ts
CHANGED
|
@@ -11,12 +11,15 @@ export declare const APP_THEMES: readonly ["light", "dark"];
|
|
|
11
11
|
export declare const APP_BRANDS: readonly ["brand", "crm", "logistics", "partner", "slate"];
|
|
12
12
|
export declare const APP_DENSITIES: readonly ["compact", "default", "comfortable"];
|
|
13
13
|
export declare const APP_FONT_SIZES: readonly ["sm", "default", "lg"];
|
|
14
|
-
/** The
|
|
14
|
+
/** The axes as held by AppProvider. `brand: null` opts out (app token wins).
|
|
15
|
+
* `scaling: null` defers to the density preset; a number is the continuous global
|
|
16
|
+
* size multiplier (the `--scaling` factor / Radix model) and overrides the preset. */
|
|
15
17
|
export type AppThemeAxes = {
|
|
16
18
|
theme: AppTheme;
|
|
17
19
|
brand: AppBrand | null;
|
|
18
20
|
density: AppDensity;
|
|
19
21
|
fontSize: AppFontSize;
|
|
22
|
+
scaling: number | null;
|
|
20
23
|
};
|
|
21
24
|
export declare const isAppTheme: (v: unknown) => v is AppTheme;
|
|
22
25
|
export declare const isAppBrand: (v: unknown) => v is AppBrand;
|
package/dist/app/theme-axes.js
CHANGED
|
@@ -24,6 +24,10 @@ function applyThemeAxes(el, axes) {
|
|
|
24
24
|
if (axes.brand === null) delete el.dataset.brand;
|
|
25
25
|
else el.dataset.brand = axes.brand;
|
|
26
26
|
}
|
|
27
|
+
if (axes.scaling !== void 0) {
|
|
28
|
+
if (axes.scaling === null) el.style.removeProperty("--scaling");
|
|
29
|
+
else el.style.setProperty("--scaling", String(axes.scaling));
|
|
30
|
+
}
|
|
27
31
|
}
|
|
28
32
|
export {
|
|
29
33
|
APP_BRANDS,
|
|
@@ -42,6 +42,13 @@ export type AppProviderProp = {
|
|
|
42
42
|
density?: AppDensity;
|
|
43
43
|
/** Initial base type size — written to `<html data-font-size>`. Default: `"default"`. */
|
|
44
44
|
fontSize?: AppFontSize;
|
|
45
|
+
/**
|
|
46
|
+
* Continuous global size multiplier — sets inline `--scaling` on `<html>`. Every
|
|
47
|
+
* size token (spacing, control/table/checkbox/switch heights, radius) rescales in
|
|
48
|
+
* proportion (Radix-style). `null` (default) defers to the `density` preset; a
|
|
49
|
+
* number (e.g. `0.95`) overrides it. Type is a separate axis — not scaled.
|
|
50
|
+
*/
|
|
51
|
+
scaling?: number | null;
|
|
45
52
|
onLocaleChange?: (locale: AppLocale) => void;
|
|
46
53
|
onTimezoneChange?: (timezone: AppTimezone) => void;
|
|
47
54
|
onTimeFormatChange?: (timeFormat: AppTimeFormat) => void;
|
|
@@ -50,6 +57,7 @@ export type AppProviderProp = {
|
|
|
50
57
|
onBrandChange?: (brand: AppBrand | null) => void;
|
|
51
58
|
onDensityChange?: (density: AppDensity) => void;
|
|
52
59
|
onFontSizeChange?: (fontSize: AppFontSize) => void;
|
|
60
|
+
onScalingChange?: (scaling: number | null) => void;
|
|
53
61
|
};
|
|
54
62
|
/** Which AppProvider setting the {@link AppSettingPicker} reads/writes. */
|
|
55
63
|
export type AppSettingKind = "locale" | "timezone" | "dateFormat" | "timeFormat" | "theme" | "brand" | "density" | "fontSize";
|
|
@@ -81,11 +89,12 @@ export type AppContextValue = {
|
|
|
81
89
|
requestHeaders: AppRequestHeaders;
|
|
82
90
|
/** Configured timezone list; `undefined` → full IANA in the timezone-picker recipe. */
|
|
83
91
|
timezoneOptions?: readonly AppTimezone[];
|
|
84
|
-
/** Current theme axes (mirror `<html data-*>`). */
|
|
92
|
+
/** Current theme axes (mirror `<html data-*>` / inline `--scaling`). */
|
|
85
93
|
theme: AppTheme;
|
|
86
94
|
brand: AppBrand | null;
|
|
87
95
|
density: AppDensity;
|
|
88
96
|
fontSize: AppFontSize;
|
|
97
|
+
scaling: number | null;
|
|
89
98
|
setLocale: (locale: AppLocale) => void;
|
|
90
99
|
setTimezone: (timezone: AppTimezone) => void;
|
|
91
100
|
setTimeFormat: (timeFormat: AppTimeFormat) => void;
|
|
@@ -94,4 +103,5 @@ export type AppContextValue = {
|
|
|
94
103
|
setBrand: (brand: AppBrand | null) => void;
|
|
95
104
|
setDensity: (density: AppDensity) => void;
|
|
96
105
|
setFontSize: (fontSize: AppFontSize) => void;
|
|
106
|
+
setScaling: (scaling: number | null) => void;
|
|
97
107
|
};
|
package/dist/styles/density.css
CHANGED
|
@@ -1,54 +1,31 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* DENSITY —
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
2
|
+
* DENSITY — named presets of the global `--scaling` factor (foundation.css).
|
|
3
|
+
* One knob: density sets `--scaling`, and every size token (spacing grid, control
|
|
4
|
+
* / table / checkbox / switch heights, radius, and everything derived from them)
|
|
5
|
+
* rescales in proportion. Two entry points, same variable:
|
|
6
|
+
* • `<PageContainer density>` → `.ui-density-*` class (scoped to a descendant,
|
|
7
|
+
* wins for its subtree by proximity).
|
|
8
|
+
* • the density AXIS → `:root[data-density="*"]` on <html> (AppProvider density
|
|
9
|
+
* prop), so it cascades app-wide incl. portalled overlays. For a value off the
|
|
10
|
+
* three presets, set `--scaling` directly (AppProvider `scaling` prop).
|
|
11
|
+
*
|
|
12
|
+
* INTENTIONALLY UNLAYERED — do NOT wrap in `@layer components`. `--scaling` has an
|
|
13
|
+
* unlayered `:root` default (foundation.css); a layered `:root[data-density]` would
|
|
14
|
+
* always lose to it regardless of specificity, making the axis a no-op on <html>.
|
|
15
|
+
* Unlayered, `:root[data-density="x"]` (0,2,0) beats the `:root` default (0,1,0).
|
|
8
16
|
*/
|
|
9
17
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
:
|
|
13
|
-
|
|
14
|
-
--control-padding-x: var(--control-padding-x-compact);
|
|
15
|
-
--table-row-height: var(--table-row-height-compact);
|
|
16
|
-
--phi-unit: var(--space-3);
|
|
17
|
-
--checkbox-size: var(--checkbox-size-compact);
|
|
18
|
-
--switch-width: var(--switch-width-compact);
|
|
19
|
-
--switch-height: var(--switch-height-compact);
|
|
20
|
-
--switch-thumb-size: var(--switch-thumb-size-compact);
|
|
21
|
-
--switch-thumb-translate: var(--switch-thumb-translate-compact);
|
|
22
|
-
--table-cell-padding-y: var(--space-1);
|
|
23
|
-
/* Tighter overlay/card chrome at compact density (12px vertical). */
|
|
24
|
-
--space-chrome-y: var(--space-3);
|
|
25
|
-
}
|
|
18
|
+
.ui-density-compact,
|
|
19
|
+
:root[data-density="compact"] {
|
|
20
|
+
--scaling: 0.92;
|
|
21
|
+
}
|
|
26
22
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
--table-row-height: var(--table-row-height-default);
|
|
32
|
-
--table-cell-padding-y: var(--space-2);
|
|
33
|
-
}
|
|
23
|
+
.ui-density-default,
|
|
24
|
+
:root[data-density="default"] {
|
|
25
|
+
--scaling: 1;
|
|
26
|
+
}
|
|
34
27
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
/* Comfortable steps 44 → 36 → 32 (design spacing-density), steeper than the
|
|
39
|
-
* default 4px step so sm/xs aren't left 4px too tall. */
|
|
40
|
-
--control-height-sm: calc(var(--control-height) - 0.5rem);
|
|
41
|
-
--control-height-xs: calc(var(--control-height) - 0.75rem);
|
|
42
|
-
--control-padding-x: var(--control-padding-x-comfortable);
|
|
43
|
-
--table-row-height: var(--table-row-height-comfortable);
|
|
44
|
-
--phi-unit: var(--space-6);
|
|
45
|
-
--checkbox-size: var(--checkbox-size-comfortable);
|
|
46
|
-
--switch-width: var(--switch-width-comfortable);
|
|
47
|
-
--switch-height: var(--switch-height-comfortable);
|
|
48
|
-
--switch-thumb-size: var(--switch-thumb-size-comfortable);
|
|
49
|
-
--switch-thumb-translate: var(--switch-thumb-translate-comfortable);
|
|
50
|
-
--table-cell-padding-y: var(--space-2);
|
|
51
|
-
/* Roomier overlay/card chrome at comfortable density (24px vertical). */
|
|
52
|
-
--space-chrome-y: var(--space-6);
|
|
53
|
-
}
|
|
28
|
+
.ui-density-comfortable,
|
|
29
|
+
:root[data-density="comfortable"] {
|
|
30
|
+
--scaling: 1.08;
|
|
54
31
|
}
|
|
@@ -8,22 +8,21 @@
|
|
|
8
8
|
--control-padding-x-default: var(--space-3);
|
|
9
9
|
--control-padding-x-comfortable: var(--space-4);
|
|
10
10
|
|
|
11
|
-
--control-height: var(--control-height-default);
|
|
12
|
-
/* Adjacent control sizes, derived from the active --control-height.
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
--control-height-
|
|
16
|
-
--control-height-
|
|
17
|
-
--control-height-xs: calc(var(--control-height) - 0.5rem);
|
|
11
|
+
--control-height: calc(var(--control-height-default) * var(--scaling));
|
|
12
|
+
/* Adjacent control sizes, derived from the active --control-height. The ±step
|
|
13
|
+
* is scaled too so the whole control ladder stays proportional under --scaling. */
|
|
14
|
+
--control-height-sm: calc(var(--control-height) - calc(0.25rem * var(--scaling)));
|
|
15
|
+
--control-height-lg: calc(var(--control-height) + calc(0.25rem * var(--scaling)));
|
|
16
|
+
--control-height-xs: calc(var(--control-height) - calc(0.5rem * var(--scaling)));
|
|
18
17
|
--control-padding-x: var(--control-padding-x-default);
|
|
19
18
|
--control-gap: var(--space-inline-sm);
|
|
20
19
|
--control-gap-sm: var(--space-inline-xs);
|
|
21
20
|
--control-radius: var(--radius);
|
|
22
|
-
--control-icon-size: 1rem;
|
|
23
|
-
--control-icon-size-sm: 0.875rem;
|
|
21
|
+
--control-icon-size: calc(1rem * var(--scaling));
|
|
22
|
+
--control-icon-size-sm: calc(0.875rem * var(--scaling));
|
|
24
23
|
--control-focus-ring-width: 2px;
|
|
25
24
|
|
|
26
|
-
--checkbox-size: 1rem;
|
|
25
|
+
--checkbox-size: calc(1rem * var(--scaling));
|
|
27
26
|
--checkbox-size-compact: 0.875rem;
|
|
28
27
|
--checkbox-size-comfortable: 1.125rem;
|
|
29
28
|
--choice-gap: var(--space-inline-sm);
|
|
@@ -32,16 +31,16 @@
|
|
|
32
31
|
--choice-description-gap: 0.125rem;
|
|
33
32
|
--choice-control-offset: 0.125rem;
|
|
34
33
|
|
|
35
|
-
--switch-width: 2.25rem;
|
|
34
|
+
--switch-width: calc(2.25rem * var(--scaling));
|
|
36
35
|
--switch-width-compact: 2rem;
|
|
37
36
|
--switch-width-comfortable: 2.5rem;
|
|
38
|
-
--switch-height: 1.25rem;
|
|
37
|
+
--switch-height: calc(1.25rem * var(--scaling));
|
|
39
38
|
--switch-height-compact: 1.125rem;
|
|
40
39
|
--switch-height-comfortable: 1.375rem;
|
|
41
|
-
--switch-thumb-size: 1rem;
|
|
40
|
+
--switch-thumb-size: calc(1rem * var(--scaling));
|
|
42
41
|
--switch-thumb-size-compact: 0.875rem;
|
|
43
42
|
--switch-thumb-size-comfortable: 1.125rem;
|
|
44
|
-
--switch-thumb-translate: 1rem;
|
|
43
|
+
--switch-thumb-translate: calc(1rem * var(--scaling));
|
|
45
44
|
--switch-thumb-translate-compact: 0.875rem;
|
|
46
45
|
--switch-thumb-translate-comfortable: 1.125rem;
|
|
47
46
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
--table-row-height-compact: 1.75rem;
|
|
5
5
|
--table-row-height-default: 2rem;
|
|
6
6
|
--table-row-height-comfortable: 2.75rem;
|
|
7
|
-
--table-row-height: var(--table-row-height-default);
|
|
7
|
+
--table-row-height: calc(var(--table-row-height-default) * var(--scaling));
|
|
8
8
|
--table-cell-padding-y: var(--space-2);
|
|
9
9
|
--table-cell-space-x: var(--control-padding-x);
|
|
10
10
|
--table-head-font-size: var(--font-size-xs);
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
--disabled-opacity: 0.5;
|
|
76
76
|
|
|
77
77
|
/* Shape and elevation */
|
|
78
|
-
--radius: 0.375rem; /* 6px
|
|
78
|
+
--radius: calc(0.375rem * var(--scaling)); /* 6px base × scaling; override to retheme every step */
|
|
79
79
|
--radius-ratio: 1.618; /* φ — radii scale by the golden ratio (steps derive in @theme) */
|
|
80
80
|
--radius-pill: 9999px; /* fully-round: switch / radio / slider / pill badges (NOT --radius-derived) */
|
|
81
81
|
--radius-sharp: 0; /* squared corners: table cells, flush inputs */
|
|
@@ -140,17 +140,29 @@
|
|
|
140
140
|
--line-height-body: 1.7;
|
|
141
141
|
--letter-spacing-tight: 0;
|
|
142
142
|
|
|
143
|
-
/*
|
|
143
|
+
/* ── SCALING — the one global density knob (Radix Themes model). A single
|
|
144
|
+
* dimensionless multiplier on every SIZE token (spacing grid, control / table /
|
|
145
|
+
* checkbox / switch heights, radius), so the whole UI rescales in proportion
|
|
146
|
+
* from one place. `1` = the design baseline. The `density` axis sets named
|
|
147
|
+
* presets (compact .92 · default 1 · comfortable 1.08); AppProvider's `scaling`
|
|
148
|
+
* prop sets any value continuously. Type has its OWN base+ratio (--font-size-base)
|
|
149
|
+
* and is NOT scaled here — fontSize stays an orthogonal axis. Touch targets
|
|
150
|
+
* (--touch-target-min) are also exempt (a11y minimum). */
|
|
151
|
+
--scaling: 1;
|
|
152
|
+
|
|
153
|
+
/* Raw spacing scale — the 4px grid, scaled. Everything that derives from
|
|
154
|
+
* --space-* (padding, gaps, --phi-unit, semantic spacing, chrome) inherits the
|
|
155
|
+
* scaling automatically; this is the single highest-leverage scaling point. */
|
|
144
156
|
--space-0: 0;
|
|
145
|
-
--space-1: 0.25rem;
|
|
146
|
-
--space-2: 0.5rem;
|
|
147
|
-
--space-3: 0.75rem;
|
|
148
|
-
--space-4: 1rem;
|
|
149
|
-
--space-5: 1.25rem;
|
|
150
|
-
--space-6: 1.5rem;
|
|
151
|
-
--space-8: 2rem;
|
|
152
|
-
--space-10: 2.5rem;
|
|
153
|
-
--space-12: 3rem;
|
|
157
|
+
--space-1: calc(0.25rem * var(--scaling));
|
|
158
|
+
--space-2: calc(0.5rem * var(--scaling));
|
|
159
|
+
--space-3: calc(0.75rem * var(--scaling));
|
|
160
|
+
--space-4: calc(1rem * var(--scaling));
|
|
161
|
+
--space-5: calc(1.25rem * var(--scaling));
|
|
162
|
+
--space-6: calc(1.5rem * var(--scaling));
|
|
163
|
+
--space-8: calc(2rem * var(--scaling));
|
|
164
|
+
--space-10: calc(2.5rem * var(--scaling));
|
|
165
|
+
--space-12: calc(3rem * var(--scaling));
|
|
154
166
|
|
|
155
167
|
/* Golden ratio scale */
|
|
156
168
|
--ratio-phi: 1.6180339887;
|