@coko/client
Version:
Client side common code for coko apps
52 lines (51 loc) • 1.52 kB
JavaScript
import { useMemo as e } from "react";
import { jsx as t } from "react/jsx-runtime";
import { App as n, ConfigProvider as r, theme as i } from "antd";
//#region src/components/AntConfigProvider.tsx
var a = 16, o = new Set(Object.keys(i.getDesignToken())), s = {
stack: !1,
showProgress: !0,
pauseOnHover: !0,
duration: 4
}, c = (e) => {
if (typeof e == "string") {
if (e.slice(-2) === "px") return parseFloat(e);
if (e.slice(-3) === "rem") return parseFloat(e) * a;
}
return typeof e == "number" ? e : void 0;
};
function l(e) {
let t = {
borderRadius: c(e.borderRadius),
colorBgBase: e.colorBackground,
colorTextBase: e.colorText,
fontFamily: e.fontInterface,
fontSize: c(e.fontSizeBase),
fontSizeHeading1: c(e.fontSizeHeading1),
fontSizeHeading2: c(e.fontSizeHeading2),
fontSizeHeading3: c(e.fontSizeHeading3),
fontSizeHeading4: c(e.fontSizeHeading4),
fontSizeHeading5: c(e.fontSizeHeading5),
fontSizeHeading6: c(e.fontSizeHeading6),
lineType: e.borderStyle,
lineWidth: c(e.borderWidth),
motionUnit: e.transitionDuration,
sizeUnit: c(e.gridUnit)
}, n = Object.fromEntries(Object.entries(t).filter(([, e]) => !!e));
return { token: {
...Object.fromEntries(Object.entries(e).filter(([e]) => o.has(e))),
...n
} };
}
var u = ({ children: i, theme: a, notification: o }) => /* @__PURE__ */ t(r, {
theme: e(() => l(a), [a]),
children: /* @__PURE__ */ t(n, {
notification: e(() => ({
...s,
...o
}), [o]),
children: i
})
});
//#endregion
export { u as default };