@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.
Files changed (65) hide show
  1. package/dist/chunk-2WMVDMFV.cjs +62 -0
  2. package/dist/chunk-33QILJJH.cjs +143 -0
  3. package/dist/chunk-4NE3SLTM.cjs +695 -0
  4. package/dist/{chunk-M7P46XKI.cjs → chunk-57SJ4LJF.cjs} +33 -3
  5. package/dist/chunk-5LC6KVL3.cjs +68 -0
  6. package/dist/{chunk-RBNCR5KB.js → chunk-A3EGFI6T.js} +31 -1
  7. package/dist/chunk-APCBIHLR.cjs +507 -0
  8. package/dist/chunk-BPBY7ON7.cjs +451 -0
  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-IBRVMLUF.js +668 -0
  13. package/dist/chunk-ISVUXVFL.js +471 -0
  14. package/dist/chunk-JL27KVRT.js +68 -0
  15. package/dist/chunk-JXLRHKCQ.js +143 -0
  16. package/dist/chunk-MC7SY2QH.cjs +20 -0
  17. package/dist/{chunk-RCP3SD26.js → chunk-N7C4UNUL.js} +2 -126
  18. package/dist/chunk-RMLFMRWL.js +102 -0
  19. package/dist/chunk-RRRGLRRP.cjs +28 -0
  20. package/dist/chunk-SGHP76GU.js +28 -0
  21. package/dist/{chunk-PBVPOX7D.js → chunk-TUJBDS5M.js} +30 -63
  22. package/dist/chunk-UBA6AEY6.cjs +102 -0
  23. package/dist/{chunk-NHPQQQ7P.cjs → chunk-UL263KGM.cjs} +56 -89
  24. package/dist/{chunk-B755PRVJ.cjs → chunk-UVO4GFSW.cjs} +3 -127
  25. package/dist/chunk-XHZBXYVU.js +62 -0
  26. package/dist/chunk-YRCUALUQ.js +451 -0
  27. package/dist/components/button/index.cjs +17 -0
  28. package/dist/components/button/index.d.cts +659 -0
  29. package/dist/components/button/index.d.ts +659 -0
  30. package/dist/components/button/index.js +17 -0
  31. package/dist/components/card/index.cjs +20 -0
  32. package/dist/components/card/index.d.cts +620 -0
  33. package/dist/components/card/index.d.ts +620 -0
  34. package/dist/components/card/index.js +20 -0
  35. package/dist/components/typography/index.cjs +14 -0
  36. package/dist/components/typography/index.d.cts +116 -0
  37. package/dist/components/typography/index.d.ts +116 -0
  38. package/dist/components/typography/index.js +14 -0
  39. package/dist/components/view/index.cjs +16 -0
  40. package/dist/components/view/index.d.cts +152 -0
  41. package/dist/components/view/index.d.ts +152 -0
  42. package/dist/components/view/index.js +16 -0
  43. package/dist/create-recipe-CC3NNCqF.d.ts +94 -0
  44. package/dist/create-recipe-CPBFg7ym.d.cts +94 -0
  45. package/dist/icon.type-BkcEPJbK.d.ts +73 -0
  46. package/dist/icon.type-Cs1tMX0W.d.cts +73 -0
  47. package/dist/index.cjs +167 -5
  48. package/dist/index.d.cts +79 -4
  49. package/dist/index.d.ts +79 -4
  50. package/dist/index.js +171 -9
  51. package/dist/pressable-feedback.type-DsvWZXWC.d.ts +127 -0
  52. package/dist/pressable-feedback.type-wfeiJz5m.d.cts +127 -0
  53. package/dist/style-props.type-B1BG5TCm.d.cts +31 -0
  54. package/dist/style-props.type-B1BG5TCm.d.ts +31 -0
  55. package/dist/system/index.cjs +66 -3
  56. package/dist/system/index.d.cts +301 -75
  57. package/dist/system/index.d.ts +301 -75
  58. package/dist/system/index.js +68 -5
  59. package/dist/theme/index.cjs +4 -3
  60. package/dist/theme/index.d.cts +27 -15
  61. package/dist/theme/index.d.ts +27 -15
  62. package/dist/theme/index.js +7 -6
  63. package/dist/{theme.type-B3ODSLbB.d.cts → theme.type-C2gNHpEx.d.cts} +8 -2
  64. package/dist/{theme.type-B3ODSLbB.d.ts → theme.type-C2gNHpEx.d.ts} +8 -2
  65. package/package.json +74 -18
