@xaui/native 0.9.1-alpha.11 → 0.9.1-alpha.13

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 (31) hide show
  1. package/dist/{chunk-7XGOXTGT.js → chunk-4O3PXFQ7.js} +15 -31
  2. package/dist/{chunk-3QBT3Q65.cjs → chunk-6N5JXRUZ.cjs} +26 -3
  3. package/dist/chunk-B3EAZ2CC.js +1010 -0
  4. package/dist/{chunk-2FEDC7U5.cjs → chunk-DDYMIWLW.cjs} +41 -57
  5. package/dist/chunk-IVVFYUDW.cjs +1044 -0
  6. package/dist/{chunk-6OHFG32Y.cjs → chunk-MLJ543GP.cjs} +41 -53
  7. package/dist/{chunk-NQ5WWF77.js → chunk-RWLODK55.js} +35 -47
  8. package/dist/{chunk-X2K2FX3W.js → chunk-XJARE6SC.js} +24 -1
  9. package/dist/components/button/index.cjs +4 -4
  10. package/dist/components/button/index.d.cts +162 -13
  11. package/dist/components/button/index.d.ts +162 -13
  12. package/dist/components/button/index.js +3 -3
  13. package/dist/{create-recipe-Dn9kj5Rs.d.ts → create-recipe-3OPwcC6P.d.ts} +81 -21
  14. package/dist/{create-recipe-BjSP0zL_.d.cts → create-recipe-oiLAlJ4u.d.cts} +81 -21
  15. package/dist/index.cjs +28 -8
  16. package/dist/index.d.cts +2 -2
  17. package/dist/index.d.ts +2 -2
  18. package/dist/index.js +32 -12
  19. package/dist/system/index.cjs +24 -4
  20. package/dist/system/index.d.cts +160 -35
  21. package/dist/system/index.d.ts +160 -35
  22. package/dist/system/index.js +31 -11
  23. package/dist/theme/index.cjs +3 -3
  24. package/dist/theme/index.d.cts +19 -8
  25. package/dist/theme/index.d.ts +19 -8
  26. package/dist/theme/index.js +2 -2
  27. package/package.json +1 -1
  28. package/dist/chunk-E2UGZJBT.cjs +0 -959
  29. package/dist/chunk-R4HJCQPI.js +0 -889
  30. /package/dist/{chunk-LMUPNKPH.cjs → chunk-2FOEFUPM.cjs} +0 -0
  31. /package/dist/{chunk-3TIDEII6.js → chunk-TO6DAGFB.js} +0 -0
