266 lines
15 KiB
TypeScript
266 lines
15 KiB
TypeScript
/* Metro module 8552; source: design/components/Coachmark/native/Coachmark.native.tsx; dependencies: [29, 57, 31, 27, 33, 4017, 4501, 697, 8547, 4583, 8553, 1357, 4570, 4573, 4578, 1244, 5312, 8554, 8564, 477, 3868, 2] */
|
|
function _fun67785(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#67785, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8737:6, offset: 0x01c30800, size: 1024 bytes, params: 8, frame: 27
|
|
var object4;
|
|
const env0_0 = require;
|
|
const closure = Coachmark;
|
|
const env0_3 = ['style'];
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_4 = importDefault(29) /* metro dependency 29 */;
|
|
const env0_5 = importDefault(57) /* metro dependency 57 */;
|
|
const env0_6 = importAll(31) /* metro dependency 31 */;
|
|
let value = require(27) /* metro dependency 27 */;
|
|
const env0_7 = value.View;
|
|
const Pressable = value.Pressable;
|
|
const env0_9 = value.Image;
|
|
value = require(33) /* metro dependency 33 */;
|
|
const env0_10 = value.jsx;
|
|
const env0_11 = value.jsxs;
|
|
const env0_12 = value.Fragment;
|
|
const env0_13 = (importDefault(4017) /* metro dependency 4017: ReanimatedRexport */).createAnimatedComponent(Pressable);
|
|
value = require(4501) /* metro dependency 4501: createStyles */;
|
|
const createStyles = value.createStyles;
|
|
object4 = {container: {'position': 'absolute', 'alignItems': 'center'}};
|
|
const object5 = {};
|
|
const SHADOW_BUTTON_OVERLAY = (importDefault(697) /* metro dependency 697: native */).shadows.SHADOW_BUTTON_OVERLAY;
|
|
copyDataProperties(object5, SHADOW_BUTTON_OVERLAY, undefined);
|
|
object4.shadow = object5;
|
|
const object8 = {};
|
|
const COACHMARK_BODY_WIDTH = (importDefault(697) /* metro dependency 697: native */).modules.mobile.COACHMARK_BODY_WIDTH;
|
|
object8.width = COACHMARK_BODY_WIDTH;
|
|
object8.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg;
|
|
object8.overflow = 'hidden';
|
|
object8.zIndex = 1;
|
|
object4.body = object8;
|
|
object4.textGap = {gap: 4};
|
|
const PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
|
|
object4.textOnlyPadding = {paddingHorizontal: PX_24};
|
|
const object9 = {borderWidth: 1};
|
|
const MOBILE_COACHMARK_BORDER_DEFAULT = (importDefault(697) /* metro dependency 697: native */).colors.MOBILE_COACHMARK_BORDER_DEFAULT;
|
|
object9.borderColor = MOBILE_COACHMARK_BORDER_DEFAULT;
|
|
const MOBILE_COACHMARK_BACKGROUND_DEFAULT = (importDefault(697) /* metro dependency 697: native */).colors.MOBILE_COACHMARK_BACKGROUND_DEFAULT;
|
|
object9.backgroundColor = MOBILE_COACHMARK_BACKGROUND_DEFAULT;
|
|
object9.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg;
|
|
object4.bodyBgColor = object9;
|
|
const object11 = {};
|
|
object11.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg;
|
|
object11.overflow = 'hidden';
|
|
object4.gradient = object11;
|
|
const PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
|
|
object4.bodyContainer = {'padding': null, 'alignItems': 'center', 'justifyContent': 'center', padding: PX_16};
|
|
object4.center = {'alignItems': 'center', 'justifyContent': 'center'};
|
|
let COACHMARK_BUTTON_SPACING = (importDefault(697) /* metro dependency 697: native */).modules.mobile.COACHMARK_BUTTON_SPACING;
|
|
object4.buttonSpacing = {height: COACHMARK_BUTTON_SPACING};
|
|
object4.text = {'maxWidth': 200, 'textAlign': 'center'};
|
|
object4.cursorContainer = {'alignItems': 'center', 'zIndex': 0};
|
|
const object12 = {'height': 8, 'width': 8, 'borderRadius': null, 'borderWidth': 2, 'backgroundColor': 'transparent'};
|
|
object12.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.xs;
|
|
let INTERACTIVE_TEXT_ACTIVE = (importDefault(697) /* metro dependency 697: native */).colors.INTERACTIVE_TEXT_ACTIVE;
|
|
object12.borderColor = INTERACTIVE_TEXT_ACTIVE;
|
|
object4.cursorHead = object12;
|
|
INTERACTIVE_TEXT_ACTIVE = (importDefault(697) /* metro dependency 697: native */).colors.INTERACTIVE_TEXT_ACTIVE;
|
|
object4.cursorSpine = {'width': 2, 'height': 16, backgroundColor: INTERACTIVE_TEXT_ACTIVE};
|
|
object4.image = {'height': 40, 'width': 40};
|
|
COACHMARK_BUTTON_SPACING = (importDefault(697) /* metro dependency 697: native */).modules.mobile.COACHMARK_BUTTON_SPACING;
|
|
object4.bottomMargin = {marginBottom: COACHMARK_BUTTON_SPACING};
|
|
const object14 = {position: 'absolute'};
|
|
COACHMARK_BUTTON_SPACING = (importDefault(697) /* metro dependency 697: native */).modules.mobile.COACHMARK_BUTTON_SPACING;
|
|
object14.top = COACHMARK_BUTTON_SPACING;
|
|
COACHMARK_BUTTON_SPACING = (importDefault(697) /* metro dependency 697: native */).modules.mobile.COACHMARK_BUTTON_SPACING;
|
|
object14.right = COACHMARK_BUTTON_SPACING;
|
|
object4.closeButton = object14;
|
|
const env0_14 = Reflect.apply(createStyles, value, [object4]);
|
|
const env0_15 = {'21/9': 90, '16/9': 90, '6/4': 60, '2/1': 40, '1/1': 40};
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('design/components/Coachmark/native/Coachmark.native.tsx');
|
|
exports.Coachmark = closure;
|
|
exports.CoachmarkContainer = CoachmarkContainer;
|
|
}
|
|
|
|
function Coachmark({targetMeasurements, surfaceMeasurements, title, description, offsetY, graphic, imgSource, position, onDismiss, buttonLabel, buttonVariant, onButtonPress, gradientColor, experimental_withBlurBackground, renderImgComponent, enterExitAnimatedStyles}) { // fn#67786, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8737:1653, offset: 0x01c30c00, size: 1796 bytes, params: 2, frame: 56
|
|
var object4;
|
|
var r37;
|
|
var r31;
|
|
var r23;
|
|
var r27;
|
|
var jsxRuntimeEnv0_12Binding2;
|
|
var items5;
|
|
var Button;
|
|
var object2;
|
|
var object3;
|
|
let value = 0;
|
|
let r12 = offsetY === undefined ? value : offsetY;
|
|
const styles = useStyles();
|
|
const env0_3 = styles;
|
|
let binding = env0_6;
|
|
const value5 = binding.useRef(null);
|
|
const env0_4 = value5;
|
|
const value7 = env0_5(env0_6.useState(null), 2);
|
|
const property = value7[value];
|
|
var env0_5 = value7[1];
|
|
const {adjustmentX, tooltipX,
|
|
tooltipY} = (importDefault(8547) /* metro dependency 8547: useTooltipPositionNative */)(property,
|
|
surfaceMeasurements, targetMeasurements, position, -8 + r12);
|
|
const value10 = (require(4017) /* metro dependency 4017: ReanimatedRexport */).useSharedValue(value);
|
|
var env0_6 = value10;
|
|
const value11 = env0_6.useCallback(_fun67787, [value10]);
|
|
const value12 = env0_6.useCallback(_fun67788, [value10]);
|
|
const value13 = (require(4583) /* metro dependency 4583: ButtonHooksNative */).useButtonPressAnimationProps(value10);
|
|
const style = value13.style;
|
|
const value14 = env0_4(value13, env0_3);
|
|
const value15 = env0_6.useMemo(_fun67789, [graphic, imgSource, renderImgComponent, styles]);
|
|
const value16 = (importDefault(1357) /* metro dependency 1357: MobileVisualRefreshExperiment */)('Coachmark');
|
|
const jsxRuntimeEnv0_12Binding = jsxRuntimeEnv0_12;
|
|
const viewBindingProps = {ref: value5, accessibilityRole: 'alert', style: styles.center, accessible: true,
|
|
onLayout: onLayout_67790};
|
|
const textGap = value16 ? styles.textGap : undefined;
|
|
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
|
|
const view = <View {...viewBindingProps}>{value15}<View style={textGap}><Text style={[styles.text,
|
|
graphic == null ? styles.textOnlyPadding : undefined]} variant={value16 ? 'text-md/semibold' : 'heading-md/bold'} color="mobile-text-heading-primary">{title}</Text><Text style={styles.text} variant="text-sm/medium" color={value16 ? 'text-subtle' : 'text-default'}>{description}</Text></View></View>;
|
|
if (buttonLabel != null) {
|
|
if (onButtonPress != null) {
|
|
jsxRuntimeEnv0_12Binding2 = jsxRuntimeEnv0_12;
|
|
items5 = [<View style={styles.buttonSpacing} />];
|
|
Button = (require(4578) /* metro dependency 4578: ButtonNative */).Button;
|
|
if (experimental_withBlurBackground) {
|
|
r31 = {'variant': 'secondary-overlay', 'size': 'lg', 'text': null, 'onPress': null, 'grow': true,
|
|
text: buttonLabel,
|
|
onPress: onButtonPress};
|
|
} else {
|
|
object2 = {};
|
|
r37 = buttonVariant ?? 'secondary';
|
|
object2.variant = r37;
|
|
r37 = value16 ? 'sm' : 'lg';
|
|
object2.size = r37;
|
|
object2.text = buttonLabel;
|
|
object2.onPress = onButtonPress;
|
|
object2.grow = true;
|
|
r31 = object2;
|
|
}
|
|
items5[1] = <Button {...r31} />;
|
|
r23 = <>{items5}</>;
|
|
} else {
|
|
r23 = null;
|
|
}
|
|
} else {
|
|
r23 = null;
|
|
}
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
const string = intl.string;
|
|
const cpT0Cq = (require(1244) /* metro dependency 1244: indexNative */).t.cpT0Cq;
|
|
const XSmallIcon = (require(5312) /* metro dependency 5312: XSmallIcon */).XSmallIcon;
|
|
if (value16) {
|
|
object3 = {size: 'xs'};
|
|
object3.color = (importDefault(697) /* metro dependency 697: native */).colors.ICON_STRONG;
|
|
r27 = object3;
|
|
} else {
|
|
r27 = {};
|
|
}
|
|
const fragment = <>{view}{r23}<Pressable accessibilityRole="button" accessibilityLabel={Reflect.apply(string, intl,
|
|
[cpT0Cq])} style={styles.closeButton} onPress={onDismiss} onPressIn={value11} onPressOut={value12}><XSmallIcon {...r27} /></Pressable></>;
|
|
if (experimental_withBlurBackground) {
|
|
const BackgroundBlurView = (require(8554) /* metro dependency 8554: native */).BackgroundBlurView;
|
|
r12 = <BackgroundBlurView style={styles.bodyContainer} blurTheme="dark" pressed={value10}>{fragment}</BackgroundBlurView>;
|
|
} else {
|
|
r12 = <View style={[styles.bodyContainer,
|
|
styles.bodyBgColor]}>{value16 && gradientColor != null ? ((ExpressiveGradient) => <ExpressiveGradient style={styles.gradient} color={gradientColor} backgroundColor={(importDefault(697) /* metro dependency 697: native */).colors.MOBILE_COACHMARK_BACKGROUND_DEFAULT} />)((require(8564) /* metro dependency 8564: ExpressiveGradientNative */).ExpressiveGradient) : null}{fragment}</View>;
|
|
}
|
|
object4 = {onLayout: onLayout_67791};
|
|
const items8 = [styles.container];
|
|
const platformUtilsModule = require(477) /* metro dependency 477: PlatformUtils */;
|
|
items8[1] = platformUtilsModule.isIOS() ? styles.shadow : undefined;
|
|
items8[2] = {opacity: property != null ? 1 : value, top: tooltipY, left: tooltipX};
|
|
object4.style = items8;
|
|
const items9 = [position === 'bottom' && <Cursor position="bottom" adjustmentX={adjustmentX} />];
|
|
binding = env0_13;
|
|
const bindingProps = {...value14};
|
|
bindingProps['onAccessibilityEscape'] = onDismiss;
|
|
bindingProps['accessible'] = false;
|
|
bindingProps['onPress'] = onDismiss;
|
|
const items10 = [styles.body];
|
|
value = platformUtilsModule;
|
|
value = arraySpread(items10, value.isAndroid() ? [styles.shadow, enterExitAnimatedStyles] : [], 1, position);
|
|
items10[value] = style;
|
|
value + 1;
|
|
bindingProps['style'] = items10;
|
|
items9[1] = ((Component) => <Component {...bindingProps}>{r12}</Component>)(binding);
|
|
items9[2] = position === 'top' && <Cursor position="top" adjustmentX={adjustmentX} />;
|
|
return (
|
|
<View {...object4}>
|
|
{items9}
|
|
</View>
|
|
);
|
|
}
|
|
|
|
function Cursor({position, adjustmentX}) { // fn#67792, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8737:4304, offset: 0x01c314bd, size: 200 bytes, params: 2, frame: 20
|
|
const styles = useStyles();
|
|
const value2 = position === 'top';
|
|
const r9 = value2 ? 'column-reverse' : 'column';
|
|
const object2 = {};
|
|
if (value2) {
|
|
object2.marginTop = -6;
|
|
} else {
|
|
object2.marginBottom = -6;
|
|
}
|
|
return (
|
|
<View style={[styles.cursorContainer, object2, {flexDirection: r9, left: -adjustmentX}]}>
|
|
<View style={styles.cursorHead} />
|
|
<View style={styles.cursorSpine} />
|
|
</View>
|
|
);
|
|
}
|
|
|
|
function CoachmarkContainer(a0) { // fn#67793, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8737:4694, offset: 0x01c31585, size: 132 bytes, params: 2, frame: 17
|
|
const nativeModule = require(3868) /* metro dependency 3868: native */;
|
|
const useThemeContext = nativeModule.useThemeContext;
|
|
const r5 = a0.experimental_withBlurBackground ? 'dark' : Reflect.apply(useThemeContext, nativeModule, []).theme;
|
|
const ThemeContextProvider = nativeModule.ThemeContextProvider;
|
|
return (
|
|
<ThemeContextProvider theme={r5}>
|
|
<Coachmark {...a0} />
|
|
</ThemeContextProvider>
|
|
);
|
|
}
|
|
|
|
function _fun67787() { // fn#67787, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8737:2171, offset: 0x01c31304, size: 24 bytes, params: 1, frame: 11
|
|
env0_6.set(1);
|
|
}
|
|
|
|
function _fun67788() { // fn#67788, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8737:2209, offset: 0x01c3131c, size: 23 bytes, params: 1, frame: 11
|
|
env0_6.set(0);
|
|
}
|
|
|
|
function _fun67789() { // fn#67789, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8737:2306, offset: 0x01c31333, size: 278 bytes, params: 1, frame: 21
|
|
var value7;
|
|
var Graphic;
|
|
var binding;
|
|
var aspectRatio;
|
|
const graphicBinding = graphic;
|
|
const value2 = null;
|
|
if (value2 != graphicBinding) {
|
|
value7 = environment.__proto__;
|
|
var viewBindingProps = {style: styles.bottomMargin};
|
|
Graphic = (require(8553) /* metro dependency 8553: GraphicNative */).Graphic;
|
|
binding = env1_15;
|
|
aspectRatio = graphic.aspectRatio;
|
|
return (
|
|
<View {...viewBindingProps}>
|
|
<Graphic {...graphic} {...{['style']: {maxHeight: binding[value2 != aspectRatio ? aspectRatio : '1/1']}}} />
|
|
</View>
|
|
);
|
|
}
|
|
let r1 = value2 != renderImgComponent ? renderImgComponent() : value2;
|
|
r1 = value2 != imgSource ? <Image source={imgSource} style={styles.image} /> : r1;
|
|
return value2 == r1 ? value2 : <View style={styles.bottomMargin}>{r1}</View>;
|
|
}
|
|
|
|
function CoachmarkOnLayout() { // fn#67790, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8737:2713, owner: Coachmark.onLayout, offset: 0x01c31449, size: 59 bytes, params: 1, frame: 13
|
|
const value = environment.__proto__;
|
|
(require(4570) /* metro dependency 4570: setAccessibilityFocusAndroid */).setAccessibilityFocus({ref: env0_4,
|
|
delay: 100});
|
|
}
|
|
|
|
function CoachmarkOnLayout_67791({nativeEvent}) { // fn#67791, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8737:3882, owner: Coachmark.onLayout, offset: 0x01c31484, size: 57 bytes, params: 2, frame: 12
|
|
env0_5({width: nativeEvent.layout.width, height: nativeEvent.layout.height});
|
|
}
|
|
|