@xaui/native 0.9.1-alpha.17 → 0.9.1-alpha.18

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.
@@ -12,31 +12,59 @@ type IconComponentProps = {
12
12
  size?: number;
13
13
  color?: string;
14
14
  };
15
- /**
16
- * R14 reaches the **`source` form only**, exactly like `style` below and for the same
17
- * reason: it is the one of the three forms where we render the node. On the other two,
18
- * `size` and `color` are what shapes the icon.
19
- */
20
- type IconProps = ImageStyleProps & {
21
- /** An icon component. `size` and `color` are injected into it. */
22
- as?: ComponentType<IconComponentProps>;
23
- /** A raw `react-native-svg` element, cloned with the resolved size and colour. */
24
- children?: ReactNode;
25
- /** An image, tinted with the resolved colour. */
26
- source?: ImageSourcePropType;
15
+ /** What every form takes, and the only lever the two non-rendering ones have. */
16
+ type IconBase = {
27
17
  /** Overrides what the surrounding slot asked for. */
28
18
  size?: number;
29
19
  /** A raw value (R7), never a token. Overrides the slot's. */
30
20
  color?: string;
31
- /**
32
- * The **`source` form only** — it is the one of the three where we render the view.
33
- * `as` hands its props to a third-party component and the children form clones an
34
- * element the caller made; neither is a view this can style, and wrapping them would
35
- * add a level of depth to every icon in the library. `size` and `color` are the
36
- * escape hatch there.
37
- */
21
+ };
22
+ /**
23
+ * An icon component `size` and `color` are injected into it.
24
+ *
25
+ * No style props and no `style`: we do not render this node, the third party does, and
26
+ * there is no published interface that says it would accept either. Wrapping it in a view
27
+ * to make them work would add a level of depth to every icon in the library.
28
+ */
29
+ type IconAsProps = IconBase & {
30
+ as: ComponentType<IconComponentProps>;
31
+ children?: never;
32
+ source?: never;
33
+ };
34
+ /**
35
+ * A raw `react-native-svg` element, cloned with the resolved size and colour.
36
+ *
37
+ * No style props and no `style` either: the node is the caller's own element, and they can
38
+ * style it where they wrote it.
39
+ */
40
+ type IconChildrenProps = IconBase & {
41
+ as?: never;
42
+ children: ReactNode;
43
+ source?: never;
44
+ };
45
+ /**
46
+ * An image, tinted with the resolved colour — **the one form that carries R14**, because
47
+ * it is the one where we render the node.
48
+ */
49
+ type IconSourceProps = IconBase & ImageStyleProps & {
50
+ as?: never;
51
+ children?: never;
52
+ source: ImageSourcePropType;
38
53
  style?: StyleProp<ImageStyle>;
39
54
  };
55
+ /**
56
+ * Three forms, and the type says which one you are in.
57
+ *
58
+ * The union is what makes R14's boundary checkable rather than merely documented. When
59
+ * every form declared the style props, `<Icon as={Trash2} marginEnd={8} />` compiled and
60
+ * did nothing at all — the prop was dropped on the two forms that do not render the node,
61
+ * silently, and only a comment said so. Now it is a compile error that points at `size`
62
+ * and `color`, which are the levers those forms actually have.
63
+ *
64
+ * It also makes the three mutually exclusive, which they always were at runtime: `as`
65
+ * wins over children, and children over `source`.
66
+ */
67
+ type IconProps = IconAsProps | IconChildrenProps | IconSourceProps;
40
68
  /** What a component root publishes so the icons inside it need no props at all. */
41
69
  type IconContextValue = {
42
70
  size?: number;
@@ -12,31 +12,59 @@ type IconComponentProps = {
12
12
  size?: number;
13
13
  color?: string;
14
14
  };
15
- /**
16
- * R14 reaches the **`source` form only**, exactly like `style` below and for the same
17
- * reason: it is the one of the three forms where we render the node. On the other two,
18
- * `size` and `color` are what shapes the icon.
19
- */
20
- type IconProps = ImageStyleProps & {
21
- /** An icon component. `size` and `color` are injected into it. */
22
- as?: ComponentType<IconComponentProps>;
23
- /** A raw `react-native-svg` element, cloned with the resolved size and colour. */
24
- children?: ReactNode;
25
- /** An image, tinted with the resolved colour. */
26
- source?: ImageSourcePropType;
15
+ /** What every form takes, and the only lever the two non-rendering ones have. */
16
+ type IconBase = {
27
17
  /** Overrides what the surrounding slot asked for. */
28
18
  size?: number;
29
19
  /** A raw value (R7), never a token. Overrides the slot's. */
30
20
  color?: string;
31
- /**
32
- * The **`source` form only** — it is the one of the three where we render the view.
33
- * `as` hands its props to a third-party component and the children form clones an
34
- * element the caller made; neither is a view this can style, and wrapping them would
35
- * add a level of depth to every icon in the library. `size` and `color` are the
36
- * escape hatch there.
37
- */
21
+ };
22
+ /**
23
+ * An icon component `size` and `color` are injected into it.
24
+ *
25
+ * No style props and no `style`: we do not render this node, the third party does, and
26
+ * there is no published interface that says it would accept either. Wrapping it in a view
27
+ * to make them work would add a level of depth to every icon in the library.
28
+ */
29
+ type IconAsProps = IconBase & {
30
+ as: ComponentType<IconComponentProps>;
31
+ children?: never;
32
+ source?: never;
33
+ };
34
+ /**
35
+ * A raw `react-native-svg` element, cloned with the resolved size and colour.
36
+ *
37
+ * No style props and no `style` either: the node is the caller's own element, and they can
38
+ * style it where they wrote it.
39
+ */
40
+ type IconChildrenProps = IconBase & {
41
+ as?: never;
42
+ children: ReactNode;
43
+ source?: never;
44
+ };
45
+ /**
46
+ * An image, tinted with the resolved colour — **the one form that carries R14**, because
47
+ * it is the one where we render the node.
48
+ */
49
+ type IconSourceProps = IconBase & ImageStyleProps & {
50
+ as?: never;
51
+ children?: never;
52
+ source: ImageSourcePropType;
38
53
  style?: StyleProp<ImageStyle>;
39
54
  };
55
+ /**
56
+ * Three forms, and the type says which one you are in.
57
+ *
58
+ * The union is what makes R14's boundary checkable rather than merely documented. When
59
+ * every form declared the style props, `<Icon as={Trash2} marginEnd={8} />` compiled and
60
+ * did nothing at all — the prop was dropped on the two forms that do not render the node,
61
+ * silently, and only a comment said so. Now it is a compile error that points at `size`
62
+ * and `color`, which are the levers those forms actually have.
63
+ *
64
+ * It also makes the three mutually exclusive, which they always were at runtime: `as`
65
+ * wins over children, and children over `source`.
66
+ */
67
+ type IconProps = IconAsProps | IconChildrenProps | IconSourceProps;
40
68
  /** What a component root publishes so the icons inside it need no props at all. */
41
69
  type IconContextValue = {
42
70
  size?: number;
@@ -27,7 +27,7 @@ var _chunkM2VYRHVScjs = require('../chunk-M2VYRHVS.cjs');
27
27
 
28
28
 
29
29
 
30
- var _chunk2UICXD3Qcjs = require('../chunk-2UICXD3Q.cjs');
30
+ var _chunkP5MKOLIWcjs = require('../chunk-P5MKOLIW.cjs');
31
31
 
32
32
 
33
33
 
@@ -72,4 +72,4 @@ require('../chunk-6N5JXRUZ.cjs');
72
72
 
73
73
 
74
74
 
75
- exports.FEEDBACK_OVERLAY = _chunk2UICXD3Qcjs.FEEDBACK_OVERLAY; exports.HIGHLIGHT_DURATION = _chunk2UICXD3Qcjs.HIGHLIGHT_DURATION; exports.HIGHLIGHT_OPACITY = _chunk2UICXD3Qcjs.HIGHLIGHT_OPACITY; exports.Icon = _chunk2UICXD3Qcjs.Icon; exports.IconContext = _chunk2UICXD3Qcjs.IconContext; exports.PRESS_DURATION = _chunk2UICXD3Qcjs.PRESS_DURATION; exports.PRESS_SCALE = _chunk2UICXD3Qcjs.PRESS_SCALE; exports.Portal = _chunkM2VYRHVScjs.Portal; exports.PortalContext = _chunkM2VYRHVScjs.PortalContext; exports.PortalHost = _chunkM2VYRHVScjs.PortalHost; exports.PressableFeedback = _chunk2UICXD3Qcjs.PressableFeedback; exports.RIPPLE_CONFIRM_DURATION = _chunk2UICXD3Qcjs.RIPPLE_CONFIRM_DURATION; exports.RIPPLE_EXPAND_DURATION = _chunk2UICXD3Qcjs.RIPPLE_EXPAND_DURATION; exports.RIPPLE_FADE_IN = _chunk2UICXD3Qcjs.RIPPLE_FADE_IN; exports.RIPPLE_FADE_OUT = _chunk2UICXD3Qcjs.RIPPLE_FADE_OUT; exports.RIPPLE_FADE_OUT_DELAY = _chunk2UICXD3Qcjs.RIPPLE_FADE_OUT_DELAY; exports.RIPPLE_OPACITY = _chunk2UICXD3Qcjs.RIPPLE_OPACITY; exports.RIPPLE_START_SCALE = _chunk2UICXD3Qcjs.RIPPLE_START_SCALE; exports.SCALE_REFERENCE_WIDTH = _chunk2UICXD3Qcjs.SCALE_REFERENCE_WIDTH; exports.Slot = _chunk5SU7FXWHcjs.Slot; exports.childrenToString = _chunk5SU7FXWHcjs.childrenToString; exports.createRecipe = _chunk5SU7FXWHcjs.createRecipe; exports.createSlotContext = _chunk5SU7FXWHcjs.createSlotContext; exports.markOverlay = _chunk2UICXD3Qcjs.markOverlay; exports.mergeProps = _chunk5SU7FXWHcjs.mergeProps; exports.mergeRefs = _chunk5SU7FXWHcjs.mergeRefs; exports.pressScaleFor = _chunk2UICXD3Qcjs.pressScaleFor; exports.resolveAnimation = _chunk2UICXD3Qcjs.resolveAnimation; exports.resolveSlotAnimation = _chunk2UICXD3Qcjs.resolveSlotAnimation; exports.rippleRadiusFor = _chunk2UICXD3Qcjs.rippleRadiusFor; exports.useFeedback = _chunk2UICXD3Qcjs.useFeedback; exports.useIconContext = _chunk2UICXD3Qcjs.useIconContext; exports.useStyleProps = _chunk5SU7FXWHcjs.useStyleProps;
75
+ exports.FEEDBACK_OVERLAY = _chunkP5MKOLIWcjs.FEEDBACK_OVERLAY; exports.HIGHLIGHT_DURATION = _chunkP5MKOLIWcjs.HIGHLIGHT_DURATION; exports.HIGHLIGHT_OPACITY = _chunkP5MKOLIWcjs.HIGHLIGHT_OPACITY; exports.Icon = _chunkP5MKOLIWcjs.Icon; exports.IconContext = _chunkP5MKOLIWcjs.IconContext; exports.PRESS_DURATION = _chunkP5MKOLIWcjs.PRESS_DURATION; exports.PRESS_SCALE = _chunkP5MKOLIWcjs.PRESS_SCALE; exports.Portal = _chunkM2VYRHVScjs.Portal; exports.PortalContext = _chunkM2VYRHVScjs.PortalContext; exports.PortalHost = _chunkM2VYRHVScjs.PortalHost; exports.PressableFeedback = _chunkP5MKOLIWcjs.PressableFeedback; exports.RIPPLE_CONFIRM_DURATION = _chunkP5MKOLIWcjs.RIPPLE_CONFIRM_DURATION; exports.RIPPLE_EXPAND_DURATION = _chunkP5MKOLIWcjs.RIPPLE_EXPAND_DURATION; exports.RIPPLE_FADE_IN = _chunkP5MKOLIWcjs.RIPPLE_FADE_IN; exports.RIPPLE_FADE_OUT = _chunkP5MKOLIWcjs.RIPPLE_FADE_OUT; exports.RIPPLE_FADE_OUT_DELAY = _chunkP5MKOLIWcjs.RIPPLE_FADE_OUT_DELAY; exports.RIPPLE_OPACITY = _chunkP5MKOLIWcjs.RIPPLE_OPACITY; exports.RIPPLE_START_SCALE = _chunkP5MKOLIWcjs.RIPPLE_START_SCALE; exports.SCALE_REFERENCE_WIDTH = _chunkP5MKOLIWcjs.SCALE_REFERENCE_WIDTH; exports.Slot = _chunk5SU7FXWHcjs.Slot; exports.childrenToString = _chunk5SU7FXWHcjs.childrenToString; exports.createRecipe = _chunk5SU7FXWHcjs.createRecipe; exports.createSlotContext = _chunk5SU7FXWHcjs.createSlotContext; exports.markOverlay = _chunkP5MKOLIWcjs.markOverlay; exports.mergeProps = _chunk5SU7FXWHcjs.mergeProps; exports.mergeRefs = _chunk5SU7FXWHcjs.mergeRefs; exports.pressScaleFor = _chunkP5MKOLIWcjs.pressScaleFor; exports.resolveAnimation = _chunkP5MKOLIWcjs.resolveAnimation; exports.resolveSlotAnimation = _chunkP5MKOLIWcjs.resolveSlotAnimation; exports.rippleRadiusFor = _chunkP5MKOLIWcjs.rippleRadiusFor; exports.useFeedback = _chunkP5MKOLIWcjs.useFeedback; exports.useIconContext = _chunkP5MKOLIWcjs.useIconContext; exports.useStyleProps = _chunk5SU7FXWHcjs.useStyleProps;
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, Provider, Ref, RefCallback } from 'react';
3
- import { b as IconProps, a as IconContextValue, S as SlotAnimation, F as FeedbackContext, c as AnimationProp, d as ResolvedAnimation } from '../pressable-feedback.type-C9kjAuVQ.cjs';
4
- export { A as AnimationConfig, I as IconComponentProps, P as PressableFeedbackProps, R as RadiusStyle, e as RippleWave } from '../pressable-feedback.type-C9kjAuVQ.cjs';
3
+ import { b as IconProps, a as IconContextValue, S as SlotAnimation, F as FeedbackContext, c as AnimationProp, d as ResolvedAnimation } from '../pressable-feedback.type-lgW5wQx5.cjs';
4
+ export { A as AnimationConfig, I as IconComponentProps, P as PressableFeedbackProps, R as RadiusStyle, e as RippleWave } from '../pressable-feedback.type-lgW5wQx5.cjs';
5
5
  import { V as ViewStyleProps } from '../create-recipe-3_ElpCYt.cjs';
6
6
  export { A as Axes, C as CompoundVariant, D as DirectionalStyleKey, I as ImageStyleProps, 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, n as StyleProps, o as TextStyleProps, T as TintArgs, k as VariantColors, l as VariantRole, m as VariantTokens, c as createRecipe } from '../create-recipe-3_ElpCYt.cjs';
7
7
  import * as react_native from 'react-native';
@@ -55,8 +55,12 @@ declare function useStyleProps<P extends object>(props: P): [StylePropsOf<P>, Re
55
55
  * Three accepted forms — a component through `as`, a raw SVG as children, or an image
56
56
  * through `source` — and the resolution is the same for all three: an explicit prop, else
57
57
  * what the surrounding slot published, else the theme.
58
+ *
59
+ * The props are taken whole rather than destructured, because they are a union: which
60
+ * keys exist depends on the form, and narrowing is what lets `style` be reachable in the
61
+ * one branch that renders a node and unwritable in the two that do not.
58
62
  */
59
- declare function Icon({ as: Component, children, source, size, color, style, ...props }: IconProps): react.JSX.Element;
63
+ declare function Icon(props: IconProps): react.JSX.Element;
60
64
  declare namespace Icon {
61
65
  var displayName: string;
62
66
  }
@@ -378,7 +382,7 @@ declare function resolveSlotAnimation(override: SlotAnimation | undefined, enabl
378
382
  * off — and it is the only shape that survives `asChild`, where the caller's own element
379
383
  * is the pressable and there is no sibling for the primitive to inject.
380
384
  */
381
- declare const PressableFeedback: react.ForwardRefExoticComponent<Omit<react_native.PressableProps, "children" | "style" | "disabled"> & ViewStyleProps & {
385
+ declare const PressableFeedback: react.ForwardRefExoticComponent<Omit<react_native.PressableProps, "style" | "children" | "disabled"> & ViewStyleProps & {
382
386
  isPressed?: boolean;
383
387
  isDisabled?: boolean;
384
388
  asChild?: boolean;
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, Provider, Ref, RefCallback } from 'react';
3
- import { b as IconProps, a as IconContextValue, S as SlotAnimation, F as FeedbackContext, c as AnimationProp, d as ResolvedAnimation } from '../pressable-feedback.type-KcPvFf6f.js';
4
- export { A as AnimationConfig, I as IconComponentProps, P as PressableFeedbackProps, R as RadiusStyle, e as RippleWave } from '../pressable-feedback.type-KcPvFf6f.js';
3
+ import { b as IconProps, a as IconContextValue, S as SlotAnimation, F as FeedbackContext, c as AnimationProp, d as ResolvedAnimation } from '../pressable-feedback.type-UwqIG6ES.js';
4
+ export { A as AnimationConfig, I as IconComponentProps, P as PressableFeedbackProps, R as RadiusStyle, e as RippleWave } from '../pressable-feedback.type-UwqIG6ES.js';
5
5
  import { V as ViewStyleProps } from '../create-recipe-DImq1AZA.js';
6
6
  export { A as Axes, C as CompoundVariant, D as DirectionalStyleKey, I as ImageStyleProps, 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, n as StyleProps, o as TextStyleProps, T as TintArgs, k as VariantColors, l as VariantRole, m as VariantTokens, c as createRecipe } from '../create-recipe-DImq1AZA.js';
7
7
  import * as react_native from 'react-native';
@@ -55,8 +55,12 @@ declare function useStyleProps<P extends object>(props: P): [StylePropsOf<P>, Re
55
55
  * Three accepted forms — a component through `as`, a raw SVG as children, or an image
56
56
  * through `source` — and the resolution is the same for all three: an explicit prop, else
57
57
  * what the surrounding slot published, else the theme.
58
+ *
59
+ * The props are taken whole rather than destructured, because they are a union: which
60
+ * keys exist depends on the form, and narrowing is what lets `style` be reachable in the
61
+ * one branch that renders a node and unwritable in the two that do not.
58
62
  */
59
- declare function Icon({ as: Component, children, source, size, color, style, ...props }: IconProps): react.JSX.Element;
63
+ declare function Icon(props: IconProps): react.JSX.Element;
60
64
  declare namespace Icon {
61
65
  var displayName: string;
62
66
  }
@@ -378,7 +382,7 @@ declare function resolveSlotAnimation(override: SlotAnimation | undefined, enabl
378
382
  * off — and it is the only shape that survives `asChild`, where the caller's own element
379
383
  * is the pressable and there is no sibling for the primitive to inject.
380
384
  */
381
- declare const PressableFeedback: react.ForwardRefExoticComponent<Omit<react_native.PressableProps, "children" | "style" | "disabled"> & ViewStyleProps & {
385
+ declare const PressableFeedback: react.ForwardRefExoticComponent<Omit<react_native.PressableProps, "style" | "children" | "disabled"> & ViewStyleProps & {
382
386
  isPressed?: boolean;
383
387
  isDisabled?: boolean;
384
388
  asChild?: boolean;
@@ -27,7 +27,7 @@ import {
27
27
  rippleRadiusFor,
28
28
  useFeedback,
29
29
  useIconContext
30
- } from "../chunk-F432IDIW.js";
30
+ } from "../chunk-VQPP6FCB.js";
31
31
  import {
32
32
  Slot,
33
33
  childrenToString,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaui/native",
3
- "version": "0.9.1-alpha.17",
3
+ "version": "0.9.1-alpha.18",
4
4
  "description": "Composition-first React Native UI components with native animations powered by Reanimated",
5
5
  "keywords": [
6
6
  "react-native",