Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into rule-props
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Aug 2, 2024
2 parents 9ab3619 + be59ad4 commit 3707c3b
Show file tree
Hide file tree
Showing 12 changed files with 168 additions and 168 deletions.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,12 @@ This API can then be used by [plugins] to do a lot of useful things,
e.g., to find errors automatically, or to insert vendor prefixes.

Currently, PostCSS has more than 200 plugins. You can find all of the plugins
in the [plugins list] or in the [searchable catalog]. Below is a list
of our favorite plugins — the best demonstrations of what can be built
on top of PostCSS.
in the [plugins list]. Below is a list of our favorite plugins —
the best demonstrations of what can be built on top of PostCSS.

If you have any new ideas, [PostCSS plugin development] is really easy.

[searchable catalog]: https://www.postcss.parts/
[plugins list]: https://github.com/postcss/postcss/blob/main/docs/plugins.md
[plugins list]: https://github.com/postcss/postcss/blob/main/docs/plugins.md


### Solve Global CSS Problem
Expand Down Expand Up @@ -202,7 +200,7 @@ You can start using PostCSS in just two steps:
1. Find and add PostCSS extensions for your build tool.
2. [Select plugins] and add them to your PostCSS process.

[Select plugins]: https://www.postcss.parts/
[Select plugins]: https://postcss.org/docs/postcss-plugins


