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

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.
@@ -0,0 +1,1044 @@
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 _chunkFDUI4IAMcjs = require('./chunk-FDUI4IAM.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 = _chunkFDUI4IAMcjs.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/style-props/use-style-props.ts
203
+
204
+ // src/utils/style-props.ts
205
+ var STYLE_PROP_KEYS = [
206
+ // Flex and layout
207
+ "alignContent", "alignItems", "alignSelf", "aspectRatio", "boxSizing", "columnGap", "direction", "display", "flex", "flexBasis", "flexDirection", "flexGrow", "flexShrink", "flexWrap", "gap", "justifyContent", "overflow", "rowGap",
208
+ // Position
209
+ "bottom", "end", "inset", "insetBlock", "insetBlockEnd", "insetBlockStart", "insetInline", "insetInlineEnd", "insetInlineStart", "position", "start", "top", "zIndex",
210
+ // Margin
211
+ "margin", "marginBlock", "marginBlockEnd", "marginBlockStart", "marginBottom", "marginEnd", "marginHorizontal", "marginInline", "marginInlineEnd", "marginInlineStart", "marginStart", "marginTop", "marginVertical",
212
+ // Padding
213
+ "padding", "paddingBlock", "paddingBlockEnd", "paddingBlockStart", "paddingBottom", "paddingEnd", "paddingHorizontal", "paddingInline", "paddingInlineEnd", "paddingInlineStart", "paddingStart", "paddingTop", "paddingVertical",
214
+ // Size
215
+ "height", "maxHeight", "maxWidth", "minHeight", "minWidth", "width",
216
+ // Border
217
+ "borderBlockColor", "borderBlockEndColor", "borderBlockStartColor", "borderBottomColor", "borderBottomEndRadius", "borderBottomStartRadius", "borderBottomWidth", "borderColor", "borderCurve", "borderEndColor", "borderEndEndRadius", "borderEndStartRadius", "borderEndWidth", "borderRadius", "borderStartColor", "borderStartEndRadius", "borderStartStartRadius", "borderStartWidth", "borderStyle", "borderTopColor", "borderTopEndRadius", "borderTopStartRadius", "borderTopWidth", "borderWidth",
218
+ // Fill, shadow, and the rest of a box's paint
219
+ "backfaceVisibility", "backgroundColor", "boxShadow", "cursor", "elevation", "experimental_backgroundImage", "filter", "isolation", "mixBlendMode", "opacity", "outlineColor", "outlineOffset", "outlineStyle", "outlineWidth", "shadowColor", "shadowOffset", "shadowOpacity", "shadowRadius",
220
+ // Transform
221
+ "rotation", "scaleX", "scaleY", "transform", "transformMatrix", "transformOrigin", "translateX", "translateY",
222
+ // Text — a text slot only
223
+ "color", "fontFamily", "fontSize", "fontStyle", "fontVariant", "fontWeight", "includeFontPadding", "letterSpacing", "lineHeight", "textAlign", "textAlignVertical", "textDecorationColor", "textDecorationLine", "textDecorationStyle", "textShadowColor", "textShadowOffset", "textShadowRadius", "textTransform", "userSelect", "verticalAlign", "writingDirection",
224
+ // Image — an image slot only
225
+ "objectFit", "overlayColor", "resizeMode", "tintColor"];
226
+ var STYLE_PROP_KEY_SET = new Set(STYLE_PROP_KEYS);
227
+ function splitStyleProps(props) {
228
+ const styleProps = {};
229
+ const rest = {};
230
+ for (const [key, value] of Object.entries(props)) {
231
+ if (STYLE_PROP_KEY_SET.has(key)) styleProps[key] = value;else rest[key] = value;
232
+ }
233
+ return [styleProps, rest];
234
+ }
235
+
236
+ // src/system/style-props/use-style-props.ts
237
+ function useStyleProps(props) {
238
+ const [styleProps, rest] = splitStyleProps(props);
239
+ const key = _chunkFDUI4IAMcjs.stableHash.call(void 0, styleProps);
240
+ return [_react.useMemo.call(void 0, () => styleProps, [key]), rest];
241
+ }
242
+
243
+ // src/system/pressable-feedback/pressable-feedback-context.ts
244
+
245
+ var [FeedbackProvider, useFeedback] = createSlotContext("PressableFeedback");
246
+ var DisableAllContext = _react.createContext.call(void 0, false);
247
+
248
+ // src/system/pressable-feedback/pressable-feedback.animation.ts
249
+ var PRESS_SCALE = 0.985;
250
+ var PRESS_DURATION = 300;
251
+ var SCALE_REFERENCE_WIDTH = 300;
252
+ const _worklet_6699857654336_init_data = {
253
+ code: "function pressScaleFor_chunkGZIOB63OCjs1(width){const{SCALE_REFERENCE_WIDTH,PRESS_SCALE}=this.__closure;const coefficient=width>0?SCALE_REFERENCE_WIDTH/width:1;return 1-(1-PRESS_SCALE)*coefficient;}",
254
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-GZIOB63O.cjs",
255
+ sourceMap: "{\"version\":3,\"names\":[\"pressScaleFor_chunkGZIOB63OCjs1\",\"width\",\"SCALE_REFERENCE_WIDTH\",\"PRESS_SCALE\",\"__closure\",\"coefficient\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-GZIOB63O.cjs\"],\"mappings\":\"AAwWA,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\":[]}"
256
+ };
257
+ const pressScaleFor = function pressScaleFor_chunkGZIOB63OCjs1Factory({
258
+ _worklet_6699857654336_init_data,
259
+ SCALE_REFERENCE_WIDTH,
260
+ PRESS_SCALE
261
+ }) {
262
+ const _e = [new global.Error(), -3, -27];
263
+ const pressScaleFor = function (width) {
264
+ const coefficient = width > 0 ? SCALE_REFERENCE_WIDTH / width : 1;
265
+ return 1 - (1 - PRESS_SCALE) * coefficient;
266
+ };
267
+ pressScaleFor.__closure = {
268
+ SCALE_REFERENCE_WIDTH,
269
+ PRESS_SCALE
270
+ };
271
+ pressScaleFor.__workletHash = 6699857654336;
272
+ pressScaleFor.__pluginVersion = "0.7.4";
273
+ pressScaleFor.__initData = _worklet_6699857654336_init_data;
274
+ pressScaleFor.__stackDetails = _e;
275
+ return pressScaleFor;
276
+ }({
277
+ _worklet_6699857654336_init_data,
278
+ SCALE_REFERENCE_WIDTH,
279
+ PRESS_SCALE
280
+ });
281
+ var HIGHLIGHT_OPACITY = 0.1;
282
+ var HIGHLIGHT_DURATION = 200;
283
+ var RIPPLE_OPACITY = 0.1;
284
+ var RIPPLE_START_SCALE = 0.3;
285
+ var RIPPLE_EXPAND_DURATION = 1e3;
286
+ var RIPPLE_CONFIRM_DURATION = 225;
287
+ var RIPPLE_FADE_IN = 75;
288
+ var RIPPLE_FADE_OUT_DELAY = 225;
289
+ var RIPPLE_FADE_OUT = 150;
290
+ const _worklet_8377068516475_init_data = {
291
+ code: "function rippleRadiusFor_chunkGZIOB63OCjs2(width,height){return Math.sqrt(width*width+height*height)/2+5;}",
292
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-GZIOB63O.cjs",
293
+ sourceMap: "{\"version\":3,\"names\":[\"rippleRadiusFor_chunkGZIOB63OCjs2\",\"width\",\"height\",\"Math\",\"sqrt\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-GZIOB63O.cjs\"],\"mappings\":\"AAsXA,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\":[]}"
294
+ };
295
+ const rippleRadiusFor = function rippleRadiusFor_chunkGZIOB63OCjs2Factory({
296
+ _worklet_8377068516475_init_data
297
+ }) {
298
+ const _e = [new global.Error(), 1, -27];
299
+ const rippleRadiusFor = function (width, height) {
300
+ return Math.sqrt(width * width + height * height) / 2 + 5;
301
+ };
302
+ rippleRadiusFor.__closure = {};
303
+ rippleRadiusFor.__workletHash = 8377068516475;
304
+ rippleRadiusFor.__pluginVersion = "0.7.4";
305
+ rippleRadiusFor.__initData = _worklet_8377068516475_init_data;
306
+ rippleRadiusFor.__stackDetails = _e;
307
+ return rippleRadiusFor;
308
+ }({
309
+ _worklet_8377068516475_init_data
310
+ });
311
+ var ALL_OFF = {
312
+ scale: false,
313
+ highlight: false,
314
+ ripple: false,
315
+ none: true
316
+ };
317
+ var ALL_ON = {
318
+ scale: true,
319
+ highlight: true,
320
+ ripple: true,
321
+ none: false
322
+ };
323
+ function resolveAnimation(animation, inheritedDisableAll = false) {
324
+ if (inheritedDisableAll) return {
325
+ ...ALL_OFF,
326
+ disableAll: true
327
+ };
328
+ if (animation === false || animation === "disabled") {
329
+ return {
330
+ ...ALL_OFF,
331
+ disableAll: false
332
+ };
333
+ }
334
+ if (animation === "disable-all") return {
335
+ ...ALL_OFF,
336
+ disableAll: true
337
+ };
338
+ if (animation === void 0 || animation === true) {
339
+ return {
340
+ ...ALL_ON,
341
+ disableAll: false
342
+ };
343
+ }
344
+ const scale = _nullishCoalesce(animation.scale, () => true);
345
+ const highlight = _nullishCoalesce(animation.highlight, () => true);
346
+ const ripple = _nullishCoalesce(animation.ripple, () => true);
347
+ return {
348
+ scale,
349
+ highlight,
350
+ ripple,
351
+ none: !scale && !highlight && !ripple,
352
+ disableAll: false
353
+ };
354
+ }
355
+ function resolveSlotAnimation(override, enabledByRoot, defaultOpacity, defaultDuration = PRESS_DURATION) {
356
+ const fallback = {
357
+ enabled: enabledByRoot,
358
+ duration: defaultDuration,
359
+ opacity: defaultOpacity
360
+ };
361
+ if (override === void 0 || override === true) return fallback;
362
+ if (override === false) return {
363
+ ...fallback,
364
+ enabled: false
365
+ };
366
+ return {
367
+ enabled: enabledByRoot,
368
+ duration: _nullishCoalesce(override.duration, () => defaultDuration),
369
+ opacity: _nullishCoalesce(override.opacity, () => defaultOpacity)
370
+ };
371
+ }
372
+
373
+ // src/system/pressable-feedback/pressable-feedback.overlay.ts
374
+
375
+ var FEEDBACK_OVERLAY = /* @__PURE__ */Symbol.for("xaui.PressableFeedback.overlay");
376
+ function markOverlay(component) {
377
+ return Object.assign(component, {
378
+ [FEEDBACK_OVERLAY]: true
379
+ });
380
+ }
381
+ function isBareOverlay(node) {
382
+ if (!_react.isValidElement.call(void 0, node)) return false;
383
+ const type = node.type;
384
+ if (typeof type !== "function" && typeof type !== "object") return false;
385
+ if (type === null) return false;
386
+ if (type[FEEDBACK_OVERLAY] !== true) return false;
387
+ return node.props.children === void 0;
388
+ }
389
+ function partitionOverlays(children) {
390
+ const all = _react.Children.toArray(children);
391
+ const overlays = all.filter(isBareOverlay);
392
+ if (overlays.length === 0) return {
393
+ overlays: null,
394
+ content: children
395
+ };
396
+ return {
397
+ overlays,
398
+ content: all.filter(node => !isBareOverlay(node))
399
+ };
400
+ }
401
+
402
+ // src/system/pressable-feedback/pressable-feedback.tsx
403
+
404
+ var _reactnativereanimated = require('react-native-reanimated');
405
+ var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
406
+
407
+ // src/system/pressable-feedback/pressable-feedback.surface.ts
408
+ function inkFor(background, colors) {
409
+ if (typeof background !== "string" || !_chunkFDUI4IAMcjs.isHex.call(void 0, background)) return colors.foreground;
410
+ return _chunkFDUI4IAMcjs.contrastOn.call(void 0, background, colors.snow, colors.eclipse);
411
+ }
412
+ var RADIUS_KEYS = ["borderRadius", "borderStartStartRadius", "borderStartEndRadius", "borderEndStartRadius", "borderEndEndRadius"];
413
+ function radiusFrom(style) {
414
+ if (!style) return {};
415
+ const radius = {};
416
+ for (const key of RADIUS_KEYS) {
417
+ const value = style[key];
418
+ if (value !== void 0) radius[key] = value;
419
+ }
420
+ return radius;
421
+ }
422
+
423
+ // src/system/pressable-feedback/pressable-feedback.tsx
424
+
425
+ var AnimatedPressable = _reactnativereanimated2.default.createAnimatedComponent(_reactnative.Pressable);
426
+ var AnimatedSlot = _reactnativereanimated2.default.createAnimatedComponent(Slot);
427
+ var PressableFeedback = _react.forwardRef.call(void 0, function PressableFeedback2({
428
+ animation,
429
+ ...rest
430
+ }, ref) {
431
+ const inheritedDisableAll = _react.useContext.call(void 0, DisableAllContext);
432
+ const resolved = resolveAnimation(animation, inheritedDisableAll);
433
+ const Feedback = resolved.none ? StaticFeedback : AnimatedFeedback;
434
+ const body = /* @__PURE__ */_jsxruntime.jsx.call(void 0, Feedback, {
435
+ ref,
436
+ animation: resolved,
437
+ ...rest
438
+ });
439
+ return resolved.disableAll ? /* @__PURE__ */_jsxruntime.jsx.call(void 0, DisableAllContext.Provider, {
440
+ value: true,
441
+ children: body
442
+ }) : body;
443
+ });
444
+ var StaticFeedback = _react.forwardRef.call(void 0, function StaticFeedback2({
445
+ isPressed = false,
446
+ isDisabled,
447
+ asChild = false,
448
+ animation,
449
+ children,
450
+ style,
451
+ ...rest
452
+ }, ref) {
453
+ const surface = useSurface(style);
454
+ const context = _react.useMemo.call(void 0, () => ({
455
+ isPressed,
456
+ animation,
457
+ ...surface
458
+ }), [isPressed, animation, surface]);
459
+ const Root = asChild ? Slot : _reactnative.Pressable;
460
+ const {
461
+ overlays,
462
+ content
463
+ } = partitionOverlays(children);
464
+ return /* @__PURE__ */_jsxruntime.jsx.call(void 0, FeedbackProvider, {
465
+ value: context,
466
+ children: /* @__PURE__ */_jsxruntime.jsxs.call(void 0, Root, {
467
+ ref,
468
+ style,
469
+ disabled: isDisabled,
470
+ ...rest,
471
+ children: [overlays, content]
472
+ })
473
+ });
474
+ });
475
+ const _worklet_15173624129561_init_data = {
476
+ code: "function chunkGZIOB63OCjs3(){const{animation,pressedScale,progress}=this.__closure;if(!animation.scale)return{};return{transform:[{scale:1-(1-pressedScale.value)*progress.value}]};}",
477
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-GZIOB63O.cjs",
478
+ sourceMap: "{\"version\":3,\"names\":[\"chunkGZIOB63OCjs3\",\"animation\",\"pressedScale\",\"progress\",\"__closure\",\"scale\",\"transform\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-GZIOB63O.cjs\"],\"mappings\":\"AA0hB6E,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\":[]}"
479
+ };
480
+ var AnimatedFeedback = _react.forwardRef.call(void 0, function AnimatedFeedback2({
481
+ isPressed = false,
482
+ isDisabled,
483
+ asChild = false,
484
+ animation,
485
+ children,
486
+ style,
487
+ onLayout,
488
+ onTouchStart,
489
+ onTouchEnd,
490
+ onTouchCancel,
491
+ ...rest
492
+ }, ref) {
493
+ const progress = _reactnativereanimated.useSharedValue.call(void 0, 0);
494
+ const size = _reactnativereanimated.useSharedValue.call(void 0, {
495
+ width: 0,
496
+ height: 0
497
+ });
498
+ const waves = [useWave(), useWave()];
499
+ const nextWave = _react.useRef.call(void 0, 0);
500
+ _react.useEffect.call(void 0, () => {
501
+ progress.value = _reactnativereanimated.withTiming.call(void 0, isPressed ? 1 : 0, {
502
+ duration: PRESS_DURATION,
503
+ easing: _reactnativereanimated.Easing.out(_reactnativereanimated.Easing.ease)
504
+ });
505
+ }, [isPressed, progress]);
506
+ const pressedScale = _reactnativereanimated.useDerivedValue.call(void 0, () => pressScaleFor(size.value.width));
507
+ const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, function chunkGZIOB63OCjs3Factory({
508
+ _worklet_15173624129561_init_data,
509
+ animation,
510
+ pressedScale,
511
+ progress
512
+ }) {
513
+ const _e = [new global.Error(), -4, -27];
514
+ const chunkGZIOB63OCjs3 = function () {
515
+ if (!animation.scale) return {};
516
+ return {
517
+ transform: [{
518
+ scale: 1 - (1 - pressedScale.value) * progress.value
519
+ }]
520
+ };
521
+ };
522
+ chunkGZIOB63OCjs3.__closure = {
523
+ animation,
524
+ pressedScale,
525
+ progress
526
+ };
527
+ chunkGZIOB63OCjs3.__workletHash = 15173624129561;
528
+ chunkGZIOB63OCjs3.__pluginVersion = "0.7.4";
529
+ chunkGZIOB63OCjs3.__initData = _worklet_15173624129561_init_data;
530
+ chunkGZIOB63OCjs3.__stackDetails = _e;
531
+ return chunkGZIOB63OCjs3;
532
+ }({
533
+ _worklet_15173624129561_init_data,
534
+ animation,
535
+ pressedScale,
536
+ progress
537
+ }), [animation.scale, progress, pressedScale]);
538
+ const surface = useSurface(style);
539
+ const context = _react.useMemo.call(void 0, () => ({
540
+ isPressed,
541
+ animation,
542
+ progress,
543
+ size,
544
+ waves,
545
+ ...surface
546
+ }), [isPressed, animation, progress, size, waves, surface]);
547
+ const handleTouchStart = event => {
548
+ const wave = waves[nextWave.current];
549
+ nextWave.current = nextWave.current === 0 ? 1 : 0;
550
+ const {
551
+ locationX,
552
+ locationY
553
+ } = event.nativeEvent;
554
+ wave.origin.value = {
555
+ x: locationX,
556
+ y: locationY
557
+ };
558
+ wave.expand.value = 0;
559
+ wave.expand.value = _reactnativereanimated.withTiming.call(void 0, 1, {
560
+ duration: RIPPLE_EXPAND_DURATION,
561
+ easing: _reactnativereanimated.Easing.ease
562
+ });
563
+ wave.alpha.value = _reactnativereanimated.withTiming.call(void 0, 1, {
564
+ duration: RIPPLE_FADE_IN
565
+ });
566
+ _optionalChain([onTouchStart, 'optionalCall', _3 => _3(event)]);
567
+ };
568
+ const releaseWave = () => {
569
+ const wave = waves[nextWave.current === 0 ? 1 : 0];
570
+ wave.expand.value = _reactnativereanimated.withTiming.call(void 0, 1, {
571
+ duration: RIPPLE_CONFIRM_DURATION,
572
+ easing: _reactnativereanimated.Easing.ease
573
+ });
574
+ wave.alpha.value = _reactnativereanimated.withDelay.call(void 0, RIPPLE_FADE_OUT_DELAY, _reactnativereanimated.withTiming.call(void 0, 0, {
575
+ duration: RIPPLE_FADE_OUT
576
+ }));
577
+ };
578
+ const handleTouchEnd = event => {
579
+ releaseWave();
580
+ _optionalChain([onTouchEnd, 'optionalCall', _4 => _4(event)]);
581
+ };
582
+ const handleTouchCancel = event => {
583
+ releaseWave();
584
+ _optionalChain([onTouchCancel, 'optionalCall', _5 => _5(event)]);
585
+ };
586
+ const handleLayout = event => {
587
+ const {
588
+ width,
589
+ height
590
+ } = event.nativeEvent.layout;
591
+ size.value = {
592
+ width,
593
+ height
594
+ };
595
+ _optionalChain([onLayout, 'optionalCall', _6 => _6(event)]);
596
+ };
597
+ const Root = asChild ? AnimatedSlot : AnimatedPressable;
598
+ const {
599
+ overlays,
600
+ content
601
+ } = partitionOverlays(children);
602
+ return /* @__PURE__ */_jsxruntime.jsx.call(void 0, FeedbackProvider, {
603
+ value: context,
604
+ children: /* @__PURE__ */_jsxruntime.jsxs.call(void 0, Root, {
605
+ ref,
606
+ style: [style, animatedStyle],
607
+ disabled: isDisabled,
608
+ onLayout: handleLayout,
609
+ onTouchStart: handleTouchStart,
610
+ onTouchEnd: handleTouchEnd,
611
+ onTouchCancel: handleTouchCancel,
612
+ ...rest,
613
+ children: [overlays, content]
614
+ })
615
+ });
616
+ });
617
+ PressableFeedback.displayName = "XAUI.PressableFeedback";
618
+ function useWave() {
619
+ return {
620
+ expand: _reactnativereanimated.useSharedValue.call(void 0, 0),
621
+ alpha: _reactnativereanimated.useSharedValue.call(void 0, 0),
622
+ origin: _reactnativereanimated.useSharedValue.call(void 0, {
623
+ x: 0,
624
+ y: 0
625
+ })
626
+ };
627
+ }
628
+ function useSurface(style) {
629
+ const theme = _chunkFDUI4IAMcjs.useXAUITheme.call(void 0);
630
+ return _react.useMemo.call(void 0, () => {
631
+ const flat = _reactnative.StyleSheet.flatten(style);
632
+ return {
633
+ ink: inkFor(_optionalChain([flat, 'optionalAccess', _7 => _7.backgroundColor]), theme.colors),
634
+ corners: radiusFrom(flat)
635
+ };
636
+ }, [style, theme]);
637
+ }
638
+
639
+ // src/system/pressable-feedback/pressable-feedback-highlight.tsx
640
+
641
+ function PressableFeedbackHighlight({
642
+ style,
643
+ animation: override,
644
+ children
645
+ }) {
646
+ const {
647
+ isPressed,
648
+ animation,
649
+ progress,
650
+ ink,
651
+ corners
652
+ } = useFeedback();
653
+ const settings = resolveSlotAnimation(override, animation.highlight, HIGHLIGHT_OPACITY, HIGHLIGHT_DURATION);
654
+ const base = [_reactnative.StyleSheet.absoluteFillObject, {
655
+ backgroundColor: ink,
656
+ pointerEvents: "none"
657
+ }, corners, style];
658
+ if (!progress || !settings.enabled) {
659
+ return /* @__PURE__ */_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
660
+ children: [/* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.View, {
661
+ style: [base, {
662
+ opacity: isPressed ? settings.opacity : 0
663
+ }]
664
+ }), children]
665
+ });
666
+ }
667
+ return /* @__PURE__ */_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
668
+ children: [/* @__PURE__ */_jsxruntime.jsx.call(void 0, AnimatedHighlight, {
669
+ base,
670
+ duration: settings.duration,
671
+ opacity: settings.opacity
672
+ }), children]
673
+ });
674
+ }
675
+ PressableFeedbackHighlight.displayName = "XAUI.PressableFeedback.Highlight";
676
+ markOverlay(PressableFeedbackHighlight);
677
+ const _worklet_6996900026671_init_data = {
678
+ code: "function chunkGZIOB63OCjs4(){const{shown,opacity}=this.__closure;return{opacity:shown.value*opacity};}",
679
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-GZIOB63O.cjs",
680
+ sourceMap: "{\"version\":3,\"names\":[\"chunkGZIOB63OCjs4\",\"shown\",\"opacity\",\"__closure\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-GZIOB63O.cjs\"],\"mappings\":\"AAyqB6E,SAAAA,iBAAMA,CAAA,QAAAC,KAAA,CAAAC,OAAA,OAAAC,SAAA,CAE/E,MAAO,CAAED,OAAO,CAAED,KAAK,CAACG,KAAK,CAAGF,OAAQ,CAAC,CAC3C\",\"ignoreList\":[]}"
681
+ };
682
+ function AnimatedHighlight({
683
+ base,
684
+ duration,
685
+ opacity
686
+ }) {
687
+ const {
688
+ isPressed
689
+ } = useFeedback();
690
+ const shown = _reactnativereanimated.useSharedValue.call(void 0, 0);
691
+ _react.useEffect.call(void 0, () => {
692
+ shown.value = _reactnativereanimated.withTiming.call(void 0, isPressed ? 1 : 0, {
693
+ duration
694
+ });
695
+ }, [isPressed, shown, duration]);
696
+ const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, function chunkGZIOB63OCjs4Factory({
697
+ _worklet_6996900026671_init_data,
698
+ shown,
699
+ opacity
700
+ }) {
701
+ const _e = [new global.Error(), -3, -27];
702
+ const chunkGZIOB63OCjs4 = function () {
703
+ return {
704
+ opacity: shown.value * opacity
705
+ };
706
+ };
707
+ chunkGZIOB63OCjs4.__closure = {
708
+ shown,
709
+ opacity
710
+ };
711
+ chunkGZIOB63OCjs4.__workletHash = 6996900026671;
712
+ chunkGZIOB63OCjs4.__pluginVersion = "0.7.4";
713
+ chunkGZIOB63OCjs4.__initData = _worklet_6996900026671_init_data;
714
+ chunkGZIOB63OCjs4.__stackDetails = _e;
715
+ return chunkGZIOB63OCjs4;
716
+ }({
717
+ _worklet_6996900026671_init_data,
718
+ shown,
719
+ opacity
720
+ }), [shown, opacity]);
721
+ return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, {
722
+ style: [base, animatedStyle]
723
+ });
724
+ }
725
+
726
+ // src/system/pressable-feedback/pressable-feedback-ripple.tsx
727
+
728
+ function PressableFeedbackRipple({
729
+ style,
730
+ animation: override,
731
+ children
732
+ }) {
733
+ const {
734
+ animation,
735
+ waves,
736
+ ink,
737
+ corners
738
+ } = useFeedback();
739
+ const settings = resolveSlotAnimation(override, animation.ripple, RIPPLE_OPACITY);
740
+ const [size, setSize] = _react.useState.call(void 0, {
741
+ width: 0,
742
+ height: 0
743
+ });
744
+ const handleLayout = event => {
745
+ const {
746
+ width,
747
+ height
748
+ } = event.nativeEvent.layout;
749
+ setSize(current => current.width === width && current.height === height ? current : {
750
+ width,
751
+ height
752
+ });
753
+ };
754
+ if (!waves || !settings.enabled) return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, {
755
+ children
756
+ });
757
+ const radius = rippleRadiusFor(size.width, size.height);
758
+ return /* @__PURE__ */_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
759
+ children: [/* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.View, {
760
+ style: [_reactnative.StyleSheet.absoluteFill, styles.clip, corners],
761
+ onLayout: handleLayout,
762
+ children: waves.map((wave, index) => /* @__PURE__ */_jsxruntime.jsx.call(void 0, RippleWave, {
763
+ wave,
764
+ radius,
765
+ center: {
766
+ x: size.width / 2,
767
+ y: size.height / 2
768
+ },
769
+ color: ink,
770
+ opacity: settings.opacity,
771
+ style
772
+ }, index))
773
+ }), children]
774
+ });
775
+ }
776
+ PressableFeedbackRipple.displayName = "XAUI.PressableFeedback.Ripple";
777
+ markOverlay(PressableFeedbackRipple);
778
+ const _worklet_7523284106050_init_data = {
779
+ code: "function chunkGZIOB63OCjs5(){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}]};}",
780
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-GZIOB63O.cjs",
781
+ sourceMap: "{\"version\":3,\"names\":[\"chunkGZIOB63OCjs5\",\"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-GZIOB63O.cjs\"],\"mappings\":\"AAsuB6E,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\":[]}"
782
+ };
783
+ function RippleWave({
784
+ wave,
785
+ radius,
786
+ center,
787
+ color,
788
+ opacity,
789
+ style
790
+ }) {
791
+ const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, function chunkGZIOB63OCjs5Factory({
792
+ _worklet_7523284106050_init_data,
793
+ wave,
794
+ RIPPLE_START_SCALE,
795
+ center,
796
+ opacity,
797
+ radius
798
+ }) {
799
+ const _e = [new global.Error(), -6, -27];
800
+ const chunkGZIOB63OCjs5 = function () {
801
+ const t = wave.expand.value;
802
+ const from = wave.origin.value;
803
+ const scale = RIPPLE_START_SCALE + (1 - RIPPLE_START_SCALE) * t;
804
+ const x = from.x + (center.x - from.x) * t;
805
+ const y = from.y + (center.y - from.y) * t;
806
+ return {
807
+ // Its own curve, not the expansion's: full ink in 75ms, held while the circle grows.
808
+ opacity: wave.alpha.value * opacity,
809
+ transform: [{
810
+ translateX: x - radius
811
+ }, {
812
+ translateY: y - radius
813
+ }, {
814
+ scale
815
+ }]
816
+ };
817
+ };
818
+ chunkGZIOB63OCjs5.__closure = {
819
+ wave,
820
+ RIPPLE_START_SCALE,
821
+ center,
822
+ opacity,
823
+ radius
824
+ };
825
+ chunkGZIOB63OCjs5.__workletHash = 7523284106050;
826
+ chunkGZIOB63OCjs5.__pluginVersion = "0.7.4";
827
+ chunkGZIOB63OCjs5.__initData = _worklet_7523284106050_init_data;
828
+ chunkGZIOB63OCjs5.__stackDetails = _e;
829
+ return chunkGZIOB63OCjs5;
830
+ }({
831
+ _worklet_7523284106050_init_data,
832
+ wave,
833
+ RIPPLE_START_SCALE,
834
+ center,
835
+ opacity,
836
+ radius
837
+ }), [wave, radius, center, opacity]);
838
+ return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, {
839
+ style: [styles.wave, {
840
+ backgroundColor: color,
841
+ width: radius * 2,
842
+ height: radius * 2,
843
+ borderRadius: radius
844
+ }, style, animatedStyle]
845
+ });
846
+ }
847
+ var styles = _reactnative.StyleSheet.create({
848
+ // `pointerEvents` in the style rather than as a prop: the prop form is deprecated, and it
849
+ // is not decoration — a container that ate touches would claim every press meant for the
850
+ // control it covers.
851
+ clip: {
852
+ overflow: "hidden",
853
+ pointerEvents: "none"
854
+ },
855
+ wave: {
856
+ position: "absolute",
857
+ top: 0,
858
+ start: 0
859
+ }
860
+ });
861
+
862
+ // src/system/pressable-feedback/index.ts
863
+ var PressableFeedback3 = Object.assign(PressableFeedback, {
864
+ Highlight: PressableFeedbackHighlight,
865
+ Ripple: PressableFeedbackRipple
866
+ });
867
+
868
+ // src/system/recipe/resolve-tint.ts
869
+ var TINT_SLICE_BY_SUFFIX = [[/SoftForeground$/, "softForeground"], [/SoftPressed$/, "softPressed"], [/Soft$/, "soft"], [/Foreground$/, "foreground"], [/Pressed$/, "pressed"]];
870
+ function tintSliceFor(token) {
871
+ for (const [suffix, slice] of TINT_SLICE_BY_SUFFIX) {
872
+ if (suffix.test(token)) return slice;
873
+ }
874
+ return "base";
875
+ }
876
+ function resolveTint(tokens, color, theme) {
877
+ const tint = _chunkFDUI4IAMcjs.deriveTint.call(void 0, color, theme);
878
+ const colors = {};
879
+ for (const [role, token] of Object.entries(_nullishCoalesce(tokens, () => ({})))) {
880
+ colors[role] = tint[tintSliceFor(token)];
881
+ }
882
+ return colors;
883
+ }
884
+
885
+ // src/system/recipe/style-cache.ts
886
+
887
+ // src/system/recipe/variant-map.ts
888
+ var STATE_ORDER = ["focused", "pressed", "disabled"];
889
+ function resolveSelection(defaultVariants, selection) {
890
+ const resolved = {
891
+ ...defaultVariants
892
+ };
893
+ for (const [axis, value] of Object.entries(_nullishCoalesce(selection, () => ({})))) {
894
+ if (value !== void 0) resolved[axis] = value;
895
+ }
896
+ return resolved;
897
+ }
898
+ function resolveVariantColors(tokens, theme) {
899
+ const colors = {};
900
+ for (const [role, token] of entriesOf(tokens)) {
901
+ const value = theme.colors[token];
902
+ if (value === void 0) {
903
+ 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.`);
904
+ }
905
+ colors[role] = value;
906
+ }
907
+ return colors;
908
+ }
909
+ function activeStateFns(states, active) {
910
+ const fns = [];
911
+ for (const state of STATE_ORDER) {
912
+ const fn = active[state] ? _optionalChain([states, 'optionalAccess', _8 => _8[state]]) : void 0;
913
+ if (fn) fns.push(fn);
914
+ }
915
+ return fns;
916
+ }
917
+ function collectStyleFns(config, selection, states) {
918
+ const fns = [];
919
+ if (config.base) fns.push(config.base);
920
+ if (config.paint) fns.push(config.paint);
921
+ for (const [axis, values] of Object.entries(_nullishCoalesce(config.variants, () => ({})))) {
922
+ const value = selection[axis];
923
+ const fn = value === void 0 ? void 0 : values[value];
924
+ if (fn) fns.push(fn);
925
+ }
926
+ for (const compound of _nullishCoalesce(config.compoundVariants, () => [])) {
927
+ if (appliesTo(compound.when, selection)) fns.push(compound.style);
928
+ }
929
+ return [...fns, ...activeStateFns(config.states, states)];
930
+ }
931
+ function appliesTo(when, selection) {
932
+ return Object.entries(when).every(([axis, value]) => selection[axis] === value);
933
+ }
934
+ function entriesOf(tokens) {
935
+ return Object.entries(_nullishCoalesce(tokens, () => ({})));
936
+ }
937
+
938
+ // src/system/recipe/style-cache.ts
939
+ function createStyleCache(slots) {
940
+ const entries = /* @__PURE__ */new Map();
941
+ return {
942
+ read(key, build) {
943
+ const hit = entries.get(key);
944
+ if (hit) return hit;
945
+ const built = build();
946
+ const complete = {};
947
+ for (const slot of slots) complete[slot] = _nullishCoalesce(built[slot], () => ({}));
948
+ const created = _reactnative.StyleSheet.create(complete);
949
+ entries.set(key, created);
950
+ return created;
951
+ },
952
+ get size() {
953
+ return entries.size;
954
+ },
955
+ clear() {
956
+ entries.clear();
957
+ }
958
+ };
959
+ }
960
+ function cacheKey(theme, selection, states) {
961
+ const axes = Object.keys(selection).sort().map(axis => `${axis}:${_nullishCoalesce(selection[axis], () => "-")}`).join("|");
962
+ const active = STATE_ORDER.filter(state => states[state]).join(",");
963
+ return `${theme.id}|${theme.mode}|${axes}|${active}`;
964
+ }
965
+
966
+ // src/system/recipe/create-recipe.ts
967
+ function createRecipe(config) {
968
+ const cache = createStyleCache(config.slots);
969
+ const tokensFor = variant => variant === void 0 ? void 0 : _optionalChain([config, 'access', _9 => _9.variantTokens, 'optionalAccess', _10 => _10[variant]]);
970
+ return {
971
+ slots: config.slots,
972
+ resolve({
973
+ theme,
974
+ selection,
975
+ states = {}
976
+ }) {
977
+ const resolved = resolveSelection(config.defaultVariants, selection);
978
+ return cache.read(cacheKey(theme, resolved, states), () => {
979
+ const colors = resolveVariantColors(tokensFor(resolved.variant), theme);
980
+ return apply(collectStyleFns(config, resolved, states), theme, colors);
981
+ });
982
+ },
983
+ tint({
984
+ theme,
985
+ color,
986
+ selection,
987
+ states = {}
988
+ }) {
989
+ if (!config.paint) return {};
990
+ const resolved = resolveSelection(config.defaultVariants, selection);
991
+ const tokens = tokensFor(resolved.variant);
992
+ if (!tokens) return {};
993
+ const colors = resolveTint(tokens, color, theme);
994
+ const fns = [config.paint, ...activeStateFns(config.states, states)];
995
+ return apply(fns, theme, colors);
996
+ }
997
+ };
998
+ }
999
+ function apply(fns, theme, colors) {
1000
+ const merged = {};
1001
+ for (const fn of fns) {
1002
+ const produced = fn(theme, colors);
1003
+ for (const slot of Object.keys(produced)) {
1004
+ const style = produced[slot];
1005
+ if (!style) continue;
1006
+ const previous = merged[slot];
1007
+ merged[slot] = previous ? {
1008
+ ...previous,
1009
+ ...style
1010
+ } : style;
1011
+ }
1012
+ }
1013
+ return merged;
1014
+ }
1015
+ exports.IconContext = IconContext;
1016
+ exports.useIconContext = useIconContext;
1017
+ exports.Icon = Icon;
1018
+ exports.childrenToString = childrenToString;
1019
+ exports.createSlotContext = createSlotContext;
1020
+ exports.mergeRefs = mergeRefs;
1021
+ exports.mergeProps = mergeProps;
1022
+ exports.Slot = Slot;
1023
+ exports.useStyleProps = useStyleProps;
1024
+ exports.useFeedback = useFeedback;
1025
+ exports.PRESS_SCALE = PRESS_SCALE;
1026
+ exports.PRESS_DURATION = PRESS_DURATION;
1027
+ exports.SCALE_REFERENCE_WIDTH = SCALE_REFERENCE_WIDTH;
1028
+ exports.pressScaleFor = pressScaleFor;
1029
+ exports.HIGHLIGHT_OPACITY = HIGHLIGHT_OPACITY;
1030
+ exports.HIGHLIGHT_DURATION = HIGHLIGHT_DURATION;
1031
+ exports.RIPPLE_OPACITY = RIPPLE_OPACITY;
1032
+ exports.RIPPLE_START_SCALE = RIPPLE_START_SCALE;
1033
+ exports.RIPPLE_EXPAND_DURATION = RIPPLE_EXPAND_DURATION;
1034
+ exports.RIPPLE_CONFIRM_DURATION = RIPPLE_CONFIRM_DURATION;
1035
+ exports.RIPPLE_FADE_IN = RIPPLE_FADE_IN;
1036
+ exports.RIPPLE_FADE_OUT_DELAY = RIPPLE_FADE_OUT_DELAY;
1037
+ exports.RIPPLE_FADE_OUT = RIPPLE_FADE_OUT;
1038
+ exports.rippleRadiusFor = rippleRadiusFor;
1039
+ exports.resolveAnimation = resolveAnimation;
1040
+ exports.resolveSlotAnimation = resolveSlotAnimation;
1041
+ exports.FEEDBACK_OVERLAY = FEEDBACK_OVERLAY;
1042
+ exports.markOverlay = markOverlay;
1043
+ exports.PressableFeedback = PressableFeedback3;
1044
+ exports.createRecipe = createRecipe;