tailwindcss 4.0.4 → 4.0.5
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/chunk-N4FJXYNV.mjs +10 -0
- package/dist/flatten-color-palette.js +1 -1
- package/dist/flatten-color-palette.mjs +1 -1
- package/dist/lib.d.mts +38 -34
- package/dist/lib.js +19 -19
- package/dist/lib.mjs +10 -19
- package/package.json +2 -2
- package/dist/chunk-WZA4AHDT.mjs +0 -1
@@ -0,0 +1,10 @@
|
|
1
|
+
function I(n){if(arguments.length==0)throw new TypeError("`CSS.escape` requires an argument.");var e=String(n),r=e.length,s=-1,t,l="",o=e.charCodeAt(0);if(r==1&&o==45)return"\\"+e;for(;++s<r;){if(t=e.charCodeAt(s),t==0){l+="\uFFFD";continue}if(t>=1&&t<=31||t==127||s==0&&t>=48&&t<=57||s==1&&t>=48&&t<=57&&o==45){l+="\\"+t.toString(16)+" ";continue}if(t>=128||t==45||t==95||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122){l+=e.charAt(s);continue}l+="\\"+e.charAt(s)}return l}function R(n){return n.replace(/\\([\dA-Fa-f]{1,6}[\t\n\f\r ]?|[\S\s])/g,e=>e.length>2?String.fromCodePoint(Number.parseInt(e.slice(1).trim(),16)):e[1])}var U=new Map([["--font",["--font-weight","--font-size"]],["--inset",["--inset-shadow","--inset-ring"]],["--text",["--text-color","--text-underline-offset","--text-indent","--text-decoration-thickness","--text-decoration-color"]]]);function D(n,e){return(U.get(e)??[]).some(r=>n===r||n.startsWith(`${r}-`))}var L=class{constructor(e=new Map,r=new Set([])){this.values=e;this.keyframes=r}prefix=null;add(e,r,s=0){if(e.endsWith("-*")){if(r!=="initial")throw new Error(`Invalid theme value \`${r}\` for namespace \`${e}\``);e==="--*"?this.values.clear():this.clearNamespace(e.slice(0,-2),0)}if(s&4){let t=this.values.get(e);if(t&&!(t.options&4))return}r==="initial"?this.values.delete(e):this.values.set(e,{value:r,options:s})}keysInNamespaces(e){let r=[];for(let s of e){let t=`${s}-`;for(let l of this.values.keys())l.startsWith(t)&&l.indexOf("--",2)===-1&&(D(l,s)||r.push(l.slice(t.length)))}return r}get(e){for(let r of e){let s=this.values.get(r);if(s)return s.value}return null}hasDefault(e){return(this.getOptions(e)&4)===4}getOptions(e){return e=R(this.#n(e)),this.values.get(e)?.options??0}entries(){return this.prefix?Array.from(this.values,e=>(e[0]=this.#r(e[0]),e)):this.values.entries()}#r(e){return this.prefix?`--${this.prefix}-${e.slice(2)}`:e}#n(e){return this.prefix?`--${e.slice(3+this.prefix.length)}`:e}clearNamespace(e,r){let s=U.get(e)??[];e:for(let t of this.values.keys())if(t.startsWith(e)){if(r!==0&&(this.getOptions(t)&r)!==r)continue;for(let l of s)if(t.startsWith(l))continue e;this.values.delete(t)}}#e(e,r){for(let s of r){let t=e!==null?`${s}-${e}`:s;if(!this.values.has(t))if(e!==null&&e.includes(".")){if(t=`${s}-${e.replaceAll(".","_")}`,!this.values.has(t))continue}else continue;if(!D(t,s))return t}return null}#t(e){return this.values.has(e)?`var(${I(this.#r(e))})`:null}markUsedVariable(e){let r=R(this.#n(e)),s=this.values.get(r);s&&(s.options|=16)}resolve(e,r){let s=this.#e(e,r);if(!s)return null;let t=this.values.get(s);return t.options&1?t.value:this.#t(s)}resolveValue(e,r){let s=this.#e(e,r);return s?this.values.get(s).value:null}resolveWith(e,r,s=[]){let t=this.#e(e,r);if(!t)return null;let l={};for(let u of s){let a=`${t}${u}`,i=this.values.get(a);i&&(i.options&1?l[u]=i.value:l[u]=this.#t(a))}let o=this.values.get(t);return o.options&1?[o.value,l]:[this.#t(t),l]}namespace(e){let r=new Map,s=`${e}-`;for(let[t,l]of this.values)t===e?r.set(null,l.value):t.startsWith(`${s}-`)?r.set(t.slice(e.length),l.value):t.startsWith(s)&&r.set(t.slice(s.length),l.value);return r}addKeyframes(e){this.keyframes.add(e)}getKeyframes(){return Array.from(this.keyframes)}};var N=class extends Map{constructor(r){super();this.factory=r}get(r){let s=super.get(r);return s===void 0&&(s=this.factory(r,this),this.set(r,s)),s}};var j=64;function G(n,e=[]){return{kind:"rule",selector:n,nodes:e}}function $(n,e="",r=[]){return{kind:"at-rule",name:n,params:e,nodes:r}}function M(n,e=[]){return n.charCodeAt(0)===j?x(n,e):G(n,e)}function _(n,e,r=!1){return{kind:"declaration",property:n,value:e,important:r}}function F(n){return{kind:"comment",value:n}}function oe(n,e){return{kind:"context",context:n,nodes:e}}function ae(n){return{kind:"at-root",nodes:n}}function b(n,e,r=[],s={}){for(let t=0;t<n.length;t++){let l=n[t],o=r[r.length-1]??null;if(l.kind==="context"){if(b(l.nodes,e,r,{...s,...l.context})===2)return 2;continue}r.push(l);let u=!1,a=0,i=e(l,{parent:o,context:s,path:r,replaceWith(f){u=!0,Array.isArray(f)?f.length===0?(n.splice(t,1),a=0):f.length===1?(n[t]=f[0],a=1):(n.splice(t,1,...f),a=f.length):(n[t]=f,a=1)}})??0;if(r.pop(),u){i===0?t--:t+=a-1;continue}if(i===2)return 2;if(i!==1&&"nodes"in l){r.push(l);let f=b(l.nodes,e,r,s);if(r.pop(),f===2)return 2}}}function W(n,e,r=[],s={}){for(let t=0;t<n.length;t++){let l=n[t],o=r[r.length-1]??null;if(l.kind==="rule"||l.kind==="at-rule")r.push(l),W(l.nodes,e,r,s),r.pop();else if(l.kind==="context"){W(l.nodes,e,r,{...s,...l.context});continue}r.push(l),e(l,{parent:o,context:s,path:r,replaceWith(u){Array.isArray(u)?u.length===0?n.splice(t,1):u.length===1?n[t]=u[0]:n.splice(t,1,...u):n[t]=u,t+=u.length-1}}),r.pop()}}function fe(n,e){let r=[],s=new Set,t=new N(()=>new Set),l=new Set,o=new Set;function u(i,f,h={},d=0){if(i.kind==="declaration"){if(i.property==="--tw-sort"||i.value===void 0||i.value===null)return;if(h.theme&&i.property[0]==="-"&&i.property[1]==="-"&&t.get(f).add(i),i.value.includes("var(")&&e.trackUsedVariables(i.value),i.property==="animation"){let c=i.value.split(/\s+/);for(let p of c)o.add(p)}f.push(i)}else if(i.kind==="rule")if(i.selector==="&")for(let c of i.nodes){let p=[];u(c,p,h,d+1),p.length>0&&f.push(...p)}else{let c={...i,nodes:[]};for(let p of i.nodes)u(p,c.nodes,h,d+1);c.nodes.length>0&&f.push(c)}else if(i.kind==="at-rule"&&i.name==="@property"&&d===0){if(s.has(i.params))return;s.add(i.params);let c={...i,nodes:[]};for(let p of i.nodes)u(p,c.nodes,h,d+1);f.push(c)}else if(i.kind==="at-rule"){let c={...i,nodes:[]};for(let p of i.nodes)u(p,c.nodes,h,d+1);i.name==="@keyframes"&&h.theme&&l.add(c),(c.nodes.length>0||c.name==="@layer"||c.name==="@charset"||c.name==="@custom-media"||c.name==="@namespace"||c.name==="@import")&&f.push(c)}else if(i.kind==="at-root")for(let c of i.nodes){let p=[];u(c,p,h,0);for(let g of p)r.push(g)}else if(i.kind==="context"){if(i.context.reference)return;for(let c of i.nodes)u(c,f,{...h,...i.context},d)}else i.kind==="comment"&&f.push(i)}let a=[];for(let i of n)u(i,a,{},0);e:for(let[i,f]of t)for(let h of f){if(e.theme.getOptions(h.property)&24){if(h.property.startsWith("--animate-")){let p=h.value.split(/\s+/);for(let g of p)o.add(g)}continue}let c=i.indexOf(h);if(i.splice(c,1),i.length===0){for(let[p,g]of a.entries())if(g.kind==="rule"&&g.nodes===i){a.splice(p,1);break}continue e}}for(let i of l)if(!o.has(i.params)){let f=r.indexOf(i);r.splice(f,1)}return a.concat(r)}function ue(n){function e(s,t=0){let l="",o=" ".repeat(t);if(s.kind==="declaration")l+=`${o}${s.property}: ${s.value}${s.important?" !important":""};
|
2
|
+
`;else if(s.kind==="rule"){l+=`${o}${s.selector} {
|
3
|
+
`;for(let u of s.nodes)l+=e(u,t+1);l+=`${o}}
|
4
|
+
`}else if(s.kind==="at-rule"){if(s.nodes.length===0)return`${o}${s.name} ${s.params};
|
5
|
+
`;l+=`${o}${s.name}${s.params?` ${s.params} `:" "}{
|
6
|
+
`;for(let u of s.nodes)l+=e(u,t+1);l+=`${o}}
|
7
|
+
`}else if(s.kind==="comment")l+=`${o}/*${s.value}*/
|
8
|
+
`;else if(s.kind==="context"||s.kind==="at-root")return"";return l}let r="";for(let s of n){let t=e(s);t!==""&&(r+=t)}return r}var y=92,C=47,k=42,H=34,z=39,Q=58,E=59,m=10,v=32,S=9,P=123,T=125,K=40,B=41,Y=91,q=93,V=45,w=64,X=33;function de(n){n=n.replaceAll(`\r
|
9
|
+
`,`
|
10
|
+
`);let e=[],r=[],s=[],t=null,l=null,o="",u="",a;for(let i=0;i<n.length;i++){let f=n.charCodeAt(i);if(f===y)o+=n.slice(i,i+2),i+=1;else if(f===C&&n.charCodeAt(i+1)===k){let h=i;for(let c=i+2;c<n.length;c++)if(a=n.charCodeAt(c),a===y)c+=1;else if(a===k&&n.charCodeAt(c+1)===C){i=c+1;break}let d=n.slice(h,i+1);d.charCodeAt(2)===X&&r.push(F(d.slice(2,-2)))}else if(f===z||f===H){let h=i;for(let d=i+1;d<n.length;d++)if(a=n.charCodeAt(d),a===y)d+=1;else if(a===f){i=d;break}else{if(a===E&&n.charCodeAt(d+1)===m)throw new Error(`Unterminated string: ${n.slice(h,d+1)+String.fromCharCode(f)}`);if(a===m)throw new Error(`Unterminated string: ${n.slice(h,d)+String.fromCharCode(f)}`)}o+=n.slice(h,i+1)}else{if((f===v||f===m||f===S)&&(a=n.charCodeAt(i+1))&&(a===v||a===m||a===S))continue;if(f===m){if(o.length===0)continue;a=o.charCodeAt(o.length-1),a!==v&&a!==m&&a!==S&&(o+=" ")}else if(f===V&&n.charCodeAt(i+1)===V&&o.length===0){let h="",d=i,c=-1;for(let g=i+2;g<n.length;g++)if(a=n.charCodeAt(g),a===y)g+=1;else if(a===C&&n.charCodeAt(g+1)===k){for(let A=g+2;A<n.length;A++)if(a=n.charCodeAt(A),a===y)A+=1;else if(a===k&&n.charCodeAt(A+1)===C){g=A+1;break}}else if(c===-1&&a===Q)c=o.length+g-d;else if(a===E&&h.length===0){o+=n.slice(d,g),i=g;break}else if(a===K)h+=")";else if(a===Y)h+="]";else if(a===P)h+="}";else if((a===T||n.length-1===g)&&h.length===0){i=g-1,o+=n.slice(d,g);break}else(a===B||a===q||a===T)&&h.length>0&&n[g]===h[h.length-1]&&(h=h.slice(0,-1));let p=O(o,c);if(!p)throw new Error("Invalid custom property, expected a value");t?t.nodes.push(p):e.push(p),o=""}else if(f===E&&o.charCodeAt(0)===w)l=x(o),t?t.nodes.push(l):e.push(l),o="",l=null;else if(f===E&&u[u.length-1]!==")"){let h=O(o);if(!h)throw o.length===0?new Error("Unexpected semicolon"):new Error(`Invalid declaration: \`${o.trim()}\``);t?t.nodes.push(h):e.push(h),o=""}else if(f===P&&u[u.length-1]!==")")u+="}",l=M(o.trim()),t&&t.nodes.push(l),s.push(t),t=l,o="",l=null;else if(f===T&&u[u.length-1]!==")"){if(u==="")throw new Error("Missing opening {");if(u=u.slice(0,-1),o.length>0)if(o.charCodeAt(0)===w)l=x(o),t?t.nodes.push(l):e.push(l),o="",l=null;else{let d=o.indexOf(":");if(t){let c=O(o,d);if(!c)throw new Error(`Invalid declaration: \`${o.trim()}\``);t.nodes.push(c)}}let h=s.pop()??null;h===null&&t&&e.push(t),t=h,o="",l=null}else if(f===K)u+=")",o+="(";else if(f===B){if(u[u.length-1]!==")")throw new Error("Missing opening (");u=u.slice(0,-1),o+=")"}else{if(o.length===0&&(f===v||f===m||f===S))continue;o+=String.fromCharCode(f)}}}if(o.charCodeAt(0)===w&&e.push(x(o)),u.length>0&&t){if(t.kind==="rule")throw new Error(`Missing closing } at ${t.selector}`);if(t.kind==="at-rule")throw new Error(`Missing closing } at ${t.name} ${t.params}`)}return r.length>0?r.concat(e):e}function x(n,e=[]){for(let r=5;r<n.length;r++){let s=n.charCodeAt(r);if(s===v||s===K){let t=n.slice(0,r).trim(),l=n.slice(r).trim();return $(t,l,e)}}return $(n.trim(),"",e)}function O(n,e=n.indexOf(":")){if(e===-1)return null;let r=n.indexOf("!important",e+1);return _(n.slice(0,e).trim(),n.slice(e+1,r===-1?n.length:r).trim(),r!==-1)}export{de as a,I as b,R as c,L as d,N as e,G as f,$ as g,M as h,_ as i,F as j,oe as k,ae as l,b as m,W as n,fe as o,ue as p};
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";function
|
1
|
+
"use strict";function i(r){let n={};for(let[e,t]of Object.entries(r??{}))if(e!=="__CSS_VALUES__")if(typeof t=="object"&&t!==null)for(let[s,l]of Object.entries(i(t)))n[`${e}${s==="DEFAULT"?"":`-${s}`}`]=l;else n[e]=t;if("__CSS_VALUES__"in r)for(let[e,t]of Object.entries(r.__CSS_VALUES__))Number(t)&4||(n[e]=r[e]);return n}module.exports=i;
|
@@ -1 +1 @@
|
|
1
|
-
import"./chunk-
|
1
|
+
import"./chunk-N4FJXYNV.mjs";function i(r){let n={};for(let[e,t]of Object.entries(r??{}))if(e!=="__CSS_VALUES__")if(typeof t=="object"&&t!==null)for(let[o,f]of Object.entries(i(t)))n[`${e}${o==="DEFAULT"?"":`-${o}`}`]=f;else n[e]=t;if("__CSS_VALUES__"in r)for(let[e,t]of Object.entries(r.__CSS_VALUES__))Number(t)&4||(n[e]=r[e]);return n}export{i as default};
|
package/dist/lib.d.mts
CHANGED
@@ -2,44 +2,13 @@ import { U as UserConfig, P as Plugin } from './types-BTRmm49E.mjs';
|
|
2
2
|
import { V as Variant, C as Candidate } from './resolve-config-QUZ9b-Gn.mjs';
|
3
3
|
import './colors.mjs';
|
4
4
|
|
5
|
-
type StyleRule = {
|
6
|
-
kind: 'rule';
|
7
|
-
selector: string;
|
8
|
-
nodes: AstNode[];
|
9
|
-
};
|
10
|
-
type AtRule = {
|
11
|
-
kind: 'at-rule';
|
12
|
-
name: string;
|
13
|
-
params: string;
|
14
|
-
nodes: AstNode[];
|
15
|
-
};
|
16
|
-
type Declaration = {
|
17
|
-
kind: 'declaration';
|
18
|
-
property: string;
|
19
|
-
value: string | undefined;
|
20
|
-
important: boolean;
|
21
|
-
};
|
22
|
-
type Comment = {
|
23
|
-
kind: 'comment';
|
24
|
-
value: string;
|
25
|
-
};
|
26
|
-
type Context = {
|
27
|
-
kind: 'context';
|
28
|
-
context: Record<string, string | boolean>;
|
29
|
-
nodes: AstNode[];
|
30
|
-
};
|
31
|
-
type AtRoot = {
|
32
|
-
kind: 'at-root';
|
33
|
-
nodes: AstNode[];
|
34
|
-
};
|
35
|
-
type Rule = StyleRule | AtRule;
|
36
|
-
type AstNode = StyleRule | AtRule | Declaration | Comment | Context | AtRoot;
|
37
|
-
|
38
5
|
declare const enum ThemeOptions {
|
39
6
|
NONE = 0,
|
40
7
|
INLINE = 1,
|
41
8
|
REFERENCE = 2,
|
42
|
-
DEFAULT = 4
|
9
|
+
DEFAULT = 4,
|
10
|
+
STATIC = 8,
|
11
|
+
USED = 16
|
43
12
|
}
|
44
13
|
declare class Theme {
|
45
14
|
#private;
|
@@ -63,6 +32,7 @@ declare class Theme {
|
|
63
32
|
options: ThemeOptions;
|
64
33
|
}][];
|
65
34
|
clearNamespace(namespace: string, clearOptions: ThemeOptions): void;
|
35
|
+
markUsedVariable(themeKey: string): void;
|
66
36
|
resolve(candidateValue: string | null, themeKeys: ThemeKey[]): string | null;
|
67
37
|
resolveValue(candidateValue: string | null, themeKeys: ThemeKey[]): string | null;
|
68
38
|
resolveWith(candidateValue: string, themeKeys: ThemeKey[], nestedKeys?: `--${string}`[]): [string, Record<string, string>] | null;
|
@@ -204,9 +174,43 @@ type DesignSystem = {
|
|
204
174
|
compileAstNodes(candidate: Candidate): ReturnType<typeof compileAstNodes>;
|
205
175
|
getVariantOrder(): Map<Variant, number>;
|
206
176
|
resolveThemeValue(path: string): string | undefined;
|
177
|
+
trackUsedVariables(raw: string): void;
|
207
178
|
candidatesToCss(classes: string[]): (string | null)[];
|
208
179
|
};
|
209
180
|
|
181
|
+
type StyleRule = {
|
182
|
+
kind: 'rule';
|
183
|
+
selector: string;
|
184
|
+
nodes: AstNode[];
|
185
|
+
};
|
186
|
+
type AtRule = {
|
187
|
+
kind: 'at-rule';
|
188
|
+
name: string;
|
189
|
+
params: string;
|
190
|
+
nodes: AstNode[];
|
191
|
+
};
|
192
|
+
type Declaration = {
|
193
|
+
kind: 'declaration';
|
194
|
+
property: string;
|
195
|
+
value: string | undefined;
|
196
|
+
important: boolean;
|
197
|
+
};
|
198
|
+
type Comment = {
|
199
|
+
kind: 'comment';
|
200
|
+
value: string;
|
201
|
+
};
|
202
|
+
type Context = {
|
203
|
+
kind: 'context';
|
204
|
+
context: Record<string, string | boolean>;
|
205
|
+
nodes: AstNode[];
|
206
|
+
};
|
207
|
+
type AtRoot = {
|
208
|
+
kind: 'at-root';
|
209
|
+
nodes: AstNode[];
|
210
|
+
};
|
211
|
+
type Rule = StyleRule | AtRule;
|
212
|
+
type AstNode = StyleRule | AtRule | Declaration | Comment | Context | AtRoot;
|
213
|
+
|
210
214
|
type Config = UserConfig;
|
211
215
|
type CompileOptions = {
|
212
216
|
base?: string;
|