119 lines
3.4 KiB
React
119 lines
3.4 KiB
React
// Metro module 8553 (f8554).
|
|
import { Children } from "react";
|
|
import { pickNotNil } from "./Module8547";
|
|
import extractLengthList from "./extractLengthList";
|
|
let Component, c5484_6, c5484_7, c5484_8, c5484_9, c5484_10, getChild;
|
|
const extractFont = function extractFont({ fontData, fontStyle, fontVariant, fontWeight, fontStretch, fontSize, fontFamily, textAnchor, textDecoration, letterSpacing, wordSpacing, kerning, fontFeatureSettings, fontVariantLigatures, fontVariationSettings, font }) {
|
|
let r52;
|
|
const r40 = pickNotNil({
|
|
fontData,
|
|
fontStyle,
|
|
fontVariant,
|
|
fontWeight,
|
|
fontStretch,
|
|
fontSize,
|
|
fontFamily: fontFamily ? fontFamily.split(c5484_9)[0].replace(c5484_7, "").replace(c5484_8, "") : null,
|
|
textAnchor,
|
|
textDecoration,
|
|
letterSpacing,
|
|
wordSpacing,
|
|
kerning,
|
|
fontFeatureSettings,
|
|
fontVariantLigatures,
|
|
fontVariationSettings
|
|
});
|
|
let r41 = font;
|
|
if (typeof r41 === "string") {
|
|
if (Object.prototype.hasOwnProperty.call(c5484_10, font)) {
|
|
r52 = c5484_10[font];
|
|
} else {
|
|
const r51 = c5484_6.exec(font);
|
|
if (r51) {
|
|
const r56 = /bold/.exec(r51[1]);
|
|
const r60 = /italic/.exec(r51[1]);
|
|
const fontSize2 = r51[2] || 12;
|
|
let fontStyle2 = "normal";
|
|
const fontWeight2 = r56 ? "bold" : "normal";
|
|
if (r60) {
|
|
fontStyle2 = "italic";
|
|
}
|
|
const r65 = r51[3];
|
|
c5484_10[font] = {
|
|
fontSize: fontSize2,
|
|
fontWeight: fontWeight2,
|
|
fontStyle: fontStyle2,
|
|
fontFamily: r65 ? r65.split(c5484_9)[0].replace(c5484_7, "").replace(c5484_8, "") : null
|
|
};
|
|
r52 = c5484_10[font];
|
|
} else {
|
|
c5484_10[font] = null;
|
|
r52 = null;
|
|
}
|
|
}
|
|
r41 = r52;
|
|
}
|
|
return {
|
|
...r41,
|
|
...r40
|
|
};
|
|
};
|
|
getChild = function getChild(a0) {
|
|
return typeof a0 !== "string" ? typeof a0 === "number" ? <Component>
|
|
{String(a0)}
|
|
</Component> : a0 : <Component>
|
|
{String(a0)}
|
|
</Component>;
|
|
};
|
|
c5484_6 = /^\s*((?:(?:normal|bold|italic)\s+)*)(?:(\d+(?:\.\d+)?(?:%|px|em|pt|pc|mm|cm|in]))*(?:\s*\/.*?)?\s+)?\s*"?([^"]*)/i;
|
|
c5484_7 = /^[\s"']*/;
|
|
c5484_8 = /[\s"']*$/;
|
|
c5484_9 = /\s*,\s*/g;
|
|
c5484_10 = {};
|
|
export default function extractText(a0, a1) {
|
|
let r9, r10, alignmentBaseline, baselineShift, children, children2, dx, dy, inlineSize, rotate, verticalAlign;
|
|
L9: {
|
|
r10 = a0.x;
|
|
r9 = a0.y;
|
|
dx = a0.dx;
|
|
dy = a0.dy;
|
|
rotate = a0.rotate;
|
|
children = a0.children;
|
|
inlineSize = a0.inlineSize;
|
|
baselineShift = a0.baselineShift;
|
|
verticalAlign = a0.verticalAlign;
|
|
alignmentBaseline = a0.alignmentBaseline;
|
|
if (typeof children !== "string" && typeof children !== "number") {
|
|
if (!(Children.count(children) > 1)) {
|
|
const isArray = Array.isArray(children);
|
|
children2 = children;
|
|
if (!isArray) {
|
|
break L9;
|
|
}
|
|
}
|
|
children2 = Children.map(children, getChild);
|
|
} else {
|
|
children2 = a1 ? <Component>
|
|
{String(children)}
|
|
</Component> : null;
|
|
}
|
|
}
|
|
return {
|
|
content: children2 === null ? String(children) : null,
|
|
children: children2,
|
|
inlineSize,
|
|
baselineShift,
|
|
verticalAlign,
|
|
alignmentBaseline,
|
|
font: extractFont(a0),
|
|
x: extractLengthList(r10),
|
|
y: extractLengthList(r9),
|
|
dx: extractLengthList(dx),
|
|
dy: extractLengthList(dy),
|
|
rotate: extractLengthList(rotate)
|
|
};
|
|
};
|
|
export { extractFont };
|
|
export function setTSpan(a0) {
|
|
Component = a0;
|
|
}
|