livecode-static/livecodes/processor-unocss-compiler.aff439fdf8caa3e77e917c16350607f8.js
2025-06-11 22:23:49 +08:00

5 lines
599 B
JavaScript

"use strict";(()=>{var d=(e,n)=>({...n.customSettings[e]});self.createUnocssCompiler=()=>{let e=self.unocss,{createGenerator:n,defineConfig:u}=e;return async(o,{config:s,options:g})=>{let m=`<template>${g.html}
<script>${s.script.content}<\/script></template>`,f=d("unocss",s),a=(r={})=>Object.keys(r).filter(t=>r[t]&&t in e).map(t=>{let p=r[t];return typeof p=="object"?e[t](p):e[t]()}),y=u({presets:a({presetUno:!0,presetAttributify:!0,presetIcons:{cdn:"https://esm.sh/"}})}),{presets:i,...c}=f;i&&(c.presets=a(i));let b=await n(c,y),{css:l}=await b.generate(m);return l.trim()?l+`
`+o:o}};})();