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