@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.
@@ -1 +1,278 @@
1
- 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};
1
+ // src/runtime/internal/cx.ts
2
+ var z = "__PANDA_CX_SEPARATOR__";
3
+ var X = 2048, M = 32, G = 33, m = 4;
4
+ function H(e = X) {
5
+ let o = 0, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), r = (i, n) => {
6
+ t.set(i, n), ++o > e && (o = 0, s = t, t = /* @__PURE__ */ new Map());
7
+ };
8
+ return {
9
+ get(i) {
10
+ let n = t.get(i);
11
+ return n === void 0 && (n = s.get(i)) !== void 0 && r(i, n), n;
12
+ },
13
+ set: r
14
+ };
15
+ }
16
+ function W(e, o, t, s) {
17
+ let r = 0, i = e.length > 0, n = 0;
18
+ for (let l = 0; l <= e.length; l++) {
19
+ let a = l === e.length ? M : e.charCodeAt(l);
20
+ if (a !== M && (a < 9 || a > 13)) continue;
21
+ if ((a !== M || l === n) && (i = !1), l === n) {
22
+ n = l + 1;
23
+ continue;
24
+ }
25
+ let C = s + r * m;
26
+ r++, t[C] = n, t[C + 1] = l, t[C + 2] = -1;
27
+ let h = l;
28
+ e.charCodeAt(h - 1) === G && h--;
29
+ let u = 0, _ = n;
30
+ for (let R = n; R < h; R++) {
31
+ let g = e.charCodeAt(R);
32
+ g === 91 ? u++ : g === 93 ? u-- : g === 58 && u === 0 && (_ = R + 1);
33
+ }
34
+ let p = e.indexOf(o, _);
35
+ if (p > _ && p < h) {
36
+ let R = 2166136261;
37
+ for (let g = n; g < p; g++) R = Math.imul(R ^ e.charCodeAt(g), 16777619);
38
+ t[C + 2] = p, t[C + 3] = R;
39
+ }
40
+ n = l + 1;
41
+ }
42
+ return i ? r : -r;
43
+ }
44
+ function K(e = {}) {
45
+ 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;
46
+ function _(c) {
47
+ if (c)
48
+ if (typeof c == "string") r.push(c);
49
+ else for (let f = 0; f < c.length; f++) _(c[f]);
50
+ }
51
+ function p(c) {
52
+ if (c <= n.length) return;
53
+ let f = n.length;
54
+ for (; f < c; ) f *= 2;
55
+ let w = (P, x) => {
56
+ let d = new Int32Array(x);
57
+ return d.set(P), d;
58
+ };
59
+ i = w(i, f * m), n = w(n, f), l = w(l, f);
60
+ }
61
+ function R(c, f) {
62
+ let w = i[c * m], P = i[f * m], x = i[c * m + 2] - w;
63
+ if (i[f * m + 2] - P !== x) return !1;
64
+ let d = r[n[c]], A = r[n[f]];
65
+ for (let y = 0; y < x; y++)
66
+ if (d.charCodeAt(w + y) !== A.charCodeAt(P + y)) return !1;
67
+ return !0;
68
+ }
69
+ function g() {
70
+ let c = 0, f = !0;
71
+ for (let d = 0; d < r.length; d++) {
72
+ let A = r[d], y = t.get(A), S;
73
+ if (y !== void 0) {
74
+ S = y[0], p(c + Math.abs(S));
75
+ let T = c * m;
76
+ for (let V = 1; V < y.length; V++) i[T + V - 1] = y[V];
77
+ } else if (p(c + A.length), S = W(A, o, i, c * m), s.get(A) === void 0) s.set(A, !0);
78
+ else {
79
+ let T = new Int32Array(1 + Math.abs(S) * m);
80
+ T[0] = S, T.set(i.subarray(c * m, (c + Math.abs(S)) * m), 1), t.set(A, T);
81
+ }
82
+ S <= 0 && (f = !1);
83
+ let O = c + Math.abs(S);
84
+ for (; c < O; c++) n[c] = d;
85
+ }
86
+ if (c * 2 > a) {
87
+ for (; c * 2 > a; ) a *= 2;
88
+ C = new Int32Array(a), h = new Int32Array(a), u = 0;
89
+ }
90
+ ++u === 2147483647 && (u = 1, h.fill(0));
91
+ let w = a - 1, P = !1;
92
+ for (let d = 0; d < c; d++) {
93
+ if (l[d] = d, i[d * m + 2] < 0) continue;
94
+ let A = i[d * m + 3], y = A & w, S = -1;
95
+ for (; h[y] === u; ) {
96
+ let O = C[y];
97
+ if (i[O * m + 3] === A && R(O, d)) {
98
+ S = O;
99
+ break;
100
+ }
101
+ y = y + 1 & w;
102
+ }
103
+ S === -1 ? (h[y] = u, C[y] = d) : (l[S] = d, l[d] = -1, P = !0);
104
+ }
105
+ if (!P && f) {
106
+ let d = r[0];
107
+ for (let A = 1; A < r.length; A++) d += " " + r[A];
108
+ return d;
109
+ }
110
+ let x = "";
111
+ for (let d = 0; d < c; d++) {
112
+ let A = l[d];
113
+ if (A === -1) continue;
114
+ let y = r[n[A]].slice(i[A * m], i[A * m + 1]);
115
+ x = x ? x + " " + y : y;
116
+ }
117
+ return x;
118
+ }
119
+ return function(...f) {
120
+ r.length = 0;
121
+ for (let P = 0; P < f.length; P++) _(f[P]);
122
+ let w = r.length;
123
+ return w === 0 ? "" : w === 1 ? r[0] : g();
124
+ };
125
+ }
126
+ var b = /* @__PURE__ */ K();
127
+
128
+ // src/runtime/internal/css.ts
129
+ function N(...e) {
130
+ return b(...e);
131
+ }
132
+
133
+ // src/runtime/internal/memo.ts
134
+ var B = (e) => e !== null && (typeof e == "object" || typeof e == "function"), F = ["true", "false", "null"];
135
+ function q(e, o, t, s) {
136
+ let r = 1, i = [], n = [], l = [], a = [], C = o.map((_) => {
137
+ let p = /* @__PURE__ */ Object.create(null), R = 1;
138
+ for (let g of t[_]) p[g] = R++;
139
+ if (s)
140
+ n.push(R++), l.push(R++), a.push(R++);
141
+ else {
142
+ for (let g of F) p[g] ??= R++;
143
+ n.push(p.true), l.push(p.false), a.push(p.null);
144
+ }
145
+ return i.push(R), r *= R, p;
146
+ });
147
+ if (r > 256) return null;
148
+ let h = new Array(r), u;
149
+ return (_) => {
150
+ if (_ == null) return u === void 0 ? u = e() : u;
151
+ let p = 0;
152
+ for (let g = 0; g < o.length; g++) {
153
+ let c = _[o[g]], f = 0;
154
+ if (c === !0) f = n[g];
155
+ else if (c === !1) f = l[g];
156
+ else if (c === null) f = a[g];
157
+ else if (typeof c == "string") f = C[g][c];
158
+ else if (c !== void 0) {
159
+ if (s || B(c)) return e(_);
160
+ f = C[g][String(c)];
161
+ }
162
+ if (f === void 0) return e(_);
163
+ p = p * i[g] + f;
164
+ }
165
+ let R = h[p];
166
+ return R === void 0 && (h[p] = R = e(_)), R;
167
+ };
168
+ }
169
+ function J(e, o) {
170
+ let t = o.length, s = new Array(16 * t), r = new Array(16), i = 0, n = 0, l;
171
+ return (a) => {
172
+ if (a == null) return l === void 0 ? l = e() : l;
173
+ e: for (let u = 0; u < i; u++) {
174
+ let _ = u * t;
175
+ for (let p = 0; p < t; p++)
176
+ if (a[o[p]] !== s[_ + p]) continue e;
177
+ return r[u];
178
+ }
179
+ for (let u = 0; u < t; u++)
180
+ if (B(a[o[u]])) return e(a);
181
+ let C = e(a), h = n * t;
182
+ for (let u = 0; u < t; u++) s[h + u] = a[o[u]];
183
+ return r[n] = C, n === i && i++, n = (n + 1) % 16, C;
184
+ };
185
+ }
186
+ function k(e, o, t) {
187
+ let s = Object.keys(o);
188
+ return s.length === 0 ? e : q(e, s, o, !!t) ?? J(e, s);
189
+ }
190
+
191
+ // src/runtime/internal/shared.ts
192
+ function E(e, o) {
193
+ let t = { ...e };
194
+ for (let s in o)
195
+ o[s] !== void 0 && (t[s] = o[s]);
196
+ return t;
197
+ }
198
+ function j(e, o) {
199
+ for (let t in e) {
200
+ if (t === "css" || t === "className" || t === "classNames") continue;
201
+ let s = e[t], r = o[t];
202
+ if (Array.isArray(s)) {
203
+ if (!s.includes(r)) return !1;
204
+ } else if (r !== s)
205
+ return !1;
206
+ }
207
+ return !0;
208
+ }
209
+
210
+ // src/runtime/internal/recipe.ts
211
+ var D = (e) => e != null && typeof e == "object" && !Array.isArray(e);
212
+ function I(...e) {
213
+ let o = {};
214
+ for (let t of e)
215
+ if (D(t))
216
+ for (let s in t) {
217
+ let r = t[s];
218
+ o[s] = D(r) ? I(o[s], r) : r;
219
+ }
220
+ return o;
221
+ }
222
+ function v(e, o, t = (s) => s) {
223
+ let s = E(e.defaultVariants ?? {}, o), r = e.variants ?? {}, i = [t(e.base)];
224
+ for (let n in s) i.push(t(r[n]?.[s[n]]));
225
+ for (let n of e.compoundVariants ?? [])
226
+ j(n, s) && i.push(t(n.css));
227
+ return I(...i);
228
+ }
229
+ function Q(e, o) {
230
+ let t = {};
231
+ for (let s of e.slots ?? Object.keys(e.base ?? {}))
232
+ t[s] = v(e, o, (r) => r?.[s]);
233
+ return t;
234
+ }
235
+ function U(e, o) {
236
+ let t = { ...e.config?.defaultVariants, ...o.config?.defaultVariants }, s = [.../* @__PURE__ */ new Set([...e.variantKeys ?? [], ...o.variantKeys ?? []])], r = (n = {}) => E(t, n), i = L(
237
+ (n) => {
238
+ let l = r(n);
239
+ return b(e(l), o(l));
240
+ },
241
+ // Compounds from either side rule out the coercing table memo.
242
+ {
243
+ defaultVariants: t,
244
+ compoundVariants: [...e.config?.compoundVariants ?? [], ...o.config?.compoundVariants ?? []]
245
+ },
246
+ s,
247
+ { ...e.variantMap, ...o.variantMap }
248
+ );
249
+ return i.raw = (n) => {
250
+ let l = r(n);
251
+ return I(e.raw(l), o.raw(l));
252
+ }, i;
253
+ }
254
+ function L(e, o, t, s, r) {
255
+ let i = o, n = i.defaultVariants ?? {}, l = k(e, s, i.compoundVariants?.length);
256
+ return Object.assign(l, {
257
+ __cva__: !r,
258
+ variantKeys: t,
259
+ variantMap: s,
260
+ ...r && { classNameMap: r },
261
+ config: o,
262
+ raw: (a = {}) => r ? Q(i, a) : v(i, a),
263
+ // The styled factory passes its own `cva`, so chains merge exactly like styled-system.
264
+ merge: (a, C) => C ? C(o).merge(a) : U(l, a),
265
+ getVariantProps: (a = {}) => E(n, a),
266
+ splitVariantProps: (a) => {
267
+ let C = {}, h = {};
268
+ for (let u in a) (t.includes(u) ? C : h)[u] = a[u];
269
+ return [C, h];
270
+ }
271
+ });
272
+ }
273
+ export {
274
+ L as attachRecipe,
275
+ N as css,
276
+ b as cx,
277
+ k as memoRecipe
278
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/transformer",
3
- "version": "2.0.0-beta.9",
3
+ "version": "2.0.0",
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.9",
39
- "@pandacss/compiler-shared": "2.0.0-beta.9"
37
+ "@pandacss/compiler": "2.0.0",
38
+ "@pandacss/compiler-shared": "2.0.0",
39
+ "unplugin": "^2.3.11"
40
+ },
41
+ "devDependencies": {
42
+ "rolldown": "1.2.7"
40
43
  },
41
44
  "peerDependencies": {
42
45
  "vite": ">=6.0.0",