@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) • 945 B
JavaScript
;var e=require("@emotion/cache"),r=require("@emotion/serialize"),o=require("@emotion/utils"),t=require("../helper/common.helper.cjs");const n=Symbol.for("@meonode/ui/serverEmotionCache"),i=Symbol.for("@meonode/ui/serverEmotionRules");function s(){return t.getGlobalState(n,()=>e({key:"meonode-css"}))}function m(){return t.getGlobalState(i,()=>({byId:new Map}))}exports.compileServerEmotionClassName=function(e){if(!e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e)return;const t=s(),n=r.serializeStyles([e],t.registered),i=o.insertStyles(t,n,!1),a=t.inserted[n.name],u="string"==typeof i?i:"string"==typeof a?a:void 0;if(u){const e=m();e.byId.has(n.name)||e.byId.set(n.name,u)}return`${t.key}-${n.name}`},exports.consumeServerEmotionRules=function(){const e=m();if(0===e.byId.size)return[];const r=Array.from(e.byId.entries()).map(([e,r])=>({id:e,cssText:r}));return e.byId.clear(),r},exports.getServerEmotionCache=s;