### CSS-in-JS
Expand Down
5 changes: 2 additions & 3 deletions docs/README-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ PostCSS 插件),请联系 [Evil Martians](https://evilmartians.com/?utm_sou

## 插件

截止到目前,PostCSS 有 200 多个插件。你可以在 [插件列表] [搜索目录] 找到它们。
截止到目前,PostCSS 有 200 多个插件。你可以在 [插件列表] 找到它们。
下方的列表是我们最喜欢的插件 - 它们很好地演示了我们可以用 PostCSS 做些什么。

如果你有任何新的想法,[开发 PostCSS 插件] 非常简单易上手。

[搜索目录]: http://postcss.parts
[插件列表]: https://github.com/postcss/postcss/blob/main/docs/plugins.md

### 解决全局 CSS 的问题
Expand Down Expand Up @@ -158,7 +157,7 @@ PostCSS 可以转化样式到任意语法,不仅仅是 CSS。
1. 在你的构建工具中查找并添加 PostCSS 拓展。
2. [选择插件]并将它们添加到你的 PostCSS 处理队列中。

[选择插件]: http://postcss.parts
[选择插件]: https://postcss.org/docs/postcss-plugins

### CSS-in-JS

Expand Down
46 changes: 23 additions & 23 deletions lib/at-rule.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,6 @@ declare namespace AtRule {
* ```
*/
declare class AtRule_ extends Container {
/**
* The at-rule’s name immediately follows the `@`.
*
* ```js
* const root = postcss.parse('@media print {}')
* const media = root.first
* media.name //=> 'media'
* ```
*/
get name(): string
set name(value: string)

/**
* An array containing the layer’s children.
*
Expand All @@ -110,6 +98,29 @@ declare class AtRule_ extends Container {
* ```
*/
nodes: Container['nodes']
parent: ContainerWithChildren | undefined

raws: AtRule.AtRuleRaws
type: 'atrule'
constructor(defaults?: AtRule.AtRuleProps)
assign(overrides: AtRule.AtRuleProps | object): this

clone(overrides?: Partial<AtRule.AtRuleProps>): this

cloneAfter(overrides?: Partial<AtRule.AtRuleProps>): this

cloneBefore(overrides?: Partial<AtRule.AtRuleProps>): this
/**
* The at-rule’s name immediately follows the `@`.
*
* ```js
* const root = postcss.parse('@media print {}')
* const media = root.first
* media.name //=> 'media'
* ```
*/
get name(): string
set name(value: string)
/**
* The at-rule’s parameters, the values that follow the at-rule’s name
* but precede any `{}` block.
Expand All @@ -122,17 +133,6 @@ declare class AtRule_ extends Container {
*/
get params(): string
set params(value: string)
parent: ContainerWithChildren | undefined

raws: AtRule.AtRuleRaws

type: 'atrule'

constructor(defaults?: AtRule.AtRuleProps)
assign(overrides: AtRule.AtRuleProps | object): this
clone(overrides?: Partial<AtRule.AtRuleProps>): this
cloneAfter(overrides?: Partial<AtRule.AtRuleProps>): this
cloneBefore(overrides?: Partial<AtRule.AtRuleProps>): this
}

declare class AtRule extends AtRule_ {}
Expand Down
14 changes: 7 additions & 7 deletions lib/comment.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,19 @@ declare namespace Comment {
declare class Comment_ extends Node {
parent: Container | undefined
raws: Comment.CommentRaws
/**
* The comment's text.
*/
get text(): string
set text(value: string)

type: 'comment'

constructor(defaults?: Comment.CommentProps)

assign(overrides: Comment.CommentProps | object): this

clone(overrides?: Partial<Comment.CommentProps>): this
cloneAfter(overrides?: Partial<Comment.CommentProps>): this
cloneBefore(overrides?: Partial<Comment.CommentProps>): this
/**
* The comment's text.
*/
get text(): string
set text(value: string)
}

declare class Comment extends Comment_ {}
Expand Down
31 changes: 15 additions & 16 deletions lib/declaration.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,19 @@ declare namespace Declaration {
* ```
*/
declare class Declaration_ extends Node {
parent: ContainerWithChildren | undefined
raws: Declaration.DeclarationRaws

type: 'decl'

constructor(defaults?: Declaration.DeclarationProps)
assign(overrides: Declaration.DeclarationProps | object): this

clone(overrides?: Partial<Declaration.DeclarationProps>): this

cloneAfter(overrides?: Partial<Declaration.DeclarationProps>): this

cloneBefore(overrides?: Partial<Declaration.DeclarationProps>): this
/**
* It represents a specificity of the declaration.
*
Expand All @@ -78,10 +91,8 @@ declare class Declaration_ extends Node {
* ```
*/
get important(): boolean
set important(value: boolean)

parent: ContainerWithChildren | undefined

set important(value: boolean)
/**
* The property name for a CSS declaration.
*
Expand All @@ -93,12 +104,8 @@ declare class Declaration_ extends Node {
* ```
*/
get prop(): string
set prop(value: string)

raws: Declaration.DeclarationRaws

type: 'decl'

set prop(value: string)
/**
* The property value for a CSS declaration.
*
Expand All @@ -118,7 +125,6 @@ declare class Declaration_ extends Node {
*/
get value(): string
set value(value: string)

/**
* It represents a getter that returns `true` if a declaration starts with
* `--` or `$`, which are used to declare variables in CSS and SASS/SCSS.
Expand All @@ -138,13 +144,6 @@ declare class Declaration_ extends Node {
* ```
*/
get variable(): boolean
set varaible(value: string)

constructor(defaults?: Declaration.DeclarationProps)
assign(overrides: Declaration.DeclarationProps | object): this
clone(overrides?: Partial<Declaration.DeclarationProps>): this
cloneAfter(overrides?: Partial<Declaration.DeclarationProps>): this
cloneBefore(overrides?: Partial<Declaration.DeclarationProps>): this
}

declare class Declaration extends Declaration_ {}
Expand Down
1 change: 0 additions & 1 deletion lib/list.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ declare namespace list {
}
}

// eslint-disable-next-line @typescript-eslint/no-redeclare
declare const list: list.List

export = list
5 changes: 1 addition & 4 deletions lib/postcss.d.mts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ export {
plugin,
parse,
list,

document,
comment,
atRule,
rule,
decl,
root,

CssSyntaxError,
Declaration,
Container,
Expand Down Expand Up @@ -67,6 +65,5 @@ export {
WarningOptions,

// This is a class, but it’s not re-exported. That’s why it’s exported as type-only here.
type LazyResult,

type LazyResult
} from './postcss.js'
19 changes: 14 additions & 5 deletions lib/postcss.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,22 @@ type DocumentProcessor = (
document: Document,
helper: postcss.Helpers
) => Promise<void> | void
type RootProcessor = (root: Root, helper: postcss.Helpers) => Promise<void> | void
type RootProcessor = (
root: Root,
helper: postcss.Helpers
) => Promise<void> | void
type DeclarationProcessor = (
decl: Declaration,
helper: postcss.Helpers
) => Promise<void> | void
type RuleProcessor = (rule: Rule, helper: postcss.Helpers) => Promise<void> | void
type AtRuleProcessor = (atRule: AtRule, helper: postcss.Helpers) => Promise<void> | void
type RuleProcessor = (
rule: Rule,
helper: postcss.Helpers
) => Promise<void> | void
type AtRuleProcessor = (
atRule: AtRule,
helper: postcss.Helpers
) => Promise<void> | void
type CommentProcessor = (
comment: Comment,
helper: postcss.Helpers
Expand Down Expand Up @@ -176,9 +185,9 @@ declare namespace postcss {
WarningOptions
}

export type SourceMap = SourceMapGenerator & {
export type SourceMap = {
toJSON(): RawSourceMap
}
} & SourceMapGenerator

export type Helpers = { postcss: Postcss; result: Result } & Postcss

Expand Down
1 change: 0 additions & 1 deletion lib/result.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ declare namespace Result {
plugin?: string
}


// eslint-disable-next-line @typescript-eslint/no-use-before-define
export { Result_ as default }
}
Expand Down
22 changes: 11 additions & 11 deletions lib/rule.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ declare class Rule_ extends Container {
nodes: NonNullable<Container['nodes']>
parent: ContainerWithChildren | undefined
raws: Rule.RuleRaws
type: 'rule'
constructor(defaults?: Rule.RuleProps)

assign(overrides: object | Rule.RuleProps): this
clone(overrides?: Partial<Rule.RuleProps>): this

cloneAfter(overrides?: Partial<Rule.RuleProps>): this

cloneBefore(overrides?: Partial<Rule.RuleProps>): this
/**
* The rule’s full selector represented as a string.
*
Expand All @@ -92,8 +101,7 @@ declare class Rule_ extends Container {
* ```
*/
get selector(): string
set selector(value: string);

set selector(value: string)
/**
* An array containing the rule’s individual selectors.
* Groups of selectors are split at commas.
Expand All @@ -110,15 +118,7 @@ declare class Rule_ extends Container {
* ```
*/
get selectors(): string[]
set selectors(values: string[]);

type: 'rule'

constructor(defaults?: Rule.RuleProps)
assign(overrides: object | Rule.RuleProps): this
clone(overrides?: Partial<Rule.RuleProps>): this
cloneAfter(overrides?: Partial<Rule.RuleProps>): this
cloneBefore(overrides?: Partial<Rule.RuleProps>): this
set selectors(values: string[])
}

declare class Rule extends Rule_ {}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@
"devDependencies": {
"@logux/eslint-config": "^53.2.1",
"@size-limit/preset-small-lib": "^11.1.4",
"@types/node": "^20.14.12",
"@types/node": "^22.0.0",
"c8": "^10.1.2",
"check-dts": "^0.8.0",
"clean-publish": "^5.0.0",
"concat-with-sourcemaps": "^1.1.0",
"eslint": "^9.7.0",
"eslint": "^9.8.0",
"nanodelay": "^1.0.8",
"nanospy": "^1.0.0",
"postcss-parser-tests": "^8.8.0",
Expand Down
Loading

0 comments on commit 3707c3b

Please sign in to comment.