Skip to content

Commit fee53e4

Browse files
committed
Update TS types
1 parent 6f71ef5 commit fee53e4

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

node/ast.d.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ export type Rule<D = Declaration, M = MediaQuery> = | {
8181
type: "container";
8282
value: ContainerRule<D, M>;
8383
}
84+
| {
85+
type: "scope";
86+
value: ScopeRule<D, M>;
87+
}
8488
| {
8589
type: "starting-style";
8690
value: StartingStyleRule<D, M>;
@@ -9125,6 +9129,29 @@ export interface ContainerRule<D = Declaration, M = MediaQuery> {
91259129
*/
91269130
rules: Rule<D, M>[];
91279131
}
9132+
/**
9133+
* A [@scope](https://drafts.csswg.org/css-cascade-6/#scope-atrule) rule.
9134+
*
9135+
* @scope (<scope-start>) [to (<scope-end>)]? { <stylesheet> }
9136+
*/
9137+
export interface ScopeRule<D = Declaration, M = MediaQuery> {
9138+
/**
9139+
* The location of the rule in the source file.
9140+
*/
9141+
loc: Location;
9142+
/**
9143+
* Nested rules within the `@scope` rule.
9144+
*/
9145+
rules: Rule<D, M>[];
9146+
/**
9147+
* A selector list used to identify any scoping limits.
9148+
*/
9149+
scopeEnd?: SelectorList | null;
9150+
/**
9151+
* A selector list used to identify the scoping root(s).
9152+
*/
9153+
scopeStart?: SelectorList | null;
9154+
}
91289155
/**
91299156
* A [@starting-style](https://drafts.csswg.org/css-transitions-2/#defining-before-change-style-the-starting-style-rule) rule.
91309157
*/

node/index.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,6 @@ export interface Resolver {
259259
}
260260

261261
export interface Drafts {
262-
/** Whether to enable CSS nesting. */
263-
nesting?: boolean,
264262
/** Whether to enable @custom-media rules. */
265263
customMedia?: boolean
266264
}

src/rules/scope.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ use crate::visitor::Visit;
1717
/// }
1818
#[derive(Debug, PartialEq, Clone)]
1919
#[cfg_attr(feature = "visitor", derive(Visit))]
20-
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
20+
#[cfg_attr(
21+
feature = "serde",
22+
derive(serde::Serialize, serde::Deserialize),
23+
serde(rename_all = "camelCase")
24+
)]
2125
#[cfg_attr(feature = "jsonschema", derive(schemars::JsonSchema))]
2226
pub struct ScopeRule<'i, R = DefaultAtRule> {
2327
/// A selector list used to identify the scoping root(s).

0 commit comments

Comments
 (0)