@xaui/native 0.9.1-alpha.8 → 0.9.1-alpha.9
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.
- package/dist/{chunk-AW63PTQ4.cjs → chunk-2FEDC7U5.cjs} +2 -1
- package/dist/chunk-3TIDEII6.js +57 -0
- package/dist/{chunk-2KXQATVL.js → chunk-7XGOXTGT.js} +2 -1
- package/dist/chunk-LMUPNKPH.cjs +57 -0
- package/dist/chunk-PBRPIZZ2.js +350 -0
- package/dist/{chunk-NUF3UUTE.js → chunk-U3C6VN4X.js} +187 -233
- package/dist/chunk-V42SPPP3.cjs +350 -0
- package/dist/{chunk-OS5ABUCG.cjs → chunk-VGWN4JTL.cjs} +178 -224
- package/dist/components/button/index.cjs +12 -0
- package/dist/components/button/index.d.cts +192 -0
- package/dist/components/button/index.d.ts +192 -0
- package/dist/components/button/index.js +12 -0
- package/dist/create-recipe-BjxSp9_k.d.cts +197 -0
- package/dist/create-recipe-M99yoHrG.d.ts +197 -0
- package/dist/index.cjs +17 -31
- package/dist/index.d.cts +14 -4
- package/dist/index.d.ts +14 -4
- package/dist/index.js +19 -33
- package/dist/system/index.cjs +4 -2
- package/dist/system/index.d.cts +54 -243
- package/dist/system/index.d.ts +54 -243
- package/dist/system/index.js +6 -4
- package/dist/theme/index.cjs +2 -2
- package/dist/theme/index.js +1 -1
- package/package.json +6 -1
|
@@ -3,12 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
var _chunk3QBT3Q65cjs = require('./chunk-3QBT3Q65.cjs');
|
|
5
5
|
|
|
6
|
-
// src/system/icon/icon.tsx
|
|
7
|
-
var _react = require('react');
|
|
8
|
-
var _reactnative = require('react-native');
|
|
9
|
-
|
|
10
6
|
// src/system/icon/icon-context.ts
|
|
11
|
-
|
|
7
|
+
var _react = require('react');
|
|
12
8
|
var IconContext = _react.createContext.call(void 0, {});
|
|
13
9
|
IconContext.displayName = "XAUI.Icon.Context";
|
|
14
10
|
function useIconContext() {
|
|
@@ -16,6 +12,9 @@ function useIconContext() {
|
|
|
16
12
|
}
|
|
17
13
|
|
|
18
14
|
// src/system/icon/icon.tsx
|
|
15
|
+
|
|
16
|
+
var _reactnative = require('react-native');
|
|
17
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
19
18
|
function Icon({
|
|
20
19
|
as: Component,
|
|
21
20
|
children,
|
|
@@ -29,7 +28,7 @@ function Icon({
|
|
|
29
28
|
const resolvedSize = _nullishCoalesce(_nullishCoalesce(size, () => ( inherited.size)), () => ( theme.fontSizes.md));
|
|
30
29
|
const resolvedColor = _nullishCoalesce(_nullishCoalesce(color, () => ( inherited.color)), () => ( theme.colors.foreground));
|
|
31
30
|
if (Component) {
|
|
32
|
-
return /* @__PURE__ */
|
|
31
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component, { size: resolvedSize, color: resolvedColor });
|
|
33
32
|
}
|
|
34
33
|
if (_react.isValidElement.call(void 0, children)) {
|
|
35
34
|
return _react.cloneElement.call(void 0, children, {
|
|
@@ -39,7 +38,7 @@ function Icon({
|
|
|
39
38
|
});
|
|
40
39
|
}
|
|
41
40
|
if (source) {
|
|
42
|
-
return /* @__PURE__ */
|
|
41
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
43
42
|
_reactnative.Image,
|
|
44
43
|
{
|
|
45
44
|
source,
|
|
@@ -56,65 +55,28 @@ function Icon({
|
|
|
56
55
|
}
|
|
57
56
|
Icon.displayName = "XAUI.Icon";
|
|
58
57
|
|
|
59
|
-
// src/system/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
// src/system/portal/portal-context.ts
|
|
63
|
-
|
|
64
|
-
var PortalContext = _react.createContext.call(void 0, null);
|
|
58
|
+
// src/system/slot/children-to-string.ts
|
|
65
59
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const key = _react.useId.call(void 0, );
|
|
70
|
-
_react.useLayoutEffect.call(void 0, () => {
|
|
71
|
-
_optionalChain([context, 'optionalAccess', _ => _.addPortal, 'call', _2 => _2(key, children)]);
|
|
72
|
-
}, [children, context, key]);
|
|
73
|
-
_react.useLayoutEffect.call(void 0, () => {
|
|
74
|
-
return () => _optionalChain([context, 'optionalAccess', _3 => _3.removePortal, 'call', _4 => _4(key)]);
|
|
75
|
-
}, [context, key]);
|
|
76
|
-
return null;
|
|
60
|
+
function childrenToString(children) {
|
|
61
|
+
const text = stringify(children);
|
|
62
|
+
return text === null || text === "" ? null : text;
|
|
77
63
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if (!current.has(key)) return current;
|
|
94
|
-
const next = new Map(current);
|
|
95
|
-
next.delete(key);
|
|
96
|
-
return next;
|
|
97
|
-
});
|
|
98
|
-
}, []);
|
|
99
|
-
const methods = _react.useMemo.call(void 0,
|
|
100
|
-
() => ({ addPortal, removePortal }),
|
|
101
|
-
[addPortal, removePortal]
|
|
102
|
-
);
|
|
103
|
-
return /* @__PURE__ */ React.createElement(PortalContext.Provider, { value: methods }, /* @__PURE__ */ React.createElement(_reactnative.View, { style: styles.container }, children, Array.from(portals, ([key, element]) => /* @__PURE__ */ React.createElement(_react.Fragment, { key }, element))));
|
|
64
|
+
function stringify(node) {
|
|
65
|
+
if (node === null || node === void 0 || typeof node === "boolean") return "";
|
|
66
|
+
if (typeof node === "string") return node;
|
|
67
|
+
if (typeof node === "number") return String(node);
|
|
68
|
+
if (_react.isValidElement.call(void 0, node)) return null;
|
|
69
|
+
if (Array.isArray(node)) {
|
|
70
|
+
let text = "";
|
|
71
|
+
for (const child of node) {
|
|
72
|
+
const part = stringify(child);
|
|
73
|
+
if (part === null) return null;
|
|
74
|
+
text += part;
|
|
75
|
+
}
|
|
76
|
+
return text;
|
|
77
|
+
}
|
|
78
|
+
return null;
|
|
104
79
|
}
|
|
105
|
-
PortalHost.displayName = "XAUI.PortalHost";
|
|
106
|
-
|
|
107
|
-
// src/system/pressable-feedback/pressable-feedback.tsx
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
var _reactnativereanimated = require('react-native-reanimated'); var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
|
|
115
|
-
|
|
116
|
-
// src/system/pressable-feedback/pressable-feedback-context.ts
|
|
117
|
-
|
|
118
80
|
|
|
119
81
|
// src/system/slot/create-slot-context.ts
|
|
120
82
|
|
|
@@ -127,7 +89,7 @@ function createSlotContext(name) {
|
|
|
127
89
|
const error = new Error(
|
|
128
90
|
`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.`
|
|
129
91
|
);
|
|
130
|
-
_optionalChain([Error, 'access',
|
|
92
|
+
_optionalChain([Error, 'access', _ => _.captureStackTrace, 'optionalCall', _2 => _2(
|
|
131
93
|
error,
|
|
132
94
|
useSlotContext
|
|
133
95
|
)]);
|
|
@@ -138,18 +100,84 @@ function createSlotContext(name) {
|
|
|
138
100
|
return [Context.Provider, useSlotContext];
|
|
139
101
|
}
|
|
140
102
|
|
|
141
|
-
// src/system/
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
103
|
+
// src/system/slot/merge-refs.ts
|
|
104
|
+
function mergeRefs(...refs) {
|
|
105
|
+
return (value) => {
|
|
106
|
+
for (const ref of refs) {
|
|
107
|
+
if (typeof ref === "function") ref(value);
|
|
108
|
+
else if (ref) ref.current = value;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
148
112
|
|
|
113
|
+
// src/system/slot/merge-props.ts
|
|
114
|
+
var EVENT_HANDLER = /^on[A-Z]/;
|
|
115
|
+
function mergeProps(ours, theirs) {
|
|
116
|
+
const merged = { ...ours };
|
|
117
|
+
for (const key of Object.keys(theirs)) {
|
|
118
|
+
const ourValue = ours[key];
|
|
119
|
+
const theirValue = theirs[key];
|
|
120
|
+
if (EVENT_HANDLER.test(key)) {
|
|
121
|
+
merged[key] = composeHandlers(ourValue, theirValue);
|
|
122
|
+
} else if (key === "style") {
|
|
123
|
+
merged[key] = mergeStyles(ourValue, theirValue);
|
|
124
|
+
} else if (key === "ref") {
|
|
125
|
+
merged[key] = mergeRefs(
|
|
126
|
+
ourValue,
|
|
127
|
+
theirValue
|
|
128
|
+
);
|
|
129
|
+
} else {
|
|
130
|
+
merged[key] = theirValue;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return merged;
|
|
134
|
+
}
|
|
135
|
+
function composeHandlers(ours, theirs) {
|
|
136
|
+
if (typeof ours !== "function") return theirs;
|
|
137
|
+
if (typeof theirs !== "function") return ours;
|
|
138
|
+
return (...args) => {
|
|
139
|
+
;
|
|
140
|
+
ours(...args);
|
|
141
|
+
return theirs(...args);
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
function mergeStyles(ours, theirs) {
|
|
145
|
+
if (typeof ours === "function" || typeof theirs === "function") {
|
|
146
|
+
return (state) => [
|
|
147
|
+
resolveStyle(ours, state),
|
|
148
|
+
resolveStyle(theirs, state)
|
|
149
|
+
];
|
|
150
|
+
}
|
|
151
|
+
return [ours, theirs];
|
|
152
|
+
}
|
|
153
|
+
function resolveStyle(style, state) {
|
|
154
|
+
return typeof style === "function" ? style(state) : style;
|
|
155
|
+
}
|
|
149
156
|
|
|
157
|
+
// src/system/slot/slot.tsx
|
|
150
158
|
|
|
159
|
+
var Slot = _react.forwardRef.call(void 0, function Slot2({ children, ...ours }, ref) {
|
|
160
|
+
if (!_react.isValidElement.call(void 0, children)) {
|
|
161
|
+
throw new Error(
|
|
162
|
+
"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."
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
const child = children;
|
|
166
|
+
const merged = mergeProps(ours, child.props);
|
|
167
|
+
merged.ref = mergeRefs(ref, refOf(child));
|
|
168
|
+
return _react.cloneElement.call(void 0, child, merged);
|
|
169
|
+
});
|
|
170
|
+
Slot.displayName = "XAUI.Slot";
|
|
171
|
+
function refOf(element) {
|
|
172
|
+
const fromProps = element.props.ref;
|
|
173
|
+
const fromElement = element.ref;
|
|
174
|
+
return _nullishCoalesce(fromProps, () => ( fromElement));
|
|
175
|
+
}
|
|
151
176
|
|
|
177
|
+
// src/system/pressable-feedback/pressable-feedback-context.ts
|
|
152
178
|
|
|
179
|
+
var [FeedbackProvider, useFeedback] = createSlotContext("PressableFeedback");
|
|
180
|
+
var DisableAllContext = _react.createContext.call(void 0, false);
|
|
153
181
|
|
|
154
182
|
// src/system/pressable-feedback/pressable-feedback.animation.ts
|
|
155
183
|
var PRESS_SCALE = 0.975;
|
|
@@ -206,7 +234,24 @@ function resolveSlotAnimation(override, enabledByRoot, defaultOpacity, defaultDu
|
|
|
206
234
|
};
|
|
207
235
|
}
|
|
208
236
|
|
|
237
|
+
// src/system/pressable-feedback/pressable-feedback.tsx
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
var _reactnativereanimated = require('react-native-reanimated'); var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
|
|
245
|
+
|
|
209
246
|
// src/system/pressable-feedback/pressable-feedback-highlight.tsx
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
|
|
210
255
|
function PressableFeedbackHighlight({
|
|
211
256
|
style,
|
|
212
257
|
animation: override
|
|
@@ -224,7 +269,7 @@ function PressableFeedbackHighlight({
|
|
|
224
269
|
style
|
|
225
270
|
];
|
|
226
271
|
if (!progress || !settings.enabled) {
|
|
227
|
-
return /* @__PURE__ */
|
|
272
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
228
273
|
_reactnative.View,
|
|
229
274
|
{
|
|
230
275
|
pointerEvents: "none",
|
|
@@ -232,7 +277,7 @@ function PressableFeedbackHighlight({
|
|
|
232
277
|
}
|
|
233
278
|
);
|
|
234
279
|
}
|
|
235
|
-
return /* @__PURE__ */
|
|
280
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
236
281
|
AnimatedHighlight,
|
|
237
282
|
{
|
|
238
283
|
base,
|
|
@@ -252,10 +297,11 @@ function AnimatedHighlight({
|
|
|
252
297
|
_react.useEffect.call(void 0, () => {
|
|
253
298
|
shown.value = _reactnativereanimated.withTiming.call(void 0, isPressed ? 1 : 0, { duration });
|
|
254
299
|
}, [isPressed, shown, duration]);
|
|
255
|
-
const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0,
|
|
256
|
-
opacity: shown.value * opacity
|
|
257
|
-
|
|
258
|
-
|
|
300
|
+
const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0,
|
|
301
|
+
() => ({ opacity: shown.value * opacity }),
|
|
302
|
+
[shown, opacity]
|
|
303
|
+
);
|
|
304
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, { pointerEvents: "none", style: [base, animatedStyle] });
|
|
259
305
|
}
|
|
260
306
|
|
|
261
307
|
// src/system/pressable-feedback/pressable-feedback-ripple.tsx
|
|
@@ -266,6 +312,7 @@ function AnimatedHighlight({
|
|
|
266
312
|
|
|
267
313
|
|
|
268
314
|
|
|
315
|
+
|
|
269
316
|
function PressableFeedbackRipple({
|
|
270
317
|
style,
|
|
271
318
|
animation: override
|
|
@@ -279,7 +326,7 @@ function PressableFeedbackRipple({
|
|
|
279
326
|
RIPPLE_DURATION
|
|
280
327
|
);
|
|
281
328
|
if (!progress || !pressCount || !origin || !size || !settings.enabled) return null;
|
|
282
|
-
return /* @__PURE__ */
|
|
329
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
283
330
|
AnimatedRipple,
|
|
284
331
|
{
|
|
285
332
|
color: theme.colors.foreground,
|
|
@@ -303,38 +350,42 @@ function AnimatedRipple({
|
|
|
303
350
|
const fromB = _reactnativereanimated.useSharedValue.call(void 0, { x: 0, y: 0 });
|
|
304
351
|
const useA = _reactnativereanimated.useSharedValue.call(void 0, true);
|
|
305
352
|
_reactnativereanimated.useAnimatedReaction.call(void 0,
|
|
306
|
-
() => _nullishCoalesce(_optionalChain([pressCount, 'optionalAccess',
|
|
353
|
+
() => _nullishCoalesce(_optionalChain([pressCount, 'optionalAccess', _3 => _3.value]), () => ( 0)),
|
|
307
354
|
(count, previous) => {
|
|
308
355
|
if (previous === null || count === previous) return;
|
|
309
356
|
const wave = useA.value ? waveA : waveB;
|
|
310
357
|
const from = useA.value ? fromA : fromB;
|
|
311
|
-
from.value = _nullishCoalesce(_optionalChain([origin, 'optionalAccess',
|
|
358
|
+
from.value = _nullishCoalesce(_optionalChain([origin, 'optionalAccess', _4 => _4.value]), () => ( { x: 0, y: 0 }));
|
|
312
359
|
wave.value = 0;
|
|
313
360
|
wave.value = _reactnativereanimated.withTiming.call(void 0, 2, { duration: duration * 2 });
|
|
314
361
|
useA.value = !useA.value;
|
|
315
|
-
}
|
|
362
|
+
},
|
|
363
|
+
[pressCount, origin, duration, waveA, waveB, fromA, fromB, useA]
|
|
316
364
|
);
|
|
317
|
-
return /* @__PURE__ */
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
365
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
366
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
367
|
+
RippleWave,
|
|
368
|
+
{
|
|
369
|
+
wave: waveA,
|
|
370
|
+
from: fromA,
|
|
371
|
+
size,
|
|
372
|
+
color,
|
|
373
|
+
opacity,
|
|
374
|
+
style
|
|
375
|
+
}
|
|
376
|
+
),
|
|
377
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
378
|
+
RippleWave,
|
|
379
|
+
{
|
|
380
|
+
wave: waveB,
|
|
381
|
+
from: fromB,
|
|
382
|
+
size,
|
|
383
|
+
color,
|
|
384
|
+
opacity,
|
|
385
|
+
style
|
|
386
|
+
}
|
|
387
|
+
)
|
|
388
|
+
] });
|
|
338
389
|
}
|
|
339
390
|
function RippleWave({
|
|
340
391
|
wave,
|
|
@@ -345,7 +396,7 @@ function RippleWave({
|
|
|
345
396
|
style
|
|
346
397
|
}) {
|
|
347
398
|
const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, () => {
|
|
348
|
-
const within = _nullishCoalesce(_optionalChain([size, 'optionalAccess',
|
|
399
|
+
const within = _nullishCoalesce(_optionalChain([size, 'optionalAccess', _5 => _5.value]), () => ( { width: 0, height: 0 }));
|
|
349
400
|
const radius = Math.sqrt(within.width * within.width + within.height * within.height) * RIPPLE_COVERAGE;
|
|
350
401
|
const at = from.value;
|
|
351
402
|
return {
|
|
@@ -361,8 +412,8 @@ function RippleWave({
|
|
|
361
412
|
{ scale: _reactnativereanimated.interpolate.call(void 0, wave.value, [0, 1, 2], [0, 1, 1]) }
|
|
362
413
|
]
|
|
363
414
|
};
|
|
364
|
-
});
|
|
365
|
-
return /* @__PURE__ */
|
|
415
|
+
}, [wave, from, size, opacity]);
|
|
416
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
366
417
|
_reactnativereanimated2.default.View,
|
|
367
418
|
{
|
|
368
419
|
pointerEvents: "none",
|
|
@@ -375,83 +426,8 @@ function RippleWave({
|
|
|
375
426
|
);
|
|
376
427
|
}
|
|
377
428
|
|
|
378
|
-
// src/system/slot/slot.tsx
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
// src/system/slot/merge-refs.ts
|
|
382
|
-
function mergeRefs(...refs) {
|
|
383
|
-
return (value) => {
|
|
384
|
-
for (const ref of refs) {
|
|
385
|
-
if (typeof ref === "function") ref(value);
|
|
386
|
-
else if (ref) ref.current = value;
|
|
387
|
-
}
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
// src/system/slot/merge-props.ts
|
|
392
|
-
var EVENT_HANDLER = /^on[A-Z]/;
|
|
393
|
-
function mergeProps(ours, theirs) {
|
|
394
|
-
const merged = { ...ours };
|
|
395
|
-
for (const key of Object.keys(theirs)) {
|
|
396
|
-
const ourValue = ours[key];
|
|
397
|
-
const theirValue = theirs[key];
|
|
398
|
-
if (EVENT_HANDLER.test(key)) {
|
|
399
|
-
merged[key] = composeHandlers(ourValue, theirValue);
|
|
400
|
-
} else if (key === "style") {
|
|
401
|
-
merged[key] = mergeStyles(ourValue, theirValue);
|
|
402
|
-
} else if (key === "ref") {
|
|
403
|
-
merged[key] = mergeRefs(
|
|
404
|
-
ourValue,
|
|
405
|
-
theirValue
|
|
406
|
-
);
|
|
407
|
-
} else {
|
|
408
|
-
merged[key] = theirValue;
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
return merged;
|
|
412
|
-
}
|
|
413
|
-
function composeHandlers(ours, theirs) {
|
|
414
|
-
if (typeof ours !== "function") return theirs;
|
|
415
|
-
if (typeof theirs !== "function") return ours;
|
|
416
|
-
return (...args) => {
|
|
417
|
-
;
|
|
418
|
-
ours(...args);
|
|
419
|
-
return theirs(...args);
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
|
-
function mergeStyles(ours, theirs) {
|
|
423
|
-
if (typeof ours === "function" || typeof theirs === "function") {
|
|
424
|
-
return (state) => [
|
|
425
|
-
resolveStyle(ours, state),
|
|
426
|
-
resolveStyle(theirs, state)
|
|
427
|
-
];
|
|
428
|
-
}
|
|
429
|
-
return [ours, theirs];
|
|
430
|
-
}
|
|
431
|
-
function resolveStyle(style, state) {
|
|
432
|
-
return typeof style === "function" ? style(state) : style;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
// src/system/slot/slot.tsx
|
|
436
|
-
var Slot = _react.forwardRef.call(void 0, function Slot2({ children, ...ours }, ref) {
|
|
437
|
-
if (!_react.isValidElement.call(void 0, children)) {
|
|
438
|
-
throw new Error(
|
|
439
|
-
"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."
|
|
440
|
-
);
|
|
441
|
-
}
|
|
442
|
-
const child = children;
|
|
443
|
-
const merged = mergeProps(ours, child.props);
|
|
444
|
-
merged.ref = mergeRefs(ref, refOf(child));
|
|
445
|
-
return _react.cloneElement.call(void 0, child, merged);
|
|
446
|
-
});
|
|
447
|
-
Slot.displayName = "XAUI.Slot";
|
|
448
|
-
function refOf(element) {
|
|
449
|
-
const fromProps = element.props.ref;
|
|
450
|
-
const fromElement = element.ref;
|
|
451
|
-
return _nullishCoalesce(fromProps, () => ( fromElement));
|
|
452
|
-
}
|
|
453
|
-
|
|
454
429
|
// src/system/pressable-feedback/pressable-feedback.tsx
|
|
430
|
+
|
|
455
431
|
var AnimatedPressable = _reactnativereanimated2.default.createAnimatedComponent(_reactnative.Pressable);
|
|
456
432
|
var AnimatedSlot = _reactnativereanimated2.default.createAnimatedComponent(Slot);
|
|
457
433
|
var PressableFeedback = _react.forwardRef.call(void 0,
|
|
@@ -459,7 +435,7 @@ var PressableFeedback = _react.forwardRef.call(void 0,
|
|
|
459
435
|
const inheritedDisableAll = _react.useContext.call(void 0, DisableAllContext);
|
|
460
436
|
const resolved = resolveAnimation(animation, inheritedDisableAll);
|
|
461
437
|
const Feedback = resolved.none || feedbackVariant === "none" ? StaticFeedback : AnimatedFeedback;
|
|
462
|
-
const body2 = /* @__PURE__ */
|
|
438
|
+
const body2 = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
463
439
|
Feedback,
|
|
464
440
|
{
|
|
465
441
|
ref,
|
|
@@ -468,7 +444,7 @@ var PressableFeedback = _react.forwardRef.call(void 0,
|
|
|
468
444
|
...rest
|
|
469
445
|
}
|
|
470
446
|
);
|
|
471
|
-
return resolved.disableAll ? /* @__PURE__ */
|
|
447
|
+
return resolved.disableAll ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DisableAllContext.Provider, { value: true, children: body2 }) : body2;
|
|
472
448
|
}
|
|
473
449
|
);
|
|
474
450
|
var StaticFeedback = _react.forwardRef.call(void 0, function StaticFeedback2({
|
|
@@ -483,7 +459,7 @@ var StaticFeedback = _react.forwardRef.call(void 0, function StaticFeedback2({
|
|
|
483
459
|
}, ref) {
|
|
484
460
|
const context = _react.useMemo.call(void 0, () => ({ isPressed, animation }), [isPressed, animation]);
|
|
485
461
|
const Root = asChild ? Slot : _reactnative.Pressable;
|
|
486
|
-
return /* @__PURE__ */
|
|
462
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FeedbackProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Root, { ref, style, disabled: isDisabled, ...rest, children: body(asChild, feedbackVariant, children) }) });
|
|
487
463
|
});
|
|
488
464
|
var AnimatedFeedback = _react.forwardRef.call(void 0, function AnimatedFeedback2({
|
|
489
465
|
isPressed = false,
|
|
@@ -507,7 +483,8 @@ var AnimatedFeedback = _react.forwardRef.call(void 0, function AnimatedFeedback2
|
|
|
507
483
|
});
|
|
508
484
|
}, [isPressed, progress]);
|
|
509
485
|
const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0,
|
|
510
|
-
() => animation.scale ? { transform: [{ scale: 1 - (1 - PRESS_SCALE) * progress.value }] } : {}
|
|
486
|
+
() => animation.scale ? { transform: [{ scale: 1 - (1 - PRESS_SCALE) * progress.value }] } : {},
|
|
487
|
+
[animation.scale, progress]
|
|
511
488
|
);
|
|
512
489
|
const context = _react.useMemo.call(void 0,
|
|
513
490
|
() => ({ isPressed, animation, progress, pressCount, origin, size }),
|
|
@@ -517,16 +494,16 @@ var AnimatedFeedback = _react.forwardRef.call(void 0, function AnimatedFeedback2
|
|
|
517
494
|
const { locationX, locationY } = event.nativeEvent;
|
|
518
495
|
origin.value = { x: locationX, y: locationY };
|
|
519
496
|
pressCount.value += 1;
|
|
520
|
-
_optionalChain([onPressIn, 'optionalCall',
|
|
497
|
+
_optionalChain([onPressIn, 'optionalCall', _6 => _6(event)]);
|
|
521
498
|
};
|
|
522
499
|
const handleLayout = (event) => {
|
|
523
500
|
const { width, height } = event.nativeEvent.layout;
|
|
524
501
|
size.value = { width, height };
|
|
525
|
-
_optionalChain([onLayout, 'optionalCall',
|
|
502
|
+
_optionalChain([onLayout, 'optionalCall', _7 => _7(event)]);
|
|
526
503
|
};
|
|
527
504
|
const clip = feedbackVariant === "scale-ripple" ? { overflow: "hidden" } : null;
|
|
528
505
|
const Root = asChild ? AnimatedSlot : AnimatedPressable;
|
|
529
|
-
return /* @__PURE__ */
|
|
506
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FeedbackProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
530
507
|
Root,
|
|
531
508
|
{
|
|
532
509
|
ref,
|
|
@@ -534,18 +511,21 @@ var AnimatedFeedback = _react.forwardRef.call(void 0, function AnimatedFeedback2
|
|
|
534
511
|
disabled: isDisabled,
|
|
535
512
|
onPressIn: handlePressIn,
|
|
536
513
|
onLayout: handleLayout,
|
|
537
|
-
...rest
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
));
|
|
514
|
+
...rest,
|
|
515
|
+
children: body(asChild, feedbackVariant, children)
|
|
516
|
+
}
|
|
517
|
+
) });
|
|
541
518
|
});
|
|
542
519
|
function body(asChild, variant, children) {
|
|
543
520
|
if (asChild) return children;
|
|
544
|
-
return /* @__PURE__ */
|
|
521
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
522
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, DefaultOverlay, { variant }),
|
|
523
|
+
children
|
|
524
|
+
] });
|
|
545
525
|
}
|
|
546
526
|
function DefaultOverlay({ variant }) {
|
|
547
|
-
if (variant === "scale-highlight") return /* @__PURE__ */
|
|
548
|
-
if (variant === "scale-ripple") return /* @__PURE__ */
|
|
527
|
+
if (variant === "scale-highlight") return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PressableFeedbackHighlight, {});
|
|
528
|
+
if (variant === "scale-ripple") return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PressableFeedbackRipple, {});
|
|
549
529
|
return null;
|
|
550
530
|
}
|
|
551
531
|
|
|
@@ -606,7 +586,7 @@ function resolveVariantColors(tokens, theme) {
|
|
|
606
586
|
function activeStateFns(states, active) {
|
|
607
587
|
const fns = [];
|
|
608
588
|
for (const state of STATE_ORDER) {
|
|
609
|
-
const fn = active[state] ? _optionalChain([states, 'optionalAccess',
|
|
589
|
+
const fn = active[state] ? _optionalChain([states, 'optionalAccess', _8 => _8[state]]) : void 0;
|
|
610
590
|
if (fn) fns.push(fn);
|
|
611
591
|
}
|
|
612
592
|
return fns;
|
|
@@ -663,7 +643,7 @@ function cacheKey(theme, selection, states) {
|
|
|
663
643
|
// src/system/recipe/create-recipe.ts
|
|
664
644
|
function createRecipe(config) {
|
|
665
645
|
const cache = createStyleCache(config.slots);
|
|
666
|
-
const tokensFor = (variant) => variant === void 0 ? void 0 : _optionalChain([config, 'access',
|
|
646
|
+
const tokensFor = (variant) => variant === void 0 ? void 0 : _optionalChain([config, 'access', _9 => _9.variantTokens, 'optionalAccess', _10 => _10[variant]]);
|
|
667
647
|
return {
|
|
668
648
|
slots: config.slots,
|
|
669
649
|
resolve({ theme, selection, states = {} }) {
|
|
@@ -698,32 +678,6 @@ function apply(fns, theme, colors) {
|
|
|
698
678
|
return merged;
|
|
699
679
|
}
|
|
700
680
|
|
|
701
|
-
// src/system/slot/children-to-string.ts
|
|
702
|
-
|
|
703
|
-
function childrenToString(children) {
|
|
704
|
-
const text = stringify(children);
|
|
705
|
-
return text === null || text === "" ? null : text;
|
|
706
|
-
}
|
|
707
|
-
function stringify(node) {
|
|
708
|
-
if (node === null || node === void 0 || typeof node === "boolean") return "";
|
|
709
|
-
if (typeof node === "string") return node;
|
|
710
|
-
if (typeof node === "number") return String(node);
|
|
711
|
-
if (_react.isValidElement.call(void 0, node)) return null;
|
|
712
|
-
if (Array.isArray(node)) {
|
|
713
|
-
let text = "";
|
|
714
|
-
for (const child of node) {
|
|
715
|
-
const part = stringify(child);
|
|
716
|
-
if (part === null) return null;
|
|
717
|
-
text += part;
|
|
718
|
-
}
|
|
719
|
-
return text;
|
|
720
|
-
}
|
|
721
|
-
return null;
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
681
|
|
|
728
682
|
|
|
729
683
|
|
|
@@ -745,4 +699,4 @@ function stringify(node) {
|
|
|
745
699
|
|
|
746
700
|
|
|
747
701
|
|
|
748
|
-
exports.
|
|
702
|
+
exports.IconContext = IconContext; exports.useIconContext = useIconContext; exports.Icon = Icon; exports.childrenToString = childrenToString; exports.createSlotContext = createSlotContext; exports.mergeRefs = mergeRefs; exports.mergeProps = mergeProps; exports.Slot = Slot; exports.useFeedback = useFeedback; exports.PRESS_SCALE = PRESS_SCALE; exports.PRESS_DURATION = PRESS_DURATION; exports.RELEASE_DURATION = RELEASE_DURATION; exports.HIGHLIGHT_OPACITY = HIGHLIGHT_OPACITY; exports.RIPPLE_OPACITY = RIPPLE_OPACITY; exports.RIPPLE_DURATION = RIPPLE_DURATION; exports.RIPPLE_COVERAGE = RIPPLE_COVERAGE; exports.resolveAnimation = resolveAnimation; exports.resolveSlotAnimation = resolveSlotAnimation; exports.PressableFeedback = PressableFeedback3; exports.createRecipe = createRecipe;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkV42SPPP3cjs = require('../../chunk-V42SPPP3.cjs');
|
|
6
|
+
require('../../chunk-VGWN4JTL.cjs');
|
|
7
|
+
require('../../chunk-3QBT3Q65.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
exports.Button = _chunkV42SPPP3cjs.Button; exports.buttonRecipe = _chunkV42SPPP3cjs.buttonRecipe; exports.useButton = _chunkV42SPPP3cjs.useButton;
|