@xaui/native 0.9.1-alpha.4 → 0.9.1-alpha.40
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-2EGR4LWD.js +145 -0
- package/dist/chunk-2NRZKJG7.js +531 -0
- package/dist/chunk-2PMXMKS5.js +67 -0
- package/dist/chunk-2XPG2243.js +586 -0
- package/dist/chunk-36PRYGAM.js +13 -0
- package/dist/chunk-3E7CDKFO.cjs +696 -0
- package/dist/chunk-3GFRSZYR.js +54 -0
- package/dist/chunk-423RQBOX.js +21 -0
- package/dist/chunk-4CUZZWFW.js +92 -0
- package/dist/chunk-4GTAZM2C.js +174 -0
- package/dist/chunk-4KFKWBN5.cjs +89 -0
- package/dist/{chunk-3QBT3Q65.cjs → chunk-57SJ4LJF.cjs} +7 -2
- package/dist/chunk-5R26NM4M.cjs +402 -0
- package/dist/chunk-5VKYNBNA.js +607 -0
- package/dist/chunk-64MXEVT3.js +66 -0
- package/dist/chunk-6DOLGZVV.cjs +147 -0
- package/dist/chunk-6L2TS2R3.cjs +92 -0
- package/dist/chunk-6UEZJRVI.js +669 -0
- package/dist/chunk-734MFAX4.js +27 -0
- package/dist/chunk-73RKQC5X.js +104 -0
- package/dist/chunk-7DPL3ZDS.cjs +21 -0
- package/dist/chunk-7EIHHOHP.cjs +42 -0
- package/dist/chunk-7GHM4GKL.cjs +119 -0
- package/dist/chunk-7YF5NAHQ.cjs +74 -0
- package/dist/{chunk-X2K2FX3W.js → chunk-A3EGFI6T.js} +6 -1
- package/dist/chunk-ABAGZTXZ.cjs +736 -0
- package/dist/{chunk-AW63PTQ4.cjs → chunk-ACAPTWE3.cjs} +85 -81
- package/dist/chunk-AMCSSOJT.cjs +104 -0
- package/dist/chunk-BA2DBSAN.js +102 -0
- package/dist/chunk-BRRXFOBY.js +431 -0
- package/dist/chunk-C5YLPCFC.cjs +293 -0
- package/dist/chunk-DA3OKXHV.cjs +700 -0
- package/dist/chunk-DD4276RF.js +366 -0
- package/dist/chunk-DG2I4PJG.js +701 -0
- package/dist/chunk-DHGLGSH6.js +661 -0
- package/dist/chunk-DIBUQ46Y.js +346 -0
- package/dist/chunk-EGLLDKN6.js +9 -0
- package/dist/chunk-EJQCQPET.cjs +9 -0
- package/dist/chunk-EKS3W46M.cjs +66 -0
- package/dist/chunk-EZEYMLO3.js +402 -0
- package/dist/chunk-F6CQ6CBI.cjs +112 -0
- package/dist/chunk-F6W3JQ7K.js +42 -0
- package/dist/chunk-FHUYHV6J.js +89 -0
- package/dist/chunk-FNEUOBCV.cjs +174 -0
- package/dist/chunk-G7P3ERYF.cjs +478 -0
- package/dist/chunk-GA6PBWNT.js +147 -0
- package/dist/chunk-GFUZ3MUT.cjs +455 -0
- package/dist/chunk-GGW43Q37.cjs +1 -0
- package/dist/chunk-GTR5X65M.cjs +27 -0
- package/dist/chunk-H4E4HDEP.cjs +13 -0
- package/dist/chunk-H7DS4IO7.js +198 -0
- package/dist/chunk-HDVVZG4S.cjs +198 -0
- package/dist/chunk-IKJVLJKT.js +151 -0
- package/dist/chunk-J3MB4PI5.cjs +531 -0
- package/dist/chunk-K72UDPVN.js +119 -0
- package/dist/chunk-KCMYU7WF.js +86 -0
- package/dist/chunk-LRN3RNDO.js +940 -0
- package/dist/chunk-LTX6TB5I.js +124 -0
- package/dist/chunk-LUPCPLND.cjs +145 -0
- package/dist/chunk-M63GFNKV.js +194 -0
- package/dist/chunk-N3KTZMPG.js +293 -0
- package/dist/chunk-NCTOTTVW.js +13 -0
- package/dist/chunk-NWGLP6JX.cjs +410 -0
- package/dist/chunk-R73XQK7X.cjs +314 -0
- package/dist/chunk-RU7JCMWC.cjs +881 -0
- package/dist/chunk-SNIHUKDA.cjs +184 -0
- package/dist/chunk-T5FV5F7A.cjs +607 -0
- package/dist/chunk-TDTUAIFF.cjs +153 -0
- package/dist/chunk-TJ74XVZN.cjs +431 -0
- package/dist/chunk-TK44VBIE.cjs +194 -0
- package/dist/chunk-UAWBAD4E.cjs +346 -0
- package/dist/chunk-UFTCTTKK.js +381 -0
- package/dist/chunk-WDDXU3OH.cjs +67 -0
- package/dist/chunk-WFEMJCXO.cjs +13 -0
- package/dist/chunk-WHJTBTYM.js +0 -0
- package/dist/{chunk-2KXQATVL.js → chunk-WKCQ6VGW.js} +59 -55
- package/dist/chunk-XFPQFCEK.js +455 -0
- package/dist/chunk-XSQPVDFH.cjs +60 -0
- package/dist/chunk-XTC2SLFT.js +153 -0
- package/dist/chunk-XV735BSA.cjs +366 -0
- package/dist/chunk-XWNG2U4K.cjs +124 -0
- package/dist/chunk-YGYYJ3LQ.js +314 -0
- package/dist/chunk-YVHT2UVW.js +74 -0
- package/dist/chunk-ZFOOJK37.cjs +86 -0
- package/dist/close-button.type-BUYuoSt2.d.ts +36 -0
- package/dist/close-button.type-CHsgZ3wO.d.cts +36 -0
- package/dist/components/accordion/index.cjs +35 -0
- package/dist/components/accordion/index.d.cts +299 -0
- package/dist/components/accordion/index.d.ts +299 -0
- package/dist/components/accordion/index.js +35 -0
- package/dist/components/alert/index.cjs +20 -0
- package/dist/components/alert/index.d.cts +169 -0
- package/dist/components/alert/index.d.ts +169 -0
- package/dist/components/alert/index.js +20 -0
- package/dist/components/avatar/index.cjs +16 -0
- package/dist/components/avatar/index.d.cts +131 -0
- package/dist/components/avatar/index.d.ts +131 -0
- package/dist/components/avatar/index.js +16 -0
- package/dist/components/badge/index.cjs +15 -0
- package/dist/components/badge/index.d.cts +157 -0
- package/dist/components/badge/index.d.ts +157 -0
- package/dist/components/badge/index.js +15 -0
- package/dist/components/button/index.cjs +22 -0
- package/dist/components/button/index.d.cts +613 -0
- package/dist/components/button/index.d.ts +613 -0
- package/dist/components/button/index.js +22 -0
- package/dist/components/card/index.cjs +22 -0
- package/dist/components/card/index.d.cts +620 -0
- package/dist/components/card/index.d.ts +620 -0
- package/dist/components/card/index.js +22 -0
- package/dist/components/checkbox/index.cjs +26 -0
- package/dist/components/checkbox/index.d.cts +1136 -0
- package/dist/components/checkbox/index.d.ts +1136 -0
- package/dist/components/checkbox/index.js +26 -0
- package/dist/components/chip/index.cjs +20 -0
- package/dist/components/chip/index.d.cts +608 -0
- package/dist/components/chip/index.d.ts +608 -0
- package/dist/components/chip/index.js +20 -0
- package/dist/components/divider/index.cjs +13 -0
- package/dist/components/divider/index.d.cts +117 -0
- package/dist/components/divider/index.d.ts +117 -0
- package/dist/components/divider/index.js +13 -0
- package/dist/components/field-group/index.cjs +27 -0
- package/dist/components/field-group/index.d.cts +270 -0
- package/dist/components/field-group/index.d.ts +270 -0
- package/dist/components/field-group/index.js +27 -0
- package/dist/components/input-otp/index.cjs +29 -0
- package/dist/components/input-otp/index.d.cts +325 -0
- package/dist/components/input-otp/index.d.ts +325 -0
- package/dist/components/input-otp/index.js +29 -0
- package/dist/components/menu/index.cjs +49 -0
- package/dist/components/menu/index.d.cts +351 -0
- package/dist/components/menu/index.d.ts +351 -0
- package/dist/components/menu/index.js +49 -0
- package/dist/components/popover/index.cjs +38 -0
- package/dist/components/popover/index.d.cts +254 -0
- package/dist/components/popover/index.d.ts +254 -0
- package/dist/components/popover/index.js +38 -0
- package/dist/components/radio/index.cjs +26 -0
- package/dist/components/radio/index.d.cts +1102 -0
- package/dist/components/radio/index.d.ts +1102 -0
- package/dist/components/radio/index.js +26 -0
- package/dist/components/select/index.cjs +50 -0
- package/dist/components/select/index.d.cts +498 -0
- package/dist/components/select/index.d.ts +498 -0
- package/dist/components/select/index.js +50 -0
- package/dist/components/skeleton/index.cjs +11 -0
- package/dist/components/skeleton/index.d.cts +111 -0
- package/dist/components/skeleton/index.d.ts +111 -0
- package/dist/components/skeleton/index.js +11 -0
- package/dist/components/spinner/index.cjs +17 -0
- package/dist/components/spinner/index.d.cts +104 -0
- package/dist/components/spinner/index.d.ts +104 -0
- package/dist/components/spinner/index.js +17 -0
- package/dist/components/switch/index.cjs +27 -0
- package/dist/components/switch/index.d.cts +1154 -0
- package/dist/components/switch/index.d.ts +1154 -0
- package/dist/components/switch/index.js +27 -0
- package/dist/components/text-area/index.cjs +14 -0
- package/dist/components/text-area/index.d.cts +73 -0
- package/dist/components/text-area/index.d.ts +73 -0
- package/dist/components/text-area/index.js +14 -0
- package/dist/components/text-field/index.cjs +25 -0
- package/dist/components/text-field/index.d.cts +205 -0
- package/dist/components/text-field/index.d.ts +205 -0
- package/dist/components/text-field/index.js +25 -0
- package/dist/components/typography/index.cjs +15 -0
- package/dist/components/typography/index.d.cts +116 -0
- package/dist/components/typography/index.d.ts +116 -0
- package/dist/components/typography/index.js +15 -0
- package/dist/components/view/index.cjs +17 -0
- package/dist/components/view/index.d.cts +152 -0
- package/dist/components/view/index.d.ts +152 -0
- package/dist/components/view/index.js +17 -0
- package/dist/create-recipe-BdVd2ffi.d.ts +114 -0
- package/dist/create-recipe-dC7wMfnj.d.cts +114 -0
- package/dist/icon.type-Kml72iSz.d.ts +73 -0
- package/dist/icon.type-d_i9ma-i.d.cts +73 -0
- package/dist/index.cjs +400 -4
- package/dist/index.d.cts +118 -4
- package/dist/index.d.ts +118 -4
- package/dist/index.js +423 -27
- package/dist/placement-DHa0Rrh1.d.cts +38 -0
- package/dist/placement-DHa0Rrh1.d.ts +38 -0
- package/dist/pressable-feedback.type-BA2C9sSz.d.cts +127 -0
- package/dist/pressable-feedback.type-Bs4dQlGj.d.ts +127 -0
- package/dist/style-props.type-CfnoGEP7.d.cts +31 -0
- package/dist/style-props.type-CfnoGEP7.d.ts +31 -0
- package/dist/system/index.cjs +73 -4
- package/dist/system/index.d.cts +379 -193
- package/dist/system/index.d.ts +379 -193
- package/dist/system/index.js +87 -18
- package/dist/text-field.type-0l73acce.d.ts +167 -0
- package/dist/text-field.type-DBh06DU5.d.cts +167 -0
- package/dist/theme/index.cjs +5 -3
- package/dist/theme/index.d.cts +55 -24
- package/dist/theme/index.d.ts +55 -24
- package/dist/theme/index.js +4 -2
- package/dist/{theme.type-C9bFJKFm.d.cts → theme.type-C2gNHpEx.d.cts} +1 -1
- package/dist/{theme.type-C9bFJKFm.d.ts → theme.type-C2gNHpEx.d.ts} +1 -1
- package/package.json +254 -18
- package/dist/chunk-ECDWSSHJ.js +0 -688
- package/dist/chunk-IYFGO523.cjs +0 -688
|
@@ -0,0 +1,669 @@
|
|
|
1
|
+
import { contrastOn, isHex, useXAUITheme } from "./chunk-A3EGFI6T.js";
|
|
2
|
+
import { Slot, createSlotContext } from "./chunk-K72UDPVN.js";
|
|
3
|
+
import { useStyleProps } from "./chunk-M63GFNKV.js";
|
|
4
|
+
|
|
5
|
+
// src/system/pressable-feedback/pressable-feedback-context.ts
|
|
6
|
+
import { createContext } from "react";
|
|
7
|
+
var [FeedbackProvider, useFeedback] = createSlotContext("PressableFeedback");
|
|
8
|
+
var DisableAllContext = createContext(false);
|
|
9
|
+
|
|
10
|
+
// src/system/pressable-feedback/pressable-feedback.animation.ts
|
|
11
|
+
var PRESS_SCALE = 0.985;
|
|
12
|
+
var PRESS_DURATION = 300;
|
|
13
|
+
var SCALE_REFERENCE_WIDTH = 300;
|
|
14
|
+
const _worklet_10204734304331_init_data = {
|
|
15
|
+
code: "function pressScaleFor_chunk6UEZJRVIJs1(width){const{SCALE_REFERENCE_WIDTH,PRESS_SCALE}=this.__closure;const coefficient=width>0?SCALE_REFERENCE_WIDTH/width:1;return 1-(1-PRESS_SCALE)*coefficient;}",
|
|
16
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-6UEZJRVI.js",
|
|
17
|
+
sourceMap: "{\"version\":3,\"names\":[\"pressScaleFor_chunk6UEZJRVIJs1\",\"width\",\"SCALE_REFERENCE_WIDTH\",\"PRESS_SCALE\",\"__closure\",\"coefficient\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-6UEZJRVI.js\"],\"mappings\":\"AAsBA,SAAAA,8BAA8BA,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\":[]}"
|
|
18
|
+
};
|
|
19
|
+
const pressScaleFor = function pressScaleFor_chunk6UEZJRVIJs1Factory({
|
|
20
|
+
_worklet_10204734304331_init_data,
|
|
21
|
+
SCALE_REFERENCE_WIDTH,
|
|
22
|
+
PRESS_SCALE
|
|
23
|
+
}) {
|
|
24
|
+
const _e = [new global.Error(), -3, -27];
|
|
25
|
+
const pressScaleFor = function (width) {
|
|
26
|
+
const coefficient = width > 0 ? SCALE_REFERENCE_WIDTH / width : 1;
|
|
27
|
+
return 1 - (1 - PRESS_SCALE) * coefficient;
|
|
28
|
+
};
|
|
29
|
+
pressScaleFor.__closure = {
|
|
30
|
+
SCALE_REFERENCE_WIDTH,
|
|
31
|
+
PRESS_SCALE
|
|
32
|
+
};
|
|
33
|
+
pressScaleFor.__workletHash = 10204734304331;
|
|
34
|
+
pressScaleFor.__pluginVersion = "0.7.4";
|
|
35
|
+
pressScaleFor.__initData = _worklet_10204734304331_init_data;
|
|
36
|
+
pressScaleFor.__stackDetails = _e;
|
|
37
|
+
return pressScaleFor;
|
|
38
|
+
}({
|
|
39
|
+
_worklet_10204734304331_init_data,
|
|
40
|
+
SCALE_REFERENCE_WIDTH,
|
|
41
|
+
PRESS_SCALE
|
|
42
|
+
});
|
|
43
|
+
var HIGHLIGHT_OPACITY = 0.1;
|
|
44
|
+
var HIGHLIGHT_DURATION = 200;
|
|
45
|
+
var RIPPLE_OPACITY = 0.1;
|
|
46
|
+
var RIPPLE_START_SCALE = 0.3;
|
|
47
|
+
var RIPPLE_EXPAND_DURATION = 1e3;
|
|
48
|
+
var RIPPLE_CONFIRM_DURATION = 225;
|
|
49
|
+
var RIPPLE_FADE_IN = 75;
|
|
50
|
+
var RIPPLE_FADE_OUT_DELAY = 225;
|
|
51
|
+
var RIPPLE_FADE_OUT = 150;
|
|
52
|
+
const _worklet_5727627969008_init_data = {
|
|
53
|
+
code: "function rippleRadiusFor_chunk6UEZJRVIJs2(width,height){return Math.sqrt(width*width+height*height)/2+5;}",
|
|
54
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-6UEZJRVI.js",
|
|
55
|
+
sourceMap: "{\"version\":3,\"names\":[\"rippleRadiusFor_chunk6UEZJRVIJs2\",\"width\",\"height\",\"Math\",\"sqrt\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-6UEZJRVI.js\"],\"mappings\":\"AAoCA,SAAAA,gCAAwCA,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\":[]}"
|
|
56
|
+
};
|
|
57
|
+
const rippleRadiusFor = function rippleRadiusFor_chunk6UEZJRVIJs2Factory({
|
|
58
|
+
_worklet_5727627969008_init_data
|
|
59
|
+
}) {
|
|
60
|
+
const _e = [new global.Error(), 1, -27];
|
|
61
|
+
const rippleRadiusFor = function (width, height) {
|
|
62
|
+
return Math.sqrt(width * width + height * height) / 2 + 5;
|
|
63
|
+
};
|
|
64
|
+
rippleRadiusFor.__closure = {};
|
|
65
|
+
rippleRadiusFor.__workletHash = 5727627969008;
|
|
66
|
+
rippleRadiusFor.__pluginVersion = "0.7.4";
|
|
67
|
+
rippleRadiusFor.__initData = _worklet_5727627969008_init_data;
|
|
68
|
+
rippleRadiusFor.__stackDetails = _e;
|
|
69
|
+
return rippleRadiusFor;
|
|
70
|
+
}({
|
|
71
|
+
_worklet_5727627969008_init_data
|
|
72
|
+
});
|
|
73
|
+
var ALL_OFF = {
|
|
74
|
+
scale: false,
|
|
75
|
+
highlight: false,
|
|
76
|
+
ripple: false,
|
|
77
|
+
none: true
|
|
78
|
+
};
|
|
79
|
+
var ALL_ON = {
|
|
80
|
+
scale: true,
|
|
81
|
+
highlight: true,
|
|
82
|
+
ripple: true,
|
|
83
|
+
none: false
|
|
84
|
+
};
|
|
85
|
+
function resolveAnimation(animation, inheritedDisableAll = false) {
|
|
86
|
+
if (inheritedDisableAll) return {
|
|
87
|
+
...ALL_OFF,
|
|
88
|
+
disableAll: true
|
|
89
|
+
};
|
|
90
|
+
if (animation === false || animation === "disabled") {
|
|
91
|
+
return {
|
|
92
|
+
...ALL_OFF,
|
|
93
|
+
disableAll: false
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
if (animation === "disable-all") return {
|
|
97
|
+
...ALL_OFF,
|
|
98
|
+
disableAll: true
|
|
99
|
+
};
|
|
100
|
+
if (animation === void 0 || animation === true) {
|
|
101
|
+
return {
|
|
102
|
+
...ALL_ON,
|
|
103
|
+
disableAll: false
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
const scale = animation.scale ?? true;
|
|
107
|
+
const highlight = animation.highlight ?? true;
|
|
108
|
+
const ripple = animation.ripple ?? true;
|
|
109
|
+
return {
|
|
110
|
+
scale,
|
|
111
|
+
highlight,
|
|
112
|
+
ripple,
|
|
113
|
+
none: !scale && !highlight && !ripple,
|
|
114
|
+
disableAll: false
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function resolveSlotAnimation(override, enabledByRoot, defaultOpacity, defaultDuration = PRESS_DURATION) {
|
|
118
|
+
const fallback = {
|
|
119
|
+
enabled: enabledByRoot,
|
|
120
|
+
duration: defaultDuration,
|
|
121
|
+
opacity: defaultOpacity
|
|
122
|
+
};
|
|
123
|
+
if (override === void 0 || override === true) return fallback;
|
|
124
|
+
if (override === false) return {
|
|
125
|
+
...fallback,
|
|
126
|
+
enabled: false
|
|
127
|
+
};
|
|
128
|
+
return {
|
|
129
|
+
enabled: enabledByRoot,
|
|
130
|
+
duration: override.duration ?? defaultDuration,
|
|
131
|
+
opacity: override.opacity ?? defaultOpacity
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// src/system/pressable-feedback/pressable-feedback.overlay.ts
|
|
136
|
+
import { Children, Fragment, createElement, isValidElement } from "react";
|
|
137
|
+
var FEEDBACK_OVERLAY = /* @__PURE__ */Symbol.for("xaui.PressableFeedback.overlay");
|
|
138
|
+
function markOverlay(component) {
|
|
139
|
+
return Object.assign(component, {
|
|
140
|
+
[FEEDBACK_OVERLAY]: true
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function isBareOverlay(node) {
|
|
144
|
+
if (!isValidElement(node)) return false;
|
|
145
|
+
const type = node.type;
|
|
146
|
+
if (typeof type !== "function" && typeof type !== "object") return false;
|
|
147
|
+
if (type === null) return false;
|
|
148
|
+
if (type[FEEDBACK_OVERLAY] !== true) return false;
|
|
149
|
+
return node.props.children === void 0;
|
|
150
|
+
}
|
|
151
|
+
function partitionOverlays(children) {
|
|
152
|
+
const all = Children.toArray(children);
|
|
153
|
+
const overlays = all.filter(isBareOverlay);
|
|
154
|
+
if (overlays.length === 0) return {
|
|
155
|
+
overlays: null,
|
|
156
|
+
content: children
|
|
157
|
+
};
|
|
158
|
+
return {
|
|
159
|
+
overlays,
|
|
160
|
+
content: all.filter(node => !isBareOverlay(node))
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
function feedbackChildren(children, asChild) {
|
|
164
|
+
if (asChild) return children;
|
|
165
|
+
const {
|
|
166
|
+
overlays,
|
|
167
|
+
content
|
|
168
|
+
} = partitionOverlays(children);
|
|
169
|
+
if (overlays === null) return content;
|
|
170
|
+
return createElement(Fragment, null, overlays, content);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// src/system/pressable-feedback/pressable-feedback.tsx
|
|
174
|
+
import { forwardRef, useContext, useEffect, useMemo, useRef } from "react";
|
|
175
|
+
import { Pressable, StyleSheet } from "react-native";
|
|
176
|
+
import Animated, { Easing, useAnimatedStyle, useDerivedValue, useSharedValue, withDelay, withTiming } from "react-native-reanimated";
|
|
177
|
+
|
|
178
|
+
// src/system/pressable-feedback/pressable-feedback.surface.ts
|
|
179
|
+
function inkFor(background, colors) {
|
|
180
|
+
if (typeof background !== "string" || !isHex(background)) return colors.foreground;
|
|
181
|
+
return contrastOn(background, colors.snow, colors.eclipse);
|
|
182
|
+
}
|
|
183
|
+
var RADIUS_KEYS = ["borderRadius", "borderStartStartRadius", "borderStartEndRadius", "borderEndStartRadius", "borderEndEndRadius"];
|
|
184
|
+
function radiusFrom(style) {
|
|
185
|
+
if (!style) return {};
|
|
186
|
+
const radius = {};
|
|
187
|
+
for (const key of RADIUS_KEYS) {
|
|
188
|
+
const value = style[key];
|
|
189
|
+
if (value !== void 0) radius[key] = value;
|
|
190
|
+
}
|
|
191
|
+
return radius;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// src/system/pressable-feedback/pressable-feedback.tsx
|
|
195
|
+
import { jsx } from "react/jsx-runtime";
|
|
196
|
+
var AnimatedPressable = Animated.createAnimatedComponent(Pressable);
|
|
197
|
+
var AnimatedSlot = Animated.createAnimatedComponent(Slot);
|
|
198
|
+
var PressableFeedback = forwardRef(function PressableFeedback2({
|
|
199
|
+
animation,
|
|
200
|
+
style,
|
|
201
|
+
...props
|
|
202
|
+
}, ref) {
|
|
203
|
+
const inheritedDisableAll = useContext(DisableAllContext);
|
|
204
|
+
const resolved = resolveAnimation(animation, inheritedDisableAll);
|
|
205
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
206
|
+
const Feedback = resolved.none ? StaticFeedback : AnimatedFeedback;
|
|
207
|
+
const body = /* @__PURE__ */jsx(Feedback, {
|
|
208
|
+
ref,
|
|
209
|
+
animation: resolved,
|
|
210
|
+
style: [styleProps, style],
|
|
211
|
+
...rest
|
|
212
|
+
});
|
|
213
|
+
return resolved.disableAll ? /* @__PURE__ */jsx(DisableAllContext.Provider, {
|
|
214
|
+
value: true,
|
|
215
|
+
children: body
|
|
216
|
+
}) : body;
|
|
217
|
+
});
|
|
218
|
+
var StaticFeedback = forwardRef(function StaticFeedback2({
|
|
219
|
+
isPressed = false,
|
|
220
|
+
isDisabled,
|
|
221
|
+
asChild = false,
|
|
222
|
+
animation,
|
|
223
|
+
children,
|
|
224
|
+
style,
|
|
225
|
+
...rest
|
|
226
|
+
}, ref) {
|
|
227
|
+
const surface = useSurface(style);
|
|
228
|
+
const context = useMemo(() => ({
|
|
229
|
+
isPressed,
|
|
230
|
+
animation,
|
|
231
|
+
...surface
|
|
232
|
+
}), [isPressed, animation, surface]);
|
|
233
|
+
const Root = asChild ? Slot : Pressable;
|
|
234
|
+
return /* @__PURE__ */jsx(FeedbackProvider, {
|
|
235
|
+
value: context,
|
|
236
|
+
children: /* @__PURE__ */jsx(Root, {
|
|
237
|
+
ref,
|
|
238
|
+
style,
|
|
239
|
+
disabled: isDisabled,
|
|
240
|
+
...rest,
|
|
241
|
+
children: feedbackChildren(children, asChild)
|
|
242
|
+
})
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
const _worklet_10033516032453_init_data = {
|
|
246
|
+
code: "function chunk6UEZJRVIJs3(){const{pressScaleFor,size}=this.__closure;return pressScaleFor(size.value.width);}",
|
|
247
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-6UEZJRVI.js",
|
|
248
|
+
sourceMap: "{\"version\":3,\"names\":[\"chunk6UEZJRVIJs3\",\"pressScaleFor\",\"size\",\"__closure\",\"value\",\"width\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-6UEZJRVI.js\"],\"mappings\":\"AAkNuC,SAAAA,iBAAA,QAAAC,aAAA,CAAAC,IAAA,OAAAC,SAAA,OAAM,CAAAF,aAAc,CAAAC,IAAK,CAAAE,KAAM,CAAAC,KAAK\",\"ignoreList\":[]}"
|
|
249
|
+
};
|
|
250
|
+
const _worklet_10361673705493_init_data = {
|
|
251
|
+
code: "function chunk6UEZJRVIJs4(){const{animation,pressedScale,progress}=this.__closure;if(!animation.scale)return{};return{transform:[{scale:1-(1-pressedScale.value)*progress.value}]};}",
|
|
252
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-6UEZJRVI.js",
|
|
253
|
+
sourceMap: "{\"version\":3,\"names\":[\"chunk6UEZJRVIJs4\",\"animation\",\"pressedScale\",\"progress\",\"__closure\",\"scale\",\"transform\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-6UEZJRVI.js\"],\"mappings\":\"AAmNyC,SAAAA,gBAAMA,CAAA,QAAAC,SAAA,CAAAC,YAAA,CAAAC,QAAA,OAAAC,SAAA,CAE3C,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\":[]}"
|
|
254
|
+
};
|
|
255
|
+
var AnimatedFeedback = forwardRef(function AnimatedFeedback2({
|
|
256
|
+
isPressed = false,
|
|
257
|
+
isDisabled,
|
|
258
|
+
asChild = false,
|
|
259
|
+
animation,
|
|
260
|
+
children,
|
|
261
|
+
style,
|
|
262
|
+
onLayout,
|
|
263
|
+
onTouchStart,
|
|
264
|
+
onTouchEnd,
|
|
265
|
+
onTouchCancel,
|
|
266
|
+
...rest
|
|
267
|
+
}, ref) {
|
|
268
|
+
const progress = useSharedValue(0);
|
|
269
|
+
const size = useSharedValue({
|
|
270
|
+
width: 0,
|
|
271
|
+
height: 0
|
|
272
|
+
});
|
|
273
|
+
const waves = [useWave(), useWave()];
|
|
274
|
+
const nextWave = useRef(0);
|
|
275
|
+
useEffect(() => {
|
|
276
|
+
progress.value = withTiming(isPressed ? 1 : 0, {
|
|
277
|
+
duration: PRESS_DURATION,
|
|
278
|
+
easing: Easing.out(Easing.ease)
|
|
279
|
+
});
|
|
280
|
+
}, [isPressed, progress]);
|
|
281
|
+
const pressedScale = useDerivedValue(function chunk6UEZJRVIJs3Factory({
|
|
282
|
+
_worklet_10033516032453_init_data,
|
|
283
|
+
pressScaleFor,
|
|
284
|
+
size
|
|
285
|
+
}) {
|
|
286
|
+
const _e = [new global.Error(), -3, -27];
|
|
287
|
+
const chunk6UEZJRVIJs3 = () => pressScaleFor(size.value.width);
|
|
288
|
+
chunk6UEZJRVIJs3.__closure = {
|
|
289
|
+
pressScaleFor,
|
|
290
|
+
size
|
|
291
|
+
};
|
|
292
|
+
chunk6UEZJRVIJs3.__workletHash = 10033516032453;
|
|
293
|
+
chunk6UEZJRVIJs3.__pluginVersion = "0.7.4";
|
|
294
|
+
chunk6UEZJRVIJs3.__initData = _worklet_10033516032453_init_data;
|
|
295
|
+
chunk6UEZJRVIJs3.__stackDetails = _e;
|
|
296
|
+
return chunk6UEZJRVIJs3;
|
|
297
|
+
}({
|
|
298
|
+
_worklet_10033516032453_init_data,
|
|
299
|
+
pressScaleFor,
|
|
300
|
+
size
|
|
301
|
+
}));
|
|
302
|
+
const animatedStyle = useAnimatedStyle(function chunk6UEZJRVIJs4Factory({
|
|
303
|
+
_worklet_10361673705493_init_data,
|
|
304
|
+
animation,
|
|
305
|
+
pressedScale,
|
|
306
|
+
progress
|
|
307
|
+
}) {
|
|
308
|
+
const _e = [new global.Error(), -4, -27];
|
|
309
|
+
const chunk6UEZJRVIJs4 = function () {
|
|
310
|
+
if (!animation.scale) return {};
|
|
311
|
+
return {
|
|
312
|
+
transform: [{
|
|
313
|
+
scale: 1 - (1 - pressedScale.value) * progress.value
|
|
314
|
+
}]
|
|
315
|
+
};
|
|
316
|
+
};
|
|
317
|
+
chunk6UEZJRVIJs4.__closure = {
|
|
318
|
+
animation,
|
|
319
|
+
pressedScale,
|
|
320
|
+
progress
|
|
321
|
+
};
|
|
322
|
+
chunk6UEZJRVIJs4.__workletHash = 10361673705493;
|
|
323
|
+
chunk6UEZJRVIJs4.__pluginVersion = "0.7.4";
|
|
324
|
+
chunk6UEZJRVIJs4.__initData = _worklet_10361673705493_init_data;
|
|
325
|
+
chunk6UEZJRVIJs4.__stackDetails = _e;
|
|
326
|
+
return chunk6UEZJRVIJs4;
|
|
327
|
+
}({
|
|
328
|
+
_worklet_10361673705493_init_data,
|
|
329
|
+
animation,
|
|
330
|
+
pressedScale,
|
|
331
|
+
progress
|
|
332
|
+
}), [animation.scale, progress, pressedScale]);
|
|
333
|
+
const surface = useSurface(style);
|
|
334
|
+
const context = useMemo(() => ({
|
|
335
|
+
isPressed,
|
|
336
|
+
animation,
|
|
337
|
+
progress,
|
|
338
|
+
size,
|
|
339
|
+
waves,
|
|
340
|
+
...surface
|
|
341
|
+
}), [isPressed, animation, progress, size, waves, surface]);
|
|
342
|
+
const handleTouchStart = event => {
|
|
343
|
+
const wave = waves[nextWave.current];
|
|
344
|
+
nextWave.current = nextWave.current === 0 ? 1 : 0;
|
|
345
|
+
const {
|
|
346
|
+
locationX,
|
|
347
|
+
locationY
|
|
348
|
+
} = event.nativeEvent;
|
|
349
|
+
wave.origin.value = {
|
|
350
|
+
x: locationX,
|
|
351
|
+
y: locationY
|
|
352
|
+
};
|
|
353
|
+
wave.expand.value = 0;
|
|
354
|
+
wave.expand.value = withTiming(1, {
|
|
355
|
+
duration: RIPPLE_EXPAND_DURATION,
|
|
356
|
+
easing: Easing.ease
|
|
357
|
+
});
|
|
358
|
+
wave.alpha.value = withTiming(1, {
|
|
359
|
+
duration: RIPPLE_FADE_IN
|
|
360
|
+
});
|
|
361
|
+
onTouchStart?.(event);
|
|
362
|
+
};
|
|
363
|
+
const releaseWave = () => {
|
|
364
|
+
const wave = waves[nextWave.current === 0 ? 1 : 0];
|
|
365
|
+
wave.expand.value = withTiming(1, {
|
|
366
|
+
duration: RIPPLE_CONFIRM_DURATION,
|
|
367
|
+
easing: Easing.ease
|
|
368
|
+
});
|
|
369
|
+
wave.alpha.value = withDelay(RIPPLE_FADE_OUT_DELAY, withTiming(0, {
|
|
370
|
+
duration: RIPPLE_FADE_OUT
|
|
371
|
+
}));
|
|
372
|
+
};
|
|
373
|
+
const handleTouchEnd = event => {
|
|
374
|
+
releaseWave();
|
|
375
|
+
onTouchEnd?.(event);
|
|
376
|
+
};
|
|
377
|
+
const handleTouchCancel = event => {
|
|
378
|
+
releaseWave();
|
|
379
|
+
onTouchCancel?.(event);
|
|
380
|
+
};
|
|
381
|
+
const handleLayout = event => {
|
|
382
|
+
const {
|
|
383
|
+
width,
|
|
384
|
+
height
|
|
385
|
+
} = event.nativeEvent.layout;
|
|
386
|
+
size.value = {
|
|
387
|
+
width,
|
|
388
|
+
height
|
|
389
|
+
};
|
|
390
|
+
onLayout?.(event);
|
|
391
|
+
};
|
|
392
|
+
const Root = asChild ? AnimatedSlot : AnimatedPressable;
|
|
393
|
+
return /* @__PURE__ */jsx(FeedbackProvider, {
|
|
394
|
+
value: context,
|
|
395
|
+
children: /* @__PURE__ */jsx(Root, {
|
|
396
|
+
ref,
|
|
397
|
+
style: [style, animatedStyle],
|
|
398
|
+
disabled: isDisabled,
|
|
399
|
+
onLayout: handleLayout,
|
|
400
|
+
onTouchStart: handleTouchStart,
|
|
401
|
+
onTouchEnd: handleTouchEnd,
|
|
402
|
+
onTouchCancel: handleTouchCancel,
|
|
403
|
+
...rest,
|
|
404
|
+
children: feedbackChildren(children, asChild)
|
|
405
|
+
})
|
|
406
|
+
});
|
|
407
|
+
});
|
|
408
|
+
PressableFeedback.displayName = "XAUI.PressableFeedback";
|
|
409
|
+
function useWave() {
|
|
410
|
+
return {
|
|
411
|
+
expand: useSharedValue(0),
|
|
412
|
+
alpha: useSharedValue(0),
|
|
413
|
+
origin: useSharedValue({
|
|
414
|
+
x: 0,
|
|
415
|
+
y: 0
|
|
416
|
+
})
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
function useSurface(style) {
|
|
420
|
+
const theme = useXAUITheme();
|
|
421
|
+
return useMemo(() => {
|
|
422
|
+
const flat = StyleSheet.flatten(style);
|
|
423
|
+
return {
|
|
424
|
+
ink: inkFor(flat?.backgroundColor, theme.colors),
|
|
425
|
+
corners: radiusFrom(flat)
|
|
426
|
+
};
|
|
427
|
+
}, [style, theme]);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// src/system/pressable-feedback/pressable-feedback-highlight.tsx
|
|
431
|
+
import { useEffect as useEffect2 } from "react";
|
|
432
|
+
import { StyleSheet as StyleSheet2, View as View2 } from "react-native";
|
|
433
|
+
import Animated2, { useAnimatedStyle as useAnimatedStyle2, useSharedValue as useSharedValue2, withTiming as withTiming2 } from "react-native-reanimated";
|
|
434
|
+
import { Fragment as Fragment2, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
435
|
+
function PressableFeedbackHighlight({
|
|
436
|
+
style,
|
|
437
|
+
animation: override,
|
|
438
|
+
children,
|
|
439
|
+
...props
|
|
440
|
+
}) {
|
|
441
|
+
const {
|
|
442
|
+
isPressed,
|
|
443
|
+
animation,
|
|
444
|
+
progress,
|
|
445
|
+
ink,
|
|
446
|
+
corners
|
|
447
|
+
} = useFeedback();
|
|
448
|
+
const [styleProps] = useStyleProps(props);
|
|
449
|
+
const settings = resolveSlotAnimation(override, animation.highlight, HIGHLIGHT_OPACITY, HIGHLIGHT_DURATION);
|
|
450
|
+
const base = [StyleSheet2.absoluteFillObject, {
|
|
451
|
+
backgroundColor: ink,
|
|
452
|
+
pointerEvents: "none"
|
|
453
|
+
}, corners, styleProps, style];
|
|
454
|
+
if (!progress || !settings.enabled) {
|
|
455
|
+
return /* @__PURE__ */jsxs(Fragment2, {
|
|
456
|
+
children: [/* @__PURE__ */jsx2(View2, {
|
|
457
|
+
style: [base, {
|
|
458
|
+
opacity: isPressed ? settings.opacity : 0
|
|
459
|
+
}]
|
|
460
|
+
}), children]
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
return /* @__PURE__ */jsxs(Fragment2, {
|
|
464
|
+
children: [/* @__PURE__ */jsx2(AnimatedHighlight, {
|
|
465
|
+
base,
|
|
466
|
+
duration: settings.duration,
|
|
467
|
+
opacity: settings.opacity
|
|
468
|
+
}), children]
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
PressableFeedbackHighlight.displayName = "XAUI.PressableFeedback.Highlight";
|
|
472
|
+
markOverlay(PressableFeedbackHighlight);
|
|
473
|
+
const _worklet_9195774527589_init_data = {
|
|
474
|
+
code: "function chunk6UEZJRVIJs5(){const{shown,opacity}=this.__closure;return{opacity:shown.value*opacity};}",
|
|
475
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-6UEZJRVI.js",
|
|
476
|
+
sourceMap: "{\"version\":3,\"names\":[\"chunk6UEZJRVIJs5\",\"shown\",\"opacity\",\"__closure\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-6UEZJRVI.js\"],\"mappings\":\"AAiW0C,SAAAA,gBAAMA,CAAA,QAAAC,KAAA,CAAAC,OAAA,OAAAC,SAAA,CAE5C,MAAO,CAAED,OAAO,CAAED,KAAK,CAACG,KAAK,CAAGF,OAAQ,CAAC,CAC3C\",\"ignoreList\":[]}"
|
|
477
|
+
};
|
|
478
|
+
function AnimatedHighlight({
|
|
479
|
+
base,
|
|
480
|
+
duration,
|
|
481
|
+
opacity
|
|
482
|
+
}) {
|
|
483
|
+
const {
|
|
484
|
+
isPressed
|
|
485
|
+
} = useFeedback();
|
|
486
|
+
const shown = useSharedValue2(0);
|
|
487
|
+
useEffect2(() => {
|
|
488
|
+
shown.value = withTiming2(isPressed ? 1 : 0, {
|
|
489
|
+
duration
|
|
490
|
+
});
|
|
491
|
+
}, [isPressed, shown, duration]);
|
|
492
|
+
const animatedStyle = useAnimatedStyle2(function chunk6UEZJRVIJs5Factory({
|
|
493
|
+
_worklet_9195774527589_init_data,
|
|
494
|
+
shown,
|
|
495
|
+
opacity
|
|
496
|
+
}) {
|
|
497
|
+
const _e = [new global.Error(), -3, -27];
|
|
498
|
+
const chunk6UEZJRVIJs5 = function () {
|
|
499
|
+
return {
|
|
500
|
+
opacity: shown.value * opacity
|
|
501
|
+
};
|
|
502
|
+
};
|
|
503
|
+
chunk6UEZJRVIJs5.__closure = {
|
|
504
|
+
shown,
|
|
505
|
+
opacity
|
|
506
|
+
};
|
|
507
|
+
chunk6UEZJRVIJs5.__workletHash = 9195774527589;
|
|
508
|
+
chunk6UEZJRVIJs5.__pluginVersion = "0.7.4";
|
|
509
|
+
chunk6UEZJRVIJs5.__initData = _worklet_9195774527589_init_data;
|
|
510
|
+
chunk6UEZJRVIJs5.__stackDetails = _e;
|
|
511
|
+
return chunk6UEZJRVIJs5;
|
|
512
|
+
}({
|
|
513
|
+
_worklet_9195774527589_init_data,
|
|
514
|
+
shown,
|
|
515
|
+
opacity
|
|
516
|
+
}), [shown, opacity]);
|
|
517
|
+
return /* @__PURE__ */jsx2(Animated2.View, {
|
|
518
|
+
style: [base, animatedStyle]
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
// src/system/pressable-feedback/pressable-feedback-ripple.tsx
|
|
523
|
+
import { useState } from "react";
|
|
524
|
+
import { StyleSheet as StyleSheet3, View as View3 } from "react-native";
|
|
525
|
+
import Animated3, { useAnimatedStyle as useAnimatedStyle3 } from "react-native-reanimated";
|
|
526
|
+
import { Fragment as Fragment3, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
527
|
+
function PressableFeedbackRipple({
|
|
528
|
+
style,
|
|
529
|
+
animation: override,
|
|
530
|
+
children,
|
|
531
|
+
...props
|
|
532
|
+
}) {
|
|
533
|
+
const {
|
|
534
|
+
animation,
|
|
535
|
+
waves,
|
|
536
|
+
ink,
|
|
537
|
+
corners
|
|
538
|
+
} = useFeedback();
|
|
539
|
+
const [styleProps] = useStyleProps(props);
|
|
540
|
+
const waveStyle = [styleProps, style];
|
|
541
|
+
const settings = resolveSlotAnimation(override, animation.ripple, RIPPLE_OPACITY);
|
|
542
|
+
const [size, setSize] = useState({
|
|
543
|
+
width: 0,
|
|
544
|
+
height: 0
|
|
545
|
+
});
|
|
546
|
+
const handleLayout = event => {
|
|
547
|
+
const {
|
|
548
|
+
width,
|
|
549
|
+
height
|
|
550
|
+
} = event.nativeEvent.layout;
|
|
551
|
+
setSize(current => current.width === width && current.height === height ? current : {
|
|
552
|
+
width,
|
|
553
|
+
height
|
|
554
|
+
});
|
|
555
|
+
};
|
|
556
|
+
if (!waves || !settings.enabled) return /* @__PURE__ */jsx3(Fragment3, {
|
|
557
|
+
children
|
|
558
|
+
});
|
|
559
|
+
const radius = rippleRadiusFor(size.width, size.height);
|
|
560
|
+
return /* @__PURE__ */jsxs2(Fragment3, {
|
|
561
|
+
children: [/* @__PURE__ */jsx3(View3, {
|
|
562
|
+
style: [StyleSheet3.absoluteFill, styles.clip, corners],
|
|
563
|
+
onLayout: handleLayout,
|
|
564
|
+
children: waves.map((wave, index) => /* @__PURE__ */jsx3(RippleWave, {
|
|
565
|
+
wave,
|
|
566
|
+
radius,
|
|
567
|
+
center: {
|
|
568
|
+
x: size.width / 2,
|
|
569
|
+
y: size.height / 2
|
|
570
|
+
},
|
|
571
|
+
color: ink,
|
|
572
|
+
opacity: settings.opacity,
|
|
573
|
+
style: waveStyle
|
|
574
|
+
}, index))
|
|
575
|
+
}), children]
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
PressableFeedbackRipple.displayName = "XAUI.PressableFeedback.Ripple";
|
|
579
|
+
markOverlay(PressableFeedbackRipple);
|
|
580
|
+
const _worklet_5341060347434_init_data = {
|
|
581
|
+
code: "function chunk6UEZJRVIJs6(){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}]};}",
|
|
582
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-6UEZJRVI.js",
|
|
583
|
+
sourceMap: "{\"version\":3,\"names\":[\"chunk6UEZJRVIJs6\",\"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-6UEZJRVI.js\"],\"mappings\":\"AAia0C,SAAAA,gBAAMA,CAAA,QAAAC,IAAA,CAAAC,kBAAA,CAAAC,MAAA,CAAAC,OAAA,CAAAC,MAAA,OAAAC,SAAA,CAE5C,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\":[]}"
|
|
584
|
+
};
|
|
585
|
+
function RippleWave({
|
|
586
|
+
wave,
|
|
587
|
+
radius,
|
|
588
|
+
center,
|
|
589
|
+
color,
|
|
590
|
+
opacity,
|
|
591
|
+
style
|
|
592
|
+
}) {
|
|
593
|
+
const animatedStyle = useAnimatedStyle3(function chunk6UEZJRVIJs6Factory({
|
|
594
|
+
_worklet_5341060347434_init_data,
|
|
595
|
+
wave,
|
|
596
|
+
RIPPLE_START_SCALE,
|
|
597
|
+
center,
|
|
598
|
+
opacity,
|
|
599
|
+
radius
|
|
600
|
+
}) {
|
|
601
|
+
const _e = [new global.Error(), -6, -27];
|
|
602
|
+
const chunk6UEZJRVIJs6 = function () {
|
|
603
|
+
const t = wave.expand.value;
|
|
604
|
+
const from = wave.origin.value;
|
|
605
|
+
const scale = RIPPLE_START_SCALE + (1 - RIPPLE_START_SCALE) * t;
|
|
606
|
+
const x = from.x + (center.x - from.x) * t;
|
|
607
|
+
const y = from.y + (center.y - from.y) * t;
|
|
608
|
+
return {
|
|
609
|
+
// Its own curve, not the expansion's: full ink in 75ms, held while the circle grows.
|
|
610
|
+
opacity: wave.alpha.value * opacity,
|
|
611
|
+
transform: [{
|
|
612
|
+
translateX: x - radius
|
|
613
|
+
}, {
|
|
614
|
+
translateY: y - radius
|
|
615
|
+
}, {
|
|
616
|
+
scale
|
|
617
|
+
}]
|
|
618
|
+
};
|
|
619
|
+
};
|
|
620
|
+
chunk6UEZJRVIJs6.__closure = {
|
|
621
|
+
wave,
|
|
622
|
+
RIPPLE_START_SCALE,
|
|
623
|
+
center,
|
|
624
|
+
opacity,
|
|
625
|
+
radius
|
|
626
|
+
};
|
|
627
|
+
chunk6UEZJRVIJs6.__workletHash = 5341060347434;
|
|
628
|
+
chunk6UEZJRVIJs6.__pluginVersion = "0.7.4";
|
|
629
|
+
chunk6UEZJRVIJs6.__initData = _worklet_5341060347434_init_data;
|
|
630
|
+
chunk6UEZJRVIJs6.__stackDetails = _e;
|
|
631
|
+
return chunk6UEZJRVIJs6;
|
|
632
|
+
}({
|
|
633
|
+
_worklet_5341060347434_init_data,
|
|
634
|
+
wave,
|
|
635
|
+
RIPPLE_START_SCALE,
|
|
636
|
+
center,
|
|
637
|
+
opacity,
|
|
638
|
+
radius
|
|
639
|
+
}), [wave, radius, center, opacity]);
|
|
640
|
+
return /* @__PURE__ */jsx3(Animated3.View, {
|
|
641
|
+
style: [styles.wave, {
|
|
642
|
+
backgroundColor: color,
|
|
643
|
+
width: radius * 2,
|
|
644
|
+
height: radius * 2,
|
|
645
|
+
borderRadius: radius
|
|
646
|
+
}, style, animatedStyle]
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
var styles = StyleSheet3.create({
|
|
650
|
+
// `pointerEvents` in the style rather than as a prop: the prop form is deprecated, and it
|
|
651
|
+
// is not decoration — a container that ate touches would claim every press meant for the
|
|
652
|
+
// control it covers.
|
|
653
|
+
clip: {
|
|
654
|
+
overflow: "hidden",
|
|
655
|
+
pointerEvents: "none"
|
|
656
|
+
},
|
|
657
|
+
wave: {
|
|
658
|
+
position: "absolute",
|
|
659
|
+
top: 0,
|
|
660
|
+
start: 0
|
|
661
|
+
}
|
|
662
|
+
});
|
|
663
|
+
|
|
664
|
+
// src/system/pressable-feedback/index.ts
|
|
665
|
+
var PressableFeedback3 = Object.assign(PressableFeedback, {
|
|
666
|
+
Highlight: PressableFeedbackHighlight,
|
|
667
|
+
Ripple: PressableFeedbackRipple
|
|
668
|
+
});
|
|
669
|
+
export { useFeedback, PRESS_SCALE, PRESS_DURATION, SCALE_REFERENCE_WIDTH, pressScaleFor, HIGHLIGHT_OPACITY, HIGHLIGHT_DURATION, RIPPLE_OPACITY, RIPPLE_START_SCALE, RIPPLE_EXPAND_DURATION, RIPPLE_CONFIRM_DURATION, RIPPLE_FADE_IN, RIPPLE_FADE_OUT_DELAY, RIPPLE_FADE_OUT, rippleRadiusFor, resolveAnimation, resolveSlotAnimation, FEEDBACK_OVERLAY, markOverlay, PressableFeedback3 as PressableFeedback };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// src/hooks/use-anchor-ref.ts
|
|
2
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
3
|
+
function useAnchorRef({ isOpen, onAnchor, onLayout }) {
|
|
4
|
+
const node = useRef(null);
|
|
5
|
+
const latest = useRef(onAnchor);
|
|
6
|
+
latest.current = onAnchor;
|
|
7
|
+
const measure = useCallback(() => {
|
|
8
|
+
node.current?.measureInWindow((x, y, width, height) => {
|
|
9
|
+
latest.current({ x, y, width, height });
|
|
10
|
+
});
|
|
11
|
+
}, []);
|
|
12
|
+
const handleLayout = useCallback(
|
|
13
|
+
(event) => {
|
|
14
|
+
onLayout?.(event);
|
|
15
|
+
measure();
|
|
16
|
+
},
|
|
17
|
+
[measure, onLayout]
|
|
18
|
+
);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (isOpen) measure();
|
|
21
|
+
}, [isOpen, measure]);
|
|
22
|
+
return { node, measure, onLayout: handleLayout };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
useAnchorRef
|
|
27
|
+
};
|