@xaui/native 0.9.1-alpha.2 → 0.9.1-alpha.20

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.
Files changed (53) hide show
  1. package/dist/chunk-2WMVDMFV.cjs +62 -0
  2. package/dist/chunk-33QILJJH.cjs +143 -0
  3. package/dist/chunk-4EPS7UBO.js +496 -0
  4. package/dist/{chunk-M7P46XKI.cjs → chunk-57SJ4LJF.cjs} +33 -3
  5. package/dist/chunk-6ARON3XT.cjs +534 -0
  6. package/dist/{chunk-RBNCR5KB.js → chunk-A3EGFI6T.js} +31 -1
  7. package/dist/chunk-A4VD4MHK.cjs +757 -0
  8. package/dist/{chunk-NHPQQQ7P.cjs → chunk-BHTFIZTQ.cjs} +55 -88
  9. package/dist/chunk-EVXZGNPA.cjs +303 -0
  10. package/dist/chunk-EXX6ATAS.js +303 -0
  11. package/dist/chunk-GGW42MY4.js +20 -0
  12. package/dist/chunk-JXLRHKCQ.js +143 -0
  13. package/dist/chunk-MC7SY2QH.cjs +20 -0
  14. package/dist/{chunk-PBVPOX7D.js → chunk-MWXE7D4L.js} +29 -62
  15. package/dist/{chunk-RCP3SD26.js → chunk-N7C4UNUL.js} +2 -126
  16. package/dist/chunk-RMLFMRWL.js +102 -0
  17. package/dist/chunk-UBA6AEY6.cjs +102 -0
  18. package/dist/{chunk-B755PRVJ.cjs → chunk-UVO4GFSW.cjs} +3 -127
  19. package/dist/chunk-WXAME7KB.js +728 -0
  20. package/dist/chunk-XHZBXYVU.js +62 -0
  21. package/dist/components/button/index.cjs +15 -0
  22. package/dist/components/button/index.d.cts +658 -0
  23. package/dist/components/button/index.d.ts +658 -0
  24. package/dist/components/button/index.js +15 -0
  25. package/dist/components/typography/index.cjs +14 -0
  26. package/dist/components/typography/index.d.cts +116 -0
  27. package/dist/components/typography/index.d.ts +116 -0
  28. package/dist/components/typography/index.js +14 -0
  29. package/dist/components/view/index.cjs +16 -0
  30. package/dist/components/view/index.d.cts +152 -0
  31. package/dist/components/view/index.d.ts +152 -0
  32. package/dist/components/view/index.js +16 -0
  33. package/dist/create-recipe-C0XXjuow.d.cts +89 -0
  34. package/dist/create-recipe-CPXFo2rk.d.ts +89 -0
  35. package/dist/index.cjs +151 -5
  36. package/dist/index.d.cts +77 -4
  37. package/dist/index.d.ts +77 -4
  38. package/dist/index.js +155 -9
  39. package/dist/pressable-feedback.type-1K8YEOb8.d.cts +195 -0
  40. package/dist/pressable-feedback.type-BwkKLQlX.d.ts +195 -0
  41. package/dist/style-props.type-B1BG5TCm.d.cts +31 -0
  42. package/dist/style-props.type-B1BG5TCm.d.ts +31 -0
  43. package/dist/system/index.cjs +64 -3
  44. package/dist/system/index.d.cts +299 -75
  45. package/dist/system/index.d.ts +299 -75
  46. package/dist/system/index.js +66 -5
  47. package/dist/theme/index.cjs +4 -3
  48. package/dist/theme/index.d.cts +26 -14
  49. package/dist/theme/index.d.ts +26 -14
  50. package/dist/theme/index.js +7 -6
  51. package/dist/{theme.type-B3ODSLbB.d.cts → theme.type-C2gNHpEx.d.cts} +8 -2
  52. package/dist/{theme.type-B3ODSLbB.d.ts → theme.type-C2gNHpEx.d.ts} +8 -2
  53. package/package.json +64 -18
