MCPcopy
hub / github.com/vercel/next.js / parseUtility

Method parseUtility

packages/next/src/compiled/@vercel/og/index.edge.js:19426–19457  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19424 return n ? this.order !== void 0 ? { kind: "ordered", order: this.order, styleIr: n } : n : { kind: "null" };
19425 }
19426 parseUtility() {
19427 var t, n, r, i, o;
19428 let s = this.config.theme, a = null;
19429 switch (this.char) {
19430 case "m":
19431 case "p": {
19432 let u2 = this.peekSlice(1, 3).match(/^(t|b|r|l|x|y)?-/);
19433 if (u2) {
19434 let f = this.char === "m" ? "margin" : "padding";
19435 this.advance(((n = (t = u2[0]) === null || t === void 0 ? void 0 : t.length) !== null && n !== void 0 ? n : 0) + 1);
19436 let l2 = Ds(u2[1]), p = Gs(f, l2, this.isNegative, this.rest, (r = this.config.theme) === null || r === void 0 ? void 0 : r[f]);
19437 if (p)
19438 return p;
19439 }
19440 }
19441 }
19442 if (this.consumePeeked("h-") && (a = Vs("height", this.rest, this.context, s == null ? void 0 : s.height), a) || this.consumePeeked("w-") && (a = Vs("width", this.rest, this.context, s == null ? void 0 : s.width), a) || this.consumePeeked("min-w-") && (a = An("minWidth", this.rest, this.context, s == null ? void 0 : s.minWidth), a) || this.consumePeeked("min-h-") && (a = An("minHeight", this.rest, this.context, s == null ? void 0 : s.minHeight), a) || this.consumePeeked("max-w-") && (a = An("maxWidth", this.rest, this.context, s == null ? void 0 : s.maxWidth), a) || this.consumePeeked("max-h-") && (a = An("maxHeight", this.rest, this.context, s == null ? void 0 : s.maxHeight), a) || this.consumePeeked("leading-") && (a = Us(this.rest, s == null ? void 0 : s.lineHeight), a) || this.consumePeeked("text-") && (a = qs(this.rest, s == null ? void 0 : s.fontSize, this.context), a || (a = lr("text", this.rest, s == null ? void 0 : s.textColor), a) || this.consumePeeked("opacity-") && (a = On("text", this.rest), a)) || this.consumePeeked("font-") && (a = js(this.rest, s == null ? void 0 : s.fontFamily), a) || this.consumePeeked("aspect-") && (this.consumePeeked("ratio-") && Je("`aspect-ratio-{ratio}` is deprecated, use `aspect-{ratio}` instead"), a = Bt("aspectRatio", this.rest, { fractions: true }), a) || this.consumePeeked("tint-") && (a = lr("tint", this.rest, s == null ? void 0 : s.colors), a) || this.consumePeeked("bg-") && (a = lr("bg", this.rest, s == null ? void 0 : s.backgroundColor), a || this.consumePeeked("opacity-") && (a = On("bg", this.rest), a)) || this.consumePeeked("border") && (a = zf(this.rest, s), a || this.consumePeeked("-opacity-") && (a = On("border", this.rest), a)) || this.consumePeeked("rounded") && (a = jf(this.rest, s == null ? void 0 : s.borderRadius), a) || this.consumePeeked("bottom-") && (a = Er("bottom", this.rest, this.isNegative, s == null ? void 0 : s.inset), a) || this.consumePeeked("top-") && (a = Er("top", this.rest, this.isNegative, s == null ? void 0 : s.inset), a) || this.consumePeeked("left-") && (a = Er("left", this.rest, this.isNegative, s == null ? void 0 : s.inset), a) || this.consumePeeked("right-") && (a = Er("right", this.rest, this.isNegative, s == null ? void 0 : s.inset), a) || this.consumePeeked("inset-") && (a = Er("inset", this.rest, this.isNegative, s == null ? void 0 : s.inset), a) || this.consumePeeked("flex-") && (this.consumePeeked("grow") ? a = Pn("Grow", this.rest, s == null ? void 0 : s.flexGrow) : this.consumePeeked("shrink") ? a = Pn("Shrink", this.rest, s == null ? void 0 : s.flexShrink) : a = Hf(this.rest, s == null ? void 0 : s.flex), a) || this.consumePeeked("grow") && (a = Pn("Grow", this.rest, s == null ? void 0 : s.flexGrow), a) || this.consumePeeked("shrink") && (a = Pn("Shrink", this.rest, s == null ? void 0 : s.flexShrink), a) || this.consumePeeked("shadow-color-opacity-") && (a = On("shadow", this.rest), a) || this.consumePeeked("shadow-opacity-") && (a = Qf(this.rest), a) || this.consumePeeked("shadow-offset-") && (a = Kf(this.rest), a) || this.consumePeeked("shadow-radius-") && (a = dt("shadowRadius", this.rest), a) || this.consumePeeked("shadow-") && (a = lr("shadow", this.rest, s == null ? void 0 : s.colors), a))
19443 return a;
19444 if (this.consumePeeked("elevation-")) {
19445 let u2 = parseInt(this.rest, 10);
19446 if (!Number.isNaN(u2))
19447 return _({ elevation: u2 });
19448 }
19449 if (this.consumePeeked("opacity-") && (a = Xf(this.rest, s == null ? void 0 : s.opacity), a) || this.consumePeeked("tracking-") && (a = Yf(this.rest, this.isNegative, s == null ? void 0 : s.letterSpacing), a))
19450 return a;
19451 if (this.consumePeeked("z-")) {
19452 let u2 = Number((o = (i = s == null ? void 0 : s.zIndex) === null || i === void 0 ? void 0 : i[this.rest]) !== null && o !== void 0 ? o : this.rest);
19453 if (!Number.isNaN(u2))
19454 return _({ zIndex: u2 });
19455 }
19456 return Je(`\`${this.rest}\` unknown or invalid utility`), null;
19457 }
19458 handlePossibleArbitraryBreakpointPrefix(t) {
19459 var n;
19460 if (t[0] !== "m")

Callers 1

parseMethod · 0.45

Calls 15

GsFunction · 0.85
AnFunction · 0.85
UsFunction · 0.85
lrFunction · 0.85
OnFunction · 0.85
jsFunction · 0.85
jfFunction · 0.85
ErFunction · 0.85
HfFunction · 0.85
QfFunction · 0.85
XfFunction · 0.85
DsFunction · 0.70

Tested by

no test coverage detected