tailwindcss 4.0.0-alpha.8 → 4.0.0-beta.1

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,10 @@
1
+ import { a as PluginFn, C as Config, b as PluginWithConfig, c as PluginWithOptions } from './types-CAsznCh5.mjs';
2
+ import './resolve-config-QUZ9b-Gn.mjs';
3
+ import './colors.mjs';
4
+
5
+ declare function createPlugin(handler: PluginFn, config?: Partial<Config>): PluginWithConfig;
6
+ declare namespace createPlugin {
7
+ var withOptions: <T>(pluginFunction: (options?: T) => PluginFn, configFunction?: (options?: T) => Partial<Config>) => PluginWithOptions<T>;
8
+ }
9
+
10
+ export { createPlugin as default };
@@ -0,0 +1,102 @@
1
+ import { P as PluginUtils, N as NamedUtilityValue } from './resolve-config-BIFUA2FY.js';
2
+ import './colors-b_6i0Oi7.js';
3
+
4
+ type ResolvableTo<T> = T | ((utils: PluginUtils) => T);
5
+ type ThemeValue = ResolvableTo<Record<string, unknown>> | null | undefined;
6
+ type ThemeConfig = Record<string, ThemeValue> & {
7
+ extend?: Record<string, ThemeValue>;
8
+ };
9
+ type ContentFile = string | {
10
+ raw: string;
11
+ extension?: string;
12
+ };
13
+ type DarkModeStrategy = false | 'media' | 'class' | ['class', string] | 'selector' | ['selector', string] | ['variant', string | string[]];
14
+ interface UserConfig {
15
+ presets?: UserConfig[];
16
+ theme?: ThemeConfig;
17
+ plugins?: Plugin[];
18
+ }
19
+ interface UserConfig {
20
+ content?: ContentFile[] | {
21
+ relative?: boolean;
22
+ files: ContentFile[];
23
+ };
24
+ }
25
+ interface UserConfig {
26
+ darkMode?: DarkModeStrategy;
27
+ }
28
+ interface UserConfig {
29
+ prefix?: string;
30
+ }
31
+ interface UserConfig {
32
+ blocklist?: string[];
33
+ }
34
+ interface UserConfig {
35
+ important?: boolean | string;
36
+ }
37
+ interface UserConfig {
38
+ future?: 'all' | Record<string, boolean>;
39
+ }
40
+
41
+ type Config = UserConfig;
42
+ type PluginFn = (api: PluginAPI) => void;
43
+ type PluginWithConfig = {
44
+ handler: PluginFn;
45
+ config?: UserConfig;
46
+ };
47
+ type PluginWithOptions<T> = {
48
+ (options?: T): PluginWithConfig;
49
+ __isOptionsFunction: true;
50
+ };
51
+ type Plugin = PluginFn | PluginWithConfig | PluginWithOptions<any>;
52
+ type PluginAPI = {
53
+ addBase(base: CssInJs): void;
54
+ addVariant(name: string, variant: string | string[] | CssInJs): void;
55
+ matchVariant<T = string>(name: string, cb: (value: T | string, extra: {
56
+ modifier: string | null;
57
+ }) => string | string[], options?: {
58
+ values?: Record<string, T>;
59
+ sort?(a: {
60
+ value: T | string;
61
+ modifier: string | null;
62
+ }, b: {
63
+ value: T | string;
64
+ modifier: string | null;
65
+ }): number;
66
+ }): void;
67
+ addUtilities(utilities: Record<string, CssInJs | CssInJs[]> | Record<string, CssInJs | CssInJs[]>[], options?: {}): void;
68
+ matchUtilities(utilities: Record<string, (value: string, extra: {
69
+ modifier: string | null;
70
+ }) => CssInJs | CssInJs[]>, options?: Partial<{
71
+ type: string | string[];
72
+ supportsNegativeValues: boolean;
73
+ values: Record<string, string> & {
74
+ __BARE_VALUE__?: (value: NamedUtilityValue) => string | undefined;
75
+ };
76
+ modifiers: 'any' | Record<string, string>;
77
+ }>): void;
78
+ addComponents(utilities: Record<string, CssInJs> | Record<string, CssInJs>[], options?: {}): void;
79
+ matchComponents(utilities: Record<string, (value: string, extra: {
80
+ modifier: string | null;
81
+ }) => CssInJs>, options?: Partial<{
82
+ type: string | string[];
83
+ supportsNegativeValues: boolean;
84
+ values: Record<string, string> & {
85
+ __BARE_VALUE__?: (value: NamedUtilityValue) => string | undefined;
86
+ };
87
+ modifiers: 'any' | Record<string, string>;
88
+ }>): void;
89
+ theme(path: string, defaultValue?: any): any;
90
+ config(path?: string, defaultValue?: any): any;
91
+ prefix(className: string): string;
92
+ };
93
+ type CssInJs = {
94
+ [key: string]: string | string[] | CssInJs | CssInJs[];
95
+ };
96
+
97
+ declare function createPlugin(handler: PluginFn, config?: Partial<Config>): PluginWithConfig;
98
+ declare namespace createPlugin {
99
+ var withOptions: <T>(pluginFunction: (options?: T) => PluginFn, configFunction?: (options?: T) => Partial<Config>) => PluginWithOptions<T>;
100
+ }
101
+
102
+ export { createPlugin as default };
package/dist/plugin.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";function u(i,n){return{handler:i,config:n}}u.withOptions=function(i,n=()=>({})){function t(o){return{handler:i(o),config:n(o)}}return t.__isOptionsFunction=!0,t};var g=u;module.exports=g;
@@ -0,0 +1 @@
1
+ function u(n,i){return{handler:n,config:i}}u.withOptions=function(n,i=()=>({})){function t(o){return{handler:n(o),config:i(o)}}return t.__isOptionsFunction=!0,t};var g=u;export{g as default};
@@ -0,0 +1,29 @@
1
+ import { _ as _default } from './colors-b_6i0Oi7.js';
2
+
3
+ type NamedUtilityValue = {
4
+ kind: 'named';
5
+ /**
6
+ * ```
7
+ * bg-red-500
8
+ * ^^^^^^^
9
+ *
10
+ * w-1/2
11
+ * ^
12
+ * ```
13
+ */
14
+ value: string;
15
+ /**
16
+ * ```
17
+ * w-1/2
18
+ * ^^^
19
+ * ```
20
+ */
21
+ fraction: string | null;
22
+ };
23
+
24
+ type PluginUtils = {
25
+ theme: (keypath: string, defaultValue?: any) => any;
26
+ colors: typeof _default;
27
+ };
28
+
29
+ export type { NamedUtilityValue as N, PluginUtils as P };
@@ -0,0 +1,190 @@
1
+ import _default from './colors.mjs';
2
+
3
+ type ArbitraryUtilityValue = {
4
+ kind: 'arbitrary';
5
+ /**
6
+ * ```
7
+ * bg-[color:var(--my-color)]
8
+ * ^^^^^
9
+ *
10
+ * bg-(color:--my-color)
11
+ * ^^^^^
12
+ * ```
13
+ */
14
+ dataType: string | null;
15
+ /**
16
+ * ```
17
+ * bg-[#0088cc]
18
+ * ^^^^^^^
19
+ *
20
+ * bg-[var(--my_variable)]
21
+ * ^^^^^^^^^^^^^^^^^^
22
+ *
23
+ * bg-(--my_variable)
24
+ * ^^^^^^^^^^^^^^
25
+ * ```
26
+ */
27
+ value: string;
28
+ };
29
+ type NamedUtilityValue = {
30
+ kind: 'named';
31
+ /**
32
+ * ```
33
+ * bg-red-500
34
+ * ^^^^^^^
35
+ *
36
+ * w-1/2
37
+ * ^
38
+ * ```
39
+ */
40
+ value: string;
41
+ /**
42
+ * ```
43
+ * w-1/2
44
+ * ^^^
45
+ * ```
46
+ */
47
+ fraction: string | null;
48
+ };
49
+ type ArbitraryModifier = {
50
+ kind: 'arbitrary';
51
+ /**
52
+ * ```
53
+ * bg-red-500/[50%]
54
+ * ^^^
55
+ * ```
56
+ */
57
+ value: string;
58
+ };
59
+ type NamedModifier = {
60
+ kind: 'named';
61
+ /**
62
+ * ```
63
+ * bg-red-500/50
64
+ * ^^
65
+ * ```
66
+ */
67
+ value: string;
68
+ };
69
+ type ArbitraryVariantValue = {
70
+ kind: 'arbitrary';
71
+ value: string;
72
+ };
73
+ type NamedVariantValue = {
74
+ kind: 'named';
75
+ value: string;
76
+ };
77
+ type Variant =
78
+ /**
79
+ * Arbitrary variants are variants that take a selector and generate a variant
80
+ * on the fly.
81
+ *
82
+ * E.g.: `[&_p]`
83
+ */
84
+ {
85
+ kind: 'arbitrary';
86
+ selector: string;
87
+ relative: boolean;
88
+ }
89
+ /**
90
+ * Static variants are variants that don't take any arguments.
91
+ *
92
+ * E.g.: `hover`
93
+ */
94
+ | {
95
+ kind: 'static';
96
+ root: string;
97
+ }
98
+ /**
99
+ * Functional variants are variants that can take an argument. The argument is
100
+ * either a named variant value or an arbitrary variant value.
101
+ *
102
+ * E.g.:
103
+ *
104
+ * - `aria-disabled`
105
+ * - `aria-[disabled]`
106
+ * - `@container-size` -> @container, with named value `size`
107
+ * - `@container-[inline-size]` -> @container, with arbitrary variant value `inline-size`
108
+ * - `@container` -> @container, with no value
109
+ */
110
+ | {
111
+ kind: 'functional';
112
+ root: string;
113
+ value: ArbitraryVariantValue | NamedVariantValue | null;
114
+ modifier: ArbitraryModifier | NamedModifier | null;
115
+ }
116
+ /**
117
+ * Compound variants are variants that take another variant as an argument.
118
+ *
119
+ * E.g.:
120
+ *
121
+ * - `has-[&_p]`
122
+ * - `group-*`
123
+ * - `peer-*`
124
+ */
125
+ | {
126
+ kind: 'compound';
127
+ root: string;
128
+ modifier: ArbitraryModifier | NamedModifier | null;
129
+ variant: Variant;
130
+ };
131
+ type Candidate =
132
+ /**
133
+ * Arbitrary candidates are candidates that register utilities on the fly with
134
+ * a property and a value.
135
+ *
136
+ * E.g.:
137
+ *
138
+ * - `[color:red]`
139
+ * - `[color:red]/50`
140
+ * - `[color:red]/50!`
141
+ */
142
+ {
143
+ kind: 'arbitrary';
144
+ property: string;
145
+ value: string;
146
+ modifier: ArbitraryModifier | NamedModifier | null;
147
+ variants: Variant[];
148
+ important: boolean;
149
+ raw: string;
150
+ }
151
+ /**
152
+ * Static candidates are candidates that don't take any arguments.
153
+ *
154
+ * E.g.:
155
+ *
156
+ * - `underline`
157
+ * - `box-border`
158
+ */
159
+ | {
160
+ kind: 'static';
161
+ root: string;
162
+ variants: Variant[];
163
+ important: boolean;
164
+ raw: string;
165
+ }
166
+ /**
167
+ * Functional candidates are candidates that can take an argument.
168
+ *
169
+ * E.g.:
170
+ *
171
+ * - `bg-red-500`
172
+ * - `bg-[#0088cc]`
173
+ * - `w-1/2`
174
+ */
175
+ | {
176
+ kind: 'functional';
177
+ root: string;
178
+ value: ArbitraryUtilityValue | NamedUtilityValue | null;
179
+ modifier: ArbitraryModifier | NamedModifier | null;
180
+ variants: Variant[];
181
+ important: boolean;
182
+ raw: string;
183
+ };
184
+
185
+ type PluginUtils = {
186
+ theme: (keypath: string, defaultValue?: any) => any;
187
+ colors: typeof _default;
188
+ };
189
+
190
+ export type { Candidate as C, NamedUtilityValue as N, PluginUtils as P, Variant as V };
@@ -0,0 +1,96 @@
1
+ import { N as NamedUtilityValue, P as PluginUtils } from './resolve-config-QUZ9b-Gn.mjs';
2
+
3
+ type Config = UserConfig;
4
+ type PluginFn = (api: PluginAPI) => void;
5
+ type PluginWithConfig = {
6
+ handler: PluginFn;
7
+ config?: UserConfig;
8
+ };
9
+ type PluginWithOptions<T> = {
10
+ (options?: T): PluginWithConfig;
11
+ __isOptionsFunction: true;
12
+ };
13
+ type Plugin = PluginFn | PluginWithConfig | PluginWithOptions<any>;
14
+ type PluginAPI = {
15
+ addBase(base: CssInJs): void;
16
+ addVariant(name: string, variant: string | string[] | CssInJs): void;
17
+ matchVariant<T = string>(name: string, cb: (value: T | string, extra: {
18
+ modifier: string | null;
19
+ }) => string | string[], options?: {
20
+ values?: Record<string, T>;
21
+ sort?(a: {
22
+ value: T | string;
23
+ modifier: string | null;
24
+ }, b: {
25
+ value: T | string;
26
+ modifier: string | null;
27
+ }): number;
28
+ }): void;
29
+ addUtilities(utilities: Record<string, CssInJs | CssInJs[]> | Record<string, CssInJs | CssInJs[]>[], options?: {}): void;
30
+ matchUtilities(utilities: Record<string, (value: string, extra: {
31
+ modifier: string | null;
32
+ }) => CssInJs | CssInJs[]>, options?: Partial<{
33
+ type: string | string[];
34
+ supportsNegativeValues: boolean;
35
+ values: Record<string, string> & {
36
+ __BARE_VALUE__?: (value: NamedUtilityValue) => string | undefined;
37
+ };
38
+ modifiers: 'any' | Record<string, string>;
39
+ }>): void;
40
+ addComponents(utilities: Record<string, CssInJs> | Record<string, CssInJs>[], options?: {}): void;
41
+ matchComponents(utilities: Record<string, (value: string, extra: {
42
+ modifier: string | null;
43
+ }) => CssInJs>, options?: Partial<{
44
+ type: string | string[];
45
+ supportsNegativeValues: boolean;
46
+ values: Record<string, string> & {
47
+ __BARE_VALUE__?: (value: NamedUtilityValue) => string | undefined;
48
+ };
49
+ modifiers: 'any' | Record<string, string>;
50
+ }>): void;
51
+ theme(path: string, defaultValue?: any): any;
52
+ config(path?: string, defaultValue?: any): any;
53
+ prefix(className: string): string;
54
+ };
55
+ type CssInJs = {
56
+ [key: string]: string | string[] | CssInJs | CssInJs[];
57
+ };
58
+
59
+ type ResolvableTo<T> = T | ((utils: PluginUtils) => T);
60
+ type ThemeValue = ResolvableTo<Record<string, unknown>> | null | undefined;
61
+ type ThemeConfig = Record<string, ThemeValue> & {
62
+ extend?: Record<string, ThemeValue>;
63
+ };
64
+ type ContentFile = string | {
65
+ raw: string;
66
+ extension?: string;
67
+ };
68
+ type DarkModeStrategy = false | 'media' | 'class' | ['class', string] | 'selector' | ['selector', string] | ['variant', string | string[]];
69
+ interface UserConfig {
70
+ presets?: UserConfig[];
71
+ theme?: ThemeConfig;
72
+ plugins?: Plugin[];
73
+ }
74
+ interface UserConfig {
75
+ content?: ContentFile[] | {
76
+ relative?: boolean;
77
+ files: ContentFile[];
78
+ };
79
+ }
80
+ interface UserConfig {
81
+ darkMode?: DarkModeStrategy;
82
+ }
83
+ interface UserConfig {
84
+ prefix?: string;
85
+ }
86
+ interface UserConfig {
87
+ blocklist?: string[];
88
+ }
89
+ interface UserConfig {
90
+ important?: boolean | string;
91
+ }
92
+ interface UserConfig {
93
+ future?: 'all' | Record<string, boolean>;
94
+ }
95
+
96
+ export type { Config as C, Plugin as P, UserConfig as U, PluginFn as a, PluginWithConfig as b, PluginWithOptions as c };