211 lines
15 KiB
TypeScript
211 lines
15 KiB
TypeScript
/* Metro module 12798; source: design/components/ContextMenu/native/ContextMenuItem.native.tsx; dependencies: [31, 27, 33, 4017, 4501, 8813, 697, 1357, 8812, 4577, 4581, 4580, 4573, 2] */
|
|
import MobileVisualRefreshExperiment from '../../../../modules/themes/experiments/MobileVisualRefreshExperiment.tsx'; /* Metro dependency 1357 */
|
|
import ReanimatedRexport from '../../../../modules/reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
|
|
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 JsxRuntimeModule from '../../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
|
|
import * as ReanimatedRexportModule from '../../../../modules/reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
|
|
import * as CreateStylesModule from '../../Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
|
|
import * as TextModule from '../../Text/native/Text.tsx'; /* Metro dependency 4573 */
|
|
import * as SpringModule from '../../../animation/reanimated/spring/spring.tsx'; /* Metro dependency 4577 */
|
|
import * as SpringPresetsModule from '../../../animation/reanimated/spring/springPresets.tsx'; /* Metro dependency 4581 */
|
|
import * as ContextMenuStateNativeModule from './ContextMenuState.native.tsx'; /* Metro dependency 8812 */
|
|
import * as ContextMenuConstantsNativeModule from './ContextMenuConstants.native.tsx'; /* Metro dependency 8813 */
|
|
|
|
function _fun97623(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#97623, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12988:6, offset: 0x0218a63a, size: 277 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const Pressable = (ReactNativeModule).Pressable;
|
|
const env0_6 = (ReanimatedRexport).createAnimatedComponent(Pressable);
|
|
const env0_7 = (CreateStylesModule).createStyles(_fun97624);
|
|
object = {code: 'function ContextMenuItemNativeTsx1(){const{pan}=this.__closure;return pan.get();}'};
|
|
object = {code: 'function ContextMenuItemNativeTsx2(_current,previous){const{measure,ref,index,INDEX_BOUNDS_OFFSET,itemMeasurements,INDEX_BOUNDS_PAGE_X_OFFSET,INDEX_BOUNDS_PAGE_Y_OFFSET,INDEX_BOUNDS_WIDTH_OFFSET,INDEX_BOUNDS_HEIGHT_OFFSET}=this.__closure;if(previous==null||_current===previous)return;const measurements=measure(ref);if(measurements!=null){const{pageX:pageX,pageY:pageY,width:width,height:height}=measurements;const offset=index*INDEX_BOUNDS_OFFSET;itemMeasurements.get()[offset+INDEX_BOUNDS_PAGE_X_OFFSET]=pageX;itemMeasurements.get()[offset+INDEX_BOUNDS_PAGE_Y_OFFSET]=pageY;itemMeasurements.get()[offset+INDEX_BOUNDS_WIDTH_OFFSET]=width;itemMeasurements.get()[offset+INDEX_BOUNDS_HEIGHT_OFFSET]=height;}}'};
|
|
object = {code: "function ContextMenuItemNativeTsx3(){const{activeIndex,index,pressed,withSpring,backgroundColor,SUBTLE_SPRING}=this.__closure;const isActive=activeIndex.get()===index||pressed.get()===1;return{backgroundColor:withSpring(isActive?backgroundColor:'transparent',SUBTLE_SPRING,'animate-always')};}"};
|
|
(FileImportTrackerModule).fileFinishedImporting('design/components/ContextMenu/native/ContextMenuItem.native.tsx');
|
|
exports.ContextMenuItem = ContextMenuItem;
|
|
function _fun97624(a0) { // fn#97624, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12988:214, offset: 0x0218a74f, size: 406 bytes, params: 2, frame: 17
|
|
const object = {};
|
|
const object2 = {'padding': null, 'minHeight': null, 'flexDirection': 'row', 'justifyContent': 'space-between',
|
|
'alignItems': 'center', 'gap': 8};
|
|
const CONTEXT_MENU_ITEM_PADDING = (ContextMenuConstantsNativeModule).CONTEXT_MENU_ITEM_PADDING;
|
|
object2.padding = CONTEXT_MENU_ITEM_PADDING;
|
|
const CONTEXT_MENU_ITEM_BASE_HEIGHT = (ContextMenuConstantsNativeModule).CONTEXT_MENU_ITEM_BASE_HEIGHT;
|
|
object2.minHeight = CONTEXT_MENU_ITEM_BASE_HEIGHT;
|
|
object.container = object2;
|
|
object.containerRefresh = {justifyContent: 'flex-start'};
|
|
const object4 = {};
|
|
object4.borderTopLeftRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg;
|
|
object4.borderTopRightRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg;
|
|
object.roundedTop = object4;
|
|
const object5 = {};
|
|
object5.borderBottomLeftRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg;
|
|
object5.borderBottomRightRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg;
|
|
object.roundedBottom = object5;
|
|
const BORDER_SUBTLE = (importDefault(697) /* metro dependency 697: native */).colors.BORDER_SUBTLE;
|
|
object.border = {borderBottomWidth: 1, borderBottomColor: BORDER_SUBTLE};
|
|
const BACKGROUND_MOD_SUBTLE = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_MOD_SUBTLE;
|
|
object.pressed = {backgroundColor: BACKGROUND_MOD_SUBTLE};
|
|
object.icon = {'width': 20, 'height': 20,
|
|
tintColor: a0 === 'destructive' ? (importDefault(697) /* metro dependency 697: native */).colors.TEXT_FEEDBACK_CRITICAL : (importDefault(697) /* metro dependency 697: native */).colors.TEXT_STRONG};
|
|
object.label = {flexShrink: 1};
|
|
object.trailingIndicator = {marginLeft: 'auto'};
|
|
return object;
|
|
}
|
|
|
|
function ContextMenuItem({label, IconComponent, trailingIndicator, iconSource, start, end, lastInSection, index, state, onPress, variant, accessibilityRole}) { // fn#97625, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12988:2183, offset: 0x0218a8e5, size: 1239 bytes, params: 2, frame: 39
|
|
variant = variant === undefined ? 'default' : variant;
|
|
accessibilityRole = accessibilityRole === undefined ? 'button' : accessibilityRole;
|
|
const value2 = (ReanimatedRexportModule).useAnimatedRef();
|
|
const styles = useStyles(variant);
|
|
const value3 = (MobileVisualRefreshExperiment)('ContextMenuItem');
|
|
const pan = state.pan;
|
|
const itemMeasurements = state.itemMeasurements;
|
|
const itemMeasurements2 = itemMeasurements;
|
|
const activeIndex = state.activeIndex;
|
|
const value4 = (ReanimatedRexportModule).useSharedValue(0);
|
|
const useAnimatedReaction = ReanimatedRexportModule.useAnimatedReaction;
|
|
let closure = function() {
|
|
return pan.get();
|
|
};
|
|
closure.__closure = {pan: pan};
|
|
closure.__workletHash = 11852115418144;
|
|
closure.__initData = env0_8;
|
|
const ContextMenuItemP2 = ContextMenuItemP;
|
|
object = {measure: ReanimatedRexportModule.measure, ref: value2, index: index};
|
|
const INDEX_BOUNDS_OFFSET = (ContextMenuStateNativeModule).INDEX_BOUNDS_OFFSET;
|
|
object.INDEX_BOUNDS_OFFSET = INDEX_BOUNDS_OFFSET;
|
|
object.itemMeasurements = itemMeasurements;
|
|
const INDEX_BOUNDS_PAGE_X_OFFSET = (ContextMenuStateNativeModule).INDEX_BOUNDS_PAGE_X_OFFSET;
|
|
object.INDEX_BOUNDS_PAGE_X_OFFSET = INDEX_BOUNDS_PAGE_X_OFFSET;
|
|
const INDEX_BOUNDS_PAGE_Y_OFFSET = (ContextMenuStateNativeModule).INDEX_BOUNDS_PAGE_Y_OFFSET;
|
|
object.INDEX_BOUNDS_PAGE_Y_OFFSET = INDEX_BOUNDS_PAGE_Y_OFFSET;
|
|
const INDEX_BOUNDS_WIDTH_OFFSET = (ContextMenuStateNativeModule).INDEX_BOUNDS_WIDTH_OFFSET;
|
|
object.INDEX_BOUNDS_WIDTH_OFFSET = INDEX_BOUNDS_WIDTH_OFFSET;
|
|
const INDEX_BOUNDS_HEIGHT_OFFSET = (ContextMenuStateNativeModule).INDEX_BOUNDS_HEIGHT_OFFSET;
|
|
object.INDEX_BOUNDS_HEIGHT_OFFSET = INDEX_BOUNDS_HEIGHT_OFFSET;
|
|
ContextMenuItemP2.__closure = object;
|
|
ContextMenuItemP2.__workletHash = 9571959267234;
|
|
ContextMenuItemP2.__initData = env0_9;
|
|
Reflect.apply(useAnimatedReaction, ReanimatedRexportModule, [closure, ContextMenuItemP2]);
|
|
const backgroundColor = styles.pressed.backgroundColor;
|
|
const backgroundColor2 = backgroundColor;
|
|
const useAnimatedStyle = ReanimatedRexportModule.useAnimatedStyle;
|
|
closure = ContextMenuItemR;
|
|
object = {activeIndex: activeIndex, index: index, pressed: value4};
|
|
object.withSpring = (require(4577) /* metro dependency 4577: spring */).withSpring;
|
|
object.backgroundColor = backgroundColor;
|
|
const SUBTLE_SPRING = (SpringPresetsModule).SUBTLE_SPRING;
|
|
object.SUBTLE_SPRING = SUBTLE_SPRING;
|
|
closure.__closure = object;
|
|
closure.__workletHash = 624481847983;
|
|
closure.__initData = env0_10;
|
|
const value5 = Reflect.apply(useAnimatedStyle, ReanimatedRexportModule, [closure]);
|
|
const r14 = (
|
|
IconComponent != null
|
|
? (
|
|
<IconComponent size="sm" color={styles.icon.tintColor} />
|
|
)
|
|
: (
|
|
iconSource != null
|
|
? ((Component) => <Component source={iconSource} style={styles.icon} />)(importDefault(4580) /* metro dependency 4580: Icon */)
|
|
: null
|
|
)
|
|
);
|
|
const r9 = (
|
|
trailingIndicator != null
|
|
? ((Component) => <Component size="sm" color={styles.icon.tintColor} />)(trailingIndicator)
|
|
: null
|
|
);
|
|
let binding = itemMeasurements2;
|
|
const value10 = binding.useCallback(_fun97629, [index, itemMeasurements]);
|
|
const value11 = binding.useCallback(function() {
|
|
activeIndex.set(index);
|
|
}, [activeIndex, index]);
|
|
const value12 = binding.useCallback(function() {
|
|
activeIndex.set(-1);
|
|
}, [activeIndex]);
|
|
binding = backgroundColor2;
|
|
const items3 = [styles.container];
|
|
items3[1] = value3 && styles.containerRefresh;
|
|
items3[2] = !end && !lastInSection && styles.border;
|
|
items3[3] = start && styles.roundedTop;
|
|
items3[4] = end && styles.roundedBottom;
|
|
items3[5] = value5;
|
|
const items2 = [
|
|
value3 && ((View) => <View>{r14}</View>)((importDefault(4017) /* metro dependency 4017: ReanimatedRexport */).View),
|
|
|
|
];
|
|
const Text = (TextModule).Text;
|
|
items2[1] = (
|
|
<Text
|
|
animated
|
|
variant="text-md/medium"
|
|
style={styles.label}
|
|
color={variant !== 'destructive' ? 'text-strong' : 'text-feedback-critical'}
|
|
>
|
|
{label}
|
|
</Text>
|
|
);
|
|
items2[2] = !value3 && ((View) => <View>{r14}</View>)((importDefault(4017) /* metro dependency 4017: ReanimatedRexport */).View);
|
|
items2[3] = r9 != null && ((View) => <View style={styles.trailingIndicator}>{r9}</View>)((importDefault(4017) /* metro dependency 4017: ReanimatedRexport */).View);
|
|
return ((Component) => <Component ref={value2} style={items3} onLayout={value10} onPressIn={value11} onPressOut={value12} onPress={onPress} accessibilityRole={accessibilityRole}>{items2}</Component>)(binding);
|
|
function ContextMenuItemP(a0, a1) { // fn#97627, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12988:2632, owner: ContextMenuItem.p, offset: 0x0218adbc, size: 276 bytes, params: 3, frame: 20
|
|
var value;
|
|
var value3;
|
|
var pageX;
|
|
var pageY;
|
|
var width;
|
|
var height;
|
|
if (a1 != null) {
|
|
if (a0 !== a1) {
|
|
value = environment.__proto__;
|
|
value3 = (require(4017) /* metro dependency 4017: ReanimatedRexport */).measure(env0_1);
|
|
if (value3 != null) {
|
|
pageX = value3.pageX;
|
|
pageY = value3.pageY;
|
|
width = value3.width;
|
|
height = value3.height;
|
|
value = index * (require(8812) /* metro dependency 8812: ContextMenuStateNative */).INDEX_BOUNDS_OFFSET;
|
|
itemMeasurements.get()[value + (require(8812) /* metro dependency 8812: ContextMenuStateNative */).INDEX_BOUNDS_PAGE_X_OFFSET] = pageX;
|
|
itemMeasurements.get()[value + (require(8812) /* metro dependency 8812: ContextMenuStateNative */).INDEX_BOUNDS_PAGE_Y_OFFSET] = pageY;
|
|
itemMeasurements.get()[value + (require(8812) /* metro dependency 8812: ContextMenuStateNative */).INDEX_BOUNDS_WIDTH_OFFSET] = width;
|
|
itemMeasurements.get()[value + (require(8812) /* metro dependency 8812: ContextMenuStateNative */).INDEX_BOUNDS_HEIGHT_OFFSET] = height;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function ContextMenuItemR() { // fn#97628, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12988:3451, owner: ContextMenuItem.R, offset: 0x0218aed0, size: 135 bytes, params: 1, frame: 18
|
|
const r7 = activeIndex.get() === index || JsxRuntimeModule.jsxs.get() === 1;
|
|
const withSpring = SpringModule.withSpring;
|
|
const backgroundColor2 = r7 ? backgroundColor : 'transparent';
|
|
const SUBTLE_SPRING = (SpringPresetsModule).SUBTLE_SPRING;
|
|
return {backgroundColor: Reflect.apply(withSpring, SpringModule, [backgroundColor2, SUBTLE_SPRING,
|
|
'animate-always'])};
|
|
}
|
|
|
|
function _fun97629({nativeEvent}) { // fn#97629, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12988:3945, offset: 0x0218af57, size: 153 bytes, params: 2, frame: 18
|
|
var indexBinding;
|
|
var value2;
|
|
var value3;
|
|
const {height, width} = nativeEvent.layout;
|
|
if (height !== 0) {
|
|
if (width !== 0) {
|
|
indexBinding = index;
|
|
value2 = environment.__proto__;
|
|
value3 = indexBinding * (require(8812) /* metro dependency 8812: ContextMenuStateNative */).INDEX_BOUNDS_OFFSET;
|
|
itemMeasurements.get()[value3 + (require(8812) /* metro dependency 8812: ContextMenuStateNative */).INDEX_BOUNDS_HEIGHT_OFFSET] = height;
|
|
itemMeasurements.get()[value3 + (require(8812) /* metro dependency 8812: ContextMenuStateNative */).INDEX_BOUNDS_WIDTH_OFFSET] = width;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun97623, 12798, [31, 27, 33, 4017, 4501, 8813, 697, 1357, 8812, 4577, 4581, 4580, 4573,
|
|
2]) /* metro module 12798, dependencies: [31, 27, 33, 4017, 4501, 8813, 697, 1357, 8812, 4577, 4581, 4580, 4573, 2] */;
|