@xaui/native 0.9.1-alpha.3 → 0.9.1-alpha.4

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.
@@ -3,8 +3,56 @@ import {
3
3
  useXAUITheme
4
4
  } from "./chunk-X2K2FX3W.js";
5
5
 
6
+ // src/system/portal/portal.tsx
7
+ import { useContext, useId, useLayoutEffect } from "react";
8
+
9
+ // src/system/portal/portal-context.ts
10
+ import { createContext } from "react";
11
+ var PortalContext = createContext(null);
12
+
13
+ // src/system/portal/portal.tsx
14
+ function Portal({ children }) {
15
+ const context = useContext(PortalContext);
16
+ const key = useId();
17
+ useLayoutEffect(() => {
18
+ context?.addPortal(key, children);
19
+ }, [children, context, key]);
20
+ useLayoutEffect(() => {
21
+ return () => context?.removePortal(key);
22
+ }, [context, key]);
23
+ return null;
24
+ }
25
+ Portal.displayName = "XAUI.Portal";
26
+
27
+ // src/system/portal/portal-host.tsx
28
+ import { Fragment, useCallback, useMemo, useState } from "react";
29
+ import { StyleSheet, View } from "react-native";
30
+ var styles = StyleSheet.create({
31
+ container: { flex: 1 }
32
+ });
33
+ function PortalHost({ children }) {
34
+ const [portals, setPortals] = useState(/* @__PURE__ */ new Map());
35
+ const addPortal = useCallback((key, element) => {
36
+ setPortals((current) => new Map(current).set(key, element));
37
+ }, []);
38
+ const removePortal = useCallback((key) => {
39
+ setPortals((current) => {
40
+ if (!current.has(key)) return current;
41
+ const next = new Map(current);
42
+ next.delete(key);
43
+ return next;
44
+ });
45
+ }, []);
46
+ const methods = useMemo(
47
+ () => ({ addPortal, removePortal }),
48
+ [addPortal, removePortal]
49
+ );
50
+ return /* @__PURE__ */ React.createElement(PortalContext.Provider, { value: methods }, /* @__PURE__ */ React.createElement(View, { style: styles.container }, children, Array.from(portals, ([key, element]) => /* @__PURE__ */ React.createElement(Fragment, { key }, element))));
51
+ }
52
+ PortalHost.displayName = "XAUI.PortalHost";
53
+
6
54
  // src/system/pressable-feedback/pressable-feedback.tsx
7
- import { forwardRef as forwardRef2, useContext as useContext2, useEffect as useEffect2, useMemo } from "react";
55
+ import { forwardRef as forwardRef2, useContext as useContext3, useEffect as useEffect2, useMemo as useMemo2 } from "react";
8
56
  import { Pressable } from "react-native";
