UNPKG

@mankindui/core

Version:

- a react component library - you can see how @mankindui/core can be used via examples: [usage examples](https://github.com/clarklindev/mankindui-test)

189 lines (188 loc) 5.95 kB
import { MS as t, WEBKIT as c, MOZ as a } from "./Enum.js"; import { hash as g, replace as r, charat as i, strlen as d, indexof as p, match as o, substr as z } from "./Utility.js"; function M(s, e, n) { switch (g(s, e)) { // color-adjust case 5103: return c + "print-" + s + s; // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function) case 5737: case 4201: case 3177: case 3433: case 1641: case 4457: case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break case 5572: case 6356: case 5844: case 3191: case 6645: case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite, case 6391: case 5879: case 5623: case 6135: case 4599: case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width) case 4215: case 6389: case 5109: case 5365: case 5621: case 3829: return c + s + s; // tab-size case 4789: return a + s + s; // appearance, user-select, transform, hyphens, text-size-adjust case 5349: case 4246: case 4810: case 6968: case 2756: return c + s + a + s + t + s + s; // writing-mode case 5936: switch (i(s, e + 11)) { // vertical-l(r) case 114: return c + s + t + r(s, /[svh]\w+-[tblr]{2}/, "tb") + s; // vertical-r(l) case 108: return c + s + t + r(s, /[svh]\w+-[tblr]{2}/, "tb-rl") + s; // horizontal(-)tb case 45: return c + s + t + r(s, /[svh]\w+-[tblr]{2}/, "lr") + s; } // flex, flex-direction, scroll-snap-type, writing-mode case 6828: case 4268: case 2903: return c + s + t + s + s; // order case 6165: return c + s + t + "flex-" + s + s; // align-items case 5187: return c + s + r(s, /(\w+).+(:[^]+)/, c + "box-$1$2" + t + "flex-$1$2") + s; // align-self case 5443: return c + s + t + "flex-item-" + r(s, /flex-|-self/g, "") + (o(s, /flex-|baseline/) ? "" : t + "grid-row-" + r(s, /flex-|-self/g, "")) + s; // align-content case 4675: return c + s + t + "flex-line-pack" + r(s, /align-content|flex-|-self/g, "") + s; // flex-shrink case 5548: return c + s + t + r(s, "shrink", "negative") + s; // flex-basis case 5292: return c + s + t + r(s, "basis", "preferred-size") + s; // flex-grow case 6060: return c + "box-" + r(s, "-grow", "") + c + s + t + r(s, "grow", "positive") + s; // transition case 4554: return c + r(s, /([^-])(transform)/g, "$1" + c + "$2") + s; // cursor case 6187: return r(r(r(s, /(zoom-|grab)/, c + "$1"), /(image-set)/, c + "$1"), s, "") + s; // background, background-image case 5495: case 3959: return r(s, /(image-set\([^]*)/, c + "$1$`$1"); // justify-content case 4968: return r(r(s, /(.+:)(flex-)?(.*)/, c + "box-pack:$3" + t + "flex-pack:$3"), /s.+-b[^;]+/, "justify") + c + s + s; // justify-self case 4200: if (!o(s, /flex-|baseline/)) return t + "grid-column-align" + z(s, e) + s; break; // grid-template-(columns|rows) case 2592: case 3360: return t + r(s, "template-", "") + s; // grid-(row|column)-start case 4384: case 3616: return n && n.some(function(f, $) { return e = $, o(f.props, /grid-\w+-end/); }) ? ~p(s + (n = n[e].value), "span", 0) ? s : t + r(s, "-start", "") + s + t + "grid-row-span:" + (~p(n, "span", 0) ? o(n, /\d+/) : +o(n, /\d+/) - +o(s, /\d+/)) + ";" : t + r(s, "-start", "") + s; // grid-(row|column)-end case 4896: case 4128: return n && n.some(function(f) { return o(f.props, /grid-\w+-start/); }) ? s : t + r(r(s, "-end", "-span"), "span ", "") + s; // (margin|padding)-inline-(start|end) case 4095: case 3583: case 4068: case 2532: return r(s, /(.+)-inline(.+)/, c + "$1$2") + s; // (min|max)?(width|height|inline-size|block-size) case 8116: case 7059: case 5753: case 5535: case 5445: case 5701: case 4933: case 4677: case 5533: case 5789: case 5021: case 4765: if (d(s) - 1 - e > 6) switch (i(s, e + 1)) { // (m)ax-content, (m)in-content case 109: if (i(s, e + 4) !== 45) break; // (f)ill-available, (f)it-content case 102: return r(s, /(.+:)(.+)-([^]+)/, "$1" + c + "$2-$3$1" + a + (i(s, e + 3) == 108 ? "$3" : "$2-$3")) + s; // (s)tretch case 115: return ~p(s, "stretch", 0) ? M(r(s, "stretch", "fill-available"), e, n) + s : s; } break; // grid-(column|row) case 5152: case 5920: return r(s, /(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/, function(f, $, b, w, k, x, m) { return t + $ + ":" + b + m + (w ? t + $ + "-span:" + (k ? x : +x - +b) + m : "") + s; }); // position: sticky case 4949: if (i(s, e + 6) === 121) return r(s, ":", ":" + c) + s; break; // display: (flex|inline-flex|grid|inline-grid) case 6444: switch (i(s, i(s, 14) === 45 ? 18 : 11)) { // (inline-)?fle(x) case 120: return r(s, /(.+:)([^;\s!]+)(;|(\s+)?!.+)?/, "$1" + c + (i(s, 14) === 45 ? "inline-" : "") + "box$3$1" + c + "$2$3$1" + t + "$2box$3") + s; // (inline-)?gri(d) case 100: return r(s, ":", ":" + t) + s; } break; // scroll-margin, scroll-margin-(top|right|bottom|left) case 5719: case 2647: case 2135: case 3927: case 2391: return r(s, "scroll-", "scroll-snap-") + s; } return s; } export { M as prefix }; //# sourceMappingURL=Prefixer.js.map