UNPKG

ant-design-x-vue

Version:

Craft AI-driven interfaces effortlessly

93 lines (92 loc) 3.29 kB
function g(e) { if (typeof e == "number") return [e]; const n = String(e).split(/\s+/); let d = "", t = 0; return n.reduce((r, o) => (o.includes("(") ? (d += o, t += o.split("(").length - 1) : o.includes(")") ? (d += ` ${o}`, t -= o.split(")").length - 1, t === 0 && (r.push(d), d = "")) : t > 0 ? d += ` ${o}` : r.push(o), r), []); } function i(e) { return e.notSplit = !0, e; } const p = { // Inset inset: ["top", "right", "bottom", "left"], insetBlock: ["top", "bottom"], insetBlockStart: ["top"], insetBlockEnd: ["bottom"], insetInline: ["left", "right"], insetInlineStart: ["left"], insetInlineEnd: ["right"], // Margin marginBlock: ["marginTop", "marginBottom"], marginBlockStart: ["marginTop"], marginBlockEnd: ["marginBottom"], marginInline: ["marginLeft", "marginRight"], marginInlineStart: ["marginLeft"], marginInlineEnd: ["marginRight"], // Padding paddingBlock: ["paddingTop", "paddingBottom"], paddingBlockStart: ["paddingTop"], paddingBlockEnd: ["paddingBottom"], paddingInline: ["paddingLeft", "paddingRight"], paddingInlineStart: ["paddingLeft"], paddingInlineEnd: ["paddingRight"], // Border borderBlock: i(["borderTop", "borderBottom"]), borderBlockStart: i(["borderTop"]), borderBlockEnd: i(["borderBottom"]), borderInline: i(["borderLeft", "borderRight"]), borderInlineStart: i(["borderLeft"]), borderInlineEnd: i(["borderRight"]), // Border width borderBlockWidth: ["borderTopWidth", "borderBottomWidth"], borderBlockStartWidth: ["borderTopWidth"], borderBlockEndWidth: ["borderBottomWidth"], borderInlineWidth: ["borderLeftWidth", "borderRightWidth"], borderInlineStartWidth: ["borderLeftWidth"], borderInlineEndWidth: ["borderRightWidth"], // Border style borderBlockStyle: ["borderTopStyle", "borderBottomStyle"], borderBlockStartStyle: ["borderTopStyle"], borderBlockEndStyle: ["borderBottomStyle"], borderInlineStyle: ["borderLeftStyle", "borderRightStyle"], borderInlineStartStyle: ["borderLeftStyle"], borderInlineEndStyle: ["borderRightStyle"], // Border color borderBlockColor: ["borderTopColor", "borderBottomColor"], borderBlockStartColor: ["borderTopColor"], borderBlockEndColor: ["borderBottomColor"], borderInlineColor: ["borderLeftColor", "borderRightColor"], borderInlineStartColor: ["borderLeftColor"], borderInlineEndColor: ["borderRightColor"], // Border radius borderStartStartRadius: ["borderTopLeftRadius"], borderStartEndRadius: ["borderTopRightRadius"], borderEndStartRadius: ["borderBottomLeftRadius"], borderEndEndRadius: ["borderBottomRightRadius"] }; function a(e) { return { _skip_check_: !0, value: e }; } const h = { visit: (e) => { const n = {}; return Object.keys(e).forEach((d) => { const t = e[d], r = p[d]; if (r && (typeof t == "number" || typeof t == "string")) { const o = g(t); r.length && r.notSplit ? r.forEach((l) => { n[l] = a(t); }) : r.length === 1 ? n[r[0]] = a(t) : r.length === 2 ? r.forEach((l, b) => { n[l] = a(o[b] ?? o[0]); }) : r.length === 4 ? r.forEach((l, b) => { n[l] = a(o[b] ?? o[b - 2] ?? o[0]); }) : n[d] = t; } else n[d] = t; }), n; } }; export { h as default };