11import { substituteAtApply } from '../apply'
2- import { atRule , decl , styleRule , type AstNode } from '../ast'
2+ import { atRule , decl , rule , styleRule , type AstNode } from '../ast'
33import type { Candidate , CandidateModifier , NamedUtilityValue } from '../candidate'
44import { substituteFunctions } from '../css-functions'
55import * as CSS from '../css-parser'
@@ -432,11 +432,7 @@ export function objectToAst(rules: CssInJs | CssInJs[]): AstNode[] {
432432 for ( let [ name , value ] of entries ) {
433433 if ( typeof value !== 'object' ) {
434434 if ( ! name . startsWith ( '--' ) && value === '@slot' ) {
435- if ( name [ 0 ] === '@' ) {
436- ast . push ( CSS . parseAtRule ( name , [ atRule ( 'slot' ) ] ) )
437- } else {
438- ast . push ( styleRule ( name , [ atRule ( 'slot' ) ] ) )
439- }
435+ ast . push ( rule ( name , [ atRule ( 'slot' ) ] ) )
440436 } else {
441437 // Convert camelCase to kebab-case:
442438 // https://github.com/postcss/postcss-js/blob/b3db658b932b42f6ac14ca0b1d50f50c4569805b/parser.js#L30-L35
@@ -449,19 +445,11 @@ export function objectToAst(rules: CssInJs | CssInJs[]): AstNode[] {
449445 if ( typeof item === 'string' ) {
450446 ast . push ( decl ( name , item ) )
451447 } else {
452- if ( name [ 0 ] === '@' ) {
453- ast . push ( CSS . parseAtRule ( name , objectToAst ( item ) ) )
454- } else {
455- ast . push ( styleRule ( name , objectToAst ( item ) ) )
456- }
448+ ast . push ( rule ( name , objectToAst ( item ) ) )
457449 }
458450 }
459451 } else if ( value !== null ) {
460- if ( name [ 0 ] === '@' ) {
461- ast . push ( CSS . parseAtRule ( name , objectToAst ( value ) ) )
462- } else {
463- ast . push ( styleRule ( name , objectToAst ( value ) ) )
464- }
452+ ast . push ( rule ( name , objectToAst ( value ) ) )
465453 }
466454 }
467455
0 commit comments