351 lines
19 KiB
TypeScript
351 lines
19 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] */
|
|
import ObjectWithoutProperties from '../../../../by-id/module-00029-ObjectWithoutProperties.js'; /* Metro dependency 29 */
|
|
import Module00057 from '../../../../by-id/module-00057.js'; /* Metro dependency 57 */
|
|
import MobileVisualRefreshExperiment from '../../../../modules/themes/experiments/MobileVisualRefreshExperiment.tsx'; /* Metro dependency 1357 */
|
|
import ReanimatedRexport from '../../../../modules/reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
|
|
import UseTooltipPositionNative from '../../Tooltip/native/useTooltipPosition.native.tsx'; /* Metro dependency 8547 */
|
|
import * as FileImportTrackerModule from '../../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ReactNativeModule from '../../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
|
|
import * as ReactModule from '../../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
|
|
import * as PlatformUtilsModule from '../../../../utils/PlatformUtils.tsx'; /* Metro dependency 477 */
|
|
import * as IndexNativeModule from '../../../../intl/index.native.tsx'; /* Metro dependency 1244 */
|
|
import * as NativeModule from '../../../../external/discord_common/js/packages/design/native.tsx'; /* Metro dependency 3868 */
|
|
import * as ReanimatedRexportModule from '../../../../modules/reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
|
|
import * as SetAccessibilityFocusAndroidModule from '../../../../modules/a11y/native/setAccessibilityFocus.android.tsx'; /* Metro dependency 4570 */
|
|
import * as TextModule from '../../Text/native/Text.tsx'; /* Metro dependency 4573 */
|
|
import * as ButtonHooksNativeModule from '../../Button/native/ButtonHooks.native.tsx'; /* Metro dependency 4583 */
|
|
import * as XSmallIconModule from '../../Icon/native/redesign/generated/XSmallIcon.tsx'; /* Metro dependency 5312 */
|
|
|
|
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
|
|
const env0_0 = require;
|
|
const Coachmark2 = Coachmark;
|
|
const env0_3 = ['style'];
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = ReactNativeModule;
|
|
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 = (ReanimatedRexport).createAnimatedComponent(Pressable);
|
|
value = require(4501) /* metro dependency 4501: createStyles */;
|
|
const createStyles = value.createStyles;
|
|
object = {container: {'position': 'absolute', 'alignItems': 'center'}};
|
|
const object2 = {};
|
|
const SHADOW_BUTTON_OVERLAY = (importDefault(697) /* metro dependency 697: native */).shadows.SHADOW_BUTTON_OVERLAY;
|
|
copyDataProperties(object2, SHADOW_BUTTON_OVERLAY, undefined);
|
|
object.shadow = object2;
|
|
const object3 = {};
|
|
const COACHMARK_BODY_WIDTH = (importDefault(697) /* metro dependency 697: native */).modules.mobile.COACHMARK_BODY_WIDTH;
|
|
object3.width = COACHMARK_BODY_WIDTH;
|
|
object3.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg;
|
|
object3.overflow = 'hidden';
|
|
object3.zIndex = 1;
|
|
object.body = object3;
|
|
object.textGap = {gap: 4};
|
|
const PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
|
|
object.textOnlyPadding = {paddingHorizontal: PX_24};
|
|
const object6 = {borderWidth: 1};
|
|
const MOBILE_COACHMARK_BORDER_DEFAULT = (importDefault(697) /* metro dependency 697: native */).colors.MOBILE_COACHMARK_BORDER_DEFAULT;
|
|
object6.borderColor = MOBILE_COACHMARK_BORDER_DEFAULT;
|
|
const MOBILE_COACHMARK_BACKGROUND_DEFAULT = (importDefault(697) /* metro dependency 697: native */).colors.MOBILE_COACHMARK_BACKGROUND_DEFAULT;
|
|
object6.backgroundColor = MOBILE_COACHMARK_BACKGROUND_DEFAULT;
|
|
object6.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg;
|
|
object.bodyBgColor = object6;
|
|
const object7 = {};
|
|
object7.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg;
|
|
object7.overflow = 'hidden';
|
|
object.gradient = object7;
|
|
const PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
|
|
object.bodyContainer = {'padding': null, 'alignItems': 'center', 'justifyContent': 'center', padding: PX_16};
|
|
object.center = {'alignItems': 'center', 'justifyContent': 'center'};
|
|
let COACHMARK_BUTTON_SPACING = (importDefault(697) /* metro dependency 697: native */).modules.mobile.COACHMARK_BUTTON_SPACING;
|
|
object.buttonSpacing = {height: COACHMARK_BUTTON_SPACING};
|
|
object.text = {'maxWidth': 200, 'textAlign': 'center'};
|
|
object.cursorContainer = {'alignItems': 'center', 'zIndex': 0};
|
|
const object10 = {'height': 8, 'width': 8, 'borderRadius': null, 'borderWidth': 2, 'backgroundColor': 'transparent'};
|
|
object10.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.xs;
|
|
let INTERACTIVE_TEXT_ACTIVE = (importDefault(697) /* metro dependency 697: native */).colors.INTERACTIVE_TEXT_ACTIVE;
|
|
object10.borderColor = INTERACTIVE_TEXT_ACTIVE;
|
|
object.cursorHead = object10;
|
|
INTERACTIVE_TEXT_ACTIVE = (importDefault(697) /* metro dependency 697: native */).colors.INTERACTIVE_TEXT_ACTIVE;
|
|
object.cursorSpine = {'width': 2, 'height': 16, backgroundColor: INTERACTIVE_TEXT_ACTIVE};
|
|
object.image = {'height': 40, 'width': 40};
|
|
COACHMARK_BUTTON_SPACING = (importDefault(697) /* metro dependency 697: native */).modules.mobile.COACHMARK_BUTTON_SPACING;
|
|
object.bottomMargin = {marginBottom: COACHMARK_BUTTON_SPACING};
|
|
const object13 = {position: 'absolute'};
|
|
COACHMARK_BUTTON_SPACING = (importDefault(697) /* metro dependency 697: native */).modules.mobile.COACHMARK_BUTTON_SPACING;
|
|
object13.top = COACHMARK_BUTTON_SPACING;
|
|
COACHMARK_BUTTON_SPACING = (importDefault(697) /* metro dependency 697: native */).modules.mobile.COACHMARK_BUTTON_SPACING;
|
|
object13.right = COACHMARK_BUTTON_SPACING;
|
|
object.closeButton = object13;
|
|
const env0_14 = Reflect.apply(createStyles, value, [object]);
|
|
const env0_15 = {'21/9': 90, '16/9': 90, '6/4': 60, '2/1': 40, '1/1': 40};
|
|
(FileImportTrackerModule).fileFinishedImporting('design/components/Coachmark/native/Coachmark.native.tsx');
|
|
exports.Coachmark = Coachmark2;
|
|
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 object6;
|
|
var r37;
|
|
var r31;
|
|
var r23;
|
|
var r27;
|
|
var jsxRuntimeEnv0_12Binding2;
|
|
var items5;
|
|
var Button;
|
|
var object;
|
|
var object5;
|
|
let value = 0;
|
|
let r12 = offsetY === undefined ? value : offsetY;
|
|
const styles = useStyles();
|
|
const styles2 = 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} = (UseTooltipPositionNative)(property,
|
|
surfaceMeasurements, targetMeasurements, position, -8 + r12);
|
|
const value10 = (ReanimatedRexportModule).useSharedValue(value);
|
|
var env0_6 = value10;
|
|
const value11 = env0_6.useCallback(_fun67787, [value10]);
|
|
const value12 = env0_6.useCallback(_fun67788, [value10]);
|
|
const value13 = (ButtonHooksNativeModule).useButtonPressAnimationProps(value10);
|
|
const style = value13.style;
|
|
const value14 = env0_4(value13, styles2);
|
|
const value15 = env0_6.useMemo(_fun67789, [graphic, imgSource, renderImgComponent, styles]);
|
|
const value16 = (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 = (TextModule).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 {
|
|
object = {};
|
|
r37 = buttonVariant ?? 'secondary';
|
|
object.variant = r37;
|
|
r37 = value16 ? 'sm' : 'lg';
|
|
object.size = r37;
|
|
object.text = buttonLabel;
|
|
object.onPress = onButtonPress;
|
|
object.grow = true;
|
|
r31 = object;
|
|
}
|
|
items5[1] = <Button {...r31} />;
|
|
r23 = (
|
|
<>
|
|
{items5}
|
|
</>
|
|
);
|
|
} else {
|
|
r23 = null;
|
|
}
|
|
} else {
|
|
r23 = null;
|
|
}
|
|
const intl = (IndexNativeModule).intl;
|
|
const string = intl.string;
|
|
const cpT0Cq = (IndexNativeModule).t.cpT0Cq;
|
|
const XSmallIcon = (XSmallIconModule).XSmallIcon;
|
|
if (value16) {
|
|
object5 = {size: 'xs'};
|
|
object5.color = (importDefault(697) /* metro dependency 697: native */).colors.ICON_STRONG;
|
|
r27 = object5;
|
|
} 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>
|
|
);
|
|
}
|
|
object6 = {onLayout: onLayout_67791};
|
|
const items8 = [styles.container];
|
|
items8[1] = PlatformUtilsModule.isIOS() ? styles.shadow : undefined;
|
|
items8[2] = {opacity: property != null ? 1 : value, top: tooltipY, left: tooltipX};
|
|
object6.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 {...object6}>
|
|
{items9}
|
|
</View>
|
|
);
|
|
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__;
|
|
(SetAccessibilityFocusAndroidModule).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});
|
|
}
|
|
|
|
}
|
|
|
|
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 object = {};
|
|
if (value2) {
|
|
object.marginTop = -6;
|
|
} else {
|
|
object.marginBottom = -6;
|
|
}
|
|
return (
|
|
<View style={[styles.cursorContainer, object, {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 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>
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun67785, 8552, [29, 57, 31, 27, 33, 4017, 4501, 697, 8547, 4583, 8553, 1357, 4570, 4573, 4578, 1244,
|
|
5312, 8554, 8564, 477, 3868,
|
|
2]) /* metro module 8552, dependencies: [29, 57, 31, 27, 33, 4017, 4501, 697, 8547, 4583, 8553, 1357, 4570, 4573, 4578, 1244, 5312, 8554, 8564, 477, 3868, 2] */;
|