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
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
export interface NativeGlassContainerProps {
|
|
4
|
+
/**
|
|
5
|
+
* How close two glass surfaces must be before iOS 26 blends them into one
|
|
6
|
+
* connected liquid surface, in points. 0 merges only what touches.
|
|
7
|
+
*/
|
|
8
|
+
spacing?: number;
|
|
9
|
+
style?: StyleProp<ViewStyle>;
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
isDark?: boolean;
|
|
12
|
+
testID?: string;
|
|
13
|
+
[prop: string]: any;
|
|
14
|
+
}
|
|
15
|
+
/** Clears the memoised decision. Only tests call this, to drive both branches. */
|
|
16
|
+
export declare function resetGlassContainerRouter(): void;
|
|
17
|
+
/**
|
|
18
|
+
* Groups glass surfaces so iOS 26 can merge them into one surface.
|
|
19
|
+
*
|
|
20
|
+
* On iOS 26, Apple's Liquid Glass is a connected material: two glass elements
|
|
21
|
+
* placed close enough run together into a single shape with one shared edge,
|
|
22
|
+
* rather than reading as two separate panes. `GlassContainer` is the component
|
|
23
|
+
* that opts into that — a bar and the floating button above it, or a pair of
|
|
24
|
+
* adjacent buttons, become one piece of glass.
|
|
25
|
+
*
|
|
26
|
+
* **Merging is an iOS 26+ visual effect and a no-op everywhere else.** On
|
|
27
|
+
* older iOS, Android, Expo Go and the web preview this renders a plain wrapper
|
|
28
|
+
* with identical layout: the children are the same components, drawn at the
|
|
29
|
+
* same positions, they simply keep their own separate edges. Nothing changes
|
|
30
|
+
* shape or shifts, so a container costs nothing on the platforms that cannot
|
|
31
|
+
* blend.
|
|
32
|
+
*
|
|
33
|
+
* Use it only around surfaces that should read as one; glass inside glass is
|
|
34
|
+
* still forbidden, so a container's children are `Glass` surfaces placed side
|
|
35
|
+
* by side, not a panel wrapping another panel.
|
|
36
|
+
*/
|
|
37
|
+
export declare const GlassContainer: import("react").ForwardRefExoticComponent<Omit<NativeGlassContainerProps, "ref"> & import("react").RefAttributes<any>>;
|
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import type { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
import type { SurfaceProfile } from "./material";
|
|
3
4
|
export interface NativeGlassProps {
|
|
4
5
|
effect?: "clear" | "regular" | "none";
|
|
5
6
|
tintColor?: string;
|
|
6
7
|
interactive?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Which web surface profile this is (panel, control, field, overlay, hint,
|
|
10
|
+
* rail). The fallback uses it to pick blur, rim brightness and highlight —
|
|
11
|
+
* read by the fallback branch only; Apple's material replaces the stack on
|
|
12
|
+
* iOS 26, so the prop is not forwarded there.
|
|
13
|
+
*/
|
|
14
|
+
surface?: SurfaceProfile;
|
|
15
|
+
/**
|
|
16
|
+
* True while the surface is held, so the fallback can fade its specular glow
|
|
17
|
+
* in. Not forwarded to Apple's view, which draws its own press effect.
|
|
18
|
+
*/
|
|
19
|
+
pressed?: boolean;
|
|
7
20
|
/** Passed to whichever surface renders, so tests can find the glass itself. */
|
|
8
21
|
testID?: string;
|
|
9
22
|
style?: StyleProp<ViewStyle>;
|
|
@@ -28,5 +41,13 @@ export declare const isGlassSupported: boolean;
|
|
|
28
41
|
* Platform Glass View — the single place a glass surface is chosen:
|
|
29
42
|
* - iOS 26+: Real UIGlassEffect via @callstack/liquid-glass
|
|
30
43
|
* - iOS < 26 / Android / Expo Go: translucent tint View with identical layout
|
|
44
|
+
*
|
|
45
|
+
* Reduce Transparency is honoured on the fallback branch only: there the
|
|
46
|
+
* translucent tint is replaced by the theme's solid glass colour, with the same
|
|
47
|
+
* radius and the same hairline border, because a translucent surface is what
|
|
48
|
+
* the user asked the system to remove. On iOS 26 the system applies its own
|
|
49
|
+
* treatment to `UIGlassEffect` and this component does not second-guess it —
|
|
50
|
+
* overriding Apple's accessibility treatment would be worse than deferring to
|
|
51
|
+
* it, so the real glass is left exactly as the system renders it.
|
|
31
52
|
*/
|
|
32
53
|
export declare const GlassView: import("react").ForwardRefExoticComponent<Omit<NativeGlassProps, "ref"> & import("react").RefAttributes<any>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the user has asked the system to reduce transparency.
|
|
3
|
+
*
|
|
4
|
+
* When true, a glass surface must render a solid colour rather than a
|
|
5
|
+
* translucent one. `GlassView` honours this on the fallback branch; on iOS 26
|
|
6
|
+
* the system applies its own treatment to `UIGlassEffect` and is not
|
|
7
|
+
* second-guessed here.
|
|
8
|
+
*
|
|
9
|
+
* The change event is iOS-only in React Native, so on Android the initial
|
|
10
|
+
* read is the answer.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useReducedTransparency(): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the user has asked the system to reduce motion.
|
|
15
|
+
*
|
|
16
|
+
* Glacia's own animations settle at their end state instead of playing when
|
|
17
|
+
* this is true.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useReducedMotion(): boolean;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type BlurKind = "expo" | "community";
|
|
2
|
+
interface ResolvedBlur {
|
|
3
|
+
kind: BlurKind;
|
|
4
|
+
View: any;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The installed blur backend, or null when neither is available.
|
|
8
|
+
*
|
|
9
|
+
* Memoised: the answer is a property of the installed modules, not of the
|
|
10
|
+
* render, so resolving once keeps every surface on the same backend.
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveBlurView(): ResolvedBlur | null;
|
|
13
|
+
/** Clears the memoised backend. Only tests call this. */
|
|
14
|
+
export declare function resetBlurResolver(): void;
|
|
15
|
+
/**
|
|
16
|
+
* The props one backend needs to blur a surface.
|
|
17
|
+
*
|
|
18
|
+
* The two libraries name the same idea differently — expo-blur takes a 0–100
|
|
19
|
+
* intensity and a tint, community-blur a 0–100 amount and a blur type — so the
|
|
20
|
+
* mapping lives here rather than in the fallback's render. Android needs an
|
|
21
|
+
* explicit method on expo-blur; Dimezis is its own real-time backdrop blur.
|
|
22
|
+
*/
|
|
23
|
+
export declare function blurProps(kind: BlurKind, intensity: number, isDark: boolean): Record<string, any>;
|
|
24
|
+
export {};
|
|
@@ -1,18 +1,48 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import type { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
import { type SurfaceProfile } from "./material";
|
|
3
4
|
export interface FallbackGlassProps {
|
|
4
5
|
effect?: "clear" | "regular" | "none";
|
|
6
|
+
/**
|
|
7
|
+
* Which of the web's six lenses this surface is. The profile decides the
|
|
8
|
+
* blur strength, rim brightness and top highlight, so a dialog and a badge
|
|
9
|
+
* no longer share one flat recipe.
|
|
10
|
+
*/
|
|
11
|
+
surface?: SurfaceProfile;
|
|
5
12
|
tintColor?: string;
|
|
13
|
+
/** True while the surface is held; fades the specular glow in. */
|
|
14
|
+
pressed?: boolean;
|
|
6
15
|
testID?: string;
|
|
7
16
|
style?: StyleProp<ViewStyle>;
|
|
8
17
|
children?: ReactNode;
|
|
9
18
|
isDark?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Force the solid treatment. Normally read from the system's Reduce
|
|
21
|
+
* Transparency preference; this exists so a test can pin it.
|
|
22
|
+
*/
|
|
23
|
+
reducedTransparency?: boolean;
|
|
10
24
|
}
|
|
11
25
|
/**
|
|
12
26
|
* Glacia's own glass surface for every platform where Apple's material is not
|
|
13
27
|
* available: Android, iOS before 26, and Expo Go.
|
|
14
28
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
29
|
+
* The material is the web one, rebuilt in layers, because a single flat View
|
|
30
|
+
* could never read as glass:
|
|
31
|
+
*
|
|
32
|
+
* 1. backdrop blur (`expo-blur` / `@react-native-community/blur` when either
|
|
33
|
+
* is installed — a real `UIVisualEffectView` on iOS 17),
|
|
34
|
+
* 2. the tint token on top of the blurred backdrop,
|
|
35
|
+
* 3. a painted rim light, brightest on the top edge, so corners read as curved,
|
|
36
|
+
* 4. a soft highlight just inside the top edge,
|
|
37
|
+
* 5. the 0.5px edge line, and
|
|
38
|
+
* 6. a drop shadow on the surface itself (outside the clipped layer).
|
|
39
|
+
*
|
|
40
|
+
* All of that lives in an absolutely-positioned, clipped layer behind the
|
|
41
|
+
* children. The caller's style stays on the outer View, so heights, padding and
|
|
42
|
+
* flex behaviour are byte-identical to the old flat implementation and
|
|
43
|
+
* switching branches never shifts the layout.
|
|
44
|
+
*
|
|
45
|
+
* Reduce Transparency still replaces the whole thing with a solid colour: the
|
|
46
|
+
* preference exists precisely to remove see-through surfaces.
|
|
17
47
|
*/
|
|
18
48
|
export declare const FallbackGlassView: import("react").ForwardRefExoticComponent<FallbackGlassProps & import("react").RefAttributes<any>>;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
export interface LiquidGlassModule {
|
|
2
2
|
LiquidGlassView?: any;
|
|
3
|
+
/**
|
|
4
|
+
* The container that merges nearby glass elements into one connected
|
|
5
|
+
* surface. Exported by `@callstack/liquid-glass` alongside the view.
|
|
6
|
+
*/
|
|
7
|
+
LiquidGlassContainerView?: any;
|
|
3
8
|
isLiquidGlassSupported?: boolean;
|
|
4
9
|
}
|
|
5
10
|
/** The routing decision for one glass surface. */
|
|
@@ -8,6 +13,11 @@ export interface GlassRouter {
|
|
|
8
13
|
supported: boolean;
|
|
9
14
|
/** Apple's `LiquidGlassView`, or null when the fallback renders instead. */
|
|
10
15
|
LiquidGlassView: any;
|
|
16
|
+
/**
|
|
17
|
+
* Apple's `LiquidGlassContainerView` — the surface that merges neighbouring
|
|
18
|
+
* glass — or null when the fallback wrapper renders instead.
|
|
19
|
+
*/
|
|
20
|
+
LiquidGlassContainerView: any;
|
|
11
21
|
}
|
|
12
22
|
/**
|
|
13
23
|
* Reads a liquid-glass module and decides which branch renders.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface SurfaceGlowProps {
|
|
2
|
+
/** True while the surface is held. */
|
|
3
|
+
active: boolean;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* A radial highlight that fades in while `active`.
|
|
7
|
+
*
|
|
8
|
+
* Motion uses the package's spring tokens and respects Reduce Motion: with the
|
|
9
|
+
* preference on, the glow appears at its end state rather than fading.
|
|
10
|
+
*/
|
|
11
|
+
export declare function SurfaceGlow({ active }: SurfaceGlowProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One selection tick, for a control whose value just changed by one step.
|
|
3
|
+
*
|
|
4
|
+
* Silent where no haptics API is available (the DOM preview, a test run, a
|
|
5
|
+
* device without a vibration motor). Never throws.
|
|
6
|
+
*/
|
|
7
|
+
export declare function hapticSelection(): void;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
/**
|
|
4
|
+
* How far a lens sits above its row.
|
|
5
|
+
*
|
|
6
|
+
* Shallower than a panel's shadow: a lens is inside a surface that already
|
|
7
|
+
* floats, so it needs contact, not altitude.
|
|
8
|
+
*/
|
|
9
|
+
export declare function lensShadow(isDark?: boolean): ViewStyle;
|
|
10
|
+
/**
|
|
11
|
+
* The rim of a lens, on its own.
|
|
12
|
+
*
|
|
13
|
+
* For indicators that are already animated views and cannot become a
|
|
14
|
+
* `SelectedLens`: they keep their own transform, and this paints the light on
|
|
15
|
+
* top of whatever tint they already have.
|
|
16
|
+
*/
|
|
17
|
+
export declare function LensRim({ radius, isDark }: {
|
|
18
|
+
radius: number;
|
|
19
|
+
isDark?: boolean;
|
|
20
|
+
}): import("react").JSX.Element;
|
|
21
|
+
export interface SelectedLensProps {
|
|
22
|
+
/** The lens shape. A circle is simply a radius of half the side. */
|
|
23
|
+
radius: number;
|
|
24
|
+
isDark?: boolean;
|
|
25
|
+
style?: StyleProp<ViewStyle>;
|
|
26
|
+
children?: ReactNode;
|
|
27
|
+
testID?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A selected state, drawn as the web's lens.
|
|
31
|
+
*
|
|
32
|
+
* Rendered as an absolutely positioned overlay so it never changes the layout
|
|
33
|
+
* of the row it marks: parents keep their padding and press handling, and the
|
|
34
|
+
* content paints above it by sibling order.
|
|
35
|
+
*/
|
|
36
|
+
export declare function SelectedLens({ radius, isDark, style, children, testID }: SelectedLensProps): import("react").JSX.Element;
|
|
37
|
+
/** The lens overlay for a row: inset from the panel's edges, full width inside. */
|
|
38
|
+
export declare function rowLensStyle(radius: number, inset?: number): ViewStyle;
|
|
39
|
+
/** A pill lens filling its own box, for indicators pinned to a control. */
|
|
40
|
+
export declare const lensFill: {
|
|
41
|
+
readonly borderRadius: 9999;
|
|
42
|
+
readonly position: "absolute";
|
|
43
|
+
readonly top: 0;
|
|
44
|
+
readonly left: 0;
|
|
45
|
+
readonly right: 0;
|
|
46
|
+
readonly bottom: 0;
|
|
47
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** The six surfaces the web engine distinguishes. */
|
|
2
|
+
export type SurfaceProfile = "panel" | "control" | "field" | "overlay" | "hint" | "rail";
|
|
3
|
+
/** A resolved material for one surface, in the units React Native accepts. */
|
|
4
|
+
export interface ResolvedMaterial {
|
|
5
|
+
/** Backdrop blur intensity on expo-blur's 0–100 scale. */
|
|
6
|
+
blur: number;
|
|
7
|
+
/** Alpha of the rim's brightest (top) stop. */
|
|
8
|
+
rim: number;
|
|
9
|
+
/** Alpha of the highlight inside the top edge. */
|
|
10
|
+
highlight: number;
|
|
11
|
+
/** How far the surface is lifted, from the theme's shadow tokens. */
|
|
12
|
+
shadowOpacity: number;
|
|
13
|
+
shadowRadius: number;
|
|
14
|
+
shadowOffsetY: number;
|
|
15
|
+
/** Android's equivalent of the iOS shadow. */
|
|
16
|
+
elevation: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The material for one surface.
|
|
20
|
+
*
|
|
21
|
+
* The `clear` effect is the same stack with a thinner lens — less blur and a
|
|
22
|
+
* fainter rim — which is what the web means by clear. Reduce Transparency is
|
|
23
|
+
* handled before this call: it replaces the whole stack with a solid colour.
|
|
24
|
+
*/
|
|
25
|
+
export declare function materialFor(profile?: SurfaceProfile, effect?: "clear" | "regular" | "none", isDark?: boolean): ResolvedMaterial;
|
|
26
|
+
/** Whether a surface is a shadowed one at all (the hint family sits flat). */
|
|
27
|
+
export declare function isFlatProfile(profile: SurfaceProfile): boolean;
|
|
@@ -12,6 +12,10 @@ export type SpringName = keyof typeof springs;
|
|
|
12
12
|
* on this platform. A caller that gets `animated === false` renders the target
|
|
13
13
|
* directly, so the DOM preview and tests show the settled state rather than an
|
|
14
14
|
* animation the environment cannot advance.
|
|
15
|
+
*
|
|
16
|
+
* Reduce Motion turns this into the same case: `animated` is false and the
|
|
17
|
+
* value is already at its target, so the component jumps to its end state
|
|
18
|
+
* rather than playing a transition the user asked not to see.
|
|
15
19
|
*/
|
|
16
20
|
export declare function useSpring(target: number, spring?: SpringName): {
|
|
17
21
|
value: any;
|
|
@@ -10,6 +10,13 @@ export interface RNPrimitives {
|
|
|
10
10
|
Circle: any;
|
|
11
11
|
Rect: any;
|
|
12
12
|
Polygon: any;
|
|
13
|
+
/** Gradient and clipping nodes, for the colour picker's hue track. */
|
|
14
|
+
Defs: any;
|
|
15
|
+
LinearGradient: any;
|
|
16
|
+
/** The radial gradient the press glow is painted with. */
|
|
17
|
+
RadialGradient: any;
|
|
18
|
+
Stop: any;
|
|
19
|
+
ClipPath: any;
|
|
13
20
|
SvgText: any;
|
|
14
21
|
TextInput: any;
|
|
15
22
|
Modal: any;
|
|
@@ -28,6 +35,22 @@ export interface RNPrimitives {
|
|
|
28
35
|
PanResponder: any;
|
|
29
36
|
/** React Native's useColorScheme, or null outside a native runtime. */
|
|
30
37
|
useColorScheme: (() => "light" | "dark" | null | undefined) | null;
|
|
38
|
+
/**
|
|
39
|
+
* React Native's AccessibilityInfo, or null outside a native runtime. Read
|
|
40
|
+
* for the Reduce Transparency and Reduce Motion preferences.
|
|
41
|
+
*/
|
|
42
|
+
AccessibilityInfo: any;
|
|
43
|
+
/** React Native's Vibration, or null outside a native runtime. */
|
|
44
|
+
Vibration: any;
|
|
45
|
+
/**
|
|
46
|
+
* React Native's useWindowDimensions, or a fixed reader off-device. Snap
|
|
47
|
+
* points are fractions of the window, so the sheet needs the height before
|
|
48
|
+
* it can resolve them.
|
|
49
|
+
*/
|
|
50
|
+
useWindowDimensions: () => {
|
|
51
|
+
width: number;
|
|
52
|
+
height: number;
|
|
53
|
+
};
|
|
31
54
|
}
|
|
32
55
|
/**
|
|
33
56
|
* Records an element's width for gesture maths when the environment has no
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface GlassRimProps {
|
|
2
|
+
/** The surface's corner radius, so the rim follows the shape. */
|
|
3
|
+
radius: number;
|
|
4
|
+
/** Alpha of the brightest (top) part of the rim. */
|
|
5
|
+
rim: number;
|
|
6
|
+
/** Alpha of the highlight inside the top edge. */
|
|
7
|
+
highlight: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The rim light and top highlight of one surface.
|
|
11
|
+
*
|
|
12
|
+
* Both are stacked stops of a vertical gradient in the same colour: the eye
|
|
13
|
+
* reads the brightest edge as a lit curve and the falloff as the curve turning
|
|
14
|
+
* away from the light.
|
|
15
|
+
*/
|
|
16
|
+
export declare function GlassRim({ radius, rim, highlight }: GlassRimProps): import("react").JSX.Element;
|
|
@@ -3,6 +3,7 @@ export declare const radii: {
|
|
|
3
3
|
md: 14;
|
|
4
4
|
lg: 20;
|
|
5
5
|
xl: 28;
|
|
6
|
+
stack: 26;
|
|
6
7
|
pill: 9999;
|
|
7
8
|
};
|
|
8
9
|
export declare const springs: {
|
|
@@ -55,6 +56,40 @@ export declare const typeScale: {
|
|
|
55
56
|
fontWeight: "400";
|
|
56
57
|
};
|
|
57
58
|
};
|
|
59
|
+
/**
|
|
60
|
+
* The default colour palette for ColorPicker.
|
|
61
|
+
*
|
|
62
|
+
* A palette is data, not a theme colour — it is the same twelve hues in light
|
|
63
|
+
* and dark — so it lives here rather than in either theme. Keeping it in the
|
|
64
|
+
* token module is also what lets the conformance guard require that component
|
|
65
|
+
* code contains no colour literal at all.
|
|
66
|
+
*/
|
|
67
|
+
export declare const palette: {
|
|
68
|
+
default: string[];
|
|
69
|
+
/** The colour a picker starts on when the caller gives none. */
|
|
70
|
+
fallback: string;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Control sizes in points, for components whose dimension is not a radius.
|
|
74
|
+
*
|
|
75
|
+
* Rating's stars are the reason this exists: a star has a size and the size
|
|
76
|
+
* must come from the scale rather than from a literal in the component.
|
|
77
|
+
*/
|
|
78
|
+
export declare const controlSizes: {
|
|
79
|
+
star: {
|
|
80
|
+
sm: number;
|
|
81
|
+
md: number;
|
|
82
|
+
lg: number;
|
|
83
|
+
};
|
|
84
|
+
swatch: {
|
|
85
|
+
sm: number;
|
|
86
|
+
md: number;
|
|
87
|
+
lg: number;
|
|
88
|
+
};
|
|
89
|
+
picker: {
|
|
90
|
+
track: number;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
58
93
|
/**
|
|
59
94
|
* Theme colours in the form React Native accepts.
|
|
60
95
|
*
|
|
@@ -69,6 +104,12 @@ export declare const colors: {
|
|
|
69
104
|
muted: string;
|
|
70
105
|
glass: string;
|
|
71
106
|
glassActive: string;
|
|
107
|
+
/**
|
|
108
|
+
* The near-solid surface the web uses where legibility beats translucency:
|
|
109
|
+
* menus and toggle groups. A glass surface underneath text that must be
|
|
110
|
+
* read at a glance is the one place the web deliberately goes opaque-ish.
|
|
111
|
+
*/
|
|
112
|
+
surface: string;
|
|
72
113
|
edge: string;
|
|
73
114
|
separator: string;
|
|
74
115
|
fill: string;
|
|
@@ -79,6 +120,20 @@ export declare const colors: {
|
|
|
79
120
|
scrim: string;
|
|
80
121
|
onTint: string;
|
|
81
122
|
skeleton: string;
|
|
123
|
+
/**
|
|
124
|
+
* The solid colour glass becomes when the user has asked the system to
|
|
125
|
+
* reduce transparency. Apple's rule is that a translucent surface is
|
|
126
|
+
* replaced by an opaque one, not merely tinted differently.
|
|
127
|
+
*/
|
|
128
|
+
glassSolid: string;
|
|
129
|
+
/**
|
|
130
|
+
* Neutral colours used by pickers and fields: the field's own wash, and
|
|
131
|
+
* the far end of a saturation gradient (the point of no saturation).
|
|
132
|
+
*/
|
|
133
|
+
fieldWash: string;
|
|
134
|
+
/** A flat neutral surface: incoming message bubbles, file chips. */
|
|
135
|
+
wash: string;
|
|
136
|
+
neutralTop: string;
|
|
82
137
|
axis: string;
|
|
83
138
|
};
|
|
84
139
|
dark: {
|
|
@@ -86,6 +141,7 @@ export declare const colors: {
|
|
|
86
141
|
muted: string;
|
|
87
142
|
glass: string;
|
|
88
143
|
glassActive: string;
|
|
144
|
+
surface: string;
|
|
89
145
|
edge: string;
|
|
90
146
|
separator: string;
|
|
91
147
|
fill: string;
|
|
@@ -96,11 +152,44 @@ export declare const colors: {
|
|
|
96
152
|
scrim: string;
|
|
97
153
|
onTint: string;
|
|
98
154
|
skeleton: string;
|
|
155
|
+
glassSolid: string;
|
|
156
|
+
fieldWash: string;
|
|
157
|
+
/** A flat neutral surface: incoming message bubbles, file chips. */
|
|
158
|
+
wash: string;
|
|
159
|
+
neutralTop: string;
|
|
99
160
|
axis: string;
|
|
100
161
|
};
|
|
101
162
|
};
|
|
102
163
|
/** Keeps the shared token file honest if a colour is added there first. */
|
|
103
164
|
export type ThemeColors = typeof colors.light;
|
|
165
|
+
/**
|
|
166
|
+
* The values the fallback's material layers are built from.
|
|
167
|
+
*
|
|
168
|
+
* These are the web engine's numbers, not new inventions: the rim shine is the
|
|
169
|
+
* web's `--gl-rim` brightness (0.30 light / 0.13 dark), the top highlight and
|
|
170
|
+
* press glow are the web overlay alphas, and the drop shadow is the web's
|
|
171
|
+
* `0 1px 3px` black 0.06. They live here, next to the colours, so no component
|
|
172
|
+
* carries a material literal of its own.
|
|
173
|
+
*/
|
|
174
|
+
export declare const material: {
|
|
175
|
+
/** Maximum alpha of the painted rim light, per theme (web: shine). */
|
|
176
|
+
rim: {
|
|
177
|
+
light: number;
|
|
178
|
+
dark: number;
|
|
179
|
+
};
|
|
180
|
+
/** Alpha of the soft highlight drawn inside the top edge. */
|
|
181
|
+
highlight: number;
|
|
182
|
+
/** Alpha of the radial glow that fades in while a surface is held. */
|
|
183
|
+
glow: number;
|
|
184
|
+
/** Shadow colour; the web drops surfaces by 1px with 6% black in light. */
|
|
185
|
+
shadowColor: string;
|
|
186
|
+
shadowOpacity: {
|
|
187
|
+
light: number;
|
|
188
|
+
dark: number;
|
|
189
|
+
};
|
|
190
|
+
/** The colour the rim light and the top highlight are painted in. */
|
|
191
|
+
rimColor: string;
|
|
192
|
+
};
|
|
104
193
|
/** The semantic tone of a feedback component (Banner, Toast). */
|
|
105
194
|
export type Tone = "info" | "success" | "warning" | "error";
|
|
106
195
|
/** Resolves a tone to its theme colour. */
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "glacia-native",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Liquid Glass UI components for React Native — real iOS 26 glass, with a clean fallback on Android and older iOS.",
|
|
5
|
+
"author": "Binyam Feyissa (https://github.com/binyamfeyissa)",
|
|
5
6
|
"license": "MIT",
|
|
6
7
|
"repository": {
|
|
7
8
|
"type": "git",
|
|
@@ -24,10 +25,12 @@
|
|
|
24
25
|
"@callstack/liquid-glass": ">=0.7.0",
|
|
25
26
|
"react": ">=18",
|
|
26
27
|
"react-native": ">=0.80",
|
|
27
|
-
"react-native-svg": ">=13"
|
|
28
|
+
"react-native-svg": ">=13",
|
|
29
|
+
"expo-blur": ">=12",
|
|
30
|
+
"@react-native-community/blur": ">=4"
|
|
28
31
|
},
|
|
29
32
|
"dependencies": {
|
|
30
|
-
"glacia-tokens": "0.5.
|
|
33
|
+
"glacia-tokens": "0.5.2"
|
|
31
34
|
},
|
|
32
35
|
"devDependencies": {
|
|
33
36
|
"@testing-library/react": "^16.3.3",
|
|
@@ -41,6 +44,12 @@
|
|
|
41
44
|
"peerDependenciesMeta": {
|
|
42
45
|
"react-native-svg": {
|
|
43
46
|
"optional": true
|
|
47
|
+
},
|
|
48
|
+
"expo-blur": {
|
|
49
|
+
"optional": true
|
|
50
|
+
},
|
|
51
|
+
"@react-native-community/blur": {
|
|
52
|
+
"optional": true
|
|
44
53
|
}
|
|
45
54
|
},
|
|
46
55
|
"scripts": {
|