Skip to content
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
5 changes: 4 additions & 1 deletion src/css-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,10 @@ export class CSSNode {
this.index = index
}

/** Get the arena (for internal/advanced use only) */
/**
* @internal
* Get the arena (for internal/advanced use only)
*/
__get_arena(): CSSDataArena {
return this.arena
}
Expand Down
8 changes: 6 additions & 2 deletions src/parse-atrule-prelude.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,7 @@ describe('At-Rule Prelude Nodes', () => {
expect(children.some((c) => c.type === SUPPORTS_QUERY)).toBe(true)

const query = children.find((c) => c.type === SUPPORTS_QUERY)
expect(query?.value).toContain('display')
expect(query?.value).toContain('flex')
expect(query?.value).toContain('display: flex')
})

it('should trim whitespace and comments from supports queries', () => {
Expand Down Expand Up @@ -560,7 +559,9 @@ describe('At-Rule Prelude Nodes', () => {
const children = atRule?.children.filter((c) => c.type !== BLOCK) || []
expect(children.length).toBe(1)
expect(children[0].type).toBe(LAYER_NAME)
expect(children[0].type_name).toBe('Layer')
expect(children[0].text).toBe('base')
expect(children[0].value).toBe('base')
})

it('should parse comma-separated layer names', () => {
Expand All @@ -573,12 +574,15 @@ describe('At-Rule Prelude Nodes', () => {

expect(children[0].type).toBe(LAYER_NAME)
expect(children[0].text).toBe('base')
expect(children[0].value).toBe('base')

expect(children[1].type).toBe(LAYER_NAME)
expect(children[1].text).toBe('components')
expect(children[1].value).toBe('components')

expect(children[2].type).toBe(LAYER_NAME)
expect(children[2].text).toBe('utilities')
expect(children[2].value).toBe('utilities')
})
})

Expand Down
3 changes: 3 additions & 0 deletions src/parse-atrule-prelude.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,9 @@ export class AtRulePreludeParser {
if (token_type === TOKEN_IDENT) {
// Layer name
let layer = this.create_node(LAYER_NAME, this.lexer.token_start, this.lexer.token_end)
// Set value to the layer name text (same as the full node text)
this.arena.set_value_start_delta(layer, 0)
this.arena.set_value_length(layer, this.lexer.token_end - this.lexer.token_start)
nodes.push(layer)
} else if (token_type === TOKEN_COMMA) {
// Skip comma separator
Expand Down