1 | // Type definitions for postcss-preset-env 7.7
|
2 | // Project: https://github.com/csstools/postcss-plugins/tree/main/plugin-packs/postcss-preset-env
|
3 | // Definitions by: Latif Sulistyo <https://github.com/latipun7>
|
4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
5 | // TypeScript Version: 4.0
|
6 |
|
7 | import { PluginCreator as PostCSSPlugin } from 'postcss';
|
8 | import { Options as AutoprefixerOptions } from 'autoprefixer';
|
9 |
|
10 | declare namespace postcssPresetEnv {
|
11 | interface pluginOptions {
|
12 | /**
|
13 | * The stage option determines which CSS features to polyfill,
|
14 | * based upon their stability in the process of becoming
|
15 | * implemented web standards.
|
16 | *
|
17 | * `postcssPresetEnv({ stage: 0 })`
|
18 | *
|
19 | * The `stage` can be `0` (experimental) through `4` (stable), or false.
|
20 | * Setting stage to false will disable every polyfill. Doing this would only
|
21 | * be useful if you intended to exclusively use the `features` option.
|
22 | *
|
23 | * Without any configuration options, PostCSS Preset Env enables
|
24 | * **Stage 2** features.
|
25 | */
|
26 | stage?: number | undefined;
|
27 |
|
28 | /**
|
29 | * The features option enables or disables specific polyfills by ID.
|
30 | * Passing true to a specific feature ID will enable its polyfill,
|
31 | * while passing false will disable it.
|
32 | *
|
33 | * Passing an object to a specific feature ID will both enable and
|
34 | * configure it.
|
35 | *
|
36 | * Any polyfills not explicitly enabled or disabled through `features`
|
37 | * are determined by the `stage` option.
|
38 | */
|
39 | features?: pluginOptions.features | undefined;
|
40 |
|
41 | /**
|
42 | * The browsers option determines which polyfills are required based upon
|
43 | * the browsers you are supporting.
|
44 | *
|
45 | * PostCSS Preset Env supports any standard browserslist configuration,
|
46 | * which can be a `.browserslistrc` file, a `browserslist` key in
|
47 | * `package.json`, or `browserslist` environment variables.
|
48 | *
|
49 | * The `browsers` option should only be used when a standard browserslist
|
50 | * configuration is not available.
|
51 | *
|
52 | * @default default
|
53 | */
|
54 | browsers?: string | string[] | undefined;
|
55 |
|
56 | /**
|
57 | * The `insertAfter` keys allow you to insert other PostCSS plugins
|
58 | * into the chain. This is only useful if you are also using sugary
|
59 | * PostCSS plugins that must execute before or after certain polyfills.
|
60 | * `insertAfter` support chaining one or multiple plugins.
|
61 | */
|
62 | insertAfter?: object | undefined;
|
63 |
|
64 | /**
|
65 | * The `insertBefore` keys allow you to insert other PostCSS plugins
|
66 | * into the chain. This is only useful if you are also using sugary
|
67 | * PostCSS plugins that must execute before or after certain polyfills.
|
68 | * `insertBefore` support chaining one or multiple plugins.
|
69 | */
|
70 | insertBefore?: object | undefined;
|
71 |
|
72 | /**
|
73 | * PostCSS Preset Env includes
|
74 | * [autoprefixer](https://github.com/postcss/autoprefixer)
|
75 | * and `browsers` option will be passed to it automatically.
|
76 | *
|
77 | * Specifying the `autoprefixer` option enables passing
|
78 | * [additional options](https://github.com/postcss/autoprefixer#options)
|
79 | * into autoprefixer.
|
80 | *
|
81 | * Passing `autoprefixer: false` disables autoprefixer.
|
82 | */
|
83 | autoprefixer?: boolean | AutoprefixerOptions | undefined;
|
84 |
|
85 | /**
|
86 | * The `preserve` option determines whether all plugins should receive
|
87 | * a `preserve` option, which may preserve or remove otherwise-polyfilled CSS.
|
88 | * By default, this option is not configured.
|
89 | */
|
90 | preserve?: boolean | undefined;
|
91 |
|
92 | /**
|
93 | * The `importFrom` option specifies sources where variables like
|
94 | * Custom Media, Custom Properties, Custom Selectors, and
|
95 | * Environment Variables can be imported from, which might be
|
96 | * CSS, JS, and JSON files, functions, and directly passed objects.
|
97 | */
|
98 | importFrom?: string | any[] | undefined;
|
99 |
|
100 | /**
|
101 | * The `exportTo` option specifies destinations where variables like
|
102 | * Custom Media, Custom Properties, Custom Selectors, and
|
103 | * Environment Variables can be exported to, which might be
|
104 | * CSS, JS, and JSON files, functions, and directly passed objects.
|
105 | */
|
106 | exportTo?: string | any[] | undefined;
|
107 | }
|
108 |
|
109 | namespace pluginOptions {
|
110 | interface features {
|
111 | 'all-property'?: boolean | object | undefined;
|
112 | 'any-link-pseudo-class'?: boolean | object | undefined;
|
113 | 'blank-pseudo-class'?: boolean | object | undefined;
|
114 | 'break-properties'?: boolean | object | undefined;
|
115 | 'case-insensitive-attributes'?: boolean | object | undefined;
|
116 | 'color-functional-notation'?: boolean | object | undefined;
|
117 | 'color-mod-function'?: boolean | object | undefined;
|
118 | 'custom-media-queries'?: boolean | object | undefined;
|
119 | 'custom-properties'?: boolean | object | undefined;
|
120 | 'custom-selectors'?: boolean | object | undefined;
|
121 | 'dir-pseudo-class'?: boolean | object | undefined;
|
122 | 'double-position-gradients'?: boolean | object | undefined;
|
123 | 'environment-variables'?: boolean | object | undefined;
|
124 | 'focus-visible-pseudo-class'?: boolean | object | undefined;
|
125 | 'focus-within-pseudo-class'?: boolean | object | undefined;
|
126 | 'font-variant-property'?: boolean | object | undefined;
|
127 | 'gap-properties'?: boolean | object | undefined;
|
128 | 'gray-function'?: boolean | object | undefined;
|
129 | 'has-pseudo-class'?: boolean | object | undefined;
|
130 | 'hexadecimal-alpha-notation'?: boolean | object | undefined;
|
131 | 'image-set-function'?: boolean | object | undefined;
|
132 | 'lab-function'?: boolean | object | undefined;
|
133 | 'logical-properties-and-values'?: boolean | object | undefined;
|
134 | 'matches-pseudo-class'?: boolean | object | undefined;
|
135 | 'media-query-ranges'?: boolean | object | undefined;
|
136 | 'nesting-rules'?: boolean | object | undefined;
|
137 | 'not-pseudo-class'?: boolean | object | undefined;
|
138 | 'overflow-property'?: boolean | object | undefined;
|
139 | 'overflow-wrap-property'?: boolean | object | undefined;
|
140 | 'place-properties'?: boolean | object | undefined;
|
141 | 'prefers-color-scheme-query'?: boolean | object | undefined;
|
142 | 'rebeccapurple-color'?: boolean | object | undefined;
|
143 | 'system-ui-font-family'?: boolean | object | undefined;
|
144 | }
|
145 | }
|
146 |
|
147 | type PostcssPresetEnv = PostCSSPlugin<pluginOptions>;
|
148 | }
|
149 |
|
150 | declare const postcssPresetEnv: postcssPresetEnv.PostcssPresetEnv;
|
151 | export = postcssPresetEnv;
|