172 lines
6.0 KiB
JavaScript
172 lines
6.0 KiB
JavaScript
// Metro module 1702 (f1703).
|
|
import _classCallCheck from "./_classCallCheck";
|
|
import _createClass from "./_createClass";
|
|
import * as _Module1655 from "./Module1655";
|
|
import { flattenArray } from "./Module1703";
|
|
import { makeViewDescriptorsSet } from "./Module1704";
|
|
import { adaptViewConfig } from "./configureProps";
|
|
import * as _Module1706 from "./Module1706";
|
|
import { stopMapper, startMapper } from "./createMapperRegistry";
|
|
function $mk69805($env) {
|
|
return (a0) => {
|
|
let env24553;
|
|
const r2 = env24553 = {
|
|
$parent: $env
|
|
};
|
|
env24553[0] = a0;
|
|
return !!a0 && Object.keys(a0).some($mk69806(r2));
|
|
};
|
|
}
|
|
function $mk69806($env) {
|
|
return (a0) => {
|
|
const r6 = $env[0][a0];
|
|
const r4 = $env.$parent;
|
|
return (0, r4[0])(r4[1][3]).isSharedValue(r6) || a0 === "transform" && (!!Array.isArray(r6) && r6.some($mk69805(r4)));
|
|
};
|
|
}
|
|
let getInlinePropsUpdate2, c1346_6;
|
|
let getInlinePropsUpdate;
|
|
let InlinePropManager;
|
|
let env1346 = {};
|
|
const isInlineStyleTransform = function isInlineStyleTransform(a0) {
|
|
return !!Array.isArray(a0) && a0.some($mk69805(env1346));
|
|
};
|
|
getInlinePropsUpdate = function getInlinePropsUpdate(a0) {
|
|
const r0 = {};
|
|
for (const item of Object.entries(a0)) {
|
|
const [r35, r12] = item;
|
|
if (_Module1655.isSharedValue(r12)) {
|
|
r0[r35] = r12.value;
|
|
} else {
|
|
const isArray = Array.isArray(r12);
|
|
if (isArray) {
|
|
r0[r35] = r12.map((item) => getInlinePropsUpdate(item));
|
|
} else {
|
|
r0[r35] = typeof r12 === "object" ? getInlinePropsUpdate(r12) : r12;
|
|
}
|
|
}
|
|
}
|
|
return r0;
|
|
};
|
|
getInlinePropsUpdate.__closure = {
|
|
isSharedValue: _Module1655.isSharedValue
|
|
};
|
|
getInlinePropsUpdate.__workletHash = 14886679339062;
|
|
getInlinePropsUpdate.__initData = {
|
|
code: "function getInlinePropsUpdate_Pnpm_InlinePropManagerTs1(inlineProps){const getInlinePropsUpdate_Pnpm_InlinePropManagerTs1=this._recur;const{isSharedValue}=this.__closure;const update={};for(const[key,styleValue]of Object.entries(inlineProps)){if(isSharedValue(styleValue)){update[key]=styleValue.value;}else if(Array.isArray(styleValue)){update[key]=styleValue.map(function(item){return getInlinePropsUpdate_Pnpm_InlinePropManagerTs1(item);});}else if(typeof styleValue==='object'){update[key]=getInlinePropsUpdate_Pnpm_InlinePropManagerTs1(styleValue);}else{update[key]=styleValue;}}return update;}"
|
|
};
|
|
getInlinePropsUpdate2 = getInlinePropsUpdate;
|
|
c1346_6 = {
|
|
code: "function pnpm_InlinePropManagerTs2(){const{getInlinePropsUpdate,newInlineProps,updateProps,shareableViewDescriptors}=this.__closure;const update=getInlinePropsUpdate(newInlineProps);updateProps(shareableViewDescriptors,update);}"
|
|
};
|
|
InlinePropManager = function InlinePropManager() {
|
|
_classCallCheck(this, InlinePropManager);
|
|
this._inlinePropsViewDescriptors = null;
|
|
this._inlinePropsMapperId = null;
|
|
this._inlineProps = {};
|
|
};
|
|
const r35 = _createClass(InlinePropManager, [{
|
|
key: "attachInlineProps",
|
|
value: function attachInlineProps({ props }, a1) {
|
|
const newInlineProps = {};
|
|
let c24554_0 = newInlineProps;
|
|
for (const key in props) {
|
|
const r13 = props[key];
|
|
if (key === "style") {
|
|
let style = props.style;
|
|
if (style == null) {
|
|
style = [];
|
|
}
|
|
flattenArray(style).forEach((a0) => {
|
|
if (a0) {
|
|
for (const item of Object.entries(a0)) {
|
|
const [r35, r12] = item;
|
|
if (_Module1655.isSharedValue(r12) || r35 === "transform" && isInlineStyleTransform(r12)) {
|
|
c24554_0[r35] = r12;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
} else if (_Module1655.isSharedValue(r13)) {
|
|
newInlineProps[key] = r13;
|
|
}
|
|
}
|
|
let shareableViewDescriptors;
|
|
let c24555_0 = newInlineProps;
|
|
if ((function inlinePropsHasChanged(a0, a1) {
|
|
if (Object.keys(a0).length !== Object.keys(a1).length) {
|
|
return true;
|
|
}
|
|
for (const item of Object.keys(a0)) {
|
|
if (a0[item] === a1[item]) {
|
|
continue;
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
})(newInlineProps, this._inlineProps)) {
|
|
if (!this._inlinePropsViewDescriptors) {
|
|
this._inlinePropsViewDescriptors = makeViewDescriptorsSet();
|
|
const { viewTag, viewName, shadowNodeWrapper, viewConfig } = a1;
|
|
if (Object.keys(newInlineProps).length && viewConfig) {
|
|
adaptViewConfig(viewConfig);
|
|
}
|
|
this._inlinePropsViewDescriptors.add({
|
|
tag: viewTag,
|
|
name: viewName,
|
|
shadowNodeWrapper
|
|
});
|
|
}
|
|
shareableViewDescriptors = this._inlinePropsViewDescriptors.shareableViewDescriptors;
|
|
const r64 = function() {
|
|
_Module1706.updateProps(shareableViewDescriptors, getInlinePropsUpdate2(c24555_0));
|
|
};
|
|
r64.__closure = {
|
|
getInlinePropsUpdate: getInlinePropsUpdate2,
|
|
newInlineProps,
|
|
updateProps: _Module1706.updateProps,
|
|
shareableViewDescriptors
|
|
};
|
|
r64.__workletHash = 4459550727912;
|
|
r64.__initData = c1346_6;
|
|
this._inlineProps = newInlineProps;
|
|
if (this._inlinePropsMapperId) {
|
|
stopMapper(this._inlinePropsMapperId);
|
|
}
|
|
this._inlinePropsMapperId = null;
|
|
if (Object.keys(newInlineProps).length) {
|
|
this._inlinePropsMapperId = startMapper(r64, Object.values(newInlineProps));
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
key: "detachInlineProps",
|
|
value: function detachInlineProps() {
|
|
if (this._inlinePropsMapperId) {
|
|
stopMapper(this._inlinePropsMapperId);
|
|
}
|
|
}
|
|
}]);
|
|
export function hasInlineStyles(a0) {
|
|
let env13169;
|
|
const r2 = env13169 = {
|
|
$parent: env1346
|
|
};
|
|
env13169[0] = a0;
|
|
return !!a0 && Object.keys(a0).some($mk69806(r2));
|
|
}
|
|
export function getInlineStyle(a0, a1) {
|
|
if (a1) {
|
|
return getInlinePropsUpdate2(a0);
|
|
}
|
|
const r27 = {};
|
|
for (const item of Object.entries(a0)) {
|
|
const [r36, r13] = item;
|
|
if (!(_Module1655.isSharedValue(r13) || r36 === "transform" && isInlineStyleTransform(r13))) {
|
|
r27[r36] = r13;
|
|
}
|
|
}
|
|
return r27;
|
|
}
|
|
export { r35 as InlinePropManager };
|