232 lines
12 KiB
JavaScript
232 lines
12 KiB
JavaScript
// Metro module 9730 (f9731).
|
|
import { useMemo } from "react";
|
|
import { Dimensions } from "react-native";
|
|
import * as _Module1606 from "./Module1606";
|
|
function $mk83164($env) {
|
|
return function l(a0) {
|
|
let rotateZ, scale, translateX;
|
|
const r4 = $env[0];
|
|
const { showLength, snapDirection: snapDirection2 = "left", moveSize = $env.$parent[3].width, stackInterval = 18, scaleInterval = 0.04, opacityInterval: opacityInterval2 = 0.1, rotateZDeg = 30 } = r4;
|
|
const r10 = $env.$parent;
|
|
const r37 = (0, r10[6])({
|
|
showLength,
|
|
value: a0,
|
|
snapDirection: snapDirection2
|
|
});
|
|
const { validLength, value, inputRange } = r37;
|
|
const r41 = (0, r10[7])({
|
|
validLength,
|
|
value,
|
|
opacityInterval: opacityInterval2,
|
|
snapDirection: snapDirection2
|
|
});
|
|
const { zIndex, opacity } = r41;
|
|
if (snapDirection2 === "left") {
|
|
const r85 = r10[0];
|
|
const r86 = r10[1];
|
|
translateX = r85(r86[2]).interpolate(value, inputRange, [-moveSize, 0, validLength * stackInterval], r85(r86[2]).Extrapolation.CLAMP);
|
|
scale = r85(r86[2]).interpolate(value, inputRange, [1, 1, 1 - validLength * scaleInterval], r85(r86[2]).Extrapolation.CLAMP);
|
|
rotateZ = `${r85(r86[2]).interpolate(value, inputRange, [-rotateZDeg, 0, 0], r85(r86[2]).Extrapolation.CLAMP)}deg`;
|
|
} else {
|
|
rotateZ = void 0;
|
|
scale = void 0;
|
|
translateX = void 0;
|
|
if (snapDirection2 === "right") {
|
|
const r22 = r10[0];
|
|
const r18 = r10[1];
|
|
translateX = r22(r18[2]).interpolate(value, inputRange, [-validLength * stackInterval, 0, moveSize], r22(r18[2]).Extrapolation.CLAMP);
|
|
scale = r22(r18[2]).interpolate(value, inputRange, [1 - validLength * scaleInterval, 1, 1], r22(r18[2]).Extrapolation.CLAMP);
|
|
rotateZ = `${r22(r18[2]).interpolate(value, inputRange, [0, 0, rotateZDeg], r22(r18[2]).Extrapolation.CLAMP)}deg`;
|
|
}
|
|
}
|
|
return {
|
|
transform: [{
|
|
translateX
|
|
}, {
|
|
scale
|
|
}, {
|
|
rotateZ
|
|
}],
|
|
zIndex,
|
|
opacity
|
|
};
|
|
};
|
|
}
|
|
let getCommonVariables, getCommonStyles;
|
|
let env6442 = {};
|
|
const c6442_3 = Dimensions.get("window");
|
|
const c6442_4 = {
|
|
code: "function pnpm_stackTs1(_value){const{screen,modeConfig,getCommonVariables,getCommonStyles,interpolate,Extrapolation}=this.__closure;const{showLength:showLength,snapDirection=\"left\",moveSize=screen.width,stackInterval=18,scaleInterval=0.04,opacityInterval=0.1,rotateZDeg=30}=modeConfig;const{validLength:validLength,value:value,inputRange:inputRange}=getCommonVariables({showLength:showLength,value:_value,snapDirection:snapDirection});const{zIndex:zIndex,opacity:opacity}=getCommonStyles({validLength:validLength,value:value,opacityInterval:opacityInterval,snapDirection:snapDirection});let translateX;let scale;let rotateZ;if(snapDirection===\"left\"){translateX=interpolate(value,inputRange,[-moveSize,0,validLength*stackInterval],Extrapolation.CLAMP);scale=interpolate(value,inputRange,[1,1,1-validLength*scaleInterval],Extrapolation.CLAMP);rotateZ=interpolate(value,inputRange,[-rotateZDeg,0,0],Extrapolation.CLAMP)+\"deg\";}else if(snapDirection===\"right\"){translateX=interpolate(value,inputRange,[-validLength*stackInterval,0,moveSize],Extrapolation.CLAMP);scale=interpolate(value,inputRange,[1-validLength*scaleInterval,1,1],Extrapolation.CLAMP);rotateZ=interpolate(value,inputRange,[0,0,rotateZDeg],Extrapolation.CLAMP)+\"deg\";}const transform=[{translateX:translateX},{scale:scale},{rotateZ:rotateZ}];const styles={transform:transform,zIndex:zIndex,opacity:opacity};return styles;}"
|
|
};
|
|
const c6442_5 = {
|
|
code: "function pnpm_stackTs2(_value){const{screen,modeConfig,getCommonVariables,getCommonStyles,interpolate,Extrapolation}=this.__closure;const{showLength:showLength,snapDirection=\"left\",moveSize=screen.width,stackInterval=18,scaleInterval=0.04,opacityInterval=0.1,rotateZDeg=30}=modeConfig;const{validLength:validLength,value:value,inputRange:inputRange}=getCommonVariables({showLength:showLength,value:_value,snapDirection:snapDirection});const{zIndex:zIndex,opacity:opacity}=getCommonStyles({validLength:validLength,value:value,opacityInterval:opacityInterval,snapDirection:snapDirection});let translateX;let scale;let rotateZ;let translateY;if(snapDirection===\"left\"){translateX=interpolate(value,inputRange,[-moveSize,0,0],Extrapolation.CLAMP);scale=interpolate(value,inputRange,[1,1,1-validLength*scaleInterval],Extrapolation.CLAMP);rotateZ=interpolate(value,inputRange,[-rotateZDeg,0,0],Extrapolation.CLAMP)+\"deg\";translateY=interpolate(value,inputRange,[0,0,validLength*stackInterval],Extrapolation.CLAMP);}else if(snapDirection===\"right\"){translateX=interpolate(value,inputRange,[0,0,moveSize],Extrapolation.CLAMP);scale=interpolate(value,inputRange,[1-validLength*scaleInterval,1,1],Extrapolation.CLAMP);rotateZ=interpolate(value,inputRange,[0,0,rotateZDeg],Extrapolation.CLAMP)+\"deg\";translateY=interpolate(value,inputRange,[validLength*stackInterval,0,0],Extrapolation.CLAMP);}const transform=[{translateX:translateX},{scale:scale},{rotateZ:rotateZ},{translateY:translateY}];const styles={transform:transform,zIndex:zIndex,opacity:opacity};return styles;}"
|
|
};
|
|
const getCommonVariables2 = function getCommonVariables({ showLength, value, snapDirection }) {
|
|
let inputRange;
|
|
const r19 = Math.floor(Math.abs(value));
|
|
const r2 = Math.abs(value) % 1;
|
|
const value2 = value < 0 ? -(r19 + (r2 < 0.5 ? 4 * r2 * r2 * r2 : 1 - (-2 * r2 + 2) ** 3 / 2)) : r19 + (r2 < 0.5 ? 4 * r2 * r2 * r2 : 1 - (-2 * r2 + 2) ** 3 / 2);
|
|
const validLength = showLength - 1;
|
|
if (snapDirection === "left") {
|
|
inputRange = [-1, 0, validLength];
|
|
} else {
|
|
if (snapDirection !== "right") {
|
|
throw new Error("snapDirection must be set to either left or right");
|
|
}
|
|
inputRange = [-validLength, 0, 1];
|
|
}
|
|
return {
|
|
inputRange,
|
|
validLength,
|
|
value: value2
|
|
};
|
|
};
|
|
getCommonVariables2.__closure = {};
|
|
getCommonVariables2.__workletHash = 9545327827217;
|
|
getCommonVariables2.__initData = {
|
|
code: "function getCommonVariables_Pnpm_stackTs3(opts){const{showLength:showLength,value:_value,snapDirection:snapDirection}=opts;function easeInOutCubic(v){return v<0.5?4*v*v*v:1-(-2*v+2)**3/2;}const page=Math.floor(Math.abs(_value));const diff=Math.abs(_value)%1;const value=_value<0?-(page+easeInOutCubic(diff)):page+easeInOutCubic(diff);const validLength=showLength-1;let inputRange;if(snapDirection===\"left\")inputRange=[-1,0,validLength];else if(snapDirection===\"right\")inputRange=[-validLength,0,1];else throw new Error(\"snapDirection must be set to either left or right\");return{inputRange:inputRange,validLength:validLength,value:value};}"
|
|
};
|
|
getCommonVariables = getCommonVariables2;
|
|
const getCommonStyles2 = function getCommonStyles({ snapDirection, validLength, value, opacityInterval }) {
|
|
let r39, opacity;
|
|
if (snapDirection === "left") {
|
|
r39 = Math.floor(10000 * _Module1606.interpolate(value, [-1.5, -1, -1 + Number.MIN_VALUE, 0, validLength], [Number.MIN_VALUE, validLength, validLength, validLength - 1, -1])) / 100;
|
|
opacity = _Module1606.interpolate(value, [-1, 0, validLength - 1, validLength], [0.25, 1, 1 - (validLength - 1) * opacityInterval, 0.25]);
|
|
} else {
|
|
if (snapDirection !== "right") {
|
|
throw new Error("snapDirection must be set to either left or right");
|
|
}
|
|
r39 = Math.floor(10000 * _Module1606.interpolate(value, [-validLength, 0, 1 - Number.MIN_VALUE, 1, 1.5], [1, validLength - 1, validLength, validLength, Number.MIN_VALUE])) / 100;
|
|
opacity = _Module1606.interpolate(value, [-validLength, 1 - validLength, 0, 1], [0.25, 1 - (validLength - 1) * opacityInterval, 1, 0.25]);
|
|
}
|
|
return {
|
|
zIndex: Math.round(r39),
|
|
opacity
|
|
};
|
|
};
|
|
getCommonStyles2.__closure = {
|
|
interpolate: _Module1606.interpolate
|
|
};
|
|
getCommonStyles2.__workletHash = 9067239849373;
|
|
getCommonStyles2.__initData = {
|
|
code: "function getCommonStyles_Pnpm_stackTs4(opts){const{interpolate}=this.__closure;const{snapDirection:snapDirection,validLength:validLength,value:value,opacityInterval:opacityInterval}=opts;let zIndex;let opacity;if(snapDirection===\"left\"){zIndex=Math.floor(interpolate(value,[-1.5,-1,-1+Number.MIN_VALUE,0,validLength],[Number.MIN_VALUE,validLength,validLength,validLength-1,-1])*10000)/100;opacity=interpolate(value,[-1,0,validLength-1,validLength],[0.25,1,1-(validLength-1)*opacityInterval,0.25]);}else if(snapDirection===\"right\"){zIndex=Math.floor(interpolate(value,[-validLength,0,1-Number.MIN_VALUE,1,1.5],[1,validLength-1,validLength,validLength,Number.MIN_VALUE])*10000)/100;opacity=interpolate(value,[-validLength,1-validLength,0,1],[0.25,1-(validLength-1)*opacityInterval,1,0.25]);}else{throw new Error(\"snapDirection must be set to either left or right\");}return{zIndex:Math.round(zIndex),opacity:opacity};}"
|
|
};
|
|
getCommonStyles = getCommonStyles2;
|
|
export function horizontalStackLayout(modeConfig = {}) {
|
|
let env17432;
|
|
const r2 = env17432 = {
|
|
$parent: env6442
|
|
};
|
|
env17432[0] = modeConfig;
|
|
const r8 = $mk83164(r2);
|
|
r8.__closure = {
|
|
screen: c6442_3,
|
|
modeConfig,
|
|
getCommonVariables,
|
|
getCommonStyles,
|
|
interpolate: _Module1606.interpolate,
|
|
Extrapolation: _Module1606.Extrapolation
|
|
};
|
|
r8.__workletHash = 13118376883684;
|
|
r8.__initData = c6442_4;
|
|
return r8;
|
|
}
|
|
export function useHorizontalStackLayout(modeConfig = {}) {
|
|
let c17433_0 = modeConfig;
|
|
let r6 = arguments[1];
|
|
if (r6 === void 0) {
|
|
r6 = {};
|
|
}
|
|
let env17434;
|
|
let c17433_1 = r6;
|
|
const config = (0, useMemo)(() => ({
|
|
type: c17433_0.snapDirection === "right" ? "negative" : "positive",
|
|
viewCount: c17433_0.showLength,
|
|
...c17433_1
|
|
}), [modeConfig, r6]);
|
|
const r12 = env17434 = {
|
|
$parent: env6442
|
|
};
|
|
env17434[0] = void 0;
|
|
if (modeConfig === void 0) {
|
|
modeConfig = {};
|
|
}
|
|
env17434[0] = modeConfig;
|
|
const layout = $mk83164(r12);
|
|
layout.__closure = {
|
|
screen: c6442_3,
|
|
modeConfig,
|
|
getCommonVariables,
|
|
getCommonStyles,
|
|
interpolate: _Module1606.interpolate,
|
|
Extrapolation: _Module1606.Extrapolation
|
|
};
|
|
layout.__workletHash = 13118376883684;
|
|
layout.__initData = c6442_4;
|
|
return {
|
|
layout,
|
|
config
|
|
};
|
|
}
|
|
export function verticalStackLayout(modeConfig = {}) {
|
|
let c17435_0 = modeConfig;
|
|
const r8 = function(a0) {
|
|
let rotateZ, scale, translateX, translateY;
|
|
const { showLength, snapDirection: snapDirection2 = "left", moveSize = c6442_3.width, stackInterval = 18, scaleInterval = 0.04, opacityInterval: opacityInterval2 = 0.1, rotateZDeg = 30 } = c17435_0;
|
|
const commonVariables = getCommonVariables({
|
|
showLength,
|
|
value: a0,
|
|
snapDirection: snapDirection2
|
|
});
|
|
const { validLength, value, inputRange } = commonVariables;
|
|
const styles = getCommonStyles({
|
|
validLength,
|
|
value,
|
|
opacityInterval: opacityInterval2,
|
|
snapDirection: snapDirection2
|
|
});
|
|
const { zIndex, opacity } = styles;
|
|
if (snapDirection2 === "left") {
|
|
translateX = _Module1606.interpolate(value, inputRange, [-moveSize, 0, 0], _Module1606.Extrapolation.CLAMP);
|
|
scale = _Module1606.interpolate(value, inputRange, [1, 1, 1 - validLength * scaleInterval], _Module1606.Extrapolation.CLAMP);
|
|
rotateZ = `${_Module1606.interpolate(value, inputRange, [-rotateZDeg, 0, 0], _Module1606.Extrapolation.CLAMP)}deg`;
|
|
translateY = _Module1606.interpolate(value, inputRange, [0, 0, validLength * stackInterval], _Module1606.Extrapolation.CLAMP);
|
|
} else {
|
|
translateY = void 0;
|
|
rotateZ = void 0;
|
|
scale = void 0;
|
|
translateX = void 0;
|
|
if (snapDirection2 === "right") {
|
|
translateX = _Module1606.interpolate(value, inputRange, [0, 0, moveSize], _Module1606.Extrapolation.CLAMP);
|
|
scale = _Module1606.interpolate(value, inputRange, [1 - validLength * scaleInterval, 1, 1], _Module1606.Extrapolation.CLAMP);
|
|
rotateZ = `${_Module1606.interpolate(value, inputRange, [0, 0, rotateZDeg], _Module1606.Extrapolation.CLAMP)}deg`;
|
|
translateY = _Module1606.interpolate(value, inputRange, [validLength * stackInterval, 0, 0], _Module1606.Extrapolation.CLAMP);
|
|
}
|
|
}
|
|
return {
|
|
transform: [{
|
|
translateX
|
|
}, {
|
|
scale
|
|
}, {
|
|
rotateZ
|
|
}, {
|
|
translateY
|
|
}],
|
|
zIndex,
|
|
opacity
|
|
};
|
|
};
|
|
r8.__closure = {
|
|
screen: c6442_3,
|
|
modeConfig,
|
|
getCommonVariables,
|
|
getCommonStyles,
|
|
interpolate: _Module1606.interpolate,
|
|
Extrapolation: _Module1606.Extrapolation
|
|
};
|
|
r8.__workletHash = 9752649608963;
|
|
r8.__initData = c6442_5;
|
|
return r8;
|
|
}
|