@xaui/native 0.9.1-alpha.1 → 0.9.1-alpha.3
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/{chunk-PBVPOX7D.js → chunk-2KXQATVL.js} +3 -27
- package/dist/{chunk-M7P46XKI.cjs → chunk-3QBT3Q65.cjs} +27 -2
- package/dist/{chunk-NHPQQQ7P.cjs → chunk-AW63PTQ4.cjs} +33 -57
- package/dist/chunk-QAMNNTGM.js +637 -0
- package/dist/chunk-V63JO65F.cjs +637 -0
- package/dist/{chunk-RBNCR5KB.js → chunk-X2K2FX3W.js} +25 -0
- package/dist/index.cjs +36 -4
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +40 -8
- package/dist/system/index.cjs +35 -3
- package/dist/system/index.d.cts +273 -3
- package/dist/system/index.d.ts +273 -3
- package/dist/system/index.js +36 -4
- package/dist/theme/index.cjs +3 -3
- package/dist/theme/index.d.cts +3 -2
- package/dist/theme/index.d.ts +3 -2
- package/dist/theme/index.js +6 -6
- package/dist/{theme.type-B3ODSLbB.d.cts → theme.type-C9bFJKFm.d.cts} +7 -1
- package/dist/{theme.type-B3ODSLbB.d.ts → theme.type-C9bFJKFm.d.ts} +7 -1
- package/package.json +1 -1
- package/dist/chunk-KFCORXWW.cjs +0 -150
- package/dist/chunk-N357EQCZ.js +0 -150
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var _chunkKFCORXWWcjs = require('./chunk-KFCORXWW.cjs');
|
|
4
3
|
|
|
5
4
|
|
|
6
5
|
|
|
@@ -16,10 +15,9 @@ var _chunkKFCORXWWcjs = require('./chunk-KFCORXWW.cjs');
|
|
|
16
15
|
|
|
17
16
|
|
|
18
17
|
|
|
19
|
-
var _chunkNHPQQQ7Pcjs = require('./chunk-NHPQQQ7P.cjs');
|
|
20
18
|
|
|
19
|
+
var _chunkV63JO65Fcjs = require('./chunk-V63JO65F.cjs');
|
|
21
20
|
|
|
22
|
-
var _chunkM7P46XKIcjs = require('./chunk-M7P46XKI.cjs');
|
|
23
21
|
|
|
24
22
|
|
|
25
23
|
|
|
@@ -30,11 +28,45 @@ var _chunkM7P46XKIcjs = require('./chunk-M7P46XKI.cjs');
|
|
|
30
28
|
|
|
31
29
|
|
|
32
30
|
|
|
31
|
+
var _chunkAW63PTQ4cjs = require('./chunk-AW63PTQ4.cjs');
|
|
33
32
|
|
|
34
33
|
|
|
35
34
|
|
|
36
35
|
|
|
37
36
|
|
|
38
37
|
|
|
38
|
+
var _chunk3QBT3Q65cjs = require('./chunk-3QBT3Q65.cjs');
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
exports.HIGHLIGHT_OPACITY = _chunkV63JO65Fcjs.HIGHLIGHT_OPACITY; exports.PRESS_DURATION = _chunkV63JO65Fcjs.PRESS_DURATION; exports.PRESS_SCALE = _chunkV63JO65Fcjs.PRESS_SCALE; exports.PressableFeedback = _chunkV63JO65Fcjs.PressableFeedback; exports.RELEASE_DURATION = _chunkV63JO65Fcjs.RELEASE_DURATION; exports.RIPPLE_COVERAGE = _chunkV63JO65Fcjs.RIPPLE_COVERAGE; exports.RIPPLE_DURATION = _chunkV63JO65Fcjs.RIPPLE_DURATION; exports.RIPPLE_OPACITY = _chunkV63JO65Fcjs.RIPPLE_OPACITY; exports.Slot = _chunkV63JO65Fcjs.Slot; exports.ThemeContext = _chunk3QBT3Q65cjs.ThemeContext; exports.XAUIProvider = _chunkAW63PTQ4cjs.XAUIProvider; exports.buildRadius = _chunkAW63PTQ4cjs.buildRadius; exports.buildShadows = _chunkAW63PTQ4cjs.buildShadows; exports.childrenToString = _chunkV63JO65Fcjs.childrenToString; exports.createRecipe = _chunkV63JO65Fcjs.createRecipe; exports.createSlotContext = _chunkV63JO65Fcjs.createSlotContext; exports.createTheme = _chunkAW63PTQ4cjs.createTheme; exports.defaultTheme = _chunkAW63PTQ4cjs.defaultTheme; exports.deriveColors = _chunkAW63PTQ4cjs.deriveColors; exports.deriveTint = _chunk3QBT3Q65cjs.deriveTint; exports.mergeProps = _chunkV63JO65Fcjs.mergeProps; exports.mergeRefs = _chunkV63JO65Fcjs.mergeRefs; exports.palette = _chunkAW63PTQ4cjs.palette; exports.primitives = _chunkAW63PTQ4cjs.primitives; exports.resolveAnimation = _chunkV63JO65Fcjs.resolveAnimation; exports.resolveSlotAnimation = _chunkV63JO65Fcjs.resolveSlotAnimation; exports.sourceKeys = _chunkAW63PTQ4cjs.sourceKeys; exports.tokens = _chunkAW63PTQ4cjs.tokens; exports.useColorMode = _chunk3QBT3Q65cjs.useColorMode; exports.useFeedback = _chunkV63JO65Fcjs.useFeedback; exports.useThemeColor = _chunk3QBT3Q65cjs.useThemeColor; exports.useXAUITheme = _chunk3QBT3Q65cjs.useXAUITheme;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { Axes, CompoundVariant, Recipe, RecipeConfig, ResolveArgs, ResolvedSelection, ResolvedStyles, Selection, SlotStyle, SlotStyles, StateName, States, StyleFn, TintArgs, VariantColors, VariantRole, VariantTokens, createRecipe } from './system/index.cjs';
|
|
1
|
+
export { AnimationConfig, AnimationProp, AsChildProps, Axes, CompoundVariant, FeedbackContext, FeedbackVariant, HIGHLIGHT_OPACITY, MergeableProps, PRESS_DURATION, PRESS_SCALE, PossibleRef, PressableFeedback, PressableFeedbackHighlightProps, PressableFeedbackProps, PressableFeedbackRippleProps, RELEASE_DURATION, RIPPLE_COVERAGE, RIPPLE_DURATION, RIPPLE_OPACITY, Recipe, RecipeConfig, ResolveArgs, ResolvedAnimation, ResolvedSelection, ResolvedStyles, Selection, Slot, SlotAnimation, SlotProps, SlotStyle, SlotStyles, StateName, States, StyleFn, TintArgs, VariantColors, VariantRole, VariantTokens, childrenToString, createRecipe, createSlotContext, mergeProps, mergeRefs, resolveAnimation, resolveSlotAnimation, useFeedback } from './system/index.cjs';
|
|
2
2
|
export { ColorModePreference, PaletteFamily, PaletteShade, ThemeContext, XAUIProvider, XAUIProviderProps, XAUITint, buildRadius, buildShadows, createTheme, defaultTheme, deriveColors, deriveTint, palette, primitives, sourceKeys, tokens, useColorMode, useThemeColor, useXAUITheme } from './theme/index.cjs';
|
|
3
|
-
export { C as ColorMode, F as FontSizeKey, a as FontWeightKey, R as RadiusKey, S as Size, X as XAUIColors, b as XAUIDerivedColors, c as XAUIPrimitiveColors, d as XAUIRadius, e as XAUIShadow, f as XAUISourceColors, g as XAUITheme, h as XAUIThemeConfig, i as XAUIThemeSet } from './theme.type-
|
|
4
|
-
import 'react-native';
|
|
3
|
+
export { C as ColorMode, F as FontSizeKey, a as FontWeightKey, R as RadiusKey, S as Size, X as XAUIColors, b as XAUIDerivedColors, c as XAUIPrimitiveColors, d as XAUIRadius, e as XAUIShadow, f as XAUISourceColors, g as XAUITheme, h as XAUIThemeConfig, i as XAUIThemeSet } from './theme.type-C9bFJKFm.cjs';
|
|
5
4
|
import 'react';
|
|
5
|
+
import 'react-native';
|
|
6
|
+
import 'react-native-reanimated';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { Axes, CompoundVariant, Recipe, RecipeConfig, ResolveArgs, ResolvedSelection, ResolvedStyles, Selection, SlotStyle, SlotStyles, StateName, States, StyleFn, TintArgs, VariantColors, VariantRole, VariantTokens, createRecipe } from './system/index.js';
|
|
1
|
+
export { AnimationConfig, AnimationProp, AsChildProps, Axes, CompoundVariant, FeedbackContext, FeedbackVariant, HIGHLIGHT_OPACITY, MergeableProps, PRESS_DURATION, PRESS_SCALE, PossibleRef, PressableFeedback, PressableFeedbackHighlightProps, PressableFeedbackProps, PressableFeedbackRippleProps, RELEASE_DURATION, RIPPLE_COVERAGE, RIPPLE_DURATION, RIPPLE_OPACITY, Recipe, RecipeConfig, ResolveArgs, ResolvedAnimation, ResolvedSelection, ResolvedStyles, Selection, Slot, SlotAnimation, SlotProps, SlotStyle, SlotStyles, StateName, States, StyleFn, TintArgs, VariantColors, VariantRole, VariantTokens, childrenToString, createRecipe, createSlotContext, mergeProps, mergeRefs, resolveAnimation, resolveSlotAnimation, useFeedback } from './system/index.js';
|
|
2
2
|
export { ColorModePreference, PaletteFamily, PaletteShade, ThemeContext, XAUIProvider, XAUIProviderProps, XAUITint, buildRadius, buildShadows, createTheme, defaultTheme, deriveColors, deriveTint, palette, primitives, sourceKeys, tokens, useColorMode, useThemeColor, useXAUITheme } from './theme/index.js';
|
|
3
|
-
export { C as ColorMode, F as FontSizeKey, a as FontWeightKey, R as RadiusKey, S as Size, X as XAUIColors, b as XAUIDerivedColors, c as XAUIPrimitiveColors, d as XAUIRadius, e as XAUIShadow, f as XAUISourceColors, g as XAUITheme, h as XAUIThemeConfig, i as XAUIThemeSet } from './theme.type-
|
|
4
|
-
import 'react-native';
|
|
3
|
+
export { C as ColorMode, F as FontSizeKey, a as FontWeightKey, R as RadiusKey, S as Size, X as XAUIColors, b as XAUIDerivedColors, c as XAUIPrimitiveColors, d as XAUIRadius, e as XAUIShadow, f as XAUISourceColors, g as XAUITheme, h as XAUIThemeConfig, i as XAUIThemeSet } from './theme.type-C9bFJKFm.js';
|
|
5
4
|
import 'react';
|
|
5
|
+
import 'react-native';
|
|
6
|
+
import 'react-native-reanimated';
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
HIGHLIGHT_OPACITY,
|
|
3
|
+
PRESS_DURATION,
|
|
4
|
+
PRESS_SCALE,
|
|
5
|
+
PressableFeedback,
|
|
6
|
+
RELEASE_DURATION,
|
|
7
|
+
RIPPLE_COVERAGE,
|
|
8
|
+
RIPPLE_DURATION,
|
|
9
|
+
RIPPLE_OPACITY,
|
|
10
|
+
Slot,
|
|
11
|
+
childrenToString,
|
|
12
|
+
createRecipe,
|
|
13
|
+
createSlotContext,
|
|
14
|
+
mergeProps,
|
|
15
|
+
mergeRefs,
|
|
16
|
+
resolveAnimation,
|
|
17
|
+
resolveSlotAnimation,
|
|
18
|
+
useFeedback
|
|
19
|
+
} from "./chunk-QAMNNTGM.js";
|
|
4
20
|
import {
|
|
5
|
-
ThemeContext,
|
|
6
21
|
XAUIProvider,
|
|
7
22
|
buildRadius,
|
|
8
23
|
buildShadows,
|
|
@@ -12,29 +27,46 @@ import {
|
|
|
12
27
|
palette,
|
|
13
28
|
primitives,
|
|
14
29
|
sourceKeys,
|
|
15
|
-
tokens
|
|
30
|
+
tokens
|
|
31
|
+
} from "./chunk-2KXQATVL.js";
|
|
32
|
+
import {
|
|
33
|
+
ThemeContext,
|
|
34
|
+
deriveTint,
|
|
16
35
|
useColorMode,
|
|
17
36
|
useThemeColor,
|
|
18
37
|
useXAUITheme
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import {
|
|
21
|
-
deriveTint
|
|
22
|
-
} from "./chunk-RBNCR5KB.js";
|
|
38
|
+
} from "./chunk-X2K2FX3W.js";
|
|
23
39
|
export {
|
|
40
|
+
HIGHLIGHT_OPACITY,
|
|
41
|
+
PRESS_DURATION,
|
|
42
|
+
PRESS_SCALE,
|
|
43
|
+
PressableFeedback,
|
|
44
|
+
RELEASE_DURATION,
|
|
45
|
+
RIPPLE_COVERAGE,
|
|
46
|
+
RIPPLE_DURATION,
|
|
47
|
+
RIPPLE_OPACITY,
|
|
48
|
+
Slot,
|
|
24
49
|
ThemeContext,
|
|
25
50
|
XAUIProvider,
|
|
26
51
|
buildRadius,
|
|
27
52
|
buildShadows,
|
|
53
|
+
childrenToString,
|
|
28
54
|
createRecipe,
|
|
55
|
+
createSlotContext,
|
|
29
56
|
createTheme,
|
|
30
57
|
defaultTheme,
|
|
31
58
|
deriveColors,
|
|
32
59
|
deriveTint,
|
|
60
|
+
mergeProps,
|
|
61
|
+
mergeRefs,
|
|
33
62
|
palette,
|
|
34
63
|
primitives,
|
|
64
|
+
resolveAnimation,
|
|
65
|
+
resolveSlotAnimation,
|
|
35
66
|
sourceKeys,
|
|
36
67
|
tokens,
|
|
37
68
|
useColorMode,
|
|
69
|
+
useFeedback,
|
|
38
70
|
useThemeColor,
|
|
39
71
|
useXAUITheme
|
|
40
72
|
};
|
package/dist/system/index.cjs
CHANGED
|
@@ -1,7 +1,39 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var _chunkKFCORXWWcjs = require('../chunk-KFCORXWW.cjs');
|
|
4
|
-
require('../chunk-M7P46XKI.cjs');
|
|
5
3
|
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _chunkV63JO65Fcjs = require('../chunk-V63JO65F.cjs');
|
|
20
|
+
require('../chunk-3QBT3Q65.cjs');
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
exports.HIGHLIGHT_OPACITY = _chunkV63JO65Fcjs.HIGHLIGHT_OPACITY; exports.PRESS_DURATION = _chunkV63JO65Fcjs.PRESS_DURATION; exports.PRESS_SCALE = _chunkV63JO65Fcjs.PRESS_SCALE; exports.PressableFeedback = _chunkV63JO65Fcjs.PressableFeedback; exports.RELEASE_DURATION = _chunkV63JO65Fcjs.RELEASE_DURATION; exports.RIPPLE_COVERAGE = _chunkV63JO65Fcjs.RIPPLE_COVERAGE; exports.RIPPLE_DURATION = _chunkV63JO65Fcjs.RIPPLE_DURATION; exports.RIPPLE_OPACITY = _chunkV63JO65Fcjs.RIPPLE_OPACITY; exports.Slot = _chunkV63JO65Fcjs.Slot; exports.childrenToString = _chunkV63JO65Fcjs.childrenToString; exports.createRecipe = _chunkV63JO65Fcjs.createRecipe; exports.createSlotContext = _chunkV63JO65Fcjs.createSlotContext; exports.mergeProps = _chunkV63JO65Fcjs.mergeProps; exports.mergeRefs = _chunkV63JO65Fcjs.mergeRefs; exports.resolveAnimation = _chunkV63JO65Fcjs.resolveAnimation; exports.resolveSlotAnimation = _chunkV63JO65Fcjs.resolveSlotAnimation; exports.useFeedback = _chunkV63JO65Fcjs.useFeedback;
|
package/dist/system/index.d.cts
CHANGED
|
@@ -1,5 +1,186 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode, Provider, Ref, RefCallback } from 'react';
|
|
3
|
+
import * as react_native from 'react-native';
|
|
4
|
+
import { PressableProps, StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
5
|
+
import { SharedValue } from 'react-native-reanimated';
|
|
6
|
+
import { g as XAUITheme, X as XAUIColors } from '../theme.type-C9bFJKFm.cjs';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* What the root does under the finger. `scale-highlight` and `scale-ripple` mount their
|
|
10
|
+
* overlay themselves; `scale` mounts none, which is what a root picks when it renders its
|
|
11
|
+
* own `<PressableFeedback.Highlight>` to style it (R1: no prop reaches into another
|
|
12
|
+
* component's insides).
|
|
13
|
+
*/
|
|
14
|
+
type FeedbackVariant = 'scale-highlight' | 'scale-ripple' | 'scale' | 'none';
|
|
15
|
+
type AnimationConfig = {
|
|
16
|
+
scale?: boolean;
|
|
17
|
+
highlight?: boolean;
|
|
18
|
+
ripple?: boolean;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* `false` and `'disabled'` turn this component's animations off. `'disable-all'` turns
|
|
22
|
+
* them off for its descendants too — a long list kills every row's worklets with one
|
|
23
|
+
* prop instead of threading it down. An object switches them off one at a time.
|
|
24
|
+
*/
|
|
25
|
+
type AnimationProp = boolean | 'disabled' | 'disable-all' | AnimationConfig;
|
|
26
|
+
/** `animation` once normalised — what the components actually read. */
|
|
27
|
+
type ResolvedAnimation = {
|
|
28
|
+
scale: boolean;
|
|
29
|
+
highlight: boolean;
|
|
30
|
+
ripple: boolean;
|
|
31
|
+
/** True when every sub-animation is off: the branch that mounts no worklet at all. */
|
|
32
|
+
none: boolean;
|
|
33
|
+
/** Propagated to descendants through context. */
|
|
34
|
+
disableAll: boolean;
|
|
35
|
+
};
|
|
36
|
+
type PressableFeedbackProps = Omit<PressableProps, 'style' | 'children' | 'disabled'> & {
|
|
37
|
+
/** Controlled: the root owns the state, because its recipe resolves on it (R5). */
|
|
38
|
+
isPressed?: boolean;
|
|
39
|
+
/** R8: `disabled` is not part of the public vocabulary, `isX` is. */
|
|
40
|
+
isDisabled?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Merge into the single child instead of rendering a pressable (R12) — **keeping the
|
|
43
|
+
* feedback**. Swapping this component out for a bare `Slot` would silently drop the
|
|
44
|
+
* touch feedback of every `asChild` control.
|
|
45
|
+
*/
|
|
46
|
+
asChild?: boolean;
|
|
47
|
+
feedbackVariant?: FeedbackVariant;
|
|
48
|
+
animation?: AnimationProp;
|
|
49
|
+
style?: StyleProp<ViewStyle>;
|
|
50
|
+
/**
|
|
51
|
+
* `Pressable`'s function form is dropped on purpose. It exists to hand the press state
|
|
52
|
+
* to children; here the root above already owns that state and this publishes it
|
|
53
|
+
* through context, so the function form would be a second, quieter source of truth.
|
|
54
|
+
*/
|
|
55
|
+
children?: ReactNode;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* A slot's own animation, overriding the blanket one on the root. `false` switches that
|
|
59
|
+
* slot off; the object tunes it. Deliberately two knobs rather than a full timing
|
|
60
|
+
* surface — anything past this is a different animation, and that is a component's job,
|
|
61
|
+
* not a prop's.
|
|
62
|
+
*/
|
|
63
|
+
type SlotAnimation = boolean | {
|
|
64
|
+
/** Milliseconds. Falls back to the shared press timing. */
|
|
65
|
+
duration?: number;
|
|
66
|
+
/** How far the overlay goes at full press, 0 to 1. */
|
|
67
|
+
opacity?: number;
|
|
68
|
+
};
|
|
69
|
+
type FeedbackContext = {
|
|
70
|
+
isPressed: boolean;
|
|
71
|
+
animation: ResolvedAnimation;
|
|
72
|
+
/** Absent on the static branch, where nothing animates and no worklet is mounted. */
|
|
73
|
+
progress?: SharedValue<number>;
|
|
74
|
+
/**
|
|
75
|
+
* Bumped on every press-in. The ripple starts from this rather than from a `useEffect`
|
|
76
|
+
* on `isPressed`: a one-shot driven by a boolean depends on React re-rendering between
|
|
77
|
+
* the two touch events, and starting it from the event that carries the coordinates is
|
|
78
|
+
* both simpler and impossible to miss.
|
|
79
|
+
*/
|
|
80
|
+
pressCount?: SharedValue<number>;
|
|
81
|
+
/** Where the finger landed, and how big the root is — the ripple needs both. */
|
|
82
|
+
origin?: SharedValue<{
|
|
83
|
+
x: number;
|
|
84
|
+
y: number;
|
|
85
|
+
}>;
|
|
86
|
+
size?: SharedValue<{
|
|
87
|
+
width: number;
|
|
88
|
+
height: number;
|
|
89
|
+
}>;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
type PressableFeedbackHighlightProps = {
|
|
93
|
+
style?: StyleProp<ViewStyle>;
|
|
94
|
+
/** Overrides the blanket `animation` on the root, for this overlay only. */
|
|
95
|
+
animation?: SlotAnimation;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* The press wash: one flat overlay fading in under the finger.
|
|
99
|
+
*
|
|
100
|
+
* It is a **neutral** wash, not the variant's pressed colour. A component picks one or
|
|
101
|
+
* the other — this overlay, or a `pressed` state in its recipe swapping `bg` for
|
|
102
|
+
* `bgPressed` — never both, or a pressed button darkens twice.
|
|
103
|
+
*/
|
|
104
|
+
declare function PressableFeedbackHighlight({ style, animation: override, }: PressableFeedbackHighlightProps): react.JSX.Element;
|
|
105
|
+
declare namespace PressableFeedbackHighlight {
|
|
106
|
+
var displayName: string;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
type PressableFeedbackRippleProps = {
|
|
110
|
+
style?: StyleProp<ViewStyle>;
|
|
111
|
+
/** Overrides the blanket `animation` on the root, for this overlay only. */
|
|
112
|
+
animation?: SlotAnimation;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* A circle washing outwards from where the finger landed.
|
|
116
|
+
*
|
|
117
|
+
* It is a **one-shot, independent of how long the press lasts**: the wave runs its course
|
|
118
|
+
* and ends, the way a ripple in water does. Tying it to the press would leave a disc
|
|
119
|
+
* parked on the control for as long as a finger rests there.
|
|
120
|
+
*
|
|
121
|
+
* It needs the root to clip — `PressableFeedback` sets `overflow: 'hidden'` when it
|
|
122
|
+
* mounts one — and it renders nothing on the static branch: a ripple that cannot expand
|
|
123
|
+
* is a coloured disc sitting on the control, which reads as a defect rather than as
|
|
124
|
+
* reduced motion.
|
|
125
|
+
*/
|
|
126
|
+
declare function PressableFeedbackRipple({ style, animation: override, }: PressableFeedbackRippleProps): react.JSX.Element | null;
|
|
127
|
+
declare namespace PressableFeedbackRipple {
|
|
128
|
+
var displayName: string;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
declare const useFeedback: () => FeedbackContext;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* The values the v0 tree shipped with (`Animated.spring` to `0.975`, `bounciness: 0`,
|
|
135
|
+
* over roughly 100ms). Kept identical on purpose: the touch feedback is the part of a
|
|
136
|
+
* library users feel rather than read, and changing its timing in a rewrite would be a
|
|
137
|
+
* regression nobody asked for. `bounciness: 0` is why a duration replaces the spring —
|
|
138
|
+
* a spring with no bounce is a curve.
|
|
139
|
+
*/
|
|
140
|
+
declare const PRESS_SCALE = 0.975;
|
|
141
|
+
declare const PRESS_DURATION = 100;
|
|
142
|
+
declare const RELEASE_DURATION = 150;
|
|
143
|
+
/** How far the wash and the ripple go at full press. */
|
|
144
|
+
declare const HIGHLIGHT_OPACITY = 0.08;
|
|
145
|
+
declare const RIPPLE_OPACITY = 0.12;
|
|
146
|
+
declare const RIPPLE_DURATION = 350;
|
|
147
|
+
/**
|
|
148
|
+
* The circle's radius as a multiple of the control's diagonal. Above 1 it covers from
|
|
149
|
+
* any point on the control, so where the finger landed never enters the calculation.
|
|
150
|
+
*/
|
|
151
|
+
declare const RIPPLE_COVERAGE = 1.25;
|
|
152
|
+
/**
|
|
153
|
+
* One shape out of four accepted ones, so the components read a record instead of
|
|
154
|
+
* re-deciding what `'disable-all'` meant.
|
|
155
|
+
*
|
|
156
|
+
* `inheritedDisableAll` comes from an ancestor that asked for it, and it wins: a list
|
|
157
|
+
* that switched its rows' animations off cannot be overridden by a row.
|
|
158
|
+
*/
|
|
159
|
+
declare function resolveAnimation(animation: AnimationProp | undefined, inheritedDisableAll?: boolean): ResolvedAnimation;
|
|
160
|
+
type ResolvedSlotAnimation = {
|
|
161
|
+
enabled: boolean;
|
|
162
|
+
duration: number;
|
|
163
|
+
opacity: number;
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* A slot's own `animation` over the root's blanket one, with the root winning when it
|
|
167
|
+
* switched everything off — `animation="disable-all"` on an ancestor cannot be undone by
|
|
168
|
+
* an overlay that asks nicely.
|
|
169
|
+
*/
|
|
170
|
+
declare function resolveSlotAnimation(override: SlotAnimation | undefined, enabledByRoot: boolean, defaultOpacity: number, defaultDuration?: number): ResolvedSlotAnimation;
|
|
171
|
+
|
|
172
|
+
declare const PressableFeedback: react.ForwardRefExoticComponent<Omit<react_native.PressableProps, "disabled" | "style" | "children"> & {
|
|
173
|
+
isPressed?: boolean;
|
|
174
|
+
isDisabled?: boolean;
|
|
175
|
+
asChild?: boolean;
|
|
176
|
+
feedbackVariant?: FeedbackVariant;
|
|
177
|
+
animation?: AnimationProp;
|
|
178
|
+
style?: react_native.StyleProp<react_native.ViewStyle>;
|
|
179
|
+
children?: react.ReactNode;
|
|
180
|
+
} & react.RefAttributes<react_native.View>> & {
|
|
181
|
+
Highlight: typeof PressableFeedbackHighlight;
|
|
182
|
+
Ripple: typeof PressableFeedbackRipple;
|
|
183
|
+
};
|
|
3
184
|
|
|
4
185
|
/**
|
|
5
186
|
* A slot is a view or a text node, and a recipe writes one object per slot, so the two
|
|
@@ -80,4 +261,93 @@ type Recipe<Slot extends string, Variant extends string, A extends Axes<Slot>> =
|
|
|
80
261
|
*/
|
|
81
262
|
declare function createRecipe<Slot extends string, Variant extends string, const A extends Axes<Slot>>(config: RecipeConfig<Slot, Variant, A>): Recipe<Slot, Variant, A>;
|
|
82
263
|
|
|
83
|
-
|
|
264
|
+
/**
|
|
265
|
+
* R3: the string a root should wrap in its default text slot, or `null` when it should
|
|
266
|
+
* render its children as they are.
|
|
267
|
+
*
|
|
268
|
+
* The whole tree is stringified recursively rather than the first child inspected. That
|
|
269
|
+
* is what makes `<Button>{count} items</Button>` work — children there are the array
|
|
270
|
+
* `[3, ' items']`, and an `isValidElement` check on the first entry would call it an
|
|
271
|
+
* element-free tree only by accident, while a check for "is the first child a string"
|
|
272
|
+
* would miss it outright.
|
|
273
|
+
*
|
|
274
|
+
* `null` for an empty result as much as for a tree containing an element: in both cases
|
|
275
|
+
* there is nothing to wrap, and a root's fallback — render the children — is right for
|
|
276
|
+
* both. It also keeps `<Button>{false}</Button>` from mounting an empty text node.
|
|
277
|
+
*/
|
|
278
|
+
declare function childrenToString(children: ReactNode): string | null;
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* A context a slot cannot read by accident. Every compound gets one, and it carries
|
|
282
|
+
* **resolved** values — style references the root already computed, not tokens for the
|
|
283
|
+
* slot to resolve again (R5).
|
|
284
|
+
*
|
|
285
|
+
* ```ts
|
|
286
|
+
* const [ButtonProvider, useButton] = createSlotContext<ButtonContext>('Button')
|
|
287
|
+
* ```
|
|
288
|
+
*
|
|
289
|
+
* The tuple is what lets each compound name its own hook, which R10 requires it to
|
|
290
|
+
* export. `name` gives both halves of the error, so there is one place to spell it.
|
|
291
|
+
*/
|
|
292
|
+
declare function createSlotContext<T>(name: string): readonly [Provider<T | null>, () => T];
|
|
293
|
+
|
|
294
|
+
/** Anything React accepts as a ref, plus the absence of one. */
|
|
295
|
+
type PossibleRef<T> = Ref<T> | undefined;
|
|
296
|
+
/**
|
|
297
|
+
* The props `mergeProps` knows how to combine. Deliberately loose: it merges whatever a
|
|
298
|
+
* root hands to whatever child it was given, and neither side is knowable from here.
|
|
299
|
+
*/
|
|
300
|
+
type MergeableProps = Record<string, unknown>;
|
|
301
|
+
type AsChildProps = {
|
|
302
|
+
/**
|
|
303
|
+
* Merge this component's props into its single child instead of rendering an element
|
|
304
|
+
* of its own — a navigation `Link` as a `Button`, a bespoke trigger as a `Select`.
|
|
305
|
+
*/
|
|
306
|
+
asChild?: boolean;
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Merges a root's own props into the child it renders through `asChild` (R12). Four
|
|
311
|
+
* rules, and the child wins wherever they do not apply — it is the more specific intent:
|
|
312
|
+
*
|
|
313
|
+
* - **Event handlers compose.** Both run, ours first: the component's own behaviour (the
|
|
314
|
+
* press state that drives its styles) happens before the child's side effect (the
|
|
315
|
+
* navigation). Replacing one with the other is the bug this exists to prevent.
|
|
316
|
+
* - **Styles stack**, ours under the child's, so the child can override.
|
|
317
|
+
* - **`ref`s merge** through `mergeRefs`. React 19 passes `ref` as an ordinary prop, so
|
|
318
|
+
* it arrives here rather than beside the props, and dropping it would sever the root's
|
|
319
|
+
* handle on the node.
|
|
320
|
+
* - **Everything else: the child's value wins**, and ours fills in what it left unset.
|
|
321
|
+
*/
|
|
322
|
+
declare function mergeProps(ours: MergeableProps, theirs: MergeableProps): MergeableProps;
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* One callback that feeds several refs — what lets a root keep its own handle on a node
|
|
326
|
+
* while still honouring the ref its caller passed (R9), and what `asChild` needs to
|
|
327
|
+
* forward a ref into the child it merges into (R12).
|
|
328
|
+
*
|
|
329
|
+
* It returns nothing on purpose. React 19 reads a ref callback's return value as a
|
|
330
|
+
* cleanup function while React 18 ignores it, and this package supports both; letting
|
|
331
|
+
* a merged cleanup through would behave differently on each. React calls every ref with
|
|
332
|
+
* `null` on unmount anyway, which this forwards.
|
|
333
|
+
*/
|
|
334
|
+
declare function mergeRefs<T>(...refs: Array<PossibleRef<T>>): RefCallback<T>;
|
|
335
|
+
|
|
336
|
+
type SlotProps = MergeableProps & {
|
|
337
|
+
children?: ReactNode;
|
|
338
|
+
};
|
|
339
|
+
/**
|
|
340
|
+
* The render branch behind `asChild` (R12). A root picks it instead of its own element:
|
|
341
|
+
*
|
|
342
|
+
* ```tsx
|
|
343
|
+
* const Root = asChild ? Slot : Pressable
|
|
344
|
+
* return <Root ref={ref} {...rootProps}>{children}</Root>
|
|
345
|
+
* ```
|
|
346
|
+
*
|
|
347
|
+
* One line per root, which is the point — forty-seven roots each hand-rolling a
|
|
348
|
+
* `cloneElement` and a ref merge would drift, and R12 has to hold uniformly from the
|
|
349
|
+
* first component or the ref signature of the whole core changes later.
|
|
350
|
+
*/
|
|
351
|
+
declare const Slot: react.ForwardRefExoticComponent<Omit<SlotProps, "ref"> & react.RefAttributes<unknown>>;
|
|
352
|
+
|
|
353
|
+
export { type AnimationConfig, type AnimationProp, type AsChildProps, type Axes, type CompoundVariant, type FeedbackContext, type FeedbackVariant, HIGHLIGHT_OPACITY, type MergeableProps, PRESS_DURATION, PRESS_SCALE, type PossibleRef, PressableFeedback, type PressableFeedbackHighlightProps, type PressableFeedbackProps, type PressableFeedbackRippleProps, RELEASE_DURATION, RIPPLE_COVERAGE, RIPPLE_DURATION, RIPPLE_OPACITY, type Recipe, type RecipeConfig, type ResolveArgs, type ResolvedAnimation, type ResolvedSelection, type ResolvedStyles, type Selection, Slot, type SlotAnimation, type SlotProps, type SlotStyle, type SlotStyles, type StateName, type States, type StyleFn, type TintArgs, type VariantColors, type VariantRole, type VariantTokens, childrenToString, createRecipe, createSlotContext, mergeProps, mergeRefs, resolveAnimation, resolveSlotAnimation, useFeedback };
|