@meonode/ui
Version:
A structured approach to component composition, direct CSS-first prop styling, built-in theming, smart prop handling (including raw property pass-through), and dynamic children.
2 lines (1 loc) • 928 B
JavaScript
import e from"@emotion/cache";import{serializeStyles as o}from"@emotion/serialize";import{insertStyles as r}from"@emotion/utils";import{getGlobalState as n}from"../helper/common.helper.js";const t=Symbol.for("@meonode/ui/serverEmotionCache"),i=Symbol.for("@meonode/ui/serverEmotionRules");function m(){return n(t,()=>e({key:"meonode-css"}))}function s(){return n(i,()=>({byId:new Map}))}function f(e){if(!e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e)return;const n=m(),t=o([e],n.registered),i=r(n,t,!1),f=n.inserted[t.name],c="string"==typeof i?i:"string"==typeof f?f:void 0;if(c){const e=s();e.byId.has(t.name)||e.byId.set(t.name,c)}return`${n.key}-${t.name}`}function c(){const e=s();if(0===e.byId.size)return[];const o=Array.from(e.byId.entries()).map(([e,o])=>({id:e,cssText:o}));return e.byId.clear(),o}export{f as compileServerEmotionClassName,c as consumeServerEmotionRules,m as getServerEmotionCache};