@@ -1,959 +0,0 @@
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 _chunk3QBT3Q65cjs = require('./chunk-3QBT3Q65.cjs');
40
-
41
- // src/system/icon/icon-context.ts
42
- var _react = require('react');
43
- var IconContext = _react.createContext.call(void 0, {});
44
- IconContext.displayName = "XAUI.Icon.Context";
45
- function useIconContext() {
46
- return _react.useContext.call(void 0, IconContext);
47
- }
48
-
49
- // src/system/icon/icon.tsx
50
-
51
- var _reactnative = require('react-native');
52
- var _jsxruntime = require('react/jsx-runtime');
53
- function Icon({
54
- as: Component,
55
- children,
56
- source,
57
- size,
58
- color,
59
- style
60
- }) {
61
- const inherited = useIconContext();
62
- const theme = _chunk3QBT3Q65cjs.useXAUITheme.call(void 0);
63
- const resolvedSize = _nullishCoalesce(_nullishCoalesce(size, () => inherited.size), () => theme.fontSizes.md);
64
- const resolvedColor = _nullishCoalesce(_nullishCoalesce(color, () => inherited.color), () => theme.colors.foreground);
65
- if (Component) {
66
- return /* @__PURE__ */_jsxruntime.jsx.call(void 0, Component, {
67
- size: resolvedSize,
68
- color: resolvedColor
69
- });
70
- }
71
- if (_react.isValidElement.call(void 0, children)) {
72
- return _react.cloneElement.call(void 0, children, {
73
- width: resolvedSize,
74
- height: resolvedSize,
75
- color: resolvedColor
76
- });
77
- }
78
- if (source) {
79
- return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.Image, {
80
- source,
81
- style: [{
82
- width: resolvedSize,
83
- height: resolvedSize,
84
- tintColor: resolvedColor
85
- }, style]
86
- });
87
- }
88
- 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.");
89
- }
90
- Icon.displayName = "XAUI.Icon";
91
-
92
- // src/system/slot/children-to-string.ts
93
-
94
- function childrenToString(children) {
95
- const text = stringify(children);
96
- return text === null || text === "" ? null : text;
97
- }
98
- function stringify(node) {
99
- if (node === null || node === void 0 || typeof node === "boolean") return "";
100
- if (typeof node === "string") return node;
101
- if (typeof node === "number") return String(node);
102
- if (_react.isValidElement.call(void 0, node)) return null;
103
- if (Array.isArray(node)) {
104
- let text = "";
105
- for (const child of node) {
106
- const part = stringify(child);
107
- if (part === null) return null;
108
- text += part;
109
- }
110
- return text;
111
- }
112
- return null;
113
- }
114
-
115
- // src/system/slot/create-slot-context.ts
116
-
117
- function createSlotContext(name) {
118
- const Context = _react.createContext.call(void 0, null);
119
- Context.displayName = `XAUI.${name}.Context`;
120
- function useSlotContext() {
121
- const value = _react.useContext.call(void 0, Context);
122
- if (value === null) {
123
- const error = new Error(`XAUI: use${name} must be called inside <${name}>. A slot reads the values its root resolved, so it can only be rendered as a child of one.`);
124
- _optionalChain([Error, 'access', _ => _.captureStackTrace, 'optionalCall', _2 => _2(error, useSlotContext)]);
125
- throw error;
126
- }
127
- return value;
128
- }
129
- return [Context.Provider, useSlotContext];
130
- }
131
-
132
- // src/system/slot/merge-refs.ts
133
- function mergeRefs(...refs) {
134
- return value => {
135
- for (const ref of refs) {
136
- if (typeof ref === "function") ref(value);else if (ref) ref.current = value;
137
- }
138
- };
139
- }
140
-
141
- // src/system/slot/merge-props.ts
142
- var EVENT_HANDLER = /^on[A-Z]/;
143
- function mergeProps(ours, theirs) {
144
- const merged = {
145
- ...ours
146
- };
147
- for (const key of Object.keys(theirs)) {
148
- const ourValue = ours[key];
149
- const theirValue = theirs[key];
150
- if (EVENT_HANDLER.test(key)) {
151
- merged[key] = composeHandlers(ourValue, theirValue);
152
- } else if (key === "style") {
153
- merged[key] = mergeStyles(ourValue, theirValue);
154
- } else if (key === "ref") {
155
- merged[key] = mergeRefs(ourValue, theirValue);
156
- } else {
157
- merged[key] = theirValue;
158
- }
159
- }
160
- return merged;
161
- }
162
- function composeHandlers(ours, theirs) {
163
- if (typeof ours !== "function") return theirs;
164
- if (typeof theirs !== "function") return ours;
165
- return (...args) => {
166
- ;
167
- ours(...args);
168
- return theirs(...args);
169
- };
170
- }
171
- function mergeStyles(ours, theirs) {
172
- if (typeof ours === "function" || typeof theirs === "function") {
173
- return state => [resolveStyle(ours, state), resolveStyle(theirs, state)];
174
- }
175
- return [ours, theirs];
176
- }
177
- function resolveStyle(style, state) {
178
- return typeof style === "function" ? style(state) : style;
179
- }
180
-
181
- // src/system/slot/slot.tsx
182
-
183
- var Slot = _react.forwardRef.call(void 0, function Slot2({
184
- children,
185
- ...ours
186
- }, ref) {
187
- if (!_react.isValidElement.call(void 0, children)) {
188
- throw new Error("XAUI: asChild expects exactly one React element as its child, and merges the component's props into it. Text, a fragment, several children or none give it nothing to merge into \u2014 drop `asChild` to render the component itself.");
189
- }
190
- const child = children;
191
- const merged = mergeProps(ours, child.props);
192
- merged.ref = mergeRefs(ref, refOf(child));
193
- return _react.cloneElement.call(void 0, child, merged);
194
- });
195
- Slot.displayName = "XAUI.Slot";
196
- function refOf(element) {
197
- const fromProps = element.props.ref;
198
- const fromElement = element.ref;
199
- return _nullishCoalesce(fromProps, () => fromElement);
200
- }
201
-
202
- // src/system/pressable-feedback/pressable-feedback-context.ts
203
-
204
- var [FeedbackProvider, useFeedback] = createSlotContext("PressableFeedback");
205
- var DisableAllContext = _react.createContext.call(void 0, false);
206
-
207
- // src/system/pressable-feedback/pressable-feedback.animation.ts
208
- var PRESS_SCALE = 0.975;
209
- var PRESS_DURATION = 100;
210
- var RELEASE_DURATION = 150;
211
- var HIGHLIGHT_OPACITY = 0.08;
212
- var RIPPLE_OPACITY = 0.12;
213
- var RIPPLE_DURATION = 350;
214
- var RIPPLE_COVERAGE = 1.25;
215
- var ALL_OFF = {
216
- scale: false,
217
- highlight: false,
218
- ripple: false,
219
- none: true
220
- };
221
- var ALL_ON = {
222
- scale: true,
223
- highlight: true,
224
- ripple: true,
225
- none: false
226
- };
227
- function resolveAnimation(animation, inheritedDisableAll = false) {
228
- if (inheritedDisableAll) return {
229
- ...ALL_OFF,
230
- disableAll: true
231
- };
232
- if (animation === false || animation === "disabled") {
233
- return {
234
- ...ALL_OFF,
235
- disableAll: false
236
- };
237
- }
238
- if (animation === "disable-all") return {
239
- ...ALL_OFF,
240
- disableAll: true
241
- };
242
- if (animation === void 0 || animation === true) {
243
- return {
244
- ...ALL_ON,
245
- disableAll: false
246
- };
247
- }
248
- const scale = _nullishCoalesce(animation.scale, () => true);
249
- const highlight = _nullishCoalesce(animation.highlight, () => true);
250
- const ripple = _nullishCoalesce(animation.ripple, () => true);
251
- return {
252
- scale,
253
- highlight,
254
- ripple,
255
- none: !scale && !highlight && !ripple,
256
- disableAll: false
257
- };
258
- }
259
- function resolveSlotAnimation(override, enabledByRoot, defaultOpacity, defaultDuration = PRESS_DURATION) {
260
- const fallback = {
261
- enabled: enabledByRoot,
262
- duration: defaultDuration,
263
- opacity: defaultOpacity
264
- };
265
- if (override === void 0 || override === true) return fallback;
266
- if (override === false) return {
267
- ...fallback,
268
- enabled: false
269
- };
270
- return {
271
- enabled: enabledByRoot,
272
- duration: _nullishCoalesce(override.duration, () => defaultDuration),
273
- opacity: _nullishCoalesce(override.opacity, () => defaultOpacity)
274
- };
275
- }
276
-
277
- // src/system/pressable-feedback/pressable-feedback.tsx
278
-
279
- var _reactnativereanimated = require('react-native-reanimated');
280
- var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
281
-
282
- // src/system/pressable-feedback/pressable-feedback-highlight.tsx
283
-
284
- function PressableFeedbackHighlight({
285
- style,
286
- animation: override
287
- }) {
288
- const {
289
- isPressed,
290
- animation,
291
- progress
292
- } = useFeedback();
293
- const theme = _chunk3QBT3Q65cjs.useXAUITheme.call(void 0);
294
- const settings = resolveSlotAnimation(override, animation.highlight, HIGHLIGHT_OPACITY);
295
- const base = [_reactnative.StyleSheet.absoluteFillObject, {
296
- backgroundColor: theme.colors.foreground
297
- }, style];
298
- if (!progress || !settings.enabled) {
299
- return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.View, {
300
- pointerEvents: "none",
301
- style: [base, {
302
- opacity: isPressed ? settings.opacity : 0
303
- }]
304
- });
305
- }
306
- return /* @__PURE__ */_jsxruntime.jsx.call(void 0, AnimatedHighlight, {
307
- base,
308
- duration: settings.duration,
309
- opacity: settings.opacity
310
- });
311
- }
312
- PressableFeedbackHighlight.displayName = "XAUI.PressableFeedback.Highlight";
313
- const _worklet_7944669876890_init_data = {
314
- code: "function chunkE2UGZJBTCjs1(){const{shown,opacity}=this.__closure;return{opacity:shown.value*opacity};}",
315
- location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-E2UGZJBT.cjs",
316
- sourceMap: "{\"version\":3,\"names\":[\"chunkE2UGZJBTCjs1\",\"shown\",\"opacity\",\"__closure\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-E2UGZJBT.cjs\"],\"mappings\":\"AA2S6E,SAAAA,iBAAMA,CAAA,QAAAC,KAAA,CAAAC,OAAA,OAAAC,SAAA,CAE/E,MAAO,CAAED,OAAO,CAAED,KAAK,CAACG,KAAK,CAAGF,OAAQ,CAAC,CAC3C\",\"ignoreList\":[]}"
317
- };
318
- function AnimatedHighlight({
319
- base,
320
- duration,
321
- opacity
322
- }) {
323
- const {
324
- isPressed
325
- } = useFeedback();
326
- const shown = _reactnativereanimated.useSharedValue.call(void 0, 0);
327
- _react.useEffect.call(void 0, () => {
328
- shown.value = _reactnativereanimated.withTiming.call(void 0, isPressed ? 1 : 0, {
329
- duration
330
- });
331
- }, [isPressed, shown, duration]);
332
- const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, function chunkE2UGZJBTCjs1Factory({
333
- _worklet_7944669876890_init_data,
334
- shown,
335
- opacity
336
- }) {
337
- const _e = [new global.Error(), -3, -27];
338
- const chunkE2UGZJBTCjs1 = function () {
339
- return {
340
- opacity: shown.value * opacity
341
- };
342
- };
343
- chunkE2UGZJBTCjs1.__closure = {
344
- shown,
345
- opacity
346
- };
347
- chunkE2UGZJBTCjs1.__workletHash = 7944669876890;
348
- chunkE2UGZJBTCjs1.__pluginVersion = "0.7.4";
349
- chunkE2UGZJBTCjs1.__initData = _worklet_7944669876890_init_data;
350
- chunkE2UGZJBTCjs1.__stackDetails = _e;
351
- return chunkE2UGZJBTCjs1;
352
- }({
353
- _worklet_7944669876890_init_data,
354
- shown,
355
- opacity
356
- }), [shown, opacity]);
357
- return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, {
358
- pointerEvents: "none",
359
- style: [base, animatedStyle]
360
- });
361
- }
362
-
363
- // src/system/pressable-feedback/pressable-feedback-ripple.tsx
364
-
365
- function PressableFeedbackRipple({
366
- style,
367
- animation: override
368
- }) {
369
- const {
370
- animation,
371
- progress,
372
- pressCount,
373
- origin,
374
- size
375
- } = useFeedback();
376
- const theme = _chunk3QBT3Q65cjs.useXAUITheme.call(void 0);
377
- const settings = resolveSlotAnimation(override, animation.ripple, RIPPLE_OPACITY, RIPPLE_DURATION);
378
- if (!progress || !pressCount || !origin || !size || !settings.enabled) return null;
379
- return /* @__PURE__ */_jsxruntime.jsx.call(void 0, AnimatedRipple, {
380
- color: theme.colors.foreground,
381
- duration: settings.duration,
382
- opacity: settings.opacity,
383
- style
384
- });
385
- }
386
- PressableFeedbackRipple.displayName = "XAUI.PressableFeedback.Ripple";
387
- const _worklet_4906391944810_init_data = {
388
- code: "function chunkE2UGZJBTCjs2(){const{_nullishCoalesce,_optionalChain,pressCount}=this.__closure;return _nullishCoalesce(_optionalChain([pressCount,'optionalAccess',function(_3){return _3.value;}]),function(){return 0;});}",
389
- location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-E2UGZJBT.cjs",
390
- sourceMap: "{\"version\":3,\"names\":[\"chunkE2UGZJBTCjs2\",\"_nullishCoalesce\",\"_optionalChain\",\"pressCount\",\"__closure\",\"_3\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-E2UGZJBT.cjs\"],\"mappings\":\"AA+VI,SAAAA,iBAAMA,CAAA,QAAAC,gBAAA,CAAAC,cAAA,CAAAC,UAAA,OAAAC,SAAA,CAEJ,MAAO,CAAAH,gBAAgB,CAACC,cAAc,CAAC,CAACC,UAAU,CAAE,gBAAgB,CAAE,SAAAE,EAAE,QAAI,CAAAA,EAAE,CAACC,KAAK,GAAC,CAAC,CAAE,iBAAQ,EAAE,GAAC,CACrG\",\"ignoreList\":[]}"
391
- };
392
- const _worklet_14179670666721_init_data = {
393
- code: "function chunkE2UGZJBTCjs3(count,previous){const{useA,waveA,waveB,fromA,fromB,_nullishCoalesce,_optionalChain,origin,_reactnativereanimated,duration}=this.__closure;if(previous===null||count===previous)return;const wave=useA.value?waveA:waveB;const from=useA.value?fromA:fromB;from.value=_nullishCoalesce(_optionalChain([origin,'optionalAccess',function(_4){return _4.value;}]),function(){return{x:0,y:0};});wave.value=0;wave.value=_reactnativereanimated.withTiming.call(void 0,1,{duration:duration});useA.value=!useA.value;}",
394
- location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-E2UGZJBT.cjs",
395
- sourceMap: "{\"version\":3,\"names\":[\"chunkE2UGZJBTCjs3\",\"count\",\"previous\",\"useA\",\"waveA\",\"waveB\",\"fromA\",\"fromB\",\"_nullishCoalesce\",\"_optionalChain\",\"origin\",\"_reactnativereanimated\",\"duration\",\"__closure\",\"wave\",\"value\",\"from\",\"_4\",\"x\",\"y\",\"withTiming\",\"call\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-E2UGZJBT.cjs\"],\"mappings\":\"AAmWI,QAAC,CAAAA,iBAAeA,CAAAC,KAAK,CAAAC,QAAA,QAAAC,IAAA,CAAAC,KAAA,CAAAC,KAAA,CAAAC,KAAA,CAAAC,KAAA,CAAAC,gBAAA,CAAAC,cAAA,CAAAC,MAAA,CAAAC,sBAAA,CAAAC,QAAA,OAAAC,SAAA,CAEnB,GAAIX,QAAQ,GAAK,IAAI,EAAID,KAAK,GAAKC,QAAQ,CAAE,OAC7C,KAAM,CAAAY,IAAI,CAAGX,IAAI,CAACY,KAAK,CAAGX,KAAK,CAAGC,KAAK,CACvC,KAAM,CAAAW,IAAI,CAAGb,IAAI,CAACY,KAAK,CAAGT,KAAK,CAAGC,KAAK,CACvCS,IAAI,CAACD,KAAK,CAAGP,gBAAgB,CAACC,cAAc,CAAC,CAACC,MAAM,CAAE,gBAAgB,CAAE,SAAAO,EAAE,QAAI,CAAAA,EAAE,CAACF,KAAK,GAAC,CAAC,CAAE,iBAAQ,CAAEG,CAAC,CAAE,CAAC,CAAEC,CAAC,CAAE,CAAE,CAAC,EAAC,CAAC,CAClHL,IAAI,CAACC,KAAK,CAAG,CAAC,CACdD,IAAI,CAACC,KAAK,CAAGJ,sBAAsB,CAACS,UAAU,CAACC,IAAI,CAAC,IAAK,EAAC,CAAE,CAAC,CAAE,CAAET,QAAA,CAAAA,QAAS,CAAC,CAAC,CAC5ET,IAAI,CAACY,KAAK,CAAG,CAACZ,IAAI,CAACY,KAAK,CAC1B\",\"ignoreList\":[]}"
396
- };
397
- function AnimatedRipple({
398
- color,
399
- duration,
400
- opacity,
401
- style
402
- }) {
403
- const {
404
- pressCount,
405
- origin,
406
- size
407
- } = useFeedback();
408
- const waveA = _reactnativereanimated.useSharedValue.call(void 0, 0);
409
- const waveB = _reactnativereanimated.useSharedValue.call(void 0, 0);
410
- const fromA = _reactnativereanimated.useSharedValue.call(void 0, {
411
- x: 0,
412
- y: 0
413
- });
414
- const fromB = _reactnativereanimated.useSharedValue.call(void 0, {
415
- x: 0,
416
- y: 0
417
- });
418
- const useA = _reactnativereanimated.useSharedValue.call(void 0, true);
419
- _reactnativereanimated.useAnimatedReaction.call(void 0, function chunkE2UGZJBTCjs2Factory({
420
- _worklet_4906391944810_init_data,
421
- _nullishCoalesce,
422
- _optionalChain,
423
- pressCount
424
- }) {
425
- const _e = [new global.Error(), -4, -27];
426
- const chunkE2UGZJBTCjs2 = function () {
427
- return _nullishCoalesce(_optionalChain([pressCount, 'optionalAccess', _3 => _3.value]), () => 0);
428
- };
429
- chunkE2UGZJBTCjs2.__closure = {
430
- _nullishCoalesce,
431
- _optionalChain,
432
- pressCount
433
- };
434
- chunkE2UGZJBTCjs2.__workletHash = 4906391944810;
435
- chunkE2UGZJBTCjs2.__pluginVersion = "0.7.4";
436
- chunkE2UGZJBTCjs2.__initData = _worklet_4906391944810_init_data;
437
- chunkE2UGZJBTCjs2.__stackDetails = _e;
438
- return chunkE2UGZJBTCjs2;
439
- }({
440
- _worklet_4906391944810_init_data,
441
- _nullishCoalesce,
442
- _optionalChain,
443
- pressCount
444
- }), function chunkE2UGZJBTCjs3Factory({
445
- _worklet_14179670666721_init_data,
446
- useA,
447
- waveA,
448
- waveB,
449
- fromA,
450
- fromB,
451
- _nullishCoalesce,
452
- _optionalChain,
453
- origin,
454
- _reactnativereanimated,
455
- duration
456
- }) {
457
- const _e = [new global.Error(), -11, -27];
458
- const chunkE2UGZJBTCjs3 = function (count, previous) {
459
- if (previous === null || count === previous) return;
460
- const wave = useA.value ? waveA : waveB;
461
- const from = useA.value ? fromA : fromB;
462
- from.value = _nullishCoalesce(_optionalChain([origin, 'optionalAccess', _4 => _4.value]), () => ({
463
- x: 0,
464
- y: 0
465
- }));
466
- wave.value = 0;
467
- wave.value = _reactnativereanimated.withTiming.call(void 0, 1, {
468
- duration
469
- });
470
- useA.value = !useA.value;
471
- };
472
- chunkE2UGZJBTCjs3.__closure = {
473
- useA,
474
- waveA,
475
- waveB,
476
- fromA,
477
- fromB,
478
- _nullishCoalesce,
479
- _optionalChain,
480
- origin,
481
- _reactnativereanimated,
482
- duration
483
- };
484
- chunkE2UGZJBTCjs3.__workletHash = 14179670666721;
485
- chunkE2UGZJBTCjs3.__pluginVersion = "0.7.4";
486
- chunkE2UGZJBTCjs3.__initData = _worklet_14179670666721_init_data;
487
- chunkE2UGZJBTCjs3.__stackDetails = _e;
488
- return chunkE2UGZJBTCjs3;
489
- }({
490
- _worklet_14179670666721_init_data,
491
- useA,
492
- waveA,
493
- waveB,
494
- fromA,
495
- fromB,
496
- _nullishCoalesce,
497
- _optionalChain,
498
- origin,
499
- _reactnativereanimated,
500
- duration
501
- }), [pressCount, origin, duration, waveA, waveB, fromA, fromB, useA]);
502
- return /* @__PURE__ */_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
503
- children: [/* @__PURE__ */_jsxruntime.jsx.call(void 0, RippleWave, {
504
- wave: waveA,
505
- from: fromA,
506
- size,
507
- color,
508
- opacity,
509
- style
510
- }), /* @__PURE__ */_jsxruntime.jsx.call(void 0, RippleWave, {
511
- wave: waveB,
512
- from: fromB,
513
- size,
514
- color,
515
- opacity,
516
- style
517
- })]
518
- });
519
- }
520
- const _worklet_1643310987592_init_data = {
521
- code: "function chunkE2UGZJBTCjs4(){const{_nullishCoalesce,_optionalChain,size,RIPPLE_COVERAGE,from,progress,opacity,wave}=this.__closure;const within=_nullishCoalesce(_optionalChain([size,'optionalAccess',function(_5){return _5.value;}]),function(){return{width:0,height:0};});const radius=Math.sqrt(within.width*within.width+within.height*within.height)*RIPPLE_COVERAGE;const at=from.value;return{width:radius*2,height:radius*2,borderRadius:radius,opacity:_nullishCoalesce(_optionalChain([progress,'optionalAccess',function(_6){return _6.value;}]),function(){return 0;})*opacity,transform:[{translateX:at.x-radius},{translateY:at.y-radius},{scale:wave.value}]};}",
522
- location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-E2UGZJBT.cjs",
523
- sourceMap: "{\"version\":3,\"names\":[\"chunkE2UGZJBTCjs4\",\"_nullishCoalesce\",\"_optionalChain\",\"size\",\"RIPPLE_COVERAGE\",\"from\",\"progress\",\"opacity\",\"wave\",\"__closure\",\"within\",\"_5\",\"value\",\"width\",\"height\",\"radius\",\"Math\",\"sqrt\",\"at\",\"borderRadius\",\"_6\",\"transform\",\"translateX\",\"x\",\"translateY\",\"y\",\"scale\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-E2UGZJBT.cjs\"],\"mappings\":\"AAiZ6E,SAAAA,iBAAMA,CAAA,QAAAC,gBAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,eAAA,CAAAC,IAAA,CAAAC,QAAA,CAAAC,OAAA,CAAAC,IAAA,OAAAC,SAAA,CAE/E,KAAM,CAAAC,MAAM,CAAGT,gBAAgB,CAACC,cAAc,CAAC,CAACC,IAAI,CAAE,gBAAgB,CAAE,SAAAQ,EAAE,QAAI,CAAAA,EAAE,CAACC,KAAK,GAAC,CAAC,CAAE,iBAAQ,CAAEC,KAAK,CAAE,CAAC,CAAEC,MAAM,CAAE,CAAE,CAAC,EAAC,CAAC,CAC3H,KAAM,CAAAC,MAAM,CAAGC,IAAI,CAACC,IAAI,CAACP,MAAM,CAACG,KAAK,CAAGH,MAAM,CAACG,KAAK,CAAGH,MAAM,CAACI,MAAM,CAAGJ,MAAM,CAACI,MAAM,CAAC,CAAGV,eAAe,CACvG,KAAM,CAAAc,EAAE,CAAGb,IAAI,CAACO,KAAK,CACrB,MAAO,CACLC,KAAK,CAAEE,MAAM,CAAG,CAAC,CACjBD,MAAM,CAAEC,MAAM,CAAG,CAAC,CAClBI,YAAY,CAAEJ,MAAM,CAGpBR,OAAO,CAAGN,gBAAgB,CAACC,cAAc,CAAC,CAACI,QAAQ,CAAE,gBAAgB,CAAE,SAAAc,EAAE,QAAI,CAAAA,EAAE,CAACR,KAAK,GAAC,CAAC,CAAE,iBAAQ,EAAE,GAAC,CAAIL,OAAO,CAC/Gc,SAAS,CAAE,CACT,CAAEC,UAAU,CAAEJ,EAAE,CAACK,CAAC,CAAGR,MAAO,CAAC,CAC7B,CAAES,UAAU,CAAEN,EAAE,CAACO,CAAC,CAAGV,MAAO,CAAC,CAC7B,CAAEW,KAAK,CAAElB,IAAI,CAACI,KAAM,CAAC,CAEzB,CAAC,CACH\",\"ignoreList\":[]}"
524
- };
525
- function RippleWave({
526
- wave,
527
- from,
528
- size,
529
- color,
530
- opacity,
531
- style
532
- }) {
533
- const {
534
- progress
535
- } = useFeedback();
536
- const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, function chunkE2UGZJBTCjs4Factory({
537
- _worklet_1643310987592_init_data,
538
- _nullishCoalesce,
539
- _optionalChain,
540
- size,
541
- RIPPLE_COVERAGE,
542
- from,
543
- progress,
544
- opacity,
545
- wave
546
- }) {
547
- const _e = [new global.Error(), -9, -27];
548
- const chunkE2UGZJBTCjs4 = function () {
549
- const within = _nullishCoalesce(_optionalChain([size, 'optionalAccess', _5 => _5.value]), () => ({
550
- width: 0,
551
- height: 0
552
- }));
553
- const radius = Math.sqrt(within.width * within.width + within.height * within.height) * RIPPLE_COVERAGE;
554
- const at = from.value;
555
- return {
556
- width: radius * 2,
557
- height: radius * 2,
558
- borderRadius: radius,
559
- // The press, not the expansion. The wave is at full strength the instant it is
560
- // touched, stays while the finger stays, and drains when it lifts.
561
- opacity: _nullishCoalesce(_optionalChain([progress, 'optionalAccess', _6 => _6.value]), () => 0) * opacity,
562
- transform: [{
563
- translateX: at.x - radius
564
- }, {
565
- translateY: at.y - radius
566
- }, {
567
- scale: wave.value
568
- }]
569
- };
570
- };
571
- chunkE2UGZJBTCjs4.__closure = {
572
- _nullishCoalesce,
573
- _optionalChain,
574
- size,
575
- RIPPLE_COVERAGE,
576
- from,
577
- progress,
578
- opacity,
579
- wave
580
- };
581
- chunkE2UGZJBTCjs4.__workletHash = 1643310987592;
582
- chunkE2UGZJBTCjs4.__pluginVersion = "0.7.4";
583
- chunkE2UGZJBTCjs4.__initData = _worklet_1643310987592_init_data;
584
- chunkE2UGZJBTCjs4.__stackDetails = _e;
585
- return chunkE2UGZJBTCjs4;
586
- }({
587
- _worklet_1643310987592_init_data,
588
- _nullishCoalesce,
589
- _optionalChain,
590
- size,
591
- RIPPLE_COVERAGE,
592
- from,
593
- progress,
594
- opacity,
595
- wave
596
- }), [wave, from, size, opacity, progress]);
597
- return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, {
598
- pointerEvents: "none",
599
- style: [{
600
- position: "absolute",
601
- backgroundColor: color
602
- }, animatedStyle, style]
603
- });
604
- }
605
-
606
- // src/system/pressable-feedback/pressable-feedback.tsx
607
-
608
- var AnimatedPressable = _reactnativereanimated2.default.createAnimatedComponent(_reactnative.Pressable);
609
- var AnimatedSlot = _reactnativereanimated2.default.createAnimatedComponent(Slot);
610
- var PressableFeedback = _react.forwardRef.call(void 0, function PressableFeedback2({
611
- animation,
612
- feedbackVariant = "scale-highlight",
613
- ...rest
614
- }, ref) {
615
- const inheritedDisableAll = _react.useContext.call(void 0, DisableAllContext);
616
- const resolved = resolveAnimation(animation, inheritedDisableAll);
617
- const Feedback = resolved.none || feedbackVariant === "none" ? StaticFeedback : AnimatedFeedback;
618
- const body2 = /* @__PURE__ */_jsxruntime.jsx.call(void 0, Feedback, {
619
- ref,
620
- animation: resolved,
621
- feedbackVariant,
622
- ...rest
623
- });
624
- return resolved.disableAll ? /* @__PURE__ */_jsxruntime.jsx.call(void 0, DisableAllContext.Provider, {
625
- value: true,
626
- children: body2
627
- }) : body2;
628
- });
629
- var StaticFeedback = _react.forwardRef.call(void 0, function StaticFeedback2({
630
- isPressed = false,
631
- isDisabled,
632
- asChild = false,
633
- animation,
634
- feedbackVariant,
635
- children,
636
- style,
637
- ...rest
638
- }, ref) {
639
- const context = _react.useMemo.call(void 0, () => ({
640
- isPressed,
641
- animation
642
- }), [isPressed, animation]);
643
- const Root = asChild ? Slot : _reactnative.Pressable;
644
- return /* @__PURE__ */_jsxruntime.jsx.call(void 0, FeedbackProvider, {
645
- value: context,
646
- children: /* @__PURE__ */_jsxruntime.jsx.call(void 0, Root, {
647
- ref,
648
- style: [clipFor(feedbackVariant, asChild), style],
649
- disabled: isDisabled,
650
- ...rest,
651
- children: body(asChild, feedbackVariant, children)
652
- })
653
- });
654
- });
655
- const _worklet_8176987029290_init_data = {
656
- code: "function chunkE2UGZJBTCjs5(){const{animation,PRESS_SCALE,progress}=this.__closure;if(!animation.scale)return{};return{transform:[{scale:1-(1-PRESS_SCALE)*progress.value}]};}",
657
- location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-E2UGZJBT.cjs",
658
- sourceMap: "{\"version\":3,\"names\":[\"chunkE2UGZJBTCjs5\",\"animation\",\"PRESS_SCALE\",\"progress\",\"__closure\",\"scale\",\"transform\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-E2UGZJBT.cjs\"],\"mappings\":\"AAkf6E,SAAAA,iBAAMA,CAAA,QAAAC,SAAA,CAAAC,WAAA,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,WAAW,EAAIC,QAAQ,CAACI,KAAM,CAAC,CAAE,CAAC,CAC3E\",\"ignoreList\":[]}"
659
- };
660
- var AnimatedFeedback = _react.forwardRef.call(void 0, function AnimatedFeedback2({
661
- isPressed = false,
662
- isDisabled,
663
- asChild = false,
664
- animation,
665
- feedbackVariant,
666
- children,
667
- style,
668
- onPressIn,
669
- onLayout,
670
- ...rest
671
- }, ref) {
672
- const progress = _reactnativereanimated.useSharedValue.call(void 0, 0);
673
- const pressCount = _reactnativereanimated.useSharedValue.call(void 0, 0);
674
- const origin = _reactnativereanimated.useSharedValue.call(void 0, {
675
- x: 0,
676
- y: 0
677
- });
678
- const size = _reactnativereanimated.useSharedValue.call(void 0, {
679
- width: 0,
680
- height: 0
681
- });
682
- _react.useEffect.call(void 0, () => {
683
- progress.value = _reactnativereanimated.withTiming.call(void 0, isPressed ? 1 : 0, {
684
- duration: isPressed ? PRESS_DURATION : RELEASE_DURATION
685
- });
686
- }, [isPressed, progress]);
687
- const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, function chunkE2UGZJBTCjs5Factory({
688
- _worklet_8176987029290_init_data,
689
- animation,
690
- PRESS_SCALE,
691
- progress
692
- }) {
693
- const _e = [new global.Error(), -4, -27];
694
- const chunkE2UGZJBTCjs5 = function () {
695
- if (!animation.scale) return {};
696
- return {
697
- transform: [{
698
- scale: 1 - (1 - PRESS_SCALE) * progress.value
699
- }]
700
- };
701
- };
702
- chunkE2UGZJBTCjs5.__closure = {
703
- animation,
704
- PRESS_SCALE,
705
- progress
706
- };
707
- chunkE2UGZJBTCjs5.__workletHash = 8176987029290;
708
- chunkE2UGZJBTCjs5.__pluginVersion = "0.7.4";
709
- chunkE2UGZJBTCjs5.__initData = _worklet_8176987029290_init_data;
710
- chunkE2UGZJBTCjs5.__stackDetails = _e;
711
- return chunkE2UGZJBTCjs5;
712
- }({
713
- _worklet_8176987029290_init_data,
714
- animation,
715
- PRESS_SCALE,
716
- progress
717
- }), [animation.scale, progress]);
718
- const context = _react.useMemo.call(void 0, () => ({
719
- isPressed,
720
- animation,
721
- progress,
722
- pressCount,
723
- origin,
724
- size
725
- }), [isPressed, animation, progress, pressCount, origin, size]);
726
- const handlePressIn = event => {
727
- const {
728
- locationX,
729
- locationY
730
- } = event.nativeEvent;
731
- origin.value = {
732
- x: locationX,
733
- y: locationY
734
- };
735
- pressCount.value += 1;
736
- _optionalChain([onPressIn, 'optionalCall', _7 => _7(event)]);
737
- };
738
- const handleLayout = event => {
739
- const {
740
- width,
741
- height
742
- } = event.nativeEvent.layout;
743
- size.value = {
744
- width,
745
- height
746
- };
747
- _optionalChain([onLayout, 'optionalCall', _8 => _8(event)]);
748
- };
749
- const Root = asChild ? AnimatedSlot : AnimatedPressable;
750
- return /* @__PURE__ */_jsxruntime.jsx.call(void 0, FeedbackProvider, {
751
- value: context,
752
- children: /* @__PURE__ */_jsxruntime.jsx.call(void 0, Root, {
753
- ref,
754
- style: [clipFor(feedbackVariant, asChild), style, animatedStyle],
755
- disabled: isDisabled,
756
- onPressIn: handlePressIn,
757
- onLayout: handleLayout,
758
- ...rest,
759
- children: body(asChild, feedbackVariant, children)
760
- })
761
- });
762
- });
763
- function body(asChild, variant, children) {
764
- if (asChild) return children;
765
- return /* @__PURE__ */_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
766
- children: [/* @__PURE__ */_jsxruntime.jsx.call(void 0, DefaultOverlay, {
767
- variant
768
- }), children]
769
- });
770
- }
771
- var OVERLAY_CLIP = {
772
- overflow: "hidden"
773
- };
774
- function clipFor(variant, asChild) {
775
- if (asChild) return null;
776
- const mountsOverlay = variant === "scale-highlight" || variant === "scale-ripple";
777
- return mountsOverlay ? OVERLAY_CLIP : null;
778
- }
779
- function DefaultOverlay({
780
- variant
781
- }) {
782
- if (variant === "scale-highlight") return /* @__PURE__ */_jsxruntime.jsx.call(void 0, PressableFeedbackHighlight, {});
783
- if (variant === "scale-ripple") return /* @__PURE__ */_jsxruntime.jsx.call(void 0, PressableFeedbackRipple, {});
784
- return null;
785
- }
786
-
787
- // src/system/pressable-feedback/index.ts
788
- var PressableFeedback3 = Object.assign(PressableFeedback, {
789
- Highlight: PressableFeedbackHighlight,
790
- Ripple: PressableFeedbackRipple
791
- });
792
-
793
- // src/system/recipe/resolve-tint.ts
794
- var TINT_SLICE_BY_SUFFIX = [[/SoftForeground$/, "softForeground"], [/SoftPressed$/, "softPressed"], [/Soft$/, "soft"], [/Foreground$/, "foreground"], [/Pressed$/, "pressed"]];
795
- function tintSliceFor(token) {
796
- for (const [suffix, slice] of TINT_SLICE_BY_SUFFIX) {
797
- if (suffix.test(token)) return slice;
798
- }
799
- return "base";
800
- }
801
- function resolveTint(tokens, color, theme) {
802
- const tint = _chunk3QBT3Q65cjs.deriveTint.call(void 0, color, theme);
803
- const colors = {};
804
- for (const [role, token] of Object.entries(_nullishCoalesce(tokens, () => ({})))) {
805
- colors[role] = tint[tintSliceFor(token)];
806
- }
807
- return colors;
808
- }
809
-
810
- // src/system/recipe/style-cache.ts
811
-
812
- // src/system/recipe/variant-map.ts
813
- var STATE_ORDER = ["focused", "pressed", "disabled"];
814
- function resolveSelection(defaultVariants, selection) {
815
- const resolved = {
816
- ...defaultVariants
817
- };
818
- for (const [axis, value] of Object.entries(_nullishCoalesce(selection, () => ({})))) {
819
- if (value !== void 0) resolved[axis] = value;
820
- }
821
- return resolved;
822
- }
823
- function resolveVariantColors(tokens, theme) {
824
- const colors = {};
825
- for (const [role, token] of entriesOf(tokens)) {
826
- const value = theme.colors[token];
827
- if (value === void 0) {
828
- throw new Error(`XAUI: the recipe names "${token}" for its "${role}" role, but the theme has no such colour token. Check the spelling against XAUIColors.`);
829
- }
830
- colors[role] = value;
831
- }
832
- return colors;
833
- }
834
- function activeStateFns(states, active) {
835
- const fns = [];
836
- for (const state of STATE_ORDER) {
837
- const fn = active[state] ? _optionalChain([states, 'optionalAccess', _9 => _9[state]]) : void 0;
838
- if (fn) fns.push(fn);
839
- }
840
- return fns;
841
- }
842
- function collectStyleFns(config, selection, states) {
843
- const fns = [];
844
- if (config.base) fns.push(config.base);
845
- if (config.paint) fns.push(config.paint);
846
- for (const [axis, values] of Object.entries(_nullishCoalesce(config.variants, () => ({})))) {
847
- const value = selection[axis];
848
- const fn = value === void 0 ? void 0 : values[value];
849
- if (fn) fns.push(fn);
850
- }
851
- for (const compound of _nullishCoalesce(config.compoundVariants, () => [])) {
852
- if (appliesTo(compound.when, selection)) fns.push(compound.style);
853
- }
854
- return [...fns, ...activeStateFns(config.states, states)];
855
- }
856
- function appliesTo(when, selection) {
857
- return Object.entries(when).every(([axis, value]) => selection[axis] === value);
858
- }
859
- function entriesOf(tokens) {
860
- return Object.entries(_nullishCoalesce(tokens, () => ({})));
861
- }
862
-
863
- // src/system/recipe/style-cache.ts
864
- function createStyleCache(slots) {
865
- const entries = /* @__PURE__ */new Map();
866
- return {
867
- read(key, build) {
868
- const hit = entries.get(key);
869
- if (hit) return hit;
870
- const built = build();
871
- const complete = {};
872
- for (const slot of slots) complete[slot] = _nullishCoalesce(built[slot], () => ({}));
873
- const created = _reactnative.StyleSheet.create(complete);
874
- entries.set(key, created);
875
- return created;
876
- },
877
- get size() {
878
- return entries.size;
879
- },
880
- clear() {
881
- entries.clear();
882
- }
883
- };
884
- }
885
- function cacheKey(theme, selection, states) {
886
- const axes = Object.keys(selection).sort().map(axis => `${axis}:${_nullishCoalesce(selection[axis], () => "-")}`).join("|");
887
- const active = STATE_ORDER.filter(state => states[state]).join(",");
888
- return `${theme.id}|${theme.mode}|${axes}|${active}`;
889
- }
890
-
891
- // src/system/recipe/create-recipe.ts
892
- function createRecipe(config) {
893
- const cache = createStyleCache(config.slots);
894
- const tokensFor = variant => variant === void 0 ? void 0 : _optionalChain([config, 'access', _10 => _10.variantTokens, 'optionalAccess', _11 => _11[variant]]);
895
- return {
896
- slots: config.slots,
897
- resolve({
898
- theme,
899
- selection,
900
- states = {}
901
- }) {
902
- const resolved = resolveSelection(config.defaultVariants, selection);
903
- return cache.read(cacheKey(theme, resolved, states), () => {
904
- const colors = resolveVariantColors(tokensFor(resolved.variant), theme);
905
- return apply(collectStyleFns(config, resolved, states), theme, colors);
906
- });
907
- },
908
- tint({
909
- theme,
910
- color,
911
- selection,
912
- states = {}
913
- }) {
914
- if (!config.paint) return {};
915
- const resolved = resolveSelection(config.defaultVariants, selection);
916
- const tokens = tokensFor(resolved.variant);
917
- if (!tokens) return {};
918
- const colors = resolveTint(tokens, color, theme);
919
- const fns = [config.paint, ...activeStateFns(config.states, states)];
920
- return apply(fns, theme, colors);
921
- }
922
- };
923
- }
924
- function apply(fns, theme, colors) {
925
- const merged = {};
926
- for (const fn of fns) {
927
- const produced = fn(theme, colors);
928
- for (const slot of Object.keys(produced)) {
929
- const style = produced[slot];
930
- if (!style) continue;
931
- const previous = merged[slot];
932
- merged[slot] = previous ? {
933
- ...previous,
934
- ...style
935
- } : style;
936
- }
937
- }
938
- return merged;
939
- }
940
- exports.IconContext = IconContext;
941
- exports.useIconContext = useIconContext;
942
- exports.Icon = Icon;
943
- exports.childrenToString = childrenToString;
944
- exports.createSlotContext = createSlotContext;
945
- exports.mergeRefs = mergeRefs;
946
- exports.mergeProps = mergeProps;
947
- exports.Slot = Slot;
948
- exports.useFeedback = useFeedback;
949
- exports.PRESS_SCALE = PRESS_SCALE;
950
- exports.PRESS_DURATION = PRESS_DURATION;
951
- exports.RELEASE_DURATION = RELEASE_DURATION;
952
- exports.HIGHLIGHT_OPACITY = HIGHLIGHT_OPACITY;
953
- exports.RIPPLE_OPACITY = RIPPLE_OPACITY;
954
- exports.RIPPLE_DURATION = RIPPLE_DURATION;
955
- exports.RIPPLE_COVERAGE = RIPPLE_COVERAGE;
956
- exports.resolveAnimation = resolveAnimation;
957
- exports.resolveSlotAnimation = resolveSlotAnimation;
958
- exports.PressableFeedback = PressableFeedback3;
959
- exports.createRecipe = createRecipe;