@xaui/native 0.2.8 → 0.9.1-alpha.0
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-JDS6KGCM.cjs +791 -0
- package/dist/chunk-T3ZI2PZ6.js +791 -0
- package/dist/index.cjs +32 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +32 -0
- package/dist/theme/index.cjs +32 -0
- package/dist/theme/index.d.cts +669 -0
- package/dist/theme/index.d.ts +669 -0
- package/dist/theme/index.js +32 -0
- package/package.json +26 -249
- package/README.md +0 -178
- package/dist/alert/index.cjs +0 -340
- package/dist/alert/index.d.cts +0 -46
- package/dist/alert/index.d.ts +0 -46
- package/dist/alert/index.js +0 -340
- package/dist/app-bar/index.cjs +0 -148
- package/dist/app-bar/index.d.cts +0 -59
- package/dist/app-bar/index.d.ts +0 -59
- package/dist/app-bar/index.js +0 -148
- package/dist/autocomplete/index.cjs +0 -1122
- package/dist/autocomplete/index.d.cts +0 -88
- package/dist/autocomplete/index.d.ts +0 -88
- package/dist/autocomplete/index.js +0 -1122
- package/dist/avatar/index.cjs +0 -281
- package/dist/avatar/index.d.cts +0 -123
- package/dist/avatar/index.d.ts +0 -123
- package/dist/avatar/index.js +0 -281
- package/dist/badge/index.cjs +0 -197
- package/dist/badge/index.d.cts +0 -94
- package/dist/badge/index.d.ts +0 -94
- package/dist/badge/index.js +0 -197
- package/dist/bottom-sheet/index.cjs +0 -9
- package/dist/bottom-sheet/index.d.cts +0 -84
- package/dist/bottom-sheet/index.d.ts +0 -84
- package/dist/bottom-sheet/index.js +0 -9
- package/dist/bottom-tab-bar/index.cjs +0 -497
- package/dist/bottom-tab-bar/index.d.cts +0 -211
- package/dist/bottom-tab-bar/index.d.ts +0 -211
- package/dist/bottom-tab-bar/index.js +0 -497
- package/dist/button/index.cjs +0 -392
- package/dist/button/index.d.cts +0 -174
- package/dist/button/index.d.ts +0 -174
- package/dist/button/index.js +0 -392
- package/dist/button.type-j1ZdkkSl.d.cts +0 -4
- package/dist/button.type-j1ZdkkSl.d.ts +0 -4
- package/dist/card/index.cjs +0 -338
- package/dist/card/index.d.cts +0 -191
- package/dist/card/index.d.ts +0 -191
- package/dist/card/index.js +0 -338
- package/dist/carousel/index.cjs +0 -381
- package/dist/carousel/index.d.cts +0 -147
- package/dist/carousel/index.d.ts +0 -147
- package/dist/carousel/index.js +0 -381
- package/dist/chart/index.cjs +0 -1026
- package/dist/chart/index.d.cts +0 -218
- package/dist/chart/index.d.ts +0 -218
- package/dist/chart/index.js +0 -1026
- package/dist/checkbox/index.cjs +0 -443
- package/dist/checkbox/index.d.cts +0 -73
- package/dist/checkbox/index.d.ts +0 -73
- package/dist/checkbox/index.js +0 -443
- package/dist/chip/index.cjs +0 -503
- package/dist/chip/index.d.cts +0 -195
- package/dist/chip/index.d.ts +0 -195
- package/dist/chip/index.js +0 -503
- package/dist/chunk-4JFWQ5XT.js +0 -368
- package/dist/chunk-56RPWZD2.cjs +0 -9
- package/dist/chunk-7UFBLUMV.cjs +0 -136
- package/dist/chunk-A45TVXU5.js +0 -337
- package/dist/chunk-BYWUAPC4.cjs +0 -368
- package/dist/chunk-DECMUMCI.js +0 -0
- package/dist/chunk-DHSTKO3K.cjs +0 -19
- package/dist/chunk-DJ4Q37UT.cjs +0 -75
- package/dist/chunk-EUQDGTST.cjs +0 -1
- package/dist/chunk-GBHQCAKW.js +0 -19
- package/dist/chunk-RBSA4NH4.js +0 -136
- package/dist/chunk-SHBDANQN.js +0 -9
- package/dist/chunk-UGEINZM7.cjs +0 -290
- package/dist/chunk-UU4HHBDN.js +0 -290
- package/dist/chunk-VSZEXOUN.js +0 -384
- package/dist/chunk-YIEUN3G5.cjs +0 -384
- package/dist/chunk-ZH6ZSV2Q.cjs +0 -337
- package/dist/chunk-ZY7IUTAT.js +0 -75
- package/dist/color-picker/index.cjs +0 -457
- package/dist/color-picker/index.d.cts +0 -124
- package/dist/color-picker/index.d.ts +0 -124
- package/dist/color-picker/index.js +0 -457
- package/dist/core/index.cjs +0 -24
- package/dist/core/index.d.cts +0 -28
- package/dist/core/index.d.ts +0 -28
- package/dist/core/index.js +0 -24
- package/dist/datepicker/index.cjs +0 -1625
- package/dist/datepicker/index.d.cts +0 -45
- package/dist/datepicker/index.d.ts +0 -45
- package/dist/datepicker/index.js +0 -1625
- package/dist/dialog/index.cjs +0 -372
- package/dist/dialog/index.d.cts +0 -151
- package/dist/dialog/index.d.ts +0 -151
- package/dist/dialog/index.js +0 -372
- package/dist/divider/index.cjs +0 -8
- package/dist/divider/index.d.cts +0 -30
- package/dist/divider/index.d.ts +0 -30
- package/dist/divider/index.js +0 -8
- package/dist/drawer/index.cjs +0 -237
- package/dist/drawer/index.d.cts +0 -58
- package/dist/drawer/index.d.ts +0 -58
- package/dist/drawer/index.js +0 -237
- package/dist/expansion-panel/index.cjs +0 -441
- package/dist/expansion-panel/index.d.cts +0 -153
- package/dist/expansion-panel/index.d.ts +0 -153
- package/dist/expansion-panel/index.js +0 -441
- package/dist/fab/index.cjs +0 -9
- package/dist/fab/index.d.cts +0 -10
- package/dist/fab/index.d.ts +0 -10
- package/dist/fab/index.js +0 -9
- package/dist/fab-menu/index.cjs +0 -330
- package/dist/fab-menu/index.d.cts +0 -125
- package/dist/fab-menu/index.d.ts +0 -125
- package/dist/fab-menu/index.js +0 -330
- package/dist/fab.type-CkUHmXU_.d.ts +0 -86
- package/dist/fab.type-DN0vtAh6.d.cts +0 -86
- package/dist/feature-discovery/index.cjs +0 -464
- package/dist/feature-discovery/index.d.cts +0 -82
- package/dist/feature-discovery/index.d.ts +0 -82
- package/dist/feature-discovery/index.js +0 -464
- package/dist/indicator/index.cjs +0 -8
- package/dist/indicator/index.d.cts +0 -47
- package/dist/indicator/index.d.ts +0 -47
- package/dist/indicator/index.js +0 -8
- package/dist/input/index.cjs +0 -1462
- package/dist/input/index.d.cts +0 -522
- package/dist/input/index.d.ts +0 -522
- package/dist/input/index.js +0 -1462
- package/dist/input-trigger/index.cjs +0 -197
- package/dist/input-trigger/index.d.cts +0 -11
- package/dist/input-trigger/index.d.ts +0 -11
- package/dist/input-trigger/index.js +0 -197
- package/dist/input-trigger.type-Ba4bM3Qp.d.cts +0 -180
- package/dist/input-trigger.type-Ba4bM3Qp.d.ts +0 -180
- package/dist/list/index.cjs +0 -395
- package/dist/list/index.d.cts +0 -188
- package/dist/list/index.d.ts +0 -188
- package/dist/list/index.js +0 -395
- package/dist/menu/index.cjs +0 -316
- package/dist/menu/index.d.cts +0 -115
- package/dist/menu/index.d.ts +0 -115
- package/dist/menu/index.js +0 -316
- package/dist/menubox/index.cjs +0 -297
- package/dist/menubox/index.d.cts +0 -98
- package/dist/menubox/index.d.ts +0 -98
- package/dist/menubox/index.js +0 -297
- package/dist/pager/index.cjs +0 -205
- package/dist/pager/index.d.cts +0 -93
- package/dist/pager/index.d.ts +0 -93
- package/dist/pager/index.js +0 -205
- package/dist/picker/index.cjs +0 -244
- package/dist/picker/index.d.cts +0 -121
- package/dist/picker/index.d.ts +0 -121
- package/dist/picker/index.js +0 -244
- package/dist/progress/index.cjs +0 -219
- package/dist/progress/index.d.cts +0 -47
- package/dist/progress/index.d.ts +0 -47
- package/dist/progress/index.js +0 -219
- package/dist/radio/index.cjs +0 -465
- package/dist/radio/index.d.cts +0 -145
- package/dist/radio/index.d.ts +0 -145
- package/dist/radio/index.js +0 -465
- package/dist/refresh-control/index.cjs +0 -45
- package/dist/refresh-control/index.d.cts +0 -55
- package/dist/refresh-control/index.d.ts +0 -55
- package/dist/refresh-control/index.js +0 -45
- package/dist/segment-button/index.cjs +0 -405
- package/dist/segment-button/index.d.cts +0 -141
- package/dist/segment-button/index.d.ts +0 -141
- package/dist/segment-button/index.js +0 -405
- package/dist/select/index.cjs +0 -878
- package/dist/select/index.d.cts +0 -192
- package/dist/select/index.d.ts +0 -192
- package/dist/select/index.js +0 -878
- package/dist/skeleton/index.cjs +0 -89
- package/dist/skeleton/index.d.cts +0 -45
- package/dist/skeleton/index.d.ts +0 -45
- package/dist/skeleton/index.js +0 -89
- package/dist/slider/index.cjs +0 -576
- package/dist/slider/index.d.cts +0 -171
- package/dist/slider/index.d.ts +0 -171
- package/dist/slider/index.js +0 -576
- package/dist/snackbar/index.cjs +0 -436
- package/dist/snackbar/index.d.cts +0 -174
- package/dist/snackbar/index.d.ts +0 -174
- package/dist/snackbar/index.js +0 -436
- package/dist/snippet/index.cjs +0 -314
- package/dist/snippet/index.d.cts +0 -95
- package/dist/snippet/index.d.ts +0 -95
- package/dist/snippet/index.js +0 -314
- package/dist/stepper/index.cjs +0 -550
- package/dist/stepper/index.d.cts +0 -137
- package/dist/stepper/index.d.ts +0 -137
- package/dist/stepper/index.js +0 -550
- package/dist/switch/index.cjs +0 -358
- package/dist/switch/index.d.cts +0 -28
- package/dist/switch/index.d.ts +0 -28
- package/dist/switch/index.js +0 -358
- package/dist/tabs/index.cjs +0 -440
- package/dist/tabs/index.d.cts +0 -180
- package/dist/tabs/index.d.ts +0 -180
- package/dist/tabs/index.js +0 -440
- package/dist/timepicker/index.cjs +0 -823
- package/dist/timepicker/index.d.cts +0 -215
- package/dist/timepicker/index.d.ts +0 -215
- package/dist/timepicker/index.js +0 -823
- package/dist/toolbar/index.cjs +0 -333
- package/dist/toolbar/index.d.cts +0 -100
- package/dist/toolbar/index.d.ts +0 -100
- package/dist/toolbar/index.js +0 -333
- package/dist/typography/index.cjs +0 -238
- package/dist/typography/index.d.cts +0 -113
- package/dist/typography/index.d.ts +0 -113
- package/dist/typography/index.js +0 -238
- package/dist/view/index.cjs +0 -1361
- package/dist/view/index.d.cts +0 -833
- package/dist/view/index.d.ts +0 -833
- package/dist/view/index.js +0 -1361
|
@@ -1,464 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }require('../chunk-56RPWZD2.cjs');
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunk7UFBLUMVcjs = require('../chunk-7UFBLUMV.cjs');
|
|
5
|
-
|
|
6
|
-
// src/components/feature-discovery/feature-discovery.tsx
|
|
7
|
-
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var _reactnative = require('react-native');
|
|
15
|
-
var _core = require('@xaui/core');
|
|
16
|
-
|
|
17
|
-
// src/components/feature-discovery/feature-discovery.style.ts
|
|
18
|
-
|
|
19
|
-
var styles = _reactnative.StyleSheet.create({
|
|
20
|
-
root: {
|
|
21
|
-
flex: 1
|
|
22
|
-
},
|
|
23
|
-
absoluteFill: {
|
|
24
|
-
..._reactnative.StyleSheet.absoluteFillObject
|
|
25
|
-
},
|
|
26
|
-
circle: {
|
|
27
|
-
position: "absolute"
|
|
28
|
-
},
|
|
29
|
-
spotlightHalo: {
|
|
30
|
-
position: "absolute",
|
|
31
|
-
borderWidth: 1,
|
|
32
|
-
borderColor: "rgba(255, 255, 255, 0.35)"
|
|
33
|
-
},
|
|
34
|
-
highlightContainer: {
|
|
35
|
-
position: "absolute",
|
|
36
|
-
alignItems: "center",
|
|
37
|
-
justifyContent: "center"
|
|
38
|
-
},
|
|
39
|
-
messageContainer: {
|
|
40
|
-
position: "absolute",
|
|
41
|
-
gap: 10,
|
|
42
|
-
paddingVertical: 16,
|
|
43
|
-
paddingHorizontal: 16,
|
|
44
|
-
borderRadius: 12
|
|
45
|
-
},
|
|
46
|
-
messageHeader: {
|
|
47
|
-
flexDirection: "row",
|
|
48
|
-
alignItems: "flex-start",
|
|
49
|
-
justifyContent: "space-between",
|
|
50
|
-
gap: 8
|
|
51
|
-
},
|
|
52
|
-
messageTitleWrapper: {
|
|
53
|
-
flex: 1
|
|
54
|
-
},
|
|
55
|
-
title: {
|
|
56
|
-
fontSize: 24,
|
|
57
|
-
fontWeight: "700"
|
|
58
|
-
},
|
|
59
|
-
closeButton: {
|
|
60
|
-
padding: 4
|
|
61
|
-
},
|
|
62
|
-
closeIcon: {
|
|
63
|
-
fontSize: 18,
|
|
64
|
-
fontWeight: "600"
|
|
65
|
-
},
|
|
66
|
-
description: {
|
|
67
|
-
fontSize: 16,
|
|
68
|
-
fontWeight: "400",
|
|
69
|
-
opacity: 0.86,
|
|
70
|
-
lineHeight: 22
|
|
71
|
-
},
|
|
72
|
-
actionPressable: {
|
|
73
|
-
alignSelf: "flex-start"
|
|
74
|
-
},
|
|
75
|
-
actionText: {
|
|
76
|
-
fontSize: 14,
|
|
77
|
-
fontWeight: "600",
|
|
78
|
-
textDecorationLine: "underline"
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
// src/components/feature-discovery/feature-discovery.hook.ts
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
var useFeatureDiscoveryAnimations = () => {
|
|
87
|
-
const backdropOpacity = _react.useRef.call(void 0, new _reactnative.Animated.Value(0)).current;
|
|
88
|
-
const circleAnimScale = _react.useRef.call(void 0, new _reactnative.Animated.Value(0.2)).current;
|
|
89
|
-
const contentOpacity = _react.useRef.call(void 0, new _reactnative.Animated.Value(0)).current;
|
|
90
|
-
const haloScale = _react.useRef.call(void 0, new _reactnative.Animated.Value(0.8)).current;
|
|
91
|
-
const startAnimations = _react.useCallback.call(void 0, () => {
|
|
92
|
-
_reactnative.Animated.parallel([
|
|
93
|
-
_reactnative.Animated.timing(backdropOpacity, {
|
|
94
|
-
toValue: 1,
|
|
95
|
-
duration: 220,
|
|
96
|
-
useNativeDriver: true
|
|
97
|
-
}),
|
|
98
|
-
_reactnative.Animated.spring(circleAnimScale, {
|
|
99
|
-
toValue: 1,
|
|
100
|
-
friction: 8,
|
|
101
|
-
tension: 80,
|
|
102
|
-
useNativeDriver: true
|
|
103
|
-
}),
|
|
104
|
-
_reactnative.Animated.timing(contentOpacity, {
|
|
105
|
-
toValue: 1,
|
|
106
|
-
duration: 260,
|
|
107
|
-
useNativeDriver: true
|
|
108
|
-
}),
|
|
109
|
-
_reactnative.Animated.spring(haloScale, {
|
|
110
|
-
toValue: 1,
|
|
111
|
-
friction: 8,
|
|
112
|
-
tension: 80,
|
|
113
|
-
useNativeDriver: true
|
|
114
|
-
})
|
|
115
|
-
]).start();
|
|
116
|
-
}, [backdropOpacity, circleAnimScale, contentOpacity, haloScale]);
|
|
117
|
-
const resetAnimations = _react.useCallback.call(void 0, () => {
|
|
118
|
-
backdropOpacity.setValue(0);
|
|
119
|
-
circleAnimScale.setValue(0.2);
|
|
120
|
-
contentOpacity.setValue(0);
|
|
121
|
-
haloScale.setValue(0.8);
|
|
122
|
-
}, [backdropOpacity, circleAnimScale, contentOpacity, haloScale]);
|
|
123
|
-
return {
|
|
124
|
-
backdropOpacity,
|
|
125
|
-
circleAnimScale,
|
|
126
|
-
contentOpacity,
|
|
127
|
-
haloScale,
|
|
128
|
-
startAnimations,
|
|
129
|
-
resetAnimations
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
var useFeatureDiscoveryLayout = (targetRef) => {
|
|
133
|
-
const { width: viewportWidth, height: viewportHeight } = _reactnative.useWindowDimensions.call(void 0, );
|
|
134
|
-
const [targetLayout, setTargetLayout] = _react.useState.call(void 0, null);
|
|
135
|
-
const measureTarget = _react.useCallback.call(void 0, () => {
|
|
136
|
-
_optionalChain([targetRef, 'access', _ => _.current, 'optionalAccess', _2 => _2.measureInWindow, 'call', _3 => _3((x, y, width, height) => {
|
|
137
|
-
if (!width && !height) {
|
|
138
|
-
setTargetLayout({
|
|
139
|
-
x: viewportWidth / 2 - 28,
|
|
140
|
-
y: viewportHeight / 2 - 28,
|
|
141
|
-
width: 56,
|
|
142
|
-
height: 56
|
|
143
|
-
});
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
setTargetLayout({ x, y, width, height });
|
|
147
|
-
})]);
|
|
148
|
-
}, [targetRef, viewportHeight, viewportWidth]);
|
|
149
|
-
const fallbackTarget = _react.useMemo.call(void 0,
|
|
150
|
-
() => ({
|
|
151
|
-
x: viewportWidth / 2 - 28,
|
|
152
|
-
y: viewportHeight / 2 - 28,
|
|
153
|
-
width: 56,
|
|
154
|
-
height: 56
|
|
155
|
-
}),
|
|
156
|
-
[viewportWidth, viewportHeight]
|
|
157
|
-
);
|
|
158
|
-
const target = _nullishCoalesce(targetLayout, () => ( fallbackTarget));
|
|
159
|
-
return {
|
|
160
|
-
targetLayout,
|
|
161
|
-
target,
|
|
162
|
-
measureTarget,
|
|
163
|
-
setTargetLayout,
|
|
164
|
-
viewportWidth,
|
|
165
|
-
viewportHeight
|
|
166
|
-
};
|
|
167
|
-
};
|
|
168
|
-
var useFeatureDiscoveryGeometry = (target, viewportWidth, viewportHeight, spotlightPadding, circleScale) => {
|
|
169
|
-
const HIGHLIGHT_EDGE_INSET = 16;
|
|
170
|
-
const maxTargetX = Math.max(
|
|
171
|
-
HIGHLIGHT_EDGE_INSET,
|
|
172
|
-
viewportWidth - target.width - HIGHLIGHT_EDGE_INSET
|
|
173
|
-
);
|
|
174
|
-
const maxTargetY = Math.max(
|
|
175
|
-
HIGHLIGHT_EDGE_INSET,
|
|
176
|
-
viewportHeight - target.height - HIGHLIGHT_EDGE_INSET
|
|
177
|
-
);
|
|
178
|
-
const clampedTargetX = Math.min(
|
|
179
|
-
Math.max(target.x, HIGHLIGHT_EDGE_INSET),
|
|
180
|
-
maxTargetX
|
|
181
|
-
);
|
|
182
|
-
const clampedTargetY = Math.min(
|
|
183
|
-
Math.max(target.y, HIGHLIGHT_EDGE_INSET),
|
|
184
|
-
maxTargetY
|
|
185
|
-
);
|
|
186
|
-
const targetCenterX = clampedTargetX + target.width / 2;
|
|
187
|
-
const targetCenterY = clampedTargetY + target.height / 2;
|
|
188
|
-
const spotlightSize = Math.max(target.width, target.height) + spotlightPadding * 2;
|
|
189
|
-
const circleDiameter = _react.useMemo.call(void 0, () => {
|
|
190
|
-
return viewportWidth * circleScale;
|
|
191
|
-
}, [circleScale, viewportWidth]);
|
|
192
|
-
const circleRadius = circleDiameter / 2;
|
|
193
|
-
const TEXT_PADDING = 24;
|
|
194
|
-
const TARGET_GAP = 30;
|
|
195
|
-
const MIN_MESSAGE_HEIGHT = 140;
|
|
196
|
-
const MIN_MESSAGE_WIDTH = 280;
|
|
197
|
-
const MESSAGE_VERTICAL_OFFSET = 14;
|
|
198
|
-
const isTargetInTopHalf = targetCenterY < viewportHeight * 0.55;
|
|
199
|
-
const baseMessageTop = isTargetInTopHalf ? Math.min(viewportHeight - 200, clampedTargetY + target.height + TARGET_GAP) : Math.max(TEXT_PADDING, clampedTargetY - 150);
|
|
200
|
-
const messageTop = Math.max(TEXT_PADDING, baseMessageTop - MESSAGE_VERTICAL_OFFSET);
|
|
201
|
-
const textDy = messageTop - targetCenterY;
|
|
202
|
-
const textHalfChord = Math.abs(textDy) < circleRadius ? Math.sqrt(circleRadius ** 2 - textDy ** 2) : 0;
|
|
203
|
-
const baseMsgLeft = Math.max(
|
|
204
|
-
TEXT_PADDING,
|
|
205
|
-
targetCenterX - textHalfChord + TEXT_PADDING
|
|
206
|
-
);
|
|
207
|
-
const baseMsgRight = Math.max(
|
|
208
|
-
TEXT_PADDING,
|
|
209
|
-
viewportWidth - (targetCenterX + textHalfChord - TEXT_PADDING)
|
|
210
|
-
);
|
|
211
|
-
const baseMsgWidth = viewportWidth - baseMsgLeft - baseMsgRight;
|
|
212
|
-
const clampedMinMessageWidth = Math.min(
|
|
213
|
-
MIN_MESSAGE_WIDTH,
|
|
214
|
-
viewportWidth - TEXT_PADDING * 2
|
|
215
|
-
);
|
|
216
|
-
const isTargetOnLeft = targetCenterX < viewportWidth / 2;
|
|
217
|
-
const shouldUseSideAnchoredLayout = baseMsgWidth < clampedMinMessageWidth;
|
|
218
|
-
const msgLeft = shouldUseSideAnchoredLayout ? isTargetOnLeft ? TEXT_PADDING : viewportWidth - TEXT_PADDING - clampedMinMessageWidth : baseMsgLeft;
|
|
219
|
-
const msgRight = shouldUseSideAnchoredLayout ? isTargetOnLeft ? viewportWidth - TEXT_PADDING - clampedMinMessageWidth : TEXT_PADDING : baseMsgRight;
|
|
220
|
-
const circleBottomY = targetCenterY + circleRadius - TEXT_PADDING;
|
|
221
|
-
const msgMaxHeight = Math.max(MIN_MESSAGE_HEIGHT, circleBottomY - messageTop);
|
|
222
|
-
return {
|
|
223
|
-
targetCenterX,
|
|
224
|
-
targetCenterY,
|
|
225
|
-
spotlightSize,
|
|
226
|
-
circleDiameter,
|
|
227
|
-
circleRadius,
|
|
228
|
-
messageTop,
|
|
229
|
-
msgLeft,
|
|
230
|
-
msgRight,
|
|
231
|
-
msgMaxHeight,
|
|
232
|
-
isTargetOnLeft,
|
|
233
|
-
highlightX: clampedTargetX,
|
|
234
|
-
highlightY: clampedTargetY
|
|
235
|
-
};
|
|
236
|
-
};
|
|
237
|
-
var useFeatureDiscoveryTheme = (themeColor, overlayColor) => {
|
|
238
|
-
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
239
|
-
const colorScheme = theme.colors[_core.getSafeThemeColor.call(void 0, themeColor)];
|
|
240
|
-
const resolvedOverlayColor = _react.useMemo.call(void 0,
|
|
241
|
-
() => _nullishCoalesce(overlayColor, () => ( _core.withOpacity.call(void 0, theme.colors.foreground, 0.42))),
|
|
242
|
-
[overlayColor, theme.colors.foreground]
|
|
243
|
-
);
|
|
244
|
-
return {
|
|
245
|
-
colorScheme,
|
|
246
|
-
resolvedOverlayColor
|
|
247
|
-
};
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
// src/components/feature-discovery/feature-discovery.tsx
|
|
251
|
-
var DEFAULT_SPOTLIGHT_PADDING = 14;
|
|
252
|
-
var DEFAULT_CIRCLE_SCALE = 1.65;
|
|
253
|
-
var FeatureDiscovery = ({
|
|
254
|
-
isVisible,
|
|
255
|
-
targetRef,
|
|
256
|
-
title,
|
|
257
|
-
description,
|
|
258
|
-
actionText,
|
|
259
|
-
onActionPress,
|
|
260
|
-
onDismiss,
|
|
261
|
-
dismissOnBackdropPress = true,
|
|
262
|
-
themeColor = "primary",
|
|
263
|
-
overlayColor,
|
|
264
|
-
spotlightPadding = DEFAULT_SPOTLIGHT_PADDING,
|
|
265
|
-
circleScale = DEFAULT_CIRCLE_SCALE,
|
|
266
|
-
highlightContent,
|
|
267
|
-
customAppearance
|
|
268
|
-
}) => {
|
|
269
|
-
const {
|
|
270
|
-
backdropOpacity,
|
|
271
|
-
circleAnimScale,
|
|
272
|
-
contentOpacity,
|
|
273
|
-
haloScale,
|
|
274
|
-
startAnimations,
|
|
275
|
-
resetAnimations
|
|
276
|
-
} = useFeatureDiscoveryAnimations();
|
|
277
|
-
const { target, measureTarget, setTargetLayout, viewportWidth, viewportHeight } = useFeatureDiscoveryLayout(targetRef);
|
|
278
|
-
const {
|
|
279
|
-
targetCenterX,
|
|
280
|
-
targetCenterY,
|
|
281
|
-
spotlightSize,
|
|
282
|
-
circleDiameter,
|
|
283
|
-
messageTop,
|
|
284
|
-
msgLeft,
|
|
285
|
-
msgRight,
|
|
286
|
-
msgMaxHeight,
|
|
287
|
-
isTargetOnLeft,
|
|
288
|
-
highlightX,
|
|
289
|
-
highlightY
|
|
290
|
-
} = useFeatureDiscoveryGeometry(
|
|
291
|
-
target,
|
|
292
|
-
viewportWidth,
|
|
293
|
-
viewportHeight,
|
|
294
|
-
spotlightPadding,
|
|
295
|
-
circleScale
|
|
296
|
-
);
|
|
297
|
-
const { colorScheme, resolvedOverlayColor } = useFeatureDiscoveryTheme(
|
|
298
|
-
themeColor,
|
|
299
|
-
overlayColor
|
|
300
|
-
);
|
|
301
|
-
_react.useEffect.call(void 0, () => {
|
|
302
|
-
if (!isVisible) {
|
|
303
|
-
setTargetLayout(null);
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
resetAnimations();
|
|
307
|
-
const timer = setTimeout(() => {
|
|
308
|
-
measureTarget();
|
|
309
|
-
startAnimations();
|
|
310
|
-
}, 0);
|
|
311
|
-
return () => clearTimeout(timer);
|
|
312
|
-
}, [isVisible, measureTarget, resetAnimations, setTargetLayout, startAnimations]);
|
|
313
|
-
if (!isVisible) return null;
|
|
314
|
-
const renderContent = (content, textStyle) => {
|
|
315
|
-
if (typeof content === "string" || typeof content === "number") {
|
|
316
|
-
return /* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: textStyle }, content);
|
|
317
|
-
}
|
|
318
|
-
return content;
|
|
319
|
-
};
|
|
320
|
-
return /* @__PURE__ */ _react2.default.createElement(
|
|
321
|
-
_reactnative.Modal,
|
|
322
|
-
{
|
|
323
|
-
visible: isVisible,
|
|
324
|
-
transparent: true,
|
|
325
|
-
animationType: "none",
|
|
326
|
-
statusBarTranslucent: true,
|
|
327
|
-
onRequestClose: onDismiss
|
|
328
|
-
},
|
|
329
|
-
/* @__PURE__ */ _react2.default.createElement(
|
|
330
|
-
_reactnative.View,
|
|
331
|
-
{
|
|
332
|
-
style: [styles.root, _optionalChain([customAppearance, 'optionalAccess', _4 => _4.root]), _optionalChain([customAppearance, 'optionalAccess', _5 => _5.container])]
|
|
333
|
-
},
|
|
334
|
-
/* @__PURE__ */ _react2.default.createElement(
|
|
335
|
-
_reactnative.Pressable,
|
|
336
|
-
{
|
|
337
|
-
style: styles.absoluteFill,
|
|
338
|
-
onPress: dismissOnBackdropPress ? onDismiss : void 0
|
|
339
|
-
},
|
|
340
|
-
/* @__PURE__ */ _react2.default.createElement(
|
|
341
|
-
_reactnative.Animated.View,
|
|
342
|
-
{
|
|
343
|
-
style: [
|
|
344
|
-
styles.absoluteFill,
|
|
345
|
-
{
|
|
346
|
-
backgroundColor: resolvedOverlayColor,
|
|
347
|
-
opacity: backdropOpacity
|
|
348
|
-
}
|
|
349
|
-
]
|
|
350
|
-
}
|
|
351
|
-
)
|
|
352
|
-
),
|
|
353
|
-
/* @__PURE__ */ _react2.default.createElement(
|
|
354
|
-
_reactnative.Animated.View,
|
|
355
|
-
{
|
|
356
|
-
style: [
|
|
357
|
-
styles.circle,
|
|
358
|
-
{
|
|
359
|
-
width: circleDiameter,
|
|
360
|
-
height: circleDiameter,
|
|
361
|
-
borderRadius: circleDiameter / 2,
|
|
362
|
-
left: targetCenterX - circleDiameter / 2,
|
|
363
|
-
top: targetCenterY - circleDiameter / 2,
|
|
364
|
-
backgroundColor: colorScheme.main,
|
|
365
|
-
opacity: contentOpacity,
|
|
366
|
-
transform: [{ scale: circleAnimScale }]
|
|
367
|
-
}
|
|
368
|
-
]
|
|
369
|
-
}
|
|
370
|
-
),
|
|
371
|
-
/* @__PURE__ */ _react2.default.createElement(
|
|
372
|
-
_reactnative.Animated.View,
|
|
373
|
-
{
|
|
374
|
-
style: [
|
|
375
|
-
styles.spotlightHalo,
|
|
376
|
-
{
|
|
377
|
-
width: spotlightSize,
|
|
378
|
-
height: spotlightSize,
|
|
379
|
-
borderRadius: spotlightSize / 2,
|
|
380
|
-
left: targetCenterX - spotlightSize / 2,
|
|
381
|
-
top: targetCenterY - spotlightSize / 2,
|
|
382
|
-
opacity: contentOpacity,
|
|
383
|
-
transform: [{ scale: haloScale }]
|
|
384
|
-
}
|
|
385
|
-
]
|
|
386
|
-
}
|
|
387
|
-
),
|
|
388
|
-
highlightContent && /* @__PURE__ */ _react2.default.createElement(
|
|
389
|
-
_reactnative.Animated.View,
|
|
390
|
-
{
|
|
391
|
-
style: [
|
|
392
|
-
styles.highlightContainer,
|
|
393
|
-
{
|
|
394
|
-
left: highlightX,
|
|
395
|
-
top: highlightY,
|
|
396
|
-
width: target.width,
|
|
397
|
-
height: target.height,
|
|
398
|
-
opacity: contentOpacity
|
|
399
|
-
},
|
|
400
|
-
_optionalChain([customAppearance, 'optionalAccess', _6 => _6.highlightContainer])
|
|
401
|
-
],
|
|
402
|
-
pointerEvents: "none"
|
|
403
|
-
},
|
|
404
|
-
highlightContent
|
|
405
|
-
),
|
|
406
|
-
/* @__PURE__ */ _react2.default.createElement(
|
|
407
|
-
_reactnative.Animated.View,
|
|
408
|
-
{
|
|
409
|
-
style: [
|
|
410
|
-
styles.messageContainer,
|
|
411
|
-
{
|
|
412
|
-
top: messageTop,
|
|
413
|
-
left: msgLeft,
|
|
414
|
-
right: msgRight,
|
|
415
|
-
maxHeight: msgMaxHeight,
|
|
416
|
-
opacity: contentOpacity
|
|
417
|
-
},
|
|
418
|
-
_optionalChain([customAppearance, 'optionalAccess', _7 => _7.messageContainer])
|
|
419
|
-
],
|
|
420
|
-
pointerEvents: "box-none"
|
|
421
|
-
},
|
|
422
|
-
/* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.messageHeader }, /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.messageTitleWrapper }, renderContent(title, [
|
|
423
|
-
styles.title,
|
|
424
|
-
{ color: colorScheme.onMain },
|
|
425
|
-
{ textAlign: isTargetOnLeft ? "left" : "right" },
|
|
426
|
-
_optionalChain([customAppearance, 'optionalAccess', _8 => _8.title])
|
|
427
|
-
])), /* @__PURE__ */ _react2.default.createElement(
|
|
428
|
-
_reactnative.Pressable,
|
|
429
|
-
{
|
|
430
|
-
onPress: onDismiss,
|
|
431
|
-
style: styles.closeButton,
|
|
432
|
-
accessibilityRole: "button"
|
|
433
|
-
},
|
|
434
|
-
/* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [styles.closeIcon, { color: colorScheme.onMain }] }, "\u2715")
|
|
435
|
-
)),
|
|
436
|
-
description ? renderContent(description, [
|
|
437
|
-
styles.description,
|
|
438
|
-
{ color: _core.withOpacity.call(void 0, colorScheme.onMain, 0.9) },
|
|
439
|
-
{ textAlign: isTargetOnLeft ? "left" : "right" },
|
|
440
|
-
_optionalChain([customAppearance, 'optionalAccess', _9 => _9.description])
|
|
441
|
-
]) : null,
|
|
442
|
-
actionText ? /* @__PURE__ */ _react2.default.createElement(
|
|
443
|
-
_reactnative.Pressable,
|
|
444
|
-
{
|
|
445
|
-
onPress: onActionPress,
|
|
446
|
-
style: [
|
|
447
|
-
styles.actionPressable,
|
|
448
|
-
{ alignSelf: isTargetOnLeft ? "flex-start" : "flex-end" }
|
|
449
|
-
],
|
|
450
|
-
accessibilityRole: "button"
|
|
451
|
-
},
|
|
452
|
-
renderContent(actionText, [
|
|
453
|
-
styles.actionText,
|
|
454
|
-
{ color: colorScheme.onMain },
|
|
455
|
-
_optionalChain([customAppearance, 'optionalAccess', _10 => _10.actionText])
|
|
456
|
-
])
|
|
457
|
-
) : null
|
|
458
|
-
)
|
|
459
|
-
)
|
|
460
|
-
);
|
|
461
|
-
};
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
exports.FeatureDiscovery = FeatureDiscovery;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import React, { RefObject, ReactNode } from 'react';
|
|
2
|
-
import { ViewStyle, TextStyle } from 'react-native';
|
|
3
|
-
import { ThemeColor } from '@xaui/core/types';
|
|
4
|
-
|
|
5
|
-
type MeasurableNode = {
|
|
6
|
-
measureInWindow: (callback: (x: number, y: number, width: number, height: number) => void) => void;
|
|
7
|
-
};
|
|
8
|
-
type FeatureDiscoveryCustomAppearance = {
|
|
9
|
-
root?: ViewStyle;
|
|
10
|
-
container?: ViewStyle;
|
|
11
|
-
title?: TextStyle;
|
|
12
|
-
description?: TextStyle;
|
|
13
|
-
actionText?: TextStyle;
|
|
14
|
-
highlightContainer?: ViewStyle;
|
|
15
|
-
messageContainer?: ViewStyle;
|
|
16
|
-
};
|
|
17
|
-
type FeatureDiscoveryProps = {
|
|
18
|
-
/**
|
|
19
|
-
* Whether the discovery overlay is visible.
|
|
20
|
-
*/
|
|
21
|
-
isVisible: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Ref to the target element to highlight.
|
|
24
|
-
*/
|
|
25
|
-
targetRef: RefObject<MeasurableNode | null>;
|
|
26
|
-
/**
|
|
27
|
-
* Discovery title.
|
|
28
|
-
*/
|
|
29
|
-
title: ReactNode;
|
|
30
|
-
/**
|
|
31
|
-
* Optional discovery description.
|
|
32
|
-
*/
|
|
33
|
-
description?: ReactNode;
|
|
34
|
-
/**
|
|
35
|
-
* Optional action label displayed under the text.
|
|
36
|
-
*/
|
|
37
|
-
actionText?: ReactNode;
|
|
38
|
-
/**
|
|
39
|
-
* Called when action text is pressed.
|
|
40
|
-
*/
|
|
41
|
-
onActionPress?: () => void;
|
|
42
|
-
/**
|
|
43
|
-
* Called when overlay should close.
|
|
44
|
-
*/
|
|
45
|
-
onDismiss?: () => void;
|
|
46
|
-
/**
|
|
47
|
-
* Whether tapping outside dismisses the overlay.
|
|
48
|
-
* @default true
|
|
49
|
-
*/
|
|
50
|
-
dismissOnBackdropPress?: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Accent color for the discovery circle.
|
|
53
|
-
* @default 'primary'
|
|
54
|
-
*/
|
|
55
|
-
themeColor?: ThemeColor;
|
|
56
|
-
/**
|
|
57
|
-
* Backdrop color.
|
|
58
|
-
*/
|
|
59
|
-
overlayColor?: string;
|
|
60
|
-
/**
|
|
61
|
-
* Extra spacing around target highlight.
|
|
62
|
-
* @default 14
|
|
63
|
-
*/
|
|
64
|
-
spotlightPadding?: number;
|
|
65
|
-
/**
|
|
66
|
-
* Scale multiplier for discovery circle diameter.
|
|
67
|
-
* @default 1.65
|
|
68
|
-
*/
|
|
69
|
-
circleScale?: number;
|
|
70
|
-
/**
|
|
71
|
-
* Optional custom content rendered over the highlighted target.
|
|
72
|
-
*/
|
|
73
|
-
highlightContent?: ReactNode;
|
|
74
|
-
/**
|
|
75
|
-
* Optional style overrides.
|
|
76
|
-
*/
|
|
77
|
-
customAppearance?: FeatureDiscoveryCustomAppearance;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
declare const FeatureDiscovery: React.FC<FeatureDiscoveryProps>;
|
|
81
|
-
|
|
82
|
-
export { FeatureDiscovery, type FeatureDiscoveryCustomAppearance, type FeatureDiscoveryProps };
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import React, { RefObject, ReactNode } from 'react';
|
|
2
|
-
import { ViewStyle, TextStyle } from 'react-native';
|
|
3
|
-
import { ThemeColor } from '@xaui/core/types';
|
|
4
|
-
|
|
5
|
-
type MeasurableNode = {
|
|
6
|
-
measureInWindow: (callback: (x: number, y: number, width: number, height: number) => void) => void;
|
|
7
|
-
};
|
|
8
|
-
type FeatureDiscoveryCustomAppearance = {
|
|
9
|
-
root?: ViewStyle;
|
|
10
|
-
container?: ViewStyle;
|
|
11
|
-
title?: TextStyle;
|
|
12
|
-
description?: TextStyle;
|
|
13
|
-
actionText?: TextStyle;
|
|
14
|
-
highlightContainer?: ViewStyle;
|
|
15
|
-
messageContainer?: ViewStyle;
|
|
16
|
-
};
|
|
17
|
-
type FeatureDiscoveryProps = {
|
|
18
|
-
/**
|
|
19
|
-
* Whether the discovery overlay is visible.
|
|
20
|
-
*/
|
|
21
|
-
isVisible: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Ref to the target element to highlight.
|
|
24
|
-
*/
|
|
25
|
-
targetRef: RefObject<MeasurableNode | null>;
|
|
26
|
-
/**
|
|
27
|
-
* Discovery title.
|
|
28
|
-
*/
|
|
29
|
-
title: ReactNode;
|
|
30
|
-
/**
|
|
31
|
-
* Optional discovery description.
|
|
32
|
-
*/
|
|
33
|
-
description?: ReactNode;
|
|
34
|
-
/**
|
|
35
|
-
* Optional action label displayed under the text.
|
|
36
|
-
*/
|
|
37
|
-
actionText?: ReactNode;
|
|
38
|
-
/**
|
|
39
|
-
* Called when action text is pressed.
|
|
40
|
-
*/
|
|
41
|
-
onActionPress?: () => void;
|
|
42
|
-
/**
|
|
43
|
-
* Called when overlay should close.
|
|
44
|
-
*/
|
|
45
|
-
onDismiss?: () => void;
|
|
46
|
-
/**
|
|
47
|
-
* Whether tapping outside dismisses the overlay.
|
|
48
|
-
* @default true
|
|
49
|
-
*/
|
|
50
|
-
dismissOnBackdropPress?: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Accent color for the discovery circle.
|
|
53
|
-
* @default 'primary'
|
|
54
|
-
*/
|
|
55
|
-
themeColor?: ThemeColor;
|
|
56
|
-
/**
|
|
57
|
-
* Backdrop color.
|
|
58
|
-
*/
|
|
59
|
-
overlayColor?: string;
|
|
60
|
-
/**
|
|
61
|
-
* Extra spacing around target highlight.
|
|
62
|
-
* @default 14
|
|
63
|
-
*/
|
|
64
|
-
spotlightPadding?: number;
|
|
65
|
-
/**
|
|
66
|
-
* Scale multiplier for discovery circle diameter.
|
|
67
|
-
* @default 1.65
|
|
68
|
-
*/
|
|
69
|
-
circleScale?: number;
|
|
70
|
-
/**
|
|
71
|
-
* Optional custom content rendered over the highlighted target.
|
|
72
|
-
*/
|
|
73
|
-
highlightContent?: ReactNode;
|
|
74
|
-
/**
|
|
75
|
-
* Optional style overrides.
|
|
76
|
-
*/
|
|
77
|
-
customAppearance?: FeatureDiscoveryCustomAppearance;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
declare const FeatureDiscovery: React.FC<FeatureDiscoveryProps>;
|
|
81
|
-
|
|
82
|
-
export { FeatureDiscovery, type FeatureDiscoveryCustomAppearance, type FeatureDiscoveryProps };
|