@pandacss/transformer 2.0.0-beta.14 → 2.0.0-beta.16

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.d.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  import * as _rolldown from 'rolldown';
2
- import * as unplugin from 'unplugin';
3
2
  import * as _rollup from 'rollup';
4
3
  import * as _webpack from 'webpack';
5
- import * as _vite from 'vite';
4
+ import * as unplugin from 'unplugin';
6
5
  import * as _pandacss_compiler_shared from '@pandacss/compiler-shared';
7
6
  import { PandaTransformerOptions, PandaSourceTransformContext, PandaSourceTransformResult, Compiler, SourceTransformer, TransformerOptions, TransformSourceRequest, TransformResult } from '@pandacss/compiler-shared';
8
7
  export { PandaSourceTransformContext, PandaSourceTransformResult, PandaTransformerOptions, SourceTransformer, TransformResult, TransformSourceInput, TransformSourceRequest, TransformerOptions } from '@pandacss/compiler-shared';
@@ -36,7 +35,7 @@ declare function createSourceTransformer(compiler: Compiler): SourceTransformer;
36
35
  declare function transformSource(input: TransformSourceRequest): TransformResult;
37
36
  declare function shouldTransform(path: string, options?: TransformerOptions): boolean;
38
37
 
39
- declare const vite: (options: _pandacss_compiler_shared.PandaTransformerOptions) => _vite.Plugin<any> | _vite.Plugin<any>[];
38
+ declare const vite: (options: _pandacss_compiler_shared.PandaTransformerOptions) => unplugin.VitePlugin<any> | unplugin.VitePlugin<any>[];
40
39
  declare const webpack: (options: _pandacss_compiler_shared.PandaTransformerOptions) => _webpack.WebpackPluginInstance;
41
40
  declare const rollup: (options: _pandacss_compiler_shared.PandaTransformerOptions) => _rollup.Plugin<any> | _rollup.Plugin<any>[];
42
41
  declare const esbuild: (options: _pandacss_compiler_shared.PandaTransformerOptions) => unplugin.EsbuildPlugin;
package/dist/index.js CHANGED
@@ -362,6 +362,20 @@ function cva(config) {
362
362
  }
363
363
 
364
364
  // src/runtime/internal/sva.ts