@@ -0,0 +1,695 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ function _interopRequireDefault(obj) {
7
+ return obj && obj.__esModule ? obj : {
8
+ default: obj
9
+ };
10
+ }
11
+ function _nullishCoalesce(lhs, rhsFn) {
12
+ if (lhs != null) {
13
+ return lhs;
14
+ } else {
15
+ return rhsFn();
16
+ }
17
+ }
18
+ function _optionalChain(ops) {
19
+ let lastAccessLHS = undefined;
20
+ let value = ops[0];
21
+ let i = 1;
22
+ while (i < ops.length) {
23
+ const op = ops[i];
24
+ const fn = ops[i + 1];
25
+ i += 2;
26
+ if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
27
+ return undefined;
28
+ }
29
+ if (op === 'access' || op === 'optionalAccess') {
30
+ lastAccessLHS = value;
31
+ value = fn(value);
32
+ } else if (op === 'call' || op === 'optionalCall') {
33
+ value = fn((...args) => value.call(lastAccessLHS, ...args));
34
+ lastAccessLHS = undefined;
35
+ }
36
+ }
37
+ return value;
38
+ }
39
+ var _chunkEVXZGNPAcjs = require('./chunk-EVXZGNPA.cjs');
40
+ var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
41
+
42
+ // src/system/pressable-feedback/pressable-feedback-context.ts
43
+ var _react = require('react');
44
+ var [FeedbackProvider, useFeedback] = _chunkEVXZGNPAcjs.createSlotContext.call(void 0, "PressableFeedback");
45
+ var DisableAllContext = _react.createContext.call(void 0, false);
46
+
47
+ // src/system/pressable-feedback/pressable-feedback.animation.ts
48
+ var PRESS_SCALE = 0.985;
49
+ var PRESS_DURATION = 300;
50
+ var SCALE_REFERENCE_WIDTH = 300;
51
+ const _worklet_7095389161049_init_data = {
52
+ code: "function pressScaleFor_chunk4NE3SLTMCjs1(width){const{SCALE_REFERENCE_WIDTH,PRESS_SCALE}=this.__closure;const coefficient=width>0?SCALE_REFERENCE_WIDTH/width:1;return 1-(1-PRESS_SCALE)*coefficient;}",
53
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-4NE3SLTM.cjs",
54
+ sourceMap: "{\"version\":3,\"names\":[\"pressScaleFor_chunk4NE3SLTMCjs1\",\"width\",\"SCALE_REFERENCE_WIDTH\",\"PRESS_SCALE\",\"__closure\",\"coefficient\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-4NE3SLTM.cjs\"],\"mappings\":\"AAoBA,SAAAA,+BAA8BA,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\":[]}"
55
+ };
56
+ const pressScaleFor = function pressScaleFor_chunk4NE3SLTMCjs1Factory({
57
+ _worklet_7095389161049_init_data,
58
+ SCALE_REFERENCE_WIDTH,
59
+ PRESS_SCALE
60
+ }) {
61
+ const _e = [new global.Error(), -3, -27];
62
+ const pressScaleFor = function (width) {
63
+ const coefficient = width > 0 ? SCALE_REFERENCE_WIDTH / width : 1;
64
+ return 1 - (1 - PRESS_SCALE) * coefficient;
65
+ };
66
+ pressScaleFor.__closure = {
67
+ SCALE_REFERENCE_WIDTH,
68
+ PRESS_SCALE
69
+ };
70
+ pressScaleFor.__workletHash = 7095389161049;
71
+ pressScaleFor.__pluginVersion = "0.7.4";
72
+ pressScaleFor.__initData = _worklet_7095389161049_init_data;
73
+ pressScaleFor.__stackDetails = _e;
74
+ return pressScaleFor;
75
+ }({
76
+ _worklet_7095389161049_init_data,
77
+ SCALE_REFERENCE_WIDTH,
78
+ PRESS_SCALE
79
+ });
80
+ var HIGHLIGHT_OPACITY = 0.1;
81
+ var HIGHLIGHT_DURATION = 200;
82
+ var RIPPLE_OPACITY = 0.1;
83
+ var RIPPLE_START_SCALE = 0.3;
84
+ var RIPPLE_EXPAND_DURATION = 1e3;
85
+ var RIPPLE_CONFIRM_DURATION = 225;
86
+ var RIPPLE_FADE_IN = 75;
87
+ var RIPPLE_FADE_OUT_DELAY = 225;
88
+ var RIPPLE_FADE_OUT = 150;
89
+ const _worklet_16185247461666_init_data = {
90
+ code: "function rippleRadiusFor_chunk4NE3SLTMCjs2(width,height){return Math.sqrt(width*width+height*height)/2+5;}",
91
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-4NE3SLTM.cjs",
92
+ sourceMap: "{\"version\":3,\"names\":[\"rippleRadiusFor_chunk4NE3SLTMCjs2\",\"width\",\"height\",\"Math\",\"sqrt\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-4NE3SLTM.cjs\"],\"mappings\":\"AAkCA,SAAAA,iCAAwCA,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\":[]}"
93
+ };
94
+ const rippleRadiusFor = function rippleRadiusFor_chunk4NE3SLTMCjs2Factory({
95
+ _worklet_16185247461666_init_data
96
+ }) {
97
+ const _e = [new global.Error(), 1, -27];
98
+ const rippleRadiusFor = function (width, height) {
99
+ return Math.sqrt(width * width + height * height) / 2 + 5;
100
+ };
101
+ rippleRadiusFor.__closure = {};
102
+ rippleRadiusFor.__workletHash = 16185247461666;
103
+ rippleRadiusFor.__pluginVersion = "0.7.4";
104
+ rippleRadiusFor.__initData = _worklet_16185247461666_init_data;
105
+ rippleRadiusFor.__stackDetails = _e;
106
+ return rippleRadiusFor;
107
+ }({
108
+ _worklet_16185247461666_init_data
109
+ });
110
+ var ALL_OFF = {
111
+ scale: false,
112
+ highlight: false,
113
+ ripple: false,
114
+ none: true
115
+ };
116
+ var ALL_ON = {
117
+ scale: true,
118
+ highlight: true,
119
+ ripple: true,
120
+ none: false
121
+ };
122
+ function resolveAnimation(animation, inheritedDisableAll = false) {
123
+ if (inheritedDisableAll) return {
124
+ ...ALL_OFF,
125
+ disableAll: true
126
+ };
127
+ if (animation === false || animation === "disabled") {
128
+ return {
129
+ ...ALL_OFF,
130
+ disableAll: false
131
+ };
132
+ }
133
+ if (animation === "disable-all") return {
134
+ ...ALL_OFF,
135
+ disableAll: true
136
+ };
137
+ if (animation === void 0 || animation === true) {
138
+ return {
139
+ ...ALL_ON,
140
+ disableAll: false
141
+ };
142
+ }
143
+ const scale = _nullishCoalesce(animation.scale, () => true);
144
+ const highlight = _nullishCoalesce(animation.highlight, () => true);
145
+ const ripple = _nullishCoalesce(animation.ripple, () => true);
146
+ return {
147
+ scale,
148
+ highlight,
149
+ ripple,
150
+ none: !scale && !highlight && !ripple,
151
+ disableAll: false
152
+ };
153
+ }
154
+ function resolveSlotAnimation(override, enabledByRoot, defaultOpacity, defaultDuration = PRESS_DURATION) {
155
+ const fallback = {
156
+ enabled: enabledByRoot,
157
+ duration: defaultDuration,
158
+ opacity: defaultOpacity
159
+ };
160
+ if (override === void 0 || override === true) return fallback;
161
+ if (override === false) return {
162
+ ...fallback,
163
+ enabled: false
164
+ };
165
+ return {
166
+ enabled: enabledByRoot,
167
+ duration: _nullishCoalesce(override.duration, () => defaultDuration),
168
+ opacity: _nullishCoalesce(override.opacity, () => defaultOpacity)
169
+ };
170
+ }
171
+
172
+ // src/system/pressable-feedback/pressable-feedback.overlay.ts
173
+
174
+ var FEEDBACK_OVERLAY = /* @__PURE__ */Symbol.for("xaui.PressableFeedback.overlay");
175
+ function markOverlay(component) {
176
+ return Object.assign(component, {
177
+ [FEEDBACK_OVERLAY]: true
178
+ });
179
+ }
180
+ function isBareOverlay(node) {
181
+ if (!_react.isValidElement.call(void 0, node)) return false;
182
+ const type = node.type;
183
+ if (typeof type !== "function" && typeof type !== "object") return false;
184
+ if (type === null) return false;
185
+ if (type[FEEDBACK_OVERLAY] !== true) return false;
186
+ return node.props.children === void 0;
187
+ }
188
+ function partitionOverlays(children) {
189
+ const all = _react.Children.toArray(children);
190
+ const overlays = all.filter(isBareOverlay);
191
+ if (overlays.length === 0) return {
192
+ overlays: null,
193
+ content: children
194
+ };
195
+ return {
196
+ overlays,
197
+ content: all.filter(node => !isBareOverlay(node))
198
+ };
199
+ }
200
+ function feedbackChildren(children, asChild) {
201
+ if (asChild) return children;
202
+ const {
203
+ overlays,
204
+ content
205
+ } = partitionOverlays(children);
206
+ if (overlays === null) return content;
207
+ return _react.createElement.call(void 0, _react.Fragment, null, overlays, content);
208
+ }
209
+
210
+ // src/system/pressable-feedback/pressable-feedback.tsx
211
+
212
+ var _reactnative = require('react-native');
213
+ var _reactnativereanimated = require('react-native-reanimated');
214
+ var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
215
+
216
+ // src/system/pressable-feedback/pressable-feedback.surface.ts
217
+ function inkFor(background, colors) {
218
+ if (typeof background !== "string" || !_chunk57SJ4LJFcjs.isHex.call(void 0, background)) return colors.foreground;
219
+ return _chunk57SJ4LJFcjs.contrastOn.call(void 0, background, colors.snow, colors.eclipse);
220
+ }
221
+ var RADIUS_KEYS = ["borderRadius", "borderStartStartRadius", "borderStartEndRadius", "borderEndStartRadius", "borderEndEndRadius"];
222
+ function radiusFrom(style) {
223
+ if (!style) return {};
224
+ const radius = {};
225
+ for (const key of RADIUS_KEYS) {
226
+ const value = style[key];
227
+ if (value !== void 0) radius[key] = value;
228
+ }
229
+ return radius;
230
+ }
231
+
232
+ // src/system/pressable-feedback/pressable-feedback.tsx
233
+ var _jsxruntime = require('react/jsx-runtime');
234
+ var AnimatedPressable = _reactnativereanimated2.default.createAnimatedComponent(_reactnative.Pressable);
235
+ var AnimatedSlot = _reactnativereanimated2.default.createAnimatedComponent(_chunkEVXZGNPAcjs.Slot);
236
+ var PressableFeedback = _react.forwardRef.call(void 0, function PressableFeedback2({
237
+ animation,
238
+ style,
239
+ ...props
240
+ }, ref) {
241
+ const inheritedDisableAll = _react.useContext.call(void 0, DisableAllContext);
242
+ const resolved = resolveAnimation(animation, inheritedDisableAll);
243
+ const [styleProps, rest] = _chunkEVXZGNPAcjs.useStyleProps.call(void 0, props);
244
+ const Feedback = resolved.none ? StaticFeedback : AnimatedFeedback;
245
+ const body = /* @__PURE__ */_jsxruntime.jsx.call(void 0, Feedback, {
246
+ ref,
247
+ animation: resolved,
248
+ style: [styleProps, style],
249
+ ...rest
250
+ });
251
+ return resolved.disableAll ? /* @__PURE__ */_jsxruntime.jsx.call(void 0, DisableAllContext.Provider, {
252
+ value: true,
253
+ children: body
254
+ }) : body;
255
+ });
256
+ var StaticFeedback = _react.forwardRef.call(void 0, function StaticFeedback2({
257
+ isPressed = false,
258
+ isDisabled,
259
+ asChild = false,
260
+ animation,
261
+ children,
262
+ style,
263
+ ...rest
264
+ }, ref) {
265
+ const surface = useSurface(style);
266
+ const context = _react.useMemo.call(void 0, () => ({
267
+ isPressed,
268
+ animation,
269
+ ...surface
270
+ }), [isPressed, animation, surface]);
271
+ const Root = asChild ? _chunkEVXZGNPAcjs.Slot : _reactnative.Pressable;
272
+ return /* @__PURE__ */_jsxruntime.jsx.call(void 0, FeedbackProvider, {
273
+ value: context,
274
+ children: /* @__PURE__ */_jsxruntime.jsx.call(void 0, Root, {
275
+ ref,
276
+ style,
277
+ disabled: isDisabled,
278
+ ...rest,
279
+ children: feedbackChildren(children, asChild)
280
+ })
281
+ });
282
+ });
283
+ const _worklet_404966677504_init_data = {
284
+ code: "function chunk4NE3SLTMCjs3(){const{animation,pressedScale,progress}=this.__closure;if(!animation.scale)return{};return{transform:[{scale:1-(1-pressedScale.value)*progress.value}]};}",
285
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-4NE3SLTM.cjs",
286
+ sourceMap: "{\"version\":3,\"names\":[\"chunk4NE3SLTMCjs3\",\"animation\",\"pressedScale\",\"progress\",\"__closure\",\"scale\",\"transform\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-4NE3SLTM.cjs\"],\"mappings\":\"AAiN6E,SAAAA,iBAAMA,CAAA,QAAAC,SAAA,CAAAC,YAAA,CAAAC,QAAA,OAAAC,SAAA,CAE/E,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\":[]}"
287
+ };
288
+ var AnimatedFeedback = _react.forwardRef.call(void 0, function AnimatedFeedback2({
289
+ isPressed = false,
290
+ isDisabled,
291
+ asChild = false,
292
+ animation,
293
+ children,
294
+ style,
295
+ onLayout,
296
+ onTouchStart,
297
+ onTouchEnd,
298
+ onTouchCancel,
299
+ ...rest
300
+ }, ref) {
301
+ const progress = _reactnativereanimated.useSharedValue.call(void 0, 0);
302
+ const size = _reactnativereanimated.useSharedValue.call(void 0, {
303
+ width: 0,
304
+ height: 0
305
+ });
306
+ const waves = [useWave(), useWave()];
307
+ const nextWave = _react.useRef.call(void 0, 0);
308
+ _react.useEffect.call(void 0, () => {
309
+ progress.value = _reactnativereanimated.withTiming.call(void 0, isPressed ? 1 : 0, {
310
+ duration: PRESS_DURATION,
311
+ easing: _reactnativereanimated.Easing.out(_reactnativereanimated.Easing.ease)
312
+ });
313
+ }, [isPressed, progress]);
314
+ const pressedScale = _reactnativereanimated.useDerivedValue.call(void 0, () => pressScaleFor(size.value.width));
315
+ const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, function chunk4NE3SLTMCjs3Factory({
316
+ _worklet_404966677504_init_data,
317
+ animation,
318
+ pressedScale,
319
+ progress
320
+ }) {
321
+ const _e = [new global.Error(), -4, -27];
322
+ const chunk4NE3SLTMCjs3 = function () {
323
+ if (!animation.scale) return {};
324
+ return {
325
+ transform: [{
326
+ scale: 1 - (1 - pressedScale.value) * progress.value
327
+ }]
328
+ };
329
+ };
330
+ chunk4NE3SLTMCjs3.__closure = {
331
+ animation,
332
+ pressedScale,
333
+ progress
334
+ };
335
+ chunk4NE3SLTMCjs3.__workletHash = 404966677504;
336
+ chunk4NE3SLTMCjs3.__pluginVersion = "0.7.4";
337
+ chunk4NE3SLTMCjs3.__initData = _worklet_404966677504_init_data;
338
+ chunk4NE3SLTMCjs3.__stackDetails = _e;
339
+ return chunk4NE3SLTMCjs3;
340
+ }({
341
+ _worklet_404966677504_init_data,
342
+ animation,
343
+ pressedScale,
344
+ progress
345
+ }), [animation.scale, progress, pressedScale]);
346
+ const surface = useSurface(style);
347
+ const context = _react.useMemo.call(void 0, () => ({
348
+ isPressed,
349
+ animation,
350
+ progress,
351
+ size,
352
+ waves,
353
+ ...surface
354
+ }), [isPressed, animation, progress, size, waves, surface]);
355
+ const handleTouchStart = event => {
356
+ const wave = waves[nextWave.current];
357
+ nextWave.current = nextWave.current === 0 ? 1 : 0;
358
+ const {
359
+ locationX,
360
+ locationY
361
+ } = event.nativeEvent;
362
+ wave.origin.value = {
363
+ x: locationX,
364
+ y: locationY
365
+ };
366
+ wave.expand.value = 0;
367
+ wave.expand.value = _reactnativereanimated.withTiming.call(void 0, 1, {
368
+ duration: RIPPLE_EXPAND_DURATION,
369
+ easing: _reactnativereanimated.Easing.ease
370
+ });
371
+ wave.alpha.value = _reactnativereanimated.withTiming.call(void 0, 1, {
372
+ duration: RIPPLE_FADE_IN
373
+ });
374
+ _optionalChain([onTouchStart, 'optionalCall', _ => _(event)]);
375
+ };
376
+ const releaseWave = () => {
377
+ const wave = waves[nextWave.current === 0 ? 1 : 0];
378
+ wave.expand.value = _reactnativereanimated.withTiming.call(void 0, 1, {
379
+ duration: RIPPLE_CONFIRM_DURATION,
380
+ easing: _reactnativereanimated.Easing.ease
381
+ });
382
+ wave.alpha.value = _reactnativereanimated.withDelay.call(void 0, RIPPLE_FADE_OUT_DELAY, _reactnativereanimated.withTiming.call(void 0, 0, {
383
+ duration: RIPPLE_FADE_OUT
384
+ }));
385
+ };
386
+ const handleTouchEnd = event => {
387
+ releaseWave();
388
+ _optionalChain([onTouchEnd, 'optionalCall', _2 => _2(event)]);
389
+ };
390
+ const handleTouchCancel = event => {
391
+ releaseWave();
392
+ _optionalChain([onTouchCancel, 'optionalCall', _3 => _3(event)]);
393
+ };
394
+ const handleLayout = event => {
395
+ const {
396
+ width,
397
+ height
398
+ } = event.nativeEvent.layout;
399
+ size.value = {
400
+ width,
401
+ height
402
+ };
403
+ _optionalChain([onLayout, 'optionalCall', _4 => _4(event)]);
404
+ };
405
+ const Root = asChild ? AnimatedSlot : AnimatedPressable;
406
+ return /* @__PURE__ */_jsxruntime.jsx.call(void 0, FeedbackProvider, {
407
+ value: context,
408
+ children: /* @__PURE__ */_jsxruntime.jsx.call(void 0, Root, {
409
+ ref,
410
+ style: [style, animatedStyle],
411
+ disabled: isDisabled,
412
+ onLayout: handleLayout,
413
+ onTouchStart: handleTouchStart,
414
+ onTouchEnd: handleTouchEnd,
415
+ onTouchCancel: handleTouchCancel,
416
+ ...rest,
417
+ children: feedbackChildren(children, asChild)
418
+ })
419
+ });
420
+ });
421
+ PressableFeedback.displayName = "XAUI.PressableFeedback";
422
+ function useWave() {
423
+ return {
424
+ expand: _reactnativereanimated.useSharedValue.call(void 0, 0),
425
+ alpha: _reactnativereanimated.useSharedValue.call(void 0, 0),
426
+ origin: _reactnativereanimated.useSharedValue.call(void 0, {
427
+ x: 0,
428
+ y: 0
429
+ })
430
+ };
431
+ }
432
+ function useSurface(style) {
433
+ const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0);
434
+ return _react.useMemo.call(void 0, () => {
435
+ const flat = _reactnative.StyleSheet.flatten(style);
436
+ return {
437
+ ink: inkFor(_optionalChain([flat, 'optionalAccess', _5 => _5.backgroundColor]), theme.colors),
438
+ corners: radiusFrom(flat)
439
+ };
440
+ }, [style, theme]);
441
+ }
442
+
443
+ // src/system/pressable-feedback/pressable-feedback-highlight.tsx
444
+
445
+ function PressableFeedbackHighlight({
446
+ style,
447
+ animation: override,
448
+ children,
449
+ ...props
450
+ }) {
451
+ const {
452
+ isPressed,
453
+ animation,
454
+ progress,
455
+ ink,
456
+ corners
457
+ } = useFeedback();
458
+ const [styleProps] = _chunkEVXZGNPAcjs.useStyleProps.call(void 0, props);
459
+ const settings = resolveSlotAnimation(override, animation.highlight, HIGHLIGHT_OPACITY, HIGHLIGHT_DURATION);
460
+ const base = [_reactnative.StyleSheet.absoluteFillObject, {
461
+ backgroundColor: ink,
462
+ pointerEvents: "none"
463
+ }, corners, styleProps, style];
464
+ if (!progress || !settings.enabled) {
465
+ return /* @__PURE__ */_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
466
+ children: [/* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.View, {
467
+ style: [base, {
468
+ opacity: isPressed ? settings.opacity : 0
469
+ }]
470
+ }), children]
471
+ });
472
+ }
473
+ return /* @__PURE__ */_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
474
+ children: [/* @__PURE__ */_jsxruntime.jsx.call(void 0, AnimatedHighlight, {
475
+ base,
476
+ duration: settings.duration,
477
+ opacity: settings.opacity
478
+ }), children]
479
+ });
480
+ }
481
+ PressableFeedbackHighlight.displayName = "XAUI.PressableFeedback.Highlight";
482
+ markOverlay(PressableFeedbackHighlight);
483
+ const _worklet_7964971622326_init_data = {
484
+ code: "function chunk4NE3SLTMCjs4(){const{shown,opacity}=this.__closure;return{opacity:shown.value*opacity};}",
485
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-4NE3SLTM.cjs",
486
+ sourceMap: "{\"version\":3,\"names\":[\"chunk4NE3SLTMCjs4\",\"shown\",\"opacity\",\"__closure\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-4NE3SLTM.cjs\"],\"mappings\":\"AA+V6E,SAAAA,iBAAMA,CAAA,QAAAC,KAAA,CAAAC,OAAA,OAAAC,SAAA,CAE/E,MAAO,CAAED,OAAO,CAAED,KAAK,CAACG,KAAK,CAAGF,OAAQ,CAAC,CAC3C\",\"ignoreList\":[]}"
487
+ };
488
+ function AnimatedHighlight({
489
+ base,
490
+ duration,
491
+ opacity
492
+ }) {
493
+ const {
494
+ isPressed
495
+ } = useFeedback();
496
+ const shown = _reactnativereanimated.useSharedValue.call(void 0, 0);
497
+ _react.useEffect.call(void 0, () => {
498
+ shown.value = _reactnativereanimated.withTiming.call(void 0, isPressed ? 1 : 0, {
499
+ duration
500
+ });
501
+ }, [isPressed, shown, duration]);
502
+ const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, function chunk4NE3SLTMCjs4Factory({
503
+ _worklet_7964971622326_init_data,
504
+ shown,
505
+ opacity
506
+ }) {
507
+ const _e = [new global.Error(), -3, -27];
508
+ const chunk4NE3SLTMCjs4 = function () {
509
+ return {
510
+ opacity: shown.value * opacity
511
+ };
512
+ };
513
+ chunk4NE3SLTMCjs4.__closure = {
514
+ shown,
515
+ opacity
516
+ };
517
+ chunk4NE3SLTMCjs4.__workletHash = 7964971622326;
518
+ chunk4NE3SLTMCjs4.__pluginVersion = "0.7.4";
519
+ chunk4NE3SLTMCjs4.__initData = _worklet_7964971622326_init_data;
520
+ chunk4NE3SLTMCjs4.__stackDetails = _e;
521
+ return chunk4NE3SLTMCjs4;
522
+ }({
523
+ _worklet_7964971622326_init_data,
524
+ shown,
525
+ opacity
526
+ }), [shown, opacity]);
527
+ return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, {
528
+ style: [base, animatedStyle]
529
+ });
530
+ }
531
+
532
+ // src/system/pressable-feedback/pressable-feedback-ripple.tsx
533
+
534
+ function PressableFeedbackRipple({
535
+ style,
536
+ animation: override,
537
+ children,
538
+ ...props
539
+ }) {
540
+ const {
541
+ animation,
542
+ waves,
543
+ ink,
544
+ corners
545
+ } = useFeedback();
546
+ const [styleProps] = _chunkEVXZGNPAcjs.useStyleProps.call(void 0, props);
547
+ const waveStyle = [styleProps, style];
548
+ const settings = resolveSlotAnimation(override, animation.ripple, RIPPLE_OPACITY);
549
+ const [size, setSize] = _react.useState.call(void 0, {
550
+ width: 0,
551
+ height: 0
552
+ });
553
+ const handleLayout = event => {
554
+ const {
555
+ width,
556
+ height
557
+ } = event.nativeEvent.layout;
558
+ setSize(current => current.width === width && current.height === height ? current : {
559
+ width,
560
+ height
561
+ });
562
+ };
563
+ if (!waves || !settings.enabled) return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, {
564
+ children
565
+ });
566
+ const radius = rippleRadiusFor(size.width, size.height);
567
+ return /* @__PURE__ */_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
568
+ children: [/* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.View, {
569
+ style: [_reactnative.StyleSheet.absoluteFill, styles.clip, corners],
570
+ onLayout: handleLayout,
571
+ children: waves.map((wave, index) => /* @__PURE__ */_jsxruntime.jsx.call(void 0, RippleWave, {
572
+ wave,
573
+ radius,
574
+ center: {
575
+ x: size.width / 2,
576
+ y: size.height / 2
577
+ },
578
+ color: ink,
579
+ opacity: settings.opacity,
580
+ style: waveStyle
581
+ }, index))
582
+ }), children]
583
+ });
584
+ }
585
+ PressableFeedbackRipple.displayName = "XAUI.PressableFeedback.Ripple";
586
+ markOverlay(PressableFeedbackRipple);
587
+ const _worklet_16723479562203_init_data = {
588
+ code: "function chunk4NE3SLTMCjs5(){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}]};}",
589
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-4NE3SLTM.cjs",
590
+ sourceMap: "{\"version\":3,\"names\":[\"chunk4NE3SLTMCjs5\",\"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-4NE3SLTM.cjs\"],\"mappings\":\"AA+Z6E,SAAAA,iBAAMA,CAAA,QAAAC,IAAA,CAAAC,kBAAA,CAAAC,MAAA,CAAAC,OAAA,CAAAC,MAAA,OAAAC,SAAA,CAE/E,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\":[]}"
591
+ };
592
+ function RippleWave({
593
+ wave,
594
+ radius,
595
+ center,
596
+ color,
597
+ opacity,
598
+ style
599
+ }) {
600
+ const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, function chunk4NE3SLTMCjs5Factory({
601
+ _worklet_16723479562203_init_data,
602
+ wave,
603
+ RIPPLE_START_SCALE,
604
+ center,
605
+ opacity,
606
+ radius
607
+ }) {
608
+ const _e = [new global.Error(), -6, -27];
609
+ const chunk4NE3SLTMCjs5 = function () {
610
+ const t = wave.expand.value;
611
+ const from = wave.origin.value;
612
+ const scale = RIPPLE_START_SCALE + (1 - RIPPLE_START_SCALE) * t;
613
+ const x = from.x + (center.x - from.x) * t;
614
+ const y = from.y + (center.y - from.y) * t;
615
+ return {
616
+ // Its own curve, not the expansion's: full ink in 75ms, held while the circle grows.
617
+ opacity: wave.alpha.value * opacity,
618
+ transform: [{
619
+ translateX: x - radius
620
+ }, {
621
+ translateY: y - radius
622
+ }, {
623
+ scale
624
+ }]
625
+ };
626
+ };
627
+ chunk4NE3SLTMCjs5.__closure = {
628
+ wave,
629
+ RIPPLE_START_SCALE,
630
+ center,
631
+ opacity,
632
+ radius
633
+ };
634
+ chunk4NE3SLTMCjs5.__workletHash = 16723479562203;
635
+ chunk4NE3SLTMCjs5.__pluginVersion = "0.7.4";
636
+ chunk4NE3SLTMCjs5.__initData = _worklet_16723479562203_init_data;
637
+ chunk4NE3SLTMCjs5.__stackDetails = _e;
638
+ return chunk4NE3SLTMCjs5;
639
+ }({
640
+ _worklet_16723479562203_init_data,
641
+ wave,
642
+ RIPPLE_START_SCALE,
643
+ center,
644
+ opacity,
645
+ radius
646
+ }), [wave, radius, center, opacity]);
647
+ return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, {
648
+ style: [styles.wave, {
649
+ backgroundColor: color,
650
+ width: radius * 2,
651
+ height: radius * 2,
652
+ borderRadius: radius
653
+ }, style, animatedStyle]
654
+ });
655
+ }
656
+ var styles = _reactnative.StyleSheet.create({
657
+ // `pointerEvents` in the style rather than as a prop: the prop form is deprecated, and it
658
+ // is not decoration — a container that ate touches would claim every press meant for the
659
+ // control it covers.
660
+ clip: {
661
+ overflow: "hidden",
662
+ pointerEvents: "none"
663
+ },
664
+ wave: {
665
+ position: "absolute",
666
+ top: 0,
667
+ start: 0
668
+ }
669
+ });
670
+
671
+ // src/system/pressable-feedback/index.ts
672
+ var PressableFeedback3 = Object.assign(PressableFeedback, {
673
+ Highlight: PressableFeedbackHighlight,
674
+ Ripple: PressableFeedbackRipple
675
+ });
676
+ exports.useFeedback = useFeedback;
677
+ exports.PRESS_SCALE = PRESS_SCALE;
678
+ exports.PRESS_DURATION = PRESS_DURATION;
679
+ exports.SCALE_REFERENCE_WIDTH = SCALE_REFERENCE_WIDTH;
680
+ exports.pressScaleFor = pressScaleFor;
681
+ exports.HIGHLIGHT_OPACITY = HIGHLIGHT_OPACITY;
682
+ exports.HIGHLIGHT_DURATION = HIGHLIGHT_DURATION;
683
+ exports.RIPPLE_OPACITY = RIPPLE_OPACITY;
684
+ exports.RIPPLE_START_SCALE = RIPPLE_START_SCALE;
685
+ exports.RIPPLE_EXPAND_DURATION = RIPPLE_EXPAND_DURATION;
686
+ exports.RIPPLE_CONFIRM_DURATION = RIPPLE_CONFIRM_DURATION;
687
+ exports.RIPPLE_FADE_IN = RIPPLE_FADE_IN;
688
+ exports.RIPPLE_FADE_OUT_DELAY = RIPPLE_FADE_OUT_DELAY;
689
+ exports.RIPPLE_FADE_OUT = RIPPLE_FADE_OUT;
690
+ exports.rippleRadiusFor = rippleRadiusFor;
691
+ exports.resolveAnimation = resolveAnimation;
692
+ exports.resolveSlotAnimation = resolveSlotAnimation;
693
+ exports.FEEDBACK_OVERLAY = FEEDBACK_OVERLAY;
694
+ exports.markOverlay = markOverlay;
695
+ exports.PressableFeedback = PressableFeedback3;