@theme-registry/refract-css 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/lowering.d.ts +2 -0
- package/package.json +4 -4
package/dist/index.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{defineAdapter as e,mergeComponentRuleSet as o}from"@theme-registry/refract";import{toHexColor as t,toOklchColor as n}from"@theme-registry/refract/color-math";import{resolveNaming as r,createNamer as s}from"@theme-registry/refract/adapter-kit";const i=e=>null==e?"":String(e),a=e=>void 0!==e.unit?`${e.value}${e.unit}`:i(e.value),c=(e,o,t,n)=>{var r;if(!n){const n=e[o];return null!==(r=null==n?void 0:n[t])&&void 0!==r?r:""}const s={orientation:n};return"min"===t?e.min(o,s):"max"===t?e.max(o,s):e.exact(o,s)},l=(e,o)=>{const t=e=>e.replace(/^@media\s*/,"");return`@media ${t(e)} and ${t(o)}`},u=(e,o,t,n)=>{var r,s;const i=new Map,a=(e,o,t)=>{const n=`${e}||${o}`,r=i.get(n);r?Object.assign(r.variables,t):i.set(n,{media:e,selector:o,variables:{...t}})};for(const[i,u]of Object.entries(e))for(const e of null!==(r=u.responsive)&&void 0!==r?r:[]){const r=c(o,e.breakpoint,null!==(s=e.query)&&void 0!==s?s:"exact",e.orientation);if(!r)continue;const u=d(i,e,t,n);if(!Object.keys(u).length)continue;const f=e.mode;if(f){a(r,`:root[data-theme="${f}"]`,u);const e=v[f];e&&a(l(r,e),":root",u)}else a(r,":root",u)}return Array.from(i.values(),({media:e,selector:o,variables:t})=>({kind:"variables",selector:o,media:e,variables:t}))},d=(e,o,t,n)=>{var r;const{ref:s,target:i}=o,a={};void 0!==s&&(a[t(e,i)]=`var(${t(e,s)})`);for(const[s,c]of Object.entries(null!==(r=o.overrides)&&void 0!==r?r:{})){a["base"===s?t(e,i):t(e,i,s)]=n(c)}return a},f=e=>Object.keys(e).length?[{kind:"variables",selector:":root",variables:e}]:[],v={dark:"@media (prefers-color-scheme: dark)",light:"@media (prefers-color-scheme: light)"},p=(e,o)=>{let t=e.get(o);return t||(t={},e.set(o,t)),t},m=e=>{const o=[];for(const[t,n]of e){if(!Object.keys(n).length)continue;const e=v[t];e&&o.push({kind:"variables",selector:":root",media:e,variables:{...n}}),o.push({kind:"variables",selector:`:root[data-theme="${t}"]`,variables:{...n}})}return o},b=(e,o,t,n,r)=>e([o,t,n,r].filter(Boolean).join(".")),h=(e,o,t)=>{var n;const r=new Map;for(const[s,i]of Object.entries(e))if(i.modes)for(const e of i.modes){if(void 0===e.mode)continue;const i=p(r,e.mode),a=e.target,c=null!==(n=e.overrides)&&void 0!==n?n:{},l=c.base;l&&null!=l.value&&(i[b(o,"colors",s,a)]=t(l.value));for(const[e,n]of Object.entries(c))"base"!==e&&n&&null!=n.value&&""!==n.value&&(i[b(o,"colors",s,a,e)]=t(n.value))}return m(r)},y=(e,o,t)=>{var n,r,s,i;const a={};for(const[c,l]of Object.entries(o)){a[`${e}.${c}`]=null!==(n=l.base.external)&&void 0!==n?n:t(`${e}.${c}`);for(const[o,n]of Object.entries(null!==(r=l.extras)&&void 0!==r?r:{}))null!=(null==n?void 0:n.value)&&""!==n.value&&(a[`${e}.${c}.${o}`]=t(`${e}.${c}.${o}`));for(const[o,n]of Object.entries(null!==(s=l.variants)&&void 0!==s?s:{})){a[`${e}.${c}.${o}`]=t(`${e}.${c}.${o}`);for(const r of Object.keys(null!==(i=n.extras)&&void 0!==i?i:{}))a[`${e}.${c}.${o}.${r}`]=t(`${e}.${c}.${o}.${r}`)}}return a},$=(e,o,t,n)=>{var r,s,i;const{varName:c}=t,l=(o,t,n)=>b(c,e,o,t,n),d={};for(const[e,t]of Object.entries(o))if(void 0===t.base.external){d[l(e)]=n.formatRoot(e,t.base);for(const[o,i]of Object.entries(null!==(r=t.variants)&&void 0!==r?r:{})){d[l(e,o)]=n.formatRoot(e,i.base);for(const[t,r]of Object.entries(null!==(s=i.extras)&&void 0!==s?s:{}))d[l(e,o,t)]=n.formatRoot(e,r)}}const v=null!==(i=n.formatResponsive)&&void 0!==i?i:a;return[...f(d),...u(o,t.media,l,v),...g(o,(e,o)=>l(e,o),n.formatRoot)]},g=(e,o,t)=>{var n;const r=new Map;for(const[s,i]of Object.entries(e))if(i.modes)for(const e of i.modes){if(void 0===e.mode)continue;const i=null===(n=e.overrides)||void 0===n?void 0:n.base;null==i||null==i.struct&&null==i.value||(p(r,e.mode)[o(s,e.target)]=t(s,i))}return m(r)},k=(e,o,t)=>y(e,o,t),j=(e,o)=>{const t=`0${(e=>{for(const o of[e.offsetX,e.offsetY,e.blur,e.spread])if(void 0!==o&&"number"!=typeof o)return o.unit;return"px"})(e)}`,n=e=>void 0===e?t:(e=>"number"==typeof e?String(e):`${e.value}${e.unit}`)(e),r=[];return e.inset&&r.push("inset"),r.push(n(e.offsetX),n(e.offsetY)),null!=e.spread?r.push(n(e.blur),n(e.spread)):null!=e.blur&&r.push(n(e.blur)),e.color&&r.push(((e,o)=>{const t=o[e];return t?`var(${t})`:e})(e.color,o)),r.join(" ")},O=(e,o)=>e.map(e=>j(e,o)).join(", "),N=e=>{var o;const t=[e.property];return null==e.duration&&null==e.delay||t.push(`${null!==(o=e.duration)&&void 0!==o?o:0}ms`),e.timingFunction&&t.push(e.timingFunction),null!=e.delay&&t.push(`${e.delay}ms`),t.join(" ")},x=e=>e.map(N).join(", "),w=(e,o)=>{var t;const n=null!==(t=o.pathToVar)&&void 0!==t?t:{};return $("effects",e,o,{formatRoot:(e,o)=>o.struct?((e,o,t)=>"transitions"===e?x(o):O(o,t))(e,o.struct,n):a(o),formatResponsive:e=>e.struct?((e,o)=>{const t=e[0];return t&&"object"==typeof t&&"property"in t?x(e):O(e,o)})(e.struct,n):a(e)})},S=new Set(["duration","delay"]),E=(e,o)=>$("animation",e,o,{formatRoot:(e,o)=>"number"==typeof o.value&&S.has(e)?`${o.value}ms`:i(o.value),formatResponsive:e=>{return"number"==typeof(o=e.value)?`${o}ms`:i(o);var o}}),R=e=>e.includes("--"),T=e=>{const o={},t={};for(const[n,r]of Object.entries(e))R(n)?t[n]=r:o[n]=r;return{regular:o,config:t}},V=(e,o)=>$("layout",e,o,{formatRoot:(e,o)=>a(o)}),A=["spacing","gutters","aspectRatio"],q=(e,o)=>{const t=new Map;for(const[n,r]of Object.entries(e)){const e=n.split("--")[0];let s=t.get(e);s||(s={},t.set(e,s)),s[o.varName(`layout.${n}`)]=String(M(r.base,o.pathToVar))}return Array.from(t.values(),e=>({kind:"variables",selector:":root",variables:e}))},B=(e,o)=>{var t,n;const{media:r,selectorBuilder:s,pathToVar:i}=o,a=Object.entries(e),l={};for(const[e]of a)l[e]=s(e);const u=[];for(let e=a.length-1;e>=0;e--){const[o,t]=a[e],n=_(t.declarations,i);n.length&&u.push({kind:"rule",selector:s(o),declarations:n})}const d=[];for(const[e,o]of a)for(const a of o.overrides){if(void 0!==a.state||!a.breakpoint)continue;const o=c(r,a.breakpoint,null!==(t=a.query)&&void 0!==t?t:"exact",a.orientation);if(!o)continue;const l=_(null!==(n=a.declarations)&&void 0!==n?n:{},i);l.length&&d.push({kind:"rule",selector:s(e),media:o,declarations:l})}return{nodes:[...u,...d],variants:l}},M=(e,o)=>{var t;if(void 0===e.ref)return e.value;const n=`var(${null!==(t=o[e.ref])&&void 0!==t?t:e.ref})`;return e.wrap?`${e.wrap}(${n})`:n},_=(e,o)=>Object.entries(e).map(([e,t])=>({property:e,value:M(t,o)})),F=(e,o)=>e.split(",").map(e=>`${e.trim()}${o}`).join(","),C=(e,o)=>{const t=e.selector;if(!t)return[];const n=[];for(const[t,r]of Object.entries(e.declarations)){if(void 0===r.ref){n.push({property:t,value:r.value});continue}const e=o[r.ref];e&&n.push({property:t,value:`var(${e})`})}return n.length?[{kind:"rule",selector:`:where(${t})`,declarations:n}]:[]},X=(e,o,t,n,r,s,i)=>{var a,l,u,d,f;const v=_(t,r);v.length&&e.push({kind:"rule",selector:o,declarations:v});for(const t of n){if(void 0!==t.state||void 0!==t.container||!t.breakpoint)continue;const n=c(s,t.breakpoint,null!==(a=t.query)&&void 0!==a?a:"exact",t.orientation);if(!n)continue;const i=_(null!==(l=t.declarations)&&void 0!==l?l:{},r);i.length&&e.push({kind:"rule",selector:o,media:n,declarations:i})}const p=n.filter(e=>void 0!==e.state);for(const t of W(p)){const n=I[t.state];if(!n)continue;const i=_(null!==(u=t.declarations)&&void 0!==u?u:{},r);if(!i.length)continue;const a={kind:"rule",selector:F(o,n),declarations:i};if(t.breakpoint){const e=c(s,t.breakpoint,null!==(d=t.query)&&void 0!==d?d:"exact",t.orientation);e&&(a.media=e)}e.push(a)}for(const t of n){if(!t.container)continue;const n=Y(t,i);if(!n)continue;const s=_(null!==(f=t.declarations)&&void 0!==f?f:{},r);s.length&&e.push({kind:"rule",selector:o,media:n,declarations:s})}},I={link:":link",visited:":visited",hover:":hover",focus:":focus",active:":active",disabled:"[disabled]",pressed:"[aria-pressed]"},G=Object.keys(I),P=G.reduce((e,o,t)=>(e[o]=t,e),{}),W=e=>[...e].map((e,o)=>({override:e,index:o})).sort((e,o)=>{var t,n;const r=null!==(t=P[e.override.state])&&void 0!==t?t:Number.MAX_SAFE_INTEGER,s=null!==(n=P[o.override.state])&&void 0!==n?n:Number.MAX_SAFE_INTEGER;if(r!==s)return r-s;const i=e.override.breakpoint?1:0,a=o.override.breakpoint?1:0;return i!==a?i-a:e.index-o.index}).map(({override:e})=>e),z=(e,o,t,n)=>{var r,s;const i=e.overrides.filter(e=>void 0!==e.state&&!e.target);if(!i.length)return[];const a=[];for(const e of W(i)){const i=I[e.state];if(!i)continue;const l=_(null!==(r=e.declarations)&&void 0!==r?r:{},n);if(!l.length)continue;const u={kind:"rule",selector:`${o}${i}`,declarations:l};if(e.breakpoint){const o=c(t,e.breakpoint,null!==(s=e.query)&&void 0!==s?s:"exact",e.orientation);o&&(u.media=o)}a.push(u)}return a},Y=(e,o)=>{var t;if(!e.container||!e.size)return"";const n=null==o?void 0:o[e.container];if(!n)return"";return n[null!==(t=e.query)&&void 0!==t?t:"min"](e.size)},L=(e,o)=>{var t,n,r,s,i;const{media:a,selectorBuilder:l,pathToVar:u}=o,d=[],f={};for(const[o,r]of Object.entries(e)){const e=l(o);f[o]=e;const s=_(r.declarations,u);s.length&&d.push({kind:"rule",selector:e,declarations:s});for(const o of r.overrides){if(void 0!==o.state||!o.breakpoint)continue;const r=c(a,o.breakpoint,null!==(t=o.query)&&void 0!==t?t:"exact",o.orientation);if(!r)continue;const s=_(null!==(n=o.declarations)&&void 0!==n?n:{},u);s.length&&d.push({kind:"rule",selector:e,media:r,declarations:s})}}const v=[];for(const[o,t]of Object.entries(e))v.push(...z(t,l(o),a,u));const p=[];for(const[o,t]of Object.entries(e))for(const e of t.overrides){if(void 0===e.state||!e.target)continue;const t=I[e.state];if(!t)continue;const n=_(null!==(r=e.declarations)&&void 0!==r?r:{},u);if(!n.length)continue;const i={kind:"rule",selector:`${l(`${o}-${e.target}`)}${t}`,declarations:n};if(e.breakpoint){const o=c(a,e.breakpoint,null!==(s=e.query)&&void 0!==s?s:"exact",e.orientation);o&&(i.media=o)}p.push(i)}const m=[];for(const[t,n]of Object.entries(e)){const e=l(t);for(const t of n.overrides){if(!t.container)continue;const n=Y(t,o.containers);if(!n)continue;const r=_(null!==(i=t.declarations)&&void 0!==i?i:{},u);r.length&&m.push({kind:"rule",selector:e,media:n,declarations:r})}}return{nodes:[...d,...v,...m,...p],variants:f}},U="animation.keyframes.",D=["animation-duration","animation-timing-function","animation-delay","animation-iteration-count","animation-direction","animation-fill-mode","animation-play-state","animation-name"],H=(e,o,t)=>{const n=void 0!==e.ref?e.ref.startsWith(U)?e.ref.slice(20):e.ref:i(e.value);if(!o.has(n))throw new Error(`css adapter: animation recipe '${t}' references unknown keyframe '${n}' — no matching entry in animation.keyframes`);return n},J=(e,o)=>{var t,n,r,s,i;const{media:a,selectorBuilder:l,pathToVar:u,keyframeNames:d}=o,f=[],v={},p=(e,o,t)=>{const n=((e,o,t,n)=>{const r=[];for(const s of D){const i=e[s];i&&r.push("animation-name"===s?H(i,t,n):String(M(i,o)))}return r.join(" ")})(o,u,d,e);if(!n)return;const r={kind:"rule",selector:e,declarations:[{property:"animation",value:n}]};return t&&(r.media=t),r};for(const[o,r]of Object.entries(e)){const e=l(o);v[o]=e;const s=p(e,r.declarations);s&&f.push(s);for(const o of r.overrides){if(void 0!==o.state||!o.breakpoint)continue;const r=c(a,o.breakpoint,null!==(t=o.query)&&void 0!==t?t:"exact",o.orientation);if(!r)continue;const s=p(e,null!==(n=o.declarations)&&void 0!==n?n:{},r);s&&f.push(s)}}const m=[];for(const[o,t]of Object.entries(e)){const e=l(o),n=t.overrides.filter(e=>void 0!==e.state);for(const o of W(n)){const t=I[o.state];if(!t)continue;let n;o.breakpoint&&(n=c(a,o.breakpoint,null!==(r=o.query)&&void 0!==r?r:"exact",o.orientation)||void 0);const i=p(`${e}${t}`,null!==(s=o.declarations)&&void 0!==s?s:{},n);i&&m.push(i)}}const b=[];for(const[t,n]of Object.entries(e)){const e=l(t);for(const t of n.overrides){if(!t.container)continue;const n=Y(t,o.containers);if(!n)continue;const r=p(e,null!==(i=t.declarations)&&void 0!==i?i:{},n);r&&b.push(r)}}return{nodes:[...f,...m,...b],variants:v}},K=(e,o)=>{var t,n;const{selector:r,media:s,pathToVar:i,containers:a}=o,l=[],u=_(e.base,i);u.length&&l.push({kind:"rule",selector:r,declarations:u});for(const o of(d=Object.keys(e.states),[...d].sort((e,o)=>{var t,n;return(null!==(t=P[e])&&void 0!==t?t:Number.MAX_SAFE_INTEGER)-(null!==(n=P[o])&&void 0!==n?n:Number.MAX_SAFE_INTEGER)}))){const t=I[o];if(!t)continue;const n=_(e.states[o],i);n.length&&l.push({kind:"rule",selector:`${r}${t}`,declarations:n})}var d;for(const o of e.responsive){const e=o.container?Y(o,a):c(s,o.breakpoint,null!==(t=o.query)&&void 0!==t?t:"exact",o.orientation);if(!e)continue;const u=_(o.declarations,i);if(!u.length)continue;const d=o.state&&null!==(n=I[o.state])&&void 0!==n?n:"";l.push({kind:"rule",selector:`${r}${d}`,media:e,declarations:u})}return l},Q=(e,o={})=>{var t,n;const r=null!==(t=o.indent)&&void 0!==t?t:" ",s=null!==(n=o.newline)&&void 0!==n?n:"\n",i=[],a=Z(e);for(const e of a){if("keyframes"===e.kind){const o=te(e,r,s);if(!o)continue;i.push(`@keyframes ${e.name} {${s}${o}${s}}`);continue}const o="variables"===e.kind?ee(e.variables,r,s):oe(e.declarations,r,s);if(!o)continue;const t=`${e.selector} {${s}${o}${s}}`;e.media?i.push(`${e.media} {${s}${ne(t,r,s)}${s}}`):i.push(t)}return i.filter(Boolean).join(`${s}${s}`)},Z=e=>{const o=e=>{var o;return"variables"===e.kind?`var:${null!==(o=e.media)&&void 0!==o?o:""}:${e.selector}`:""},t=[];for(const n of e){if("variables"!==n.kind){t.push(n);continue}const e=o(n),r=t[t.length-1];r&&"variables"===r.kind&&o(r)===e?r.variables={...r.variables,...n.variables}:t.push({kind:"variables",selector:n.selector,media:n.media,variables:{...n.variables}})}return t},ee=(e,o,t)=>{const n=Object.entries(e);return n.length?n.map(([e,t])=>`${o}${e}: ${t};`).join(t):""},oe=(e,o,t)=>e.length?e.map(({property:e,value:t})=>`${o}${e}: ${t};`).join(t):"",te=(e,o,t)=>e.steps.map(e=>{if(!e.declarations.length)return"";const n=e.declarations.map(({property:e,value:t})=>`${o}${o}${e}: ${t};`).join(t);return`${o}${e.stop} {${t}${n}${t}${o}}`}).filter(Boolean).join(t),ne=(e,o,t)=>e.split(t).map(e=>e.length?`${o}${e}`:e).join(t),re=e=>{const o=[],t=[];for(const n of e)"variables"===n.kind?o.push(n):t.push(n);return{variables:o,rules:t}},se=e=>Q(re(e).variables),ie=e=>Q(re(e).rules),ae=/var\((--[^)]+)\)/,ce=e=>{const o=new Map;for(const t of e)if("variables"===t.kind)for(const[e,n]of Object.entries(t.variables))ae.test(n)||o.set(e,n);for(const t of e)if("variables"===t.kind)for(const[e,n]of Object.entries(t.variables)){if(o.has(e))continue;const t=n.match(ae);if(t){const n=o.get(t[1]);n&&o.set(e,n)}}return o},le=e=>{const o=ce(e),t=e=>{if("string"!=typeof e.value)return;const t=e.value.match(ae);if(!t)return;e.ref=t[1];const n=o.get(t[1]);void 0!==n&&(e.resolved=n)};for(const o of e)if("keyframes"!==o.kind){if("rule"===o.kind)for(const e of o.declarations)t(e)}else for(const e of o.steps)for(const o of e.declarations)t(o)},ue=(i={})=>e({name:"css",version:1,allowedStates:G,bind(e,c){var l,d,v,p,m,g,j,O,N,x,S,R,_,I,G,P,W,z,Y;const U=c.media,D=null!==(l=i.inline)&&void 0!==l&&l,H=r({prefix:i.prefix,classPrefix:i.classPrefix}),Z=s(H,i.naming),ee=Z.variableName,oe=null!==(d=i.colorFormat)&&void 0!==d?d:"rgb",te=e=>{const o=null==e?"":String(e);return o&&"rgb"!==oe?"hex"===oe?t(o):n(o):o},ne={},re={},ae=(e,o,t)=>{const n=[],r={};for(const[s,i]of Object.entries(o)){const{nodes:o,variants:a}=L(i,{media:U,selectorBuilder:o=>`.${Z.className("recipe",e,s,o)}`,pathToVar:t,containers:c.containers});n.push(...o),r[s]=a}return{recipeNodes:n,selectors:r}},ue=e.subsystems.colors;if(ue){const e=null!==(v=ue.properties)&&void 0!==v?v:{},o=((e,o)=>y("colors",e,o))(e,ee);Object.assign(re,o);const t=((e,o)=>{var t,n,r;const{varName:s,formatColor:i}=o,a=(e,o,t)=>b(s,"colors",e,o,t),c={};for(const[o,s]of Object.entries(e)){if(void 0!==s.base.external)continue;c[a(o)]=i(s.base.value);const e=null===(t=s.extras)||void 0===t?void 0:t.text;e&&null!=e.value&&""!==e.value&&(c[a(o,void 0,"text")]=i(e.value));for(const[e,t]of Object.entries(null!==(n=s.variants)&&void 0!==n?n:{})){c[a(o,e)]=i(t.base.value);for(const[n,s]of Object.entries(null!==(r=t.extras)&&void 0!==r?r:{}))null!=s.value&&""!==s.value&&(c[a(o,e,n)]=i(s.value))}}return[...f(c),...u(e,o.media,a,e=>i(e.value)),...h(e,s,i)]})(e,{varName:ee,media:U,formatColor:te}),{recipeNodes:n,selectors:r}=ae("colors",null!==(p=ue.ruleSets)&&void 0!==p?p:{},o);ne.colors={variableNodes:t,recipeNodes:n,selectors:r}}const de=e.subsystems.typography;if(de){const e=null!==(m=de.properties)&&void 0!==m?m:{},o=((e,o)=>k("typography",e,o))(e,ee);Object.assign(re,o);const t=((e,o)=>$("typography",e,o,{formatRoot:(e,o)=>a(o)}))(e,{varName:ee,media:U}),{recipeNodes:n,selectors:r}=ae("typography",null!==(g=de.ruleSets)&&void 0!==g?g:{},o);ne.typography={variableNodes:t,recipeNodes:n,selectors:r}}const fe=e.subsystems.effects;if(fe){const e=null!==(j=fe.properties)&&void 0!==j?j:{},o=((e,o)=>k("effects",e,o))(e,ee);Object.assign(re,o);const t=w(e,{varName:ee,media:U,pathToVar:re}),{recipeNodes:n,selectors:r}=ae("effects",null!==(O=fe.ruleSets)&&void 0!==O?O:{},o);ne.effects={variableNodes:t,recipeNodes:n,selectors:r}}const ve=e.subsystems.borders;if(ve){const e=null!==(N=ve.properties)&&void 0!==N?N:{},o=((e,o)=>k("borders",e,o))(e,ee);Object.assign(re,o);const t=((e,o)=>$("borders",e,o,{formatRoot:(e,o)=>a(o)}))(e,{varName:ee,media:U}),{recipeNodes:n,selectors:r}=ae("borders",null!==(x=ve.ruleSets)&&void 0!==x?x:{},re);ne.borders={variableNodes:t,recipeNodes:n,selectors:r}}const pe=e.subsystems.layout;if(pe){const e=null!==(S=pe.properties)&&void 0!==S?S:{},o=((e,o)=>{const{regular:t,config:n}=T(e),r=k("layout",t,o);for(const e of A){const t=`layout.${e}`;t in r||(r[t]=o(t))}for(const e of Object.keys(n))r[`layout.${e}`]=o(`layout.${e}`);return r})(e,ee);Object.assign(re,o);const{regular:t,config:n}=T(e),r=[...V(t,{varName:ee,media:U}),...q(n,{varName:ee,pathToVar:o})],s=[],i={};for(const[e,t]of Object.entries(null!==(R=pe.ruleSets)&&void 0!==R?R:{})){const n=o=>`.${Z.className("recipe","layout",e,o)}`,r="container"===e?B:L,{nodes:a,variants:l}=r(t,{media:U,selectorBuilder:n,pathToVar:o,containers:c.containers});s.push(...a),i[e]=l}ne.layout={variableNodes:r,recipeNodes:s,selectors:i}}const me=e.subsystems.animation;if(me){const e=null!==(_=me.properties)&&void 0!==_?_:{},o=((e,o)=>k("animation",e,o))(e,ee);Object.assign(re,o);const t=E(e,{varName:ee,media:U}),n=null!==(I=me.keyframes)&&void 0!==I?I:{},r=((e,o)=>{const t=[];for(const[n,r]of Object.entries(e)){const e=r.steps.map(e=>({stop:e.stop,declarations:Object.entries(e.declarations).map(([e,t])=>({property:e,value:M(t,o)}))}));t.push({kind:"keyframes",name:n,steps:e})}return t})(n,re),s=new Set(Object.keys(n)),i=[...r],a={};for(const[e,o]of Object.entries(null!==(G=me.ruleSets)&&void 0!==G?G:{})){const{nodes:t,variants:n}=J(o,{media:U,selectorBuilder:o=>`.${Z.className("recipe","animation",e,o)}`,pathToVar:re,keyframeNames:s,containers:c.containers});i.push(...t),a[e]=n}ne.animation={variableNodes:t,recipeNodes:i,selectors:a}}const be={},he=e.subsystems.components;if(he){const e=[],o={},t=e=>{var o,t;const n=(e=>{const[o,t]=e.split(":");if(!o||!t)return;const n=t.indexOf(".");return n<0?void 0:{subsystem:o,group:t.slice(0,n),variant:t.slice(n+1)}})(e);if(!n)return;const r=null===(t=null===(o=ne[n.subsystem])||void 0===o?void 0:o.selectors[n.group])||void 0===t?void 0:t[n.variant];return null==r?void 0:r.replace(/^\./,"")};for(const[n,r]of Object.entries(null!==(P=he.ruleSets)&&void 0!==P?P:{})){const{nodes:s,variants:i}=L(r,{media:U,selectorBuilder:e=>`.${Z.className("recipe","components",n,e)}`,pathToVar:re,containers:c.containers});e.push(...s),o[n]=i,be[n]={};for(const[e,o]of Object.entries(r)){const r=i[e].replace(/^\./,""),s=[...(null!==(W=o.references)&&void 0!==W?W:[]).map(t).filter(e=>void 0!==e),r];be[n][e]={className:s.join(" "),classList:s}}}ne.components={variableNodes:[],recipeNodes:e,selectors:o}}const ye=e.subsystems.globals;if(ye){const e=((e,o,t,n)=>{var r;const s=[];for(const i of Object.values(e))for(const e of Object.values(i))if("globals"===e.kind){const i=e.selector;if(!i)continue;X(s,i,e.declarations,e.overrides,o,t,n);for(const[a,c]of Object.entries(null!==(r=e.variants)&&void 0!==r?r:{})){const e=F(i,`.${a}`);X(s,e,c.declarations,c.overrides,o,t,n)}}else s.push(...C(e,o));return s})(null!==(z=ye.ruleSets)&&void 0!==z?z:{},re,U,c.containers);ne.globals={variableNodes:[],recipeNodes:e,selectors:{}}}const $e=e=>Z.className("container","containers","context",e),ge=((e,o)=>{const t=[];for(const[n,r]of Object.entries(null!=e?e:{}))t.push({kind:"rule",selector:`.${o(n)}`,declarations:[{property:"container-type",value:r.type},{property:"container-name",value:n}]});return t})(e.containers,$e),ke=()=>{const o=[];ne.globals&&o.push(...ne.globals.recipeNodes),o.push(...ge);for(const t of Object.keys(e.subsystems)){if("globals"===t)continue;const e=ne[t];e&&o.push(...e.variableNodes,...e.recipeNodes)}return le(o),o},je=!0===i.layer?"refract":"string"==typeof i.layer&&i.layer||void 0,Oe=null!==(Y=i.reducedMotion)&&void 0!==Y&&Y,Ne=e=>{let o=e;if(je){const t=e.trimEnd().split("\n").map(e=>e?` ${e}`:e).join("\n");o=`@layer ${je} {\n${t}\n}\n`}return Oe&&(o=`${o.trimEnd()}\n\n@media (prefers-reduced-motion: reduce) {\n *, *::before, *::after {\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n scroll-behavior: auto !important;\n }\n}\n`),o},xe=e=>{if(!D)return Q(e);const o=ce(e),t=e=>{if("string"!=typeof e.value)return{property:e.property,value:e.value};const t=e.value.replace(/var\((--[^)]+)\)/g,(e,t)=>{const n=o.get(t);return void 0!==n?String(n):e});return{property:e.property,value:t}},n=[];for(const o of e)"rule"===o.kind?n.push({...o,declarations:o.declarations.map(t)}):"keyframes"===o.kind&&n.push({...o,steps:o.steps.map(e=>({stop:e.stop,declarations:e.declarations.map(t)}))});return Q(n)},we=()=>{const o={};for(const[e,t]of Object.entries(ne)){if("globals"===e)continue;if("components"===e){o[e]=be;continue}const n={};for(const[e,o]of Object.entries(t.selectors))n[e]=Object.fromEntries(Object.entries(o).map(([e,o])=>[e,o.replace(/^\./,"")]));o[e]=n}if(e.containers&&Object.keys(e.containers).length){const t={};for(const o of Object.keys(e.containers))t[o]=$e(o);o.containers={context:t}}return o},Se=(e,o,t)=>{var n,r;return null===(r=null===(n=ne[e])||void 0===n?void 0:n.selectors[o])||void 0===r?void 0:r[t]},Ee=(e,o,t)=>{var n,r;const s=null===(r=null===(n=we()[e])||void 0===n?void 0:n[o])||void 0===r?void 0:r[t];if(void 0!==s)return"string"==typeof s?s:s.className},Re=(e,o,t)=>{const n=ne[e],r=Se(e,o,t);if(!n||!r)return"";const s=n.recipeNodes.filter(e=>"rule"===e.kind&&((e,o)=>e===o||e.startsWith(`${o}:`)||e.startsWith(`${o}[`))(e.selector,r));return xe(s)};return{recipeName(e,o,t){var n;return(null!==(n=Se(e,o,t))&&void 0!==n?n:"").replace(/^\./,"")},renderRecipe:Re,renderVariables(e){var o,t;return Q(null!==(t=null===(o=ne[e])||void 0===o?void 0:o.variableNodes)&&void 0!==t?t:[])},join:e=>e.filter(Boolean).join("\n\n"),renderAllVariables:()=>se(ke()),renderAllRecipes:()=>ie(ke()),renderAll:()=>Ne(xe(ke())),describeUsage(){var o;const t=[];for(const[n,r]of Object.entries(e.subsystems))for(const[e,s]of Object.entries(null!==(o=r.ruleSets)&&void 0!==o?o:{}))for(const o of Object.keys(s)){const r=Ee(n,e,o);r&&t.push({subsystem:n,group:e,variant:o,name:r})}return{format:"css",summary:["Import the stylesheet once, then apply the recipe class names below to your elements.",'Example: `import "./theme.css";` then `<button class="<class>">`.',"Values are CSS custom properties (`var(--…)`), so runtime theming = override the variables under a selector or `[data-theme]`."],recipes:t}},extend:()=>({media:U,renderRecipe:Re,getClass:Ee,varName:e=>re[e],get css(){return Ne(xe(ke()))},get variablesCss(){return se(ke())},get recipesCss(){return ie(ke())},get nodes(){return ke()},get classes(){return we()}}),emit(t){var n,r,s,i,a,l,u,d,f;const v=null!==(n=null==t?void 0:t.type)&&void 0!==n?n:"single";if((je||Oe)&&"single"!==v){const e=je?"layer":"reducedMotion";throw new Error(`The \`${e}\` option is only supported with single-file emit (got "${v}"). Emit one file, or drop \`${e}\` for split/subsystem/components.`)}if("single"===v){const e="single"===(null==t?void 0:t.type)?t.file:"theme.css";return{files:{[e]:Ne(xe(ke()))}}}if(D&&("split"===v||"subsystem"===v))throw new Error(`css adapter: emit mode '${v}' cannot be combined with the global inline option (inline bakes values, leaving no variables file)`);if("split"===(null==t?void 0:t.type)){const e=ke();return{files:{[t.file]:ie(e),[t.variables]:se(e)}}}if("subsystem"===(null==t?void 0:t.type)){ke();const o={};for(const n of Object.keys(e.subsystems)){const e=ne[n];if(!e)continue;const r=se(e.variableNodes),s=ie(e.recipeNodes);r&&(o[t.filename(n,"variables")]=r),s&&(o[t.filename(n,"styles")]=s)}return{files:o}}if("components"===(null==t?void 0:t.type)){const n=null!==(s=null===(r=e.subsystems.components)||void 0===r?void 0:r.ruleSets)&&void 0!==s?s:{},v=[];for(const o of Object.keys(e.subsystems)){const e=ne[o];e&&v.push(...e.variableNodes)}if(!1===t.inline){const r={},s=[],u=new Set;for(const[d,f]of Object.entries(n))for(const n of Object.keys(f)){const f=o(e,d,n),v=null===(a=null===(i=ne.components)||void 0===i?void 0:i.selectors[d])||void 0===a?void 0:a[n];if(!v)continue;const p=K(f,{selector:v,media:U,pathToVar:re,containers:c.containers}),m=t.filename({group:d,variant:n});(null!==(l=r[m])&&void 0!==l?l:r[m]=[]).push(Q(p));for(const e of f.referencedPaths){const o=re[e];o&&!u.has(o)&&(u.add(o),s.push(o))}}const d={};for(const[e,o]of Object.entries(r))d[e]=o.join("\n\n");if(!1!==t.variables){const e=ce(v.filter(e=>!e.media)),o={};for(const t of s){const n=e.get(t);void 0!==n&&(o[t]=n)}const n=[{kind:"variables",selector:":root",variables:o}];for(const e of v){if(!e.media||":root"!==e.selector)continue;const o={};for(const[t,n]of Object.entries(e.variables))u.has(t)&&(o[t]=n);Object.keys(o).length&&n.push({kind:"variables",selector:e.selector,media:e.media,variables:o})}const r=se(n);r&&(d[t.variables]=r)}return{files:d}}const p={};for(const[r,s]of Object.entries(n))for(const n of Object.keys(s)){const s=o(e,r,n),i=null===(d=null===(u=ne.components)||void 0===u?void 0:u.selectors[r])||void 0===d?void 0:d[n];if(!i)continue;const a=K(s,{selector:i,media:U,pathToVar:re,containers:c.containers});le([...v,...a]);const l=a.map(e=>({...e,declarations:e.declarations.map(e=>{const o=void 0!==e.resolved?e.resolved:e.value;if("string"==typeof o&&o.includes("var("))throw new Error(`css adapter: emit mode 'components' (inline): '${e.property}' on '${i}' has an unresolved token reference (${o}) — no baked value`);return{property:e.property,value:o}})})),m=t.filename({group:r,variant:n});(null!==(f=p[m])&&void 0!==f?f:p[m]=[]).push(Q(l))}const m={};for(const[e,o]of Object.entries(p))m[e]=o.join("\n\n");return{files:m}}throw new Error(`css adapter: emit mode '${v}' not yet implemented`)}}}});export{ue as createCssAdapter};
|
|
1
|
+
import{defineAdapter as e,mergeComponentRuleSet as t}from"@theme-registry/refract";import{toHexColor as o,toOklchColor as n}from"@theme-registry/refract/color-math";import{resolveNaming as r,createNamer as s}from"@theme-registry/refract/adapter-kit";const i=e=>null==e?"":String(e),a=e=>void 0!==e.unit?`${e.value}${e.unit}`:i(e.value),l=(e,t,o,n)=>{var r;if(!n){const n=e[t];return null!==(r=null==n?void 0:n[o])&&void 0!==r?r:""}const s={orientation:n};return"min"===o?e.min(t,s):"max"===o?e.max(t,s):e.exact(t,s)},c=(e,t)=>{const o=e=>e.replace(/^@media\s*/,"");return`@media ${o(e)} and ${o(t)}`},u=(e,t,o,n)=>{var r,s;const i=new Map,a=(e,t,o)=>{const n=`${e}||${t}`,r=i.get(n);r?Object.assign(r.variables,o):i.set(n,{media:e,selector:t,variables:{...o}})};for(const[i,u]of Object.entries(e))for(const e of null!==(r=u.responsive)&&void 0!==r?r:[]){const r=l(t,e.breakpoint,null!==(s=e.query)&&void 0!==s?s:"exact",e.orientation);if(!r)continue;const u=d(i,e,o,n);if(!Object.keys(u).length)continue;const f=e.mode;if(f){a(r,`:root[data-theme="${f}"]`,u);const e=v[f];e&&a(c(r,e),":root",u)}else a(r,":root",u)}return Array.from(i.values(),({media:e,selector:t,variables:o})=>({kind:"variables",selector:t,media:e,variables:o}))},d=(e,t,o,n)=>{var r;const{ref:s,target:i}=t,a={};void 0!==s&&(a[o(e,i)]=`var(${o(e,s)})`);for(const[s,l]of Object.entries(null!==(r=t.overrides)&&void 0!==r?r:{})){a["base"===s?o(e,i):o(e,i,s)]=n(l)}return a},f=e=>Object.keys(e).length?[{kind:"variables",selector:":root",variables:e}]:[],v={dark:"@media (prefers-color-scheme: dark)",light:"@media (prefers-color-scheme: light)"},p=(e,t)=>{let o=e.get(t);return o||(o={},e.set(t,o)),o},m=e=>{const t=[];for(const[o,n]of e){if(!Object.keys(n).length)continue;const e=v[o];e&&t.push({kind:"variables",selector:":root",media:e,variables:{...n}}),t.push({kind:"variables",selector:`:root[data-theme="${o}"]`,variables:{...n}})}return t},b=(e,t,o,n,r)=>e([t,o,n,r].filter(Boolean).join(".")),h=(e,t,o)=>{var n;const r=new Map;for(const[s,i]of Object.entries(e))if(i.modes)for(const e of i.modes){if(void 0===e.mode)continue;const i=p(r,e.mode),a=e.target,l=null!==(n=e.overrides)&&void 0!==n?n:{},c=l.base;c&&null!=c.value&&(i[b(t,"colors",s,a)]=o(c.value));for(const[e,n]of Object.entries(l))"base"!==e&&n&&null!=n.value&&""!==n.value&&(i[b(t,"colors",s,a,e)]=o(n.value))}return m(r)},y=(e,t,o)=>{var n,r,s,i;const a={};for(const[l,c]of Object.entries(t)){a[`${e}.${l}`]=null!==(n=c.base.external)&&void 0!==n?n:o(`${e}.${l}`);for(const[t,n]of Object.entries(null!==(r=c.extras)&&void 0!==r?r:{}))null!=(null==n?void 0:n.value)&&""!==n.value&&(a[`${e}.${l}.${t}`]=o(`${e}.${l}.${t}`));for(const[t,n]of Object.entries(null!==(s=c.variants)&&void 0!==s?s:{})){a[`${e}.${l}.${t}`]=o(`${e}.${l}.${t}`);for(const r of Object.keys(null!==(i=n.extras)&&void 0!==i?i:{}))a[`${e}.${l}.${t}.${r}`]=o(`${e}.${l}.${t}.${r}`)}}return a},g=(e,t,o,n)=>{var r,s,i;const{varName:l}=o,c=(t,o,n)=>b(l,e,t,o,n),d={};for(const[e,o]of Object.entries(t))if(void 0===o.base.external){d[c(e)]=n.formatRoot(e,o.base);for(const[t,i]of Object.entries(null!==(r=o.variants)&&void 0!==r?r:{})){d[c(e,t)]=n.formatRoot(e,i.base);for(const[o,r]of Object.entries(null!==(s=i.extras)&&void 0!==s?s:{}))d[c(e,t,o)]=n.formatRoot(e,r)}}const v=null!==(i=n.formatResponsive)&&void 0!==i?i:a;return[...f(d),...u(t,o.media,c,v),...$(t,(e,t)=>c(e,t),n.formatRoot)]},$=(e,t,o)=>{var n;const r=new Map;for(const[s,i]of Object.entries(e))if(i.modes)for(const e of i.modes){if(void 0===e.mode)continue;const i=null===(n=e.overrides)||void 0===n?void 0:n.base;null==i||null==i.struct&&null==i.value||(p(r,e.mode)[t(s,e.target)]=o(s,i))}return m(r)},k=(e,t,o)=>y(e,t,o),j=(e,t)=>{const o=`0${(e=>{for(const t of[e.offsetX,e.offsetY,e.blur,e.spread])if(void 0!==t&&"number"!=typeof t)return t.unit;return"px"})(e)}`,n=e=>void 0===e?o:(e=>"number"==typeof e?String(e):`${e.value}${e.unit}`)(e),r=[];return e.inset&&r.push("inset"),r.push(n(e.offsetX),n(e.offsetY)),null!=e.spread?r.push(n(e.blur),n(e.spread)):null!=e.blur&&r.push(n(e.blur)),e.color&&r.push(((e,t)=>{const o=t[e];return o?`var(${o})`:e})(e.color,t)),r.join(" ")},O=(e,t)=>e.map(e=>j(e,t)).join(", "),N=e=>{var t;const o=[e.property];return null==e.duration&&null==e.delay||o.push(`${null!==(t=e.duration)&&void 0!==t?t:0}ms`),e.timingFunction&&o.push(e.timingFunction),null!=e.delay&&o.push(`${e.delay}ms`),o.join(" ")},x=e=>e.map(N).join(", "),w=(e,t)=>{var o;const n=null!==(o=t.pathToVar)&&void 0!==o?o:{};return g("effects",e,t,{formatRoot:(e,t)=>t.struct?((e,t,o)=>"transitions"===e?x(t):O(t,o))(e,t.struct,n):a(t),formatResponsive:e=>e.struct?((e,t)=>{const o=e[0];return o&&"object"==typeof o&&"property"in o?x(e):O(e,t)})(e.struct,n):a(e)})},S=new Set(["duration","delay"]),E=(e,t)=>g("animation",e,t,{formatRoot:(e,t)=>"number"==typeof t.value&&S.has(e)?`${t.value}ms`:i(t.value),formatResponsive:e=>{return"number"==typeof(t=e.value)?`${t}ms`:i(t);var t}}),R=e=>e.includes("--"),T=e=>{const t={},o={};for(const[n,r]of Object.entries(e))R(n)?o[n]=r:t[n]=r;return{regular:t,config:o}},V=(e,t)=>g("layout",e,t,{formatRoot:(e,t)=>a(t)}),A=["spacing","gutters","aspectRatio"],B=(e,t)=>{const o=new Map;for(const[n,r]of Object.entries(e)){const e=n.split("--")[0];let s=o.get(e);s||(s={},o.set(e,s)),s[t.varName(`layout.${n}`)]=String(M(r.base,t.pathToVar))}return Array.from(o.values(),e=>({kind:"variables",selector:":root",variables:e}))},q=(e,t)=>{var o,n;const{media:r,selectorBuilder:s,pathToVar:i}=t,a=Object.entries(e),c={};for(const[e]of a)c[e]=s(e);const u=[];for(let e=a.length-1;e>=0;e--){const[t,o]=a[e],n=C(o.declarations,i);n.length&&u.push({kind:"rule",selector:s(t),declarations:n})}const d=[];for(const[e,t]of a)for(const a of t.overrides){if(void 0!==a.state||!a.breakpoint)continue;const t=l(r,a.breakpoint,null!==(o=a.query)&&void 0!==o?o:"exact",a.orientation);if(!t)continue;const c=C(null!==(n=a.declarations)&&void 0!==n?n:{},i);c.length&&d.push({kind:"rule",selector:s(e),media:t,declarations:c})}return{nodes:[...u,...d],variants:c}},M=(e,t)=>{var o;if(void 0===e.ref)return e.value;const n=`var(${null!==(o=t[e.ref])&&void 0!==o?o:e.ref})`;return e.wrap?`${e.wrap}(${n})`:n},C=(e,t)=>Object.entries(e).map(([e,o])=>({property:e,value:M(o,t)})),_=(e,t)=>e.split(",").map(e=>`${e.trim()}${t}`).join(","),F=(e,t)=>{const o=e.selector;if(!o)return[];const n=[];for(const[o,r]of Object.entries(e.declarations)){if(void 0===r.ref){n.push({property:o,value:r.value});continue}const e=t[r.ref];e&&n.push({property:o,value:`var(${e})`})}return n.length?[{kind:"rule",selector:`:where(${o})`,declarations:n}]:[]},P=(e,t,o,n,r,s,i)=>{var a,c,u,d,f;const v=C(o,r);v.length&&e.push({kind:"rule",selector:t,declarations:v});for(const o of n){if(void 0!==o.state||void 0!==o.container||!o.breakpoint)continue;const n=l(s,o.breakpoint,null!==(a=o.query)&&void 0!==a?a:"exact",o.orientation);if(!n)continue;const i=C(null!==(c=o.declarations)&&void 0!==c?c:{},r);i.length&&e.push({kind:"rule",selector:t,media:n,declarations:i})}const p=n.filter(e=>void 0!==e.state);for(const o of W(p)){const n=X[o.state];if(!n)continue;const i=C(null!==(u=o.declarations)&&void 0!==u?u:{},r);if(!i.length)continue;const a={kind:"rule",selector:_(t,n),declarations:i};if(o.breakpoint){const e=l(s,o.breakpoint,null!==(d=o.query)&&void 0!==d?d:"exact",o.orientation);e&&(a.media=e)}e.push(a)}for(const o of n){if(!o.container)continue;const n=L(o,i);if(!n)continue;const s=C(null!==(f=o.declarations)&&void 0!==f?f:{},r);s.length&&e.push({kind:"rule",selector:t,media:n,declarations:s})}},X={link:":link",visited:":visited",hover:":hover",focus:":focus",active:":active",disabled:"[disabled]",pressed:"[aria-pressed]"},I=Object.keys(X),G=I.reduce((e,t,o)=>(e[t]=o,e),{}),W=e=>[...e].map((e,t)=>({override:e,index:t})).sort((e,t)=>{var o,n;const r=null!==(o=G[e.override.state])&&void 0!==o?o:Number.MAX_SAFE_INTEGER,s=null!==(n=G[t.override.state])&&void 0!==n?n:Number.MAX_SAFE_INTEGER;if(r!==s)return r-s;const i=e.override.breakpoint?1:0,a=t.override.breakpoint?1:0;return i!==a?i-a:e.index-t.index}).map(({override:e})=>e),z=(e,t,o,n)=>{var r,s;const i=e.overrides.filter(e=>void 0!==e.state&&!e.target);if(!i.length)return[];const a=[];for(const e of W(i)){const i=X[e.state];if(!i)continue;const c=C(null!==(r=e.declarations)&&void 0!==r?r:{},n);if(!c.length)continue;const u={kind:"rule",selector:`${t}${i}`,declarations:c};if(e.breakpoint){const t=l(o,e.breakpoint,null!==(s=e.query)&&void 0!==s?s:"exact",e.orientation);t&&(u.media=t)}a.push(u)}return a},L=(e,t)=>{var o;if(!e.container||!e.size)return"";const n=null==t?void 0:t[e.container];if(!n)return"";return n[null!==(o=e.query)&&void 0!==o?o:"min"](e.size)},Y=(e,t)=>{var o,n,r,s,i;const{media:a,selectorBuilder:c,pathToVar:u}=t,d=[],f={};for(const[t,r]of Object.entries(e)){const e=c(t);f[t]=e;const s=C(r.declarations,u);s.length&&d.push({kind:"rule",selector:e,declarations:s});for(const t of r.overrides){if(void 0!==t.state||!t.breakpoint)continue;const r=l(a,t.breakpoint,null!==(o=t.query)&&void 0!==o?o:"exact",t.orientation);if(!r)continue;const s=C(null!==(n=t.declarations)&&void 0!==n?n:{},u);s.length&&d.push({kind:"rule",selector:e,media:r,declarations:s})}}const v=[];for(const[t,o]of Object.entries(e))v.push(...z(o,c(t),a,u));const p=[];for(const[t,o]of Object.entries(e))for(const e of o.overrides){if(void 0===e.state||!e.target)continue;const o=X[e.state];if(!o)continue;const n=C(null!==(r=e.declarations)&&void 0!==r?r:{},u);if(!n.length)continue;const i={kind:"rule",selector:`${c(`${t}-${e.target}`)}${o}`,declarations:n};if(e.breakpoint){const t=l(a,e.breakpoint,null!==(s=e.query)&&void 0!==s?s:"exact",e.orientation);t&&(i.media=t)}p.push(i)}const m=[];for(const[o,n]of Object.entries(e)){const e=c(o);for(const o of n.overrides){if(!o.container)continue;const n=L(o,t.containers);if(!n)continue;const r=C(null!==(i=o.declarations)&&void 0!==i?i:{},u);r.length&&m.push({kind:"rule",selector:e,media:n,declarations:r})}}return{nodes:[...d,...v,...m,...p],variants:f}},U="animation.keyframes.",D=["animation-duration","animation-timing-function","animation-delay","animation-iteration-count","animation-direction","animation-fill-mode","animation-play-state","animation-name"],H=(e,t,o)=>{const n=void 0!==e.ref?e.ref.startsWith(U)?e.ref.slice(20):e.ref:i(e.value);if(!t.has(n))throw new Error(`css adapter: animation recipe '${o}' references unknown keyframe '${n}' — no matching entry in animation.keyframes`);return n},J=(e,t)=>{var o,n,r,s,i;const{media:a,selectorBuilder:c,pathToVar:u,keyframeNames:d}=t,f=[],v={},p=(e,t,o)=>{const n=((e,t,o,n)=>{const r=[];for(const s of D){const i=e[s];i&&r.push("animation-name"===s?H(i,o,n):String(M(i,t)))}return r.join(" ")})(t,u,d,e);if(!n)return;const r={kind:"rule",selector:e,declarations:[{property:"animation",value:n}]};return o&&(r.media=o),r};for(const[t,r]of Object.entries(e)){const e=c(t);v[t]=e;const s=p(e,r.declarations);s&&f.push(s);for(const t of r.overrides){if(void 0!==t.state||!t.breakpoint)continue;const r=l(a,t.breakpoint,null!==(o=t.query)&&void 0!==o?o:"exact",t.orientation);if(!r)continue;const s=p(e,null!==(n=t.declarations)&&void 0!==n?n:{},r);s&&f.push(s)}}const m=[];for(const[t,o]of Object.entries(e)){const e=c(t),n=o.overrides.filter(e=>void 0!==e.state);for(const t of W(n)){const o=X[t.state];if(!o)continue;let n;t.breakpoint&&(n=l(a,t.breakpoint,null!==(r=t.query)&&void 0!==r?r:"exact",t.orientation)||void 0);const i=p(`${e}${o}`,null!==(s=t.declarations)&&void 0!==s?s:{},n);i&&m.push(i)}}const b=[];for(const[o,n]of Object.entries(e)){const e=c(o);for(const o of n.overrides){if(!o.container)continue;const n=L(o,t.containers);if(!n)continue;const r=p(e,null!==(i=o.declarations)&&void 0!==i?i:{},n);r&&b.push(r)}}return{nodes:[...f,...m,...b],variants:v}},K=(e,t)=>{var o,n;const{selector:r,media:s,pathToVar:i,containers:a}=t,c=[],u=C(e.base,i);u.length&&c.push({kind:"rule",selector:r,declarations:u});for(const t of(d=Object.keys(e.states),[...d].sort((e,t)=>{var o,n;return(null!==(o=G[e])&&void 0!==o?o:Number.MAX_SAFE_INTEGER)-(null!==(n=G[t])&&void 0!==n?n:Number.MAX_SAFE_INTEGER)}))){const o=X[t];if(!o)continue;const n=C(e.states[t],i);n.length&&c.push({kind:"rule",selector:`${r}${o}`,declarations:n})}var d;for(const t of e.responsive){const e=t.container?L(t,a):l(s,t.breakpoint,null!==(o=t.query)&&void 0!==o?o:"exact",t.orientation);if(!e)continue;const u=C(t.declarations,i);if(!u.length)continue;const d=t.state&&null!==(n=X[t.state])&&void 0!==n?n:"";c.push({kind:"rule",selector:`${r}${d}`,media:e,declarations:u})}return c},Q=(e,t={})=>{var o,n;const r=null!==(o=t.indent)&&void 0!==o?o:" ",s=null!==(n=t.newline)&&void 0!==n?n:"\n",i=[],a=Z(e);for(const e of a){if("keyframes"===e.kind){const t=oe(e,r,s);if(!t)continue;i.push(`@keyframes ${e.name} {${s}${t}${s}}`);continue}const t="variables"===e.kind?ee(e.variables,r,s):te(e.declarations,r,s);if(!t)continue;const o=`${e.selector} {${s}${t}${s}}`;e.media?i.push(`${e.media} {${s}${ne(o,r,s)}${s}}`):i.push(o)}return i.filter(Boolean).join(`${s}${s}`)},Z=e=>{const t=e=>{var t;return"variables"===e.kind?`var:${null!==(t=e.media)&&void 0!==t?t:""}:${e.selector}`:""},o=[];for(const n of e){if("variables"!==n.kind){o.push(n);continue}const e=t(n),r=o[o.length-1];r&&"variables"===r.kind&&t(r)===e?r.variables={...r.variables,...n.variables}:o.push({kind:"variables",selector:n.selector,media:n.media,variables:{...n.variables}})}return o},ee=(e,t,o)=>{const n=Object.entries(e);return n.length?n.map(([e,o])=>`${t}${e}: ${o};`).join(o):""},te=(e,t,o)=>e.length?e.map(({property:e,value:o})=>`${t}${e}: ${o};`).join(o):"",oe=(e,t,o)=>e.steps.map(e=>{if(!e.declarations.length)return"";const n=e.declarations.map(({property:e,value:o})=>`${t}${t}${e}: ${o};`).join(o);return`${t}${e.stop} {${o}${n}${o}${t}}`}).filter(Boolean).join(o),ne=(e,t,o)=>e.split(o).map(e=>e.length?`${t}${e}`:e).join(o),re=e=>{const t=[],o=[];for(const n of e)"variables"===n.kind?t.push(n):o.push(n);return{variables:t,rules:o}},se=e=>Q(re(e).variables),ie=e=>Q(re(e).rules),ae=/var\((--[^)]+)\)/,le=e=>{const t=new Map;for(const o of e)if("variables"===o.kind)for(const[e,n]of Object.entries(o.variables))ae.test(n)||t.set(e,n);for(const o of e)if("variables"===o.kind)for(const[e,n]of Object.entries(o.variables)){if(t.has(e))continue;const o=n.match(ae);if(o){const n=t.get(o[1]);n&&t.set(e,n)}}return t},ce=e=>{const t=le(e),o=e=>{if("string"!=typeof e.value)return;const o=e.value.match(ae);if(!o)return;e.ref=o[1];const n=t.get(o[1]);void 0!==n&&(e.resolved=n)};for(const t of e)if("keyframes"!==t.kind){if("rule"===t.kind)for(const e of t.declarations)o(e)}else for(const e of t.steps)for(const t of e.declarations)o(t)},ue=e=>{const[t,o]=e.split(":");if(!t||!o)return;const n=o.indexOf(".");return n<0?void 0:{subsystem:t,group:o.slice(0,n),variant:o.slice(n+1)}},de=(i={})=>e({name:"css",version:1,allowedStates:I,bind(e,l){var c,d,v,p,m,$,j,O,N,x,S,R,C,G,W,z,L,U,D;const H=l.media,Z=null!==(c=i.inline)&&void 0!==c&&c,ee=r({prefix:i.prefix,classPrefix:i.classPrefix}),te=s(ee,i.naming),oe=te.variableName,ne=null!==(d=i.colorFormat)&&void 0!==d?d:"rgb",re=e=>{const t=null==e?"":String(e);return t&&"rgb"!==ne?"hex"===ne?o(t):n(t):t},ae={},de={},fe=(e,t,o)=>{const n=[],r={};for(const[s,i]of Object.entries(t)){const{nodes:t,variants:a}=Y(i,{media:H,selectorBuilder:t=>`.${te.className("recipe",e,s,t)}`,pathToVar:o,containers:l.containers});n.push(...t),r[s]=a}return{recipeNodes:n,selectors:r}},ve=e.subsystems.colors;if(ve){const e=null!==(v=ve.properties)&&void 0!==v?v:{},t=((e,t)=>y("colors",e,t))(e,oe);Object.assign(de,t);const o=((e,t)=>{var o,n,r;const{varName:s,formatColor:i}=t,a=(e,t,o)=>b(s,"colors",e,t,o),l={};for(const[t,s]of Object.entries(e)){if(void 0!==s.base.external)continue;l[a(t)]=i(s.base.value);const e=null===(o=s.extras)||void 0===o?void 0:o.text;e&&null!=e.value&&""!==e.value&&(l[a(t,void 0,"text")]=i(e.value));for(const[e,o]of Object.entries(null!==(n=s.variants)&&void 0!==n?n:{})){l[a(t,e)]=i(o.base.value);for(const[n,s]of Object.entries(null!==(r=o.extras)&&void 0!==r?r:{}))null!=s.value&&""!==s.value&&(l[a(t,e,n)]=i(s.value))}}return[...f(l),...u(e,t.media,a,e=>i(e.value)),...h(e,s,i)]})(e,{varName:oe,media:H,formatColor:re}),{recipeNodes:n,selectors:r}=fe("colors",null!==(p=ve.ruleSets)&&void 0!==p?p:{},t);ae.colors={variableNodes:o,recipeNodes:n,selectors:r}}const pe=e.subsystems.typography;if(pe){const e=null!==(m=pe.properties)&&void 0!==m?m:{},t=((e,t)=>k("typography",e,t))(e,oe);Object.assign(de,t);const o=((e,t)=>g("typography",e,t,{formatRoot:(e,t)=>a(t)}))(e,{varName:oe,media:H}),{recipeNodes:n,selectors:r}=fe("typography",null!==($=pe.ruleSets)&&void 0!==$?$:{},t);ae.typography={variableNodes:o,recipeNodes:n,selectors:r}}const me=e.subsystems.effects;if(me){const e=null!==(j=me.properties)&&void 0!==j?j:{},t=((e,t)=>k("effects",e,t))(e,oe);Object.assign(de,t);const o=w(e,{varName:oe,media:H,pathToVar:de}),{recipeNodes:n,selectors:r}=fe("effects",null!==(O=me.ruleSets)&&void 0!==O?O:{},t);ae.effects={variableNodes:o,recipeNodes:n,selectors:r}}const be=e.subsystems.borders;if(be){const e=null!==(N=be.properties)&&void 0!==N?N:{},t=((e,t)=>k("borders",e,t))(e,oe);Object.assign(de,t);const o=((e,t)=>g("borders",e,t,{formatRoot:(e,t)=>a(t)}))(e,{varName:oe,media:H}),{recipeNodes:n,selectors:r}=fe("borders",null!==(x=be.ruleSets)&&void 0!==x?x:{},de);ae.borders={variableNodes:o,recipeNodes:n,selectors:r}}const he=e.subsystems.layout;if(he){const e=null!==(S=he.properties)&&void 0!==S?S:{},t=((e,t)=>{const{regular:o,config:n}=T(e),r=k("layout",o,t);for(const e of A){const o=`layout.${e}`;o in r||(r[o]=t(o))}for(const e of Object.keys(n))r[`layout.${e}`]=t(`layout.${e}`);return r})(e,oe);Object.assign(de,t);const{regular:o,config:n}=T(e),r=[...V(o,{varName:oe,media:H}),...B(n,{varName:oe,pathToVar:t})],s=[],i={};for(const[e,o]of Object.entries(null!==(R=he.ruleSets)&&void 0!==R?R:{})){const n=t=>`.${te.className("recipe","layout",e,t)}`,r="container"===e?q:Y,{nodes:a,variants:c}=r(o,{media:H,selectorBuilder:n,pathToVar:t,containers:l.containers});s.push(...a),i[e]=c}ae.layout={variableNodes:r,recipeNodes:s,selectors:i}}const ye=e.subsystems.animation;if(ye){const e=null!==(C=ye.properties)&&void 0!==C?C:{},t=((e,t)=>k("animation",e,t))(e,oe);Object.assign(de,t);const o=E(e,{varName:oe,media:H}),n=null!==(G=ye.keyframes)&&void 0!==G?G:{},r=((e,t)=>{const o=[];for(const[n,r]of Object.entries(e)){const e=r.steps.map(e=>({stop:e.stop,declarations:Object.entries(e.declarations).map(([e,o])=>({property:e,value:M(o,t)}))}));o.push({kind:"keyframes",name:n,steps:e})}return o})(n,de),s=new Set(Object.keys(n)),i=[...r],a={};for(const[e,t]of Object.entries(null!==(W=ye.ruleSets)&&void 0!==W?W:{})){const{nodes:o,variants:n}=J(t,{media:H,selectorBuilder:t=>`.${te.className("recipe","animation",e,t)}`,pathToVar:de,keyframeNames:s,containers:l.containers});i.push(...o),a[e]=n}ae.animation={variableNodes:o,recipeNodes:i,selectors:a}}const ge={},$e=e.subsystems.components;if($e){const e=[],t={},o=e=>{var t,o;const n=ue(e);if(!n)return;const r=null===(o=null===(t=ae[n.subsystem])||void 0===t?void 0:t.selectors[n.group])||void 0===o?void 0:o[n.variant];return null==r?void 0:r.replace(/^\./,"")};for(const[n,r]of Object.entries(null!==(z=$e.ruleSets)&&void 0!==z?z:{})){const{nodes:s,variants:i}=Y(r,{media:H,selectorBuilder:e=>`.${te.className("recipe","components",n,e)}`,pathToVar:de,containers:l.containers});e.push(...s),t[n]=i,ge[n]={};for(const[e,t]of Object.entries(r)){const r=i[e].replace(/^\./,""),s=[...(null!==(L=t.references)&&void 0!==L?L:[]).map(o).filter(e=>void 0!==e),r];ge[n][e]={className:s.join(" "),classList:s}}}ae.components={variableNodes:[],recipeNodes:e,selectors:t}}const ke=e.subsystems.globals;if(ke){const e=((e,t,o,n)=>{var r;const s=[];for(const i of Object.values(e))for(const e of Object.values(i))if("globals"===e.kind){const i=e.selector;if(!i)continue;P(s,i,e.declarations,e.overrides,t,o,n);for(const[a,l]of Object.entries(null!==(r=e.variants)&&void 0!==r?r:{})){const e=_(i,`.${a}`);P(s,e,l.declarations,l.overrides,t,o,n)}}else s.push(...F(e,t));return s})(null!==(U=ke.ruleSets)&&void 0!==U?U:{},de,H,l.containers);ae.globals={variableNodes:[],recipeNodes:e,selectors:{}}}const je=e=>te.className("container","containers","context",e),Oe=((e,t)=>{const o=[];for(const[n,r]of Object.entries(null!=e?e:{}))o.push({kind:"rule",selector:`.${t(n)}`,declarations:[{property:"container-type",value:r.type},{property:"container-name",value:n}]});return o})(e.containers,je),Ne=()=>{const t=[];ae.globals&&t.push(...ae.globals.recipeNodes),t.push(...Oe);for(const o of Object.keys(e.subsystems)){if("globals"===o)continue;const e=ae[o];e&&t.push(...e.variableNodes,...e.recipeNodes)}return ce(t),t},xe=!0===i.layer?"refract":"string"==typeof i.layer&&i.layer||void 0,we=null!==(D=i.reducedMotion)&&void 0!==D&&D,Se=e=>{let t=e;if(xe){const o=e.trimEnd().split("\n").map(e=>e?` ${e}`:e).join("\n");t=`@layer ${xe} {\n${o}\n}\n`}return we&&(t=`${t.trimEnd()}\n\n@media (prefers-reduced-motion: reduce) {\n *, *::before, *::after {\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n scroll-behavior: auto !important;\n }\n}\n`),t},Ee=e=>{if(!Z)return Q(e);const t=le(e),o=e=>{if("string"!=typeof e.value)return{property:e.property,value:e.value};const o=e.value.replace(/var\((--[^)]+)\)/g,(e,o)=>{const n=t.get(o);return void 0!==n?String(n):e});return{property:e.property,value:o}},n=[];for(const t of e)"rule"===t.kind?n.push({...t,declarations:t.declarations.map(o)}):"keyframes"===t.kind&&n.push({...t,steps:t.steps.map(e=>({stop:e.stop,declarations:e.declarations.map(o)}))});return Q(n)},Re=()=>{const t={};for(const[e,o]of Object.entries(ae)){if("globals"===e)continue;if("components"===e){t[e]=ge;continue}const n={};for(const[e,t]of Object.entries(o.selectors))n[e]=Object.fromEntries(Object.entries(t).map(([e,t])=>[e,t.replace(/^\./,"")]));t[e]=n}if(e.containers&&Object.keys(e.containers).length){const o={};for(const t of Object.keys(e.containers))o[t]=je(t);t.containers={context:o}}return t},Te=(e,t,o)=>{var n,r;return null===(r=null===(n=ae[e])||void 0===n?void 0:n.selectors[t])||void 0===r?void 0:r[o]},Ve=(e,t,o)=>{var n,r;const s=null===(r=null===(n=Re()[e])||void 0===n?void 0:n[t])||void 0===r?void 0:r[o];if(void 0!==s)return"string"==typeof s?s:s.className},Ae=(e,t,o)=>{const n=ae[e],r=Te(e,t,o);if(!n||!r)return"";const s=n.recipeNodes.filter(e=>"rule"===e.kind&&((e,t)=>e===t||e.startsWith(`${t}:`)||e.startsWith(`${t}[`))(e.selector,r));return Ee(s)};return{recipeName(e,t,o){var n;return(null!==(n=Te(e,t,o))&&void 0!==n?n:"").replace(/^\./,"")},renderRecipe:Ae,renderVariables(e){var t,o;return Q(null!==(o=null===(t=ae[e])||void 0===t?void 0:t.variableNodes)&&void 0!==o?o:[])},join:e=>e.filter(Boolean).join("\n\n"),renderAllVariables:()=>se(Ne()),renderAllRecipes:()=>ie(Ne()),renderAll:()=>Se(Ee(Ne())),describeUsage(){var t;const o=[];for(const[n,r]of Object.entries(e.subsystems))for(const[e,s]of Object.entries(null!==(t=r.ruleSets)&&void 0!==t?t:{}))for(const t of Object.keys(s)){const r=Ve(n,e,t);r&&o.push({subsystem:n,group:e,variant:t,name:r})}return{format:"css",summary:["Import the stylesheet once, then apply the recipe class names below to your elements.",'Example: `import "./theme.css";` then `<button class="<class>">`.',"Values are CSS custom properties (`var(--…)`), so runtime theming = override the variables under a selector or `[data-theme]`."],recipes:o}},describePreview(t,o){const n=new Set(o),r=(...e)=>e.filter(e=>"string"==typeof e&&n.has(e)),s=e=>"components"!==t.type||"components"===e.subsystem,i=t=>{var o,n,r;return null===(r=null===(n=null===(o=e.subsystems[t.subsystem])||void 0===o?void 0:o.ruleSets)||void 0===n?void 0:n[t.group])||void 0===r?void 0:r[t.variant]},a="rfp-s-",l={markup:e=>{var o;if(!s(e))return;const n="components"===t.type?(null!==(o=Te(e.subsystem,e.group,e.variant))&&void 0!==o?o:"").replace(/^\./,""):Ve(e.subsystem,e.group,e.variant);return n?{attrs:{class:n}}:void 0},modeAttribute:"data-theme",tokenName:e=>de[e],states:e=>{var t,o;if(!s(e))return[];const n=new Set((null!==(o=null===(t=i(e))||void 0===t?void 0:t.overrides)&&void 0!==o?o:[]).map(e=>e.state).filter(e=>"string"==typeof e));return I.filter(e=>n.has(e))},statePinClass:e=>X[e]?`${a}${e}`:void 0,statePinCss:(()=>{var e;Ne();const t=[];for(const o of Object.values(ae))for(const n of null!==(e=null==o?void 0:o.recipeNodes)&&void 0!==e?e:[])if("rule"===n.kind)for(const[e,o]of Object.entries(X))if(n.selector.includes(o)){t.push({...n,selector:n.selector.split(o).join(`.${a}${e}`)});break}return t.length?Q(t):""})(),composition:e=>{var t,o,n,r;const s=null===(o=null===(t=Re()[e.subsystem])||void 0===t?void 0:t[e.group])||void 0===o?void 0:o[e.variant];if(!s||"string"==typeof s)return;const a=s.classList;if(!a||a.length<2)return;const l=null!==(r=null===(n=i(e))||void 0===n?void 0:n.references)&&void 0!==r?r:[];return a.map((e,t)=>{const o=l[t]?ue(l[t]):void 0;return{className:e,from:o?`${o.subsystem}.${o.group}.${o.variant}`:void 0}})}};switch(t.type){case"single":return{...l,stylesheets:r(t.file)};case"split":return{...l,stylesheets:r(t.variables,t.file)};case"subsystem":{const o=Object.keys(e.subsystems);return{...l,stylesheets:[...r(...o.map(e=>t.filename(e,"variables"))),...r(...o.map(e=>t.filename(e,"styles")))],groupBy:e=>e.subsystem}}case"components":{const e=e=>t.filename({group:e.group,variant:e.variant}),n=!1===t.variables?[]:r(t.variables),i=o.filter(e=>!n.includes(e));return{...l,stylesheets:[...n,...i],groupBy:t=>s(t)?e(t):"not emitted in components mode",notes:!1===t.variables&&!1===t.inline?["This target emits component rules that reference CSS variables but no variables file (`variables: false`), so the preview renders them undefined — supply the variables yourself in the consuming app."]:void 0}}}},extend:()=>({media:H,renderRecipe:Ae,getClass:Ve,varName:e=>de[e],get css(){return Se(Ee(Ne()))},get variablesCss(){return se(Ne())},get recipesCss(){return ie(Ne())},get nodes(){return Ne()},get classes(){return Re()}}),emit(o){var n,r,s,i,a,c,u,d,f;const v=null!==(n=null==o?void 0:o.type)&&void 0!==n?n:"single";if((xe||we)&&"single"!==v){const e=xe?"layer":"reducedMotion";throw new Error(`The \`${e}\` option is only supported with single-file emit (got "${v}"). Emit one file, or drop \`${e}\` for split/subsystem/components.`)}if("single"===v){const e="single"===(null==o?void 0:o.type)?o.file:"theme.css";return{files:{[e]:Se(Ee(Ne()))}}}if(Z&&("split"===v||"subsystem"===v))throw new Error(`css adapter: emit mode '${v}' cannot be combined with the global inline option (inline bakes values, leaving no variables file)`);if("split"===(null==o?void 0:o.type)){const e=Ne();return{files:{[o.file]:ie(e),[o.variables]:se(e)}}}if("subsystem"===(null==o?void 0:o.type)){Ne();const t={};for(const n of Object.keys(e.subsystems)){const e=ae[n];if(!e)continue;const r=se(e.variableNodes),s=ie(e.recipeNodes);r&&(t[o.filename(n,"variables")]=r),s&&(t[o.filename(n,"styles")]=s)}return{files:t}}if("components"===(null==o?void 0:o.type)){const n=null!==(s=null===(r=e.subsystems.components)||void 0===r?void 0:r.ruleSets)&&void 0!==s?s:{},v=[];for(const t of Object.keys(e.subsystems)){const e=ae[t];e&&v.push(...e.variableNodes)}if(!1===o.inline){const r={},s=[],u=new Set;for(const[d,f]of Object.entries(n))for(const n of Object.keys(f)){const f=t(e,d,n),v=null===(a=null===(i=ae.components)||void 0===i?void 0:i.selectors[d])||void 0===a?void 0:a[n];if(!v)continue;const p=K(f,{selector:v,media:H,pathToVar:de,containers:l.containers}),m=o.filename({group:d,variant:n});(null!==(c=r[m])&&void 0!==c?c:r[m]=[]).push(Q(p));for(const e of f.referencedPaths){const t=de[e];t&&!u.has(t)&&(u.add(t),s.push(t))}}const d={};for(const[e,t]of Object.entries(r))d[e]=t.join("\n\n");if(!1!==o.variables){const e=le(v.filter(e=>!e.media)),t={};for(const o of s){const n=e.get(o);void 0!==n&&(t[o]=n)}const n=[{kind:"variables",selector:":root",variables:t}];for(const e of v){if(!e.media||":root"!==e.selector)continue;const t={};for(const[o,n]of Object.entries(e.variables))u.has(o)&&(t[o]=n);Object.keys(t).length&&n.push({kind:"variables",selector:e.selector,media:e.media,variables:t})}const r=se(n);r&&(d[o.variables]=r)}return{files:d}}const p={};for(const[r,s]of Object.entries(n))for(const n of Object.keys(s)){const s=t(e,r,n),i=null===(d=null===(u=ae.components)||void 0===u?void 0:u.selectors[r])||void 0===d?void 0:d[n];if(!i)continue;const a=K(s,{selector:i,media:H,pathToVar:de,containers:l.containers});ce([...v,...a]);const c=a.map(e=>({...e,declarations:e.declarations.map(e=>{const t=void 0!==e.resolved?e.resolved:e.value;if("string"==typeof t&&t.includes("var("))throw new Error(`css adapter: emit mode 'components' (inline): '${e.property}' on '${i}' has an unresolved token reference (${t}) — no baked value`);return{property:e.property,value:t}})})),m=o.filename({group:r,variant:n});(null!==(f=p[m])&&void 0!==f?f:p[m]=[]).push(Q(c))}const m={};for(const[e,t]of Object.entries(p))m[e]=t.join("\n\n");return{files:m}}throw new Error(`css adapter: emit mode '${v}' not yet implemented`)}}}});export{de as createCssAdapter};
|
|
2
2
|
//# sourceMappingURL=index.esm.js.map
|