@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
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import * as react_native from 'react-native';
|
|
4
|
+
import { View, ViewProps, StyleProp, ViewStyle } from 'react-native';
|
|
5
|
+
import { V as ViewStyleProps } from '../../style-props.type-B1BG5TCm.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A horizontal axis.
|
|
9
|
+
*
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <Row gap={8} alignItems="center">
|
|
12
|
+
* <Button.Icon as={Trash2} />
|
|
13
|
+
* <Typography variant="h6">Supprimer</Typography>
|
|
14
|
+
* </Row>
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* **It contributes one declaration**, `flexDirection: 'row'`, and everything else it looks
|
|
18
|
+
* like it offers comes from R14: `gap`, `alignItems`, `justifyContent`, `padding` and the
|
|
19
|
+
* rest are `ViewStyle` keys every node already exposes as props. That is deliberate — the
|
|
20
|
+
* legacy component invented `mainAxisAlignment`, `crossAxisAlignment` and `mainAxisSize`,
|
|
21
|
+
* a vocabulary to learn for saying what React Native already says.
|
|
22
|
+
*
|
|
23
|
+
* There is no `reversed` prop either. `row` already flips in an RTL layout, which is the
|
|
24
|
+
* case that matters, and a genuine reversal is `style={{ flexDirection: 'row-reverse' }}`.
|
|
25
|
+
*/
|
|
26
|
+
declare const Row: react.ForwardRefExoticComponent<Omit<react_native.ViewProps, "style"> & {
|
|
27
|
+
asChild?: boolean;
|
|
28
|
+
style?: react_native.StyleProp<react_native.ViewStyle>;
|
|
29
|
+
children?: react.ReactNode;
|
|
30
|
+
} & Omit<ViewStyleProps, "flexDirection" | "pointerEvents" | "style" | "children" | "id" | "onLayout" | "testID" | "nativeID" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "aria-label" | "accessibilityRole" | "accessibilityState" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "accessibilityHint" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "onAccessibilityAction" | "importantForAccessibility" | "aria-hidden" | "aria-modal" | "role" | "accessibilityLabelledBy" | "aria-labelledby" | "accessibilityLiveRegion" | "aria-live" | "screenReaderFocusable" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "accessibilityLanguage" | "accessibilityShowsLargeContentViewer" | "accessibilityLargeContentTitle" | "accessibilityRespondsToUserInteraction" | "hitSlop" | "needsOffscreenAlphaCompositing" | "removeClippedSubviews" | "collapsable" | "collapsableChildren" | "onBlur" | "onFocus" | "renderToHardwareTextureAndroid" | "focusable" | "tabIndex" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerUp" | "onPointerUpCapture" | "asChild"> & react.RefAttributes<View>>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A vertical axis.
|
|
34
|
+
*
|
|
35
|
+
* ```tsx
|
|
36
|
+
* <Column gap={16} padding={16}>
|
|
37
|
+
* <Typography variant="h3">Projets</Typography>
|
|
38
|
+
* <Typography variant="body-sm">Trois en cours, un archivé.</Typography>
|
|
39
|
+
* </Column>
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* **It contributes one declaration**, `flexDirection: 'column'` — which is React Native's
|
|
43
|
+
* default, so this component exists for what it *says* rather than for what it changes.
|
|
44
|
+
* A column written as a column reads as a deliberate axis, and its siblings in a layout
|
|
45
|
+
* are then all named the same way; a bare `View` leaves the reader to infer it.
|
|
46
|
+
*
|
|
47
|
+
* Everything else comes from R14: `gap`, `alignItems`, `justifyContent`, `padding` are
|
|
48
|
+
* `ViewStyle` keys every node already exposes as props, under React Native's own names.
|
|
49
|
+
*/
|
|
50
|
+
declare const Column: react.ForwardRefExoticComponent<Omit<react_native.ViewProps, "style"> & {
|
|
51
|
+
asChild?: boolean;
|
|
52
|
+
style?: react_native.StyleProp<react_native.ViewStyle>;
|
|
53
|
+
children?: react.ReactNode;
|
|
54
|
+
} & Omit<ViewStyleProps, "flexDirection" | "pointerEvents" | "style" | "children" | "id" | "onLayout" | "testID" | "nativeID" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "aria-label" | "accessibilityRole" | "accessibilityState" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "accessibilityHint" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "onAccessibilityAction" | "importantForAccessibility" | "aria-hidden" | "aria-modal" | "role" | "accessibilityLabelledBy" | "aria-labelledby" | "accessibilityLiveRegion" | "aria-live" | "screenReaderFocusable" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "accessibilityLanguage" | "accessibilityShowsLargeContentViewer" | "accessibilityLargeContentTitle" | "accessibilityRespondsToUserInteraction" | "hitSlop" | "needsOffscreenAlphaCompositing" | "removeClippedSubviews" | "collapsable" | "collapsableChildren" | "onBlur" | "onFocus" | "renderToHardwareTextureAndroid" | "focusable" | "tabIndex" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerUp" | "onPointerUpCapture" | "asChild"> & react.RefAttributes<View>>;
|
|
55
|
+
|
|
56
|
+
type GridContextValue = {
|
|
57
|
+
/**
|
|
58
|
+
* The width of one column in points, or `undefined` on the very first render — the grid
|
|
59
|
+
* has not been measured yet. A cell falls back to a percentage for that one frame.
|
|
60
|
+
*/
|
|
61
|
+
cellWidth: number | undefined;
|
|
62
|
+
columns: number;
|
|
63
|
+
gap: number;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* R10 — the resolved geometry a cell needs, published by the root that measured it.
|
|
67
|
+
*
|
|
68
|
+
* Strict, and named: a `Grid.Item` outside a `Grid` has no column width to span, and
|
|
69
|
+
* failing with the component's name beats rendering a cell of arbitrary size.
|
|
70
|
+
*/
|
|
71
|
+
declare function useGrid(): GridContextValue;
|
|
72
|
+
|
|
73
|
+
type AxisOwnProps = {
|
|
74
|
+
/** R12 — the child element becomes the axis, keeping its direction. */
|
|
75
|
+
asChild?: boolean;
|
|
76
|
+
style?: StyleProp<ViewStyle>;
|
|
77
|
+
children?: ReactNode;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Everything a `View` can be styled with, as props (R14), **minus `flexDirection`** — that
|
|
81
|
+
* one is the component's identity, and a `Row` that could be told to lay out as a column
|
|
82
|
+
* would only be a `View` with a longer name. Reversal and the rest go through `style`,
|
|
83
|
+
* which is the escape hatch for what has no readable prop.
|
|
84
|
+
*
|
|
85
|
+
* Note what is *not* declared here: no `mainAxisAlignment`, no `crossAxisAlignment`, no
|
|
86
|
+
* `gap` prop of our own. They are `justifyContent`, `alignItems` and `gap` — React
|
|
87
|
+
* Native's own names, carrying React Native's own values, and R14 already exposes every
|
|
88
|
+
* one of them. A vocabulary of ours would be a second set of words for the same thing.
|
|
89
|
+
*/
|
|
90
|
+
type AxisProps = Omit<ViewProps, 'style'> & AxisOwnProps & Omit<ViewStyleProps, keyof AxisOwnProps | keyof ViewProps | 'flexDirection'>;
|
|
91
|
+
type RowProps = AxisProps;
|
|
92
|
+
type ColumnProps = AxisProps;
|
|
93
|
+
/**
|
|
94
|
+
* `Stack` and `Stack.Item` take the full R14 set: unlike the axes, neither claims a style
|
|
95
|
+
* key as its identity. `position` is set by each of them and remains overridable, because
|
|
96
|
+
* a layer that has to be `relative` for one screen should not need a different component.
|
|
97
|
+
*/
|
|
98
|
+
type StackProps = Omit<ViewProps, 'style'> & AxisOwnProps & Omit<ViewStyleProps, keyof AxisOwnProps | keyof ViewProps>;
|
|
99
|
+
type StackItemProps = StackProps;
|
|
100
|
+
type GridOwnProps = {
|
|
101
|
+
/** How many columns. Floored, and never below one. @default 2 */
|
|
102
|
+
columns?: number;
|
|
103
|
+
/**
|
|
104
|
+
* The space between cells, in points — React Native's `gap`, taken as a prop because the
|
|
105
|
+
* root has to read it to size the columns. @default 0
|
|
106
|
+
*/
|
|
107
|
+
gap?: number;
|
|
108
|
+
style?: StyleProp<ViewStyle>;
|
|
109
|
+
children?: ReactNode;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* No `asChild`: the root measures itself through `onLayout` and publishes the result, so
|
|
113
|
+
* it has to be the node it renders. `flexDirection`, `flexWrap` and the three gap keys are
|
|
114
|
+
* withheld for the same reason — they are the grid's mechanism, not its decoration.
|
|
115
|
+
*/
|
|
116
|
+
type GridProps = Omit<ViewProps, 'style'> & GridOwnProps & Omit<ViewStyleProps, keyof GridOwnProps | keyof ViewProps | 'flexDirection' | 'flexWrap' | 'columnGap' | 'rowGap'>;
|
|
117
|
+
type GridItemOwnProps = {
|
|
118
|
+
/** How many columns the cell covers. Clamped to the grid's count. @default 1 */
|
|
119
|
+
span?: number;
|
|
120
|
+
style?: StyleProp<ViewStyle>;
|
|
121
|
+
children?: ReactNode;
|
|
122
|
+
};
|
|
123
|
+
/** `width` is the grid's answer, so it is not a prop here. */
|
|
124
|
+
type GridItemProps = Omit<ViewProps, 'style'> & GridItemOwnProps & Omit<ViewStyleProps, keyof GridItemOwnProps | keyof ViewProps | 'width'>;
|
|
125
|
+
|
|
126
|
+
/** Overlaying is composed: the root is the containing block, `Item` is a layer in it. */
|
|
127
|
+
declare const Stack: react.ForwardRefExoticComponent<Omit<react_native.ViewProps, "style"> & {
|
|
128
|
+
asChild?: boolean;
|
|
129
|
+
style?: react_native.StyleProp<react_native.ViewStyle>;
|
|
130
|
+
children?: react.ReactNode;
|
|
131
|
+
} & Omit<ViewStyleProps, "pointerEvents" | "style" | "children" | "id" | "onLayout" | "testID" | "nativeID" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "aria-label" | "accessibilityRole" | "accessibilityState" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "accessibilityHint" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "onAccessibilityAction" | "importantForAccessibility" | "aria-hidden" | "aria-modal" | "role" | "accessibilityLabelledBy" | "aria-labelledby" | "accessibilityLiveRegion" | "aria-live" | "screenReaderFocusable" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "accessibilityLanguage" | "accessibilityShowsLargeContentViewer" | "accessibilityLargeContentTitle" | "accessibilityRespondsToUserInteraction" | "hitSlop" | "needsOffscreenAlphaCompositing" | "removeClippedSubviews" | "collapsable" | "collapsableChildren" | "onBlur" | "onFocus" | "renderToHardwareTextureAndroid" | "focusable" | "tabIndex" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerUp" | "onPointerUpCapture" | "asChild"> & react.RefAttributes<react_native.View>> & {
|
|
132
|
+
Item: react.ForwardRefExoticComponent<Omit<react_native.ViewProps, "style"> & {
|
|
133
|
+
asChild?: boolean;
|
|
134
|
+
style?: react_native.StyleProp<react_native.ViewStyle>;
|
|
135
|
+
children?: react.ReactNode;
|
|
136
|
+
} & Omit<ViewStyleProps, "pointerEvents" | "style" | "children" | "id" | "onLayout" | "testID" | "nativeID" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "aria-label" | "accessibilityRole" | "accessibilityState" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "accessibilityHint" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "onAccessibilityAction" | "importantForAccessibility" | "aria-hidden" | "aria-modal" | "role" | "accessibilityLabelledBy" | "aria-labelledby" | "accessibilityLiveRegion" | "aria-live" | "screenReaderFocusable" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "accessibilityLanguage" | "accessibilityShowsLargeContentViewer" | "accessibilityLargeContentTitle" | "accessibilityRespondsToUserInteraction" | "hitSlop" | "needsOffscreenAlphaCompositing" | "removeClippedSubviews" | "collapsable" | "collapsableChildren" | "onBlur" | "onFocus" | "renderToHardwareTextureAndroid" | "focusable" | "tabIndex" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerUp" | "onPointerUpCapture" | "asChild"> & react.RefAttributes<react_native.View>>;
|
|
137
|
+
};
|
|
138
|
+
/** Every child is a cell; `Item` is the one that spans more than a column. */
|
|
139
|
+
declare const Grid: react.ForwardRefExoticComponent<Omit<react_native.ViewProps, "style"> & {
|
|
140
|
+
columns?: number;
|
|
141
|
+
gap?: number;
|
|
142
|
+
style?: react_native.StyleProp<react_native.ViewStyle>;
|
|
143
|
+
children?: react.ReactNode;
|
|
144
|
+
} & Omit<ViewStyleProps, "columnGap" | "flexDirection" | "flexWrap" | "gap" | "rowGap" | "pointerEvents" | "style" | "children" | "id" | "onLayout" | "testID" | "nativeID" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "aria-label" | "accessibilityRole" | "accessibilityState" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "accessibilityHint" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "onAccessibilityAction" | "importantForAccessibility" | "aria-hidden" | "aria-modal" | "role" | "accessibilityLabelledBy" | "aria-labelledby" | "accessibilityLiveRegion" | "aria-live" | "screenReaderFocusable" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "accessibilityLanguage" | "accessibilityShowsLargeContentViewer" | "accessibilityLargeContentTitle" | "accessibilityRespondsToUserInteraction" | "hitSlop" | "needsOffscreenAlphaCompositing" | "removeClippedSubviews" | "collapsable" | "collapsableChildren" | "onBlur" | "onFocus" | "renderToHardwareTextureAndroid" | "focusable" | "tabIndex" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerUp" | "onPointerUpCapture" | "columns"> & react.RefAttributes<react_native.View>> & {
|
|
145
|
+
Item: react.ForwardRefExoticComponent<Omit<react_native.ViewProps, "style"> & {
|
|
146
|
+
span?: number;
|
|
147
|
+
style?: react_native.StyleProp<react_native.ViewStyle>;
|
|
148
|
+
children?: react.ReactNode;
|
|
149
|
+
} & Omit<ViewStyleProps, "width" | "pointerEvents" | "span" | "style" | "children" | "id" | "onLayout" | "testID" | "nativeID" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "aria-label" | "accessibilityRole" | "accessibilityState" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "accessibilityHint" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "onAccessibilityAction" | "importantForAccessibility" | "aria-hidden" | "aria-modal" | "role" | "accessibilityLabelledBy" | "aria-labelledby" | "accessibilityLiveRegion" | "aria-live" | "screenReaderFocusable" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "accessibilityLanguage" | "accessibilityShowsLargeContentViewer" | "accessibilityLargeContentTitle" | "accessibilityRespondsToUserInteraction" | "hitSlop" | "needsOffscreenAlphaCompositing" | "removeClippedSubviews" | "collapsable" | "collapsableChildren" | "onBlur" | "onFocus" | "renderToHardwareTextureAndroid" | "focusable" | "tabIndex" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerUp" | "onPointerUpCapture"> & react.RefAttributes<react_native.View>>;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export { type AxisProps, Column, type ColumnProps, Grid, type GridContextValue, type GridItemProps, type GridProps, Row, type RowProps, Stack, type StackItemProps, type StackProps, useGrid };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { X as XAUITheme, a as XAUIColors } from './theme.type-C2gNHpEx.js';
|
|
2
|
+
import { ViewStyle, TextStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A slot is a view or a text node, and a recipe writes one object per slot, so the two
|
|
6
|
+
* RN style shapes are merged rather than discriminated per slot.
|
|
7
|
+
*/
|
|
8
|
+
type SlotStyle = ViewStyle & TextStyle;
|
|
9
|
+
type SlotStyles<Slot extends string> = Partial<Record<Slot, SlotStyle>>;
|
|
10
|
+
/** The roles a variant consumes. The variant names tokens; `paint` says where they land. */
|
|
11
|
+
type VariantRole = 'bg' | 'bgPressed' | 'fg' | 'border';
|
|
12
|
+
/** Token names per role — no colour value ever appears in a recipe. */
|
|
13
|
+
type VariantTokens = Partial<Record<VariantRole, keyof XAUIColors>>;
|
|
14
|
+
/** The same roles resolved: theme colours, or the slices of a raw `color`. */
|
|
15
|
+
type VariantColors = Partial<Record<VariantRole, string>>;
|
|
16
|
+
/**
|
|
17
|
+
* `disabled` is applied last of the three: a control that is both pressed and disabled
|
|
18
|
+
* has to read disabled.
|
|
19
|
+
*/
|
|
20
|
+
type StateName = 'focused' | 'pressed' | 'disabled';
|
|
21
|
+
type States = Partial<Record<StateName, boolean>>;
|
|
22
|
+
/** Reads the theme and the variant's resolved colours; returns one style per slot. */
|
|
23
|
+
type StyleFn<Slot extends string> = (theme: XAUITheme, colors: VariantColors) => SlotStyles<Slot>;
|
|
24
|
+
/** Named axes of finite token values — `{ size: { sm: fn, md: fn } }`. */
|
|
25
|
+
type Axes<Slot extends string> = Record<string, Record<string, StyleFn<Slot>>>;
|
|
26
|
+
/** One value per axis, plus the variant. Missing keys fall back to `defaultVariants`. */
|
|
27
|
+
type Selection<Variant extends string, A extends Axes<string>> = {
|
|
28
|
+
variant?: Variant;
|
|
29
|
+
} & {
|
|
30
|
+
[Axis in keyof A]?: Extract<keyof A[Axis], string>;
|
|
31
|
+
};
|
|
32
|
+
type CompoundVariant<Slot extends string, Variant extends string, A extends Axes<Slot>> = {
|
|
33
|
+
when: Selection<Variant, A>;
|
|
34
|
+
style: StyleFn<Slot>;
|
|
35
|
+
};
|
|
36
|
+
type RecipeConfig<Slot extends string, Variant extends string, A extends Axes<Slot>> = {
|
|
37
|
+
/** Every slot the component publishes. Slots a recipe never styles resolve to `{}`. */
|
|
38
|
+
slots: readonly Slot[];
|
|
39
|
+
base?: StyleFn<Slot>;
|
|
40
|
+
variantTokens?: Record<Variant, VariantTokens>;
|
|
41
|
+
/** Where the variant's colours land — written once, and it holds for every variant. */
|
|
42
|
+
paint?: StyleFn<Slot>;
|
|
43
|
+
variants?: A;
|
|
44
|
+
/**
|
|
45
|
+
* `NoInfer` for the same reason as `defaultVariants` below: a `when: { variant: 'x' }`
|
|
46
|
+
* names one variant, and letting inference read `Variant` off it collapses the recipe
|
|
47
|
+
* to that single value.
|
|
48
|
+
*/
|
|
49
|
+
compoundVariants?: ReadonlyArray<CompoundVariant<Slot, NoInfer<Variant>, A>>;
|
|
50
|
+
states?: Partial<Record<StateName, StyleFn<Slot>>>;
|
|
51
|
+
/**
|
|
52
|
+
* `NoInfer`, because this is the one place a single variant name appears on its own:
|
|
53
|
+
* without it, inference reads `Variant` off `{ variant: 'primary' }` and narrows the
|
|
54
|
+
* whole recipe to that one value, so every other variant becomes a type error at the
|
|
55
|
+
* call site. `variantTokens` is the declaration; this only picks a default from it.
|
|
56
|
+
*/
|
|
57
|
+
defaultVariants?: Selection<NoInfer<Variant>, A>;
|
|
58
|
+
};
|
|
59
|
+
/** Stable references: the same object for the same tokens, for the app's lifetime. */
|
|
60
|
+
type ResolvedStyles<Slot extends string> = Readonly<Record<Slot, SlotStyle>>;
|
|
61
|
+
/** A selection with `defaultVariants` already folded in, keyed by axis name. */
|
|
62
|
+
type ResolvedSelection = Readonly<Record<string, string | undefined>>;
|
|
63
|
+
|
|
64
|
+
type ResolveArgs<Variant extends string, A extends Axes<string>> = {
|
|
65
|
+
theme: XAUITheme;
|
|
66
|
+
selection?: Selection<Variant, A>;
|
|
67
|
+
states?: States;
|
|
68
|
+
};
|
|
69
|
+
type TintArgs<Variant extends string, A extends Axes<string>> = ResolveArgs<Variant, A> & {
|
|
70
|
+
color: string;
|
|
71
|
+
};
|
|
72
|
+
type Recipe<Slot extends string, Variant extends string, A extends Axes<Slot>> = {
|
|
73
|
+
readonly slots: readonly Slot[];
|
|
74
|
+
/** The cached pass: stable `StyleSheet` references, keyed by tokens alone. */
|
|
75
|
+
resolve(args: ResolveArgs<Variant, A>): ResolvedStyles<Slot>;
|
|
76
|
+
/**
|
|
77
|
+
* The tint pass: the same functions run again with `color`'s slices in place of the
|
|
78
|
+
* theme's tokens. Uncached and allocating, and only ever called when `color` is set.
|
|
79
|
+
*/
|
|
80
|
+
tint(args: TintArgs<Variant, A>): SlotStyles<Slot>;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* A component's style, declared once. Resolution splits in two because the two halves
|
|
84
|
+
* have different lifetimes: everything keyed by a finite token is cached forever, and
|
|
85
|
+
* an arbitrary `color` is recomputed per render — which is what keeps the cache bounded
|
|
86
|
+
* by the number of token combinations rather than by the palette users invent.
|
|
87
|
+
*
|
|
88
|
+
* const styles = buttonRecipe.resolve({ theme, selection: { variant, size }, states })
|
|
89
|
+
* const tint = color ? buttonRecipe.tint({ theme, color, selection, states }) : undefined
|
|
90
|
+
* <View style={[styles.root, tint?.root, style]} />
|
|
91
|
+
*/
|
|
92
|
+
declare function createRecipe<Slot extends string, Variant extends string, const A extends Axes<Slot>>(config: RecipeConfig<Slot, Variant, A>): Recipe<Slot, Variant, A>;
|
|
93
|
+
|
|
94
|
+
export { type Axes as A, type CompoundVariant as C, type Recipe as R, type Selection as S, type TintArgs as T, type VariantColors as V, type ResolveArgs as a, type RecipeConfig as b, createRecipe as c, type ResolvedSelection as d, type ResolvedStyles as e, type SlotStyle as f, type SlotStyles as g, type StateName as h, type States as i, type StyleFn as j, type VariantRole as k, type VariantTokens as l };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { X as XAUITheme, a as XAUIColors } from './theme.type-C2gNHpEx.cjs';
|
|
2
|
+
import { ViewStyle, TextStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A slot is a view or a text node, and a recipe writes one object per slot, so the two
|
|
6
|
+
* RN style shapes are merged rather than discriminated per slot.
|
|
7
|
+
*/
|
|
8
|
+
type SlotStyle = ViewStyle & TextStyle;
|
|
9
|
+
type SlotStyles<Slot extends string> = Partial<Record<Slot, SlotStyle>>;
|
|
10
|
+
/** The roles a variant consumes. The variant names tokens; `paint` says where they land. */
|
|
11
|
+
type VariantRole = 'bg' | 'bgPressed' | 'fg' | 'border';
|
|
12
|
+
/** Token names per role — no colour value ever appears in a recipe. */
|
|
13
|
+
type VariantTokens = Partial<Record<VariantRole, keyof XAUIColors>>;
|
|
14
|
+
/** The same roles resolved: theme colours, or the slices of a raw `color`. */
|
|
15
|
+
type VariantColors = Partial<Record<VariantRole, string>>;
|
|
16
|
+
/**
|
|
17
|
+
* `disabled` is applied last of the three: a control that is both pressed and disabled
|
|
18
|
+
* has to read disabled.
|
|
19
|
+
*/
|
|
20
|
+
type StateName = 'focused' | 'pressed' | 'disabled';
|
|
21
|
+
type States = Partial<Record<StateName, boolean>>;
|
|
22
|
+
/** Reads the theme and the variant's resolved colours; returns one style per slot. */
|
|
23
|
+
type StyleFn<Slot extends string> = (theme: XAUITheme, colors: VariantColors) => SlotStyles<Slot>;
|
|
24
|
+
/** Named axes of finite token values — `{ size: { sm: fn, md: fn } }`. */
|
|
25
|
+
type Axes<Slot extends string> = Record<string, Record<string, StyleFn<Slot>>>;
|
|
26
|
+
/** One value per axis, plus the variant. Missing keys fall back to `defaultVariants`. */
|
|
27
|
+
type Selection<Variant extends string, A extends Axes<string>> = {
|
|
28
|
+
variant?: Variant;
|
|
29
|
+
} & {
|
|
30
|
+
[Axis in keyof A]?: Extract<keyof A[Axis], string>;
|
|
31
|
+
};
|
|
32
|
+
type CompoundVariant<Slot extends string, Variant extends string, A extends Axes<Slot>> = {
|
|
33
|
+
when: Selection<Variant, A>;
|
|
34
|
+
style: StyleFn<Slot>;
|
|
35
|
+
};
|
|
36
|
+
type RecipeConfig<Slot extends string, Variant extends string, A extends Axes<Slot>> = {
|
|
37
|
+
/** Every slot the component publishes. Slots a recipe never styles resolve to `{}`. */
|
|
38
|
+
slots: readonly Slot[];
|
|
39
|
+
base?: StyleFn<Slot>;
|
|
40
|
+
variantTokens?: Record<Variant, VariantTokens>;
|
|
41
|
+
/** Where the variant's colours land — written once, and it holds for every variant. */
|
|
42
|
+
paint?: StyleFn<Slot>;
|
|
43
|
+
variants?: A;
|
|
44
|
+
/**
|
|
45
|
+
* `NoInfer` for the same reason as `defaultVariants` below: a `when: { variant: 'x' }`
|
|
46
|
+
* names one variant, and letting inference read `Variant` off it collapses the recipe
|
|
47
|
+
* to that single value.
|
|
48
|
+
*/
|
|
49
|
+
compoundVariants?: ReadonlyArray<CompoundVariant<Slot, NoInfer<Variant>, A>>;
|
|
50
|
+
states?: Partial<Record<StateName, StyleFn<Slot>>>;
|
|
51
|
+
/**
|
|
52
|
+
* `NoInfer`, because this is the one place a single variant name appears on its own:
|
|
53
|
+
* without it, inference reads `Variant` off `{ variant: 'primary' }` and narrows the
|
|
54
|
+
* whole recipe to that one value, so every other variant becomes a type error at the
|
|
55
|
+
* call site. `variantTokens` is the declaration; this only picks a default from it.
|
|
56
|
+
*/
|
|
57
|
+
defaultVariants?: Selection<NoInfer<Variant>, A>;
|
|
58
|
+
};
|
|
59
|
+
/** Stable references: the same object for the same tokens, for the app's lifetime. */
|
|
60
|
+
type ResolvedStyles<Slot extends string> = Readonly<Record<Slot, SlotStyle>>;
|
|
61
|
+
/** A selection with `defaultVariants` already folded in, keyed by axis name. */
|
|
62
|
+
type ResolvedSelection = Readonly<Record<string, string | undefined>>;
|
|
63
|
+
|
|
64
|
+
type ResolveArgs<Variant extends string, A extends Axes<string>> = {
|
|
65
|
+
theme: XAUITheme;
|
|
66
|
+
selection?: Selection<Variant, A>;
|
|
67
|
+
states?: States;
|
|
68
|
+
};
|
|
69
|
+
type TintArgs<Variant extends string, A extends Axes<string>> = ResolveArgs<Variant, A> & {
|
|
70
|
+
color: string;
|
|
71
|
+
};
|
|
72
|
+
type Recipe<Slot extends string, Variant extends string, A extends Axes<Slot>> = {
|
|
73
|
+
readonly slots: readonly Slot[];
|
|
74
|
+
/** The cached pass: stable `StyleSheet` references, keyed by tokens alone. */
|
|
75
|
+
resolve(args: ResolveArgs<Variant, A>): ResolvedStyles<Slot>;
|
|
76
|
+
/**
|
|
77
|
+
* The tint pass: the same functions run again with `color`'s slices in place of the
|
|
78
|
+
* theme's tokens. Uncached and allocating, and only ever called when `color` is set.
|
|
79
|
+
*/
|
|
80
|
+
tint(args: TintArgs<Variant, A>): SlotStyles<Slot>;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* A component's style, declared once. Resolution splits in two because the two halves
|
|
84
|
+
* have different lifetimes: everything keyed by a finite token is cached forever, and
|
|
85
|
+
* an arbitrary `color` is recomputed per render — which is what keeps the cache bounded
|
|
86
|
+
* by the number of token combinations rather than by the palette users invent.
|
|
87
|
+
*
|
|
88
|
+
* const styles = buttonRecipe.resolve({ theme, selection: { variant, size }, states })
|
|
89
|
+
* const tint = color ? buttonRecipe.tint({ theme, color, selection, states }) : undefined
|
|
90
|
+
* <View style={[styles.root, tint?.root, style]} />
|
|
91
|
+
*/
|
|
92
|
+
declare function createRecipe<Slot extends string, Variant extends string, const A extends Axes<Slot>>(config: RecipeConfig<Slot, Variant, A>): Recipe<Slot, Variant, A>;
|
|
93
|
+
|
|
94
|
+
export { type Axes as A, type CompoundVariant as C, type Recipe as R, type Selection as S, type TintArgs as T, type VariantColors as V, type ResolveArgs as a, type RecipeConfig as b, createRecipe as c, type ResolvedSelection as d, type ResolvedStyles as e, type SlotStyle as f, type SlotStyles as g, type StateName as h, type States as i, type StyleFn as j, type VariantRole as k, type VariantTokens as l };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { ComponentType, ReactNode } from 'react';
|
|
2
|
+
import { ImageSourcePropType, StyleProp, ImageStyle } from 'react-native';
|
|
3
|
+
import { I as ImageStyleProps } from './style-props.type-B1BG5TCm.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The props Lucide, Ionicons and `react-native-vector-icons` all accept — the shape
|
|
7
|
+
* `as` is handed. It is a convention rather than an interface anyone published, which is
|
|
8
|
+
* exactly why `Icon` exists: without it every call site computes the two values by hand.
|
|
9
|
+
*/
|
|
10
|
+
type IconComponentProps = {
|
|
11
|
+
size?: number;
|
|
12
|
+
color?: string;
|
|
13
|
+
};
|
|
14
|
+
/** What every form takes, and the only lever the two non-rendering ones have. */
|
|
15
|
+
type IconBase = {
|
|
16
|
+
/** Overrides what the surrounding slot asked for. */
|
|
17
|
+
size?: number;
|
|
18
|
+
/** A raw value (R7), never a token. Overrides the slot's. */
|
|
19
|
+
color?: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* An icon component — `size` and `color` are injected into it.
|
|
23
|
+
*
|
|
24
|
+
* No style props and no `style`: we do not render this node, the third party does, and
|
|
25
|
+
* there is no published interface that says it would accept either. Wrapping it in a view
|
|
26
|
+
* to make them work would add a level of depth to every icon in the library.
|
|
27
|
+
*/
|
|
28
|
+
type IconAsProps = IconBase & {
|
|
29
|
+
as: ComponentType<IconComponentProps>;
|
|
30
|
+
children?: never;
|
|
31
|
+
source?: never;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* A raw `react-native-svg` element, cloned with the resolved size and colour.
|
|
35
|
+
*
|
|
36
|
+
* No style props and no `style` either: the node is the caller's own element, and they can
|
|
37
|
+
* style it where they wrote it.
|
|
38
|
+
*/
|
|
39
|
+
type IconChildrenProps = IconBase & {
|
|
40
|
+
as?: never;
|
|
41
|
+
children: ReactNode;
|
|
42
|
+
source?: never;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* An image, tinted with the resolved colour — **the one form that carries R14**, because
|
|
46
|
+
* it is the one where we render the node.
|
|
47
|
+
*/
|
|
48
|
+
type IconSourceProps = IconBase & ImageStyleProps & {
|
|
49
|
+
as?: never;
|
|
50
|
+
children?: never;
|
|
51
|
+
source: ImageSourcePropType;
|
|
52
|
+
style?: StyleProp<ImageStyle>;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Three forms, and the type says which one you are in.
|
|
56
|
+
*
|
|
57
|
+
* The union is what makes R14's boundary checkable rather than merely documented. When
|
|
58
|
+
* every form declared the style props, `<Icon as={Trash2} marginEnd={8} />` compiled and
|
|
59
|
+
* did nothing at all — the prop was dropped on the two forms that do not render the node,
|
|
60
|
+
* silently, and only a comment said so. Now it is a compile error that points at `size`
|
|
61
|
+
* and `color`, which are the levers those forms actually have.
|
|
62
|
+
*
|
|
63
|
+
* It also makes the three mutually exclusive, which they always were at runtime: `as`
|
|
64
|
+
* wins over children, and children over `source`.
|
|
65
|
+
*/
|
|
66
|
+
type IconProps = IconAsProps | IconChildrenProps | IconSourceProps;
|
|
67
|
+
/** What a component root publishes so the icons inside it need no props at all. */
|
|
68
|
+
type IconContextValue = {
|
|
69
|
+
size?: number;
|
|
70
|
+
color?: string;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export type { IconComponentProps as I, IconContextValue as a, IconProps as b };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { ComponentType, ReactNode } from 'react';
|
|
2
|
+
import { ImageSourcePropType, StyleProp, ImageStyle } from 'react-native';
|
|
3
|
+
import { I as ImageStyleProps } from './style-props.type-B1BG5TCm.cjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The props Lucide, Ionicons and `react-native-vector-icons` all accept — the shape
|
|
7
|
+
* `as` is handed. It is a convention rather than an interface anyone published, which is
|
|
8
|
+
* exactly why `Icon` exists: without it every call site computes the two values by hand.
|
|
9
|
+
*/
|
|
10
|
+
type IconComponentProps = {
|
|
11
|
+
size?: number;
|
|
12
|
+
color?: string;
|
|
13
|
+
};
|
|
14
|
+
/** What every form takes, and the only lever the two non-rendering ones have. */
|
|
15
|
+
type IconBase = {
|
|
16
|
+
/** Overrides what the surrounding slot asked for. */
|
|
17
|
+
size?: number;
|
|
18
|
+
/** A raw value (R7), never a token. Overrides the slot's. */
|
|
19
|
+
color?: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* An icon component — `size` and `color` are injected into it.
|
|
23
|
+
*
|
|
24
|
+
* No style props and no `style`: we do not render this node, the third party does, and
|
|
25
|
+
* there is no published interface that says it would accept either. Wrapping it in a view
|
|
26
|
+
* to make them work would add a level of depth to every icon in the library.
|
|
27
|
+
*/
|
|
28
|
+
type IconAsProps = IconBase & {
|
|
29
|
+
as: ComponentType<IconComponentProps>;
|
|
30
|
+
children?: never;
|
|
31
|
+
source?: never;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* A raw `react-native-svg` element, cloned with the resolved size and colour.
|
|
35
|
+
*
|
|
36
|
+
* No style props and no `style` either: the node is the caller's own element, and they can
|
|
37
|
+
* style it where they wrote it.
|
|
38
|
+
*/
|
|
39
|
+
type IconChildrenProps = IconBase & {
|
|
40
|
+
as?: never;
|
|
41
|
+
children: ReactNode;
|
|
42
|
+
source?: never;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* An image, tinted with the resolved colour — **the one form that carries R14**, because
|
|
46
|
+
* it is the one where we render the node.
|
|
47
|
+
*/
|
|
48
|
+
type IconSourceProps = IconBase & ImageStyleProps & {
|
|
49
|
+
as?: never;
|
|
50
|
+
children?: never;
|
|
51
|
+
source: ImageSourcePropType;
|
|
52
|
+
style?: StyleProp<ImageStyle>;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Three forms, and the type says which one you are in.
|
|
56
|
+
*
|
|
57
|
+
* The union is what makes R14's boundary checkable rather than merely documented. When
|
|
58
|
+
* every form declared the style props, `<Icon as={Trash2} marginEnd={8} />` compiled and
|
|
59
|
+
* did nothing at all — the prop was dropped on the two forms that do not render the node,
|
|
60
|
+
* silently, and only a comment said so. Now it is a compile error that points at `size`
|
|
61
|
+
* and `color`, which are the levers those forms actually have.
|
|
62
|
+
*
|
|
63
|
+
* It also makes the three mutually exclusive, which they always were at runtime: `as`
|
|
64
|
+
* wins over children, and children over `source`.
|
|
65
|
+
*/
|
|
66
|
+
type IconProps = IconAsProps | IconChildrenProps | IconSourceProps;
|
|
67
|
+
/** What a component root publishes so the icons inside it need no props at all. */
|
|
68
|
+
type IconContextValue = {
|
|
69
|
+
size?: number;
|
|
70
|
+
color?: string;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export type { IconComponentProps as I, IconContextValue as a, IconProps as b };
|