8000 feat(preset-wind4): add reset css in `preset-wind4` (#4458) · unocss/unocss@e5f7999 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit e5f7999

Browse files
authored
feat(preset-wind4): add reset css in preset-wind4 (#4458)
1 parent 2d8828e commit e5f7999

File tree

7 files changed

+435
-407
lines changed

7 files changed

+435
-407
lines changed

packages-presets/preset-wind4/src/index.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type { PresetOptions } from '@unocss/core'
22
import type { Theme } from './theme'
33
import { definePreset } from '@unocss/core'
44
import { extractorArbitraryVariants } from '@unocss/extractor-arbitrary-variants'
5-
65
import { postprocessors } from './postprocess'
76
import { preflights } from './preflights'
87
import { rules } from './rules'
@@ -38,24 +37,28 @@ export interface PresetWind4Options extends PresetOptions {
3837
* @default 'class'
3938
*/
4039
dark?: 'class' | 'media' | DarkModeSelectors
40+
4141
/**
4242
* Generate tagged pseudo selector as `[group=""]` instead of `.group`
4343
*
4444
* @default false
4545
*/
4646
attributifyPseudo?: boolean
47+
4748
/**
4849
* Prefix for CSS variables.
4950
*
5051
* @default 'un-'
5152
*/
5253
variablePrefix?: string
54+
5355
/**
5456
* Utils prefix. When using tagged pseudo selector, only the first truthy prefix will be used.
5557
*
5658
* @default undefined
5759
*/
5860
prefix?: string | string[]
61+
5962
/**
6063
* Enable arbitrary variants, for example `<div class="[&>*]:m-1 [&[open]]:p-2"></div>`.
6164
*
@@ -64,10 +67,12 @@ export interface PresetWind4Options extends PresetOptions {
6467
* @default true
6568
*/
6669
arbitraryVariants?: boolean
70+
6771
/**
6872
* Choose which theme keys to export as CSS variables.
6973
*/
7074
themeKeys?: string[] | ((keys: string[]) => string[])
75+
7176
/**
7277
* The important option lets you control whether UnoCSS’s utilities should be marked with `!important`.
7378
*
@@ -80,6 +85,13 @@ export interface PresetWind4Options extends PresetOptions {
8085
* @default false
8186
*/
8287
important?: boolean | string
88+
89+
/**
90+
* Reset the default preflight styles.
91+
*
92+
* @default true
93+
*/
94+
reset?: boolean
8395
}
8496

8597
export const presetWind4 = definePreset<PresetWind4Options, Theme>((options = {}) => {
@@ -93,6 +105,9 @@ export const presetWind4 = definePreset<PresetWind4Options, Theme>((options = {}
93105
rules,
94106
shortcuts,
95107
theme,
108+
layers: {
109+
theme: -150,
110+
},
96111
preflights: preflights(options),
97112
variants: variants(options),
98113
prefix: options.prefix,
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import type { Preflight } from '@unocss/core'
22
import type { PresetWind4Options } from '..'
33
import type { Theme } from '../theme/types'
4+
import { reset } from './reset'
45
import { theme } from './theme'
56

67
export const preflights: (options: PresetWind4Options) => Preflight<Theme>[] = (options) => {
78
return [
89
theme(options),
9-
]
10+
reset(options),
11+
].filter(Boolean) as Preflight<Theme>[]
1012
}

0 commit comments

Comments
 (0)
0