UNPKG

@lobehub/ui

Version:

Lobe UI is an open-source UI component library for building AIGC web apps

34 lines (33 loc) 1.16 kB
import { styleKeysOf } from "../shared.mjs"; import { extractStyle } from "@ant-design/cssinjs"; //#region src/static-css/runtime/index.ts const buildInlineAntdStyle = (runtimeCache, payload) => { const staticKeys = payload.styleKeys instanceof Set ? payload.styleKeys : new Set(payload.styleKeys); const cssinjsCache = runtimeCache; const cssVarCss = extractStyle(cssinjsCache, { plain: true, types: ["cssVar"] }); const uncoveredKeys = styleKeysOf(cssinjsCache).filter((key) => !staticKeys.has(key)); let uncoveredCss = ""; if (uncoveredKeys.length > 0) { const pseudoCache = { cache: new Map(uncoveredKeys.map((key) => [key, cssinjsCache.cache.get(key)])), extracted: /* @__PURE__ */ new Set(), updateTimes: cssinjsCache.updateTimes }; uncoveredCss = extractStyle(pseudoCache, { plain: true, types: ["style"] }); } const css = cssVarCss + uncoveredCss; return { css, html: css ? `<style data-rc-order="prepend" data-rc-priority="-9999">${css}</style>` : "", uncovered: uncoveredKeys.map((key) => key.split("%")[2] ?? key) }; }; //#endregion export { buildInlineAntdStyle }; //# sourceMappingURL=index.mjs.map