@pandacss/transformer 2.0.0-beta.9 → 2.0.0

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.
@@ -0,0 +1,4 @@
1
+ /** Transformed `css()` sites receive pre-encoded class strings only. */
2
+ declare function css(...styles: string[]): string;
3
+
4
+ export { css as c };
package/dist/index.d.ts CHANGED
@@ -1,13 +1,12 @@
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';
9
8
  export { CxOptions, CxSeparator, PandaClassPart, createCx, cx, getMergeKey, splitClassName } from './runtime/cx.js';
10
- export { StringCvaConfig, css, cva, sva } from './runtime/internal.js';
9
+ export { c as css } from './css-BPeL3U6s.js';
11
10
 
12
11
  /** Marker baked into the default bundle — replaced per-project at load time. */
13
12
  declare const CX_SEPARATOR_PLACEHOLDER = "__PANDA_CX_SEPARATOR__";
@@ -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
@@ -1,249 +1,248 @@
1
1
  // src/runtime/internal/cx.ts
2
2
  var bakedSeparator = typeof __PANDA_CX_SEPARATOR__ !== "undefined" && __PANDA_CX_SEPARATOR__ ? __PANDA_CX_SEPARATOR__ : "_";
3
+ var CHAR_OPEN_BRACKET = 91;
4
+ var CHAR_CLOSE_BRACKET = 93;
5
+ var CHAR_COLON = 58;
3
6
  function splitClassName(className) {
4
7
  const segments = [];
5
- let current = "";
8
+ let start = 0;
6
9
  let bracketDepth = 0;
7
10
  for (let i = 0; i < className.length; i++) {
8
- const ch = className[i];
9
- if (ch === "[") {
11
+ const code = className.charCodeAt(i);
12
+ if (code === CHAR_OPEN_BRACKET) {
10
13
  bracketDepth++;
11
- current += ch;
12
- } else if (ch === "]") {
14
+ } else if (code === CHAR_CLOSE_BRACKET) {
13
15
  bracketDepth--;
14
- current += ch;
15
- } else if (ch === ":" && bracketDepth === 0) {
16
- if (current) segments.push(current);
17
- current = "";
18
- } else {
19
- current += ch;
16
+ } else if (code === CHAR_COLON && bracketDepth === 0) {
17
+ if (i > start) segments.push(className.slice(start, i));
18
+ start = i + 1;
20
19
  }
21
20
  }
22
- if (current) segments.push(current);
21
+ if (start < className.length) segments.push(className.slice(start));
23
22
  return segments;
24
23
  }
25
24
  function getMergeKey(className, separator) {
26
- let cls = className;
27
- if (cls.endsWith("!")) {
28
- cls = cls.slice(0, -1);
25
+ let end = className.length;
26
+ if (end > 0 && className.charCodeAt(end - 1) === 33) {
27
+ end -= 1;
29
28
  }
30
- const segments = splitClassName(cls);
31
- if (segments.length === 0) return null;
32
- const last = segments[segments.length - 1];
33
- const sepIdx = last.indexOf(separator);
34
- if (sepIdx < 1) return null;
35
- const property = last.slice(0, sepIdx);
36
- if (segments.length === 1) {
37
- return property;
29
+ if (end === 0) return null;
30
+ let bracketDepth = 0;
31
+ let lastColon = -1;
32
+ for (let i = 0; i < end; i++) {
33
+ const code = className.charCodeAt(i);
34
+ if (code === CHAR_OPEN_BRACKET) {
35
+ bracketDepth++;
36
+ } else if (code === CHAR_CLOSE_BRACKET) {
37
+ bracketDepth--;
38
+ } else if (code === CHAR_COLON && bracketDepth === 0) {
39
+ lastColon = i;
40
+ }
38
41
  }
39
- const conditions = segments.slice(0, -1).join(":");
40
- return `${conditions}:${property}`;
42
+ const propStart = lastColon + 1;
43
+ const sepIdx = className.indexOf(separator, propStart);
44
+ if (sepIdx < propStart + 1 || sepIdx >= end) return null;
45
+ return className.slice(0, sepIdx);
41
46
  }
42
- function flattenParts(parts, out) {
43
- for (const part of parts) {
44
- if (!part) continue;
45
- if (Array.isArray(part)) {
46
- flattenParts(part, out);
47
- continue;
47
+ var CACHE_LIMIT = 2048;
48
+ var CHAR_SPACE = 32;
49
+ var CHAR_BANG = 33;
50
+ var FIELDS = 4;
51
+ function createCache(limit = CACHE_LIMIT) {
52
+ let size = 0;
53
+ let current = /* @__PURE__ */ new Map();
54
+ let previous = /* @__PURE__ */ new Map();
55
+ const set = (key, value) => {
56
+ current.set(key, value);
57
+ if (++size > limit) {
58
+ size = 0;
59
+ previous = current;
60
+ current = /* @__PURE__ */ new Map();
48
61
  }
49
- if (part === "") continue;
50
- out.push(part);
51
- }
62
+ };
63
+ return {
64
+ get(key) {
65
+ let value = current.get(key);
66
+ if (value === void 0 && (value = previous.get(key)) !== void 0) set(key, value);
67
+ return value;
68
+ },
69
+ set
70
+ };
52
71
  }
53
- function mergeClassStrings(separator, classes) {
54
- const seen = /* @__PURE__ */ new Map();
55
- const order = [];
56
- let id = 0;
57
- for (const cls of classes) {
58
- for (const token of cls.split(" ")) {
59
- if (!token) continue;
60
- const key = getMergeKey(token, separator);
61
- if (key !== null) {
62
- if (!seen.has(key)) order.push(key);
63
- seen.set(key, token);
64
- } else {
65
- const uniqueKey = `__${id++}`;
66
- order.push(uniqueKey);
67
- seen.set(uniqueKey, token);
68
- }
72
+ function scanPart(part, separator, out, offset) {
73
+ let count = 0;
74
+ let clean = part.length > 0;
75
+ let start = 0;
76
+ for (let i = 0; i <= part.length; i++) {
77
+ const code = i === part.length ? CHAR_SPACE : part.charCodeAt(i);
78
+ if (code !== CHAR_SPACE && (code < 9 || code > 13)) continue;
79
+ if (code !== CHAR_SPACE || i === start) clean = false;
80
+ if (i === start) {
81
+ start = i + 1;
82
+ continue;
69
83
  }
84
+ const at = offset + count * FIELDS;
85
+ count++;
86
+ out[at] = start;
87
+ out[at + 1] = i;
88
+ out[at + 2] = -1;
89
+ let end = i;
90
+ if (part.charCodeAt(end - 1) === CHAR_BANG) end--;
91
+ let depth = 0;
92
+ let propStart = start;
93
+ for (let c = start; c < end; c++) {
94
+ const code2 = part.charCodeAt(c);
95
+ if (code2 === CHAR_OPEN_BRACKET) depth++;
96
+ else if (code2 === CHAR_CLOSE_BRACKET) depth--;
97
+ else if (code2 === CHAR_COLON && depth === 0) propStart = c + 1;
98
+ }
99
+ const sep = part.indexOf(separator, propStart);
100
+ if (sep > propStart && sep < end) {
101
+ let hash = 2166136261;
102
+ for (let c = start; c < sep; c++) hash = Math.imul(hash ^ part.charCodeAt(c), 16777619);
103
+ out[at + 2] = sep;
104
+ out[at + 3] = hash;
105
+ }
106
+ start = i + 1;
70
107
  }
71
- let str = "";
72
- for (let i = 0; i < order.length; i++) {
73
- if (str) str += " ";
74
- str += seen.get(order[i]);
75
- }
76
- return str;
108
+ return clean ? count : -count;
77
109
  }
78
110
  function createCx(options = {}) {
79
111
  const separator = options.separator ?? bakedSeparator;
80
- return function cx2(...parts) {
81
- const flat = [];
82
- flattenParts(parts, flat);
83
- return mergeClassStrings(separator, flat);
84
- };
85
- }
86
- var cx = createCx();
87
-
88
- // src/runtime/internal/css.ts
89
- function css(...styles) {
90
- return cx(...styles);
91
- }
92
-
93
- // src/runtime/internal/cva.ts
94
- function withDefaults(defaults, props) {
95
- const out = { ...defaults };
96
- for (const key in props) {
97
- if (props[key] !== void 0) out[key] = props[key];
112
+ const scanned = createCache();
113
+ const seenOnce = createCache(512);
114
+ const parts = [];
115
+ let tokens = new Int32Array(64 * FIELDS);
116
+ let tokenPart = new Int32Array(64);
117
+ let winner = new Int32Array(64);
118
+ let tableSize = 128;
119
+ let table = new Int32Array(tableSize);
120
+ let stamps = new Int32Array(tableSize);
121
+ let stamp = 0;
122
+ function collect(value) {
123
+ if (!value) return;
124
+ if (typeof value === "string") parts.push(value);
125
+ else for (let i = 0; i < value.length; i++) collect(value[i]);
98
126
  }
99
- return out;
100
- }
101
- function compoundMatches(compound, variants) {
102
- for (const key in compound) {
103
- if (key === "css" || key === "className" || key === "classNames") continue;
104
- const expected = compound[key];
105
- const actual = variants[key];
106
- if (Array.isArray(expected)) {
107
- if (!expected.includes(actual)) return false;
108
- } else if (actual !== expected) {
109
- return false;
127
+ function reserve(tokenCount) {
128
+ if (tokenCount <= tokenPart.length) return;
129
+ let size = tokenPart.length;
130
+ while (size < tokenCount) size *= 2;
131
+ const grow = (from, length) => {
132
+ const next = new Int32Array(length);
133
+ next.set(from);
134
+ return next;
135
+ };
136
+ tokens = grow(tokens, size * FIELDS);
137
+ tokenPart = grow(tokenPart, size);
138
+ winner = grow(winner, size);
139
+ }
140
+ function sameKey(a, b) {
141
+ const aStart = tokens[a * FIELDS];
142
+ const bStart = tokens[b * FIELDS];
143
+ const length = tokens[a * FIELDS + 2] - aStart;
144
+ if (tokens[b * FIELDS + 2] - bStart !== length) return false;
145
+ const left = parts[tokenPart[a]];
146
+ const right = parts[tokenPart[b]];
147
+ for (let i = 0; i < length; i++) {
148
+ if (left.charCodeAt(aStart + i) !== right.charCodeAt(bStart + i)) return false;
110
149
  }
150
+ return true;
111
151
  }
112
- return true;
113
- }
114
- function toVariantMap(variants) {
115
- const map = {};
116
- for (const key in variants) map[key] = Object.keys(variants[key] ?? {});
117
- return map;
118
- }
119
- function cva(config) {
120
- const base = config.base ?? "";
121
- const variants = config.variants ?? {};
122
- const defaultVariants = config.defaultVariants ?? {};
123
- const compoundVariants = config.compoundVariants ?? [];
124
- const variantKeys = Object.keys(variants);
125
- const resolve = (props = {}) => {
126
- const computed = withDefaults(defaultVariants, props);
127
- const parts = [];
128
- if (base) parts.push(base);
129
- for (const key of variantKeys) {
130
- const value = computed[key];
131
- if (typeof value === "string" && variants[key]?.[value]) {
132
- parts.push(variants[key][value]);
152
+ function merge() {
153
+ let count = 0;
154
+ let clean = true;
155
+ for (let p = 0; p < parts.length; p++) {
156
+ const part = parts[p];
157
+ const cached = scanned.get(part);
158
+ let partCount;
159
+ if (cached !== void 0) {
160
+ partCount = cached[0];
161
+ reserve(count + Math.abs(partCount));
162
+ const base = count * FIELDS;
163
+ for (let i = 1; i < cached.length; i++) tokens[base + i - 1] = cached[i];
164
+ } else {
165
+ reserve(count + part.length);
166
+ partCount = scanPart(part, separator, tokens, count * FIELDS);
167
+ if (seenOnce.get(part) === void 0) seenOnce.set(part, true);
168
+ else {
169
+ const record = new Int32Array(1 + Math.abs(partCount) * FIELDS);
170
+ record[0] = partCount;
171
+ record.set(tokens.subarray(count * FIELDS, (count + Math.abs(partCount)) * FIELDS), 1);
172
+ scanned.set(part, record);
173
+ }
133
174
  }
175
+ if (partCount <= 0) clean = false;
176
+ const end = count + Math.abs(partCount);
177
+ for (; count < end; count++) tokenPart[count] = p;
134
178
  }
135
- for (const compound of compoundVariants) {
136
- if (!compoundMatches(compound, computed)) continue;
137
- const cls = compound.className ?? compound.css;
138
- if (typeof cls === "string" && cls) parts.push(cls);
139
- }
140
- return cx(...parts);
141
- };
142
- const cvaFn = (props = {}) => resolve(props);
143
- return Object.assign(cvaFn, {
144
- __cva__: true,
145
- variantKeys,
146
- variantMap: toVariantMap(variants),
147
- raw: resolve,
148
- config,
149
- getVariantProps(props) {
150
- return withDefaults(defaultVariants, props);
151
- },
152
- splitVariantProps(props) {
153
- const rest = {};
154
- const variantProps = {};
155
- for (const key in props) {
156
- if (variantKeys.includes(key)) variantProps[key] = props[key];
157
- else rest[key] = props[key];
158
- }
159
- return [rest, variantProps];
179
+ if (count * 2 > tableSize) {
180
+ while (count * 2 > tableSize) tableSize *= 2;
181
+ table = new Int32Array(tableSize);
182
+ stamps = new Int32Array(tableSize);
183
+ stamp = 0;
160
184
  }
161
- });
162
- }
163
-
164
- // src/runtime/internal/sva.ts
165
- function slotCompoundVariants(compoundVariants, slot) {
166
- if (!compoundVariants?.length) return void 0;
167
- return compoundVariants.map((compound) => {
168
- const next = {};
169
- for (const key in compound) {
170
- if (key === "css" || key === "className" || key === "classNames") continue;
171
- next[key] = compound[key];
185
+ if (++stamp === 2147483647) {
186
+ stamp = 1;
187
+ stamps.fill(0);
172
188
  }
173
- const css2 = compound.css;
174
- if (typeof css2 === "string") next.css = css2;
175
- else if (css2 && typeof css2 === "object" && slot in css2) next.css = css2[slot];
176
- const className = compound.classNames?.[slot] ?? compound.className;
177
- if (className) next.className = className;
178
- return next;
179
- }).filter((compound) => compound.css || compound.className);
180
- }
181
- function getSlotRecipes(config) {
182
- const slots = config.slots ?? Object.keys(config.base ?? {});
183
- const recipes = {};
184
- for (const slot of slots) {
185
- recipes[slot] = {
186
- base: config.base?.[slot],
187
- variants: config.variants,
188
- defaultVariants: config.defaultVariants,
189
- compoundVariants: slotCompoundVariants(config.compoundVariants, slot)
190
- };
191
- if (config.className?.[slot]) {
192
- recipes[slot] = {
193
- ...recipes[slot],
194
- base: cx(recipes[slot]?.base, config.className[slot])
195
- };
189
+ const mask = tableSize - 1;
190
+ let replaced = false;
191
+ for (let t = 0; t < count; t++) {
192
+ winner[t] = t;
193
+ if (tokens[t * FIELDS + 2] < 0) continue;
194
+ const hash = tokens[t * FIELDS + 3];
195
+ let slot = hash & mask;
196
+ let owner = -1;
197
+ while (stamps[slot] === stamp) {
198
+ const candidate = table[slot];
199
+ if (tokens[candidate * FIELDS + 3] === hash && sameKey(candidate, t)) {
200
+ owner = candidate;
201
+ break;
202
+ }
203
+ slot = slot + 1 & mask;
204
+ }
205
+ if (owner === -1) {
206
+ stamps[slot] = stamp;
207
+ table[slot] = t;
208
+ } else {
209
+ winner[owner] = t;
210
+ winner[t] = -1;
211
+ replaced = true;
212
+ }
196
213
  }
197
- }
198
- return recipes;
199
- }
200
- function sva(config) {
201
- const slotRecipes = getSlotRecipes(config);
202
- const slots = Object.entries(slotRecipes).map(([slot, recipe]) => [slot, cva(recipe)]);
203
- const defaultVariants = config.defaultVariants ?? {};
204
- const variantKeys = Object.keys(config.variants ?? {});
205
- const svaFn = (props = {}) => {
206
- const result = {};
207
- for (const [slot, slotFn] of slots) {
208
- result[slot] = slotFn(props);
214
+ if (!replaced && clean) {
215
+ let joined = parts[0];
216
+ for (let p = 1; p < parts.length; p++) joined += " " + parts[p];
217
+ return joined;
209
218
  }
210
- return result;
211
- };
212
- const raw = (props = {}) => {
213
- const result = {};
214
- for (const [slot, slotFn] of slots) {
215
- result[slot] = slotFn.raw(props);
219
+ let result = "";
220
+ for (let t = 0; t < count; t++) {
221
+ const w = winner[t];
222
+ if (w === -1) continue;
223
+ const piece = parts[tokenPart[w]].slice(tokens[w * FIELDS], tokens[w * FIELDS + 1]);
224
+ result = result ? result + " " + piece : piece;
216
225
  }
217
226
  return result;
227
+ }
228
+ return function cx2(...args) {
229
+ parts.length = 0;
230
+ for (let i = 0; i < args.length; i++) collect(args[i]);
231
+ const count = parts.length;
232
+ if (count === 0) return "";
233
+ if (count === 1) return parts[0];
234
+ return merge();
218
235
  };
219
- return Object.assign(svaFn, {
220
- __cva__: false,
221
- raw,
222
- config,
223
- variantMap: Object.fromEntries(variantKeys.map((key) => [key, Object.keys(config.variants?.[key] ?? {})])),
224
- variantKeys,
225
- classNameMap: config.className ?? {},
226
- getVariantProps(props) {
227
- const out = { ...defaultVariants };
228
- for (const key in props) {
229
- if (props[key] !== void 0) out[key] = props[key];
230
- }
231
- return out;
232
- },
233
- splitVariantProps(props) {
234
- const rest = {};
235
- const variantProps = {};
236
- for (const key in props) {
237
- if (variantKeys.includes(key)) variantProps[key] = props[key];
238
- else rest[key] = props[key];
239
- }
240
- return [rest, variantProps];
241
- }
242
- });
236
+ }
237
+ var cx = /* @__PURE__ */ createCx();
238
+
239
+ // src/runtime/internal/css.ts
240
+ function css(...styles) {
241
+ return cx(...styles);
243
242
  }
244
243
 
245
244
  // src/runtime/internal/source.ts
246
- var internalCssSource = 'var x="__PANDA_CX_SEPARATOR__";function m(t){let r=[],n="",s=0;for(let a=0;a<t.length;a++){let i=t[a];i==="["?(s++,n+=i):i==="]"?(s--,n+=i):i===":"&&s===0?(n&&r.push(n),n=""):n+=i}return n&&r.push(n),r}function C(t,r){let n=t;n.endsWith("!")&&(n=n.slice(0,-1));let s=m(n);if(s.length===0)return null;let a=s[s.length-1],i=a.indexOf(r);if(i<1)return null;let u=a.slice(0,i);return s.length===1?u:`${s.slice(0,-1).join(":")}:${u}`}function R(t,r){for(let n of t)if(n){if(Array.isArray(n)){R(n,r);continue}n!==""&&r.push(n)}}function V(t,r){let n=new Map,s=[],a=0;for(let u of r)for(let o of u.split(" ")){if(!o)continue;let e=C(o,t);if(e!==null)n.has(e)||s.push(e),n.set(e,o);else{let c=`__${a++}`;s.push(c),n.set(c,o)}}let i="";for(let u=0;u<s.length;u++)i&&(i+=" "),i+=n.get(s[u]);return i}function v(t={}){let r=t.separator??x;return function(...s){let a=[];return R(s,a),V(r,a)}}var g=v();function y(...t){return g(...t)}function _(t,r){let n={...t};for(let s in r)r[s]!==void 0&&(n[s]=r[s]);return n}function w(t,r){for(let n in t){if(n==="css"||n==="className"||n==="classNames")continue;let s=t[n],a=r[n];if(Array.isArray(s)){if(!s.includes(a))return!1}else if(a!==s)return!1}return!0}function N(t){let r={};for(let n in t)r[n]=Object.keys(t[n]??{});return r}function p(t){let r=t.base??"",n=t.variants??{},s=t.defaultVariants??{},a=t.compoundVariants??[],i=Object.keys(n),u=(e={})=>{let c=_(s,e),f=[];r&&f.push(r);for(let l of i){let d=c[l];typeof d=="string"&&n[l]?.[d]&&f.push(n[l][d])}for(let l of a){if(!w(l,c))continue;let d=l.className??l.css;typeof d=="string"&&d&&f.push(d)}return g(...f)};return Object.assign((e={})=>u(e),{__cva__:!0,variantKeys:i,variantMap:N(n),raw:u,config:t,getVariantProps(e){return _(s,e)},splitVariantProps(e){let c={},f={};for(let l in e)i.includes(l)?f[l]=e[l]:c[l]=e[l];return[c,f]}})}function P(t,r){if(t?.length)return t.map(n=>{let s={};for(let u in n)u==="css"||u==="className"||u==="classNames"||(s[u]=n[u]);let a=n.css;typeof a=="string"?s.css=a:a&&typeof a=="object"&&r in a&&(s.css=a[r]);let i=n.classNames?.[r]??n.className;return i&&(s.className=i),s}).filter(n=>n.css||n.className)}function b(t){let r=t.slots??Object.keys(t.base??{}),n={};for(let s of r)n[s]={base:t.base?.[s],variants:t.variants,defaultVariants:t.defaultVariants,compoundVariants:P(t.compoundVariants,s)},t.className?.[s]&&(n[s]={...n[s],base:g(n[s]?.base,t.className[s])});return n}function k(t){let r=b(t),n=Object.entries(r).map(([o,e])=>[o,p(e)]),s=t.defaultVariants??{},a=Object.keys(t.variants??{});return Object.assign((o={})=>{let e={};for(let[c,f]of n)e[c]=f(o);return e},{__cva__:!1,raw:(o={})=>{let e={};for(let[c,f]of n)e[c]=f.raw(o);return e},config:t,variantMap:Object.fromEntries(a.map(o=>[o,Object.keys(t.variants?.[o]??{})])),variantKeys:a,classNameMap:t.className??{},getVariantProps(o){let e={...s};for(let c in o)o[c]!==void 0&&(e[c]=o[c]);return e},splitVariantProps(o){let e={},c={};for(let f in o)a.includes(f)?c[f]=o[f]:e[f]=o[f];return[e,c]}})}export{y as css,p as cva,g as cx,k as sva};\n';
245
+ var internalCssSource = '// src/runtime/internal/cx.ts\nvar z = "__PANDA_CX_SEPARATOR__";\nvar X = 2048, M = 32, G = 33, m = 4;\nfunction H(e = X) {\n let o = 0, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), r = (i, n) => {\n t.set(i, n), ++o > e && (o = 0, s = t, t = /* @__PURE__ */ new Map());\n };\n return {\n get(i) {\n let n = t.get(i);\n return n === void 0 && (n = s.get(i)) !== void 0 && r(i, n), n;\n },\n set: r\n };\n}\nfunction W(e, o, t, s) {\n let r = 0, i = e.length > 0, n = 0;\n for (let l = 0; l <= e.length; l++) {\n let a = l === e.length ? M : e.charCodeAt(l);\n if (a !== M && (a < 9 || a > 13)) continue;\n if ((a !== M || l === n) && (i = !1), l === n) {\n n = l + 1;\n continue;\n }\n let C = s + r * m;\n r++, t[C] = n, t[C + 1] = l, t[C + 2] = -1;\n let h = l;\n e.charCodeAt(h - 1) === G && h--;\n let u = 0, _ = n;\n for (let R = n; R < h; R++) {\n let g = e.charCodeAt(R);\n g === 91 ? u++ : g === 93 ? u-- : g === 58 && u === 0 && (_ = R + 1);\n }\n let p = e.indexOf(o, _);\n if (p > _ && p < h) {\n let R = 2166136261;\n for (let g = n; g < p; g++) R = Math.imul(R ^ e.charCodeAt(g), 16777619);\n t[C + 2] = p, t[C + 3] = R;\n }\n n = l + 1;\n }\n return i ? r : -r;\n}\nfunction K(e = {}) {\n let o = e.separator ?? z, t = H(), s = H(512), r = [], i = new Int32Array(64 * m), n = new Int32Array(64), l = new Int32Array(64), a = 128, C = new Int32Array(a), h = new Int32Array(a), u = 0;\n function _(c) {\n if (c)\n if (typeof c == "string") r.push(c);\n else for (let f = 0; f < c.length; f++) _(c[f]);\n }\n function p(c) {\n if (c <= n.length) return;\n let f = n.length;\n for (; f < c; ) f *= 2;\n let w = (P, x) => {\n let d = new Int32Array(x);\n return d.set(P), d;\n };\n i = w(i, f * m), n = w(n, f), l = w(l, f);\n }\n function R(c, f) {\n let w = i[c * m], P = i[f * m], x = i[c * m + 2] - w;\n if (i[f * m + 2] - P !== x) return !1;\n let d = r[n[c]], A = r[n[f]];\n for (let y = 0; y < x; y++)\n if (d.charCodeAt(w + y) !== A.charCodeAt(P + y)) return !1;\n return !0;\n }\n function g() {\n let c = 0, f = !0;\n for (let d = 0; d < r.length; d++) {\n let A = r[d], y = t.get(A), S;\n if (y !== void 0) {\n S = y[0], p(c + Math.abs(S));\n let T = c * m;\n for (let V = 1; V < y.length; V++) i[T + V - 1] = y[V];\n } else if (p(c + A.length), S = W(A, o, i, c * m), s.get(A) === void 0) s.set(A, !0);\n else {\n let T = new Int32Array(1 + Math.abs(S) * m);\n T[0] = S, T.set(i.subarray(c * m, (c + Math.abs(S)) * m), 1), t.set(A, T);\n }\n S <= 0 && (f = !1);\n let O = c + Math.abs(S);\n for (; c < O; c++) n[c] = d;\n }\n if (c * 2 > a) {\n for (; c * 2 > a; ) a *= 2;\n C = new Int32Array(a), h = new Int32Array(a), u = 0;\n }\n ++u === 2147483647 && (u = 1, h.fill(0));\n let w = a - 1, P = !1;\n for (let d = 0; d < c; d++) {\n if (l[d] = d, i[d * m + 2] < 0) continue;\n let A = i[d * m + 3], y = A & w, S = -1;\n for (; h[y] === u; ) {\n let O = C[y];\n if (i[O * m + 3] === A && R(O, d)) {\n S = O;\n break;\n }\n y = y + 1 & w;\n }\n S === -1 ? (h[y] = u, C[y] = d) : (l[S] = d, l[d] = -1, P = !0);\n }\n if (!P && f) {\n let d = r[0];\n for (let A = 1; A < r.length; A++) d += " " + r[A];\n return d;\n }\n let x = "";\n for (let d = 0; d < c; d++) {\n let A = l[d];\n if (A === -1) continue;\n let y = r[n[A]].slice(i[A * m], i[A * m + 1]);\n x = x ? x + " " + y : y;\n }\n return x;\n }\n return function(...f) {\n r.length = 0;\n for (let P = 0; P < f.length; P++) _(f[P]);\n let w = r.length;\n return w === 0 ? "" : w === 1 ? r[0] : g();\n };\n}\nvar b = /* @__PURE__ */ K();\n\n// src/runtime/internal/css.ts\nfunction N(...e) {\n return b(...e);\n}\n\n// src/runtime/internal/memo.ts\nvar B = (e) => e !== null && (typeof e == "object" || typeof e == "function"), F = ["true", "false", "null"];\nfunction q(e, o, t, s) {\n let r = 1, i = [], n = [], l = [], a = [], C = o.map((_) => {\n let p = /* @__PURE__ */ Object.create(null), R = 1;\n for (let g of t[_]) p[g] = R++;\n if (s)\n n.push(R++), l.push(R++), a.push(R++);\n else {\n for (let g of F) p[g] ??= R++;\n n.push(p.true), l.push(p.false), a.push(p.null);\n }\n return i.push(R), r *= R, p;\n });\n if (r > 256) return null;\n let h = new Array(r), u;\n return (_) => {\n if (_ == null) return u === void 0 ? u = e() : u;\n let p = 0;\n for (let g = 0; g < o.length; g++) {\n let c = _[o[g]], f = 0;\n if (c === !0) f = n[g];\n else if (c === !1) f = l[g];\n else if (c === null) f = a[g];\n else if (typeof c == "string") f = C[g][c];\n else if (c !== void 0) {\n if (s || B(c)) return e(_);\n f = C[g][String(c)];\n }\n if (f === void 0) return e(_);\n p = p * i[g] + f;\n }\n let R = h[p];\n return R === void 0 && (h[p] = R = e(_)), R;\n };\n}\nfunction J(e, o) {\n let t = o.length, s = new Array(16 * t), r = new Array(16), i = 0, n = 0, l;\n return (a) => {\n if (a == null) return l === void 0 ? l = e() : l;\n e: for (let u = 0; u < i; u++) {\n let _ = u * t;\n for (let p = 0; p < t; p++)\n if (a[o[p]] !== s[_ + p]) continue e;\n return r[u];\n }\n for (let u = 0; u < t; u++)\n if (B(a[o[u]])) return e(a);\n let C = e(a), h = n * t;\n for (let u = 0; u < t; u++) s[h + u] = a[o[u]];\n return r[n] = C, n === i && i++, n = (n + 1) % 16, C;\n };\n}\nfunction k(e, o, t) {\n let s = Object.keys(o);\n return s.length === 0 ? e : q(e, s, o, !!t) ?? J(e, s);\n}\n\n// src/runtime/internal/shared.ts\nfunction E(e, o) {\n let t = { ...e };\n for (let s in o)\n o[s] !== void 0 && (t[s] = o[s]);\n return t;\n}\nfunction j(e, o) {\n for (let t in e) {\n if (t === "css" || t === "className" || t === "classNames") continue;\n let s = e[t], r = o[t];\n if (Array.isArray(s)) {\n if (!s.includes(r)) return !1;\n } else if (r !== s)\n return !1;\n }\n return !0;\n}\n\n// src/runtime/internal/recipe.ts\nvar D = (e) => e != null && typeof e == "object" && !Array.isArray(e);\nfunction I(...e) {\n let o = {};\n for (let t of e)\n if (D(t))\n for (let s in t) {\n let r = t[s];\n o[s] = D(r) ? I(o[s], r) : r;\n }\n return o;\n}\nfunction v(e, o, t = (s) => s) {\n let s = E(e.defaultVariants ?? {}, o), r = e.variants ?? {}, i = [t(e.base)];\n for (let n in s) i.push(t(r[n]?.[s[n]]));\n for (let n of e.compoundVariants ?? [])\n j(n, s) && i.push(t(n.css));\n return I(...i);\n}\nfunction Q(e, o) {\n let t = {};\n for (let s of e.slots ?? Object.keys(e.base ?? {}))\n t[s] = v(e, o, (r) => r?.[s]);\n return t;\n}\nfunction U(e, o) {\n let t = { ...e.config?.defaultVariants, ...o.config?.defaultVariants }, s = [.../* @__PURE__ */ new Set([...e.variantKeys ?? [], ...o.variantKeys ?? []])], r = (n = {}) => E(t, n), i = L(\n (n) => {\n let l = r(n);\n return b(e(l), o(l));\n },\n // Compounds from either side rule out the coercing table memo.\n {\n defaultVariants: t,\n compoundVariants: [...e.config?.compoundVariants ?? [], ...o.config?.compoundVariants ?? []]\n },\n s,\n { ...e.variantMap, ...o.variantMap }\n );\n return i.raw = (n) => {\n let l = r(n);\n return I(e.raw(l), o.raw(l));\n }, i;\n}\nfunction L(e, o, t, s, r) {\n let i = o, n = i.defaultVariants ?? {}, l = k(e, s, i.compoundVariants?.length);\n return Object.assign(l, {\n __cva__: !r,\n variantKeys: t,\n variantMap: s,\n ...r && { classNameMap: r },\n config: o,\n raw: (a = {}) => r ? Q(i, a) : v(i, a),\n // The styled factory passes its own `cva`, so chains merge exactly like styled-system.\n merge: (a, C) => C ? C(o).merge(a) : U(l, a),\n getVariantProps: (a = {}) => E(n, a),\n splitVariantProps: (a) => {\n let C = {}, h = {};\n for (let u in a) (t.includes(u) ? C : h)[u] = a[u];\n return [C, h];\n }\n });\n}\nexport {\n L as attachRecipe,\n N as css,\n b as cx,\n k as memoRecipe\n};\n';
247
246
 
248
247
  // src/runtime/internal/load.ts
249
248
  var CX_SEPARATOR_PLACEHOLDER = "__PANDA_CX_SEPARATOR__";
@@ -445,7 +444,6 @@ export {
445
444
  createPandaSourcePluginHooks,
446
445
  createSourceTransformer,
447
446
  css,
448
- cva,
449
447
  cx,
450
448
  src_default as default,
451
449
  esbuild,
@@ -461,7 +459,6 @@ export {
461
459
  runSourceTransform,
462
460
  shouldTransform,
463
461
  splitClassName,
464
- sva,
465
462
  transformSource,
466
463
  vite,
467
464
  webpack
@@ -9,8 +9,8 @@ declare function splitClassName(className: string): string[];
9
9
  /** Merge key for one Panda atomic class token (conditions + property). */
10
10
  declare function getMergeKey(className: string, separator: string): string | null;
11
11
  /** Build a transform-time `cx` helper bound to the project separator. */
12
- declare function createCx(options?: CxOptions): (...parts: PandaClassPart[]) => string;
12
+ declare function createCx(options?: CxOptions): (...args: PandaClassPart[]) => string;
13
13
  /** Default transform-time `cx` — mirrors styled-system naming with Panda merge semantics. */
14
- declare const cx: (...parts: PandaClassPart[]) => string;
14
+ declare const cx: (...args: PandaClassPart[]) => string;
15
15
 
16
16
  export { type CxOptions, type CxSeparator, type PandaClassPart, createCx, cx, getMergeKey, splitClassName };