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

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(preset-wind4): add reset css in preset-wind4 #4458

Merged
merged 1 commit into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion packages-presets/preset-wind4/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { PresetOptions } from '@unocss/core'
import type { Theme } from './theme'
import { definePreset } from '@unocss/core'
import { extractorArbitraryVariants } from '@unocss/extractor-arbitrary-variants'

import { postprocessors } from './postprocess'
import { preflights } from './preflights'
import { rules } from './rules'
Expand Down Expand Up @@ -38,24 +37,28 @@ export interface PresetWind4Options extends PresetOptions {
* @default 'class'
*/
dark?: 'class' | 'media' | DarkModeSelectors

/**
* Generate tagged pseudo selector as `[group=""]` instead of `.group`
*
* @default false
*/
attributifyPseudo?: boolean

/**
* Prefix for CSS variables.
*
* @default 'un-'
*/
variablePrefix?: string

/**
* Utils prefix. When using tagged pseudo selector, only the first truthy prefix will be used.
*
* @default undefined
*/
prefix?: string | string[]

/**
* Enable arbitrary variants, for example `<div class="[&>*]:m-1 [&[open]]:p-2"></div>`.
*
Expand All @@ -64,10 +67,12 @@ export interface PresetWind4Options extends PresetOptions {
* @default true
*/
arbitraryVariants?: boolean

/**
* Choose which theme keys to export as CSS variables.
*/
themeKeys?: string[] | ((keys: string[]) => string[])

/**
* The important option lets you control whether UnoCSS’s utilities should be marked with `!important`.
*
Expand All @@ -80,6 +85,13 @@ export interface PresetWind4Options extends PresetOptions {
* @default false
*/
important?: boolean | string

/**
* Reset the default preflight styles.
*
* @default true
*/
reset?: boolean
}

export const presetWind4 = definePreset<PresetWind4Options, Theme>((options = {}) => {
Expand All @@ -93,6 +105,9 @@ export const presetWind4 = definePreset<PresetWind4Options, Theme>((options = {}
rules,
shortcuts,
theme,
layers: {
theme: -150,
},
preflights: preflights(options),
variants: variants(options),
prefix: options.prefix,
Expand Down
4 changes: 3 additions & 1 deletion packages-presets/preset-wind4/src/preflights/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import type { Preflight } from '@unocss/core'
import type { PresetWind4Options } from '..'
import type { Theme } from '../theme/types'
import { reset } from './reset'
import { theme } from './theme'

export const preflights: (options: PresetWind4Options) => Preflight<Theme>[] = (options) => {
return [
theme(options),
]
reset(options),
].filter(Boolean) as Preflight<Theme>[]
}
Loading
0