glacia-native 0.5.0 → 0.5.2
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/LICENSE +29 -4
- package/README.md +27 -0
- package/lib/module/Bars.js +103 -9
- package/lib/module/Button.js +11 -8
- package/lib/module/Card.js +2 -2
- package/lib/module/Dialog.js +16 -17
- package/lib/module/Display.js +86 -8
- package/lib/module/Feedback.js +244 -21
- package/lib/module/Form.js +29 -33
- package/lib/module/Forms2.js +257 -13
- package/lib/module/Glass.js +2 -2
- package/lib/module/Input.js +12 -10
- package/lib/module/Message.js +84 -0
- package/lib/module/Overlays.js +195 -17
- package/lib/module/Pickers.js +16 -16
- package/lib/module/SegmentedControl.js +24 -11
- package/lib/module/Slider.js +24 -10
- package/lib/module/Switch.js +25 -10
- package/lib/module/TabBar.js +23 -13
- package/lib/module/Table.js +4 -3
- package/lib/module/Tabs.js +3 -2
- package/lib/module/ai.js +26 -18
- package/lib/module/charts/BarChart.js +11 -3
- package/lib/module/index.js +23 -2
- package/lib/module/internal/GlassContainer.js +54 -0
- package/lib/module/internal/GlassView.js +10 -2
- package/lib/module/internal/a11y.js +94 -0
- package/lib/module/internal/blur.js +78 -0
- package/lib/module/internal/fallback.js +120 -19
- package/lib/module/internal/glass-routing.js +7 -0
- package/lib/module/internal/glow.js +36 -0
- package/lib/module/internal/haptics.js +54 -0
- package/lib/module/internal/lens.js +70 -0
- package/lib/module/internal/material.js +64 -0
- package/lib/module/internal/motion.js +10 -1
- package/lib/module/internal/primitives.js +70 -4
- package/lib/module/internal/rim.js +35 -0
- package/lib/module/internal/tokens.js +80 -2
- package/lib/typescript/Bars.d.ts +67 -0
- package/lib/typescript/Display.d.ts +59 -0
- package/lib/typescript/Feedback.d.ts +58 -0
- package/lib/typescript/Forms2.d.ts +81 -0
- package/lib/typescript/Message.d.ts +67 -0
- package/lib/typescript/Overlays.d.ts +41 -0
- package/lib/typescript/SegmentedControl.d.ts +2 -0
- package/lib/typescript/Slider.d.ts +2 -0
- package/lib/typescript/Switch.d.ts +2 -0
- package/lib/typescript/TabBar.d.ts +2 -0
- package/lib/typescript/index.d.ts +9 -6
- package/lib/typescript/internal/GlassContainer.d.ts +37 -0
- package/lib/typescript/internal/GlassView.d.ts +21 -0
- package/lib/typescript/internal/a11y.d.ts +19 -0
- package/lib/typescript/internal/blur.d.ts +24 -0
- package/lib/typescript/internal/fallback.d.ts +32 -2
- package/lib/typescript/internal/glass-routing.d.ts +10 -0
- package/lib/typescript/internal/glow.d.ts +11 -0
- package/lib/typescript/internal/haptics.d.ts +7 -0
- package/lib/typescript/internal/lens.d.ts +47 -0
- package/lib/typescript/internal/material.d.ts +27 -0
- package/lib/typescript/internal/motion.d.ts +4 -0
- package/lib/typescript/internal/primitives.d.ts +23 -0
- package/lib/typescript/internal/rim.d.ts +16 -0
- package/lib/typescript/internal/tokens.d.ts +89 -0
- package/package.json +12 -3
- package/src/Bars.tsx +239 -2
- package/src/Button.tsx +16 -9
- package/src/Card.tsx +2 -2
- package/src/Dialog.tsx +37 -26
- package/src/Display.tsx +237 -6
- package/src/Feedback.tsx +448 -35
- package/src/Form.tsx +60 -40
- package/src/Forms2.tsx +455 -8
- package/src/Glass.tsx +4 -0
- package/src/Input.tsx +15 -11
- package/src/Message.tsx +218 -0
- package/src/Overlays.tsx +269 -39
- package/src/Pickers.tsx +11 -6
- package/src/SegmentedControl.tsx +39 -9
- package/src/Slider.tsx +26 -10
- package/src/Switch.tsx +29 -10
- package/src/TabBar.tsx +39 -12
- package/src/Table.tsx +4 -3
- package/src/Tabs.tsx +5 -0
- package/src/ai.tsx +37 -23
- package/src/charts/BarChart.tsx +41 -3
- package/src/index.ts +43 -1
- package/src/internal/GlassContainer.tsx +82 -0
- package/src/internal/GlassView.tsx +25 -0
- package/src/internal/a11y.ts +105 -0
- package/src/internal/blur.ts +90 -0
- package/src/internal/fallback.tsx +170 -15
- package/src/internal/glass-routing.ts +17 -0
- package/src/internal/glow.tsx +62 -0
- package/src/internal/haptics.ts +59 -0
- package/src/internal/lens.tsx +105 -0
- package/src/internal/material.ts +92 -0
- package/src/internal/motion.ts +10 -1
- package/src/internal/primitives.ts +83 -4
- package/src/internal/rim.tsx +79 -0
- package/src/internal/tokens.ts +82 -1
|
@@ -28,6 +28,13 @@ export interface RNPrimitives {
|
|
|
28
28
|
Circle: any;
|
|
29
29
|
Rect: any;
|
|
30
30
|
Polygon: any;
|
|
31
|
+
/** Gradient and clipping nodes, for the colour picker's hue track. */
|
|
32
|
+
Defs: any;
|
|
33
|
+
LinearGradient: any;
|
|
34
|
+
/** The radial gradient the press glow is painted with. */
|
|
35
|
+
RadialGradient: any;
|
|
36
|
+
Stop: any;
|
|
37
|
+
ClipPath: any;
|
|
31
38
|
SvgText: any;
|
|
32
39
|
TextInput: any;
|
|
33
40
|
Modal: any;
|
|
@@ -46,6 +53,19 @@ export interface RNPrimitives {
|
|
|
46
53
|
PanResponder: any;
|
|
47
54
|
/** React Native's useColorScheme, or null outside a native runtime. */
|
|
48
55
|
useColorScheme: (() => "light" | "dark" | null | undefined) | null;
|
|
56
|
+
/**
|
|
57
|
+
* React Native's AccessibilityInfo, or null outside a native runtime. Read
|
|
58
|
+
* for the Reduce Transparency and Reduce Motion preferences.
|
|
59
|
+
*/
|
|
60
|
+
AccessibilityInfo: any;
|
|
61
|
+
/** React Native's Vibration, or null outside a native runtime. */
|
|
62
|
+
Vibration: any;
|
|
63
|
+
/**
|
|
64
|
+
* React Native's useWindowDimensions, or a fixed reader off-device. Snap
|
|
65
|
+
* points are fractions of the window, so the sheet needs the height before
|
|
66
|
+
* it can resolve them.
|
|
67
|
+
*/
|
|
68
|
+
useWindowDimensions: () => { width: number; height: number };
|
|
49
69
|
}
|
|
50
70
|
|
|
51
71
|
/**
|
|
@@ -242,15 +262,23 @@ function resolve(): RNPrimitives {
|
|
|
242
262
|
|
|
243
263
|
/** An image that reads its remote source in the DOM preview. */
|
|
244
264
|
function imageFallback(props: any) {
|
|
245
|
-
const { source, accessibilityLabel, style, onError } = props ?? {};
|
|
265
|
+
const { source, accessibilityLabel, accessibilityRole, style, onError, onLoad, testID, ...rest } = props ?? {};
|
|
246
266
|
const { createElement } = require("react");
|
|
267
|
+
const source_ = typeof source === "number" ? undefined : source?.uri;
|
|
247
268
|
return createElement("img", {
|
|
248
|
-
src:
|
|
269
|
+
src: source_,
|
|
270
|
+
// `alt` covers the visible-description case; `aria-label` is what queries
|
|
271
|
+
// and screen readers in the preview read, so both are set.
|
|
249
272
|
alt: accessibilityLabel ?? "",
|
|
273
|
+
"aria-label": accessibilityLabel,
|
|
274
|
+
"aria-role": accessibilityRole,
|
|
275
|
+
"data-testid": testID,
|
|
250
276
|
style: toDomStyle(style),
|
|
251
|
-
//
|
|
252
|
-
//
|
|
277
|
+
// Load and error must reach the component the way they do on a device,
|
|
278
|
+
// or the placeholder and the fallback can never render in the preview.
|
|
253
279
|
onError,
|
|
280
|
+
onLoad,
|
|
281
|
+
...rest,
|
|
254
282
|
});
|
|
255
283
|
}
|
|
256
284
|
|
|
@@ -268,6 +296,11 @@ function resolve(): RNPrimitives {
|
|
|
268
296
|
Circle: svg?.Circle ?? fallback("circle"),
|
|
269
297
|
Rect: svg?.Rect ?? fallback("rect"),
|
|
270
298
|
Polygon: svg?.Polygon ?? fallback("polygon"),
|
|
299
|
+
Defs: svg?.Defs ?? fallback("defs"),
|
|
300
|
+
LinearGradient: svg?.LinearGradient ?? fallback("linearGradient"),
|
|
301
|
+
RadialGradient: svg?.RadialGradient ?? fallback("radialGradient"),
|
|
302
|
+
Stop: svg?.Stop ?? fallback("stop"),
|
|
303
|
+
ClipPath: svg?.ClipPath ?? fallback("clipPath"),
|
|
271
304
|
// TextInput is not an SVG primitive, but resolving it here keeps every
|
|
272
305
|
// component on one runtime-resolution path instead of two.
|
|
273
306
|
TextInput: rn?.TextInput ?? fallback("input"),
|
|
@@ -285,6 +318,19 @@ function resolve(): RNPrimitives {
|
|
|
285
318
|
isNative: Boolean(rn?.View),
|
|
286
319
|
PanResponder: rn?.PanResponder ?? panResponderShim(),
|
|
287
320
|
useColorScheme: rn?.useColorScheme ?? null,
|
|
321
|
+
// AccessibilityInfo and Vibration are only meaningful on a device; both
|
|
322
|
+
// are null off it, and their callers already treat absence as "off".
|
|
323
|
+
AccessibilityInfo: rn?.AccessibilityInfo ?? null,
|
|
324
|
+
Vibration: rn?.Vibration ?? null,
|
|
325
|
+
// Off-device there is no window; the DOM preview reports the viewport when
|
|
326
|
+
// it can and a conventional phone size otherwise. Snap points are
|
|
327
|
+
// fractions, so any consistent height yields the same proportions.
|
|
328
|
+
useWindowDimensions:
|
|
329
|
+
rn?.useWindowDimensions ??
|
|
330
|
+
(() => {
|
|
331
|
+
const view: any = typeof globalThis !== "undefined" ? (globalThis as any).window : undefined;
|
|
332
|
+
return { width: view?.innerWidth ?? 390, height: view?.innerHeight ?? 800 };
|
|
333
|
+
}),
|
|
288
334
|
};
|
|
289
335
|
}
|
|
290
336
|
|
|
@@ -443,6 +489,32 @@ const LENGTH_PROPS = new Set([
|
|
|
443
489
|
]);
|
|
444
490
|
|
|
445
491
|
/** Converts an RN style object to DOM-compatible CSS. */
|
|
492
|
+
/**
|
|
493
|
+
* Rewrites React Native's `transform` array into a CSS transform string.
|
|
494
|
+
*
|
|
495
|
+
* The preview is a browser, and a browser does not understand
|
|
496
|
+
* `[{ translateX: 12 }, { scale: 2 }]`; React Native's Shape controls and
|
|
497
|
+
* glass offsets would silently not move. Translating the entries here keeps the
|
|
498
|
+
* preview faithful to what a device shows.
|
|
499
|
+
*/
|
|
500
|
+
function transformToCss(entries: any): string | undefined {
|
|
501
|
+
if (!Array.isArray(entries)) return typeof entries === "string" ? entries : undefined;
|
|
502
|
+
const parts: string[] = [];
|
|
503
|
+
for (const entry of entries) {
|
|
504
|
+
if (!entry || typeof entry !== "object") continue;
|
|
505
|
+
for (const [key, raw] of Object.entries(entry)) {
|
|
506
|
+
const value = typeof (raw as any)?.__getValue === "function" ? (raw as any).__getValue() : raw;
|
|
507
|
+
if (typeof value !== "number") continue;
|
|
508
|
+
if (key === "translateX") parts.push(`translateX(${value}px)`);
|
|
509
|
+
else if (key === "translateY") parts.push(`translateY(${value}px)`);
|
|
510
|
+
else if (key === "scale") parts.push(`scale(${value})`);
|
|
511
|
+
else if (key === "rotate") parts.push(`rotate(${value}deg)`);
|
|
512
|
+
else if (key === "rotateZ") parts.push(`rotateZ(${value}deg)`);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
return parts.length > 0 ? parts.join(" ") : undefined;
|
|
516
|
+
}
|
|
517
|
+
|
|
446
518
|
function toDomStyle(style: any): any {
|
|
447
519
|
if (!style) return style;
|
|
448
520
|
const list = Array.isArray(style) ? style : [style];
|
|
@@ -455,6 +527,13 @@ function toDomStyle(style: any): any {
|
|
|
455
527
|
// Animated values resolve to plain numbers off-device.
|
|
456
528
|
const resolved =
|
|
457
529
|
typeof (value as any)?.interpolate === "function" ? (value as any).__getValue?.() : value;
|
|
530
|
+
if (key === "transform") {
|
|
531
|
+
const css = transformToCss(resolved);
|
|
532
|
+
// Only set it when there is something to say; an empty transform would
|
|
533
|
+
// override an earlier entry in a style array.
|
|
534
|
+
if (css) merged[key] = css;
|
|
535
|
+
continue;
|
|
536
|
+
}
|
|
458
537
|
merged[key] =
|
|
459
538
|
typeof resolved === "number" && LENGTH_PROPS.has(key) ? `${resolved}px` : resolved;
|
|
460
539
|
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// The painted rim: light caught on the curved edge of a glass surface.
|
|
2
|
+
//
|
|
3
|
+
// This is the layer that makes a rounded corner *read* as rounded. The web
|
|
4
|
+
// engine paints a rim gradient into every glass element (brightest along the
|
|
5
|
+
// top edge, fading down the sides, nearly gone at the bottom), plus a soft
|
|
6
|
+
// highlight just inside the top. The fallback only had a uniform 8% edge line,
|
|
7
|
+
// which is why the owner described the corners as "not fully curved".
|
|
8
|
+
//
|
|
9
|
+
// Drawn in SVG because that is what the package already uses for its charts
|
|
10
|
+
// and share the same resolver: no new native dependency, and it works
|
|
11
|
+
// identically on iOS and Android.
|
|
12
|
+
|
|
13
|
+
import { useId } from "react";
|
|
14
|
+
|
|
15
|
+
import { primitives } from "./primitives";
|
|
16
|
+
import { material } from "./tokens";
|
|
17
|
+
|
|
18
|
+
const fill = { position: "absolute", top: 0, left: 0, right: 0, bottom: 0 } as const;
|
|
19
|
+
|
|
20
|
+
export interface GlassRimProps {
|
|
21
|
+
/** The surface's corner radius, so the rim follows the shape. */
|
|
22
|
+
radius: number;
|
|
23
|
+
/** Alpha of the brightest (top) part of the rim. */
|
|
24
|
+
rim: number;
|
|
25
|
+
/** Alpha of the highlight inside the top edge. */
|
|
26
|
+
highlight: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The rim light and top highlight of one surface.
|
|
31
|
+
*
|
|
32
|
+
* Both are stacked stops of a vertical gradient in the same colour: the eye
|
|
33
|
+
* reads the brightest edge as a lit curve and the falloff as the curve turning
|
|
34
|
+
* away from the light.
|
|
35
|
+
*/
|
|
36
|
+
export function GlassRim({ radius, rim, highlight }: GlassRimProps) {
|
|
37
|
+
const { Svg, Defs, Rect, LinearGradient, Stop } = primitives();
|
|
38
|
+
const key = useId().replace(/[^a-zA-Z0-9_-]/g, "");
|
|
39
|
+
const rimId = `rim-${key}`;
|
|
40
|
+
const highlightId = `top-${key}`;
|
|
41
|
+
// SVG clamps rx/ry to half the side, so a pill radius simply becomes a pill.
|
|
42
|
+
const rx = Math.max(0, radius - 0.5);
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<Svg width="100%" height="100%" style={fill} pointerEvents="none">
|
|
46
|
+
<Defs>
|
|
47
|
+
<LinearGradient id={rimId} x1="0" y1="0" x2="0" y2="1">
|
|
48
|
+
<Stop offset="0" stopColor={material.rimColor} stopOpacity={rim} />
|
|
49
|
+
<Stop offset="0.55" stopColor={material.rimColor} stopOpacity={rim * 0.35} />
|
|
50
|
+
<Stop offset="1" stopColor={material.rimColor} stopOpacity={rim * 0.08} />
|
|
51
|
+
</LinearGradient>
|
|
52
|
+
<LinearGradient id={highlightId} x1="0" y1="0" x2="0" y2="1">
|
|
53
|
+
<Stop offset="0" stopColor={material.rimColor} stopOpacity={highlight} />
|
|
54
|
+
<Stop offset="1" stopColor={material.rimColor} stopOpacity={0} />
|
|
55
|
+
</LinearGradient>
|
|
56
|
+
</Defs>
|
|
57
|
+
<Rect
|
|
58
|
+
x={0.5}
|
|
59
|
+
y={0.5}
|
|
60
|
+
width="99%"
|
|
61
|
+
height="99%"
|
|
62
|
+
rx={rx}
|
|
63
|
+
ry={rx}
|
|
64
|
+
fill="none"
|
|
65
|
+
stroke={`url(#${rimId})`}
|
|
66
|
+
strokeWidth={1}
|
|
67
|
+
/>
|
|
68
|
+
<Rect
|
|
69
|
+
x={1}
|
|
70
|
+
y={1}
|
|
71
|
+
width="98%"
|
|
72
|
+
height="40%"
|
|
73
|
+
rx={Math.max(0, rx - 1)}
|
|
74
|
+
ry={Math.max(0, rx - 1)}
|
|
75
|
+
fill={`url(#${highlightId})`}
|
|
76
|
+
/>
|
|
77
|
+
</Svg>
|
|
78
|
+
);
|
|
79
|
+
}
|
package/src/internal/tokens.ts
CHANGED
|
@@ -5,6 +5,7 @@ export const radii = {
|
|
|
5
5
|
md: tokenRadii.md.number,
|
|
6
6
|
lg: tokenRadii.lg.number,
|
|
7
7
|
xl: tokenRadii.xl.number,
|
|
8
|
+
stack: tokenRadii.stack.number,
|
|
8
9
|
pill: tokenRadii.pill.number,
|
|
9
10
|
};
|
|
10
11
|
|
|
@@ -28,6 +29,35 @@ export const typeScale = {
|
|
|
28
29
|
caption: { fontSize: 12, lineHeight: 16, fontWeight: "400" as const },
|
|
29
30
|
};
|
|
30
31
|
|
|
32
|
+
/**
|
|
33
|
+
* The default colour palette for ColorPicker.
|
|
34
|
+
*
|
|
35
|
+
* A palette is data, not a theme colour — it is the same twelve hues in light
|
|
36
|
+
* and dark — so it lives here rather than in either theme. Keeping it in the
|
|
37
|
+
* token module is also what lets the conformance guard require that component
|
|
38
|
+
* code contains no colour literal at all.
|
|
39
|
+
*/
|
|
40
|
+
export const palette = {
|
|
41
|
+
default: [
|
|
42
|
+
"#FF3B30", "#FF9500", "#FFCC00", "#34C759", "#32ADE6", "#007AFF",
|
|
43
|
+
"#5856D6", "#AF52DE", "#FF2D55", "#A2845E", "#8E8E93", "#1C1C1E",
|
|
44
|
+
],
|
|
45
|
+
/** The colour a picker starts on when the caller gives none. */
|
|
46
|
+
fallback: "#007AFF",
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Control sizes in points, for components whose dimension is not a radius.
|
|
51
|
+
*
|
|
52
|
+
* Rating's stars are the reason this exists: a star has a size and the size
|
|
53
|
+
* must come from the scale rather than from a literal in the component.
|
|
54
|
+
*/
|
|
55
|
+
export const controlSizes = {
|
|
56
|
+
star: { sm: 14, md: 20, lg: 28 },
|
|
57
|
+
swatch: { sm: 28, md: 36, lg: 44 },
|
|
58
|
+
picker: { track: 28 },
|
|
59
|
+
};
|
|
60
|
+
|
|
31
61
|
/**
|
|
32
62
|
* Theme colours in the form React Native accepts.
|
|
33
63
|
*
|
|
@@ -42,8 +72,16 @@ export const colors = {
|
|
|
42
72
|
muted: "#3C3C4399",
|
|
43
73
|
glass: "rgba(255, 255, 255, 0.6)",
|
|
44
74
|
glassActive: "rgba(236, 236, 240, 0.85)",
|
|
75
|
+
/**
|
|
76
|
+
* The near-solid surface the web uses where legibility beats translucency:
|
|
77
|
+
* menus and toggle groups. A glass surface underneath text that must be
|
|
78
|
+
* read at a glance is the one place the web deliberately goes opaque-ish.
|
|
79
|
+
*/
|
|
80
|
+
surface: "rgba(255, 255, 255, 0.86)",
|
|
45
81
|
edge: "rgba(0, 0, 0, 0.08)",
|
|
46
|
-
separator:
|
|
82
|
+
// The agreed separator value: the web CSS one (0.15 / 0.16 dark), so the
|
|
83
|
+
// three files that carried three different light values now agree.
|
|
84
|
+
separator: "rgba(60, 60, 67, 0.15)",
|
|
47
85
|
fill: "#0088FF",
|
|
48
86
|
destructive: "#FF3B30",
|
|
49
87
|
on: "#34C759",
|
|
@@ -54,6 +92,20 @@ export const colors = {
|
|
|
54
92
|
// Text and icons drawn on top of a filled (tinted) surface.
|
|
55
93
|
onTint: "#FFFFFF",
|
|
56
94
|
skeleton: "rgba(60, 60, 67, 0.12)",
|
|
95
|
+
/**
|
|
96
|
+
* The solid colour glass becomes when the user has asked the system to
|
|
97
|
+
* reduce transparency. Apple's rule is that a translucent surface is
|
|
98
|
+
* replaced by an opaque one, not merely tinted differently.
|
|
99
|
+
*/
|
|
100
|
+
glassSolid: "#F2F2F7",
|
|
101
|
+
/**
|
|
102
|
+
* Neutral colours used by pickers and fields: the field's own wash, and
|
|
103
|
+
* the far end of a saturation gradient (the point of no saturation).
|
|
104
|
+
*/
|
|
105
|
+
fieldWash: "rgba(120, 120, 128, 0.12)",
|
|
106
|
+
/** A flat neutral surface: incoming message bubbles, file chips. */
|
|
107
|
+
wash: "rgba(120, 120, 128, 0.12)",
|
|
108
|
+
neutralTop: "#FFFFFF",
|
|
57
109
|
// Chart axis and grid lines: low-contrast, so they never compete with data.
|
|
58
110
|
axis: "#3C3C43",
|
|
59
111
|
},
|
|
@@ -62,6 +114,7 @@ export const colors = {
|
|
|
62
114
|
muted: "#EBEBF599",
|
|
63
115
|
glass: "rgba(40, 40, 40, 0.62)",
|
|
64
116
|
glassActive: "rgba(70, 70, 70, 0.62)",
|
|
117
|
+
surface: "rgba(40, 40, 40, 0.86)",
|
|
65
118
|
edge: "rgba(255, 255, 255, 0.08)",
|
|
66
119
|
separator: "rgba(235, 235, 245, 0.16)",
|
|
67
120
|
fill: "#0091FF",
|
|
@@ -72,6 +125,11 @@ export const colors = {
|
|
|
72
125
|
scrim: "rgba(0, 0, 0, 0.6)",
|
|
73
126
|
onTint: "#FFFFFF",
|
|
74
127
|
skeleton: "rgba(235, 235, 245, 0.14)",
|
|
128
|
+
glassSolid: "#1C1C1E",
|
|
129
|
+
fieldWash: "rgba(120, 120, 128, 0.12)",
|
|
130
|
+
/** A flat neutral surface: incoming message bubbles, file chips. */
|
|
131
|
+
wash: "rgba(120, 120, 128, 0.12)",
|
|
132
|
+
neutralTop: "#FFFFFF",
|
|
75
133
|
axis: "#EBEBF5",
|
|
76
134
|
},
|
|
77
135
|
};
|
|
@@ -79,6 +137,29 @@ export const colors = {
|
|
|
79
137
|
/** Keeps the shared token file honest if a colour is added there first. */
|
|
80
138
|
export type ThemeColors = typeof colors.light;
|
|
81
139
|
|
|
140
|
+
/**
|
|
141
|
+
* The values the fallback's material layers are built from.
|
|
142
|
+
*
|
|
143
|
+
* These are the web engine's numbers, not new inventions: the rim shine is the
|
|
144
|
+
* web's `--gl-rim` brightness (0.30 light / 0.13 dark), the top highlight and
|
|
145
|
+
* press glow are the web overlay alphas, and the drop shadow is the web's
|
|
146
|
+
* `0 1px 3px` black 0.06. They live here, next to the colours, so no component
|
|
147
|
+
* carries a material literal of its own.
|
|
148
|
+
*/
|
|
149
|
+
export const material = {
|
|
150
|
+
/** Maximum alpha of the painted rim light, per theme (web: shine). */
|
|
151
|
+
rim: { light: 0.3, dark: 0.13 },
|
|
152
|
+
/** Alpha of the soft highlight drawn inside the top edge. */
|
|
153
|
+
highlight: 0.1,
|
|
154
|
+
/** Alpha of the radial glow that fades in while a surface is held. */
|
|
155
|
+
glow: 0.035,
|
|
156
|
+
/** Shadow colour; the web drops surfaces by 1px with 6% black in light. */
|
|
157
|
+
shadowColor: "#000000",
|
|
158
|
+
shadowOpacity: { light: 0.06, dark: 0 },
|
|
159
|
+
/** The colour the rim light and the top highlight are painted in. */
|
|
160
|
+
rimColor: "#FFFFFF",
|
|
161
|
+
};
|
|
162
|
+
|
|
82
163
|
/** The semantic tone of a feedback component (Banner, Toast). */
|
|
83
164
|
export type Tone = "info" | "success" | "warning" | "error";
|
|
84
165
|
|