decord/source/design/components/Card/native/Card.native.tsx
2026-07-30 10:14:41 +00:00

288 lines
9.9 KiB
TypeScript

// Module ID: 5222
// Function ID: 5223
// Name: PressableCard
// Dependencies: [109, 19, 17, 21, 4050, 712, 4189, 5223, 1348, 3893, 500, 4599, 4603, 5224, 2]
// Module 5222 (PressableCard)
import _objectWithoutProperties from "_objectWithoutProperties";
import noop from "noop";
import get_ActivityIndicator from "get ActivityIndicator";
import { jsx } from "jsxProd";
import createCacheKey from "createCacheKey";
import createCacheKey from "createCacheKey";
import importDefaultResult from "module_4050";
let Pressable;
let closure_6;
const require = arg1;
class Card {
constructor(arg0) {
flag = global.start;
if (flag === undefined) {
flag = true;
}
flag2 = global.end;
if (flag2 === undefined) {
flag2 = true;
}
str = global.shadow;
if (str === undefined) {
str = "none";
}
str2 = global.border;
if (str2 === undefined) {
str2 = "faint";
}
str3 = global.variant;
if (str3 === undefined) {
str3 = "primary";
}
merged = Object.assign(global, Object.create(null));
tmp2 = require("useIsMobileVisualRefreshExperimentEnabled")("Card");
obj = require("map");
radius = merged.radius;
if (radius == null) {
radius = obj.useToken(require("Themes").modules.mobile.CARD_DEFAULT_RADIUS);
}
tmp3 = f35146(flag, flag2, str3, str, str2, radius);
items = [, , ];
({ spacing: arr[0], card: arr[1] } = tmp3);
items[2] = merged.style;
if ("onPress" in merged) {
if (null != merged.onPress) {
str4 = merged.accessibilityRole;
tmp5 = PressableCard;
tmp6 = PressableCard;
tmp7 = PressableCard(merged, PressableCard);
tmp8 = jsx;
tmp9 = PressableCard;
if (str4 == null) {
str4 = "button";
}
obj = { accessibilityRole: null };
obj[0] = str4;
tmp10 = obj;
tmp11 = tmp7;
merged1 = Object.assign(tmp7);
obj.start = flag;
obj.end = flag2;
obj.style = items;
obj.variant = str3;
obj.isRefreshEnabled = tmp2;
obj.radius = radius;
return tmp8(tmp9, obj);
}
}
obj1 = {};
merged2 = Object.assign(merged);
obj1.style = items;
return jsx(View, obj1);
}
}
function PressableCard(start) {
let children;
let end;
let isRefreshEnabled;
let radius;
let style;
let variant;
let obj = onPressIn(sharedValue[10]);
if (obj.isAndroid()) {
const start2 = start.start;
onPressIn = start2;
const end2 = start.end;
let onPressOut = end2;
const radius2 = start.radius;
sharedValue = radius2;
const isRefreshEnabled2 = start.isRefreshEnabled;
obj = {};
const merged = Object.assign(start, Object.create(null));
let items = [start2, end2, radius2];
const memo = React.useMemo(() => {
if (onPressIn) {
let cornerRadius = sharedValue;
} else {
cornerRadius = 0;
}
return { cornerRadius };
}, items);
obj = { androidRippleConfig: null };
obj[0] = memo;
const merged1 = Object.assign(merged);
obj.children = start.children;
let tmp19 = jsx(tmp(tmp2[13]).AnimatedPressableHighlight, { androidRippleConfig: null });
} else {
onPressIn = start.onPressIn;
onPressOut = start.onPressOut;
({ radius, start, end } = start);
({ children, style, variant, isRefreshEnabled } = start);
const merged2 = Object.assign(start, Object.create(null));
sharedValue = undefined;
let backgroundColor;
let backgroundColorPressed;
let tmpResult = tmp(tmp2[4]);
sharedValue = tmpResult.useSharedValue(0);
const items1 = [sharedValue, onPressIn];
const items2 = [sharedValue, onPressOut];
const callback = React.useCallback((arg0) => {
const result = sharedValue.set(1);
if (onPressIn != null) {
tmp2(arg0);
}
}, items1);
const callback1 = React.useCallback((arg0) => {
const result = sharedValue.set(0);
if (onPressOut != null) {
tmp2(arg0);
}
}, items2);
const tmp11 = callback2(variant, isRefreshEnabled);
backgroundColor = tmp11.backgroundColor;
backgroundColorPressed = tmp11.backgroundColorPressed;
tmpResult = tmp(tmp2[4]);
class B {
constructor() {
obj = { backgroundColor: null };
obj2 = onPressIn(c2[11]);
obj3 = onPressIn(c2[4]);
items = [, ];
items[0] = backgroundColor;
items[1] = backgroundColorPressed;
interpolateColorResult = obj3.interpolateColor(c2.get(), [0, 1], items);
obj[0] = obj2.withSpring(interpolateColorResult, onPressIn(c2[12]).ON_PRESS_SPRING, "animate-always");
return obj;
}
}
let obj2 = { withSpring: null, interpolateColor: null, pressed: null, backgroundColor: null, backgroundColorPressed: null, ON_PRESS_SPRING: null };
obj2[0] = tmp(tmp2[11]).withSpring;
obj2[1] = tmp(tmp2[4]).interpolateColor;
obj2[2] = sharedValue;
obj2[3] = backgroundColor;
obj2[4] = backgroundColorPressed;
obj2[5] = tmp(tmp2[12]).ON_PRESS_SPRING;
B.__closure = obj2;
B.__workletHash = 14943431549291;
B.__initData = closure_12;
let obj3 = {};
const animatedStyle = tmpResult.useAnimatedStyle(B);
const merged3 = Object.assign(merged2);
obj3.onPressIn = callback;
obj3.onPressOut = callback1;
const items3 = [style, animatedStyle];
obj3.style = items3;
obj3.unstable_pressDelay = 130;
obj3.children = children;
tmp19 = <closure_8 />;
}
return tmp19;
}
let closure_3 = ["accessibilityRole"];
({ View: closure_6, Pressable } = get_ActivityIndicator);
let closure_8 = require("module_4050").createAnimatedComponent(Pressable);
let closure_9 = createCacheKey.createStyleProperties((arg0) => {
let flag = arg1;
if (arg1 === undefined) {
flag = false;
}
if ("primary" === arg0) {
let backgroundColor = importDefault(712).colors.TABLEROW_BACKGROUND_DEFAULT;
} else if ("secondary" === arg0) {
backgroundColor = importDefault(712).colors.CARD_SECONDARY_BACKGROUND_DEFAULT;
} else if ("muted" === arg0) {
backgroundColor = importDefault(712).colors.CARD_MUTED_BG;
} else if ("transparent" === arg0) {
backgroundColor = importDefault(712).unsafe_rawColors.TRANSPARENT;
} else if ("control-secondary" === arg0) {
backgroundColor = importDefault(712).colors.CONTROL_SECONDARY_BACKGROUND_DEFAULT;
} else if ("surface-high" === arg0) {
backgroundColor = importDefault(712).colors.BACKGROUND_SURFACE_HIGH;
}
if (flag === undefined) {
flag = false;
}
if ("primary" === arg0) {
let backgroundColorPressed = importDefault(712).colors.TABLEROW_BACKGROUND_PRESSED;
} else if ("secondary" === arg0) {
backgroundColorPressed = importDefault(712).colors.CARD_SECONDARY_BACKGROUND_ACTIVE;
} else if ("muted" === arg0) {
backgroundColorPressed = importDefault(712).colors.CARD_MUTED_PRESSED_BG;
} else if ("transparent" === arg0) {
const tmp15 = importDefault(712);
if (flag) {
let TRANSPARENT = tmp15.colors.BACKGROUND_MOD_SUBTLE;
} else {
TRANSPARENT = tmp15.unsafe_rawColors.TRANSPARENT;
}
backgroundColorPressed = TRANSPARENT;
} else if ("control-secondary" === arg0) {
backgroundColorPressed = importDefault(712).colors.CONTROL_SECONDARY_BACKGROUND_ACTIVE;
} else if ("surface-high" === arg0) {
backgroundColorPressed = importDefault(712).colors.BACKGROUND_BASE_LOW;
}
return { backgroundColor, backgroundColorPressed };
});
let closure_10 = createCacheKey.createStyles((arg0, arg1, arg2, arg3, arg4, arg5) => {
if ("primary" === arg2) {
let BACKGROUND_SURFACE_HIGH = importDefault(712).colors.TABLEROW_BACKGROUND_DEFAULT;
} else if ("secondary" === arg2) {
BACKGROUND_SURFACE_HIGH = importDefault(712).colors.CARD_SECONDARY_BACKGROUND_DEFAULT;
} else if ("muted" === arg2) {
BACKGROUND_SURFACE_HIGH = importDefault(712).colors.CARD_MUTED_BG;
} else if ("transparent" === arg2) {
BACKGROUND_SURFACE_HIGH = importDefault(712).unsafe_rawColors.TRANSPARENT;
} else if ("control-secondary" === arg2) {
BACKGROUND_SURFACE_HIGH = importDefault(712).colors.CONTROL_SECONDARY_BACKGROUND_DEFAULT;
} else if ("surface-high" === arg2) {
BACKGROUND_SURFACE_HIGH = importDefault(712).colors.BACKGROUND_SURFACE_HIGH;
}
let BORDER_SUBTLE = null;
if ("none" !== arg4) {
if ("subtle" === arg4) {
BORDER_SUBTLE = importDefault(712).colors.BORDER_SUBTLE;
} else if ("strong" === arg4) {
BORDER_SUBTLE = importDefault(712).colors.BORDER_STRONG;
} else if ("faint" === arg4) {
BORDER_SUBTLE = importDefault(712).colors.BORDER_MUTED;
} else if ("control-secondary" === arg4) {
BORDER_SUBTLE = importDefault(712).colors.CONTROL_SECONDARY_BORDER_DEFAULT;
}
}
if (BORDER_SUBTLE == null) {
BORDER_SUBTLE = BACKGROUND_SURFACE_HIGH;
}
const card = {};
const merged = Object.assign(require(5223) /* createCardShadowToken */.createCardShadowToken(arg3));
let tmp21;
if (arg0) {
tmp21 = arg5;
}
card.borderTopStartRadius = tmp21;
let tmp22;
if (arg0) {
tmp22 = arg5;
}
card.borderTopEndRadius = tmp22;
let tmp23;
if (arg1) {
tmp23 = arg5;
}
card.borderBottomStartRadius = tmp23;
let tmp24;
if (arg1) {
tmp24 = arg5;
}
card.borderBottomEndRadius = tmp24;
card.borderColor = BORDER_SUBTLE;
let num = 0;
if ("none" !== arg4) {
num = 1;
}
card.borderWidth = num;
card.backgroundColor = BACKGROUND_SURFACE_HIGH;
return { card, spacing: { padding: 16 } };
});
let closure_12 = { code: "function CardNativeTsx1(){const{withSpring,interpolateColor,pressed,backgroundColor,backgroundColorPressed,ON_PRESS_SPRING}=this.__closure;const pressedColor=withSpring(interpolateColor(pressed.get(),[0,1],[backgroundColor,backgroundColorPressed]),ON_PRESS_SPRING,'animate-always');return{backgroundColor:pressedColor};}" };
let result = require("get ActivityIndicator").fileFinishedImporting("design/components/Card/native/Card.native.tsx");
export { Card };
export const InternalCard = Card;