9
57
  import Animated3, {
10
58
  useAnimatedStyle as useAnimatedStyle3,
@@ -13,15 +61,15 @@ import Animated3, {
13
61
  } from "react-native-reanimated";
14
62
 
15
63
  // src/system/pressable-feedback/pressable-feedback-context.ts
16
- import { createContext as createContext2 } from "react";
64
+ import { createContext as createContext3 } from "react";
17
65
 
18
66
  // src/system/slot/create-slot-context.ts
19
- import { createContext, useContext } from "react";
67
+ import { createContext as createContext2, useContext as useContext2 } from "react";
20
68
  function createSlotContext(name) {
21
- const Context = createContext(null);
69
+ const Context = createContext2(null);
22
70
  Context.displayName = `XAUI.${name}.Context`;
23
71
  function useSlotContext() {
24
- const value = useContext(Context);
72
+ const value = useContext2(Context);
25
73
  if (value === null) {
26
74
  const error = new Error(
27
75
  `XAUI: use${name} must be called inside <${name}>. A slot reads the values its root resolved, so it can only be rendered as a child of one.`
@@ -39,11 +87,11 @@ function createSlotContext(name) {
39
87
 
40
88
  // src/system/pressable-feedback/pressable-feedback-context.ts
41
89
  var [FeedbackProvider, useFeedback] = createSlotContext("PressableFeedback");
42
- var DisableAllContext = createContext2(false);
90
+ var DisableAllContext = createContext3(false);
43
91
 
44
92
  // src/system/pressable-feedback/pressable-feedback-highlight.tsx
45
93
  import { useEffect } from "react";
46
- import { StyleSheet, View } from "react-native";
94
+ import { StyleSheet as StyleSheet2, View as View2 } from "react-native";
47
95
  import Animated, {
48
96
  useAnimatedStyle,
49
97
  useSharedValue,
@@ -118,13 +166,13 @@ function PressableFeedbackHighlight({
118
166
  HIGHLIGHT_OPACITY
119
167
  );
120
168
  const base = [
121
- StyleSheet.absoluteFillObject,
169
+ StyleSheet2.absoluteFillObject,
122
170
  { backgroundColor: theme.colors.foreground },
123
171
  style
124
172
  ];
125
173
  if (!progress || !settings.enabled) {
126
174
  return /* @__PURE__ */ React.createElement(
127
- View,
175
+ View2,
128
176
  {
129
177
  pointerEvents: "none",
130
178
  style: [base, { opacity: isPressed ? settings.opacity : 0 }]
@@ -355,7 +403,7 @@ var AnimatedPressable = Animated3.createAnimatedComponent(Pressable);
355
403
  var AnimatedSlot = Animated3.createAnimatedComponent(Slot);
356
404
  var PressableFeedback = forwardRef2(
357
405
  function PressableFeedback2({ animation, feedbackVariant = "scale-highlight", ...rest }, ref) {
358
- const inheritedDisableAll = useContext2(DisableAllContext);
406
+ const inheritedDisableAll = useContext3(DisableAllContext);
359
407
  const resolved = resolveAnimation(animation, inheritedDisableAll);
360
408
  const Feedback = resolved.none || feedbackVariant === "none" ? StaticFeedback : AnimatedFeedback;
361
409
  const body = /* @__PURE__ */ React.createElement(
@@ -380,7 +428,7 @@ var StaticFeedback = forwardRef2(function StaticFeedback2({
380
428
  style,
381
429
  ...rest
382
430
  }, ref) {
383
- const context = useMemo(() => ({ isPressed, animation }), [isPressed, animation]);
431
+ const context = useMemo2(() => ({ isPressed, animation }), [isPressed, animation]);
384
432
  const Root = asChild ? Slot : Pressable;
385
433
  return /* @__PURE__ */ React.createElement(Root, { ref, style, disabled: isDisabled, ...rest }, /* @__PURE__ */ React.createElement(FeedbackProvider, { value: context }, /* @__PURE__ */ React.createElement(DefaultOverlay, { variant: feedbackVariant }), children));
386
434
  });
@@ -408,7 +456,7 @@ var AnimatedFeedback = forwardRef2(function AnimatedFeedback2({
408
456
  const animatedStyle = useAnimatedStyle3(
409
457
  () => animation.scale ? { transform: [{ scale: 1 - (1 - PRESS_SCALE) * progress.value }] } : {}
410
458
  );
411
- const context = useMemo(
459
+ const context = useMemo2(
412
460
  () => ({ isPressed, animation, progress, pressCount, origin, size }),
413
461
  [isPressed, animation, progress, pressCount, origin, size]
414
462
  );
@@ -474,7 +522,7 @@ function resolveTint(tokens, color, theme) {
474
522
  }
475
523
 
476
524
  // src/system/recipe/style-cache.ts
477
- import { StyleSheet as StyleSheet2 } from "react-native";
525
+ import { StyleSheet as StyleSheet3 } from "react-native";
478
526
 
479
527
  // src/system/recipe/variant-map.ts
480
528
  var STATE_ORDER = ["focused", "pressed", "disabled"];
@@ -537,7 +585,7 @@ function createStyleCache(slots) {
537
585
  const built = build();
538
586
  const complete = {};
539
587
  for (const slot of slots) complete[slot] = built[slot] ?? {};
540
- const created = StyleSheet2.create(complete);
588
+ const created = StyleSheet3.create(complete);
541
589
  entries.set(key, created);
542
590
  return created;
543
591
  },
@@ -617,6 +665,9 @@ function stringify(node) {
617
665
  }
618
666
 
619
667
  export {
668
+ PortalContext,
669
+ Portal,
670
+ PortalHost,
620
671
  createSlotContext,
621
672
  useFeedback,
622
673
  PRESS_SCALE,
@@ -3,9 +3,57 @@
3
3
 
4
4
  var _chunk3QBT3Q65cjs = require('./chunk-3QBT3Q65.cjs');
5
5
 
6
- // src/system/pressable-feedback/pressable-feedback.tsx
6
+ // src/system/portal/portal.tsx
7
7
  var _react = require('react');
8
+
9
+ // src/system/portal/portal-context.ts
10
+
11
+ var PortalContext = _react.createContext.call(void 0, null);
12
+
13
+ // src/system/portal/portal.tsx
14
+ function Portal({ children }) {
15
+ const context = _react.useContext.call(void 0, PortalContext);
16
+ const key = _react.useId.call(void 0, );
17
+ _react.useLayoutEffect.call(void 0, () => {
18
+ _optionalChain([context, 'optionalAccess', _ => _.addPortal, 'call', _2 => _2(key, children)]);
19
+ }, [children, context, key]);
20
+ _react.useLayoutEffect.call(void 0, () => {
21
+ return () => _optionalChain([context, 'optionalAccess', _3 => _3.removePortal, 'call', _4 => _4(key)]);
22
+ }, [context, key]);
23
+ return null;
24
+ }
25
+ Portal.displayName = "XAUI.Portal";
26
+
27
+ // src/system/portal/portal-host.tsx
28
+
8
29
  var _reactnative = require('react-native');
30
+ var styles = _reactnative.StyleSheet.create({
31
+ container: { flex: 1 }
32
+ });
33
+ function PortalHost({ children }) {
34
+ const [portals, setPortals] = _react.useState.call(void 0, /* @__PURE__ */ new Map());
35
+ const addPortal = _react.useCallback.call(void 0, (key, element) => {
36
+ setPortals((current) => new Map(current).set(key, element));
37
+ }, []);
38
+ const removePortal = _react.useCallback.call(void 0, (key) => {
39
+ setPortals((current) => {
40
+ if (!current.has(key)) return current;
41
+ const next = new Map(current);
42
+ next.delete(key);
43
+ return next;
44
+ });
45
+ }, []);
46
+ const methods = _react.useMemo.call(void 0,
47
+ () => ({ addPortal, removePortal }),
48
+ [addPortal, removePortal]
49
+ );
50
+ return /* @__PURE__ */ React.createElement(PortalContext.Provider, { value: methods }, /* @__PURE__ */ React.createElement(_reactnative.View, { style: styles.container }, children, Array.from(portals, ([key, element]) => /* @__PURE__ */ React.createElement(_react.Fragment, { key }, element))));
51
+ }
52
+ PortalHost.displayName = "XAUI.PortalHost";
53
+
54
+ // src/system/pressable-feedback/pressable-feedback.tsx
55
+
56
+
9
57
 
10
58
 
11
59
 
@@ -26,7 +74,7 @@ function createSlotContext(name) {
26
74
  const error = new Error(
27
75
  `XAUI: use${name} must be called inside <${name}>. A slot reads the values its root resolved, so it can only be rendered as a child of one.`
28
76
  );
29
- _optionalChain([Error, 'access', _ => _.captureStackTrace, 'optionalCall', _2 => _2(
77
+ _optionalChain([Error, 'access', _5 => _5.captureStackTrace, 'optionalCall', _6 => _6(
30
78
  error,
31
79
  useSlotContext
32
80
  )]);
@@ -202,12 +250,12 @@ function AnimatedRipple({
202
250
  const fromB = _reactnativereanimated.useSharedValue.call(void 0, { x: 0, y: 0 });
203
251
  const useA = _reactnativereanimated.useSharedValue.call(void 0, true);
204
252
  _reactnativereanimated.useAnimatedReaction.call(void 0,
205
- () => _nullishCoalesce(_optionalChain([pressCount, 'optionalAccess', _3 => _3.value]), () => ( 0)),
253
+ () => _nullishCoalesce(_optionalChain([pressCount, 'optionalAccess', _7 => _7.value]), () => ( 0)),
206
254
  (count, previous) => {
207
255
  if (previous === null || count === previous) return;
208
256
  const wave = useA.value ? waveA : waveB;
209
257
  const from = useA.value ? fromA : fromB;
210
- from.value = _nullishCoalesce(_optionalChain([origin, 'optionalAccess', _4 => _4.value]), () => ( { x: 0, y: 0 }));
258
+ from.value = _nullishCoalesce(_optionalChain([origin, 'optionalAccess', _8 => _8.value]), () => ( { x: 0, y: 0 }));
211
259
  wave.value = 0;
212
260
  wave.value = _reactnativereanimated.withTiming.call(void 0, 2, { duration: duration * 2 });
213
261
  useA.value = !useA.value;
@@ -244,7 +292,7 @@ function RippleWave({
244
292
  style
245
293
  }) {
246
294
  const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, () => {
247
- const within = _nullishCoalesce(_optionalChain([size, 'optionalAccess', _5 => _5.value]), () => ( { width: 0, height: 0 }));
295
+ const within = _nullishCoalesce(_optionalChain([size, 'optionalAccess', _9 => _9.value]), () => ( { width: 0, height: 0 }));
248
296
  const radius = Math.sqrt(within.width * within.width + within.height * within.height) * RIPPLE_COVERAGE;
249
297
  const at = from.value;
250
298
  return {
@@ -416,12 +464,12 @@ var AnimatedFeedback = _react.forwardRef.call(void 0, function AnimatedFeedback2
416
464
  const { locationX, locationY } = event.nativeEvent;
417
465
  origin.value = { x: locationX, y: locationY };
418
466
  pressCount.value += 1;
419
- _optionalChain([onPressIn, 'optionalCall', _6 => _6(event)]);
467
+ _optionalChain([onPressIn, 'optionalCall', _10 => _10(event)]);
420
468
  };
421
469
  const handleLayout = (event) => {
422
470
  const { width, height } = event.nativeEvent.layout;
423
471
  size.value = { width, height };
424
- _optionalChain([onLayout, 'optionalCall', _7 => _7(event)]);
472
+ _optionalChain([onLayout, 'optionalCall', _11 => _11(event)]);
425
473
  };
426
474
  const clip = feedbackVariant === "scale-ripple" ? { overflow: "hidden" } : null;
427
475
  const Root = asChild ? AnimatedSlot : AnimatedPressable;
@@ -501,7 +549,7 @@ function resolveVariantColors(tokens, theme) {
501
549
  function activeStateFns(states, active) {
502
550
  const fns = [];
503
551
  for (const state of STATE_ORDER) {
504
- const fn = active[state] ? _optionalChain([states, 'optionalAccess', _8 => _8[state]]) : void 0;
552
+ const fn = active[state] ? _optionalChain([states, 'optionalAccess', _12 => _12[state]]) : void 0;
505
553
  if (fn) fns.push(fn);
506
554
  }
507
555
  return fns;
@@ -558,7 +606,7 @@ function cacheKey(theme, selection, states) {
558
606
  // src/system/recipe/create-recipe.ts
559
607
  function createRecipe(config) {
560
608
  const cache = createStyleCache(config.slots);
561
- const tokensFor = (variant) => variant === void 0 ? void 0 : _optionalChain([config, 'access', _9 => _9.variantTokens, 'optionalAccess', _10 => _10[variant]]);
609
+ const tokensFor = (variant) => variant === void 0 ? void 0 : _optionalChain([config, 'access', _13 => _13.variantTokens, 'optionalAccess', _14 => _14[variant]]);
562
610
  return {
563
611
  slots: config.slots,
564
612
  resolve({ theme, selection, states = {} }) {
@@ -634,4 +682,7 @@ function stringify(node) {
634
682
 
635
683
 
636
684
 
637
- exports.createSlotContext = createSlotContext; exports.useFeedback = useFeedback; exports.PRESS_SCALE = PRESS_SCALE; exports.PRESS_DURATION = PRESS_DURATION; exports.RELEASE_DURATION = RELEASE_DURATION; exports.HIGHLIGHT_OPACITY = HIGHLIGHT_OPACITY; exports.RIPPLE_OPACITY = RIPPLE_OPACITY; exports.RIPPLE_DURATION = RIPPLE_DURATION; exports.RIPPLE_COVERAGE = RIPPLE_COVERAGE; exports.resolveAnimation = resolveAnimation; exports.resolveSlotAnimation = resolveSlotAnimation; exports.mergeRefs = mergeRefs; exports.mergeProps = mergeProps; exports.Slot = Slot; exports.PressableFeedback = PressableFeedback3; exports.createRecipe = createRecipe; exports.childrenToString = childrenToString;
685
+
686
+
687
+
688
+ exports.PortalContext = PortalContext; exports.Portal = Portal; exports.PortalHost = PortalHost; exports.createSlotContext = createSlotContext; exports.useFeedback = useFeedback; exports.PRESS_SCALE = PRESS_SCALE; exports.PRESS_DURATION = PRESS_DURATION; exports.RELEASE_DURATION = RELEASE_DURATION; exports.HIGHLIGHT_OPACITY = HIGHLIGHT_OPACITY; exports.RIPPLE_OPACITY = RIPPLE_OPACITY; exports.RIPPLE_DURATION = RIPPLE_DURATION; exports.RIPPLE_COVERAGE = RIPPLE_COVERAGE; exports.resolveAnimation = resolveAnimation; exports.resolveSlotAnimation = resolveSlotAnimation; exports.mergeRefs = mergeRefs; exports.mergeProps = mergeProps; exports.Slot = Slot; exports.PressableFeedback = PressableFeedback3; exports.createRecipe = createRecipe; exports.childrenToString = childrenToString;
package/dist/index.cjs CHANGED
@@ -16,7 +16,10 @@
16
16
 
17
17
 
18
18
 
19
- var _chunkV63JO65Fcjs = require('./chunk-V63JO65F.cjs');
19
+
20
+
21
+
22
+ var _chunkIYFGO523cjs = require('./chunk-IYFGO523.cjs');
20
23
 
21
24
 
22
25
 
@@ -69,4 +72,7 @@ var _chunk3QBT3Q65cjs = require('./chunk-3QBT3Q65.cjs');
69
72
 
70
73
 
71
74
 
72
- exports.HIGHLIGHT_OPACITY = _chunkV63JO65Fcjs.HIGHLIGHT_OPACITY; exports.PRESS_DURATION = _chunkV63JO65Fcjs.PRESS_DURATION; exports.PRESS_SCALE = _chunkV63JO65Fcjs.PRESS_SCALE; exports.PressableFeedback = _chunkV63JO65Fcjs.PressableFeedback; exports.RELEASE_DURATION = _chunkV63JO65Fcjs.RELEASE_DURATION; exports.RIPPLE_COVERAGE = _chunkV63JO65Fcjs.RIPPLE_COVERAGE; exports.RIPPLE_DURATION = _chunkV63JO65Fcjs.RIPPLE_DURATION; exports.RIPPLE_OPACITY = _chunkV63JO65Fcjs.RIPPLE_OPACITY; exports.Slot = _chunkV63JO65Fcjs.Slot; exports.ThemeContext = _chunk3QBT3Q65cjs.ThemeContext; exports.XAUIProvider = _chunkAW63PTQ4cjs.XAUIProvider; exports.buildRadius = _chunkAW63PTQ4cjs.buildRadius; exports.buildShadows = _chunkAW63PTQ4cjs.buildShadows; exports.childrenToString = _chunkV63JO65Fcjs.childrenToString; exports.createRecipe = _chunkV63JO65Fcjs.createRecipe; exports.createSlotContext = _chunkV63JO65Fcjs.createSlotContext; exports.createTheme = _chunkAW63PTQ4cjs.createTheme; exports.defaultTheme = _chunkAW63PTQ4cjs.defaultTheme; exports.deriveColors = _chunkAW63PTQ4cjs.deriveColors; exports.deriveTint = _chunk3QBT3Q65cjs.deriveTint; exports.mergeProps = _chunkV63JO65Fcjs.mergeProps; exports.mergeRefs = _chunkV63JO65Fcjs.mergeRefs; exports.palette = _chunkAW63PTQ4cjs.palette; exports.primitives = _chunkAW63PTQ4cjs.primitives; exports.resolveAnimation = _chunkV63JO65Fcjs.resolveAnimation; exports.resolveSlotAnimation = _chunkV63JO65Fcjs.resolveSlotAnimation; exports.sourceKeys = _chunkAW63PTQ4cjs.sourceKeys; exports.tokens = _chunkAW63PTQ4cjs.tokens; exports.useColorMode = _chunk3QBT3Q65cjs.useColorMode; exports.useFeedback = _chunkV63JO65Fcjs.useFeedback; exports.useThemeColor = _chunk3QBT3Q65cjs.useThemeColor; exports.useXAUITheme = _chunk3QBT3Q65cjs.useXAUITheme;
75
+
76
+
77
+
78
+ exports.HIGHLIGHT_OPACITY = _chunkIYFGO523cjs.HIGHLIGHT_OPACITY; exports.PRESS_DURATION = _chunkIYFGO523cjs.PRESS_DURATION; exports.PRESS_SCALE = _chunkIYFGO523cjs.PRESS_SCALE; exports.Portal = _chunkIYFGO523cjs.Portal; exports.PortalContext = _chunkIYFGO523cjs.PortalContext; exports.PortalHost = _chunkIYFGO523cjs.PortalHost; exports.PressableFeedback = _chunkIYFGO523cjs.PressableFeedback; exports.RELEASE_DURATION = _chunkIYFGO523cjs.RELEASE_DURATION; exports.RIPPLE_COVERAGE = _chunkIYFGO523cjs.RIPPLE_COVERAGE; exports.RIPPLE_DURATION = _chunkIYFGO523cjs.RIPPLE_DURATION; exports.RIPPLE_OPACITY = _chunkIYFGO523cjs.RIPPLE_OPACITY; exports.Slot = _chunkIYFGO523cjs.Slot; exports.ThemeContext = _chunk3QBT3Q65cjs.ThemeContext; exports.XAUIProvider = _chunkAW63PTQ4cjs.XAUIProvider; exports.buildRadius = _chunkAW63PTQ4cjs.buildRadius; exports.buildShadows = _chunkAW63PTQ4cjs.buildShadows; exports.childrenToString = _chunkIYFGO523cjs.childrenToString; exports.createRecipe = _chunkIYFGO523cjs.createRecipe; exports.createSlotContext = _chunkIYFGO523cjs.createSlotContext; exports.createTheme = _chunkAW63PTQ4cjs.createTheme; exports.defaultTheme = _chunkAW63PTQ4cjs.defaultTheme; exports.deriveColors = _chunkAW63PTQ4cjs.deriveColors; exports.deriveTint = _chunk3QBT3Q65cjs.deriveTint; exports.mergeProps = _chunkIYFGO523cjs.mergeProps; exports.mergeRefs = _chunkIYFGO523cjs.mergeRefs; exports.palette = _chunkAW63PTQ4cjs.palette; exports.primitives = _chunkAW63PTQ4cjs.primitives; exports.resolveAnimation = _chunkIYFGO523cjs.resolveAnimation; exports.resolveSlotAnimation = _chunkIYFGO523cjs.resolveSlotAnimation; exports.sourceKeys = _chunkAW63PTQ4cjs.sourceKeys; exports.tokens = _chunkAW63PTQ4cjs.tokens; exports.useColorMode = _chunk3QBT3Q65cjs.useColorMode; exports.useFeedback = _chunkIYFGO523cjs.useFeedback; exports.useThemeColor = _chunk3QBT3Q65cjs.useThemeColor; exports.useXAUITheme = _chunk3QBT3Q65cjs.useXAUITheme;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { AnimationConfig, AnimationProp, AsChildProps, Axes, CompoundVariant, FeedbackContext, FeedbackVariant, HIGHLIGHT_OPACITY, MergeableProps, PRESS_DURATION, PRESS_SCALE, PossibleRef, PressableFeedback, PressableFeedbackHighlightProps, PressableFeedbackProps, PressableFeedbackRippleProps, RELEASE_DURATION, RIPPLE_COVERAGE, RIPPLE_DURATION, RIPPLE_OPACITY, Recipe, RecipeConfig, ResolveArgs, ResolvedAnimation, ResolvedSelection, ResolvedStyles, Selection, Slot, SlotAnimation, SlotProps, SlotStyle, SlotStyles, StateName, States, StyleFn, TintArgs, VariantColors, VariantRole, VariantTokens, childrenToString, createRecipe, createSlotContext, mergeProps, mergeRefs, resolveAnimation, resolveSlotAnimation, useFeedback } from './system/index.cjs';
1
+ export { AnimationConfig, AnimationProp, AsChildProps, Axes, CompoundVariant, FeedbackContext, FeedbackVariant, HIGHLIGHT_OPACITY, MergeableProps, PRESS_DURATION, PRESS_SCALE, Portal, PortalContext, PortalHost, PortalHostProps, PortalMethods, PortalProps, PossibleRef, PressableFeedback, PressableFeedbackHighlightProps, PressableFeedbackProps, PressableFeedbackRippleProps, RELEASE_DURATION, RIPPLE_COVERAGE, RIPPLE_DURATION, RIPPLE_OPACITY, Recipe, RecipeConfig, ResolveArgs, ResolvedAnimation, ResolvedSelection, ResolvedStyles, Selection, Slot, SlotAnimation, SlotProps, SlotStyle, SlotStyles, StateName, States, StyleFn, TintArgs, VariantColors, VariantRole, VariantTokens, childrenToString, createRecipe, createSlotContext, mergeProps, mergeRefs, resolveAnimation, resolveSlotAnimation, useFeedback } from './system/index.cjs';
2
2
  export { ColorModePreference, PaletteFamily, PaletteShade, ThemeContext, XAUIProvider, XAUIProviderProps, XAUITint, buildRadius, buildShadows, createTheme, defaultTheme, deriveColors, deriveTint, palette, primitives, sourceKeys, tokens, useColorMode, useThemeColor, useXAUITheme } from './theme/index.cjs';
3
3
  export { C as ColorMode, F as FontSizeKey, a as FontWeightKey, R as RadiusKey, S as Size, X as XAUIColors, b as XAUIDerivedColors, c as XAUIPrimitiveColors, d as XAUIRadius, e as XAUIShadow, f as XAUISourceColors, g as XAUITheme, h as XAUIThemeConfig, i as XAUIThemeSet } from './theme.type-C9bFJKFm.cjs';
4
4
  import 'react';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { AnimationConfig, AnimationProp, AsChildProps, Axes, CompoundVariant, FeedbackContext, FeedbackVariant, HIGHLIGHT_OPACITY, MergeableProps, PRESS_DURATION, PRESS_SCALE, PossibleRef, PressableFeedback, PressableFeedbackHighlightProps, PressableFeedbackProps, PressableFeedbackRippleProps, RELEASE_DURATION, RIPPLE_COVERAGE, RIPPLE_DURATION, RIPPLE_OPACITY, Recipe, RecipeConfig, ResolveArgs, ResolvedAnimation, ResolvedSelection, ResolvedStyles, Selection, Slot, SlotAnimation, SlotProps, SlotStyle, SlotStyles, StateName, States, StyleFn, TintArgs, VariantColors, VariantRole, VariantTokens, childrenToString, createRecipe, createSlotContext, mergeProps, mergeRefs, resolveAnimation, resolveSlotAnimation, useFeedback } from './system/index.js';
1
+ export { AnimationConfig, AnimationProp, AsChildProps, Axes, CompoundVariant, FeedbackContext, FeedbackVariant, HIGHLIGHT_OPACITY, MergeableProps, PRESS_DURATION, PRESS_SCALE, Portal, PortalContext, PortalHost, PortalHostProps, PortalMethods, PortalProps, PossibleRef, PressableFeedback, PressableFeedbackHighlightProps, PressableFeedbackProps, PressableFeedbackRippleProps, RELEASE_DURATION, RIPPLE_COVERAGE, RIPPLE_DURATION, RIPPLE_OPACITY, Recipe, RecipeConfig, ResolveArgs, ResolvedAnimation, ResolvedSelection, ResolvedStyles, Selection, Slot, SlotAnimation, SlotProps, SlotStyle, SlotStyles, StateName, States, StyleFn, TintArgs, VariantColors, VariantRole, VariantTokens, childrenToString, createRecipe, createSlotContext, mergeProps, mergeRefs, resolveAnimation, resolveSlotAnimation, useFeedback } from './system/index.js';
2
2
  export { ColorModePreference, PaletteFamily, PaletteShade, ThemeContext, XAUIProvider, XAUIProviderProps, XAUITint, buildRadius, buildShadows, createTheme, defaultTheme, deriveColors, deriveTint, palette, primitives, sourceKeys, tokens, useColorMode, useThemeColor, useXAUITheme } from './theme/index.js';
3
3
  export { C as ColorMode, F as FontSizeKey, a as FontWeightKey, R as RadiusKey, S as Size, X as XAUIColors, b as XAUIDerivedColors, c as XAUIPrimitiveColors, d as XAUIRadius, e as XAUIShadow, f as XAUISourceColors, g as XAUITheme, h as XAUIThemeConfig, i as XAUIThemeSet } from './theme.type-C9bFJKFm.js';
4
4
  import 'react';
package/dist/index.js CHANGED
@@ -2,6 +2,9 @@ import {
2
2
  HIGHLIGHT_OPACITY,
3
3
  PRESS_DURATION,
4
4
  PRESS_SCALE,
5
+ Portal,
6
+ PortalContext,
7
+ PortalHost,
5
8
  PressableFeedback,
6
9
  RELEASE_DURATION,
7
10
  RIPPLE_COVERAGE,
@@ -16,7 +19,7 @@ import {
16
19
  resolveAnimation,
17
20
  resolveSlotAnimation,
18
21
  useFeedback
19
- } from "./chunk-QAMNNTGM.js";
22
+ } from "./chunk-ECDWSSHJ.js";
20
23
  import {
21
24
  XAUIProvider,
22
25
  buildRadius,
@@ -40,6 +43,9 @@ export {
40
43
  HIGHLIGHT_OPACITY,
41
44
  PRESS_DURATION,
42
45
  PRESS_SCALE,
46
+ Portal,
47
+ PortalContext,
48
+ PortalHost,
43
49
  PressableFeedback,
44
50
  RELEASE_DURATION,
45
51
  RIPPLE_COVERAGE,
@@ -16,7 +16,10 @@
16
16
 
17
17
 
18
18
 
19
- var _chunkV63JO65Fcjs = require('../chunk-V63JO65F.cjs');
19
+
20
+
21
+
22
+ var _chunkIYFGO523cjs = require('../chunk-IYFGO523.cjs');
20
23
  require('../chunk-3QBT3Q65.cjs');
21
24
 
22
25
 
@@ -36,4 +39,7 @@ require('../chunk-3QBT3Q65.cjs');
36
39
 
37
40
 
38
41
 
39
- exports.HIGHLIGHT_OPACITY = _chunkV63JO65Fcjs.HIGHLIGHT_OPACITY; exports.PRESS_DURATION = _chunkV63JO65Fcjs.PRESS_DURATION; exports.PRESS_SCALE = _chunkV63JO65Fcjs.PRESS_SCALE; exports.PressableFeedback = _chunkV63JO65Fcjs.PressableFeedback; exports.RELEASE_DURATION = _chunkV63JO65Fcjs.RELEASE_DURATION; exports.RIPPLE_COVERAGE = _chunkV63JO65Fcjs.RIPPLE_COVERAGE; exports.RIPPLE_DURATION = _chunkV63JO65Fcjs.RIPPLE_DURATION; exports.RIPPLE_OPACITY = _chunkV63JO65Fcjs.RIPPLE_OPACITY; exports.Slot = _chunkV63JO65Fcjs.Slot; exports.childrenToString = _chunkV63JO65Fcjs.childrenToString; exports.createRecipe = _chunkV63JO65Fcjs.createRecipe; exports.createSlotContext = _chunkV63JO65Fcjs.createSlotContext; exports.mergeProps = _chunkV63JO65Fcjs.mergeProps; exports.mergeRefs = _chunkV63JO65Fcjs.mergeRefs; exports.resolveAnimation = _chunkV63JO65Fcjs.resolveAnimation; exports.resolveSlotAnimation = _chunkV63JO65Fcjs.resolveSlotAnimation; exports.useFeedback = _chunkV63JO65Fcjs.useFeedback;
42
+
43
+
44
+
45
+ exports.HIGHLIGHT_OPACITY = _chunkIYFGO523cjs.HIGHLIGHT_OPACITY; exports.PRESS_DURATION = _chunkIYFGO523cjs.PRESS_DURATION; exports.PRESS_SCALE = _chunkIYFGO523cjs.PRESS_SCALE; exports.Portal = _chunkIYFGO523cjs.Portal; exports.PortalContext = _chunkIYFGO523cjs.PortalContext; exports.PortalHost = _chunkIYFGO523cjs.PortalHost; exports.PressableFeedback = _chunkIYFGO523cjs.PressableFeedback; exports.RELEASE_DURATION = _chunkIYFGO523cjs.RELEASE_DURATION; exports.RIPPLE_COVERAGE = _chunkIYFGO523cjs.RIPPLE_COVERAGE; exports.RIPPLE_DURATION = _chunkIYFGO523cjs.RIPPLE_DURATION; exports.RIPPLE_OPACITY = _chunkIYFGO523cjs.RIPPLE_OPACITY; exports.Slot = _chunkIYFGO523cjs.Slot; exports.childrenToString = _chunkIYFGO523cjs.childrenToString; exports.createRecipe = _chunkIYFGO523cjs.createRecipe; exports.createSlotContext = _chunkIYFGO523cjs.createSlotContext; exports.mergeProps = _chunkIYFGO523cjs.mergeProps; exports.mergeRefs = _chunkIYFGO523cjs.mergeRefs; exports.resolveAnimation = _chunkIYFGO523cjs.resolveAnimation; exports.resolveSlotAnimation = _chunkIYFGO523cjs.resolveSlotAnimation; exports.useFeedback = _chunkIYFGO523cjs.useFeedback;
@@ -5,6 +5,48 @@ import { PressableProps, StyleProp, ViewStyle, TextStyle } from 'react-native';
5
5
  import { SharedValue } from 'react-native-reanimated';
6
6
  import { g as XAUITheme, X as XAUIColors } from '../theme.type-C9bFJKFm.cjs';
7
7
 
8
+ type PortalProps = {
9
+ children: ReactNode;
10
+ };
11
+ /**
12
+ * Renders its children into the nearest `PortalHost` instead of where it sits. What
13
+ * `Dialog`, `Sheet`, `Drawer` and `Snackbar` are built on: an overlay has to escape the
14
+ * clipping and stacking of whatever container happened to hold the trigger.
15
+ *
16
+ * Both halves run in layout effects rather than effects, which is deliberate: the content
17
+ * lands in the same commit as the trigger's, so an overlay neither shows one frame late
18
+ * nor survives one frame past the unmount that closed it. The unpublish sits in its own
19
+ * effect so that it does not depend on `children` — a re-publish then keeps the portal's
20
+ * place in the host's order instead of dropping it and re-adding it at the end.
21
+ */
22
+ declare function Portal({ children }: PortalProps): null;
23
+ declare namespace Portal {
24
+ var displayName: string;
25
+ }
26
+
27
+ type PortalMethods = {
28
+ addPortal: (key: string, element: ReactNode) => void;
29
+ removePortal: (key: string) => void;
30
+ };
31
+ /**
32
+ * `null` outside a host, and `Portal` treats that as "render nothing" rather than
33
+ * throwing: an app that forgot `PortalHost` should lose its overlays, not crash on the
34
+ * first `Dialog`.
35
+ */
36
+ declare const PortalContext: react.Context<PortalMethods | null>;
37
+
38
+ type PortalHostProps = {
39
+ children: ReactNode;
40
+ };
41
+ /**
42
+ * Where every `Portal` in the tree below renders. Mounted once, at the root of the app,
43
+ * above navigation — an overlay that renders inside a screen is clipped by it.
44
+ */
45
+ declare function PortalHost({ children }: PortalHostProps): react.JSX.Element;
46
+ declare namespace PortalHost {
47
+ var displayName: string;
48
+ }
49
+
8
50
  /**
9
51
  * What the root does under the finger. `scale-highlight` and `scale-ripple` mount their
10
52
  * overlay themselves; `scale` mounts none, which is what a root picks when it renders its
@@ -169,7 +211,7 @@ type ResolvedSlotAnimation = {
169
211
  */
170
212
  declare function resolveSlotAnimation(override: SlotAnimation | undefined, enabledByRoot: boolean, defaultOpacity: number, defaultDuration?: number): ResolvedSlotAnimation;
171
213
 
172
- declare const PressableFeedback: react.ForwardRefExoticComponent<Omit<react_native.PressableProps, "disabled" | "style" | "children"> & {
214
+ declare const PressableFeedback: react.ForwardRefExoticComponent<Omit<react_native.PressableProps, "children" | "style" | "disabled"> & {
173
215
  isPressed?: boolean;
174
216
  isDisabled?: boolean;
175
217
  asChild?: boolean;
@@ -350,4 +392,4 @@ type SlotProps = MergeableProps & {
350
392
  */
351
393
  declare const Slot: react.ForwardRefExoticComponent<Omit<SlotProps, "ref"> & react.RefAttributes<unknown>>;
352
394
 
353
- export { type AnimationConfig, type AnimationProp, type AsChildProps, type Axes, type CompoundVariant, type FeedbackContext, type FeedbackVariant, HIGHLIGHT_OPACITY, type MergeableProps, PRESS_DURATION, PRESS_SCALE, type PossibleRef, PressableFeedback, type PressableFeedbackHighlightProps, type PressableFeedbackProps, type PressableFeedbackRippleProps, RELEASE_DURATION, RIPPLE_COVERAGE, RIPPLE_DURATION, RIPPLE_OPACITY, type Recipe, type RecipeConfig, type ResolveArgs, type ResolvedAnimation, type ResolvedSelection, type ResolvedStyles, type Selection, Slot, type SlotAnimation, type SlotProps, type SlotStyle, type SlotStyles, type StateName, type States, type StyleFn, type TintArgs, type VariantColors, type VariantRole, type VariantTokens, childrenToString, createRecipe, createSlotContext, mergeProps, mergeRefs, resolveAnimation, resolveSlotAnimation, useFeedback };
395
+ export { type AnimationConfig, type AnimationProp, type AsChildProps, type Axes, type CompoundVariant, type FeedbackContext, type FeedbackVariant, HIGHLIGHT_OPACITY, type MergeableProps, PRESS_DURATION, PRESS_SCALE, Portal, PortalContext, PortalHost, type PortalHostProps, type PortalMethods, type PortalProps, type PossibleRef, PressableFeedback, type PressableFeedbackHighlightProps, type PressableFeedbackProps, type PressableFeedbackRippleProps, RELEASE_DURATION, RIPPLE_COVERAGE, RIPPLE_DURATION, RIPPLE_OPACITY, type Recipe, type RecipeConfig, type ResolveArgs, type ResolvedAnimation, type ResolvedSelection, type ResolvedStyles, type Selection, Slot, type SlotAnimation, type SlotProps, type SlotStyle, type SlotStyles, type StateName, type States, type StyleFn, type TintArgs, type VariantColors, type VariantRole, type VariantTokens, childrenToString, createRecipe, createSlotContext, mergeProps, mergeRefs, resolveAnimation, resolveSlotAnimation, useFeedback };
@@ -5,6 +5,48 @@ import { PressableProps, StyleProp, ViewStyle, TextStyle } from 'react-native';
5
5
  import { SharedValue } from 'react-native-reanimated';
6
6
  import { g as XAUITheme, X as XAUIColors } from '../theme.type-C9bFJKFm.js';
7
7
 
8
+ type PortalProps = {
9
+ children: ReactNode;
10
+ };
11
+ /**
12
+ * Renders its children into the nearest `PortalHost` instead of where it sits. What
13
+ * `Dialog`, `Sheet`, `Drawer` and `Snackbar` are built on: an overlay has to escape the
14
+ * clipping and stacking of whatever container happened to hold the trigger.
15
+ *
16
+ * Both halves run in layout effects rather than effects, which is deliberate: the content
17
+ * lands in the same commit as the trigger's, so an overlay neither shows one frame late
18
+ * nor survives one frame past the unmount that closed it. The unpublish sits in its own
19
+ * effect so that it does not depend on `children` — a re-publish then keeps the portal's
20
+ * place in the host's order instead of dropping it and re-adding it at the end.
21
+ */
22
+ declare function Portal({ children }: PortalProps): null;
23
+ declare namespace Portal {
24
+ var displayName: string;
25
+ }
26
+
27
+ type PortalMethods = {
28
+ addPortal: (key: string, element: ReactNode) => void;
29
+ removePortal: (key: string) => void;
30
+ };
31
+ /**
32
+ * `null` outside a host, and `Portal` treats that as "render nothing" rather than
33
+ * throwing: an app that forgot `PortalHost` should lose its overlays, not crash on the
34
+ * first `Dialog`.
35
+ */
36
+ declare const PortalContext: react.Context<PortalMethods | null>;
37
+
38
+ type PortalHostProps = {
39
+ children: ReactNode;
40
+ };
41
+ /**
42
+ * Where every `Portal` in the tree below renders. Mounted once, at the root of the app,
43
+ * above navigation — an overlay that renders inside a screen is clipped by it.
44
+ */
45
+ declare function PortalHost({ children }: PortalHostProps): react.JSX.Element;
46
+ declare namespace PortalHost {
47
+ var displayName: string;
48
+ }
49
+
8
50
  /**
9
51
  * What the root does under the finger. `scale-highlight` and `scale-ripple` mount their
10
52
  * overlay themselves; `scale` mounts none, which is what a root picks when it renders its
@@ -169,7 +211,7 @@ type ResolvedSlotAnimation = {
169
211
  */
170
212
  declare function resolveSlotAnimation(override: SlotAnimation | undefined, enabledByRoot: boolean, defaultOpacity: number, defaultDuration?: number): ResolvedSlotAnimation;
171
213
 
172
- declare const PressableFeedback: react.ForwardRefExoticComponent<Omit<react_native.PressableProps, "disabled" | "style" | "children"> & {
214
+ declare const PressableFeedback: react.ForwardRefExoticComponent<Omit<react_native.PressableProps, "children" | "style" | "disabled"> & {
173
215
  isPressed?: boolean;
174
216
  isDisabled?: boolean;
175
217
  asChild?: boolean;
@@ -350,4 +392,4 @@ type SlotProps = MergeableProps & {
350
392
  */
351
393
  declare const Slot: react.ForwardRefExoticComponent<Omit<SlotProps, "ref"> & react.RefAttributes<unknown>>;
352
394
 
353
- export { type AnimationConfig, type AnimationProp, type AsChildProps, type Axes, type CompoundVariant, type FeedbackContext, type FeedbackVariant, HIGHLIGHT_OPACITY, type MergeableProps, PRESS_DURATION, PRESS_SCALE, type PossibleRef, PressableFeedback, type PressableFeedbackHighlightProps, type PressableFeedbackProps, type PressableFeedbackRippleProps, RELEASE_DURATION, RIPPLE_COVERAGE, RIPPLE_DURATION, RIPPLE_OPACITY, type Recipe, type RecipeConfig, type ResolveArgs, type ResolvedAnimation, type ResolvedSelection, type ResolvedStyles, type Selection, Slot, type SlotAnimation, type SlotProps, type SlotStyle, type SlotStyles, type StateName, type States, type StyleFn, type TintArgs, type VariantColors, type VariantRole, type VariantTokens, childrenToString, createRecipe, createSlotContext, mergeProps, mergeRefs, resolveAnimation, resolveSlotAnimation, useFeedback };
395
+ export { type AnimationConfig, type AnimationProp, type AsChildProps, type Axes, type CompoundVariant, type FeedbackContext, type FeedbackVariant, HIGHLIGHT_OPACITY, type MergeableProps, PRESS_DURATION, PRESS_SCALE, Portal, PortalContext, PortalHost, type PortalHostProps, type PortalMethods, type PortalProps, type PossibleRef, PressableFeedback, type PressableFeedbackHighlightProps, type PressableFeedbackProps, type PressableFeedbackRippleProps, RELEASE_DURATION, RIPPLE_COVERAGE, RIPPLE_DURATION, RIPPLE_OPACITY, type Recipe, type RecipeConfig, type ResolveArgs, type ResolvedAnimation, type ResolvedSelection, type ResolvedStyles, type Selection, Slot, type SlotAnimation, type SlotProps, type SlotStyle, type SlotStyles, type StateName, type States, type StyleFn, type TintArgs, type VariantColors, type VariantRole, type VariantTokens, childrenToString, createRecipe, createSlotContext, mergeProps, mergeRefs, resolveAnimation, resolveSlotAnimation, useFeedback };
@@ -2,6 +2,9 @@ import {
2
2
  HIGHLIGHT_OPACITY,
3
3
  PRESS_DURATION,
4
4
  PRESS_SCALE,
5
+ Portal,
6
+ PortalContext,
7
+ PortalHost,
5
8
  PressableFeedback,
6
9
  RELEASE_DURATION,
7
10
  RIPPLE_COVERAGE,
@@ -16,12 +19,15 @@ import {
16
19
  resolveAnimation,
17
20
  resolveSlotAnimation,
18
21
  useFeedback
19
- } from "../chunk-QAMNNTGM.js";
22
+ } from "../chunk-ECDWSSHJ.js";
20
23
  import "../chunk-X2K2FX3W.js";
21
24
  export {
22
25
  HIGHLIGHT_OPACITY,
23
26
  PRESS_DURATION,
24
27
  PRESS_SCALE,
28
+ Portal,
29
+ PortalContext,
30
+ PortalHost,
25
31
  PressableFeedback,
26
32
  RELEASE_DURATION,
27
33
  RIPPLE_COVERAGE,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaui/native",
3
- "version": "0.9.1-alpha.3",
3
+ "version": "0.9.1-alpha.4",
4
4
  "description": "Composition-first React Native UI components with native animations powered by Reanimated",
5
5
  "keywords": [
6
6
  "react-native",