Skip to content
Closed
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
4 changes: 4 additions & 0 deletions packages/css-syntax-patches-for-csstree/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes to CSS Syntax Patches For CSSTree

### Unreleased (patch)

- Fixed missing `container-query` type definition in patch output

### 1.1.3

_April 12, 2026_
Expand Down
1 change: 1 addition & 0 deletions packages/css-syntax-patches-for-csstree/dist/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@
"types": {
"dashed-ident": "<custom-property-name>",
"unicode-range-token": "<urange>",
"container-query": "not <query-in-parens> | <query-in-parens> [ [ and <query-in-parens> ]* | [ or <query-in-parens> ]* ]",
"alpha()": "alpha( [ from <color> ] [ / [ <alpha-value> | alpha | none ] ]? )",
"an+b": "odd | even | <integer> | <n-dimension> | '+'? n | -n | <ndashdigit-dimension> | '+'? <ndashdigit-ident> | <dashndashdigit-ident> | <n-dimension> <signed-integer> | '+'? n <signed-integer> | -n <signed-integer> | <ndash-dimension> <signless-integer> | '+'? n- <signless-integer> | -n- <signless-integer> | <n-dimension> [ '+' | '-' ] <signless-integer> | '+'? n [ '+' | '-' ] <signless-integer> | -n [ '+' | '-' ] <signless-integer>",
"anchored-feature": "fallback : <'position-try-fallbacks'>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export function apply_patches(patches, onto) {
// Manual patches to smooth over compat between csstree and webref/css
types['dashed-ident'] = '<custom-property-name>';
types['unicode-range-token'] = '<urange>';
types['container-query'] = 'not <query-in-parens> | <query-in-parens> [ [ and <query-in-parens> ]* | [ or <query-in-parens> ]* ]';

for (const [name, definition] of Object.entries(onto.types)) {
const patch = patches.types[name];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import fs from 'node:fs/promises';
import path from 'path';
import { fork, parse } from 'css-tree';

const patches = JSON.parse(await fs.readFile(path.join('dist', 'index.json'), 'utf-8')).next;

test('container-query type is defined in patch output', () => {
assert.ok(
patches.types['container-query'],
'container-query must be in patch output because container-condition and query-in-parens reference it',
);
});

test('@container prelude validates without error', () => {
const forkedLexer = fork({
atrules: patches.atrules,
properties: patches.properties,
types: patches.types,
}).lexer;

const prelude = parse('(min-width: 768px)', { context: 'atrulePrelude', atrule: 'container' });
const result = forkedLexer.matchAtrulePrelude('container', prelude);
assert.equal(result.error, null, `should validate @container prelude, got: ${result.error?.message}`);
});