@@ -0,0 +1,728 @@
1
+ import { Slot, createSlotContext, useStyleProps } from "./chunk-EXX6ATAS.js";
2
+ import { contrastOn, isHex, useXAUITheme } from "./chunk-A3EGFI6T.js";
3
+
4
+ // src/system/icon/icon-context.ts
5
+ import { createContext, useContext } from "react";
6
+ var IconContext = createContext({});
7
+ IconContext.displayName = "XAUI.Icon.Context";
8
+ function useIconContext() {
9
+ return useContext(IconContext);
10
+ }
11
+
12
+ // src/system/icon/icon.tsx
13
+ import { cloneElement, isValidElement } from "react";
14
+ import { Image } from "react-native";
15
+ import { jsx } from "react/jsx-runtime";
16
+ function Icon(props) {
17
+ const inherited = useIconContext();
18
+ const theme = useXAUITheme();
19
+ const size = props.size ?? inherited.size ?? theme.fontSizes.md;
20
+ const color = props.color ?? inherited.color ?? theme.colors.foreground;
21
+ if (props.as) {
22
+ const Component = props.as;
23
+ return /* @__PURE__ */jsx(Component, {
24
+ size,
25
+ color
26
+ });
27
+ }
28
+ if (isValidElement(props.children)) {
29
+ return cloneElement(props.children, {
30
+ width: size,
31
+ height: size,
32
+ color
33
+ });
34
+ }
35
+ if (props.source) return /* @__PURE__ */jsx(IconImage, {
36
+ ...props,
37
+ resolved: {
38
+ size,
39
+ color
40
+ }
41
+ });
42
+ throw new Error("XAUI: Icon needs one of `as` (an icon component), a raw SVG element as its child, or `source` (an image). It renders nothing on its own.");
43
+ }
44
+ Icon.displayName = "XAUI.Icon";
45
+ function IconImage({
46
+ source,
47
+ style,
48
+ resolved,
49
+ size: _size,
50
+ color: _color,
51
+ ...props
52
+ }) {
53
+ const [styleProps] = useStyleProps(props);
54
+ return /* @__PURE__ */jsx(Image, {
55
+ source,
56
+ style: [{
57
+ width: resolved.size,
58
+ height: resolved.size,
59
+ tintColor: resolved.color
60
+ }, styleProps, style]
61
+ });
62
+ }
63
+
64
+ // src/system/pressable-feedback/pressable-feedback-context.ts
65
+ import { createContext as createContext2 } from "react";
66
+ var [FeedbackProvider, useFeedback] = createSlotContext("PressableFeedback");
67
+ var DisableAllContext = createContext2(false);
68
+
69
+ // src/system/pressable-feedback/pressable-feedback.animation.ts
70
+ var PRESS_SCALE = 0.985;
71
+ var PRESS_DURATION = 300;
72
+ var SCALE_REFERENCE_WIDTH = 300;
73
+ const _worklet_1477207651784_init_data = {
74
+ code: "function pressScaleFor_chunkWXAME7KBJs1(width){const{SCALE_REFERENCE_WIDTH,PRESS_SCALE}=this.__closure;const coefficient=width>0?SCALE_REFERENCE_WIDTH/width:1;return 1-(1-PRESS_SCALE)*coefficient;}",
75
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-WXAME7KB.js",
76
+ sourceMap: "{\"version\":3,\"names\":[\"pressScaleFor_chunkWXAME7KBJs1\",\"width\",\"SCALE_REFERENCE_WIDTH\",\"PRESS_SCALE\",\"__closure\",\"coefficient\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-WXAME7KB.js\"],\"mappings\":\"AA4EA,SAAAA,8BAA8BA,CAAAC,KAAA,QAAAC,qBAAA,CAAAC,WAAA,OAAAC,SAAA,CAE5B,KAAM,CAAAC,WAAW,CAAGJ,KAAK,CAAG,CAAC,CAAGC,qBAAqB,CAAGD,KAAK,CAAG,CAAC,CACjE,MAAO,EAAC,CAAG,CAAC,CAAC,CAAGE,WAAW,EAAIE,WAAW,CAC5C\",\"ignoreList\":[]}"
77
+ };
78
+ const pressScaleFor = function pressScaleFor_chunkWXAME7KBJs1Factory({
79
+ _worklet_1477207651784_init_data,
80
+ SCALE_REFERENCE_WIDTH,
81
+ PRESS_SCALE
82
+ }) {
83
+ const _e = [new global.Error(), -3, -27];
84
+ const pressScaleFor = function (width) {
85
+ const coefficient = width > 0 ? SCALE_REFERENCE_WIDTH / width : 1;
86
+ return 1 - (1 - PRESS_SCALE) * coefficient;
87
+ };
88
+ pressScaleFor.__closure = {
89
+ SCALE_REFERENCE_WIDTH,
90
+ PRESS_SCALE
91
+ };
92
+ pressScaleFor.__workletHash = 1477207651784;
93
+ pressScaleFor.__pluginVersion = "0.7.4";
94
+ pressScaleFor.__initData = _worklet_1477207651784_init_data;
95
+ pressScaleFor.__stackDetails = _e;
96
+ return pressScaleFor;
97
+ }({
98
+ _worklet_1477207651784_init_data,
99
+ SCALE_REFERENCE_WIDTH,
100
+ PRESS_SCALE
101
+ });
102
+ var HIGHLIGHT_OPACITY = 0.1;
103
+ var HIGHLIGHT_DURATION = 200;
104
+ var RIPPLE_OPACITY = 0.1;
105
+ var RIPPLE_START_SCALE = 0.3;
106
+ var RIPPLE_EXPAND_DURATION = 1e3;
107
+ var RIPPLE_CONFIRM_DURATION = 225;
108
+ var RIPPLE_FADE_IN = 75;
109
+ var RIPPLE_FADE_OUT_DELAY = 225;
110
+ var RIPPLE_FADE_OUT = 150;
111
+ const _worklet_6998368132659_init_data = {
112
+ code: "function rippleRadiusFor_chunkWXAME7KBJs2(width,height){return Math.sqrt(width*width+height*height)/2+5;}",
113
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-WXAME7KB.js",
114
+ sourceMap: "{\"version\":3,\"names\":[\"rippleRadiusFor_chunkWXAME7KBJs2\",\"width\",\"height\",\"Math\",\"sqrt\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-WXAME7KB.js\"],\"mappings\":\"AA0FA,SAAAA,gCAAwCA,CAAAC,KAAA,CAAAC,MAAA,EAEtC,MAAO,CAAAC,IAAI,CAACC,IAAI,CAACH,KAAK,CAAGA,KAAK,CAAGC,MAAM,CAAGA,MAAM,CAAC,CAAG,CAAC,CAAG,CAAC,CAC3D\",\"ignoreList\":[]}"
115
+ };
116
+ const rippleRadiusFor = function rippleRadiusFor_chunkWXAME7KBJs2Factory({
117
+ _worklet_6998368132659_init_data
118
+ }) {
119
+ const _e = [new global.Error(), 1, -27];
120
+ const rippleRadiusFor = function (width, height) {
121
+ return Math.sqrt(width * width + height * height) / 2 + 5;
122
+ };
123
+ rippleRadiusFor.__closure = {};
124
+ rippleRadiusFor.__workletHash = 6998368132659;
125
+ rippleRadiusFor.__pluginVersion = "0.7.4";
126
+ rippleRadiusFor.__initData = _worklet_6998368132659_init_data;
127
+ rippleRadiusFor.__stackDetails = _e;
128
+ return rippleRadiusFor;
129
+ }({
130
+ _worklet_6998368132659_init_data
131
+ });
132
+ var ALL_OFF = {
133
+ scale: false,
134
+ highlight: false,
135
+ ripple: false,
136
+ none: true
137
+ };
138
+ var ALL_ON = {
139
+ scale: true,
140
+ highlight: true,
141
+ ripple: true,
142
+ none: false
143
+ };
144
+ function resolveAnimation(animation, inheritedDisableAll = false) {
145
+ if (inheritedDisableAll) return {
146
+ ...ALL_OFF,
147
+ disableAll: true
148
+ };
149
+ if (animation === false || animation === "disabled") {
150
+ return {
151
+ ...ALL_OFF,
152
+ disableAll: false
153
+ };
154
+ }
155
+ if (animation === "disable-all") return {
156
+ ...ALL_OFF,
157
+ disableAll: true
158
+ };
159
+ if (animation === void 0 || animation === true) {
160
+ return {
161
+ ...ALL_ON,
162
+ disableAll: false
163
+ };
164
+ }
165
+ const scale = animation.scale ?? true;
166
+ const highlight = animation.highlight ?? true;
167
+ const ripple = animation.ripple ?? true;
168
+ return {
169
+ scale,
170
+ highlight,
171
+ ripple,
172
+ none: !scale && !highlight && !ripple,
173
+ disableAll: false
174
+ };
175
+ }
176
+ function resolveSlotAnimation(override, enabledByRoot, defaultOpacity, defaultDuration = PRESS_DURATION) {
177
+ const fallback = {
178
+ enabled: enabledByRoot,
179
+ duration: defaultDuration,
180
+ opacity: defaultOpacity
181
+ };
182
+ if (override === void 0 || override === true) return fallback;
183
+ if (override === false) return {
184
+ ...fallback,
185
+ enabled: false
186
+ };
187
+ return {
188
+ enabled: enabledByRoot,
189
+ duration: override.duration ?? defaultDuration,
190
+ opacity: override.opacity ?? defaultOpacity
191
+ };
192
+ }
193
+
194
+ // src/system/pressable-feedback/pressable-feedback.overlay.ts
195
+ import { Children, Fragment, createElement, isValidElement as isValidElement2 } from "react";
196
+ var FEEDBACK_OVERLAY = /* @__PURE__ */Symbol.for("xaui.PressableFeedback.overlay");
197
+ function markOverlay(component) {
198
+ return Object.assign(component, {
199
+ [FEEDBACK_OVERLAY]: true
200
+ });
201
+ }
202
+ function isBareOverlay(node) {
203
+ if (!isValidElement2(node)) return false;
204
+ const type = node.type;
205
+ if (typeof type !== "function" && typeof type !== "object") return false;
206
+ if (type === null) return false;
207
+ if (type[FEEDBACK_OVERLAY] !== true) return false;
208
+ return node.props.children === void 0;
209
+ }
210
+ function partitionOverlays(children) {
211
+ const all = Children.toArray(children);
212
+ const overlays = all.filter(isBareOverlay);
213
+ if (overlays.length === 0) return {
214
+ overlays: null,
215
+ content: children
216
+ };
217
+ return {
218
+ overlays,
219
+ content: all.filter(node => !isBareOverlay(node))
220
+ };
221
+ }
222
+ function feedbackChildren(children, asChild) {
223
+ if (asChild) return children;
224
+ const {
225
+ overlays,
226
+ content
227
+ } = partitionOverlays(children);
228
+ if (overlays === null) return content;
229
+ return createElement(Fragment, null, overlays, content);
230
+ }
231
+
232
+ // src/system/pressable-feedback/pressable-feedback.tsx
233
+ import { forwardRef, useContext as useContext2, useEffect, useMemo, useRef } from "react";
234
+ import { Pressable, StyleSheet } from "react-native";
235
+ import Animated, { Easing, useAnimatedStyle, useDerivedValue, useSharedValue, withDelay, withTiming } from "react-native-reanimated";
236
+
237
+ // src/system/pressable-feedback/pressable-feedback.surface.ts
238
+ function inkFor(background, colors) {
239
+ if (typeof background !== "string" || !isHex(background)) return colors.foreground;
240
+ return contrastOn(background, colors.snow, colors.eclipse);
241
+ }
242
+ var RADIUS_KEYS = ["borderRadius", "borderStartStartRadius", "borderStartEndRadius", "borderEndStartRadius", "borderEndEndRadius"];
243
+ function radiusFrom(style) {
244
+ if (!style) return {};
245
+ const radius = {};
246
+ for (const key of RADIUS_KEYS) {
247
+ const value = style[key];
248
+ if (value !== void 0) radius[key] = value;
249
+ }
250
+ return radius;
251
+ }
252
+
253
+ // src/system/pressable-feedback/pressable-feedback.tsx
254
+ import { jsx as jsx2 } from "react/jsx-runtime";
255
+ var AnimatedPressable = Animated.createAnimatedComponent(Pressable);
256
+ var AnimatedSlot = Animated.createAnimatedComponent(Slot);
257
+ var PressableFeedback = forwardRef(function PressableFeedback2({
258
+ animation,
259
+ style,
260
+ ...props
261
+ }, ref) {
262
+ const inheritedDisableAll = useContext2(DisableAllContext);
263
+ const resolved = resolveAnimation(animation, inheritedDisableAll);
264
+ const [styleProps, rest] = useStyleProps(props);
265
+ const Feedback = resolved.none ? StaticFeedback : AnimatedFeedback;
266
+ const body = /* @__PURE__ */jsx2(Feedback, {
267
+ ref,
268
+ animation: resolved,
269
+ style: [styleProps, style],
270
+ ...rest
271
+ });
272
+ return resolved.disableAll ? /* @__PURE__ */jsx2(DisableAllContext.Provider, {
273
+ value: true,
274
+ children: body
275
+ }) : body;
276
+ });
277
+ var StaticFeedback = forwardRef(function StaticFeedback2({
278
+ isPressed = false,
279
+ isDisabled,
280
+ asChild = false,
281
+ animation,
282
+ children,
283
+ style,
284
+ ...rest
285
+ }, ref) {
286
+ const surface = useSurface(style);
287
+ const context = useMemo(() => ({
288
+ isPressed,
289
+ animation,
290
+ ...surface
291
+ }), [isPressed, animation, surface]);
292
+ const Root = asChild ? Slot : Pressable;
293
+ return /* @__PURE__ */jsx2(FeedbackProvider, {
294
+ value: context,
295
+ children: /* @__PURE__ */jsx2(Root, {
296
+ ref,
297
+ style,
298
+ disabled: isDisabled,
299
+ ...rest,
300
+ children: feedbackChildren(children, asChild)
301
+ })
302
+ });
303
+ });
304
+ const _worklet_3682262406534_init_data = {
305
+ code: "function chunkWXAME7KBJs3(){const{pressScaleFor,size}=this.__closure;return pressScaleFor(size.value.width);}",
306
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-WXAME7KB.js",
307
+ sourceMap: "{\"version\":3,\"names\":[\"chunkWXAME7KBJs3\",\"pressScaleFor\",\"size\",\"__closure\",\"value\",\"width\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-WXAME7KB.js\"],\"mappings\":\"AAwQuC,SAAAA,iBAAA,QAAAC,aAAA,CAAAC,IAAA,OAAAC,SAAA,OAAM,CAAAF,aAAc,CAAAC,IAAK,CAAAE,KAAM,CAAAC,KAAK\",\"ignoreList\":[]}"
308
+ };
309
+ const _worklet_10640067524054_init_data = {
310
+ code: "function chunkWXAME7KBJs4(){const{animation,pressedScale,progress}=this.__closure;if(!animation.scale)return{};return{transform:[{scale:1-(1-pressedScale.value)*progress.value}]};}",
311
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-WXAME7KB.js",
312
+ sourceMap: "{\"version\":3,\"names\":[\"chunkWXAME7KBJs4\",\"animation\",\"pressedScale\",\"progress\",\"__closure\",\"scale\",\"transform\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-WXAME7KB.js\"],\"mappings\":\"AAyQyC,SAAAA,gBAAMA,CAAA,QAAAC,SAAA,CAAAC,YAAA,CAAAC,QAAA,OAAAC,SAAA,CAE3C,GAAI,CAACH,SAAS,CAACI,KAAK,CAAE,MAAO,CAAC,CAAC,CAC/B,MAAO,CAAEC,SAAS,CAAE,CAAC,CAAED,KAAK,CAAE,CAAC,CAAG,CAAC,CAAC,CAAGH,YAAY,CAACK,KAAK,EAAIJ,QAAQ,CAACI,KAAM,CAAC,CAAE,CAAC,CAClF\",\"ignoreList\":[]}"
313
+ };
314
+ var AnimatedFeedback = forwardRef(function AnimatedFeedback2({
315
+ isPressed = false,
316
+ isDisabled,
317
+ asChild = false,
318
+ animation,
319
+ children,
320
+ style,
321
+ onLayout,
322
+ onTouchStart,
323
+ onTouchEnd,
324
+ onTouchCancel,
325
+ ...rest
326
+ }, ref) {
327
+ const progress = useSharedValue(0);
328
+ const size = useSharedValue({
329
+ width: 0,
330
+ height: 0
331
+ });
332
+ const waves = [useWave(), useWave()];
333
+ const nextWave = useRef(0);
334
+ useEffect(() => {
335
+ progress.value = withTiming(isPressed ? 1 : 0, {
336
+ duration: PRESS_DURATION,
337
+ easing: Easing.out(Easing.ease)
338
+ });
339
+ }, [isPressed, progress]);
340
+ const pressedScale = useDerivedValue(function chunkWXAME7KBJs3Factory({
341
+ _worklet_3682262406534_init_data,
342
+ pressScaleFor,
343
+ size
344
+ }) {
345
+ const _e = [new global.Error(), -3, -27];
346
+ const chunkWXAME7KBJs3 = () => pressScaleFor(size.value.width);
347
+ chunkWXAME7KBJs3.__closure = {
348
+ pressScaleFor,
349
+ size
350
+ };
351
+ chunkWXAME7KBJs3.__workletHash = 3682262406534;
352
+ chunkWXAME7KBJs3.__pluginVersion = "0.7.4";
353
+ chunkWXAME7KBJs3.__initData = _worklet_3682262406534_init_data;
354
+ chunkWXAME7KBJs3.__stackDetails = _e;
355
+ return chunkWXAME7KBJs3;
356
+ }({
357
+ _worklet_3682262406534_init_data,
358
+ pressScaleFor,
359
+ size
360
+ }));
361
+ const animatedStyle = useAnimatedStyle(function chunkWXAME7KBJs4Factory({
362
+ _worklet_10640067524054_init_data,
363
+ animation,
364
+ pressedScale,
365
+ progress
366
+ }) {
367
+ const _e = [new global.Error(), -4, -27];
368
+ const chunkWXAME7KBJs4 = function () {
369
+ if (!animation.scale) return {};
370
+ return {
371
+ transform: [{
372
+ scale: 1 - (1 - pressedScale.value) * progress.value
373
+ }]
374
+ };
375
+ };
376
+ chunkWXAME7KBJs4.__closure = {
377
+ animation,
378
+ pressedScale,
379
+ progress
380
+ };
381
+ chunkWXAME7KBJs4.__workletHash = 10640067524054;
382
+ chunkWXAME7KBJs4.__pluginVersion = "0.7.4";
383
+ chunkWXAME7KBJs4.__initData = _worklet_10640067524054_init_data;
384
+ chunkWXAME7KBJs4.__stackDetails = _e;
385
+ return chunkWXAME7KBJs4;
386
+ }({
387
+ _worklet_10640067524054_init_data,
388
+ animation,
389
+ pressedScale,
390
+ progress
391
+ }), [animation.scale, progress, pressedScale]);
392
+ const surface = useSurface(style);
393
+ const context = useMemo(() => ({
394
+ isPressed,
395
+ animation,
396
+ progress,
397
+ size,
398
+ waves,
399
+ ...surface
400
+ }), [isPressed, animation, progress, size, waves, surface]);
401
+ const handleTouchStart = event => {
402
+ const wave = waves[nextWave.current];
403
+ nextWave.current = nextWave.current === 0 ? 1 : 0;
404
+ const {
405
+ locationX,
406
+ locationY
407
+ } = event.nativeEvent;
408
+ wave.origin.value = {
409
+ x: locationX,
410
+ y: locationY
411
+ };
412
+ wave.expand.value = 0;
413
+ wave.expand.value = withTiming(1, {
414
+ duration: RIPPLE_EXPAND_DURATION,
415
+ easing: Easing.ease
416
+ });
417
+ wave.alpha.value = withTiming(1, {
418
+ duration: RIPPLE_FADE_IN
419
+ });
420
+ onTouchStart?.(event);
421
+ };
422
+ const releaseWave = () => {
423
+ const wave = waves[nextWave.current === 0 ? 1 : 0];
424
+ wave.expand.value = withTiming(1, {
425
+ duration: RIPPLE_CONFIRM_DURATION,
426
+ easing: Easing.ease
427
+ });
428
+ wave.alpha.value = withDelay(RIPPLE_FADE_OUT_DELAY, withTiming(0, {
429
+ duration: RIPPLE_FADE_OUT
430
+ }));
431
+ };
432
+ const handleTouchEnd = event => {
433
+ releaseWave();
434
+ onTouchEnd?.(event);
435
+ };
436
+ const handleTouchCancel = event => {
437
+ releaseWave();
438
+ onTouchCancel?.(event);
439
+ };
440
+ const handleLayout = event => {
441
+ const {
442
+ width,
443
+ height
444
+ } = event.nativeEvent.layout;
445
+ size.value = {
446
+ width,
447
+ height
448
+ };
449
+ onLayout?.(event);
450
+ };
451
+ const Root = asChild ? AnimatedSlot : AnimatedPressable;
452
+ return /* @__PURE__ */jsx2(FeedbackProvider, {
453
+ value: context,
454
+ children: /* @__PURE__ */jsx2(Root, {
455
+ ref,
456
+ style: [style, animatedStyle],
457
+ disabled: isDisabled,
458
+ onLayout: handleLayout,
459
+ onTouchStart: handleTouchStart,
460
+ onTouchEnd: handleTouchEnd,
461
+ onTouchCancel: handleTouchCancel,
462
+ ...rest,
463
+ children: feedbackChildren(children, asChild)
464
+ })
465
+ });
466
+ });
467
+ PressableFeedback.displayName = "XAUI.PressableFeedback";
468
+ function useWave() {
469
+ return {
470
+ expand: useSharedValue(0),
471
+ alpha: useSharedValue(0),
472
+ origin: useSharedValue({
473
+ x: 0,
474
+ y: 0
475
+ })
476
+ };
477
+ }
478
+ function useSurface(style) {
479
+ const theme = useXAUITheme();
480
+ return useMemo(() => {
481
+ const flat = StyleSheet.flatten(style);
482
+ return {
483
+ ink: inkFor(flat?.backgroundColor, theme.colors),
484
+ corners: radiusFrom(flat)
485
+ };
486
+ }, [style, theme]);
487
+ }
488
+
489
+ // src/system/pressable-feedback/pressable-feedback-highlight.tsx
490
+ import { useEffect as useEffect2 } from "react";
491
+ import { StyleSheet as StyleSheet2, View as View2 } from "react-native";
492
+ import Animated2, { useAnimatedStyle as useAnimatedStyle2, useSharedValue as useSharedValue2, withTiming as withTiming2 } from "react-native-reanimated";
493
+ import { Fragment as Fragment2, jsx as jsx3, jsxs } from "react/jsx-runtime";
494
+ function PressableFeedbackHighlight({
495
+ style,
496
+ animation: override,
497
+ children,
498
+ ...props
499
+ }) {
500
+ const {
501
+ isPressed,
502
+ animation,
503
+ progress,
504
+ ink,
505
+ corners
506
+ } = useFeedback();
507
+ const [styleProps] = useStyleProps(props);
508
+ const settings = resolveSlotAnimation(override, animation.highlight, HIGHLIGHT_OPACITY, HIGHLIGHT_DURATION);
509
+ const base = [StyleSheet2.absoluteFillObject, {
510
+ backgroundColor: ink,
511
+ pointerEvents: "none"
512
+ }, corners, styleProps, style];
513
+ if (!progress || !settings.enabled) {
514
+ return /* @__PURE__ */jsxs(Fragment2, {
515
+ children: [/* @__PURE__ */jsx3(View2, {
516
+ style: [base, {
517
+ opacity: isPressed ? settings.opacity : 0
518
+ }]
519
+ }), children]
520
+ });
521
+ }
522
+ return /* @__PURE__ */jsxs(Fragment2, {
523
+ children: [/* @__PURE__ */jsx3(AnimatedHighlight, {
524
+ base,
525
+ duration: settings.duration,
526
+ opacity: settings.opacity
527
+ }), children]
528
+ });
529
+ }
530
+ PressableFeedbackHighlight.displayName = "XAUI.PressableFeedback.Highlight";
531
+ markOverlay(PressableFeedbackHighlight);
532
+ const _worklet_4673236042662_init_data = {
533
+ code: "function chunkWXAME7KBJs5(){const{shown,opacity}=this.__closure;return{opacity:shown.value*opacity};}",
534
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-WXAME7KB.js",
535
+ sourceMap: "{\"version\":3,\"names\":[\"chunkWXAME7KBJs5\",\"shown\",\"opacity\",\"__closure\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-WXAME7KB.js\"],\"mappings\":\"AAuZ0C,SAAAA,gBAAMA,CAAA,QAAAC,KAAA,CAAAC,OAAA,OAAAC,SAAA,CAE5C,MAAO,CAAED,OAAO,CAAED,KAAK,CAACG,KAAK,CAAGF,OAAQ,CAAC,CAC3C\",\"ignoreList\":[]}"
536
+ };
537
+ function AnimatedHighlight({
538
+ base,
539
+ duration,
540
+ opacity
541
+ }) {
542
+ const {
543
+ isPressed
544
+ } = useFeedback();
545
+ const shown = useSharedValue2(0);
546
+ useEffect2(() => {
547
+ shown.value = withTiming2(isPressed ? 1 : 0, {
548
+ duration
549
+ });
550
+ }, [isPressed, shown, duration]);
551
+ const animatedStyle = useAnimatedStyle2(function chunkWXAME7KBJs5Factory({
552
+ _worklet_4673236042662_init_data,
553
+ shown,
554
+ opacity
555
+ }) {
556
+ const _e = [new global.Error(), -3, -27];
557
+ const chunkWXAME7KBJs5 = function () {
558
+ return {
559
+ opacity: shown.value * opacity
560
+ };
561
+ };
562
+ chunkWXAME7KBJs5.__closure = {
563
+ shown,
564
+ opacity
565
+ };
566
+ chunkWXAME7KBJs5.__workletHash = 4673236042662;
567
+ chunkWXAME7KBJs5.__pluginVersion = "0.7.4";
568
+ chunkWXAME7KBJs5.__initData = _worklet_4673236042662_init_data;
569
+ chunkWXAME7KBJs5.__stackDetails = _e;
570
+ return chunkWXAME7KBJs5;
571
+ }({
572
+ _worklet_4673236042662_init_data,
573
+ shown,
574
+ opacity
575
+ }), [shown, opacity]);
576
+ return /* @__PURE__ */jsx3(Animated2.View, {
577
+ style: [base, animatedStyle]
578
+ });
579
+ }
580
+
581
+ // src/system/pressable-feedback/pressable-feedback-ripple.tsx
582
+ import { useState } from "react";
583
+ import { StyleSheet as StyleSheet3, View as View3 } from "react-native";
584
+ import Animated3, { useAnimatedStyle as useAnimatedStyle3 } from "react-native-reanimated";
585
+ import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
586
+ function PressableFeedbackRipple({
587
+ style,
588
+ animation: override,
589
+ children,
590
+ ...props
591
+ }) {
592
+ const {
593
+ animation,
594
+ waves,
595
+ ink,
596
+ corners
597
+ } = useFeedback();
598
+ const [styleProps] = useStyleProps(props);
599
+ const waveStyle = [styleProps, style];
600
+ const settings = resolveSlotAnimation(override, animation.ripple, RIPPLE_OPACITY);
601
+ const [size, setSize] = useState({
602
+ width: 0,
603
+ height: 0
604
+ });
605
+ const handleLayout = event => {
606
+ const {
607
+ width,
608
+ height
609
+ } = event.nativeEvent.layout;
610
+ setSize(current => current.width === width && current.height === height ? current : {
611
+ width,
612
+ height
613
+ });
614
+ };
615
+ if (!waves || !settings.enabled) return /* @__PURE__ */jsx4(Fragment3, {
616
+ children
617
+ });
618
+ const radius = rippleRadiusFor(size.width, size.height);
619
+ return /* @__PURE__ */jsxs2(Fragment3, {
620
+ children: [/* @__PURE__ */jsx4(View3, {
621
+ style: [StyleSheet3.absoluteFill, styles.clip, corners],
622
+ onLayout: handleLayout,
623
+ children: waves.map((wave, index) => /* @__PURE__ */jsx4(RippleWave, {
624
+ wave,
625
+ radius,
626
+ center: {
627
+ x: size.width / 2,
628
+ y: size.height / 2
629
+ },
630
+ color: ink,
631
+ opacity: settings.opacity,
632
+ style: waveStyle
633
+ }, index))
634
+ }), children]
635
+ });
636
+ }
637
+ PressableFeedbackRipple.displayName = "XAUI.PressableFeedback.Ripple";
638
+ markOverlay(PressableFeedbackRipple);
639
+ const _worklet_1833417637801_init_data = {
640
+ code: "function chunkWXAME7KBJs6(){const{wave,RIPPLE_START_SCALE,center,opacity,radius}=this.__closure;const t=wave.expand.value;const from=wave.origin.value;const scale=RIPPLE_START_SCALE+(1-RIPPLE_START_SCALE)*t;const x=from.x+(center.x-from.x)*t;const y=from.y+(center.y-from.y)*t;return{opacity:wave.alpha.value*opacity,transform:[{translateX:x-radius},{translateY:y-radius},{scale:scale}]};}",
641
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-WXAME7KB.js",
642
+ sourceMap: "{\"version\":3,\"names\":[\"chunkWXAME7KBJs6\",\"wave\",\"RIPPLE_START_SCALE\",\"center\",\"opacity\",\"radius\",\"__closure\",\"t\",\"expand\",\"value\",\"from\",\"origin\",\"scale\",\"x\",\"y\",\"alpha\",\"transform\",\"translateX\",\"translateY\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-WXAME7KB.js\"],\"mappings\":\"AAud0C,SAAAA,gBAAMA,CAAA,QAAAC,IAAA,CAAAC,kBAAA,CAAAC,MAAA,CAAAC,OAAA,CAAAC,MAAA,OAAAC,SAAA,CAE5C,KAAM,CAAAC,CAAC,CAAGN,IAAI,CAACO,MAAM,CAACC,KAAK,CAC3B,KAAM,CAAAC,IAAI,CAAGT,IAAI,CAACU,MAAM,CAACF,KAAK,CAC9B,KAAM,CAAAG,KAAK,CAAGV,kBAAkB,CAAG,CAAC,CAAC,CAAGA,kBAAkB,EAAIK,CAAC,CAC/D,KAAM,CAAAM,CAAC,CAAGH,IAAI,CAACG,CAAC,CAAG,CAACV,MAAM,CAACU,CAAC,CAAGH,IAAI,CAACG,CAAC,EAAIN,CAAC,CAC1C,KAAM,CAAAO,CAAC,CAAGJ,IAAI,CAACI,CAAC,CAAG,CAACX,MAAM,CAACW,CAAC,CAAGJ,IAAI,CAACI,CAAC,EAAIP,CAAC,CAC1C,MAAO,CAELH,OAAO,CAAEH,IAAI,CAACc,KAAK,CAACN,KAAK,CAAGL,OAAO,CACnCY,SAAS,CAAE,CAAC,CAAEC,UAAU,CAAEJ,CAAC,CAAGR,MAAO,CAAC,CAAE,CAAEa,UAAU,CAAEJ,CAAC,CAAGT,MAAO,CAAC,CAAE,CAAEO,KAAA,CAAAA,KAAM,CAAC,CAC/E,CAAC,CACH\",\"ignoreList\":[]}"
643
+ };
644
+ function RippleWave({
645
+ wave,
646
+ radius,
647
+ center,
648
+ color,
649
+ opacity,
650
+ style
651
+ }) {
652
+ const animatedStyle = useAnimatedStyle3(function chunkWXAME7KBJs6Factory({
653
+ _worklet_1833417637801_init_data,
654
+ wave,
655
+ RIPPLE_START_SCALE,
656
+ center,
657
+ opacity,
658
+ radius
659
+ }) {
660
+ const _e = [new global.Error(), -6, -27];
661
+ const chunkWXAME7KBJs6 = function () {
662
+ const t = wave.expand.value;
663
+ const from = wave.origin.value;
664
+ const scale = RIPPLE_START_SCALE + (1 - RIPPLE_START_SCALE) * t;
665
+ const x = from.x + (center.x - from.x) * t;
666
+ const y = from.y + (center.y - from.y) * t;
667
+ return {
668
+ // Its own curve, not the expansion's: full ink in 75ms, held while the circle grows.
669
+ opacity: wave.alpha.value * opacity,
670
+ transform: [{
671
+ translateX: x - radius
672
+ }, {
673
+ translateY: y - radius
674
+ }, {
675
+ scale
676
+ }]
677
+ };
678
+ };
679
+ chunkWXAME7KBJs6.__closure = {
680
+ wave,
681
+ RIPPLE_START_SCALE,
682
+ center,
683
+ opacity,
684
+ radius
685
+ };
686
+ chunkWXAME7KBJs6.__workletHash = 1833417637801;
687
+ chunkWXAME7KBJs6.__pluginVersion = "0.7.4";
688
+ chunkWXAME7KBJs6.__initData = _worklet_1833417637801_init_data;
689
+ chunkWXAME7KBJs6.__stackDetails = _e;
690
+ return chunkWXAME7KBJs6;
691
+ }({
692
+ _worklet_1833417637801_init_data,
693
+ wave,
694
+ RIPPLE_START_SCALE,
695
+ center,
696
+ opacity,
697
+ radius
698
+ }), [wave, radius, center, opacity]);
699
+ return /* @__PURE__ */jsx4(Animated3.View, {
700
+ style: [styles.wave, {
701
+ backgroundColor: color,
702
+ width: radius * 2,
703
+ height: radius * 2,
704
+ borderRadius: radius
705
+ }, style, animatedStyle]
706
+ });
707
+ }
708
+ var styles = StyleSheet3.create({
709
+ // `pointerEvents` in the style rather than as a prop: the prop form is deprecated, and it
710
+ // is not decoration — a container that ate touches would claim every press meant for the
711
+ // control it covers.
712
+ clip: {
713
+ overflow: "hidden",
714
+ pointerEvents: "none"
715
+ },
716
+ wave: {
717
+ position: "absolute",
718
+ top: 0,
719
+ start: 0
720
+ }
721
+ });
722
+
723
+ // src/system/pressable-feedback/index.ts
724
+ var PressableFeedback3 = Object.assign(PressableFeedback, {
725
+ Highlight: PressableFeedbackHighlight,
726
+ Ripple: PressableFeedbackRipple
727
+ });
728
+ export { IconContext, useIconContext, Icon, useFeedback, PRESS_SCALE, PRESS_DURATION, SCALE_REFERENCE_WIDTH, pressScaleFor, HIGHLIGHT_OPACITY, HIGHLIGHT_DURATION, RIPPLE_OPACITY, RIPPLE_START_SCALE, RIPPLE_EXPAND_DURATION, RIPPLE_CONFIRM_DURATION, RIPPLE_FADE_IN, RIPPLE_FADE_OUT_DELAY, RIPPLE_FADE_OUT, rippleRadiusFor, resolveAnimation, resolveSlotAnimation, FEEDBACK_OVERLAY, markOverlay, PressableFeedback3 as PressableFeedback };