365
+ function variantsForSlot(variants, slot) {
366
+ if (!variants) return void 0;
367
+ const out = {};
368
+ for (const key in variants) {
369
+ const options = {};
370
+ for (const option in variants[key]) {
371
+ const value = variants[key][option];
372
+ const cls = typeof value === "string" ? value : value?.[slot];
373
+ if (cls) options[option] = cls;
374
+ }
375
+ out[key] = options;
376
+ }
377
+ return out;
378
+ }
365
379
  function compoundsForSlot(compounds, slot) {
366
380
  if (!compounds?.length) return void 0;
367
381
  const out = [];
@@ -392,7 +406,7 @@ function sva(config) {
392
406
  slot,
393
407
  cva({
394
408
  base,
395
- variants: config.variants,
409
+ variants: variantsForSlot(config.variants, slot),
396
410
  defaultVariants: config.defaultVariants,
397
411
  compoundVariants: compoundsForSlot(config.compoundVariants, slot)
398
412
  })
@@ -421,7 +435,7 @@ function sva(config) {
421
435
  }
422
436
 
423
437
  // src/runtime/internal/source.ts
424
- var internalCssSource = 'var D="__PANDA_CX_SEPARATOR__";function w(n,r){let t=n.length;if(t>0&&n.charCodeAt(t-1)===33&&(t-=1),t===0)return null;let e=0,s=-1;for(let i=0;i<t;i++){let d=n.charCodeAt(i);d===91?e++:d===93?e--:d===58&&e===0&&(s=i)}let o=s+1,a=n.indexOf(r,o);if(a<o+1||a>=t)return null;let l=n.slice(o,a);return s===-1?l:`${n.slice(0,s)}:${l}`}function S(n,r){for(let t of n)if(t){if(Array.isArray(t)){S(t,r);continue}t!==""&&r.push(t)}}function H(n,r){let t=new Map,e=[],s=0;for(let a of r){let l=0;for(let i=0;i<=a.length;i++){if(i!==a.length&&a.charCodeAt(i)!==32)continue;if(i===l){l=i+1;continue}let d=a.slice(l,i);l=i+1;let u=w(d,n);if(u!==null)t.has(u)||e.push(u),t.set(u,d);else{let c=`__${s++}`;e.push(c),t.set(c,d)}}}if(e.length===0)return"";if(e.length===1)return t.get(e[0]);let o=t.get(e[0]);for(let a=1;a<e.length;a++)o+=` ${t.get(e[a])}`;return o}function P(n={}){let r=n.separator??D;return function(...e){if(e.length===1){let o=e[0];if(typeof o=="string")return o;if(!o)return""}let s=[];return S(e,s),s.length===0?"":s.length===1?s[0]:H(r,s)}}var y=P();function O(...n){return y(...n)}function R(n,r){let t={...n};for(let e in r)r[e]!==void 0&&(t[e]=r[e]);return t}function k(n,r){let t={},e={};for(let s in n)r.has(s)?e[s]=n[s]:t[s]=n[s];return[t,e]}function N(n){let r={};for(let t in n)r[t]=Object.keys(n[t]??{});return r}function T(n,r){for(let t in n){if(t==="css"||t==="className"||t==="classNames")continue;let e=n[t],s=r[t];if(Array.isArray(e)){if(!e.includes(s))return!1}else if(s!==e)return!1}return!0}function K(n,r,t){if(t==null)return;let e=n[r]?.[t];return typeof e=="string"&&e?e:void 0}function x(n){let r=new Map,t="",e,s=!1;return(o={})=>{let a="";for(let d in o){let u=o[d];u!==void 0&&(a+=`${d}:${String(u)}|`)}if(s&&a===t)return e;let l=r.get(a);if(l!==void 0)return t=a,e=l,s=!0,l;let i=n(o);return r.set(a,i),r.size>500&&r.delete(r.keys().next().value),t=a,e=i,s=!0,i}}function _(n){return n.length===0?"":n.length===1?n[0]:y(...n)}function L(n){if(!n)return!1;let r=Object.keys(n);return r.length===1&&r[0]==="true"&&typeof n.true=="string"}function $(n,r,t,e){if(!(e||r.length===0||r.length>12)){for(let s of r)if(!L(n[s]))return;for(let s in t){if(!r.includes(s))return;let o=t[s];if(o!==!0&&o!==!1&&o!=="true"&&o!=="false")return}return r}}function M(n){return n===!0||n==="true"}function E(n,r,t,e,s){let o=$(r,t,e,s);if(!o)return;let a=o.length,l=0;for(let u=0;u<a;u++)M(e[o[u]])&&(l|=1<<u);let i=new Array(1<<a),d=u=>{let c=[];n&&c.push(n);for(let f=0;f<a;f++)u&1<<f&&c.push(r[o[f]].true);return _(c)};return(u={})=>{let c=l;for(let f=0;f<a;f++){let g=u[o[f]];g!==void 0&&(M(g)?c|=1<<f:c&=~(1<<f))}return i[c]??=d(c)}}var X=4096;function F(n){let r=new Map;for(let t=0;t<n.length;t++){let e=n[t],s=t+1;if(r.set(e,s),e==="true")r.set(!0,s);else if(e==="false")r.set(!1,s);else{let o=Number(e);e!==""&&!Number.isNaN(o)&&r.set(o,s)}}return r}function j(n,r,t,e,s){if(s||t.length===0)return;let o=[],a=1;for(let u of t){let c=Object.keys(r[u]??{});if(c.length===0||(o.push({key:u,options:c,index:F(c),radix:c.length+1,stride:a}),a*=c.length+1,a>X))return}let l=0;for(let u in e){let c=o.find(g=>g.key===u);if(!c)return;let f=c.index.get(e[u]);if(f===void 0)return;l+=f*c.stride}let i=new Array(a),d=u=>{let c=[];n&&c.push(n);for(let f of o){let g=Math.floor(u/f.stride)%f.radix;if(g===0)continue;let p=r[f.key][f.options[g-1]];p&&c.push(p)}return _(c)};return(u={})=>{let c=l;for(let f=0;f<o.length;f++){let g=o[f],p=u[g.key];if(p===void 0)continue;let C=g.index.get(p)??0,m=Math.floor(c/g.stride)%g.radix;c+=(C-m)*g.stride}return i[c]??=d(c)}}function I(n,r){let t=[...n];for(let e of r)t.includes(e)||t.push(e);return t}function h(n){let r=n.base??"",t=n.variants??{},e=n.defaultVariants??{},s=n.compoundVariants??[],o=Object.keys(t),a=new Set(o),l=Object.keys(e).length>0,i=s.length>0,d=(f={})=>{let g=l?R(e,f):f,p=[];r&&p.push(r);for(let C of o){let m=K(t,C,g[C]);m&&p.push(m)}if(i)for(let C of s){if(!T(C,g))continue;let m=C.className??C.css;typeof m=="string"&&m&&p.push(m)}return _(p)},u=E(r,t,o,e,i)??j(r,t,o,e,i)??x(d),c=f=>{let g=f.config,p=g.variants??{},C={};for(let m of I(f.variantKeys,o)){let v={...t[m]},b=p[m]??{};for(let V in b){let A=v[V];v[V]=A?y(A,b[V]):b[V]}C[m]=v}return h({base:y(r,g.base),variants:C,defaultVariants:{...e,...g.defaultVariants},compoundVariants:[...s,...g.compoundVariants??[]]})};return Object.assign(u,{__cva__:!0,variantKeys:o,variantMap:N(t),raw:d,merge:c,config:n,getVariantProps:f=>R(e,f),splitVariantProps:f=>k(f,a)})}function q(n,r){if(!n?.length)return;let t=[];for(let e of n){let s={};for(let l in e)l==="css"||l==="className"||l==="classNames"||(s[l]=e[l]);let o=e.css;typeof o=="string"?s.css=o:o&&typeof o=="object"&&r in o&&(s.css=o[r]);let a=e.classNames?.[r]??e.className;a&&(s.className=a),(s.css||s.className)&&t.push(s)}return t.length?t:void 0}function B(n){let r=n.slots??Object.keys(n.base??{}),t=n.defaultVariants??{},e=Object.keys(n.variants??{}),s=new Set(e),o=r.map(i=>{let d=n.base?.[i];return n.className?.[i]&&(d=y(d,n.className[i])),[i,h({base:d,variants:n.variants,defaultVariants:n.defaultVariants,compoundVariants:q(n.compoundVariants,i)})]}),a=(i={})=>{let d={};for(let[u,c]of o)d[u]=c(i);return d},l=(i={})=>{let d={};for(let[u,c]of o)d[u]=c.raw(i);return d};return Object.assign(x(a),{__cva__:!1,raw:l,config:n,variantMap:Object.fromEntries(e.map(i=>[i,Object.keys(n.variants?.[i]??{})])),variantKeys:e,classNameMap:n.className??{},getVariantProps:i=>R(t,i),splitVariantProps:i=>k(i,s)})}export{O as css,h as cva,y as cx,B as sva};\n';
438
+ var internalCssSource = 'var D="__PANDA_CX_SEPARATOR__";function w(n,r){let t=n.length;if(t>0&&n.charCodeAt(t-1)===33&&(t-=1),t===0)return null;let e=0,s=-1;for(let i=0;i<t;i++){let d=n.charCodeAt(i);d===91?e++:d===93?e--:d===58&&e===0&&(s=i)}let o=s+1,a=n.indexOf(r,o);if(a<o+1||a>=t)return null;let l=n.slice(o,a);return s===-1?l:`${n.slice(0,s)}:${l}`}function S(n,r){for(let t of n)if(t){if(Array.isArray(t)){S(t,r);continue}t!==""&&r.push(t)}}function H(n,r){let t=new Map,e=[],s=0;for(let a of r){let l=0;for(let i=0;i<=a.length;i++){if(i!==a.length&&a.charCodeAt(i)!==32)continue;if(i===l){l=i+1;continue}let d=a.slice(l,i);l=i+1;let u=w(d,n);if(u!==null)t.has(u)||e.push(u),t.set(u,d);else{let c=`__${s++}`;e.push(c),t.set(c,d)}}}if(e.length===0)return"";if(e.length===1)return t.get(e[0]);let o=t.get(e[0]);for(let a=1;a<e.length;a++)o+=` ${t.get(e[a])}`;return o}function M(n={}){let r=n.separator??D;return function(...e){if(e.length===1){let o=e[0];if(typeof o=="string")return o;if(!o)return""}let s=[];return S(e,s),s.length===0?"":s.length===1?s[0]:H(r,s)}}var V=M();function P(...n){return V(...n)}function y(n,r){let t={...n};for(let e in r)r[e]!==void 0&&(t[e]=r[e]);return t}function k(n,r){let t={},e={};for(let s in n)r.has(s)?e[s]=n[s]:t[s]=n[s];return[t,e]}function N(n){let r={};for(let t in n)r[t]=Object.keys(n[t]??{});return r}function T(n,r){for(let t in n){if(t==="css"||t==="className"||t==="classNames")continue;let e=n[t],s=r[t];if(Array.isArray(e)){if(!e.includes(s))return!1}else if(s!==e)return!1}return!0}function K(n,r,t){if(t==null)return;let e=n[r]?.[t];return typeof e=="string"&&e?e:void 0}function x(n){let r=new Map,t="",e,s=!1;return(o={})=>{let a="";for(let d in o){let u=o[d];u!==void 0&&(a+=`${d}:${String(u)}|`)}if(s&&a===t)return e;let l=r.get(a);if(l!==void 0)return t=a,e=l,s=!0,l;let i=n(o);return r.set(a,i),r.size>500&&r.delete(r.keys().next().value),t=a,e=i,s=!0,i}}function _(n){return n.length===0?"":n.length===1?n[0]:V(...n)}function L(n){if(!n)return!1;let r=Object.keys(n);return r.length===1&&r[0]==="true"&&typeof n.true=="string"}function $(n,r,t,e){if(!(e||r.length===0||r.length>12)){for(let s of r)if(!L(n[s]))return;for(let s in t){if(!r.includes(s))return;let o=t[s];if(o!==!0&&o!==!1&&o!=="true"&&o!=="false")return}return r}}function O(n){return n===!0||n==="true"}function E(n,r,t,e,s){let o=$(r,t,e,s);if(!o)return;let a=o.length,l=0;for(let u=0;u<a;u++)O(e[o[u]])&&(l|=1<<u);let i=new Array(1<<a),d=u=>{let c=[];n&&c.push(n);for(let f=0;f<a;f++)u&1<<f&&c.push(r[o[f]].true);return _(c)};return(u={})=>{let c=l;for(let f=0;f<a;f++){let g=u[o[f]];g!==void 0&&(O(g)?c|=1<<f:c&=~(1<<f))}return i[c]??=d(c)}}var X=4096;function F(n){let r=new Map;for(let t=0;t<n.length;t++){let e=n[t],s=t+1;if(r.set(e,s),e==="true")r.set(!0,s);else if(e==="false")r.set(!1,s);else{let o=Number(e);e!==""&&!Number.isNaN(o)&&r.set(o,s)}}return r}function j(n,r,t,e,s){if(s||t.length===0)return;let o=[],a=1;for(let u of t){let c=Object.keys(r[u]??{});if(c.length===0||(o.push({key:u,options:c,index:F(c),radix:c.length+1,stride:a}),a*=c.length+1,a>X))return}let l=0;for(let u in e){let c=o.find(g=>g.key===u);if(!c)return;let f=c.index.get(e[u]);if(f===void 0)return;l+=f*c.stride}let i=new Array(a),d=u=>{let c=[];n&&c.push(n);for(let f of o){let g=Math.floor(u/f.stride)%f.radix;if(g===0)continue;let p=r[f.key][f.options[g-1]];p&&c.push(p)}return _(c)};return(u={})=>{let c=l;for(let f=0;f<o.length;f++){let g=o[f],p=u[g.key];if(p===void 0)continue;let C=g.index.get(p)??0,m=Math.floor(c/g.stride)%g.radix;c+=(C-m)*g.stride}return i[c]??=d(c)}}function I(n,r){let t=[...n];for(let e of r)t.includes(e)||t.push(e);return t}function R(n){let r=n.base??"",t=n.variants??{},e=n.defaultVariants??{},s=n.compoundVariants??[],o=Object.keys(t),a=new Set(o),l=Object.keys(e).length>0,i=s.length>0,d=(f={})=>{let g=l?y(e,f):f,p=[];r&&p.push(r);for(let C of o){let m=K(t,C,g[C]);m&&p.push(m)}if(i)for(let C of s){if(!T(C,g))continue;let m=C.className??C.css;typeof m=="string"&&m&&p.push(m)}return _(p)},u=E(r,t,o,e,i)??j(r,t,o,e,i)??x(d),c=f=>{let g=f.config,p=g.variants??{},C={};for(let m of I(f.variantKeys,o)){let b={...t[m]},v=p[m]??{};for(let h in v){let A=b[h];b[h]=A?V(A,v[h]):v[h]}C[m]=b}return R({base:V(r,g.base),variants:C,defaultVariants:{...e,...g.defaultVariants},compoundVariants:[...s,...g.compoundVariants??[]]})};return Object.assign(u,{__cva__:!0,variantKeys:o,variantMap:N(t),raw:d,merge:c,config:n,getVariantProps:f=>y(e,f),splitVariantProps:f=>k(f,a)})}function q(n,r){if(!n)return;let t={};for(let e in n){let s={};for(let o in n[e]){let a=n[e][o],l=typeof a=="string"?a:a?.[r];l&&(s[o]=l)}t[e]=s}return t}function z(n,r){if(!n?.length)return;let t=[];for(let e of n){let s={};for(let l in e)l==="css"||l==="className"||l==="classNames"||(s[l]=e[l]);let o=e.css;typeof o=="string"?s.css=o:o&&typeof o=="object"&&r in o&&(s.css=o[r]);let a=e.classNames?.[r]??e.className;a&&(s.className=a),(s.css||s.className)&&t.push(s)}return t.length?t:void 0}function B(n){let r=n.slots??Object.keys(n.base??{}),t=n.defaultVariants??{},e=Object.keys(n.variants??{}),s=new Set(e),o=r.map(i=>{let d=n.base?.[i];return n.className?.[i]&&(d=V(d,n.className[i])),[i,R({base:d,variants:q(n.variants,i),defaultVariants:n.defaultVariants,compoundVariants:z(n.compoundVariants,i)})]}),a=(i={})=>{let d={};for(let[u,c]of o)d[u]=c(i);return d},l=(i={})=>{let d={};for(let[u,c]of o)d[u]=c.raw(i);return d};return Object.assign(x(a),{__cva__:!1,raw:l,config:n,variantMap:Object.fromEntries(e.map(i=>[i,Object.keys(n.variants?.[i]??{})])),variantKeys:e,classNameMap:n.className??{},getVariantProps:i=>y(t,i),splitVariantProps:i=>k(i,s)})}export{P as css,R as cva,V as cx,B as sva};\n';
425
439
 
426
440
  // src/runtime/internal/load.ts
427
441
  var CX_SEPARATOR_PLACEHOLDER = "__PANDA_CX_SEPARATOR__";
@@ -38,11 +38,13 @@ type SvaCompound = Record<string, unknown> & {
38
38
  className?: string;
39
39
  classNames?: Record<string, string>;
40
40
  };
41
+ /** An option is one string for every slot, or a map of the slots it styles. */
42
+ type SlotVariantMap = Record<string, Record<string, string | Record<string, string>>>;
41
43
  type SvaConfig = {
42
44
  slots?: string[];
43
45
  base?: Record<string, string>;
44
- variants?: StringCvaConfig['variants'];
45
- defaultVariants?: StringCvaConfig['defaultVariants'];
46
+ variants?: SlotVariantMap;
47
+ defaultVariants?: Record<string, VariantValue>;
46
48
  compoundVariants?: SvaCompound[];
47
49
  className?: Record<string, string>;
48
50
  };
@@ -362,6 +362,20 @@ function cva(config) {
362
362
  }
363
363
 
364
364
  // src/runtime/internal/sva.ts
365
+ function variantsForSlot(variants, slot) {
366
+ if (!variants) return void 0;
367
+ const out = {};
368
+ for (const key in variants) {
369
+ const options = {};
370
+ for (const option in variants[key]) {
371
+ const value = variants[key][option];
372
+ const cls = typeof value === "string" ? value : value?.[slot];
373
+ if (cls) options[option] = cls;
374
+ }
375
+ out[key] = options;
376
+ }
377
+ return out;
378
+ }
365
379
  function compoundsForSlot(compounds, slot) {
366
380
  if (!compounds?.length) return void 0;
367
381
  const out = [];
@@ -392,7 +406,7 @@ function sva(config) {
392
406
  slot,
393
407
  cva({
394
408
  base,
395
- variants: config.variants,
409
+ variants: variantsForSlot(config.variants, slot),
396
410
  defaultVariants: config.defaultVariants,
397
411
  compoundVariants: compoundsForSlot(config.compoundVariants, slot)
398
412
  })
@@ -1 +1 @@
1
- var D="__PANDA_CX_SEPARATOR__";function w(n,r){let t=n.length;if(t>0&&n.charCodeAt(t-1)===33&&(t-=1),t===0)return null;let e=0,s=-1;for(let i=0;i<t;i++){let d=n.charCodeAt(i);d===91?e++:d===93?e--:d===58&&e===0&&(s=i)}let o=s+1,a=n.indexOf(r,o);if(a<o+1||a>=t)return null;let l=n.slice(o,a);return s===-1?l:`${n.slice(0,s)}:${l}`}function S(n,r){for(let t of n)if(t){if(Array.isArray(t)){S(t,r);continue}t!==""&&r.push(t)}}function H(n,r){let t=new Map,e=[],s=0;for(let a of r){let l=0;for(let i=0;i<=a.length;i++){if(i!==a.length&&a.charCodeAt(i)!==32)continue;if(i===l){l=i+1;continue}let d=a.slice(l,i);l=i+1;let u=w(d,n);if(u!==null)t.has(u)||e.push(u),t.set(u,d);else{let c=`__${s++}`;e.push(c),t.set(c,d)}}}if(e.length===0)return"";if(e.length===1)return t.get(e[0]);let o=t.get(e[0]);for(let a=1;a<e.length;a++)o+=` ${t.get(e[a])}`;return o}function P(n={}){let r=n.separator??D;return function(...e){if(e.length===1){let o=e[0];if(typeof o=="string")return o;if(!o)return""}let s=[];return S(e,s),s.length===0?"":s.length===1?s[0]:H(r,s)}}var y=P();function O(...n){return y(...n)}function R(n,r){let t={...n};for(let e in r)r[e]!==void 0&&(t[e]=r[e]);return t}function k(n,r){let t={},e={};for(let s in n)r.has(s)?e[s]=n[s]:t[s]=n[s];return[t,e]}function N(n){let r={};for(let t in n)r[t]=Object.keys(n[t]??{});return r}function T(n,r){for(let t in n){if(t==="css"||t==="className"||t==="classNames")continue;let e=n[t],s=r[t];if(Array.isArray(e)){if(!e.includes(s))return!1}else if(s!==e)return!1}return!0}function K(n,r,t){if(t==null)return;let e=n[r]?.[t];return typeof e=="string"&&e?e:void 0}function x(n){let r=new Map,t="",e,s=!1;return(o={})=>{let a="";for(let d in o){let u=o[d];u!==void 0&&(a+=`${d}:${String(u)}|`)}if(s&&a===t)return e;let l=r.get(a);if(l!==void 0)return t=a,e=l,s=!0,l;let i=n(o);return r.set(a,i),r.size>500&&r.delete(r.keys().next().value),t=a,e=i,s=!0,i}}function _(n){return n.length===0?"":n.length===1?n[0]:y(...n)}function L(n){if(!n)return!1;let r=Object.keys(n);return r.length===1&&r[0]==="true"&&typeof n.true=="string"}function $(n,r,t,e){if(!(e||r.length===0||r.length>12)){for(let s of r)if(!L(n[s]))return;for(let s in t){if(!r.includes(s))return;let o=t[s];if(o!==!0&&o!==!1&&o!=="true"&&o!=="false")return}return r}}function M(n){return n===!0||n==="true"}function E(n,r,t,e,s){let o=$(r,t,e,s);if(!o)return;let a=o.length,l=0;for(let u=0;u<a;u++)M(e[o[u]])&&(l|=1<<u);let i=new Array(1<<a),d=u=>{let c=[];n&&c.push(n);for(let f=0;f<a;f++)u&1<<f&&c.push(r[o[f]].true);return _(c)};return(u={})=>{let c=l;for(let f=0;f<a;f++){let g=u[o[f]];g!==void 0&&(M(g)?c|=1<<f:c&=~(1<<f))}return i[c]??=d(c)}}var X=4096;function F(n){let r=new Map;for(let t=0;t<n.length;t++){let e=n[t],s=t+1;if(r.set(e,s),e==="true")r.set(!0,s);else if(e==="false")r.set(!1,s);else{let o=Number(e);e!==""&&!Number.isNaN(o)&&r.set(o,s)}}return r}function j(n,r,t,e,s){if(s||t.length===0)return;let o=[],a=1;for(let u of t){let c=Object.keys(r[u]??{});if(c.length===0||(o.push({key:u,options:c,index:F(c),radix:c.length+1,stride:a}),a*=c.length+1,a>X))return}let l=0;for(let u in e){let c=o.find(g=>g.key===u);if(!c)return;let f=c.index.get(e[u]);if(f===void 0)return;l+=f*c.stride}let i=new Array(a),d=u=>{let c=[];n&&c.push(n);for(let f of o){let g=Math.floor(u/f.stride)%f.radix;if(g===0)continue;let p=r[f.key][f.options[g-1]];p&&c.push(p)}return _(c)};return(u={})=>{let c=l;for(let f=0;f<o.length;f++){let g=o[f],p=u[g.key];if(p===void 0)continue;let C=g.index.get(p)??0,m=Math.floor(c/g.stride)%g.radix;c+=(C-m)*g.stride}return i[c]??=d(c)}}function I(n,r){let t=[...n];for(let e of r)t.includes(e)||t.push(e);return t}function h(n){let r=n.base??"",t=n.variants??{},e=n.defaultVariants??{},s=n.compoundVariants??[],o=Object.keys(t),a=new Set(o),l=Object.keys(e).length>0,i=s.length>0,d=(f={})=>{let g=l?R(e,f):f,p=[];r&&p.push(r);for(let C of o){let m=K(t,C,g[C]);m&&p.push(m)}if(i)for(let C of s){if(!T(C,g))continue;let m=C.className??C.css;typeof m=="string"&&m&&p.push(m)}return _(p)},u=E(r,t,o,e,i)??j(r,t,o,e,i)??x(d),c=f=>{let g=f.config,p=g.variants??{},C={};for(let m of I(f.variantKeys,o)){let v={...t[m]},b=p[m]??{};for(let V in b){let A=v[V];v[V]=A?y(A,b[V]):b[V]}C[m]=v}return h({base:y(r,g.base),variants:C,defaultVariants:{...e,...g.defaultVariants},compoundVariants:[...s,...g.compoundVariants??[]]})};return Object.assign(u,{__cva__:!0,variantKeys:o,variantMap:N(t),raw:d,merge:c,config:n,getVariantProps:f=>R(e,f),splitVariantProps:f=>k(f,a)})}function q(n,r){if(!n?.length)return;let t=[];for(let e of n){let s={};for(let l in e)l==="css"||l==="className"||l==="classNames"||(s[l]=e[l]);let o=e.css;typeof o=="string"?s.css=o:o&&typeof o=="object"&&r in o&&(s.css=o[r]);let a=e.classNames?.[r]??e.className;a&&(s.className=a),(s.css||s.className)&&t.push(s)}return t.length?t:void 0}function B(n){let r=n.slots??Object.keys(n.base??{}),t=n.defaultVariants??{},e=Object.keys(n.variants??{}),s=new Set(e),o=r.map(i=>{let d=n.base?.[i];return n.className?.[i]&&(d=y(d,n.className[i])),[i,h({base:d,variants:n.variants,defaultVariants:n.defaultVariants,compoundVariants:q(n.compoundVariants,i)})]}),a=(i={})=>{let d={};for(let[u,c]of o)d[u]=c(i);return d},l=(i={})=>{let d={};for(let[u,c]of o)d[u]=c.raw(i);return d};return Object.assign(x(a),{__cva__:!1,raw:l,config:n,variantMap:Object.fromEntries(e.map(i=>[i,Object.keys(n.variants?.[i]??{})])),variantKeys:e,classNameMap:n.className??{},getVariantProps:i=>R(t,i),splitVariantProps:i=>k(i,s)})}export{O as css,h as cva,y as cx,B as sva};
1
+ var D="__PANDA_CX_SEPARATOR__";function w(n,r){let t=n.length;if(t>0&&n.charCodeAt(t-1)===33&&(t-=1),t===0)return null;let e=0,s=-1;for(let i=0;i<t;i++){let d=n.charCodeAt(i);d===91?e++:d===93?e--:d===58&&e===0&&(s=i)}let o=s+1,a=n.indexOf(r,o);if(a<o+1||a>=t)return null;let l=n.slice(o,a);return s===-1?l:`${n.slice(0,s)}:${l}`}function S(n,r){for(let t of n)if(t){if(Array.isArray(t)){S(t,r);continue}t!==""&&r.push(t)}}function H(n,r){let t=new Map,e=[],s=0;for(let a of r){let l=0;for(let i=0;i<=a.length;i++){if(i!==a.length&&a.charCodeAt(i)!==32)continue;if(i===l){l=i+1;continue}let d=a.slice(l,i);l=i+1;let u=w(d,n);if(u!==null)t.has(u)||e.push(u),t.set(u,d);else{let c=`__${s++}`;e.push(c),t.set(c,d)}}}if(e.length===0)return"";if(e.length===1)return t.get(e[0]);let o=t.get(e[0]);for(let a=1;a<e.length;a++)o+=` ${t.get(e[a])}`;return o}function M(n={}){let r=n.separator??D;return function(...e){if(e.length===1){let o=e[0];if(typeof o=="string")return o;if(!o)return""}let s=[];return S(e,s),s.length===0?"":s.length===1?s[0]:H(r,s)}}var V=M();function P(...n){return V(...n)}function y(n,r){let t={...n};for(let e in r)r[e]!==void 0&&(t[e]=r[e]);return t}function k(n,r){let t={},e={};for(let s in n)r.has(s)?e[s]=n[s]:t[s]=n[s];return[t,e]}function N(n){let r={};for(let t in n)r[t]=Object.keys(n[t]??{});return r}function T(n,r){for(let t in n){if(t==="css"||t==="className"||t==="classNames")continue;let e=n[t],s=r[t];if(Array.isArray(e)){if(!e.includes(s))return!1}else if(s!==e)return!1}return!0}function K(n,r,t){if(t==null)return;let e=n[r]?.[t];return typeof e=="string"&&e?e:void 0}function x(n){let r=new Map,t="",e,s=!1;return(o={})=>{let a="";for(let d in o){let u=o[d];u!==void 0&&(a+=`${d}:${String(u)}|`)}if(s&&a===t)return e;let l=r.get(a);if(l!==void 0)return t=a,e=l,s=!0,l;let i=n(o);return r.set(a,i),r.size>500&&r.delete(r.keys().next().value),t=a,e=i,s=!0,i}}function _(n){return n.length===0?"":n.length===1?n[0]:V(...n)}function L(n){if(!n)return!1;let r=Object.keys(n);return r.length===1&&r[0]==="true"&&typeof n.true=="string"}function $(n,r,t,e){if(!(e||r.length===0||r.length>12)){for(let s of r)if(!L(n[s]))return;for(let s in t){if(!r.includes(s))return;let o=t[s];if(o!==!0&&o!==!1&&o!=="true"&&o!=="false")return}return r}}function O(n){return n===!0||n==="true"}function E(n,r,t,e,s){let o=$(r,t,e,s);if(!o)return;let a=o.length,l=0;for(let u=0;u<a;u++)O(e[o[u]])&&(l|=1<<u);let i=new Array(1<<a),d=u=>{let c=[];n&&c.push(n);for(let f=0;f<a;f++)u&1<<f&&c.push(r[o[f]].true);return _(c)};return(u={})=>{let c=l;for(let f=0;f<a;f++){let g=u[o[f]];g!==void 0&&(O(g)?c|=1<<f:c&=~(1<<f))}return i[c]??=d(c)}}var X=4096;function F(n){let r=new Map;for(let t=0;t<n.length;t++){let e=n[t],s=t+1;if(r.set(e,s),e==="true")r.set(!0,s);else if(e==="false")r.set(!1,s);else{let o=Number(e);e!==""&&!Number.isNaN(o)&&r.set(o,s)}}return r}function j(n,r,t,e,s){if(s||t.length===0)return;let o=[],a=1;for(let u of t){let c=Object.keys(r[u]??{});if(c.length===0||(o.push({key:u,options:c,index:F(c),radix:c.length+1,stride:a}),a*=c.length+1,a>X))return}let l=0;for(let u in e){let c=o.find(g=>g.key===u);if(!c)return;let f=c.index.get(e[u]);if(f===void 0)return;l+=f*c.stride}let i=new Array(a),d=u=>{let c=[];n&&c.push(n);for(let f of o){let g=Math.floor(u/f.stride)%f.radix;if(g===0)continue;let p=r[f.key][f.options[g-1]];p&&c.push(p)}return _(c)};return(u={})=>{let c=l;for(let f=0;f<o.length;f++){let g=o[f],p=u[g.key];if(p===void 0)continue;let C=g.index.get(p)??0,m=Math.floor(c/g.stride)%g.radix;c+=(C-m)*g.stride}return i[c]??=d(c)}}function I(n,r){let t=[...n];for(let e of r)t.includes(e)||t.push(e);return t}function R(n){let r=n.base??"",t=n.variants??{},e=n.defaultVariants??{},s=n.compoundVariants??[],o=Object.keys(t),a=new Set(o),l=Object.keys(e).length>0,i=s.length>0,d=(f={})=>{let g=l?y(e,f):f,p=[];r&&p.push(r);for(let C of o){let m=K(t,C,g[C]);m&&p.push(m)}if(i)for(let C of s){if(!T(C,g))continue;let m=C.className??C.css;typeof m=="string"&&m&&p.push(m)}return _(p)},u=E(r,t,o,e,i)??j(r,t,o,e,i)??x(d),c=f=>{let g=f.config,p=g.variants??{},C={};for(let m of I(f.variantKeys,o)){let b={...t[m]},v=p[m]??{};for(let h in v){let A=b[h];b[h]=A?V(A,v[h]):v[h]}C[m]=b}return R({base:V(r,g.base),variants:C,defaultVariants:{...e,...g.defaultVariants},compoundVariants:[...s,...g.compoundVariants??[]]})};return Object.assign(u,{__cva__:!0,variantKeys:o,variantMap:N(t),raw:d,merge:c,config:n,getVariantProps:f=>y(e,f),splitVariantProps:f=>k(f,a)})}function q(n,r){if(!n)return;let t={};for(let e in n){let s={};for(let o in n[e]){let a=n[e][o],l=typeof a=="string"?a:a?.[r];l&&(s[o]=l)}t[e]=s}return t}function z(n,r){if(!n?.length)return;let t=[];for(let e of n){let s={};for(let l in e)l==="css"||l==="className"||l==="classNames"||(s[l]=e[l]);let o=e.css;typeof o=="string"?s.css=o:o&&typeof o=="object"&&r in o&&(s.css=o[r]);let a=e.classNames?.[r]??e.className;a&&(s.className=a),(s.css||s.className)&&t.push(s)}return t.length?t:void 0}function B(n){let r=n.slots??Object.keys(n.base??{}),t=n.defaultVariants??{},e=Object.keys(n.variants??{}),s=new Set(e),o=r.map(i=>{let d=n.base?.[i];return n.className?.[i]&&(d=V(d,n.className[i])),[i,R({base:d,variants:q(n.variants,i),defaultVariants:n.defaultVariants,compoundVariants:z(n.compoundVariants,i)})]}),a=(i={})=>{let d={};for(let[u,c]of o)d[u]=c(i);return d},l=(i={})=>{let d={};for(let[u,c]of o)d[u]=c.raw(i);return d};return Object.assign(x(a),{__cva__:!1,raw:l,config:n,variantMap:Object.fromEntries(e.map(i=>[i,Object.keys(n.variants?.[i]??{})])),variantKeys:e,classNameMap:n.className??{},getVariantProps:i=>y(t,i),splitVariantProps:i=>k(i,s)})}export{P as css,R as cva,V as cx,B as sva};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/transformer",
3
- "version": "2.0.0-beta.14",
3
+ "version": "2.0.0-beta.16",
4
4
  "description": "Source transformer facade for Panda CSS",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -34,9 +34,12 @@
34
34
  "dist"
35
35
  ],
36
36
  "dependencies": {
37
- "unplugin": "^2.3.10",
38
- "@pandacss/compiler": "2.0.0-beta.14",
39
- "@pandacss/compiler-shared": "2.0.0-beta.14"
37
+ "@pandacss/compiler": "2.0.0-beta.16",
38
+ "@pandacss/compiler-shared": "2.0.0-beta.16",
39
+ "unplugin": "^2.3.11"
40
+ },
41
+ "devDependencies": {
42
+ "rolldown": "1.2.7"
40
43
  },
41
44
  "peerDependencies": {
42
45
  "vite": ">=6.0.0",