@xaui/native 0.9.1-alpha.2 → 0.9.1-alpha.21
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-2WMVDMFV.cjs +62 -0
- package/dist/chunk-33QILJJH.cjs +143 -0
- package/dist/chunk-4NE3SLTM.cjs +695 -0
- package/dist/{chunk-M7P46XKI.cjs → chunk-57SJ4LJF.cjs} +33 -3
- package/dist/chunk-5LC6KVL3.cjs +68 -0
- package/dist/{chunk-RBNCR5KB.js → chunk-A3EGFI6T.js} +31 -1
- package/dist/chunk-APCBIHLR.cjs +507 -0
- package/dist/chunk-BPBY7ON7.cjs +451 -0
- package/dist/chunk-EVXZGNPA.cjs +303 -0
- package/dist/chunk-EXX6ATAS.js +303 -0
- package/dist/chunk-GGW42MY4.js +20 -0
- package/dist/chunk-IBRVMLUF.js +668 -0
- package/dist/chunk-ISVUXVFL.js +471 -0
- package/dist/chunk-JL27KVRT.js +68 -0
- package/dist/chunk-JXLRHKCQ.js +143 -0
- package/dist/chunk-MC7SY2QH.cjs +20 -0
- package/dist/{chunk-RCP3SD26.js → chunk-N7C4UNUL.js} +2 -126
- package/dist/chunk-RMLFMRWL.js +102 -0
- package/dist/chunk-RRRGLRRP.cjs +28 -0
- package/dist/chunk-SGHP76GU.js +28 -0
- package/dist/{chunk-PBVPOX7D.js → chunk-TUJBDS5M.js} +30 -63
- package/dist/chunk-UBA6AEY6.cjs +102 -0
- package/dist/{chunk-NHPQQQ7P.cjs → chunk-UL263KGM.cjs} +56 -89
- package/dist/{chunk-B755PRVJ.cjs → chunk-UVO4GFSW.cjs} +3 -127
- package/dist/chunk-XHZBXYVU.js +62 -0
- package/dist/chunk-YRCUALUQ.js +451 -0
- package/dist/components/button/index.cjs +17 -0
- package/dist/components/button/index.d.cts +659 -0
- package/dist/components/button/index.d.ts +659 -0
- package/dist/components/button/index.js +17 -0
- package/dist/components/card/index.cjs +20 -0
- package/dist/components/card/index.d.cts +620 -0
- package/dist/components/card/index.d.ts +620 -0
- package/dist/components/card/index.js +20 -0
- package/dist/components/typography/index.cjs +14 -0
- package/dist/components/typography/index.d.cts +116 -0
- package/dist/components/typography/index.d.ts +116 -0
- package/dist/components/typography/index.js +14 -0
- package/dist/components/view/index.cjs +16 -0
- package/dist/components/view/index.d.cts +152 -0
- package/dist/components/view/index.d.ts +152 -0
- package/dist/components/view/index.js +16 -0
- package/dist/create-recipe-CC3NNCqF.d.ts +94 -0
- package/dist/create-recipe-CPBFg7ym.d.cts +94 -0
- package/dist/icon.type-BkcEPJbK.d.ts +73 -0
- package/dist/icon.type-Cs1tMX0W.d.cts +73 -0
- package/dist/index.cjs +167 -5
- package/dist/index.d.cts +79 -4
- package/dist/index.d.ts +79 -4
- package/dist/index.js +171 -9
- package/dist/pressable-feedback.type-DsvWZXWC.d.ts +127 -0
- package/dist/pressable-feedback.type-wfeiJz5m.d.cts +127 -0
- package/dist/style-props.type-B1BG5TCm.d.cts +31 -0
- package/dist/style-props.type-B1BG5TCm.d.ts +31 -0
- package/dist/system/index.cjs +66 -3
- package/dist/system/index.d.cts +301 -75
- package/dist/system/index.d.ts +301 -75
- package/dist/system/index.js +68 -5
- package/dist/theme/index.cjs +4 -3
- package/dist/theme/index.d.cts +27 -15
- package/dist/theme/index.d.ts +27 -15
- package/dist/theme/index.js +7 -6
- package/dist/{theme.type-B3ODSLbB.d.cts → theme.type-C2gNHpEx.d.cts} +8 -2
- package/dist/{theme.type-B3ODSLbB.d.ts → theme.type-C2gNHpEx.d.ts} +8 -2
- package/package.json +74 -18
package/dist/system/index.d.ts
CHANGED
|
@@ -1,86 +1,123 @@
|
|
|
1
|
-
import { g as XAUITheme, X as XAUIColors } from '../theme.type-B3ODSLbB.js';
|
|
2
|
-
import { ViewStyle, TextStyle } from 'react-native';
|
|
3
1
|
import * as react from 'react';
|
|
4
2
|
import { ReactNode, Provider, Ref, RefCallback } from 'react';
|
|
3
|
+
import { b as IconProps, a as IconContextValue } from '../icon.type-BkcEPJbK.js';
|
|
4
|
+
export { I as IconComponentProps } from '../icon.type-BkcEPJbK.js';
|
|
5
|
+
import { V as ViewStyleProps } from '../style-props.type-B1BG5TCm.js';
|
|
6
|
+
export { D as DirectionalStyleKey, I as ImageStyleProps, S as StyleProps, T as TextStyleProps } from '../style-props.type-B1BG5TCm.js';
|
|
7
|
+
import { S as SlotAnimation, F as FeedbackContext, a as AnimationProp, b as ResolvedAnimation } from '../pressable-feedback.type-DsvWZXWC.js';
|
|
8
|
+
export { A as AnimationConfig, P as PressableFeedbackProps, R as RadiusStyle, c as RippleWave } from '../pressable-feedback.type-DsvWZXWC.js';
|
|
9
|
+
import * as react_native from 'react-native';
|
|
10
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
11
|
+
export { A as Axes, C as CompoundVariant, R as Recipe, b as RecipeConfig, a as ResolveArgs, d as ResolvedSelection, e as ResolvedStyles, S as Selection, f as SlotStyle, g as SlotStyles, h as StateName, i as States, j as StyleFn, T as TintArgs, V as VariantColors, k as VariantRole, l as VariantTokens, c as createRecipe } from '../create-recipe-CC3NNCqF.js';
|
|
12
|
+
import 'react-native-reanimated';
|
|
13
|
+
import '../theme.type-C2gNHpEx.js';
|
|
5
14
|
|
|
6
15
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
16
|
+
* The runtime half of R14. The type half lives in `system/style-props/`, and the two are
|
|
17
|
+
* pinned to each other by a compile-time check there: a React Native upgrade that adds or
|
|
18
|
+
* removes a style key fails `type-check` with the key's name rather than drifting.
|
|
19
|
+
*
|
|
20
|
+
* One set for the three style types rather than one per node. A caller cannot write
|
|
21
|
+
* `fontSize` on a view slot — that slot's props are typed `ViewStyleProps` — so the split
|
|
22
|
+
* never has to know which node it runs for, and every component shares one table.
|
|
23
|
+
*/
|
|
24
|
+
declare const STYLE_PROP_KEYS: readonly ["alignContent", "alignItems", "alignSelf", "aspectRatio", "boxSizing", "columnGap", "direction", "display", "flex", "flexBasis", "flexDirection", "flexGrow", "flexShrink", "flexWrap", "gap", "justifyContent", "overflow", "rowGap", "bottom", "end", "inset", "insetBlock", "insetBlockEnd", "insetBlockStart", "insetInline", "insetInlineEnd", "insetInlineStart", "position", "start", "top", "zIndex", "margin", "marginBlock", "marginBlockEnd", "marginBlockStart", "marginBottom", "marginEnd", "marginHorizontal", "marginInline", "marginInlineEnd", "marginInlineStart", "marginStart", "marginTop", "marginVertical", "padding", "paddingBlock", "paddingBlockEnd", "paddingBlockStart", "paddingBottom", "paddingEnd", "paddingHorizontal", "paddingInline", "paddingInlineEnd", "paddingInlineStart", "paddingStart", "paddingTop", "paddingVertical", "height", "maxHeight", "maxWidth", "minHeight", "minWidth", "width", "borderBlockColor", "borderBlockEndColor", "borderBlockStartColor", "borderBottomColor", "borderBottomEndRadius", "borderBottomStartRadius", "borderBottomWidth", "borderColor", "borderCurve", "borderEndColor", "borderEndEndRadius", "borderEndStartRadius", "borderEndWidth", "borderRadius", "borderStartColor", "borderStartEndRadius", "borderStartStartRadius", "borderStartWidth", "borderStyle", "borderTopColor", "borderTopEndRadius", "borderTopStartRadius", "borderTopWidth", "borderWidth", "backfaceVisibility", "backgroundColor", "boxShadow", "cursor", "elevation", "experimental_backgroundImage", "filter", "isolation", "mixBlendMode", "opacity", "outlineColor", "outlineOffset", "outlineStyle", "outlineWidth", "shadowColor", "shadowOffset", "shadowOpacity", "shadowRadius", "rotation", "scaleX", "scaleY", "transform", "transformMatrix", "transformOrigin", "translateX", "translateY", "color", "fontFamily", "fontSize", "fontStyle", "fontVariant", "fontWeight", "includeFontPadding", "letterSpacing", "lineHeight", "textAlign", "textAlignVertical", "textDecorationColor", "textDecorationLine", "textDecorationStyle", "textShadowColor", "textShadowOffset", "textShadowRadius", "textTransform", "userSelect", "verticalAlign", "writingDirection", "objectFit", "overlayColor", "resizeMode", "tintColor"];
|
|
25
|
+
type StylePropKey = (typeof STYLE_PROP_KEYS)[number];
|
|
26
|
+
/** What `splitStyleProps` takes out of a props object. */
|
|
27
|
+
type StylePropsOf<P> = Pick<P, Extract<keyof P, StylePropKey>>;
|
|
28
|
+
/** What it leaves in it. */
|
|
29
|
+
type RestPropsOf<P> = Omit<P, StylePropKey>;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* `splitStyleProps`, memoized on the values (R14). A component calls it on what is left
|
|
33
|
+
* after destructuring its own props, applies the style half between the tint and its
|
|
34
|
+
* `style`, and forwards the rest:
|
|
35
|
+
*
|
|
36
|
+
* ```tsx
|
|
37
|
+
* const [styleProps, rest] = useStyleProps(props)
|
|
38
|
+
* <Pressable style={[styles.root, tint, styleProps, style]} {...rest} />
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* The identity is stable while the values are, which is what a memoized child or an
|
|
42
|
+
* animated style depends on. It is keyed on a hash rather than on the object, because the
|
|
43
|
+
* object is a fresh rest-spread on every render and would never hit.
|
|
44
|
+
*/
|
|
45
|
+
declare function useStyleProps<P extends object>(props: P): [StylePropsOf<P>, RestPropsOf<P>];
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The gap nobody else closes: an icon is a third-party component, so a slot context does
|
|
49
|
+
* not reach it and every call site ends up computing the colour by hand.
|
|
50
|
+
*
|
|
51
|
+
* ```tsx
|
|
52
|
+
* <Button variant="danger">
|
|
53
|
+
* <Button.Icon as={TrashIcon} /> {/* colour and size inherited, nothing to pass *\/}
|
|
54
|
+
* <Button.Label>Supprimer</Button.Label>
|
|
55
|
+
* </Button>
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* Three accepted forms — a component through `as`, a raw SVG as children, or an image
|
|
59
|
+
* through `source` — and the resolution is the same for all three: an explicit prop, else
|
|
60
|
+
* what the surrounding slot published, else the theme.
|
|
61
|
+
*
|
|
62
|
+
* The props are taken whole rather than destructured, because they are a union: which
|
|
63
|
+
* keys exist depends on the form, and narrowing is what lets `style` be reachable in the
|
|
64
|
+
* one branch that renders a node and unwritable in the two that do not.
|
|
65
|
+
*/
|
|
66
|
+
declare function Icon(props: IconProps): react.JSX.Element;
|
|
67
|
+
declare namespace Icon {
|
|
68
|
+
var displayName: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Not a `createSlotContext`: that one throws outside its parent, and an `Icon` has to
|
|
73
|
+
* work on its own as much as inside a `Button`. An empty context is the honest default —
|
|
74
|
+
* nothing inherited, so the theme decides.
|
|
75
|
+
*/
|
|
76
|
+
declare const IconContext: react.Context<IconContextValue>;
|
|
77
|
+
declare function useIconContext(): IconContextValue;
|
|
78
|
+
|
|
79
|
+
type PortalProps = {
|
|
80
|
+
children: ReactNode;
|
|
59
81
|
};
|
|
60
|
-
|
|
61
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Renders its children into the nearest `PortalHost` instead of where it sits. What
|
|
84
|
+
* `Dialog`, `Sheet`, `Drawer` and `Snackbar` are built on: an overlay has to escape the
|
|
85
|
+
* clipping and stacking of whatever container happened to hold the trigger.
|
|
86
|
+
*
|
|
87
|
+
* Both halves run in layout effects rather than effects, which is deliberate: the content
|
|
88
|
+
* lands in the same commit as the trigger's, so an overlay neither shows one frame late
|
|
89
|
+
* nor survives one frame past the unmount that closed it. The unpublish sits in its own
|
|
90
|
+
* effect so that it does not depend on `children` — a re-publish then keeps the portal's
|
|
91
|
+
* place in the host's order instead of dropping it and re-adding it at the end.
|
|
92
|
+
*/
|
|
93
|
+
declare function Portal({ children }: PortalProps): null;
|
|
94
|
+
declare namespace Portal {
|
|
95
|
+
var displayName: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
type PortalMethods = {
|
|
99
|
+
addPortal: (key: string, element: ReactNode) => void;
|
|
100
|
+
removePortal: (key: string) => void;
|
|
62
101
|
};
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
102
|
+
/**
|
|
103
|
+
* `null` outside a host, and `Portal` treats that as "render nothing" rather than
|
|
104
|
+
* throwing: an app that forgot `PortalHost` should lose its overlays, not crash on the
|
|
105
|
+
* first `Dialog`.
|
|
106
|
+
*/
|
|
107
|
+
declare const PortalContext: react.Context<PortalMethods | null>;
|
|
108
|
+
|
|
109
|
+
/** R14 — it renders a view of its own, so it takes that view's style keys as props. */
|
|
110
|
+
type PortalHostProps = ViewStyleProps & {
|
|
111
|
+
children: ReactNode;
|
|
72
112
|
};
|
|
73
113
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* an arbitrary `color` is recomputed per render — which is what keeps the cache bounded
|
|
77
|
-
* by the number of token combinations rather than by the palette users invent.
|
|
78
|
-
*
|
|
79
|
-
* const styles = buttonRecipe.resolve({ theme, selection: { variant, size }, states })
|
|
80
|
-
* const tint = color ? buttonRecipe.tint({ theme, color, selection, states }) : undefined
|
|
81
|
-
* <View style={[styles.root, tint?.root, style]} />
|
|
114
|
+
* Where every `Portal` in the tree below renders. Mounted once, at the root of the app,
|
|
115
|
+
* above navigation — an overlay that renders inside a screen is clipped by it.
|
|
82
116
|
*/
|
|
83
|
-
declare function
|
|
117
|
+
declare function PortalHost({ children, ...props }: PortalHostProps): react.JSX.Element;
|
|
118
|
+
declare namespace PortalHost {
|
|
119
|
+
var displayName: string;
|
|
120
|
+
}
|
|
84
121
|
|
|
85
122
|
/**
|
|
86
123
|
* R3: the string a root should wrap in its default text slot, or `null` when it should
|
|
@@ -171,4 +208,193 @@ type SlotProps = MergeableProps & {
|
|
|
171
208
|
*/
|
|
172
209
|
declare const Slot: react.ForwardRefExoticComponent<Omit<SlotProps, "ref"> & react.RefAttributes<unknown>>;
|
|
173
210
|
|
|
174
|
-
|
|
211
|
+
type PressableFeedbackHighlightProps = ViewStyleProps & {
|
|
212
|
+
style?: StyleProp<ViewStyle>;
|
|
213
|
+
animation?: SlotAnimation;
|
|
214
|
+
/**
|
|
215
|
+
* The content the wash sits under. Optional: `<Highlight />` on its own is an overlay
|
|
216
|
+
* among the root's other children, and the root hoists it so order does not matter.
|
|
217
|
+
*/
|
|
218
|
+
children?: ReactNode;
|
|
219
|
+
};
|
|
220
|
+
/**
|
|
221
|
+
* The press wash: one flat overlay fading in under the finger.
|
|
222
|
+
*
|
|
223
|
+
* It is a **neutral** wash, not the variant's pressed colour. A component picks one or
|
|
224
|
+
* the other — this overlay, or a `pressed` state in its recipe swapping `bg` for
|
|
225
|
+
* `bgPressed` — never both, or a pressed button darkens twice.
|
|
226
|
+
*
|
|
227
|
+
* **Wrapping is the readable form**, and it costs nothing:
|
|
228
|
+
*
|
|
229
|
+
* ```tsx
|
|
230
|
+
* <PressableFeedback style={{ flexDirection: 'row', gap: 8 }}>
|
|
231
|
+
* <PressableFeedback.Highlight>
|
|
232
|
+
* <Icon />
|
|
233
|
+
* <Label />
|
|
234
|
+
* </PressableFeedback.Highlight>
|
|
235
|
+
* </PressableFeedback>
|
|
236
|
+
* ```
|
|
237
|
+
*
|
|
238
|
+
* The children are **not** put inside a box. They are returned as siblings of the wash in
|
|
239
|
+
* a fragment, which has no presence in the host tree — so the root's `flexDirection`,
|
|
240
|
+
* `gap` and `alignItems` still reach the icon and the label directly, and the rendered
|
|
241
|
+
* tree is identical to writing the wash as a bare sibling. A real wrapping `View` would
|
|
242
|
+
* have made the root's layout apply to the wrapper instead, and would have added the depth
|
|
243
|
+
* §8 removed.
|
|
244
|
+
*/
|
|
245
|
+
declare function PressableFeedbackHighlight({ style, animation: override, children, ...props }: PressableFeedbackHighlightProps): react.JSX.Element;
|
|
246
|
+
declare namespace PressableFeedbackHighlight {
|
|
247
|
+
var displayName: string;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
type PressableFeedbackRippleProps = ViewStyleProps & {
|
|
251
|
+
/** Applies to the wave itself, not to the container that clips it. */
|
|
252
|
+
style?: StyleProp<ViewStyle>;
|
|
253
|
+
animation?: SlotAnimation;
|
|
254
|
+
/**
|
|
255
|
+
* The content the wave washes under. Optional: `<Ripple />` on its own is an overlay
|
|
256
|
+
* among the root's other children, and the root hoists it so order does not matter.
|
|
257
|
+
*/
|
|
258
|
+
children?: ReactNode;
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
261
|
+
* A circle washing outwards from where the finger landed.
|
|
262
|
+
*
|
|
263
|
+
* **The root drives it, this only draws it.** The root is the touch surface: touches on a
|
|
264
|
+
* component's own children — a button's label — bubble up to the `Pressable`, and never to
|
|
265
|
+
* this overlay, which is their sibling rather than their parent. An overlay owning the
|
|
266
|
+
* handlers works on the padding and does nothing on the text, which is the kind of bug that
|
|
267
|
+
* looks like a rendering problem.
|
|
268
|
+
*
|
|
269
|
+
* Its ink and its corners come from the root, which reads both off its own style — only
|
|
270
|
+
* the root knows what the wave sits on, or what shape it has to stay inside.
|
|
271
|
+
*
|
|
272
|
+
* **Wrapping is the readable form**, and it costs nothing:
|
|
273
|
+
*
|
|
274
|
+
* ```tsx
|
|
275
|
+
* <PressableFeedback style={{ flexDirection: 'row', gap: 8 }}>
|
|
276
|
+
* <PressableFeedback.Ripple>
|
|
277
|
+
* <Icon />
|
|
278
|
+
* <Label />
|
|
279
|
+
* </PressableFeedback.Ripple>
|
|
280
|
+
* </PressableFeedback>
|
|
281
|
+
* ```
|
|
282
|
+
*
|
|
283
|
+
* The children are **not** put inside a box. They come back as siblings of the wave's
|
|
284
|
+
* container in a fragment, which has no presence in the host tree — so the root's
|
|
285
|
+
* `flexDirection`, `gap` and `alignItems` still reach the icon and the label directly, and
|
|
286
|
+
* the rendered tree is identical to writing the wave as a bare sibling. Written on its own,
|
|
287
|
+
* `<Ripple />` is that bare sibling, and the root hoists it so order does not matter.
|
|
288
|
+
*
|
|
289
|
+
* The motion is Material's `InkRipple`, and the parts that matter are the ones that are not
|
|
290
|
+
* obvious: the ink is **independent of the expansion**, the circle **starts at 30%** of its
|
|
291
|
+
* target rather than at a point, the target is **half the diagonal**, and the centre
|
|
292
|
+
* **travels** from the finger to the middle of the control. The constants carry the why.
|
|
293
|
+
*/
|
|
294
|
+
declare function PressableFeedbackRipple({ style, animation: override, children, ...props }: PressableFeedbackRippleProps): react.JSX.Element;
|
|
295
|
+
declare namespace PressableFeedbackRipple {
|
|
296
|
+
var displayName: string;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
declare const useFeedback: () => FeedbackContext;
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* What marks a component as a press overlay.
|
|
303
|
+
*
|
|
304
|
+
* `Symbol.for` rather than a boolean field or an identity check against our own two
|
|
305
|
+
* components: the registry is global, so two copies of `@xaui/native` in one tree still
|
|
306
|
+
* agree on what an overlay is, and a third party writing their own overlay — anything that
|
|
307
|
+
* reads `useFeedback()` and paints under the content — opts into the same treatment
|
|
308
|
+
* instead of being a second-class citizen.
|
|
309
|
+
*/
|
|
310
|
+
declare const FEEDBACK_OVERLAY: unique symbol;
|
|
311
|
+
/** Tags a component so `PressableFeedback` paints it under its content. */
|
|
312
|
+
declare function markOverlay<T extends object>(component: T): T;
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* How far a control shrinks under the finger — **before** the width coefficient below.
|
|
316
|
+
*
|
|
317
|
+
* The v0 tree shrank everything to a flat `0.975`, which is why a wide button read as
|
|
318
|
+
* lurching: a ratio applied to a 360pt row moves nine points, and the same ratio on a
|
|
319
|
+
* 96pt chip moves two. What the eye reads is the displacement, not the ratio.
|
|
320
|
+
*/
|
|
321
|
+
declare const PRESS_SCALE = 0.985;
|
|
322
|
+
declare const PRESS_DURATION = 300;
|
|
323
|
+
/**
|
|
324
|
+
* The width at which `PRESS_SCALE` is applied as written. Wider controls shrink
|
|
325
|
+
* proportionally less, narrower ones more, so the movement stays roughly constant in
|
|
326
|
+
* points across a 96pt chip and a full-width button.
|
|
327
|
+
*/
|
|
328
|
+
declare const SCALE_REFERENCE_WIDTH = 300;
|
|
329
|
+
/** The scale a control of `width` should reach when pressed. */
|
|
330
|
+
declare function pressScaleFor(width: number): number;
|
|
331
|
+
/** How far the wash goes at full press, and how long it takes to get there. */
|
|
332
|
+
declare const HIGHLIGHT_OPACITY = 0.1;
|
|
333
|
+
declare const HIGHLIGHT_DURATION = 200;
|
|
334
|
+
/**
|
|
335
|
+
* The ripple, taken from Material's reference implementation (`InkRipple`) rather than
|
|
336
|
+
* approximated. Four of its numbers are load-bearing and none of them is obvious:
|
|
337
|
+
*
|
|
338
|
+
* - **The opacity is not tied to the expansion.** It reaches full ink in 75ms and stays
|
|
339
|
+
* there while the circle keeps growing. Tying the two — the obvious thing to write —
|
|
340
|
+
* means the ink is faintest exactly when the circle is small enough to be read as a
|
|
341
|
+
* circle, which is why such a ripple looks like nothing at all.
|
|
342
|
+
* - **The circle starts at 30% of its target**, not at a point. A wave from a dot spends
|
|
343
|
+
* its visible life too small to see.
|
|
344
|
+
* - **The target radius is half the diagonal**, which is what covers the box. Larger and
|
|
345
|
+
* the edge leaves the control before the eye catches it, so the effect reads as the
|
|
346
|
+
* surface tinting rather than as something spreading.
|
|
347
|
+
* - **The centre travels** from the finger to the middle of the control as it opens, which
|
|
348
|
+
* is what makes it settle into the control instead of flooding out of a corner.
|
|
349
|
+
*
|
|
350
|
+
* The expansion runs a full second while the finger is down, and finishes in 225ms once it
|
|
351
|
+
* lifts — the wave catches up rather than being cut.
|
|
352
|
+
*/
|
|
353
|
+
declare const RIPPLE_OPACITY = 0.1;
|
|
354
|
+
declare const RIPPLE_START_SCALE = 0.3;
|
|
355
|
+
declare const RIPPLE_EXPAND_DURATION = 1000;
|
|
356
|
+
declare const RIPPLE_CONFIRM_DURATION = 225;
|
|
357
|
+
declare const RIPPLE_FADE_IN = 75;
|
|
358
|
+
declare const RIPPLE_FADE_OUT_DELAY = 225;
|
|
359
|
+
declare const RIPPLE_FADE_OUT = 150;
|
|
360
|
+
/** Half the diagonal covers the box from its centre; the 5 is Material's own overshoot. */
|
|
361
|
+
declare function rippleRadiusFor(width: number, height: number): number;
|
|
362
|
+
/**
|
|
363
|
+
* One shape out of four accepted ones, so the components read a record instead of
|
|
364
|
+
* re-deciding what `'disable-all'` meant.
|
|
365
|
+
*
|
|
366
|
+
* `inheritedDisableAll` comes from an ancestor that asked for it, and it wins: a list
|
|
367
|
+
* that switched its rows' animations off cannot be overridden by a row.
|
|
368
|
+
*/
|
|
369
|
+
declare function resolveAnimation(animation: AnimationProp | undefined, inheritedDisableAll?: boolean): ResolvedAnimation;
|
|
370
|
+
type ResolvedSlotAnimation = {
|
|
371
|
+
enabled: boolean;
|
|
372
|
+
duration: number;
|
|
373
|
+
opacity: number;
|
|
374
|
+
};
|
|
375
|
+
/**
|
|
376
|
+
* A slot's own `animation` over the root's blanket one, with the root winning when it
|
|
377
|
+
* switched everything off — `animation="disable-all"` on an ancestor cannot be undone by
|
|
378
|
+
* an overlay that asks nicely.
|
|
379
|
+
*/
|
|
380
|
+
declare function resolveSlotAnimation(override: SlotAnimation | undefined, enabledByRoot: boolean, defaultOpacity: number, defaultDuration?: number): ResolvedSlotAnimation;
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* The root scales; what else happens under the finger is **composed**, not named by a
|
|
384
|
+
* prop. An overlay a caller can reach is an overlay a caller can place, style and switch
|
|
385
|
+
* off — and it is the only shape that survives `asChild`, where the caller's own element
|
|
386
|
+
* is the pressable and there is no sibling for the primitive to inject.
|
|
387
|
+
*/
|
|
388
|
+
declare const PressableFeedback: react.ForwardRefExoticComponent<Omit<react_native.PressableProps, "style" | "children" | "disabled"> & ViewStyleProps & {
|
|
389
|
+
isPressed?: boolean;
|
|
390
|
+
isDisabled?: boolean;
|
|
391
|
+
asChild?: boolean;
|
|
392
|
+
animation?: AnimationProp;
|
|
393
|
+
style?: react_native.StyleProp<react_native.ViewStyle>;
|
|
394
|
+
children?: react.ReactNode;
|
|
395
|
+
} & react.RefAttributes<react_native.View>> & {
|
|
396
|
+
Highlight: typeof PressableFeedbackHighlight;
|
|
397
|
+
Ripple: typeof PressableFeedbackRipple;
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
export { AnimationProp, type AsChildProps, FEEDBACK_OVERLAY, FeedbackContext, HIGHLIGHT_DURATION, HIGHLIGHT_OPACITY, Icon, IconContext, IconContextValue, IconProps, type MergeableProps, PRESS_DURATION, PRESS_SCALE, Portal, PortalContext, PortalHost, type PortalHostProps, type PortalMethods, type PortalProps, type PossibleRef, PressableFeedback, type PressableFeedbackHighlightProps, type PressableFeedbackRippleProps, RIPPLE_CONFIRM_DURATION, RIPPLE_EXPAND_DURATION, RIPPLE_FADE_IN, RIPPLE_FADE_OUT, RIPPLE_FADE_OUT_DELAY, RIPPLE_OPACITY, RIPPLE_START_SCALE, ResolvedAnimation, SCALE_REFERENCE_WIDTH, Slot, SlotAnimation, type SlotProps, ViewStyleProps, childrenToString, createSlotContext, markOverlay, mergeProps, mergeRefs, pressScaleFor, resolveAnimation, resolveSlotAnimation, rippleRadiusFor, useFeedback, useIconContext, useStyleProps };
|
package/dist/system/index.js
CHANGED
|
@@ -1,17 +1,80 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Portal,
|
|
3
|
+
PortalContext,
|
|
4
|
+
PortalHost
|
|
5
|
+
} from "../chunk-XHZBXYVU.js";
|
|
6
|
+
import {
|
|
7
|
+
Icon,
|
|
8
|
+
IconContext,
|
|
9
|
+
useIconContext
|
|
10
|
+
} from "../chunk-JL27KVRT.js";
|
|
11
|
+
import {
|
|
12
|
+
FEEDBACK_OVERLAY,
|
|
13
|
+
HIGHLIGHT_DURATION,
|
|
14
|
+
HIGHLIGHT_OPACITY,
|
|
15
|
+
PRESS_DURATION,
|
|
16
|
+
PRESS_SCALE,
|
|
17
|
+
PressableFeedback,
|
|
18
|
+
RIPPLE_CONFIRM_DURATION,
|
|
19
|
+
RIPPLE_EXPAND_DURATION,
|
|
20
|
+
RIPPLE_FADE_IN,
|
|
21
|
+
RIPPLE_FADE_OUT,
|
|
22
|
+
RIPPLE_FADE_OUT_DELAY,
|
|
23
|
+
RIPPLE_OPACITY,
|
|
24
|
+
RIPPLE_START_SCALE,
|
|
25
|
+
SCALE_REFERENCE_WIDTH,
|
|
26
|
+
markOverlay,
|
|
27
|
+
pressScaleFor,
|
|
28
|
+
resolveAnimation,
|
|
29
|
+
resolveSlotAnimation,
|
|
30
|
+
rippleRadiusFor,
|
|
31
|
+
useFeedback
|
|
32
|
+
} from "../chunk-IBRVMLUF.js";
|
|
33
|
+
import {
|
|
34
|
+
createRecipe
|
|
35
|
+
} from "../chunk-N7C4UNUL.js";
|
|
1
36
|
import {
|
|
2
37
|
Slot,
|
|
3
38
|
childrenToString,
|
|
4
|
-
createRecipe,
|
|
5
39
|
createSlotContext,
|
|
6
40
|
mergeProps,
|
|
7
|
-
mergeRefs
|
|
8
|
-
|
|
9
|
-
|
|
41
|
+
mergeRefs,
|
|
42
|
+
useStyleProps
|
|
43
|
+
} from "../chunk-EXX6ATAS.js";
|
|
44
|
+
import "../chunk-A3EGFI6T.js";
|
|
45
|
+
import "../chunk-GGW42MY4.js";
|
|
10
46
|
export {
|
|
47
|
+
FEEDBACK_OVERLAY,
|
|
48
|
+
HIGHLIGHT_DURATION,
|
|
49
|
+
HIGHLIGHT_OPACITY,
|
|
50
|
+
Icon,
|
|
51
|
+
IconContext,
|
|
52
|
+
PRESS_DURATION,
|
|
53
|
+
PRESS_SCALE,
|
|
54
|
+
Portal,
|
|
55
|
+
PortalContext,
|
|
56
|
+
PortalHost,
|
|
57
|
+
PressableFeedback,
|
|
58
|
+
RIPPLE_CONFIRM_DURATION,
|
|
59
|
+
RIPPLE_EXPAND_DURATION,
|
|
60
|
+
RIPPLE_FADE_IN,
|
|
61
|
+
RIPPLE_FADE_OUT,
|
|
62
|
+
RIPPLE_FADE_OUT_DELAY,
|
|
63
|
+
RIPPLE_OPACITY,
|
|
64
|
+
RIPPLE_START_SCALE,
|
|
65
|
+
SCALE_REFERENCE_WIDTH,
|
|
11
66
|
Slot,
|
|
12
67
|
childrenToString,
|
|
13
68
|
createRecipe,
|
|
14
69
|
createSlotContext,
|
|
70
|
+
markOverlay,
|
|
15
71
|
mergeProps,
|
|
16
|
-
mergeRefs
|
|
72
|
+
mergeRefs,
|
|
73
|
+
pressScaleFor,
|
|
74
|
+
resolveAnimation,
|
|
75
|
+
resolveSlotAnimation,
|
|
76
|
+
rippleRadiusFor,
|
|
77
|
+
useFeedback,
|
|
78
|
+
useIconContext,
|
|
79
|
+
useStyleProps
|
|
17
80
|
};
|
package/dist/theme/index.cjs
CHANGED
|
@@ -9,14 +9,15 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
var _chunkUL263KGMcjs = require('../chunk-UL263KGM.cjs');
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
var _chunkNHPQQQ7Pcjs = require('../chunk-NHPQQQ7P.cjs');
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunk57SJ4LJFcjs = require('../chunk-57SJ4LJF.cjs');
|
|
20
|
+
require('../chunk-MC7SY2QH.cjs');
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
|
|
@@ -33,4 +34,4 @@ var _chunkM7P46XKIcjs = require('../chunk-M7P46XKI.cjs');
|
|
|
33
34
|
|
|
34
35
|
|
|
35
36
|
|
|
36
|
-
exports.ThemeContext =
|
|
37
|
+
exports.ThemeContext = _chunk57SJ4LJFcjs.ThemeContext; exports.XAUIProvider = _chunkUL263KGMcjs.XAUIProvider; exports.buildRadius = _chunkUL263KGMcjs.buildRadius; exports.buildShadows = _chunkUL263KGMcjs.buildShadows; exports.createTheme = _chunkUL263KGMcjs.createTheme; exports.defaultTheme = _chunkUL263KGMcjs.defaultTheme; exports.deriveColors = _chunkUL263KGMcjs.deriveColors; exports.deriveTint = _chunk57SJ4LJFcjs.deriveTint; exports.palette = _chunkUL263KGMcjs.palette; exports.primitives = _chunkUL263KGMcjs.primitives; exports.sourceKeys = _chunkUL263KGMcjs.sourceKeys; exports.tokens = _chunkUL263KGMcjs.tokens; exports.useColorMode = _chunk57SJ4LJFcjs.useColorMode; exports.useThemeColor = _chunk57SJ4LJFcjs.useThemeColor; exports.useXAUITheme = _chunk57SJ4LJFcjs.useXAUITheme;
|
package/dist/theme/index.d.cts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { i as XAUIThemeSet, h as XAUIThemeConfig,
|
|
4
|
-
export { F as FontSizeKey,
|
|
3
|
+
import { i as XAUIThemeSet, h as XAUIThemeConfig, g as XAUISourceColors, c as XAUIDerivedColors, X as XAUITheme, e as XAUIRadius, C as ColorMode, a as XAUIColors } from '../theme.type-C2gNHpEx.cjs';
|
|
4
|
+
export { F as FontSizeKey, b as FontWeightKey, R as RadiusKey, S as Size, d as XAUIPrimitiveColors, f as XAUIShadow } from '../theme.type-C2gNHpEx.cjs';
|
|
5
|
+
import 'react-native';
|
|
5
6
|
|
|
6
7
|
/** `'system'` follows the device; the resolved value is never `'system'`. */
|
|
7
8
|
type ColorModePreference = 'light' | 'dark' | 'system';
|
|
@@ -43,6 +44,17 @@ declare const defaultTheme: XAUIThemeSet;
|
|
|
43
44
|
* These are HeroUI's `color-mix(in oklab, …)` formulas transposed to JS, because React
|
|
44
45
|
* Native has no `color-mix()`. Their `-hover` names became `-pressed`: what they feed is
|
|
45
46
|
* the press overlay, and the web name was a leftover.
|
|
47
|
+
*
|
|
48
|
+
* **One deliberate divergence: a pressed state always moves towards the mode's ink**
|
|
49
|
+
* (P2-API-REVIEW §E). Mixing towards the variant's own foreground — which is what their
|
|
50
|
+
* formula does — makes the direction follow the fill's lightness rather than a decision:
|
|
51
|
+
* `#9333ea` has near-white text and lightened under the finger in light mode, while
|
|
52
|
+
* `#c084fc` has dark text and darkened in dark mode. Same component, opposite gesture,
|
|
53
|
+
* nobody's choice. Towards `foreground` it is one direction — darker in light, lighter in
|
|
54
|
+
* dark — and the label's contrast rises in both instead of falling in one.
|
|
55
|
+
*
|
|
56
|
+
* The neutral fills already did this: `defaultForeground` and `surfaceForeground` *are*
|
|
57
|
+
* the ink, so only the four saturated intents ever flipped.
|
|
46
58
|
*/
|
|
47
59
|
declare function deriveColors(s: XAUISourceColors): XAUIDerivedColors;
|
|
48
60
|
|
|
@@ -388,7 +400,7 @@ declare const tokens: {
|
|
|
388
400
|
readonly foreground: "#18181b";
|
|
389
401
|
readonly surface: "#ffffff";
|
|
390
402
|
readonly surfaceForeground: "#18181b";
|
|
391
|
-
readonly surfaceSecondary: "#
|
|
403
|
+
readonly surfaceSecondary: "#ececee";
|
|
392
404
|
readonly surfaceSecondaryForeground: "#18181b";
|
|
393
405
|
readonly surfaceTertiary: "#e4e4e7";
|
|
394
406
|
readonly surfaceTertiaryForeground: "#18181b";
|
|
@@ -396,7 +408,7 @@ declare const tokens: {
|
|
|
396
408
|
readonly overlayForeground: "#18181b";
|
|
397
409
|
readonly backdrop: "rgba(0, 0, 0, 0.2)";
|
|
398
410
|
readonly muted: "#71717a";
|
|
399
|
-
readonly default: "#
|
|
411
|
+
readonly default: "#e4e4e7";
|
|
400
412
|
readonly defaultForeground: "#18181b";
|
|
401
413
|
readonly accent: "#9333ea";
|
|
402
414
|
readonly accentForeground: "#faf5ff";
|
|
@@ -416,15 +428,15 @@ declare const tokens: {
|
|
|
416
428
|
readonly separator: "#d4d4d8";
|
|
417
429
|
readonly focus: "#9333ea";
|
|
418
430
|
readonly link: "#18181b";
|
|
419
|
-
readonly accentPressed: "#
|
|
420
|
-
readonly successPressed: "#
|
|
421
|
-
readonly warningPressed: "#
|
|
422
|
-
readonly dangerPressed: "#
|
|
423
|
-
readonly defaultPressed: "#
|
|
431
|
+
readonly accentPressed: "#8533d3";
|
|
432
|
+
readonly successPressed: "#1b753a";
|
|
433
|
+
readonly warningPressed: "#a34d13";
|
|
434
|
+
readonly dangerPressed: "#c72927";
|
|
435
|
+
readonly defaultPressed: "#dbdbde";
|
|
424
436
|
readonly surfacePressed: "#eaeaea";
|
|
425
|
-
readonly defaultSoft: "rgba(
|
|
437
|
+
readonly defaultSoft: "rgba(228, 228, 231, 0.5)";
|
|
426
438
|
readonly defaultSoftForeground: "#18181b";
|
|
427
|
-
readonly defaultSoftPressed: "rgba(
|
|
439
|
+
readonly defaultSoftPressed: "rgba(228, 228, 231, 0.6)";
|
|
428
440
|
readonly accentSoft: "rgba(147, 51, 234, 0.15)";
|
|
429
441
|
readonly accentSoftForeground: "#7833bc";
|
|
430
442
|
readonly accentSoftPressed: "rgba(147, 51, 234, 0.2)";
|
|
@@ -486,10 +498,10 @@ declare const tokens: {
|
|
|
486
498
|
readonly separator: "#52525b";
|
|
487
499
|
readonly focus: "#c084fc";
|
|
488
500
|
readonly link: "#fafafa";
|
|
489
|
-
readonly accentPressed: "#
|
|
490
|
-
readonly successPressed: "#
|
|
491
|
-
readonly warningPressed: "#
|
|
492
|
-
readonly dangerPressed: "#
|
|
501
|
+
readonly accentPressed: "#c691fd";
|
|
502
|
+
readonly successPressed: "#64e18d";
|
|
503
|
+
readonly warningPressed: "#fbc54b";
|
|
504
|
+
readonly dangerPressed: "#fa807e";
|
|
493
505
|
readonly defaultPressed: "#2e2e31";
|
|
494
506
|
readonly surfacePressed: "#27272a";
|
|
495
507
|
readonly defaultSoft: "rgba(39, 39, 42, 0.5)";
|